Apache Solr open-source search software
SOLR-8504: (IndexSchema|SolrIndexConfig)Test: private static finals for solrconfig.xml and schema.xml String literals
Christine Poerschke6ad14b34ddb5
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 335c288fe88..8919712936e 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -448,6 +448,9 @@ Other Changes* SOLR-8484: refactor update/SolrIndexConfig.LOCK_TYPE_* into core/DirectoryFactory.LOCK_TYPE_*(Christine Poerschke)+* SOLR-8504: (IndexSchema|SolrIndexConfig)Test: private static finals for+ solrconfig.xml and schema.xml String literals. (Christine Poerschke)+================== 5.4.0 ==================Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this releasediff --git a/solr/core/src/test/org/apache/solr/schema/IndexSchemaTest.java b/solr/core/src/test/org/apache/solr/schema/IndexSchemaTest.javaindex f654da58706..e6a7d9a70a3 100644--- a/solr/core/src/test/org/apache/solr/schema/IndexSchemaTest.java+++ b/solr/core/src/test/org/apache/solr/schema/IndexSchemaTest.java@@ -31,9 +31,13 @@ import java.util.Map;public class IndexSchemaTest extends SolrTestCaseJ4 {++ final private static String solrConfigFileName = "solrconfig.xml";+ final private static String schemaFileName = "schema.xml";+@BeforeClasspublic static void beforeClass() throws Exception {- initCore("solrconfig.xml","schema.xml");+ initCore(solrConfigFileName, schemaFileName);}/**diff --git a/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java b/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.javaindex 59672802bed..d444700d03a 100644--- a/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java+++ b/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java@@ -40,21 +40,25 @@ import org.junit.Test;*/public class SolrIndexConfigTest extends SolrTestCaseJ4 {+ private static final String solrConfigFileName = "solrconfig.xml";+ private static final String solrConfigFileNameWarmer = "solrconfig-warmer.xml";+ private static final String solrConfigFileNameTieredMergePolicy = "solrconfig-tieredmergepolicy.xml";++ private static final String schemaFileName = "schema.xml";+@BeforeClasspublic static void beforeClass() throws Exception {- initCore("solrconfig.xml","schema.xml");+ initCore(solrConfigFileName,schemaFileName);}private final Path instanceDir = TEST_PATH().resolve("collection1");- private final String solrConfigFileNameWarmer = "solrconfig-warmer.xml";- private final String solrConfigFileNameTieredMergePolicy = "solrconfig-tieredmergepolicy.xml";@Testpublic void testFailingSolrIndexConfigCreation() {try {SolrConfig solrConfig = new SolrConfig("bad-mp-solrconfig.xml");SolrIndexConfig solrIndexConfig = new SolrIndexConfig(solrConfig, null, null);- IndexSchema indexSchema = IndexSchemaFactory.buildIndexSchema("schema.xml", solrConfig);+ IndexSchema indexSchema = IndexSchemaFactory.buildIndexSchema(schemaFileName, solrConfig);h.getCore().setLatestSchema(indexSchema);solrIndexConfig.toIndexWriterConfig(h.getCore());fail("a mergePolicy should have an empty constructor in order to be instantiated in Solr thus this should fail ");@@ -69,7 +73,7 @@ public class SolrIndexConfigTest extends SolrTestCaseJ4 {SolrIndexConfig solrIndexConfig = new SolrIndexConfig(solrConfig, null,null);assertNotNull(solrIndexConfig);- IndexSchema indexSchema = IndexSchemaFactory.buildIndexSchema("schema.xml", solrConfig);+ IndexSchema indexSchema = IndexSchemaFactory.buildIndexSchema(schemaFileName, solrConfig);h.getCore().setLatestSchema(indexSchema);IndexWriterConfig iwc = solrIndexConfig.toIndexWriterConfig(h.getCore());@@ -95,7 +99,7 @@ public class SolrIndexConfigTest extends SolrTestCaseJ4 {assertNotNull(solrIndexConfig.mergedSegmentWarmerInfo);assertEquals(SimpleMergedSegmentWarmer.class.getName(),solrIndexConfig.mergedSegmentWarmerInfo.className);- IndexSchema indexSchema = IndexSchemaFactory.buildIndexSchema("schema.xml", solrConfig);+ IndexSchema indexSchema = IndexSchemaFactory.buildIndexSchema(schemaFileName, solrConfig);h.getCore().setLatestSchema(indexSchema);IndexWriterConfig iwc = solrIndexConfig.toIndexWriterConfig(h.getCore());assertEquals(SimpleMergedSegmentWarmer.class, iwc.getMergedSegmentWarmer().getClass());