Search in sources :

Example 1 with SolrIndexConfig

use of org.apache.solr.update.SolrIndexConfig in project lucene-solr by apache.

the class TestConfig method testSanityCheckTestSysPropsAreUsed.

// sanity check that sys propertis are working as expected
public void testSanityCheckTestSysPropsAreUsed() throws Exception {
    SolrConfig sc = new SolrConfig(new SolrResourceLoader(TEST_PATH().resolve("collection1")), "solrconfig-basic.xml", null);
    SolrIndexConfig sic = sc.indexConfig;
    assertEquals("ramBufferSizeMB sysprop", Double.parseDouble(System.getProperty("solr.tests.ramBufferSizeMB")), sic.ramBufferSizeMB, 0.0D);
    assertEquals("useCompoundFile sysprop", Boolean.parseBoolean(System.getProperty("useCompoundFile")), sic.useCompoundFile);
}
Also used : SolrIndexConfig(org.apache.solr.update.SolrIndexConfig)

Example 2 with SolrIndexConfig

use of org.apache.solr.update.SolrIndexConfig in project lucene-solr by apache.

the class TestConfig method testDefaults.

// If defaults change, add test methods to cover each version
@Test
public void testDefaults() throws Exception {
    int numDefaultsTested = 0;
    int numNullDefaults = 0;
    SolrConfig sc = new SolrConfig(new SolrResourceLoader(TEST_PATH().resolve("collection1")), "solrconfig-defaults.xml", null);
    SolrIndexConfig sic = sc.indexConfig;
    ++numDefaultsTested;
    assertEquals("default useCompoundFile", false, sic.useCompoundFile);
    ++numDefaultsTested;
    assertEquals("default maxBufferedDocs", -1, sic.maxBufferedDocs);
    ++numDefaultsTested;
    assertEquals("default ramBufferSizeMB", 100.0D, sic.ramBufferSizeMB, 0.0D);
    ++numDefaultsTested;
    assertEquals("default writeLockTimeout", -1, sic.writeLockTimeout);
    ++numDefaultsTested;
    assertEquals("default LockType", DirectoryFactory.LOCK_TYPE_NATIVE, sic.lockType);
    ++numDefaultsTested;
    assertEquals("default infoStream", InfoStream.NO_OUTPUT, sic.infoStream);
    ++numDefaultsTested;
    assertNotNull("default metrics", sic.metricsInfo);
    ++numDefaultsTested;
    ++numNullDefaults;
    assertNull("default mergePolicyFactoryInfo", sic.mergePolicyFactoryInfo);
    ++numDefaultsTested;
    ++numNullDefaults;
    assertNull("default mergeSchedulerInfo", sic.mergeSchedulerInfo);
    ++numDefaultsTested;
    ++numNullDefaults;
    assertNull("default mergedSegmentWarmerInfo", sic.mergedSegmentWarmerInfo);
    IndexSchema indexSchema = IndexSchemaFactory.buildIndexSchema("schema.xml", solrConfig);
    IndexWriterConfig iwc = sic.toIndexWriterConfig(h.getCore());
    assertNotNull("null mp", iwc.getMergePolicy());
    assertTrue("mp is not TieredMergePolicy", iwc.getMergePolicy() instanceof TieredMergePolicy);
    assertNotNull("null ms", iwc.getMergeScheduler());
    assertTrue("ms is not CMS", iwc.getMergeScheduler() instanceof ConcurrentMergeScheduler);
    assertNull("non-null mergedSegmentWarmer", iwc.getMergedSegmentWarmer());
    final int numDefaultsMapped = sic.toMap(new LinkedHashMap<>()).size();
    assertEquals("numDefaultsTested vs. numDefaultsMapped+numNullDefaults =" + sic.toMap(new LinkedHashMap<>()).keySet(), numDefaultsTested, numDefaultsMapped + numNullDefaults);
}
Also used : TieredMergePolicy(org.apache.lucene.index.TieredMergePolicy) SolrIndexConfig(org.apache.solr.update.SolrIndexConfig) IndexSchema(org.apache.solr.schema.IndexSchema) ConcurrentMergeScheduler(org.apache.lucene.index.ConcurrentMergeScheduler) IndexWriterConfig(org.apache.lucene.index.IndexWriterConfig) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test)

Aggregations

SolrIndexConfig (org.apache.solr.update.SolrIndexConfig)2 LinkedHashMap (java.util.LinkedHashMap)1 ConcurrentMergeScheduler (org.apache.lucene.index.ConcurrentMergeScheduler)1 IndexWriterConfig (org.apache.lucene.index.IndexWriterConfig)1 TieredMergePolicy (org.apache.lucene.index.TieredMergePolicy)1 IndexSchema (org.apache.solr.schema.IndexSchema)1 Test (org.junit.Test)1