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 2014/03/24 11:54:52 UTC
svn commit: r1580814 [2/2] - in /lucene/dev/trunk/solr: ./
core/src/java/org/apache/solr/cloud/ core/src/java/org/apache/solr/core/
core/src/java/org/apache/solr/handler/admin/
core/src/java/org/apache/solr/servlet/
core/src/test-files/solr/collection1...
Added: lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/configsets/configset-1/conf/schema-minimal.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/configsets/configset-1/conf/schema-minimal.xml?rev=1580814&view=auto
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/configsets/configset-1/conf/schema-minimal.xml (added)
+++ lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/configsets/configset-1/conf/schema-minimal.xml Mon Mar 24 10:54:51 2014
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ 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.
+-->
+<schema name="minimal" version="1.1">
+ <types>
+ <fieldType name="string" class="solr.StrField"/>
+ </types>
+ <fields>
+ <dynamicField name="*" type="string" indexed="true" stored="true" />
+ </fields>
+</schema>
Added: lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/configsets/configset-1/conf/solrconfig-minimal.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/configsets/configset-1/conf/solrconfig-minimal.xml?rev=1580814&view=auto
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/configsets/configset-1/conf/solrconfig-minimal.xml (added)
+++ lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/configsets/configset-1/conf/solrconfig-minimal.xml Mon Mar 24 10:54:51 2014
@@ -0,0 +1,59 @@
+<?xml version="1.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.
+-->
+
+<!-- This is a "kitchen sink" config file that tests can use.
+ When writting a new test, feel free to add *new* items (plugins,
+ config options, etc...) as long as they don't break any existing
+ tests. if you need to test something esoteric please add a new
+ "solrconfig-your-esoteric-purpose.xml" config file.
+
+ Note in particular that this test is used by MinimalSchemaTest so
+ Anything added to this file needs to work correctly even if there
+ is now uniqueKey or defaultSearch Field.
+ -->
+
+<config>
+
+ <dataDir>${solr.data.dir:}</dataDir>
+
+ <directoryFactory name="DirectoryFactory"
+ class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}"/>
+
+ <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
+
+ <updateHandler class="solr.DirectUpdateHandler2">
+ <commitWithin>
+ <softCommit>${solr.commitwithin.softcommit:true}</softCommit>
+ </commitWithin>
+
+ </updateHandler>
+ <requestHandler name="/select" class="solr.SearchHandler">
+ <lst name="defaults">
+ <str name="echoParams">explicit</str>
+ <str name="indent">true</str>
+ <str name="df">text</str>
+ </lst>
+
+ </requestHandler>
+
+ <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />
+
+ <requestHandler name="/update" class="solr.UpdateRequestHandler" />
+</config>
+
Added: lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/configsets/configset-2/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/configsets/configset-2/conf/schema.xml?rev=1580814&view=auto
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/configsets/configset-2/conf/schema.xml (added)
+++ lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/configsets/configset-2/conf/schema.xml Mon Mar 24 10:54:51 2014
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ 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.
+-->
+<schema name="minimal" version="1.1">
+ <types>
+ <fieldType name="string" class="solr.StrField"/>
+ </types>
+ <fields>
+ <dynamicField name="*" type="string" indexed="true" stored="true" />
+ </fields>
+</schema>
Added: lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/configsets/configset-2/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/configsets/configset-2/conf/solrconfig.xml?rev=1580814&view=auto
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/configsets/configset-2/conf/solrconfig.xml (added)
+++ lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/configsets/configset-2/conf/solrconfig.xml Mon Mar 24 10:54:51 2014
@@ -0,0 +1,52 @@
+<?xml version="1.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.
+-->
+
+<!--
+ Small solrconfig with no /get handler defined, for use in TestConfigSets#testConfigSetOnReload
+ -->
+
+<config>
+
+ <dataDir>${solr.data.dir:}</dataDir>
+
+ <directoryFactory name="DirectoryFactory"
+ class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}"/>
+
+ <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
+
+ <updateHandler class="solr.DirectUpdateHandler2">
+ <commitWithin>
+ <softCommit>${solr.commitwithin.softcommit:true}</softCommit>
+ </commitWithin>
+
+ </updateHandler>
+ <requestHandler name="/select" class="solr.SearchHandler">
+ <lst name="defaults">
+ <str name="echoParams">explicit</str>
+ <str name="indent">true</str>
+ <str name="df">text</str>
+ </lst>
+
+ </requestHandler>
+
+ <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />
+
+ <requestHandler name="/update" class="solr.UpdateRequestHandler" />
+</config>
+
Modified: lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/shared/solr.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/shared/solr.xml?rev=1580814&r1=1580813&r2=1580814&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/shared/solr.xml (original)
+++ lucene/dev/trunk/solr/solrj/src/test-files/solrj/solr/shared/solr.xml Mon Mar 24 10:54:51 2014
@@ -30,7 +30,7 @@
adminPath: RequestHandler path to manage cores.
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="${hostContext:solr}" zkClientTimeout="8000" genericCoreNodeNames="${genericCoreNodeNames:true}">
+ <cores adminPath="/admin/cores" defaultCoreName="core0" host="127.0.0.1" hostPort="${hostPort:8983}" hostContext="${hostContext:solr}" zkClientTimeout="8000" genericCoreNodeNames="${genericCoreNodeNames:true}" configSetBaseDir="${configSetBase:configsets}">
<core name="collection1" instanceDir="." />
<core name="core0" instanceDir="${theInstanceDir:./}" dataDir="${dataDir1}" collection="${collection:acollection}">
<property name="version" value="3.5"/>
Modified: lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/AbstractEmbeddedSolrServerTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/AbstractEmbeddedSolrServerTestCase.java?rev=1580814&r1=1580813&r2=1580814&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/AbstractEmbeddedSolrServerTestCase.java (original)
+++ lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/AbstractEmbeddedSolrServerTestCase.java Mon Mar 24 10:54:51 2014
@@ -51,6 +51,7 @@ public abstract class AbstractEmbeddedSo
super.setUp();
System.setProperty("solr.solr.home", SOLR_HOME.getAbsolutePath());
+ System.setProperty("configSetBase", SolrTestCaseJ4.getFile("solrj/solr/configsets").getAbsolutePath());
System.out.println("Solr home: " + SOLR_HOME.getAbsolutePath());
//The index is always stored within a temporary directory
Modified: lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java?rev=1580814&r1=1580813&r2=1580814&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java (original)
+++ lucene/dev/trunk/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java Mon Mar 24 10:54:51 2014
@@ -18,23 +18,31 @@
package org.apache.solr.client.solrj.request;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
+import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
import org.apache.commons.io.FileUtils;
import org.apache.solr.SolrIgnoredThreadsFilter;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.embedded.AbstractEmbeddedSolrServerTestCase;
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
+import org.apache.solr.client.solrj.response.CoreAdminResponse;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.SolrCore;
import org.junit.After;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TestRule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.core.Is.is;
+
@ThreadLeakFilters(defaultFilters = true, filters = {SolrIgnoredThreadsFilter.class})
public class TestCoreAdmin extends AbstractEmbeddedSolrServerTestCase {
protected static Logger log = LoggerFactory.getLogger(TestCoreAdmin.class);
@@ -42,6 +50,9 @@ public class TestCoreAdmin extends Abstr
private static final String SOLR_XML = "solr.xml";
private static String tempDirProp;
+
+ @Rule
+ public TestRule testRule = RuleChain.outerRule(new SystemPropertiesRestoreRule());
@Override
protected File getSolrXml() throws Exception {
@@ -57,15 +68,47 @@ public class TestCoreAdmin extends Abstr
protected SolrServer getSolrAdmin() {
return new EmbeddedSolrServer(cores, "core0");
}
+
+ @Test
+ public void testConfigSet() throws Exception {
+
+ SolrServer server = getSolrAdmin();
+ File testDir = createTestDirectory();
+
+ File newCoreInstanceDir = new File(testDir, "newcore");
+
+ CoreAdminRequest.Create req = new CoreAdminRequest.Create();
+ req.setCoreName("corewithconfigset");
+ req.setInstanceDir(newCoreInstanceDir.getAbsolutePath());
+ req.setConfigSet("configset-2");
+
+ CoreAdminResponse response = req.process(server);
+ assertThat((String) response.getResponse().get("core"), is("corewithconfigset"));
+
+ SolrCore core = null;
+ try {
+ core = cores.getCore("corewithconfigset");
+ assertThat(core, is(notNullValue()));
+ }
+ finally {
+ if (core != null)
+ core.close();
+ }
+
+ }
+
+ private File createTestDirectory() {
+ File tmp = new File(TEMP_DIR, "solrtest-" + getTestClass().getSimpleName() + "-" + System.currentTimeMillis());
+ assertTrue("Couldn't create temporary directory " + tmp.getAbsolutePath(), tmp.mkdirs());
+ return tmp;
+ }
@Test
public void testCustomUlogDir() throws Exception {
SolrServer server = getSolrAdmin();
-
- File tmp = new File(TEMP_DIR, "solrtest-" + getTestClass().getSimpleName() + "-" + System.currentTimeMillis());
- tmp.mkdirs();
+ File tmp = createTestDirectory();
log.info("Creating cores underneath {}", tmp);
Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java?rev=1580814&r1=1580813&r2=1580814&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java (original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java Mon Mar 24 10:54:51 2014
@@ -301,6 +301,13 @@ public abstract class SolrTestCaseJ4 ext
System.setProperty("solr.tests.maxIndexingThreads", String.valueOf(maxIndexingThreads));
}
+ public static Throwable getWrappedException(Throwable e) {
+ while (e != null && e.getCause() != e && e.getCause() != null) {
+ e = e.getCause();
+ }
+ return e;
+ }
+
@Override
public void setUp() throws Exception {
super.setUp();