You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ro...@apache.org on 2016/02/27 11:20:25 UTC

lucene-solr git commit: SOLR-8712: Variable solr.core.instanceDir was not being resolved

Repository: lucene-solr
Updated Branches:
  refs/heads/master 9c97f2f3d -> 5c0240219


SOLR-8712: Variable solr.core.instanceDir was not being resolved


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/5c024021
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/5c024021
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/5c024021

Branch: refs/heads/master
Commit: 5c0240219a1450aab3d14067605bc35d0b6b3c0b
Parents: 9c97f2f
Author: Alan Woodward <ro...@apache.org>
Authored: Sat Feb 27 10:03:01 2016 +0000
Committer: Alan Woodward <ro...@apache.org>
Committed: Sat Feb 27 10:03:01 2016 +0000

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  3 +
 .../org/apache/solr/core/CoreDescriptor.java    |  1 +
 .../solr/core/TestImplicitCoreProperties.java   | 61 ++++++++++++++------
 3 files changed, 48 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5c024021/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 0d57b6d..db70d28 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -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

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5c024021/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java b/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java
index d2e9558..9545549 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreDescriptor.java
@@ -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());
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5c024021/solr/core/src/test/org/apache/solr/core/TestImplicitCoreProperties.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/core/TestImplicitCoreProperties.java b/solr/core/src/test/org/apache/solr/core/TestImplicitCoreProperties.java
index 3c3d61a..149d287 100644
--- a/solr/core/src/test/org/apache/solr/core/TestImplicitCoreProperties.java
+++ b/solr/core/src/test/org/apache/solr/core/TestImplicitCoreProperties.java
@@ -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"));
   }
 
 }