diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 2a37630e3e6..c1b9e41f3a7 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -466,6 +466,9 @@ Other Changes * SOLR-6560: Purge termIndexInterval from example/test configs (Tom Burton-West, hossman) +* SOLR-6773: Remove the multicore example as the DIH and cloud examples + illustrate multicore behavior (hossman, Timothy Potter) + ================== 4.10.3 ================== Bug Fixes diff --git a/solr/core/src/test/org/apache/solr/cloud/TestMultiCoreConfBootstrap.java b/solr/core/src/test/org/apache/solr/cloud/TestMultiCoreConfBootstrap.java deleted file mode 100644 index 438cc679465..00000000000 --- a/solr/core/src/test/org/apache/solr/cloud/TestMultiCoreConfBootstrap.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.cloud; - -import java.io.File; - -import org.apache.solr.SolrTestCaseJ4; -import org.apache.solr.common.cloud.SolrZkClient; -import org.apache.solr.core.CoreContainer; -import org.apache.solr.util.ExternalPaths; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class TestMultiCoreConfBootstrap extends SolrTestCaseJ4 { - protected static Logger log = LoggerFactory.getLogger(TestMultiCoreConfBootstrap.class); - protected CoreContainer cores = null; - private String home; - - protected File dataDir1; - protected File dataDir2; - protected ZkTestServer zkServer; - protected String zkDir; - - @Override - @Before - public void setUp() throws Exception { - super.setUp(); - dataDir1 = createTempDir().toFile(); - dataDir2 = createTempDir().toFile(); - - home = ExternalPaths.EXAMPLE_MULTICORE_HOME; - System.setProperty("solr.solr.home", home); - System.setProperty( "solr.core0.data.dir", dataDir1.getCanonicalPath() ); - System.setProperty( "solr.core1.data.dir", dataDir2.getCanonicalPath() ); - - zkDir = dataDir1.getAbsolutePath() + File.separator - + "zookeeper/server1/data"; - zkServer = new ZkTestServer(zkDir); - zkServer.run(); - - SolrZkClient zkClient = new SolrZkClient(zkServer.getZkHost(), AbstractZkTestCase.TIMEOUT); - zkClient.makePath("/solr", false, true); - zkClient.close(); - - System.setProperty("zkHost", zkServer.getZkAddress()); - } - - @Override - @After - public void tearDown() throws Exception { - System.clearProperty("bootstrap_conf"); - System.clearProperty("zkHost"); - System.clearProperty("solr.solr.home"); - - if (cores != null) - cores.shutdown(); - - zkServer.shutdown(); - - zkServer = null; - zkDir = null; - - super.tearDown(); - } - - @Test - public void testMultiCoreConfBootstrap() throws Exception { - System.setProperty("bootstrap_conf", "true"); - cores = CoreContainer.createAndLoad(home, new File(home, "solr.xml")); - SolrZkClient zkclient = cores.getZkController().getZkClient(); - // zkclient.printLayoutToStdOut(); - - assertTrue(zkclient.exists("/configs/core1/solrconfig.xml", true)); - assertTrue(zkclient.exists("/configs/core1/schema.xml", true)); - assertTrue(zkclient.exists("/configs/core0/solrconfig.xml", true)); - assertTrue(zkclient.exists("/configs/core1/schema.xml", true)); - - zkclient.close(); - } -} diff --git a/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java b/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java index eda7161f352..04331105d57 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java @@ -108,23 +108,6 @@ public class ZkCLITest extends SolrTestCaseJ4 { log.info("####SETUP_END " + getTestName()); } - @Test - public void testBootstrap() throws Exception { - // test bootstrap_conf - String[] args = new String[] {"-zkhost", zkServer.getZkAddress(), "-cmd", - "bootstrap", "-solrhome", this.solrHome}; - ZkCLI.main(args); - - assertTrue(zkClient.exists(ZkController.CONFIGS_ZKNODE + "/collection1", true)); - - args = new String[] {"-zkhost", zkServer.getZkAddress(), "-cmd", - "bootstrap", "-solrhome", ExternalPaths.EXAMPLE_MULTICORE_HOME}; - ZkCLI.main(args); - - assertTrue(zkClient.exists(ZkController.CONFIGS_ZKNODE + "/core0", true)); - assertTrue(zkClient.exists(ZkController.CONFIGS_ZKNODE + "/core1", true)); - } - @Test public void testBootstrapWithChroot() throws Exception { String chroot = "/foo/bar"; diff --git a/solr/example/multicore/README.txt b/solr/solrj/src/test-files/solrj/solr/multicore/README.txt similarity index 100% rename from solr/example/multicore/README.txt rename to solr/solrj/src/test-files/solrj/solr/multicore/README.txt diff --git a/solr/example/multicore/core0/conf/schema.xml b/solr/solrj/src/test-files/solrj/solr/multicore/core0/conf/schema.xml similarity index 100% rename from solr/example/multicore/core0/conf/schema.xml rename to solr/solrj/src/test-files/solrj/solr/multicore/core0/conf/schema.xml diff --git a/solr/example/multicore/core0/conf/solrconfig.xml b/solr/solrj/src/test-files/solrj/solr/multicore/core0/conf/solrconfig.xml similarity index 100% rename from solr/example/multicore/core0/conf/solrconfig.xml rename to solr/solrj/src/test-files/solrj/solr/multicore/core0/conf/solrconfig.xml diff --git a/solr/example/multicore/core1/conf/schema.xml b/solr/solrj/src/test-files/solrj/solr/multicore/core1/conf/schema.xml similarity index 100% rename from solr/example/multicore/core1/conf/schema.xml rename to solr/solrj/src/test-files/solrj/solr/multicore/core1/conf/schema.xml diff --git a/solr/example/multicore/core1/conf/solrconfig.xml b/solr/solrj/src/test-files/solrj/solr/multicore/core1/conf/solrconfig.xml similarity index 100% rename from solr/example/multicore/core1/conf/solrconfig.xml rename to solr/solrj/src/test-files/solrj/solr/multicore/core1/conf/solrconfig.xml diff --git a/solr/example/multicore/exampledocs/ipod_other.xml b/solr/solrj/src/test-files/solrj/solr/multicore/exampledocs/ipod_other.xml similarity index 100% rename from solr/example/multicore/exampledocs/ipod_other.xml rename to solr/solrj/src/test-files/solrj/solr/multicore/exampledocs/ipod_other.xml diff --git a/solr/example/multicore/exampledocs/ipod_video.xml b/solr/solrj/src/test-files/solrj/solr/multicore/exampledocs/ipod_video.xml similarity index 100% rename from solr/example/multicore/exampledocs/ipod_video.xml rename to solr/solrj/src/test-files/solrj/solr/multicore/exampledocs/ipod_video.xml diff --git a/solr/example/multicore/solr.xml b/solr/solrj/src/test-files/solrj/solr/multicore/solr.xml similarity index 100% rename from solr/example/multicore/solr.xml rename to solr/solrj/src/test-files/solrj/solr/multicore/solr.xml diff --git a/solr/example/multicore/zoo.cfg b/solr/solrj/src/test-files/solrj/solr/multicore/zoo.cfg similarity index 100% rename from solr/example/multicore/zoo.cfg rename to solr/solrj/src/test-files/solrj/solr/multicore/zoo.cfg diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java b/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java index d11e3bba0cc..2b004a07623 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java @@ -21,6 +21,7 @@ import java.io.File; import java.io.IOException; import java.util.Arrays; +import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.client.solrj.request.AbstractUpdateRequest; import org.apache.solr.client.solrj.request.CoreAdminRequest; import org.apache.solr.client.solrj.request.QueryRequest; @@ -30,7 +31,6 @@ import org.apache.solr.common.params.CoreAdminParams; import org.apache.solr.common.params.SolrParams; import org.apache.solr.core.CoreContainer; import org.apache.solr.core.SolrCore; -import org.apache.solr.util.ExternalPaths; import org.junit.BeforeClass; /** @@ -48,7 +48,7 @@ public abstract class MergeIndexesExampleTestBase extends SolrExampleTestBase { @Override public String getSolrHome() { - return ExternalPaths.EXAMPLE_MULTICORE_HOME; + return SolrTestCaseJ4.getFile("solrj/solr/multicore").getAbsolutePath(); } @BeforeClass diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java b/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java deleted file mode 100644 index 0d7659f0812..00000000000 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.client.solrj; - -import java.io.File; -import java.util.HashSet; -import java.util.Set; - -import org.apache.lucene.util.LuceneTestCase; -import org.apache.lucene.util.TestUtil; -import org.apache.solr.client.solrj.request.AbstractUpdateRequest.ACTION; -import org.apache.solr.client.solrj.request.CoreAdminRequest; -import org.apache.solr.client.solrj.request.CoreAdminRequest.Unload; -import org.apache.solr.client.solrj.request.QueryRequest; -import org.apache.solr.client.solrj.request.UpdateRequest; -import org.apache.solr.client.solrj.response.CoreAdminResponse; -import org.apache.solr.common.SolrInputDocument; -import org.apache.solr.common.util.NamedList; -import org.apache.solr.core.CoreContainer; -import org.apache.solr.util.ExternalPaths; -import org.junit.Test; - - -/** - * - * @since solr 1.3 - */ -public abstract class MultiCoreExampleTestBase extends SolrExampleTestBase -{ - protected CoreContainer cores; - - private File dataDir2; - private File dataDir1; - - private SolrServer solrCore0; - private SolrServer solrCore1; - private SolrServer solrAdmin; - - private final Set clients = new HashSet<>(); - - @Override public String getSolrHome() { return ExternalPaths.EXAMPLE_MULTICORE_HOME; } - - @Override public void setUp() throws Exception { - super.setUp(); - dataDir1 = createTempDir().toFile(); - dataDir2 = createTempDir().toFile(); - - System.setProperty( "solr.core0.data.dir", this.dataDir1.getCanonicalPath() ); - System.setProperty( "solr.core1.data.dir", this.dataDir2.getCanonicalPath() ); - } - - @Override - public void tearDown() throws Exception { - super.tearDown(); - - if(solrCore0 != null) solrCore0.shutdown(); - if(solrCore1 != null) solrCore1.shutdown(); - if(solrAdmin != null) solrAdmin.shutdown(); - solrCore0 = solrCore1 = solrAdmin = null; - for (SolrServer client:clients) { - client.shutdown(); - } - clients.clear(); - } - - @Override - protected final SolrServer getSolrServer() - { - throw new UnsupportedOperationException(); - } - - @Override - protected final SolrServer createNewSolrServer() - { - throw new UnsupportedOperationException(); - } - - protected SolrServer getSolrCore0() - { - if (solrCore0 == null) { - solrCore0 = createServer( "core0" ); - } - return solrCore0; - } - - protected SolrServer getSolrCore1() - { - if (solrCore1 == null) { - solrCore1 = createServer( "core1" ); - } - return solrCore1; - } - - protected SolrServer getSolrAdmin() - { - if (solrAdmin == null) { - solrAdmin = createServer( "" ); - } - return solrAdmin; - } - - protected SolrServer getSolrCore(String name) - { - SolrServer server = createServer(name); - clients.add(server); - return server; - } - - - protected abstract SolrServer createServer(String string); - - @Test - public void testMultiCore() throws Exception - { - UpdateRequest up = new UpdateRequest(); - up.setAction(ACTION.COMMIT, true, true); - up.deleteByQuery("*:*"); - up.process(getSolrCore0()); - up.process(getSolrCore1()); - up.clear(); - - // Add something to each core - SolrInputDocument doc = new SolrInputDocument(); - doc.setField( "id", "AAA" ); - doc.setField( "name", "AAA1" ); - doc.setField( "type", "BBB1" ); - doc.setField( "core0", "yup" ); - - // Add to core0 - up.add( doc ); - up.process( getSolrCore0() ); - - // You can't add it to core1 - try { - ignoreException("unknown field"); - up.process( getSolrCore1() ); - fail( "Can't add core0 field to core1!" ); - } - catch( Exception ex ) {} - resetExceptionIgnores(); - - // Add to core1 - doc.setField( "id", "BBB" ); - doc.setField( "name", "BBB1" ); - doc.setField( "type", "AAA1" ); - doc.setField( "core1", "yup" ); - doc.removeField( "core0" ); - up.add( doc ); - up.process( getSolrCore1() ); - - // You can't add it to core1 - try { - ignoreException("unknown field"); - up.process( getSolrCore0() ); - fail( "Can't add core1 field to core0!" ); - } - catch( Exception ex ) {} - resetExceptionIgnores(); - - // in core0 - doc = new SolrInputDocument(); - doc.setField( "id", "BBB1" ); - doc.setField( "name", "AAA1" ); - doc.setField( "type", "BBB" ); - doc.setField( "core0", "AAA1" ); - - up.clear(); - up.add( doc ); - up.process( getSolrCore0() ); - - // now Make sure AAA is in 0 and BBB in 1 - SolrQuery q = new SolrQuery(); - QueryRequest r = new QueryRequest( q ); - q.setQuery( "id:AAA" ); - assertEquals( 1, r.process( getSolrCore0() ).getResults().size() ); - assertEquals( 0, r.process( getSolrCore1() ).getResults().size() ); - - // Now test Changing the default core - assertEquals( 1, getSolrCore0().query( new SolrQuery( "id:AAA" ) ).getResults().size() ); - assertEquals( 0, getSolrCore0().query( new SolrQuery( "id:BBB" ) ).getResults().size() ); - - assertEquals( 0, getSolrCore1().query( new SolrQuery( "id:AAA" ) ).getResults().size() ); - assertEquals( 1, getSolrCore1().query( new SolrQuery( "id:BBB" ) ).getResults().size() ); - - // cross-core join - assertEquals( 0, getSolrCore0().query( new SolrQuery( "{!join from=type to=name}*:*" ) ).getResults().size() ); // normal join - assertEquals( 2, getSolrCore0().query( new SolrQuery( "{!join from=type to=name fromIndex=core1}id:BBB" ) ).getResults().size() ); - assertEquals( 1, getSolrCore1().query( new SolrQuery( "{!join from=type to=name fromIndex=core0}id:AAA" ) ).getResults().size() ); - - // test that no rewrite happens in core0 (if it does, it will rewrite to BBB1 and nothing will be found in core1) - assertEquals( 2, getSolrCore0().query( new SolrQuery( "{!join from=type to=name fromIndex=core1}id:BB~" ) ).getResults().size() ); - - // test that query is parsed in the fromCore - assertEquals( 2, getSolrCore0().query( new SolrQuery( "{!join from=type to=name fromIndex=core1}core1:yup" ) ).getResults().size() ); - - // Now test reloading it should have a newer open time - String name = "core0"; - SolrServer coreadmin = getSolrAdmin(); - CoreAdminResponse mcr = CoreAdminRequest.getStatus( name, coreadmin ); - long before = mcr.getStartTime( name ).getTime(); - CoreAdminRequest.reloadCore( name, coreadmin ); - - // core should still have docs - assertEquals( 1, getSolrCore0().query( new SolrQuery( "id:AAA" ) ).getResults().size() ); - - mcr = CoreAdminRequest.getStatus( name, coreadmin ); - long after = mcr.getStartTime( name ).getTime(); - assertTrue( "should have more recent time: "+after+","+before, after > before ); - - // test move - CoreAdminRequest.renameCore("core1","corea",coreadmin); - CoreAdminRequest.renameCore("corea","coreb",coreadmin); - CoreAdminRequest.renameCore("coreb","corec",coreadmin); - CoreAdminRequest.renameCore("corec","cored",coreadmin); - CoreAdminRequest.renameCore("cored","corefoo",coreadmin); - try { - getSolrCore("core1").query( new SolrQuery( "id:BBB" ) ); - fail( "core1 should be gone" ); - } - catch( Exception ex ) {} - - assertEquals( 1, getSolrCore("corefoo").query( new SolrQuery( "id:BBB" ) ).getResults().size() ); - - NamedList response = getSolrCore("corefoo").query(new SolrQuery().setRequestHandler("/admin/system")).getResponse(); - NamedList coreInfo = (NamedList) response.get("core"); - String indexDir = (String) ((NamedList) coreInfo.get("directory")).get("index"); - - response = getSolrCore("core0").query(new SolrQuery().setRequestHandler("/admin/system")).getResponse(); - coreInfo = (NamedList) response.get("core"); - String dataDir = (String) ((NamedList) coreInfo.get("directory")).get("data"); - - // test delete index on core - CoreAdminRequest.unloadCore("corefoo", true, coreadmin); - File dir = new File(indexDir); - assertFalse("Index directory exists after core unload with deleteIndex=true", dir.exists()); - - Unload req = new Unload(false); - req.setDeleteDataDir(true); - req.setCoreName("core0"); - req.process(coreadmin); - - dir = new File(dataDir); - assertFalse("Data directory exists after core unload with deleteDataDir=true : " + dir, dir.exists()); - } -} diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java deleted file mode 100644 index e57ab9af5cb..00000000000 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.client.solrj.embedded; - -import org.apache.solr.client.solrj.MultiCoreExampleTestBase; -import org.apache.solr.client.solrj.SolrServer; -import org.apache.solr.core.CoreContainer; -import org.apache.solr.core.SolrCore; - -/** - * This runs SolrServer test using - * - * - * @since solr 1.3 - */ -public class MultiCoreEmbeddedTest extends MultiCoreExampleTestBase { - - @Override public void setUp() throws Exception - { - // TODO: fix this test to use MockDirectoryFactory - System.clearProperty("solr.directoryFactory"); - super.setUp(); - setupCoreContainer(); - SolrCore.log.info("CORES=" + cores + " : " + cores.getCoreNames()); - } - - protected void setupCoreContainer() { - cores = new CoreContainer(); - cores.load(); - } - - @Override - public void tearDown() throws Exception { - cores.shutdown(); - super.tearDown(); - } - - @Override - protected SolrServer createServer(String string) { - return new EmbeddedSolrServer( cores, string ); - } - - protected SolrServer getSolrAdmin() - { - return getSolrCore0(); - } -} diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MultiCoreExampleJettyTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MultiCoreExampleJettyTest.java deleted file mode 100644 index dca452cd4f1..00000000000 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MultiCoreExampleJettyTest.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.solr.client.solrj.embedded; - -import org.apache.solr.SolrTestCaseJ4; -import org.apache.solr.client.solrj.MultiCoreExampleTestBase; -import org.apache.solr.client.solrj.SolrQuery; -import org.apache.solr.client.solrj.SolrServer; -import org.apache.solr.client.solrj.impl.HttpSolrServer; -import org.apache.solr.client.solrj.request.AbstractUpdateRequest.ACTION; -import org.apache.solr.client.solrj.request.QueryRequest; -import org.apache.solr.client.solrj.request.UpdateRequest; -import org.apache.solr.common.SolrDocument; -import org.apache.solr.common.SolrDocumentList; -import org.apache.solr.common.SolrInputDocument; -import org.apache.solr.common.params.ShardParams; -import org.junit.Test; - -/** - * TODO? perhaps use: - * http://docs.codehaus.org/display/JETTY/ServletTester - * rather then open a real connection? - * - * - * @since solr 1.3 - */ -public class MultiCoreExampleJettyTest extends MultiCoreExampleTestBase { - - JettySolrRunner jetty; - int port = 0; - static final String context = "/example"; - - @Override public void setUp() throws Exception - { - // TODO: fix this test to use MockDirectoryFactory - System.clearProperty("solr.directoryFactory"); - super.setUp(); - - jetty = new JettySolrRunner(getSolrHome(), context, 0, null, null, true, null, sslConfig); - jetty.start(false); - port = jetty.getLocalPort(); - - } - - @Override public void tearDown() throws Exception - { - super.tearDown(); - jetty.stop(); // stop the server - } - - protected SolrServer createServer( String name ) - { - try { - // setup the server... - String url = buildUrl(port, context) + "/" + name; - HttpSolrServer s = new HttpSolrServer( url ); - s.setConnectionTimeout(SolrTestCaseJ4.DEFAULT_CONNECTION_TIMEOUT); - s.setDefaultMaxConnectionsPerHost(100); - s.setMaxTotalConnections(100); - return s; - } - catch( Exception ex ) { - throw new RuntimeException( ex ); - } - } - - - - @Test - public void testDistributed() throws Exception - { - UpdateRequest up = new UpdateRequest(); - up.setAction(ACTION.COMMIT, true, true); - up.deleteByQuery("*:*"); - up.process(getSolrCore0()); - up.process(getSolrCore1()); - up.clear(); - - // Add something to each core - SolrInputDocument doc = new SolrInputDocument(); - // Add to core0 - doc.setField( "id", "core0" ); - up.add( doc ); - up.process( getSolrCore0() ); - up.clear(); - - // Add to core1 - doc.setField( "id", "core1" ); - up.add( doc ); - up.process( getSolrCore1() ); - up.clear(); - - SolrQuery q = new SolrQuery(); - QueryRequest r = new QueryRequest( q ); - q.setQuery( "*:*" ); - assertEquals( 1, r.process( getSolrCore0() ).getResults().size() ); - assertEquals( 1, r.process( getSolrCore1() ).getResults().size() ); - - // Distributed - String baseURL = buildUrl(port, context) + "/"; - q = new SolrQuery( "*:*" ); - q.set( ShardParams.SHARDS, baseURL+"core0,"+baseURL+"core1" ); - q.set( "fl", "id,s:[shard]" ); - r = new QueryRequest( q ); - SolrDocumentList docs = r.process( getSolrCore0() ).getResults(); - assertEquals( 2, docs.size() ); - for( SolrDocument d : docs ) { - String id = (String)d.get("id"); - String shard = (String)d.get("s"); - assertEquals(baseURL+id, shard); // The shard ends with the core name - } - } -} diff --git a/solr/test-framework/src/java/org/apache/solr/util/ExternalPaths.java b/solr/test-framework/src/java/org/apache/solr/util/ExternalPaths.java index a457fdfa523..1f826c613de 100644 --- a/solr/test-framework/src/java/org/apache/solr/util/ExternalPaths.java +++ b/solr/test-framework/src/java/org/apache/solr/util/ExternalPaths.java @@ -51,9 +51,6 @@ public class ExternalPaths { public static String TECHPRODUCTS_CONFIGSET = new File(SOURCE_HOME, "server/solr/configsets/sample_techproducts_configs/conf").getAbsolutePath(); - /* @see #SOURCE_HOME */ - public static String EXAMPLE_MULTICORE_HOME = new File(SOURCE_HOME, "example/multicore").getAbsolutePath(); - public static String SERVER_HOME = new File(SOURCE_HOME, "server/solr").getAbsolutePath(); /**