mirror of https://github.com/apache/lucene.git
SOLR-4952: make TestConfig use solrconfig.snippet.randomindexconfig.xml - this involved moving some 'default' tests arround, prunning down solrconfig-termindex.xml, and renaming solrconfig-termindex.xml -> solrconfig-test-misc.xml since the mane 'termindex' made no sense for what it is used for
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1513312 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7ed9edb532
commit
a0ab76a95c
solr/core/src
|
@ -17,38 +17,31 @@
|
|||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- used by TestConfig to tests a few misc things relating to:
|
||||
* lib dirs
|
||||
* property substitution
|
||||
* "gettableFiles" option
|
||||
-->
|
||||
<config>
|
||||
<luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
|
||||
<xi:include href="solrconfig.snippet.randomindexconfig.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
|
||||
|
||||
<!-- see TestConfig.testAutomaticDeprecationSupport -->
|
||||
<admin>
|
||||
<defaultQuery>solr</defaultQuery>
|
||||
<gettableFiles>solrconfig.xml schema.xml admin-extra.html</gettableFiles>
|
||||
</admin>
|
||||
|
||||
<!-- see TestConfig.testLib() -->
|
||||
<lib dir="../../lib-dirs/a" />
|
||||
<lib dir="../../lib-dirs/b" regex="b." />
|
||||
<lib dir="../../lib-dirs/c" regex="c1" />
|
||||
<lib path="../../lib-dirs/d/d1/" />
|
||||
|
||||
<!-- The DirectoryFactory to use for indexes.
|
||||
solr.StandardDirectoryFactory, the default, is filesystem based.
|
||||
solr.RAMDirectoryFactory is memory based and not persistent. -->
|
||||
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
|
||||
|
||||
<indexConfig>
|
||||
<useCompoundFile>${useCompoundFile:false}</useCompoundFile>
|
||||
<mergePolicy class="org.apache.lucene.index.TieredMergePolicy"/>
|
||||
<mergeScheduler class="org.apache.lucene.index.ConcurrentMergeScheduler"/>
|
||||
</indexConfig>
|
||||
|
||||
<updateHandler class="solr.DirectUpdateHandler2">
|
||||
</updateHandler>
|
||||
|
||||
<indexReaderFactory name="IndexReaderFactory" class="org.apache.solr.core.StandardIndexReaderFactory"/>
|
||||
|
||||
<requestHandler name="standard" class="solr.StandardRequestHandler"></requestHandler>
|
||||
|
||||
<admin>
|
||||
<defaultQuery>solr</defaultQuery>
|
||||
<gettableFiles>solrconfig.xml schema.xml admin-extra.html</gettableFiles>
|
||||
</admin>
|
||||
|
||||
<!-- test getting system property -->
|
||||
<!-- see TestConfig.testJavaProperty -->
|
||||
<propTest attr1="${solr.test.sys.prop1}-$${literal}"
|
||||
attr2="${non.existent.sys.prop:default-from-config}">prefix-${solr.test.sys.prop2}-suffix</propTest>
|
||||
|
|
@ -18,12 +18,16 @@
|
|||
package org.apache.solr.core;
|
||||
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.apache.lucene.index.IndexWriterConfig;
|
||||
import org.apache.lucene.index.TieredMergePolicy;
|
||||
import org.apache.lucene.index.ConcurrentMergeScheduler;
|
||||
import org.apache.solr.SolrTestCaseJ4;
|
||||
import org.apache.solr.handler.admin.ShowFileRequestHandler;
|
||||
import org.apache.solr.update.DirectUpdateHandler2;
|
||||
import org.apache.solr.update.SolrIndexConfig;
|
||||
import org.apache.solr.util.RefCounted;
|
||||
import org.apache.solr.schema.IndexSchema;
|
||||
import org.apache.solr.schema.IndexSchemaFactory;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.w3c.dom.Node;
|
||||
|
@ -38,7 +42,7 @@ public class TestConfig extends SolrTestCaseJ4 {
|
|||
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
initCore("solrconfig-termindex.xml","schema-reversed.xml");
|
||||
initCore("solrconfig-test-misc.xml","schema-reversed.xml");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -91,16 +95,6 @@ public class TestConfig extends SolrTestCaseJ4 {
|
|||
assertEquals("prefix-proptwo-suffix", node.getTextContent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLucene23Upgrades() throws Exception {
|
||||
double bufferSize = solrConfig.indexConfig.ramBufferSizeMB;
|
||||
assertTrue(bufferSize + " does not equal: " + 100, bufferSize == 100);
|
||||
String mergePolicy = solrConfig.indexConfig.mergePolicyInfo.className;
|
||||
assertEquals(TieredMergePolicy.class.getName(), mergePolicy);
|
||||
String mergeSched = solrConfig.indexConfig.mergeSchedulerInfo.className;
|
||||
assertTrue(mergeSched + " is not equal to " + SolrIndexConfig.DEFAULT_MERGE_SCHEDULER_CLASSNAME, mergeSched.equals(SolrIndexConfig.DEFAULT_MERGE_SCHEDULER_CLASSNAME) == true);
|
||||
}
|
||||
|
||||
// sometime if the config referes to old things, it must be replaced with new stuff
|
||||
@Test
|
||||
public void testAutomaticDeprecationSupport() {
|
||||
|
@ -124,6 +118,14 @@ public class TestConfig extends SolrTestCaseJ4 {
|
|||
assertEquals("default LockType", SolrIndexConfig.LOCK_TYPE_NATIVE, sic.lockType);
|
||||
assertEquals("default useCompoundFile", false, sic.useCompoundFile);
|
||||
|
||||
IndexSchema indexSchema = IndexSchemaFactory.buildIndexSchema("schema.xml", solrConfig);
|
||||
IndexWriterConfig iwc = sic.toIndexWriterConfig(indexSchema);
|
||||
|
||||
assertNotNull("null mp", iwc.getMergePolicy());
|
||||
assertTrue("mp is not TMP", iwc.getMergePolicy() instanceof TieredMergePolicy);
|
||||
|
||||
assertNotNull("null ms", iwc.getMergeScheduler());
|
||||
assertTrue("ms is not CMS", iwc.getMergeScheduler() instanceof ConcurrentMergeScheduler);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue