Skip to content

Apache Lucene open-source search software

Kill IndexReaderFactoryTest: the only thing it asserts is a lie. Move that (fixed) assertion to AlternateDirectoryTest where it's already true.

Chris M. Hostetter1cd55ea23111
diff --git a/solr/core/src/test/org/apache/solr/core/AlternateDirectoryTest.java b/solr/core/src/test/org/apache/solr/core/AlternateDirectoryTest.java
index fec51e254ff..a46578dbea8 100644
--- a/solr/core/src/test/org/apache/solr/core/AlternateDirectoryTest.java
+++ b/solr/core/src/test/org/apache/solr/core/AlternateDirectoryTest.java
@@ -25,21 +25,29 @@ import org.apache.solr.SolrTestCaseJ4;
import org.junit.BeforeClass;
import org.junit.Test;
+/**
+ * test that configs can override the DirectoryFactory and
+ * IndexReaderFactory used in solr.
+ */
public class AlternateDirectoryTest extends SolrTestCaseJ4 {
@BeforeClass
public static void beforeClass() throws Exception {
initCore("solrconfig-altdirectory.xml", "schema.xml");
}
- /**
- * Simple test to ensure that alternate IndexReaderFactory is being used.
- */
- @Test
public void testAltDirectoryUsed() throws Exception {
assertQ(req("q","*:*","qt","standard"));
assertTrue(TestFSDirectoryFactory.openCalled);
assertTrue(TestIndexReaderFactory.newReaderCalled);
}
+
+ public void testAltReaderUsed() throws Exception {
+ IndexReaderFactory readerFactory = h.getCore().getIndexReaderFactory();
+ assertNotNull("Factory is null", readerFactory);
+ assertEquals("readerFactory is wrong class",
+ AlternateDirectoryTest.TestIndexReaderFactory.class.getName(),
+ readerFactory.getClass().getName());
+ }
static public class TestFSDirectoryFactory extends StandardDirectoryFactory {
public static volatile boolean openCalled = false;
diff --git a/solr/core/src/test/org/apache/solr/core/IndexReaderFactoryTest.java b/solr/core/src/test/org/apache/solr/core/IndexReaderFactoryTest.java
deleted file mode 100644
index 05645637efc..00000000000
--- a/solr/core/src/test/org/apache/solr/core/IndexReaderFactoryTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.apache.solr.core;
-/*
- * 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.
- */
-
-import org.apache.solr.util.AbstractSolrTestCase;
-import org.junit.BeforeClass;
-
-public class IndexReaderFactoryTest extends AbstractSolrTestCase {
-
- @BeforeClass
- public static void beforeClass() throws Exception {
- initCore("solrconfig-termindex.xml", "schema.xml");
- }
-
- /**
- * Simple test to ensure that alternate IndexReaderFactory is being used.
- */
- public void testAltReaderUsed() throws Exception {
- IndexReaderFactory readerFactory = h.getCore().getIndexReaderFactory();
- assertNotNull("Factory is null", readerFactory);
- assertTrue("readerFactory is not an instanceof " + AlternateDirectoryTest.TestIndexReaderFactory.class, readerFactory instanceof StandardIndexReaderFactory);
- }
-}
\ No newline at end of file