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 2015/11/30 15:27:42 UTC
svn commit: r1717260 [2/2] - in /lucene/dev/branches/branch_5x: ./ solr/
solr/contrib/ solr/contrib/map-reduce/src/java/org/apache/solr/hadoop/
solr/core/ solr/core/src/java/org/apache/solr/cloud/
solr/core/src/java/org/apache/solr/core/ solr/core/src/...
Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/core/TestLazyCores.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/core/TestLazyCores.java?rev=1717260&r1=1717259&r2=1717260&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/core/TestLazyCores.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/core/TestLazyCores.java Mon Nov 30 14:27:42 2015
@@ -49,8 +49,8 @@ public class TestLazyCores extends SolrT
private File solrHomeDirectory;
- private static CoreDescriptor makeCoreDescriptor(CoreContainer cc, String coreName, String instanceDir, String isTransient, String loadOnStartup) {
- return new CoreDescriptor(cc, coreName, instanceDir,
+ private static CoreDescriptor makeCoreDescriptor(CoreContainer cc, String coreName, String isTransient, String loadOnStartup) {
+ return new CoreDescriptor(cc, coreName, cc.getCoreRootDirectory().resolve(coreName),
CoreDescriptor.CORE_TRANSIENT, isTransient,
CoreDescriptor.CORE_LOADONSTARTUP, loadOnStartup);
}
@@ -59,15 +59,15 @@ public class TestLazyCores extends SolrT
@Override
public List<CoreDescriptor> discover(CoreContainer cc) {
return ImmutableList.of(
- new CoreDescriptor(cc, "collection1", "collection1"),
- makeCoreDescriptor(cc, "collectionLazy2", "collection2", "true", "true"),
- makeCoreDescriptor(cc, "collectionLazy3", "collection3", "on", "false"),
- makeCoreDescriptor(cc, "collectionLazy4", "collection4", "false", "false"),
- makeCoreDescriptor(cc, "collectionLazy5", "collection5", "false", "true"),
- makeCoreDescriptor(cc, "collectionLazy6", "collection6", "true", "false"),
- makeCoreDescriptor(cc, "collectionLazy7", "collection7", "true", "false"),
- makeCoreDescriptor(cc, "collectionLazy8", "collection8", "true", "false"),
- makeCoreDescriptor(cc, "collectionLazy9", "collection9", "true", "false")
+ makeCoreDescriptor(cc, "collection1", "false", "true"),
+ makeCoreDescriptor(cc, "collection2", "true", "true"),
+ makeCoreDescriptor(cc, "collection3", "on", "false"),
+ makeCoreDescriptor(cc, "collection4", "false", "false"),
+ makeCoreDescriptor(cc, "collection5", "false", "true"),
+ makeCoreDescriptor(cc, "collection6", "true", "false"),
+ makeCoreDescriptor(cc, "collection7", "true", "false"),
+ makeCoreDescriptor(cc, "collection8", "true", "false"),
+ makeCoreDescriptor(cc, "collection9", "true", "false")
);
}
};
@@ -91,28 +91,28 @@ public class TestLazyCores extends SolrT
try {
// NOTE: This checks the initial state for loading, no need to do this elsewhere.
- checkInCores(cc, "collection1", "collectionLazy2", "collectionLazy5");
- checkNotInCores(cc, "collectionLazy3", "collectionLazy4", "collectionLazy6", "collectionLazy7",
- "collectionLazy8", "collectionLazy9");
+ checkInCores(cc, "collection1", "collection2", "collection5");
+ checkNotInCores(cc, "collection3", "collection4", "collection6", "collection7",
+ "collection8", "collection9");
SolrCore core1 = cc.getCore("collection1");
assertFalse("core1 should not be transient", core1.getCoreDescriptor().isTransient());
assertTrue("core1 should be loadable", core1.getCoreDescriptor().isLoadOnStartup());
assertNotNull(core1.getSolrConfig());
- SolrCore core2 = cc.getCore("collectionLazy2");
+ SolrCore core2 = cc.getCore("collection2");
assertTrue("core2 should be transient", core2.getCoreDescriptor().isTransient());
assertTrue("core2 should be loadable", core2.getCoreDescriptor().isLoadOnStartup());
- SolrCore core3 = cc.getCore("collectionLazy3");
+ SolrCore core3 = cc.getCore("collection3");
assertTrue("core3 should be transient", core3.getCoreDescriptor().isTransient());
assertFalse("core3 should not be loadable", core3.getCoreDescriptor().isLoadOnStartup());
- SolrCore core4 = cc.getCore("collectionLazy4");
+ SolrCore core4 = cc.getCore("collection4");
assertFalse("core4 should not be transient", core4.getCoreDescriptor().isTransient());
assertFalse("core4 should not be loadable", core4.getCoreDescriptor().isLoadOnStartup());
- SolrCore core5 = cc.getCore("collectionLazy5");
+ SolrCore core5 = cc.getCore("collection5");
assertFalse("core5 should not be transient", core5.getCoreDescriptor().isTransient());
assertTrue("core5 should be loadable", core5.getCoreDescriptor().isLoadOnStartup());
@@ -168,8 +168,8 @@ public class TestLazyCores extends SolrT
CoreContainer cc = init();
try {
// Make sure Lazy4 isn't loaded. Should be loaded on the get
- checkNotInCores(cc, "collectionLazy4");
- SolrCore core4 = cc.getCore("collectionLazy4");
+ checkNotInCores(cc, "collection4");
+ SolrCore core4 = cc.getCore("collection4");
checkSearch(core4);
@@ -181,7 +181,7 @@ public class TestLazyCores extends SolrT
, "//result[@numFound='0']"
);
- checkInCores(cc, "collectionLazy4");
+ checkInCores(cc, "collection4");
core4.close();
collection1.close();
@@ -196,40 +196,39 @@ public class TestLazyCores extends SolrT
try {
// First check that all the cores that should be loaded at startup actually are.
- checkInCores(cc, "collection1", "collectionLazy2", "collectionLazy5");
- checkNotInCores(cc, "collectionLazy3", "collectionLazy4", "collectionLazy6",
- "collectionLazy7", "collectionLazy8", "collectionLazy9");
+ checkInCores(cc, "collection1", "collection2", "collection5");
+ checkNotInCores(cc, "collection3", "collection4", "collection6", "collection7", "collection8", "collection9");
// By putting these in non-alpha order, we're also checking that we're not just seeing an artifact.
SolrCore core1 = cc.getCore("collection1");
- SolrCore core3 = cc.getCore("collectionLazy3");
- SolrCore core4 = cc.getCore("collectionLazy4");
- SolrCore core2 = cc.getCore("collectionLazy2");
- SolrCore core5 = cc.getCore("collectionLazy5");
+ SolrCore core3 = cc.getCore("collection3");
+ SolrCore core4 = cc.getCore("collection4");
+ SolrCore core2 = cc.getCore("collection2");
+ SolrCore core5 = cc.getCore("collection5");
- checkInCores(cc, "collection1", "collectionLazy2", "collectionLazy3", "collectionLazy4", "collectionLazy5");
- checkNotInCores(cc, "collectionLazy6", "collectionLazy7", "collectionLazy8", "collectionLazy9");
+ checkInCores(cc, "collection1", "collection2", "collection3", "collection4", "collection5");
+ checkNotInCores(cc, "collection6", "collection7", "collection8", "collection9");
// map should be full up, add one more and verify
- SolrCore core6 = cc.getCore("collectionLazy6");
- checkInCores(cc, "collection1", "collectionLazy2", "collectionLazy3", "collectionLazy4", "collectionLazy5",
- "collectionLazy6");
- checkNotInCores(cc, "collectionLazy7", "collectionLazy8", "collectionLazy9");
-
- SolrCore core7 = cc.getCore("collectionLazy7");
- checkInCores(cc, "collection1", "collectionLazy2", "collectionLazy3", "collectionLazy4", "collectionLazy5",
- "collectionLazy6", "collectionLazy7");
- checkNotInCores(cc, "collectionLazy8", "collectionLazy9");
-
- SolrCore core8 = cc.getCore("collectionLazy8");
- checkInCores(cc, "collection1", "collectionLazy2", "collectionLazy4", "collectionLazy5", "collectionLazy6",
- "collectionLazy7", "collectionLazy8");
- checkNotInCores(cc, "collectionLazy3", "collectionLazy9");
-
- SolrCore core9 = cc.getCore("collectionLazy9");
- checkInCores(cc, "collection1", "collectionLazy4", "collectionLazy5", "collectionLazy6", "collectionLazy7",
- "collectionLazy8", "collectionLazy9");
- checkNotInCores(cc, "collectionLazy2", "collectionLazy3");
+ SolrCore core6 = cc.getCore("collection6");
+ checkInCores(cc, "collection1", "collection2", "collection3", "collection4", "collection5",
+ "collection6");
+ checkNotInCores(cc, "collection7", "collection8", "collection9");
+
+ SolrCore core7 = cc.getCore("collection7");
+ checkInCores(cc, "collection1", "collection2", "collection3", "collection4", "collection5",
+ "collection6", "collection7");
+ checkNotInCores(cc, "collection8", "collection9");
+
+ SolrCore core8 = cc.getCore("collection8");
+ checkInCores(cc, "collection1", "collection2", "collection4", "collection5", "collection6",
+ "collection7", "collection8");
+ checkNotInCores(cc, "collection3", "collection9");
+
+ SolrCore core9 = cc.getCore("collection9");
+ checkInCores(cc, "collection1", "collection4", "collection5", "collection6", "collection7",
+ "collection8", "collection9");
+ checkNotInCores(cc, "collection2", "collection3");
// Note decrementing the count when the core is removed from the lazyCores list is appropriate, since the
@@ -261,7 +260,7 @@ public class TestLazyCores extends SolrT
threads[idx] = new Thread() {
@Override
public void run() {
- SolrCore core = cc.getCore("collectionLazy3");
+ SolrCore core = cc.getCore("collection3");
synchronized (theCores) {
theCores.add(core);
}
@@ -312,10 +311,10 @@ public class TestLazyCores extends SolrT
try {
// First, try all 4 combinations of load on startup and transient
final CoreAdminHandler admin = new CoreAdminHandler(cc);
- SolrCore lc2 = cc.getCore("collectionLazy2");
- SolrCore lc4 = cc.getCore("collectionLazy4");
- SolrCore lc5 = cc.getCore("collectionLazy5");
- SolrCore lc6 = cc.getCore("collectionLazy6");
+ SolrCore lc2 = cc.getCore("collection2");
+ SolrCore lc4 = cc.getCore("collection4");
+ SolrCore lc5 = cc.getCore("collection5");
+ SolrCore lc6 = cc.getCore("collection6");
copyMinConf(new File(solrHomeDirectory, "t2"));
copyMinConf(new File(solrHomeDirectory, "t4"));
@@ -324,10 +323,10 @@ public class TestLazyCores extends SolrT
// Should also fail with the same name
- tryCreateFail(admin, "collectionLazy2", "t12", "Core with name", "collectionLazy2", "already exists");
- tryCreateFail(admin, "collectionLazy4", "t14", "Core with name", "collectionLazy4", "already exists");
- tryCreateFail(admin, "collectionLazy5", "t15", "Core with name", "collectionLazy5", "already exists");
- tryCreateFail(admin, "collectionLazy6", "t16", "Core with name", "collectionLazy6", "already exists");
+ tryCreateFail(admin, "collection2", "t12", "Core with name", "collection2", "already exists");
+ tryCreateFail(admin, "collection4", "t14", "Core with name", "collection4", "already exists");
+ tryCreateFail(admin, "collection5", "t15", "Core with name", "collection5", "already exists");
+ tryCreateFail(admin, "collection6", "t16", "Core with name", "collection6", "already exists");
lc2.close();
lc4.close();
@@ -339,7 +338,7 @@ public class TestLazyCores extends SolrT
}
}
- private void createViaAdmin(CoreContainer cc, String name, String instanceDir, boolean isTransient,
+ private void createViaAdmin(CoreContainer cc, String name, boolean isTransient,
boolean loadOnStartup) throws Exception {
final CoreAdminHandler admin = new CoreAdminHandler(cc);
@@ -347,7 +346,6 @@ public class TestLazyCores extends SolrT
admin.handleRequestBody
(req(CoreAdminParams.ACTION,
CoreAdminParams.CoreAdminAction.CREATE.toString(),
- CoreAdminParams.INSTANCE_DIR, instanceDir,
CoreAdminParams.NAME, name,
CoreAdminParams.TRANSIENT, Boolean.toString(isTransient),
CoreAdminParams.LOAD_ON_STARTUP, Boolean.toString(loadOnStartup)),
@@ -379,11 +377,11 @@ public class TestLazyCores extends SolrT
copyMinConf(new File(solrHomeDirectory, "core4"));
copyMinConf(new File(solrHomeDirectory, "core5"));
- createViaAdmin(cc, "core1", "./core1", true, true);
- createViaAdmin(cc, "core2", "./core2", true, false);
- createViaAdmin(cc, "core3", "./core3", true, true);
- createViaAdmin(cc, "core4", "./core4", true, false);
- createViaAdmin(cc, "core5", "./core5", true, false);
+ createViaAdmin(cc, "core1", true, true);
+ createViaAdmin(cc, "core2", true, false);
+ createViaAdmin(cc, "core3", true, true);
+ createViaAdmin(cc, "core4", true, false);
+ createViaAdmin(cc, "core5", true, false);
SolrCore c1 = cc.getCore("core1");
SolrCore c2 = cc.getCore("core2");
@@ -391,10 +389,10 @@ public class TestLazyCores extends SolrT
SolrCore c4 = cc.getCore("core4");
SolrCore c5 = cc.getCore("core5");
- checkNotInCores(cc, "core1", "collectionLazy2", "collectionLazy3", "collectionLazy4", "collectionLazy6"
- , "collectionLazy7", "collectionLazy8", "collectionLazy9");
+ checkNotInCores(cc, "core1", "collection2", "collection3", "collection4", "collection6"
+ , "collection7", "collection8", "collection9");
- checkInCores(cc, "collection1", "collectionLazy5", "core2", "core3", "core4", "core5");
+ checkInCores(cc, "collection1", "collection5", "core2", "core3", "core4", "core5");
// While we're at it, a test for SOLR-5366, unloading transient core that's been unloaded b/c it's
// transient generates a "too many closes" errorl
Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java?rev=1717260&r1=1717259&r2=1717260&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminHandlerTest.java Mon Nov 30 14:27:42 2015
@@ -17,6 +17,11 @@
package org.apache.solr.handler.admin;
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Map;
+
import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
import org.apache.commons.codec.Charsets;
import org.apache.commons.io.FileUtils;
@@ -38,9 +43,6 @@ import org.junit.Test;
import org.junit.rules.RuleChain;
import org.junit.rules.TestRule;
-import java.io.File;
-import java.util.Map;
-
public class CoreAdminHandlerTest extends SolrTestCaseJ4 {
@BeforeClass
@@ -117,16 +119,15 @@ public class CoreAdminHandlerTest extend
final CoreAdminHandler admin = new CoreAdminHandler(cores);
- String instDir;
+ Path instDir;
try (SolrCore template = cores.getCore("collection1")) {
assertNotNull(template);
instDir = template.getCoreDescriptor().getInstanceDir();
}
-
- final File instDirFile = new File(instDir);
- assertTrue("instDir doesn't exist: " + instDir, instDirFile.exists());
+
+ assertTrue("instDir doesn't exist: " + instDir, Files.exists(instDir));
final File instPropFile = new File(workDir, "instProp");
- FileUtils.copyDirectory(instDirFile, instPropFile);
+ FileUtils.copyDirectory(instDir.toFile(), instPropFile);
// create a new core (using CoreAdminHandler) w/ properties
Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminRequestStatusTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminRequestStatusTest.java?rev=1717260&r1=1717259&r2=1717260&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminRequestStatusTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/admin/CoreAdminRequestStatusTest.java Mon Nov 30 14:27:42 2015
@@ -18,6 +18,8 @@ package org.apache.solr.handler.admin;
*/
import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
import org.apache.commons.io.FileUtils;
import org.apache.solr.SolrTestCaseJ4;
@@ -44,16 +46,15 @@ public class CoreAdminRequestStatusTest
final CoreAdminHandler admin = new CoreAdminHandler(cores);
- String instDir;
+ Path instDir;
try (SolrCore template = cores.getCore("collection1")) {
assertNotNull(template);
instDir = template.getCoreDescriptor().getInstanceDir();
}
- final File instDirFile = new File(instDir);
- assertTrue("instDir doesn't exist: " + instDir, instDirFile.exists());
+ assertTrue("instDir doesn't exist: " + instDir, Files.exists(instDir));
final File instPropFile = new File(workDir, "instProp");
- FileUtils.copyDirectory(instDirFile, instPropFile);
+ FileUtils.copyDirectory(instDir.toFile(), instPropFile);
// create a new core (using CoreAdminHandler) w/ properties
Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/component/SuggestComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/component/SuggestComponentTest.java?rev=1717260&r1=1717259&r2=1717260&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/component/SuggestComponentTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/component/SuggestComponentTest.java Mon Nov 30 14:27:42 2015
@@ -22,16 +22,16 @@ import org.apache.solr.common.SolrExcept
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.CoreDescriptor;
import org.apache.solr.core.SolrCore;
-import org.apache.solr.search.SolrIndexSearcher;
import org.apache.solr.spelling.suggest.SuggesterParams;
-import org.apache.solr.util.RefCounted;
import org.junit.BeforeClass;
import org.junit.Test;
public class SuggestComponentTest extends SolrTestCaseJ4 {
- static String rh = "/suggest";
+ private static final String rh = "/suggest";
+
+ private static CoreContainer cc;
@BeforeClass
public static void beforeClass() throws Exception {
@@ -506,8 +506,9 @@ public class SuggestComponentTest extend
SolrCore core = h.getCore();
String dataDir1 = core.getDataDir();
CoreDescriptor cd = core.getCoreDescriptor();
- cores.unload(core.getName());
- SolrCore createdCore = cores.create(cd);
+ h.close();
+ createCore();
+ SolrCore createdCore = h.getCore();
assertEquals(dataDir1, createdCore.getDataDir());
assertEquals(createdCore, h.getCore());
} else {
Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestIndexSearcher.java?rev=1717260&r1=1717259&r2=1717260&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestIndexSearcher.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestIndexSearcher.java Mon Nov 30 14:27:42 2015
@@ -25,6 +25,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
+import com.google.common.collect.ImmutableMap;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexReaderContext;
import org.apache.lucene.index.LeafReaderContext;
@@ -219,9 +220,8 @@ public class TestIndexSearcher extends S
MockSearcherListener.numberOfTimesCalledFirstSearcher = new AtomicInteger();
try {
- CoreDescriptor newCd = new CoreDescriptor(cores, "core1", cd.getInstanceDir(), "config", "solrconfig-searcher-listeners1.xml");
// Create a new core, this should call all the firstSearcherListeners
- newCore = cores.create(newCd);
+ newCore = cores.create("core1", cd.getInstanceDir(), ImmutableMap.of("config", "solrconfig-searcher-listeners1.xml"));
//validate that the new core was created with the correct solrconfig
assertNotNull(newCore.getSearchComponent("mock"));
@@ -270,9 +270,8 @@ public class TestIndexSearcher extends S
final SolrCore newCore;
boolean coreCreated = false;
try {
- CoreDescriptor newCd = new CoreDescriptor(cores, "core1", cd.getInstanceDir(), "config", "solrconfig-searcher-listeners1.xml");
// Create a new core, this should call all the firstSearcherListeners
- newCore = cores.create(newCd);
+ newCore = cores.create("core1", cd.getInstanceDir(), ImmutableMap.of("config", "solrconfig-searcher-listeners1.xml"));
coreCreated = true;
//validate that the new core was created with the correct solrconfig
@@ -337,9 +336,8 @@ public class TestIndexSearcher extends S
boolean coreCreated = false;
try {
System.setProperty("tests.solr.useColdSearcher", "true");
- CoreDescriptor newCd = new CoreDescriptor(cores, "core1", cd.getInstanceDir(), "config", "solrconfig-searcher-listeners1.xml");
// Create a new core, this should call all the firstSearcherListeners
- newCore = cores.create(newCd);
+ newCore = cores.create("core1", cd.getInstanceDir(), ImmutableMap.of("config", "solrconfig-searcher-listeners1.xml"));
coreCreated = true;
//validate that the new core was created with the correct solrconfig
Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java?rev=1717260&r1=1717259&r2=1717260&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/update/SolrIndexSplitterTest.java Mon Nov 30 14:27:42 2015
@@ -17,6 +17,12 @@ package org.apache.solr.update;
* limitations under the License.
*/
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+
+import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.Term;
@@ -28,7 +34,6 @@ import org.apache.solr.common.cloud.Comp
import org.apache.solr.common.cloud.DocRouter;
import org.apache.solr.common.cloud.PlainIdRouter;
import org.apache.solr.common.util.Hash;
-import org.apache.solr.core.CoreDescriptor;
import org.apache.solr.core.DirectoryFactory;
import org.apache.solr.core.SolrCore;
import org.apache.solr.request.LocalSolrQueryRequest;
@@ -36,11 +41,6 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import java.io.File;
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.StandardCharsets;
-import java.util.List;
-
public class SolrIndexSplitterTest extends SolrTestCaseJ4 {
File indexDir1 = null, indexDir2 = null, indexDir3 = null;
@@ -159,15 +159,11 @@ public class SolrIndexSplitterTest exten
SolrCore core1 = null, core2 = null;
try {
- String instanceDir = h.getCore().getCoreDescriptor().getInstanceDir();
- CoreDescriptor dcore1 = buildCoreDescriptor(h.getCoreContainer(), "split1", instanceDir)
- .withDataDir(indexDir1.getAbsolutePath()).withSchema("schema12.xml").build();
- core1 = h.getCoreContainer().create(dcore1);
-
- CoreDescriptor dcore2 = buildCoreDescriptor(h.getCoreContainer(), "split2", instanceDir)
- .withDataDir(indexDir2.getAbsolutePath()).withSchema("schema12.xml").build();
- core2 = h.getCoreContainer().create(dcore2);
+ core1 = h.getCoreContainer().create("split1",
+ ImmutableMap.of("dataDir", indexDir1.getAbsolutePath(), "configSet", "minimal"));
+ core2 = h.getCoreContainer().create("split2",
+ ImmutableMap.of("dataDir", indexDir2.getAbsolutePath(), "configSet", "minimal"));
LocalSolrQueryRequest request = null;
try {
Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/util/MockCoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/util/MockCoreContainer.java?rev=1717260&r1=1717259&r2=1717260&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/util/MockCoreContainer.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/util/MockCoreContainer.java Mon Nov 30 14:27:42 2015
@@ -17,6 +17,9 @@ package org.apache.solr.util;
* limitations under the License.
*/
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.CoreDescriptor;
@@ -24,7 +27,7 @@ import org.apache.solr.core.CoreDescript
public class MockCoreContainer extends CoreContainer {
public static class MockCoreDescriptor extends CoreDescriptor {
public MockCoreDescriptor() {
- super(new MockCoreContainer(), "mock", "path");
+ super(new MockCoreContainer(), "mock", Paths.get("path"));
}
}
@@ -32,7 +35,7 @@ public class MockCoreContainer extends C
super(new Object());
}
- public String getCoreRootDirectory() {
- return "coreroot";
+ public Path getCoreRootDirectory() {
+ return Paths.get("coreroot");
}
}
Modified: lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java?rev=1717260&r1=1717259&r2=1717260&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java (original)
+++ lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java Mon Nov 30 14:27:42 2015
@@ -71,7 +71,6 @@ import org.apache.solr.common.util.Objec
import org.apache.solr.common.util.SuppressForbidden;
import org.apache.solr.common.util.XML;
import org.apache.solr.core.CoreContainer;
-import org.apache.solr.core.CoreDescriptor;
import org.apache.solr.core.CoresLocator;
import org.apache.solr.core.NodeConfig;
import org.apache.solr.core.SolrConfig;
@@ -397,9 +396,7 @@ public abstract class SolrTestCaseJ4 ext
configString = config;
schemaString = schema;
testSolrHome = Paths.get(solrHome);
- if (solrHome != null) {
- System.setProperty("solr.solr.home", solrHome);
- }
+ System.setProperty("solr.solr.home", solrHome);
initCore();
}
@@ -1862,53 +1859,6 @@ public abstract class SolrTestCaseJ4 ext
FileUtils.copyFile(new File(top, "synonyms.txt"), new File(subHome, "synonyms.txt"));
}
- public static CoreDescriptorBuilder buildCoreDescriptor(CoreContainer container, String name, String instancedir) {
- return new CoreDescriptorBuilder(container, name, instancedir);
- }
-
- public static class CoreDescriptorBuilder {
-
- final String name;
- final String instanceDir;
- final CoreContainer container;
- final Properties properties = new Properties();
-
- public CoreDescriptorBuilder(CoreContainer container, String name, String instancedir) {
- this.name = name;
- this.instanceDir = instancedir;
- this.container = container;
- }
-
- public CoreDescriptorBuilder withSchema(String schema) {
- properties.setProperty(CoreDescriptor.CORE_SCHEMA, schema);
- return this;
- }
-
- public CoreDescriptorBuilder withConfig(String config) {
- properties.setProperty(CoreDescriptor.CORE_CONFIG, config);
- return this;
- }
-
- public CoreDescriptorBuilder withDataDir(String datadir) {
- properties.setProperty(CoreDescriptor.CORE_DATADIR, datadir);
- return this;
- }
-
- public CoreDescriptor build() {
- return new CoreDescriptor(container, name, instanceDir, properties);
- }
-
- public CoreDescriptorBuilder isTransient(boolean isTransient) {
- properties.setProperty(CoreDescriptor.CORE_TRANSIENT, Boolean.toString(isTransient));
- return this;
- }
-
- public CoreDescriptorBuilder loadOnStartup(boolean loadOnStartup) {
- properties.setProperty(CoreDescriptor.CORE_LOADONSTARTUP, Boolean.toString(loadOnStartup));
- return this;
- }
- }
-
public boolean compareSolrDocument(Object expected, Object actual) {
if (!(expected instanceof SolrDocument) || !(actual instanceof SolrDocument)) {
Modified: lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java?rev=1717260&r1=1717259&r2=1717260&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java (original)
+++ lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java Mon Nov 30 14:27:42 2015
@@ -202,7 +202,7 @@ public class TestHarness extends BaseTes
@Override
public List<CoreDescriptor> discover(CoreContainer cc) {
- return ImmutableList.of(new CoreDescriptor(cc, coreName, coreName,
+ return ImmutableList.of(new CoreDescriptor(cc, coreName, cc.getCoreRootDirectory().resolve(coreName),
CoreDescriptor.CORE_DATADIR, dataDir,
CoreDescriptor.CORE_CONFIG, solrConfig,
CoreDescriptor.CORE_SCHEMA, schema,