Apache Lucene open-source search software
Remove stale BWC tests (#12874)
Simon Willnauerea327220a836
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.javaindex 09f4bca1759..25b7bb05841 100644--- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestBackwardsCompatibility.java@@ -2282,4 +2282,34 @@ public class TestBackwardsCompatibility extends LuceneTestCase {}}}++ public void testOpenModeAndCreatedVersion() throws IOException {+ for (String name : oldNames) {+ Directory dir = newDirectory(oldIndexDirs.get(name));+ for (OpenMode openMode : OpenMode.values()) {+ Directory tmpDir = newDirectory(dir);+ assertEquals(+ Version.LATEST.major - 1,+ SegmentInfos.readLatestCommit(tmpDir).getIndexCreatedVersionMajor());+ IndexWriter w = new IndexWriter(tmpDir, newIndexWriterConfig().setOpenMode(openMode));+ w.commit();+ w.close();+ switch (openMode) {+ case CREATE:+ assertEquals(+ Version.LATEST.major,+ SegmentInfos.readLatestCommit(tmpDir).getIndexCreatedVersionMajor());+ break;+ case APPEND:+ case CREATE_OR_APPEND:+ default:+ assertEquals(+ Version.LATEST.major - 1,+ SegmentInfos.readLatestCommit(tmpDir).getIndexCreatedVersionMajor());+ }+ tmpDir.close();+ }+ dir.close();+ }+ }}diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestIndexWriterOnOldIndex.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestIndexWriterOnOldIndex.javadeleted file mode 100644index 66fc4fdd891..00000000000--- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestIndexWriterOnOldIndex.java+++ /dev/null@@ -1,68 +0,0 @@-/*- * Licensed to the Apache Software Foundation (ASF) under one or more- * contributor license agreements. See the NOTICE file distributed with- * this work for additional information regarding copyright ownership.- * The ASF licenses this file to You under the Apache License, Version 2.0- * (the "License"); you may not use this file except in compliance with- * the License. You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package org.apache.lucene.backward_index;--import java.io.IOException;-import java.io.InputStream;-import java.nio.file.Path;-import org.apache.lucene.index.IndexWriter;-import org.apache.lucene.index.IndexWriterConfig.OpenMode;-import org.apache.lucene.index.SegmentInfos;-import org.apache.lucene.store.Directory;-import org.apache.lucene.tests.util.LuceneTestCase;-import org.apache.lucene.tests.util.TestUtil;-import org.apache.lucene.util.Version;--public class TestIndexWriterOnOldIndex extends LuceneTestCase {-- public void testOpenModeAndCreatedVersion() throws IOException {- assumeTrue("Reenable when 8.0 is released", false);- InputStream resource = getClass().getResourceAsStream("index.single-empty-doc.8.0.0.zip");- assertNotNull(resource);- Path path = createTempDir();- TestUtil.unzip(resource, path);- Directory dir = newFSDirectory(path);- for (OpenMode openMode : OpenMode.values()) {- Directory tmpDir = newDirectory(dir);- assertEquals(- 7- /** 7.0.0 */- ,- SegmentInfos.readLatestCommit(tmpDir).getIndexCreatedVersionMajor());- IndexWriter w = new IndexWriter(tmpDir, newIndexWriterConfig().setOpenMode(openMode));- w.commit();- w.close();- switch (openMode) {- case CREATE:- assertEquals(- Version.LATEST.major,- SegmentInfos.readLatestCommit(tmpDir).getIndexCreatedVersionMajor());- break;- case APPEND:- case CREATE_OR_APPEND:- default:- assertEquals(- 7- /** 7.0.0 */- ,- SegmentInfos.readLatestCommit(tmpDir).getIndexCreatedVersionMajor());- }- tmpDir.close();- }- dir.close();- }-}diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestManyPointsInOldIndex.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestManyPointsInOldIndex.javadeleted file mode 100644index 7cfe57ddba6..00000000000--- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_index/TestManyPointsInOldIndex.java+++ /dev/null@@ -1,77 +0,0 @@-/*- * Licensed to the Apache Software Foundation (ASF) under one or more- * contributor license agreements. See the NOTICE file distributed with- * this work for additional information regarding copyright ownership.- * The ASF licenses this file to You under the Apache License, Version 2.0- * (the "License"); you may not use this file except in compliance with- * the License. You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */-package org.apache.lucene.backward_index;--import java.io.IOException;-import java.io.InputStream;-import java.nio.file.Path;-import java.nio.file.Paths;-import org.apache.lucene.document.Document;-import org.apache.lucene.document.IntPoint;-import org.apache.lucene.index.CheckIndex;-import org.apache.lucene.index.IndexWriter;-import org.apache.lucene.index.IndexWriterConfig;-import org.apache.lucene.store.Directory;-import org.apache.lucene.store.FSDirectory;-import org.apache.lucene.tests.store.BaseDirectoryWrapper;-import org.apache.lucene.tests.util.LuceneTestCase;-import org.apache.lucene.tests.util.TestUtil;--// LUCENE-7501-public class TestManyPointsInOldIndex extends LuceneTestCase {-- // To regenerate the back index zip:- //- // Compile:- // 1) temporarily remove 'extends LuceneTestCase' above (else java doesn't see our static void- // main)- // 2) ant compile-test- //- // Run:- // 1) java -cp ../build/backward-codecs/classes/test:../build/core/classes/java- // org.apache.lucene.backward_index.TestManyPointsInOldIndex- //- // cd manypointsindex- // zip manypointsindex.zip *-- public static void main(String[] args) throws IOException {- Directory dir = FSDirectory.open(Paths.get("manypointsindex"));- IndexWriter w = new IndexWriter(dir, new IndexWriterConfig());- for (int i = 0; i < 1025; i++) {- Document doc = new Document();- doc.add(new IntPoint("intpoint", 1025 - i));- w.addDocument(doc);- }- w.close();- dir.close();- }-- public void testCheckOldIndex() throws IOException {- assumeTrue("Reenable when 7.0 is released", false);- Path path = createTempDir("manypointsindex");- InputStream resource = getClass().getResourceAsStream("manypointsindex.zip");- assertNotNull("manypointsindex not found", resource);- TestUtil.unzip(resource, path);- BaseDirectoryWrapper dir = newFSDirectory(path);- // disable default checking...- dir.setCheckIndexOnClose(false);-- // ... because we check ourselves here:- TestUtil.checkIndex(dir, CheckIndex.Level.MIN_LEVEL_FOR_INTEGRITY_CHECKS, true, true, null);- dir.close();- }-}