mirror of https://github.com/apache/lucene.git
SOLR-8712: Variable solr.core.instanceDir was not being resolved
This commit is contained in:
parent
9c97f2f3d2
commit
5c0240219a
|
@ -342,6 +342,9 @@ Bug Fixes
|
|||
<maxMergeDocs|mergeFactor> on their own or combined with <mergePolicy> is a warning.
|
||||
(Christine Poerschke, Shai Erera)
|
||||
|
||||
* SOLR-8712: Variable solr.core.instanceDir was not being resolved (Kristine
|
||||
Jetzke, Shawn Heisey, Alan Woodward)
|
||||
|
||||
======================= 5.5.0 =======================
|
||||
|
||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release
|
||||
|
|
|
@ -261,6 +261,7 @@ public class CoreDescriptor {
|
|||
propName = SOLR_CORE_PROP_PREFIX + propName;
|
||||
substitutableProperties.setProperty(propName, propValue);
|
||||
}
|
||||
substitutableProperties.setProperty("solr.core.instanceDir", instanceDir.toAbsolutePath().toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,32 +16,59 @@
|
|||
*/
|
||||
package org.apache.solr.core;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.solr.SolrTestCaseJ4;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TestImplicitCoreProperties extends SolrTestCaseJ4 {
|
||||
|
||||
private static CoreContainer cc;
|
||||
|
||||
@BeforeClass
|
||||
public static void setupContainer() {
|
||||
cc = createCoreContainer("collection1", "data", "solrconfig-implicitproperties.xml", "schema.xml");
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void teardownContainer() {
|
||||
if (cc != null)
|
||||
cc.shutdown();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testImplicitPropertiesAreSubstitutedInSolrConfig() {
|
||||
assertQ(req("q", "*:*")
|
||||
, "//str[@name='dummy1'][.='collection1']"
|
||||
, "//str[@name='dummy2'][.='data']"
|
||||
, "//str[@name='dummy3'][.='solrconfig-implicitproperties.xml']"
|
||||
, "//str[@name='dummy4'][.='schema.xml']"
|
||||
, "//str[@name='dummy5'][.='false']"
|
||||
);
|
||||
}
|
||||
|
||||
CoreContainer cc
|
||||
= createCoreContainer("collection1", "data", "solrconfig-implicitproperties.xml", "schema.xml");
|
||||
|
||||
try {
|
||||
assertQ(req("q", "*:*")
|
||||
, "//str[@name='dummy1'][.='collection1']"
|
||||
, "//str[@name='dummy2'][.='data']"
|
||||
, "//str[@name='dummy3'][.='solrconfig-implicitproperties.xml']"
|
||||
, "//str[@name='dummy4'][.='schema.xml']"
|
||||
, "//str[@name='dummy5'][.='false']"
|
||||
);
|
||||
// Test for SOLR-5279 - make sure properties are there on core reload
|
||||
cc.reload("collection1");
|
||||
}
|
||||
finally {
|
||||
cc.shutdown();
|
||||
}
|
||||
// SOLR-5279
|
||||
@Test
|
||||
public void testPropertiesArePersistedAcrossReload() {
|
||||
cc.reload("collection1");
|
||||
assertQ(req("q", "*:*")
|
||||
, "//str[@name='dummy1'][.='collection1']"
|
||||
, "//str[@name='dummy2'][.='data']"
|
||||
, "//str[@name='dummy3'][.='solrconfig-implicitproperties.xml']"
|
||||
, "//str[@name='dummy4'][.='schema.xml']"
|
||||
, "//str[@name='dummy5'][.='false']"
|
||||
);
|
||||
}
|
||||
|
||||
// SOLR-8712
|
||||
@Test
|
||||
public void testDefaultProperties() {
|
||||
Properties props = cc.getCoreDescriptor("collection1").getSubstitutableProperties();
|
||||
assertEquals("collection1", props.getProperty("solr.core.name"));
|
||||
assertTrue("solr.core.instanceDir not set correctly",
|
||||
props.getProperty("solr.core.instanceDir").contains("collection1"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue