mirror of https://github.com/apache/lucene.git
SOLR-3137: test+fix
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1293415 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b54664047d
commit
51ca380dd8
|
@ -1131,21 +1131,22 @@ public class CoreContainer
|
|||
return;
|
||||
}
|
||||
|
||||
String attribValue = null;
|
||||
if (node != null) {
|
||||
String rawAttribValue = DOMUtil.getAttr(node, name, null);
|
||||
if (value == null) {
|
||||
coreAttribs.put(name, rawAttribValue);
|
||||
return;
|
||||
}
|
||||
if (rawAttribValue == null && defaultValue != null && value.equals(defaultValue)) return;
|
||||
if (rawAttribValue == null && defaultValue != null && value.equals(defaultValue)) {
|
||||
return;
|
||||
}
|
||||
if (rawAttribValue != null && value.equals(DOMUtil.substituteProperty(rawAttribValue, loader.getCoreProperties()))){
|
||||
attribValue = rawAttribValue;
|
||||
coreAttribs.put(name, rawAttribValue);
|
||||
} else {
|
||||
coreAttribs.put(name, value);
|
||||
}
|
||||
}
|
||||
if (attribValue != null) {
|
||||
coreAttribs.put(name, attribValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -328,7 +328,7 @@ public class DOMUtil {
|
|||
fragment = System.getProperty(propertyName, defaultValue);
|
||||
}
|
||||
if (fragment == null) {
|
||||
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "No system property or default value specified for " + propertyName);
|
||||
throw new SolrException( SolrException.ErrorCode.SERVER_ERROR, "No system property or default value specified for " + propertyName + " value:" + value);
|
||||
}
|
||||
}
|
||||
sb.append(fragment);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
limitations under the License.
|
||||
-->
|
||||
|
||||
<schema name="example core ${l10n}" version="1.1">
|
||||
<schema name="example core ${l10n:}" version="1.1">
|
||||
<types>
|
||||
<fieldtype name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
|
||||
<fieldType name="text-FR" class="solr.TextField" positionIncrementGap="100">
|
||||
|
@ -54,7 +54,7 @@
|
|||
<field name="id" type="string" indexed="true" stored="true" multiValued="false" required="true"/>
|
||||
<field name="type" type="string" indexed="true" stored="true" multiValued="false"/>
|
||||
<field name="name" type="string" indexed="true" stored="true" multiValued="false"/>
|
||||
<field name="${ctlField}" type="text-${l10n}" indexed="true" stored="true" multiValued="true"/>
|
||||
<field name="${ctlField:}" type="text-${l10n:EN}" indexed="true" stored="true" multiValued="true"/>
|
||||
</fields>
|
||||
|
||||
<!-- field to use to determine and enforce document uniqueness. -->
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
-->
|
||||
<config>
|
||||
<luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
|
||||
<dataDir>${solr.solr.home}/data/${l10n}-${version}</dataDir>
|
||||
<dataDir>${solr.solr.home}/data/${l10n:}-${version:}</dataDir>
|
||||
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
|
||||
|
||||
<updateHandler class="solr.DirectUpdateHandler2" />
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
If 'null' (or absent), cores will not be manageable via REST
|
||||
-->
|
||||
<cores adminPath="/admin/cores" defaultCoreName="core0" host="127.0.0.1" hostPort="${hostPort:8983}" hostContext="solr" zkClientTimeout="8000">
|
||||
<core name="collection1" instanceDir="." />
|
||||
<core name="core0" instanceDir="${theInstanceDir:./}" collection="${collection:acollection}">
|
||||
<property name="version" value="3.5"/>
|
||||
<property name="l10n" value="EN"/>
|
||||
|
|
|
@ -82,7 +82,7 @@ public class TestEmbeddedSolrServer extends LuceneTestCase {
|
|||
|
||||
EmbeddedSolrServer solrServer = getSolrCore0();
|
||||
|
||||
Assert.assertEquals(2, cores.getCores().size());
|
||||
Assert.assertEquals(3, cores.getCores().size());
|
||||
List<SolrCore> solrCores = new ArrayList<SolrCore>();
|
||||
for (SolrCore solrCore : cores.getCores()) {
|
||||
Assert.assertEquals(false, solrCore.isClosed());
|
||||
|
|
|
@ -244,6 +244,43 @@ public class TestSolrProperties extends LuceneTestCase {
|
|||
} finally {
|
||||
fis.close();
|
||||
}
|
||||
|
||||
coreadmin = getRenamedSolrAdmin();
|
||||
CoreAdminRequest.createCore("newCore", home.getAbsolutePath(), coreadmin);
|
||||
|
||||
// fis = new FileInputStream(new File(solrXml.getParent(), "solr-persist.xml"));
|
||||
// solrPersistXml = IOUtils.toString(fis);
|
||||
// System.out.println("xml:" + solrPersistXml);
|
||||
// fis.close();
|
||||
|
||||
mcr = CoreAdminRequest.persist("solr-persist.xml", getRenamedSolrAdmin());
|
||||
|
||||
// fis = new FileInputStream(new File(solrXml.getParent(), "solr-persist.xml"));
|
||||
// solrPersistXml = IOUtils.toString(fis);
|
||||
// System.out.println("xml:" + solrPersistXml);
|
||||
// fis.close();
|
||||
|
||||
fis = new FileInputStream(new File(solrXml.getParent(), "solr-persist.xml"));
|
||||
try {
|
||||
Document document = builder.parse(fis);
|
||||
assertTrue(exists("/solr/cores/core[@name='collection1' and @instanceDir='./']", document));
|
||||
} finally {
|
||||
fis.close();
|
||||
}
|
||||
|
||||
// test reload and parse
|
||||
cores.shutdown();
|
||||
|
||||
cores = new CoreContainer(home.getAbsolutePath(), new File(solrXml.getParent(), "solr-persist.xml"));
|
||||
|
||||
|
||||
mcr = CoreAdminRequest.persist("solr-persist.xml", getRenamedSolrAdmin());
|
||||
|
||||
// fis = new FileInputStream(new File(solrXml.getParent(),
|
||||
// "solr-persist.xml"));
|
||||
// solrPersistXml = IOUtils.toString(fis);
|
||||
// System.out.println("xml:" + solrPersistXml);
|
||||
// fis.close();
|
||||
}
|
||||
|
||||
public static boolean exists(String xpathStr, Node node)
|
||||
|
|
Loading…
Reference in New Issue