SOLR-8504: (IndexSchema|SolrIndexConfig)Test: private static finals for solrconfig.xml and schema.xml String literals

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1723687 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Christine Poerschke 2016-01-08 11:06:33 +00:00
parent 9bc5058f7d
commit 6ad14b34dd
3 changed files with 18 additions and 7 deletions

View File

@ -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 release

View File

@ -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";
@BeforeClass
public static void beforeClass() throws Exception {
initCore("solrconfig.xml","schema.xml");
initCore(solrConfigFileName, schemaFileName);
}
/**

View File

@ -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";
@BeforeClass
public 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";
@Test
public 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());