You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by is...@apache.org on 2017/07/29 21:59:59 UTC
[22/28] lucene-solr:jira/solr-6630: Merging master
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudClusterKerberos.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudClusterKerberos.java b/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudClusterKerberos.java
deleted file mode 100644
index e2b0aea..0000000
--- a/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudClusterKerberos.java
+++ /dev/null
@@ -1,141 +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 java.nio.charset.StandardCharsets;
-
-import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.LuceneTestCase.SuppressSysoutChecks;
-import org.apache.solr.util.BadZookeeperThreadsFilter;
-import org.apache.solr.util.RevertDefaultThreadHandlerRule;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TestRule;
-
-/**
- * Test 5 nodes Solr cluster with Kerberos plugin enabled.
- * This test is Ignored right now as Mini KDC has a known bug that
- * doesn't allow us to run multiple nodes on the same host.
- * https://issues.apache.org/jira/browse/HADOOP-9893
- */
-@ThreadLeakFilters(defaultFilters = true, filters = {
- BadZookeeperThreadsFilter.class // Zookeeper login leaks TGT renewal threads
-})
-
-@Ignore
-@LuceneTestCase.Slow
-@SuppressSysoutChecks(bugUrl = "Solr logs to JUL")
-public class TestMiniSolrCloudClusterKerberos extends TestMiniSolrCloudCluster {
-
- public TestMiniSolrCloudClusterKerberos () {
- NUM_SERVERS = 5;
- NUM_SHARDS = 2;
- REPLICATION_FACTOR = 2;
- }
-
- private KerberosTestServices kerberosTestServices;
-
- @Rule
- public TestRule solrTestRules = RuleChain
- .outerRule(new SystemPropertiesRestoreRule());
-
- @ClassRule
- public static TestRule solrClassRules = RuleChain.outerRule(
- new SystemPropertiesRestoreRule()).around(
- new RevertDefaultThreadHandlerRule());
-
- @Override
- public void setUp() throws Exception {
- super.setUp();
- setupMiniKdc();
- }
-
- private void setupMiniKdc() throws Exception {
- String kdcDir = createTempDir()+File.separator+"minikdc";
- File keytabFile = new File(kdcDir, "keytabs");
- String principal = "HTTP/127.0.0.1";
- String zkServerPrincipal = "zookeeper/127.0.0.1";
- KerberosTestServices kerberosTestServices = KerberosTestServices.builder()
- .withKdc(new File(kdcDir))
- .withJaasConfiguration(principal, keytabFile, zkServerPrincipal, keytabFile)
- .build();
-
- kerberosTestServices.start();
- kerberosTestServices.getKdc().createPrincipal(keytabFile, principal, zkServerPrincipal);
-
- String jaas = "Client {\n"
- + " com.sun.security.auth.module.Krb5LoginModule required\n"
- + " useKeyTab=true\n"
- + " keyTab=\""+keytabFile.getAbsolutePath()+"\"\n"
- + " storeKey=true\n"
- + " useTicketCache=false\n"
- + " doNotPrompt=true\n"
- + " debug=true\n"
- + " principal=\""+principal+"\";\n"
- + "};\n"
- + "Server {\n"
- + " com.sun.security.auth.module.Krb5LoginModule required\n"
- + " useKeyTab=true\n"
- + " keyTab=\""+keytabFile.getAbsolutePath()+"\"\n"
- + " storeKey=true\n"
- + " doNotPrompt=true\n"
- + " useTicketCache=false\n"
- + " debug=true\n"
- + " principal=\""+zkServerPrincipal+"\";\n"
- + "};\n";
-
- String jaasFilePath = kdcDir+File.separator + "jaas-client.conf";
- FileUtils.write(new File(jaasFilePath), jaas, StandardCharsets.UTF_8);
- System.setProperty("java.security.auth.login.config", jaasFilePath);
- System.setProperty("solr.kerberos.cookie.domain", "127.0.0.1");
- System.setProperty("solr.kerberos.principal", principal);
- System.setProperty("solr.kerberos.keytab", keytabFile.getAbsolutePath());
- System.setProperty("authenticationPlugin", "org.apache.solr.security.KerberosPlugin");
-
- // more debugging, if needed
- /*System.setProperty("sun.security.jgss.debug", "true");
- System.setProperty("sun.security.krb5.debug", "true");
- System.setProperty("sun.security.jgss.debug", "true");
- System.setProperty("java.security.debug", "logincontext,policy,scl,gssloginconfig");*/
- }
-
- @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/HADOOP-9893")
- @Test
- @Override
- public void testCollectionCreateSearchDelete() throws Exception {
- super.testCollectionCreateSearchDelete();
- }
-
- @Override
- public void tearDown() throws Exception {
- System.clearProperty("java.security.auth.login.config");
- System.clearProperty("cookie.domain");
- System.clearProperty("kerberos.principal");
- System.clearProperty("kerberos.keytab");
- System.clearProperty("authenticationPlugin");
- kerberosTestServices.stop();
- super.tearDown();
- }
-}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/cloud/TestPullReplicaErrorHandling.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestPullReplicaErrorHandling.java b/solr/core/src/test/org/apache/solr/cloud/TestPullReplicaErrorHandling.java
index 6a22d99..12b3ef0 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestPullReplicaErrorHandling.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestPullReplicaErrorHandling.java
@@ -27,7 +27,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.TimeUnit;
-
+import org.apache.solr.SolrTestCaseJ4.SuppressObjectReleaseTracker;
import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
@@ -52,6 +52,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776")
+@SuppressObjectReleaseTracker(bugUrl="Testing purposes")
public class TestPullReplicaErrorHandling extends SolrCloudTestCase {
private final static int REPLICATION_TIMEOUT_SECS = 10;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/cloud/TestRandomRequestDistribution.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestRandomRequestDistribution.java b/solr/core/src/test/org/apache/solr/cloud/TestRandomRequestDistribution.java
index 31b8b9c..d3fc679 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestRandomRequestDistribution.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestRandomRequestDistribution.java
@@ -19,9 +19,12 @@ package org.apache.solr.cloud;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+
import com.codahale.metrics.Counter;
import org.apache.lucene.util.TestUtil;
@@ -41,7 +44,6 @@ import org.apache.solr.common.util.Utils;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.SolrCore;
import org.apache.solr.metrics.SolrMetricManager;
-import org.apache.solr.request.SolrRequestHandler;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -86,6 +88,25 @@ public class TestRandomRequestDistribution extends AbstractFullDistribZkTestBase
cloudClient.getZkStateReader().forceUpdateCollection("b1x1");
+ // get direct access to the metrics counters for each core/replica we're interested to monitor them
+ final Map<String,Counter> counters = new LinkedHashMap<>();
+ for (JettySolrRunner runner : jettys) {
+ CoreContainer container = runner.getCoreContainer();
+ SolrMetricManager metricManager = container.getMetricManager();
+ for (SolrCore core : container.getCores()) {
+ if ("a1x2".equals(core.getCoreDescriptor().getCollectionName())) {
+ String registry = core.getCoreMetricManager().getRegistryName();
+ Counter cnt = metricManager.counter(null, registry, "requests", "QUERY./select");
+ // sanity check
+ assertEquals(core.getName() + " has already recieved some requests?",
+ 0, cnt.getCount());
+ counters.put(core.getName(), cnt);
+ }
+ }
+ }
+ assertEquals("Sanity Check: we know there should be 2 replicas", 2, counters.size());
+
+ // send queries to the node that doesn't host any core/replica and see where it routes them
ClusterState clusterState = cloudClient.getZkStateReader().getClusterState();
DocCollection b1x1 = clusterState.getCollection("b1x1");
Collection<Replica> replicas = b1x1.getSlice("shard1").getReplicas();
@@ -94,29 +115,30 @@ public class TestRandomRequestDistribution extends AbstractFullDistribZkTestBase
if (!baseUrl.endsWith("/")) baseUrl += "/";
try (HttpSolrClient client = getHttpSolrClient(baseUrl + "a1x2", 2000, 5000)) {
+ long expectedTotalRequests = 0;
+ Set<String> uniqueCoreNames = new LinkedHashSet<>();
+
log.info("Making requests to " + baseUrl + "a1x2");
- for (int i = 0; i < 10; i++) {
+ while (uniqueCoreNames.size() < counters.keySet().size() && expectedTotalRequests < 1000L) {
+ expectedTotalRequests++;
client.query(new SolrQuery("*:*"));
- }
- }
- Map<String, Integer> shardVsCount = new HashMap<>();
- for (JettySolrRunner runner : jettys) {
- CoreContainer container = runner.getCoreContainer();
- SolrMetricManager metricManager = container.getMetricManager();
- for (SolrCore core : container.getCores()) {
- String registry = core.getCoreMetricManager().getRegistryName();
- Counter cnt = metricManager.counter(null, registry, "requests", "QUERY./select");
- SolrRequestHandler select = core.getRequestHandler("");
-// long c = (long) select.getStatistics().get("requests");
- shardVsCount.put(core.getName(), (int) cnt.getCount());
+ long actualTotalRequests = 0;
+ for (Map.Entry<String,Counter> e : counters.entrySet()) {
+ final long coreCount = e.getValue().getCount();
+ actualTotalRequests += coreCount;
+ if (0 < coreCount) {
+ uniqueCoreNames.add(e.getKey());
+ }
+ }
+ assertEquals("Sanity Check: Num Queries So Far Doesn't Match Total????",
+ expectedTotalRequests, actualTotalRequests);
}
- }
-
- log.info("Shard count map = " + shardVsCount);
-
- for (Map.Entry<String, Integer> entry : shardVsCount.entrySet()) {
- assertTrue("Shard " + entry.getKey() + " received all 10 requests", entry.getValue() != 10);
+ log.info("Total requests: " + expectedTotalRequests);
+ assertEquals("either request randomization code is broken of this test seed is really unlucky, " +
+ "Gave up waiting for requests to hit every core at least once after " +
+ expectedTotalRequests + " requests",
+ uniqueCoreNames.size(), counters.size());
}
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithKerberosAlt.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithKerberosAlt.java b/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithKerberosAlt.java
index 68af59f..08b1717 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithKerberosAlt.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithKerberosAlt.java
@@ -19,38 +19,22 @@ package org.apache.solr.cloud;
import java.io.File;
import java.lang.invoke.MethodHandles;
import java.nio.charset.StandardCharsets;
-import java.util.List;
-import java.util.Properties;
+import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import org.apache.commons.io.FileUtils;
import org.apache.lucene.util.Constants;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.embedded.JettyConfig;
-import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.common.SolrInputDocument;
-import org.apache.solr.common.cloud.SolrZkClient;
-import org.apache.solr.common.cloud.ZkStateReader;
-import org.apache.solr.core.CoreDescriptor;
-import org.apache.solr.index.TieredMergePolicyFactory;
import org.apache.solr.util.BadZookeeperThreadsFilter;
-import org.apache.solr.util.RevertDefaultThreadHandlerRule;
import org.junit.BeforeClass;
-import org.junit.ClassRule;
-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 com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
-
/**
* Test 5 nodes Solr cluster with Kerberos plugin enabled.
* This test is Ignored right now as Mini KDC has a known bug that
@@ -62,31 +46,19 @@ import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
})
@LuceneTestCase.Slow
-@LuceneTestCase.SuppressSysoutChecks(bugUrl = "Solr logs to JUL")
-public class TestSolrCloudWithKerberosAlt extends LuceneTestCase {
+public class TestSolrCloudWithKerberosAlt extends SolrCloudTestCase {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- protected final int NUM_SERVERS;
- protected final int NUM_SHARDS;
- protected final int REPLICATION_FACTOR;
-
- public TestSolrCloudWithKerberosAlt () {
- NUM_SERVERS = 1;
- NUM_SHARDS = 1;
- REPLICATION_FACTOR = 1;
- }
+ private static final int numShards = 1;
+ private static final int numReplicas = 1;
+ private static final int maxShardsPerNode = 1;
+ private static final int nodeCount = (numShards*numReplicas + (maxShardsPerNode-1))/maxShardsPerNode;
+ private static final String configName = "solrCloudCollectionConfig";
+ private static final String collectionName = "testkerberoscollection";
+
private KerberosTestServices kerberosTestServices;
- @Rule
- public TestRule solrTestRules = RuleChain
- .outerRule(new SystemPropertiesRestoreRule());
-
- @ClassRule
- public static TestRule solrClassRules = RuleChain.outerRule(
- new SystemPropertiesRestoreRule()).around(
- new RevertDefaultThreadHandlerRule());
-
@BeforeClass
public static void betterNotBeJava9() {
assumeFalse("FIXME: SOLR-8182: This test fails under Java 9", Constants.JRE_IS_MINIMUM_JAVA9);
@@ -94,9 +66,9 @@ public class TestSolrCloudWithKerberosAlt extends LuceneTestCase {
@Override
public void setUp() throws Exception {
- SolrTestCaseJ4.randomizeNumericTypesProperties(); // SOLR-10916
super.setUp();
setupMiniKdc();
+ configureCluster(nodeCount).addConfig(configName, configset("cloud-minimal")).configure();
}
private void setupMiniKdc() throws Exception {
@@ -141,10 +113,10 @@ public class TestSolrCloudWithKerberosAlt extends LuceneTestCase {
);
// more debugging, if needed
- /*System.setProperty("sun.security.jgss.debug", "true");
- System.setProperty("sun.security.krb5.debug", "true");
- System.setProperty("sun.security.jgss.debug", "true");
- System.setProperty("java.security.debug", "logincontext,policy,scl,gssloginconfig");*/
+ // System.setProperty("sun.security.jgss.debug", "true");
+ // System.setProperty("sun.security.krb5.debug", "true");
+ // System.setProperty("sun.security.jgss.debug", "true");
+ // System.setProperty("java.security.debug", "logincontext,policy,scl,gssloginconfig");
}
@Test
@@ -154,79 +126,47 @@ public class TestSolrCloudWithKerberosAlt extends LuceneTestCase {
if (random().nextBoolean()) testCollectionCreateSearchDelete();
}
- protected void testCollectionCreateSearchDelete() throws Exception {
- String collectionName = "testkerberoscollection";
+ private void testCollectionCreateSearchDelete() throws Exception {
+ CloudSolrClient client = cluster.getSolrClient();
+ CollectionAdminRequest.createCollection(collectionName, configName, numShards, numReplicas)
+ .setMaxShardsPerNode(maxShardsPerNode)
+ .process(client);
- MiniSolrCloudCluster miniCluster
- = new MiniSolrCloudCluster(NUM_SERVERS, createTempDir(), JettyConfig.builder().setContext("/solr").build());
- CloudSolrClient cloudSolrClient = miniCluster.getSolrClient();
- cloudSolrClient.setDefaultCollection(collectionName);
-
- try {
- assertNotNull(miniCluster.getZkServer());
- List<JettySolrRunner> jettys = miniCluster.getJettySolrRunners();
- assertEquals(NUM_SERVERS, jettys.size());
- for (JettySolrRunner jetty : jettys) {
- assertTrue(jetty.isRunning());
- }
-
- // create collection
- String configName = "solrCloudCollectionConfig";
- miniCluster.uploadConfigSet(SolrTestCaseJ4.TEST_PATH().resolve("collection1/conf"), configName);
-
- CollectionAdminRequest.Create createRequest = CollectionAdminRequest.createCollection(collectionName, configName, NUM_SHARDS,REPLICATION_FACTOR);
- Properties properties = new Properties();
- properties.put(CoreDescriptor.CORE_CONFIG, "solrconfig-tlog.xml");
- properties.put("solr.tests.maxBufferedDocs", "100000");
- properties.put("solr.tests.ramBufferSizeMB", "100");
- // use non-test classes so RandomizedRunner isn't necessary
- properties.put(SolrTestCaseJ4.SYSTEM_PROPERTY_SOLR_TESTS_MERGEPOLICYFACTORY, TieredMergePolicyFactory.class.getName());
- properties.put("solr.tests.mergeScheduler", "org.apache.lucene.index.ConcurrentMergeScheduler");
- properties.put("solr.directoryFactory", "solr.RAMDirectoryFactory");
- createRequest.setProperties(properties);
-
- createRequest.process(cloudSolrClient);
-
- try (SolrZkClient zkClient = new SolrZkClient
- (miniCluster.getZkServer().getZkAddress(), AbstractZkTestCase.TIMEOUT, AbstractZkTestCase.TIMEOUT, null);
- ZkStateReader zkStateReader = new ZkStateReader(zkClient)) {
- zkStateReader.createClusterStateWatchersAndUpdate();
- AbstractDistribZkTestBase.waitForRecoveriesToFinish(collectionName, zkStateReader, true, true, 330);
-
- // modify/query collection
-
- SolrInputDocument doc = new SolrInputDocument();
- doc.setField("id", "1");
- cloudSolrClient.add(doc);
- cloudSolrClient.commit();
- SolrQuery query = new SolrQuery();
- query.setQuery("*:*");
- QueryResponse rsp = cloudSolrClient.query(query);
- assertEquals(1, rsp.getResults().getNumFound());
+ AbstractDistribZkTestBase.waitForRecoveriesToFinish
+ (collectionName, client.getZkStateReader(), true, true, 330);
+
+ // modify/query collection
+
+ new UpdateRequest().add("id", "1").commit(client, collectionName);
+ QueryResponse rsp = client.query(collectionName, new SolrQuery("*:*"));
+ assertEquals(1, rsp.getResults().getNumFound());
- // delete the collection we created earlier
- CollectionAdminRequest.deleteCollection(collectionName).process(cloudSolrClient);
+ // delete the collection we created earlier
+ CollectionAdminRequest.deleteCollection(collectionName).process(client);
- AbstractDistribZkTestBase.waitForCollectionToDisappear(collectionName, zkStateReader, true, true, 330);
- }
- }
- finally {
- cloudSolrClient.close();
- miniCluster.shutdown();
- }
+ AbstractDistribZkTestBase.waitForCollectionToDisappear
+ (collectionName, client.getZkStateReader(), true, true, 330);
}
@Override
public void tearDown() throws Exception {
+ System.clearProperty("solr.jaas.debug");
System.clearProperty("java.security.auth.login.config");
- System.clearProperty("cookie.domain");
- System.clearProperty("kerberos.principal");
- System.clearProperty("kerberos.keytab");
+ System.clearProperty("solr.kerberos.jaas.appname");
+ System.clearProperty("solr.kerberos.cookie.domain");
+ System.clearProperty("solr.kerberos.principal");
+ System.clearProperty("solr.kerberos.keytab");
System.clearProperty("authenticationPlugin");
+ System.clearProperty("solr.kerberos.delegation.token.enabled");
System.clearProperty("solr.kerberos.name.rules");
- System.clearProperty("solr.jaas.debug");
+
+ // more debugging, if needed
+ // System.clearProperty("sun.security.jgss.debug");
+ // System.clearProperty("sun.security.krb5.debug");
+ // System.clearProperty("sun.security.jgss.debug");
+ // System.clearProperty("java.security.debug");
+
kerberosTestServices.stop();
- SolrTestCaseJ4.clearNumericTypesProperties(); // SOLR-10916
super.tearDown();
}
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java b/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java
index 9c04f75..8f917d2 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java
@@ -137,9 +137,11 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {
CLIENTS.add(getHttpSolrClient(jetty.getBaseUrl() + "/" + COLLECTION_NAME + "/"));
}
+ final boolean usingPoints = Boolean.getBoolean(NUMERIC_POINTS_SYSPROP);
+
// sanity check no one broke the assumptions we make about our schema
checkExpectedSchemaType( map("name","long",
- "class","solr.TrieLongField",
+ "class", RANDOMIZED_NUMERIC_FIELDTYPES.get(Long.class),
"multiValued",Boolean.FALSE,
"indexed",Boolean.FALSE,
"stored",Boolean.FALSE,
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorCloud.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorCloud.java b/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorCloud.java
index f66f892..8641720 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorCloud.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestTolerantUpdateProcessorCloud.java
@@ -132,7 +132,7 @@ public class TestTolerantUpdateProcessorCloud extends SolrCloudTestCase {
String nodeKey = jettyURL.getHost() + ":" + jettyURL.getPort() + jettyURL.getPath().replace("/","_");
urlMap.put(nodeKey, jettyURL.toString());
}
- zkStateReader.updateClusterState();
+ zkStateReader.forceUpdateCollection(COLLECTION_NAME);
ClusterState clusterState = zkStateReader.getClusterState();
for (Slice slice : clusterState.getSlices(COLLECTION_NAME)) {
String shardName = slice.getName();
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/core/DirectoryFactoryTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/core/DirectoryFactoryTest.java b/solr/core/src/test/org/apache/solr/core/DirectoryFactoryTest.java
index aa00342..869a4d2 100755
--- a/solr/core/src/test/org/apache/solr/core/DirectoryFactoryTest.java
+++ b/solr/core/src/test/org/apache/solr/core/DirectoryFactoryTest.java
@@ -17,25 +17,36 @@
package org.apache.solr.core;
import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Properties;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.common.util.NamedList;
-import org.apache.solr.handler.admin.CoreAdminHandler;
-import org.apache.solr.handler.component.HttpShardHandlerFactory;
import org.junit.After;
+import org.junit.AfterClass;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
public class DirectoryFactoryTest extends LuceneTestCase {
- public void testLockTypesUnchanged() throws Exception {
- assertEquals("simple", DirectoryFactory.LOCK_TYPE_SIMPLE);
- assertEquals("native", DirectoryFactory.LOCK_TYPE_NATIVE);
- assertEquals("single", DirectoryFactory.LOCK_TYPE_SINGLE);
- assertEquals("none", DirectoryFactory.LOCK_TYPE_NONE);
- assertEquals("hdfs", DirectoryFactory.LOCK_TYPE_HDFS);
+ private static Path solrHome = null;
+ private static SolrResourceLoader loader = null;
+
+ @BeforeClass
+ public static void setupLoader() throws Exception {
+ solrHome = Paths.get(createTempDir().toAbsolutePath().toString());
+ loader = new SolrResourceLoader(solrHome);
+ }
+
+ @AfterClass
+ public static void cleanupLoader() throws Exception {
+ if (loader != null) {
+ loader.close();
+ }
+ loader = null;
}
@After
@@ -43,13 +54,23 @@ public class DirectoryFactoryTest extends LuceneTestCase {
public void clean() {
System.clearProperty("solr.data.home");
System.clearProperty("solr.solr.home");
+ System.clearProperty("test.solr.data.home");
+ }
+
+ @Test
+ public void testLockTypesUnchanged() throws Exception {
+ assertEquals("simple", DirectoryFactory.LOCK_TYPE_SIMPLE);
+ assertEquals("native", DirectoryFactory.LOCK_TYPE_NATIVE);
+ assertEquals("single", DirectoryFactory.LOCK_TYPE_SINGLE);
+ assertEquals("none", DirectoryFactory.LOCK_TYPE_NONE);
+ assertEquals("hdfs", DirectoryFactory.LOCK_TYPE_HDFS);
}
@Test
public void testGetDataHome() throws Exception {
- MockCoreContainer cc = new MockCoreContainer("/solr/home");
+ NodeConfig config = loadNodeConfig("/solr/solr-solrDataHome.xml");
+ CoreContainer cc = new CoreContainer(config);
Properties cp = cc.getContainerProperties();
- boolean zkAware = cc.isZooKeeperAware();
RAMDirectoryFactory rdf = new RAMDirectoryFactory();
rdf.initCoreContainer(cc);
rdf.init(new NamedList());
@@ -65,33 +86,32 @@ public class DirectoryFactoryTest extends LuceneTestCase {
// solr.data.home set with System property, and relative path
System.setProperty("solr.data.home", "solrdata");
+ config = loadNodeConfig("/solr/solr-solrDataHome.xml");
+ cc = new CoreContainer(config);
+ rdf = new RAMDirectoryFactory();
+ rdf.initCoreContainer(cc);
rdf.init(new NamedList());
- assertDataHome("/solr/home/solrdata/inst_dir/data", "inst_dir", rdf, cc);
+ assertDataHome(solrHome.resolve("solrdata/inst_dir/data").toAbsolutePath().toString(), "inst_dir", rdf, cc);
// Test parsing last component of instanceDir, and using custom dataDir
- assertDataHome("/solr/home/solrdata/myinst/mydata", "/path/to/myinst", rdf, cc, "dataDir", "mydata");
+ assertDataHome(solrHome.resolve("solrdata/myinst/mydata").toAbsolutePath().toString(), "/path/to/myinst", rdf, cc, "dataDir", "mydata");
+ // solr.data.home set but also solrDataHome set in solr.xml, which should override the former
+ System.setProperty("test.solr.data.home", "/foo");
+ config = loadNodeConfig("/solr/solr-solrDataHome.xml");
+ cc = new CoreContainer(config);
+ rdf = new RAMDirectoryFactory();
+ rdf.initCoreContainer(cc);
+ rdf.init(new NamedList());
+ assertDataHome("/foo/inst_dir/data", "inst_dir", rdf, cc);
}
- private void assertDataHome(String expected, String instanceDir, RAMDirectoryFactory rdf, MockCoreContainer cc, String... properties) throws IOException {
+ private void assertDataHome(String expected, String instanceDir, RAMDirectoryFactory rdf, CoreContainer cc, String... properties) throws IOException {
String dataHome = rdf.getDataHome(new CoreDescriptor("core_name", Paths.get(instanceDir), cc.containerProperties, cc.isZooKeeperAware(), properties));
assertEquals(Paths.get(expected).toAbsolutePath(), Paths.get(dataHome).toAbsolutePath());
}
- private static class MockCoreContainer extends CoreContainer {
-
- private final String mockSolrHome;
-
- public MockCoreContainer(String solrHome) throws IOException {
- super(new Object());
- mockSolrHome = solrHome;
- this.shardHandlerFactory = new HttpShardHandlerFactory();
- this.coreAdminHandler = new CoreAdminHandler();
- }
-
- @Override
- public String getSolrHome() {
- return mockSolrHome;
- }
+ private NodeConfig loadNodeConfig(String config) throws Exception {
+ InputStream is = DirectoryFactoryTest.class.getResourceAsStream(config);
+ return SolrXmlConfig.fromInputStream(loader, is);
}
-
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/core/TestConfigSetImmutable.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/core/TestConfigSetImmutable.java b/solr/core/src/test/org/apache/solr/core/TestConfigSetImmutable.java
index 30fac6a..2388b3d 100644
--- a/solr/core/src/test/org/apache/solr/core/TestConfigSetImmutable.java
+++ b/solr/core/src/test/org/apache/solr/core/TestConfigSetImmutable.java
@@ -73,7 +73,7 @@ public class TestConfigSetImmutable extends RestTestBase {
String payload = "{\n" +
"'create-requesthandler' : { 'name' : '/x', 'class': 'org.apache.solr.handler.DumpRequestHandler' , 'startup' : 'lazy'}\n" +
"}";
- String uri = "/config?wt=json";
+ String uri = "/config";
String response = restTestHarness.post(uri, SolrTestCaseJ4.json(payload));
Map map = (Map) ObjectBuilder.getVal(new JSONParser(new StringReader(response)));
assertNotNull(map.get("error"));
@@ -91,7 +91,7 @@ public class TestConfigSetImmutable extends RestTestBase {
" },\n" +
" }";
- String response = restTestHarness.post("/schema?wt=json", json(payload));
+ String response = restTestHarness.post("/schema", json(payload));
Map map = (Map) ObjectBuilder.getVal(new JSONParser(new StringReader(response)));
assertNotNull(map.get("errors"));
assertTrue(map.get("errors").toString().contains("immutable"));
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java b/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java
index bf0568f..4e944c3 100644
--- a/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java
+++ b/solr/core/src/test/org/apache/solr/core/TestCoreDiscovery.java
@@ -17,12 +17,17 @@
package org.apache.solr.core;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
+import java.util.List;
import java.util.Properties;
import com.google.common.collect.ImmutableMap;
@@ -47,15 +52,15 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
initCore();
}
- private final File solrHomeDirectory = createTempDir().toFile();
+ private final Path solrHomeDirectory = createTempDir();
private void setMeUp(String alternateCoreDir) throws Exception {
- System.setProperty("solr.solr.home", solrHomeDirectory.getAbsolutePath());
+ System.setProperty("solr.solr.home", solrHomeDirectory.toAbsolutePath().toString());
String xmlStr = SOLR_XML;
if (alternateCoreDir != null) {
xmlStr = xmlStr.replace("<solr>", "<solr> <str name=\"coreRootDirectory\">" + alternateCoreDir + "</str> ");
}
- File tmpFile = new File(solrHomeDirectory, SolrXmlConfig.SOLR_XML_FILE);
+ File tmpFile = new File(solrHomeDirectory.toFile(), SolrXmlConfig.SOLR_XML_FILE);
FileUtils.write(tmpFile, xmlStr, IOUtils.UTF_8);
}
@@ -64,7 +69,7 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
setMeUp(null);
}
- private Properties makeCorePropFile(String name, boolean isTransient, boolean loadOnStartup, String... extraProps) {
+ private Properties makeCoreProperties(String name, boolean isTransient, boolean loadOnStartup, String... extraProps) {
Properties props = new Properties();
props.put(CoreDescriptor.CORE_NAME, name);
props.put(CoreDescriptor.CORE_SCHEMA, "schema-tiny.xml");
@@ -89,14 +94,12 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
} finally {
out.close();
}
-
addConfFiles(new File(propFile.getParent(), "conf"));
-
}
private void addCoreWithProps(String name, Properties stockProps) throws Exception {
- File propFile = new File(new File(solrHomeDirectory, name), CorePropertiesLocator.PROPERTIES_FILENAME);
+ File propFile = new File(new File(solrHomeDirectory.toFile(), name), CorePropertiesLocator.PROPERTIES_FILENAME);
File parent = propFile.getParentFile();
assertTrue("Failed to mkdirs for " + parent.getAbsolutePath(), parent.mkdirs());
addCoreWithProps(stockProps, propFile);
@@ -142,12 +145,12 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
setMeUp();
// name, isLazy, loadOnStartup
- addCoreWithProps("core1", makeCorePropFile("core1", false, true, "dataDir=core1"));
- addCoreWithProps("core2", makeCorePropFile("core2", false, false, "dataDir=core2"));
+ addCoreWithProps("core1", makeCoreProperties("core1", false, true, "dataDir=core1"));
+ addCoreWithProps("core2", makeCoreProperties("core2", false, false, "dataDir=core2"));
// I suspect what we're adding in here is a "configset" rather than a schema or solrconfig.
//
- addCoreWithProps("lazy1", makeCorePropFile("lazy1", true, false, "dataDir=lazy1"));
+ addCoreWithProps("lazy1", makeCoreProperties("lazy1", true, false, "dataDir=lazy1"));
CoreContainer cc = init();
try {
@@ -172,6 +175,34 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
assertEquals("schema-tiny.xml", desc.getSchemaName());
TestLazyCores.checkInCores(cc, "core1", "core2", "lazy1");
+ // Can we persist an existing core's properties?
+
+ // Insure we can persist a new properties file if we want.
+ CoreDescriptor cd1 = core1.getCoreDescriptor();
+ Properties persistable = cd1.getPersistableUserProperties();
+ persistable.setProperty("bogusprop", "bogusval");
+ cc.getCoresLocator().persist(cc, cd1);
+ File propFile = new File(new File(solrHomeDirectory.toFile(), "core1"), CorePropertiesLocator.PROPERTIES_FILENAME);
+ Properties newProps = new Properties();
+ try (InputStreamReader is = new InputStreamReader(new FileInputStream(propFile), StandardCharsets.UTF_8)) {
+ newProps.load(is);
+ }
+ // is it there?
+ assertEquals("Should have persisted bogusprop to disk", "bogusval", newProps.getProperty("bogusprop"));
+ // is it in the user properties?
+ CorePropertiesLocator cpl = new CorePropertiesLocator(solrHomeDirectory);
+ List<CoreDescriptor> cores = cpl.discover(cc);
+ boolean found = false;
+ for (CoreDescriptor cd : cores) {
+ if (cd.getName().equals("core1")) {
+ found = true;
+ assertEquals("Should have persisted bogusprop to disk in user properties",
+ "bogusval",
+ cd.getPersistableUserProperties().getProperty("bogusprop"));
+ break;
+ }
+ }
+ assertTrue("Should have found core descriptor for core1", found);
}
} finally {
@@ -179,6 +210,71 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
}
}
+ @Test
+ public void testPropFilePersistence() throws Exception {
+ setMeUp();
+
+ // Test that an existing core.properties file is _not_ deleted if the core fails to load.
+ Properties badProps = makeCoreProperties("corep1", false, true);
+ badProps.setProperty(CoreDescriptor.CORE_SCHEMA, "not-there.xml");
+
+ addCoreWithProps("corep1", badProps);
+ // Sanity check that a core did get loaded
+ addCoreWithProps("corep2", makeCoreProperties("corep2", false, true));
+
+ Path coreP1PropFile = Paths.get(solrHomeDirectory.toString(), "corep1", "core.properties");
+ assertTrue("Core.properties file should exist for before core load failure core corep1",
+ Files.exists(coreP1PropFile));
+
+ CoreContainer cc = init();
+ try {
+ try {
+ cc.getCore("corep1");
+ fail("Should have thrown exception");
+ } catch (SolrCoreInitializationException scie) {
+ assertTrue(scie.getMessage().contains("init failure"));
+ }
+ try (SolrCore sc = cc.getCore("corep2")) {
+ assertNotNull("Core corep2 should be loaded", sc);
+ }
+ assertTrue("Core.properties file should still exist for core corep1", Files.exists(coreP1PropFile));
+
+ // Creating a core successfully should create a core.properties file
+ Path corePropFile = Paths.get(solrHomeDirectory.toString(), "corep3", "core.properties");
+ assertFalse("Should not be a properties file yet", Files.exists(corePropFile));
+ cc.create("corep3", ImmutableMap.of("configSet", "minimal"));
+ assertTrue("Should be a properties file for newly created core", Files.exists(corePropFile));
+
+ // Failing to create a core should _not_ leave a core.properties file hanging around.
+ corePropFile = Paths.get(solrHomeDirectory.toString(), "corep4", "core.properties");
+ assertFalse("Should not be a properties file yet for corep4", Files.exists(corePropFile));
+
+ try {
+ cc.create("corep4", ImmutableMap.of(
+ CoreDescriptor.CORE_NAME, "corep4",
+ CoreDescriptor.CORE_SCHEMA, "not-there.xml",
+ CoreDescriptor.CORE_CONFIG, "solrconfig-minimal.xml",
+ CoreDescriptor.CORE_TRANSIENT, "false",
+ CoreDescriptor.CORE_LOADONSTARTUP, "true"));
+ fail("Should have thrown exception getting core ");
+ } catch (SolrException se) {
+ assertTrue(se.getMessage().contains("Can't find resource"));
+ }
+ assertFalse("Failed corep4 should not have left a core.properties file around", Files.exists(corePropFile));
+
+ // Finally, just for yucks, let's determine that a this create path also leaves a prop file.
+
+ corePropFile = Paths.get(solrHomeDirectory.toString(), "corep5", "core.properties");
+ assertFalse("Should not be a properties file yet for corep5", Files.exists(corePropFile));
+
+ cc.create("corep5", ImmutableMap.of("configSet", "minimal"));
+
+ assertTrue("corep5 should have left a core.properties file on disk", Files.exists(corePropFile));
+
+ } finally {
+ cc.shutdown();
+ }
+ }
// Insure that if the number of transient cores that are loaded on startup is greater than the cache size that Solr
@@ -199,16 +295,16 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
setMeUp();
// name, isLazy, loadOnStartup
- addCoreWithProps("coreLOS", makeCorePropFile("coreLOS", false, true, "dataDir=coreLOS"));
- addCoreWithProps("coreT1", makeCorePropFile("coreT1", true, true, "dataDir=coreT1"));
- addCoreWithProps("coreT2", makeCorePropFile("coreT2", true, true, "dataDir=coreT2"));
- addCoreWithProps("coreT3", makeCorePropFile("coreT3", true, true, "dataDir=coreT3"));
- addCoreWithProps("coreT4", makeCorePropFile("coreT4", true, true, "dataDir=coreT4"));
- addCoreWithProps("coreT5", makeCorePropFile("coreT5", true, true, "dataDir=coreT5"));
- addCoreWithProps("coreT6", makeCorePropFile("coreT6", true, true, "dataDir=coreT6"));
+ addCoreWithProps("coreLOS", makeCoreProperties("coreLOS", false, true, "dataDir=coreLOS"));
+ addCoreWithProps("coreT1", makeCoreProperties("coreT1", true, true, "dataDir=coreT1"));
+ addCoreWithProps("coreT2", makeCoreProperties("coreT2", true, true, "dataDir=coreT2"));
+ addCoreWithProps("coreT3", makeCoreProperties("coreT3", true, true, "dataDir=coreT3"));
+ addCoreWithProps("coreT4", makeCoreProperties("coreT4", true, true, "dataDir=coreT4"));
+ addCoreWithProps("coreT5", makeCoreProperties("coreT5", true, true, "dataDir=coreT5"));
+ addCoreWithProps("coreT6", makeCoreProperties("coreT6", true, true, "dataDir=coreT6"));
// Do this specially since we need to search.
- final CoreContainer cc = new CoreContainer(solrHomeDirectory.getPath().toString());
+ final CoreContainer cc = new CoreContainer(solrHomeDirectory.toString());
try {
cc.load();
// Just check that the proper number of cores are loaded since making the test depend on order would be fragile
@@ -246,8 +342,8 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
setMeUp();
// name, isLazy, loadOnStartup
- addCoreWithProps("core1", makeCorePropFile("core1", false, true));
- addCoreWithProps("core2", makeCorePropFile("core2", false, false, "name=core1"));
+ addCoreWithProps("core1", makeCoreProperties("core1", false, true));
+ addCoreWithProps("core2", makeCoreProperties("core2", false, false, "name=core1"));
CoreContainer cc = null;
try {
cc = init();
@@ -274,9 +370,9 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
File alt = createTempDir().toFile();
setMeUp(alt.getAbsolutePath());
- addCoreWithProps(makeCorePropFile("core1", false, true, "dataDir=core1"),
+ addCoreWithProps(makeCoreProperties("core1", false, true, "dataDir=core1"),
new File(alt, "core1" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME));
- addCoreWithProps(makeCorePropFile("core2", false, false, "dataDir=core2"),
+ addCoreWithProps(makeCoreProperties("core2", false, false, "dataDir=core2"),
new File(alt, "core2" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME));
CoreContainer cc = init();
try (SolrCore core1 = cc.getCore("core1");
@@ -295,13 +391,13 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
setMeUp(relative);
// two cores under the relative directory
- addCoreWithProps(makeCorePropFile("core1", false, true, "dataDir=core1"),
- solrHomeDirectory.toPath().resolve(relative).resolve("core1").resolve(CorePropertiesLocator.PROPERTIES_FILENAME).toFile());
- addCoreWithProps(makeCorePropFile("core2", false, false, "dataDir=core2"),
- solrHomeDirectory.toPath().resolve(relative).resolve("core2").resolve(CorePropertiesLocator.PROPERTIES_FILENAME).toFile());
+ addCoreWithProps(makeCoreProperties("core1", false, true, "dataDir=core1"),
+ solrHomeDirectory.resolve(relative).resolve("core1").resolve(CorePropertiesLocator.PROPERTIES_FILENAME).toFile());
+ addCoreWithProps(makeCoreProperties("core2", false, false, "dataDir=core2"),
+ solrHomeDirectory.resolve(relative).resolve("core2").resolve(CorePropertiesLocator.PROPERTIES_FILENAME).toFile());
// one core *not* under the relative directory
- addCoreWithProps(makeCorePropFile("core0", false, true, "datadir=core0"),
- solrHomeDirectory.toPath().resolve("core0").resolve(CorePropertiesLocator.PROPERTIES_FILENAME).toFile());
+ addCoreWithProps(makeCoreProperties("core0", false, true, "datadir=core0"),
+ solrHomeDirectory.resolve("core0").resolve(CorePropertiesLocator.PROPERTIES_FILENAME).toFile());
CoreContainer cc = init();
try (SolrCore core1 = cc.getCore("core1");
@@ -323,9 +419,9 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
public void testNoCoreDir() throws Exception {
File noCoreDir = createTempDir().toFile();
setMeUp(noCoreDir.getAbsolutePath());
- addCoreWithProps(makeCorePropFile("core1", false, true),
+ addCoreWithProps(makeCoreProperties("core1", false, true),
new File(noCoreDir, "core1" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME));
- addCoreWithProps(makeCorePropFile("core2", false, false),
+ addCoreWithProps(makeCoreProperties("core2", false, false),
new File(noCoreDir, "core2" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME));
CoreContainer cc = init();
try (SolrCore core1 = cc.getCore("core1");
@@ -339,13 +435,13 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
@Test
public void testCoreDirCantRead() throws Exception {
- File coreDir = solrHomeDirectory;
+ File coreDir = solrHomeDirectory.toFile();
setMeUp(coreDir.getAbsolutePath());
- addCoreWithProps(makeCorePropFile("core1", false, true),
+ addCoreWithProps(makeCoreProperties("core1", false, true),
new File(coreDir, "core1" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME));
// Insure that another core is opened successfully
- addCoreWithProps(makeCorePropFile("core2", false, false, "dataDir=core2"),
+ addCoreWithProps(makeCoreProperties("core2", false, false, "dataDir=core2"),
new File(coreDir, "core2" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME));
File toSet = new File(coreDir, "core1");
@@ -365,15 +461,15 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
@Test
public void testNonCoreDirCantRead() throws Exception {
- File coreDir = solrHomeDirectory;
+ File coreDir = solrHomeDirectory.toFile();
setMeUp(coreDir.getAbsolutePath());
- addCoreWithProps(makeCorePropFile("core1", false, true),
+ addCoreWithProps(makeCoreProperties("core1", false, true),
new File(coreDir, "core1" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME));
- addCoreWithProps(makeCorePropFile("core2", false, false, "dataDir=core2"),
+ addCoreWithProps(makeCoreProperties("core2", false, false, "dataDir=core2"),
new File(coreDir, "core2" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME));
- File toSet = new File(solrHomeDirectory, "cantReadDir");
+ File toSet = new File(solrHomeDirectory.toFile(), "cantReadDir");
assertTrue("Should have been able to make directory '" + toSet.getAbsolutePath() + "' ", toSet.mkdirs());
assumeTrue("Cannot make " + toSet + " non-readable. Test aborted.", toSet.setReadable(false, false));
assumeFalse("Appears we are a super user, skip test", toSet.canRead());
@@ -392,12 +488,12 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
@Test
public void testFileCantRead() throws Exception {
- File coreDir = solrHomeDirectory;
+ File coreDir = solrHomeDirectory.toFile();
setMeUp(coreDir.getAbsolutePath());
- addCoreWithProps(makeCorePropFile("core1", false, true),
+ addCoreWithProps(makeCoreProperties("core1", false, true),
new File(coreDir, "core1" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME));
- File toSet = new File(solrHomeDirectory, "cantReadFile");
+ File toSet = new File(solrHomeDirectory.toFile(), "cantReadFile");
assertTrue("Should have been able to make file '" + toSet.getAbsolutePath() + "' ", toSet.createNewFile());
assumeTrue("Cannot make " + toSet + " non-readable. Test aborted.", toSet.setReadable(false, false));
CoreContainer cc = init();
@@ -412,7 +508,7 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
@Test
public void testSolrHomeDoesntExist() throws Exception {
- File homeDir = solrHomeDirectory;
+ File homeDir = solrHomeDirectory.toFile();
IOUtils.rm(homeDir.toPath());
CoreContainer cc = null;
try {
@@ -430,9 +526,9 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
@Test
public void testSolrHomeNotReadable() throws Exception {
- File homeDir = solrHomeDirectory;
+ File homeDir = solrHomeDirectory.toFile();
setMeUp(homeDir.getAbsolutePath());
- addCoreWithProps(makeCorePropFile("core1", false, true),
+ addCoreWithProps(makeCoreProperties("core1", false, true),
new File(homeDir, "core1" + File.separator + CorePropertiesLocator.PROPERTIES_FILENAME));
assumeTrue("Cannot make " + homeDir + " non-readable. Test aborted.", homeDir.setReadable(false, false));
@@ -468,13 +564,13 @@ public class TestCoreDiscovery extends SolrTestCaseJ4 {
@Test
public void testRootDirectoryResolution() {
- SolrResourceLoader loader = new SolrResourceLoader(solrHomeDirectory.toPath());
+ SolrResourceLoader loader = new SolrResourceLoader(solrHomeDirectory);
NodeConfig config = SolrXmlConfig.fromString(loader, "<solr><str name=\"coreRootDirectory\">relative</str></solr>");
- assertThat(config.getCoreRootDirectory().toString(), containsString(solrHomeDirectory.getAbsolutePath()));
+ assertThat(config.getCoreRootDirectory().toString(), containsString(solrHomeDirectory.toAbsolutePath().toString()));
NodeConfig absConfig = SolrXmlConfig.fromString(loader, "<solr><str name=\"coreRootDirectory\">/absolute</str></solr>");
- assertThat(absConfig.getCoreRootDirectory().toString(), not(containsString(solrHomeDirectory.getAbsolutePath())));
+ assertThat(absConfig.getCoreRootDirectory().toString(), not(containsString(solrHomeDirectory.toAbsolutePath().toString())));
}
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/core/TestCustomStream.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/core/TestCustomStream.java b/solr/core/src/test/org/apache/solr/core/TestCustomStream.java
index 3fc6394..0a70374 100644
--- a/solr/core/src/test/org/apache/solr/core/TestCustomStream.java
+++ b/solr/core/src/test/org/apache/solr/core/TestCustomStream.java
@@ -74,10 +74,10 @@ public class TestCustomStream extends AbstractFullDistribZkTestBase {
"}";
RestTestHarness client = restTestHarnesses.get(random().nextInt(restTestHarnesses.size()));
- TestSolrConfigHandler.runConfigCommand(client,"/config?wt=json",payload);
+ TestSolrConfigHandler.runConfigCommand(client,"/config",payload);
TestSolrConfigHandler.testForResponseElement(client,
null,
- "/config/overlay?wt=json",
+ "/config/overlay",
null,
Arrays.asList("overlay", "expressible", "hello", "class"),
"org.apache.solr.core.HelloStream",10);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/core/TestDynamicLoading.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/core/TestDynamicLoading.java b/solr/core/src/test/org/apache/solr/core/TestDynamicLoading.java
index 9bbe09f..4dca763 100644
--- a/solr/core/src/test/org/apache/solr/core/TestDynamicLoading.java
+++ b/solr/core/src/test/org/apache/solr/core/TestDynamicLoading.java
@@ -79,10 +79,10 @@ public class TestDynamicLoading extends AbstractFullDistribZkTestBase {
"'add-runtimelib' : { 'name' : 'colltest' ,'version':1}\n" +
"}";
RestTestHarness client = restTestHarnesses.get(random().nextInt(restTestHarnesses.size()));
- TestSolrConfigHandler.runConfigCommand(client, "/config?wt=json", payload);
+ TestSolrConfigHandler.runConfigCommand(client, "/config", payload);
TestSolrConfigHandler.testForResponseElement(client,
null,
- "/config/overlay?wt=json",
+ "/config/overlay",
null,
Arrays.asList("overlay", "runtimeLib", blobName, "version"),
1l, 10);
@@ -93,15 +93,15 @@ public class TestDynamicLoading extends AbstractFullDistribZkTestBase {
"}";
client = restTestHarnesses.get(random().nextInt(restTestHarnesses.size()));
- TestSolrConfigHandler.runConfigCommand(client,"/config?wt=json",payload);
+ TestSolrConfigHandler.runConfigCommand(client,"/config",payload);
TestSolrConfigHandler.testForResponseElement(client,
null,
- "/config/overlay?wt=json",
+ "/config/overlay",
null,
Arrays.asList("overlay", "requestHandler", "/test1", "class"),
"org.apache.solr.core.BlobStoreTestRequestHandler",10);
- Map map = TestSolrConfigHandler.getRespMap("/test1?wt=json", client);
+ Map map = TestSolrConfigHandler.getRespMap("/test1", client);
assertNotNull(TestBlobHandler.getAsString(map), map = (Map) map.get("error"));
assertTrue(TestBlobHandler.getAsString(map), map.get("msg").toString().contains(".system collection not available"));
@@ -110,7 +110,7 @@ public class TestDynamicLoading extends AbstractFullDistribZkTestBase {
TestBlobHandler.createSystemCollection(getHttpSolrClient(baseURL, randomClient.getHttpClient()));
waitForRecoveriesToFinish(".system", true);
- map = TestSolrConfigHandler.getRespMap("/test1?wt=json", client);
+ map = TestSolrConfigHandler.getRespMap("/test1", client);
assertNotNull(map = (Map) map.get("error"));
@@ -122,11 +122,11 @@ public class TestDynamicLoading extends AbstractFullDistribZkTestBase {
" }\n" +
" }";
- TestSolrConfigHandler.runConfigCommand(client,"/config/params?wt=json",payload);
+ TestSolrConfigHandler.runConfigCommand(client,"/config/params",payload);
TestSolrConfigHandler.testForResponseElement(
client,
null,
- "/config/params?wt=json",
+ "/config/params",
cloudClient,
Arrays.asList("response", "params", "watched", "x"),
"X val",
@@ -136,7 +136,7 @@ public class TestDynamicLoading extends AbstractFullDistribZkTestBase {
for(int i=0;i<100;i++) {
- map = TestSolrConfigHandler.getRespMap("/test1?wt=json", client);
+ map = TestSolrConfigHandler.getRespMap("/test1", client);
if("X val".equals(map.get("x"))){
success = true;
break;
@@ -157,11 +157,11 @@ public class TestDynamicLoading extends AbstractFullDistribZkTestBase {
"'create-queryResponseWriter' : { 'name' : 'json1', 'class': 'org.apache.solr.core.RuntimeLibResponseWriter' , 'runtimeLib':true }" +
"}";
client = restTestHarnesses.get(random().nextInt(restTestHarnesses.size()));
- TestSolrConfigHandler.runConfigCommand(client, "/config?wt=json", payload);
+ TestSolrConfigHandler.runConfigCommand(client, "/config", payload);
Map result = TestSolrConfigHandler.testForResponseElement(client,
null,
- "/config/overlay?wt=json",
+ "/config/overlay",
null,
Arrays.asList("overlay", "requestHandler", "/runtime", "class"),
"org.apache.solr.core.RuntimeLibReqHandler", 10);
@@ -170,7 +170,7 @@ public class TestDynamicLoading extends AbstractFullDistribZkTestBase {
result = TestSolrConfigHandler.testForResponseElement(client,
null,
- "/runtime?wt=json",
+ "/runtime",
null,
Arrays.asList("class"),
"org.apache.solr.core.RuntimeLibReqHandler", 10);
@@ -198,10 +198,10 @@ public class TestDynamicLoading extends AbstractFullDistribZkTestBase {
"'update-runtimelib' : { 'name' : 'colltest' ,'version':2}\n" +
"}";
client = restTestHarnesses.get(random().nextInt(restTestHarnesses.size()));
- TestSolrConfigHandler.runConfigCommand(client, "/config?wt=json", payload);
+ TestSolrConfigHandler.runConfigCommand(client, "/config", payload);
TestSolrConfigHandler.testForResponseElement(client,
null,
- "/config/overlay?wt=json",
+ "/config/overlay",
null,
Arrays.asList("overlay", "runtimeLib", blobName, "version"),
2l, 10);
@@ -221,11 +221,11 @@ public class TestDynamicLoading extends AbstractFullDistribZkTestBase {
" }\n" +
" }";
- TestSolrConfigHandler.runConfigCommand(client,"/config/params?wt=json",payload);
+ TestSolrConfigHandler.runConfigCommand(client,"/config/params",payload);
TestSolrConfigHandler.testForResponseElement(
client,
null,
- "/config/params?wt=json",
+ "/config/params",
cloudClient,
Arrays.asList("response", "params", "watched", "x"),
"X val",
@@ -233,7 +233,7 @@ public class TestDynamicLoading extends AbstractFullDistribZkTestBase {
result = TestSolrConfigHandler.testForResponseElement(
client,
null,
- "/test1?wt=json",
+ "/test1",
cloudClient,
Arrays.asList("x"),
"X val",
@@ -246,11 +246,11 @@ public class TestDynamicLoading extends AbstractFullDistribZkTestBase {
" }\n" +
" }";
- TestSolrConfigHandler.runConfigCommand(client,"/config/params?wt=json",payload);
+ TestSolrConfigHandler.runConfigCommand(client,"/config/params",payload);
result = TestSolrConfigHandler.testForResponseElement(
client,
null,
- "/test1?wt=json",
+ "/test1",
cloudClient,
Arrays.asList("x"),
"X val changed",
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/core/TestJmxIntegration.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/core/TestJmxIntegration.java b/solr/core/src/test/org/apache/solr/core/TestJmxIntegration.java
index 70df3c5..a0f4071 100644
--- a/solr/core/src/test/org/apache/solr/core/TestJmxIntegration.java
+++ b/solr/core/src/test/org/apache/solr/core/TestJmxIntegration.java
@@ -23,7 +23,6 @@ import org.apache.solr.metrics.reporters.SolrJmxReporter;
import org.apache.solr.util.AbstractSolrTestCase;
import org.junit.AfterClass;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -156,7 +155,7 @@ public class TestJmxIntegration extends AbstractSolrTestCase {
numDocs > oldNumDocs);
}
- @Test @Ignore("timing problem? https://issues.apache.org/jira/browse/SOLR-2715")
+ @Test @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-2715") // timing problem?
public void testJmxOnCoreReload() throws Exception {
String coreName = h.getCore().getName();
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.java b/solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.java
index bbad821..d2c9b80 100644
--- a/solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.java
+++ b/solr/core/src/test/org/apache/solr/core/TestSolrConfigHandler.java
@@ -106,7 +106,7 @@ public class TestSolrConfigHandler extends RestTestBase {
public void testProperty() throws Exception {
RestTestHarness harness = restTestHarness;
- Map confMap = getRespMap("/config?wt=json", harness);
+ Map confMap = getRespMap("/config", harness);
assertNotNull(getObjectByPath(confMap, false, Arrays.asList("config", "requestHandler", "/admin/luke")));
assertNotNull(getObjectByPath(confMap, false, Arrays.asList("config", "requestHandler", "/admin/system")));
assertNotNull(getObjectByPath(confMap, false, Arrays.asList("config", "requestHandler", "/admin/mbeans")));
@@ -120,20 +120,20 @@ public class TestSolrConfigHandler extends RestTestBase {
String payload = "{\n" +
" 'set-property' : { 'updateHandler.autoCommit.maxDocs':100, 'updateHandler.autoCommit.maxTime':10 , 'requestDispatcher.requestParsers.addHttpRequestToContext':true} \n" +
" }";
- runConfigCommand(harness, "/config?wt=json", payload);
+ runConfigCommand(harness, "/config", payload);
- Map m = (Map) getRespMap("/config/overlay?wt=json", harness).get("overlay");
+ Map m = (Map) getRespMap("/config/overlay", harness).get("overlay");
Map props = (Map) m.get("props");
assertNotNull(props);
assertEquals("100", String.valueOf(getObjectByPath(props, true, ImmutableList.of("updateHandler", "autoCommit", "maxDocs"))));
assertEquals("10", String.valueOf(getObjectByPath(props, true, ImmutableList.of("updateHandler", "autoCommit", "maxTime"))));
- m = getRespMap("/config/updateHandler?wt=json", harness);
+ m = getRespMap("/config/updateHandler", harness);
assertNotNull(getObjectByPath(m, true, ImmutableList.of("config","updateHandler", "commitWithin", "softCommit")));
assertNotNull(getObjectByPath(m, true, ImmutableList.of("config","updateHandler", "autoCommit", "maxDocs")));
assertNotNull(getObjectByPath(m, true, ImmutableList.of("config","updateHandler", "autoCommit", "maxTime")));
- m = (Map) getRespMap("/config?wt=json", harness).get("config");
+ m = (Map) getRespMap("/config", harness).get("config");
assertNotNull(m);
assertEquals("100", String.valueOf(getObjectByPath(m, true, ImmutableList.of("updateHandler", "autoCommit", "maxDocs"))));
@@ -142,9 +142,9 @@ public class TestSolrConfigHandler extends RestTestBase {
payload = "{\n" +
" 'unset-property' : 'updateHandler.autoCommit.maxDocs'} \n" +
" }";
- runConfigCommand(harness, "/config?wt=json", payload);
+ runConfigCommand(harness, "/config", payload);
- m = (Map) getRespMap("/config/overlay?wt=json", harness).get("overlay");
+ m = (Map) getRespMap("/config/overlay", harness).get("overlay");
props = (Map) m.get("props");
assertNotNull(props);
assertNull(getObjectByPath(props, true, ImmutableList.of("updateHandler", "autoCommit", "maxDocs")));
@@ -157,15 +157,15 @@ public class TestSolrConfigHandler extends RestTestBase {
" 'set-user-property' : { 'my.custom.variable.a':'MODIFIEDA'," +
" 'my.custom.variable.b':'MODIFIEDB' } \n" +
" }";
- runConfigCommand(harness, "/config?wt=json", payload);
+ runConfigCommand(harness, "/config", payload);
- Map m = (Map) getRespMap("/config/overlay?wt=json", harness).get("overlay");
+ Map m = (Map) getRespMap("/config/overlay", harness).get("overlay");
Map props = (Map) m.get("userProps");
assertNotNull(props);
assertEquals(props.get("my.custom.variable.a"), "MODIFIEDA");
assertEquals(props.get("my.custom.variable.b"), "MODIFIEDB");
- m = (Map) getRespMap("/dump?wt=json&json.nl=map&initArgs=true", harness).get("initArgs");
+ m = (Map) getRespMap("/dump?json.nl=map&initArgs=true", harness).get("initArgs");
m = (Map) m.get(PluginInfo.DEFAULTS);
assertEquals("MODIFIEDA", m.get("a"));
@@ -191,11 +191,11 @@ public class TestSolrConfigHandler extends RestTestBase {
String payload = "{\n" +
"'create-requesthandler' : { 'name' : '/x', 'class': 'org.apache.solr.handler.DumpRequestHandler' , 'startup' : 'lazy'}\n" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config/overlay?wt=json",
+ "/config/overlay",
cloudSolrClient,
Arrays.asList("overlay", "requestHandler", "/x", "startup"),
"lazy",
@@ -205,11 +205,11 @@ public class TestSolrConfigHandler extends RestTestBase {
"'update-requesthandler' : { 'name' : '/x', 'class': 'org.apache.solr.handler.DumpRequestHandler' ,registerPath :'/solr,/v2', " +
" 'startup' : 'lazy' , 'a':'b' , 'defaults': {'def_a':'def A val', 'multival':['a','b','c']}}\n" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config/overlay?wt=json",
+ "/config/overlay",
cloudSolrClient,
Arrays.asList("overlay", "requestHandler", "/x", "a"),
"b",
@@ -222,10 +222,10 @@ public class TestSolrConfigHandler extends RestTestBase {
" 'defaults': {'a':'A','b':'B','c':'C'}}\n" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config/overlay?wt=json",
+ "/config/overlay",
cloudSolrClient,
Arrays.asList("overlay", "requestHandler", "/dump", "defaults", "c" ),
"C",
@@ -233,7 +233,7 @@ public class TestSolrConfigHandler extends RestTestBase {
testForResponseElement(writeHarness,
testServerBaseUrl,
- "/x?wt=json&getdefaults=true&json.nl=map",
+ "/x?getdefaults=true&json.nl=map",
cloudSolrClient,
Arrays.asList("getdefaults", "def_a"),
"def A val",
@@ -241,7 +241,7 @@ public class TestSolrConfigHandler extends RestTestBase {
testForResponseElement(writeHarness,
testServerBaseUrl,
- "/x?wt=json¶m=multival&json.nl=map",
+ "/x?param=multival&json.nl=map",
cloudSolrClient,
Arrays.asList("params", "multival"),
Arrays.asList("a", "b", "c"),
@@ -250,12 +250,12 @@ public class TestSolrConfigHandler extends RestTestBase {
payload = "{\n" +
"'delete-requesthandler' : '/x'" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
boolean success = false;
long startTime = System.nanoTime();
int maxTimeoutSeconds = 10;
while (TimeUnit.SECONDS.convert(System.nanoTime() - startTime, TimeUnit.NANOSECONDS) < maxTimeoutSeconds) {
- String uri = "/config/overlay?wt=json";
+ String uri = "/config/overlay";
Map m = testServerBaseUrl == null ? getRespMap(uri, writeHarness) : TestSolrConfigHandlerConcurrent.getAsMap(testServerBaseUrl + uri, cloudSolrClient);
if (null == Utils.getObjectByPath(m, true, Arrays.asList("overlay", "requestHandler", "/x", "a"))) {
success = true;
@@ -269,10 +269,10 @@ public class TestSolrConfigHandler extends RestTestBase {
payload = "{\n" +
"'create-queryconverter' : { 'name' : 'qc', 'class': 'org.apache.solr.spelling.SpellingQueryConverter'}\n" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config?wt=json",
+ "/config",
cloudSolrClient,
Arrays.asList("config", "queryConverter", "qc", "class"),
"org.apache.solr.spelling.SpellingQueryConverter",
@@ -280,10 +280,10 @@ public class TestSolrConfigHandler extends RestTestBase {
payload = "{\n" +
"'update-queryconverter' : { 'name' : 'qc', 'class': 'org.apache.solr.spelling.SuggestQueryConverter'}\n" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config?wt=json",
+ "/config",
cloudSolrClient,
Arrays.asList("config", "queryConverter", "qc", "class"),
"org.apache.solr.spelling.SuggestQueryConverter",
@@ -292,10 +292,10 @@ public class TestSolrConfigHandler extends RestTestBase {
payload = "{\n" +
"'delete-queryconverter' : 'qc'" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config?wt=json",
+ "/config",
cloudSolrClient,
Arrays.asList("config", "queryConverter", "qc"),
null,
@@ -304,10 +304,10 @@ public class TestSolrConfigHandler extends RestTestBase {
payload = "{\n" +
"'create-searchcomponent' : { 'name' : 'tc', 'class': 'org.apache.solr.handler.component.TermsComponent'}\n" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config?wt=json",
+ "/config",
cloudSolrClient,
Arrays.asList("config", "searchComponent", "tc", "class"),
"org.apache.solr.handler.component.TermsComponent",
@@ -315,10 +315,10 @@ public class TestSolrConfigHandler extends RestTestBase {
payload = "{\n" +
"'update-searchcomponent' : { 'name' : 'tc', 'class': 'org.apache.solr.handler.component.TermVectorComponent' }\n" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config?wt=json",
+ "/config",
cloudSolrClient,
Arrays.asList("config", "searchComponent", "tc", "class"),
"org.apache.solr.handler.component.TermVectorComponent",
@@ -327,10 +327,10 @@ public class TestSolrConfigHandler extends RestTestBase {
payload = "{\n" +
"'delete-searchcomponent' : 'tc'" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config?wt=json",
+ "/config",
cloudSolrClient,
Arrays.asList("config", "searchComponent", "tc"),
null,
@@ -339,10 +339,10 @@ public class TestSolrConfigHandler extends RestTestBase {
payload = "{\n" +
"'create-valuesourceparser' : { 'name' : 'cu', 'class': 'org.apache.solr.core.CountUsageValueSourceParser'}\n" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config?wt=json",
+ "/config",
cloudSolrClient,
Arrays.asList("config", "valueSourceParser", "cu", "class"),
"org.apache.solr.core.CountUsageValueSourceParser",
@@ -353,10 +353,10 @@ public class TestSolrConfigHandler extends RestTestBase {
payload = "{\n" +
"'update-valuesourceparser' : { 'name' : 'cu', 'class': 'org.apache.solr.search.function.NvlValueSourceParser'}\n" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config?wt=json",
+ "/config",
cloudSolrClient,
Arrays.asList("config", "valueSourceParser", "cu", "class"),
"org.apache.solr.search.function.NvlValueSourceParser",
@@ -365,10 +365,10 @@ public class TestSolrConfigHandler extends RestTestBase {
payload = "{\n" +
"'delete-valuesourceparser' : 'cu'" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config?wt=json",
+ "/config",
cloudSolrClient,
Arrays.asList("config", "valueSourceParser", "cu"),
null,
@@ -379,10 +379,10 @@ public class TestSolrConfigHandler extends RestTestBase {
payload = "{\n" +
"'create-transformer' : { 'name' : 'mytrans', 'class': 'org.apache.solr.response.transform.ValueAugmenterFactory', 'value':'5'}\n" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config?wt=json",
+ "/config",
cloudSolrClient,
Arrays.asList("config", "transformer", "mytrans", "class"),
"org.apache.solr.response.transform.ValueAugmenterFactory",
@@ -391,10 +391,10 @@ public class TestSolrConfigHandler extends RestTestBase {
payload = "{\n" +
"'update-transformer' : { 'name' : 'mytrans', 'class': 'org.apache.solr.response.transform.ValueAugmenterFactory', 'value':'6'}\n" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config?wt=json",
+ "/config",
cloudSolrClient,
Arrays.asList("config", "transformer", "mytrans", "value"),
"6",
@@ -404,10 +404,10 @@ public class TestSolrConfigHandler extends RestTestBase {
"'delete-transformer' : 'mytrans'," +
"'create-initparams' : { 'name' : 'hello', 'key':'val'}\n" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
Map map = testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config?wt=json",
+ "/config",
cloudSolrClient,
Arrays.asList("config", "transformer", "mytrans"),
null,
@@ -431,10 +431,10 @@ public class TestSolrConfigHandler extends RestTestBase {
" }\n" +
" }\n" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
map = testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config?wt=json",
+ "/config",
cloudSolrClient,
Arrays.asList("config", "searchComponent","myspellcheck", "spellchecker", "class"),
"solr.DirectSolrSpellChecker",
@@ -449,16 +449,16 @@ public class TestSolrConfigHandler extends RestTestBase {
" {name: s2,lookupImpl: FuzzyLookupFactory , dictionaryImpl : DocumentExpressionDictionaryFactory}]" +
" }\n" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
map = testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config?wt=json",
+ "/config",
cloudSolrClient,
Arrays.asList("config", "requestHandler","/dump100", "class"),
"org.apache.solr.handler.DumpRequestHandler",
10);
- map = getRespMap("/dump100?wt=json&json.nl=arrmap&initArgs=true", writeHarness);
+ map = getRespMap("/dump100?json.nl=arrmap&initArgs=true", writeHarness);
List initArgs = (List) map.get("initArgs");
assertNotNull(initArgs);
assertTrue(initArgs.size() >= 2);
@@ -471,11 +471,11 @@ public class TestSolrConfigHandler extends RestTestBase {
" registerPath :'/solr,/v2'"+
", 'startup' : 'lazy'}\n" +
"}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config/overlay?wt=json",
+ "/config/overlay",
cloudSolrClient,
Arrays.asList("overlay", "requestHandler", "/dump101", "startup"),
"lazy",
@@ -484,18 +484,18 @@ public class TestSolrConfigHandler extends RestTestBase {
payload = "{\n" +
"'add-cache' : {name:'lfuCacheDecayFalse', class:'solr.search.LFUCache', size:10 ,initialSize:9 , timeDecay:false }," +
"'add-cache' : {name: 'perSegFilter', class: 'solr.search.LRUCache', size:10, initialSize:0 , autowarmCount:10}}";
- runConfigCommand(writeHarness, "/config?wt=json", payload);
+ runConfigCommand(writeHarness, "/config", payload);
map = testForResponseElement(writeHarness,
testServerBaseUrl,
- "/config/overlay?wt=json",
+ "/config/overlay",
cloudSolrClient,
Arrays.asList("overlay", "cache", "lfuCacheDecayFalse", "class"),
"solr.search.LFUCache",
10);
assertEquals("solr.search.LRUCache",getObjectByPath(map, true, ImmutableList.of("overlay", "cache", "perSegFilter", "class")));
- map = getRespMap("/dump101?cacheNames=lfuCacheDecayFalse&cacheNames=perSegFilter&wt=json", writeHarness);
+ map = getRespMap("/dump101?cacheNames=lfuCacheDecayFalse&cacheNames=perSegFilter", writeHarness);
assertEquals("Actual output "+ Utils.toJSONString(map), "org.apache.solr.search.LRUCache",getObjectByPath(map, true, ImmutableList.of( "caches", "perSegFilter")));
assertEquals("Actual output "+ Utils.toJSONString(map), "org.apache.solr.search.LFUCache",getObjectByPath(map, true, ImmutableList.of( "caches", "lfuCacheDecayFalse")));
@@ -569,12 +569,12 @@ public class TestSolrConfigHandler extends RestTestBase {
" }";
- TestSolrConfigHandler.runConfigCommand(harness, "/config/params?wt=json", payload);
+ TestSolrConfigHandler.runConfigCommand(harness, "/config/params", payload);
TestSolrConfigHandler.testForResponseElement(
harness,
null,
- "/config/params?wt=json",
+ "/config/params",
null,
Arrays.asList("response", "params", "x", "a"),
"A val",
@@ -583,7 +583,7 @@ public class TestSolrConfigHandler extends RestTestBase {
TestSolrConfigHandler.testForResponseElement(
harness,
null,
- "/config/params?wt=json",
+ "/config/params",
null,
Arrays.asList("response", "params", "x", "b"),
"B val",
@@ -593,12 +593,12 @@ public class TestSolrConfigHandler extends RestTestBase {
"'create-requesthandler' : { 'name' : '/d', registerPath :'/solr,/v2' , 'class': 'org.apache.solr.handler.DumpRequestHandler' }\n" +
"}";
- TestSolrConfigHandler.runConfigCommand(harness, "/config?wt=json", payload);
+ TestSolrConfigHandler.runConfigCommand(harness, "/config", payload);
TestSolrConfigHandler.testForResponseElement(
harness,
null,
- "/config/overlay?wt=json",
+ "/config/overlay",
null,
Arrays.asList("overlay", "requestHandler", "/d", "name"),
"/d",
@@ -606,14 +606,14 @@ public class TestSolrConfigHandler extends RestTestBase {
TestSolrConfigHandler.testForResponseElement(harness,
null,
- "/d?wt=json&useParams=x",
+ "/d?useParams=x",
null,
Arrays.asList("params", "a"),
"A val",
5);
TestSolrConfigHandler.testForResponseElement(harness,
null,
- "/d?wt=json&useParams=x&a=fomrequest",
+ "/d?useParams=x&a=fomrequest",
null,
Arrays.asList("params", "a"),
"fomrequest",
@@ -623,11 +623,11 @@ public class TestSolrConfigHandler extends RestTestBase {
"'create-requesthandler' : { 'name' : '/dump1', registerPath :'/solr,/v2' , 'class': 'org.apache.solr.handler.DumpRequestHandler', 'useParams':'x' }\n" +
"}";
- TestSolrConfigHandler.runConfigCommand(harness, "/config?wt=json", payload);
+ TestSolrConfigHandler.runConfigCommand(harness, "/config", payload);
TestSolrConfigHandler.testForResponseElement(harness,
null,
- "/config/overlay?wt=json",
+ "/config/overlay",
null,
Arrays.asList("overlay", "requestHandler", "/dump1", "name"),
"/dump1",
@@ -636,7 +636,7 @@ public class TestSolrConfigHandler extends RestTestBase {
TestSolrConfigHandler.testForResponseElement(
harness,
null,
- "/dump1?wt=json",
+ "/dump1",
null,
Arrays.asList("params", "a"),
"A val",
@@ -652,12 +652,12 @@ public class TestSolrConfigHandler extends RestTestBase {
" }";
- TestSolrConfigHandler.runConfigCommand(harness, "/config/params?wt=json", payload);
+ TestSolrConfigHandler.runConfigCommand(harness, "/config/params", payload);
TestSolrConfigHandler.testForResponseElement(
harness,
null,
- "/config/params?wt=json",
+ "/config/params",
null,
Arrays.asList("response", "params", "y", "c"),
"CY val",
@@ -665,7 +665,7 @@ public class TestSolrConfigHandler extends RestTestBase {
TestSolrConfigHandler.testForResponseElement(harness,
null,
- "/dump1?wt=json&useParams=y",
+ "/dump1?useParams=y",
null,
Arrays.asList("params", "c"),
"CY val",
@@ -675,7 +675,7 @@ public class TestSolrConfigHandler extends RestTestBase {
TestSolrConfigHandler.testForResponseElement(
harness,
null,
- "/dump1?wt=json&useParams=y",
+ "/dump1?useParams=y",
null,
Arrays.asList("params", "b"),
"BY val",
@@ -684,7 +684,7 @@ public class TestSolrConfigHandler extends RestTestBase {
TestSolrConfigHandler.testForResponseElement(
harness,
null,
- "/dump1?wt=json&useParams=y",
+ "/dump1?useParams=y",
null,
Arrays.asList("params", "a"),
"A val",
@@ -693,7 +693,7 @@ public class TestSolrConfigHandler extends RestTestBase {
TestSolrConfigHandler.testForResponseElement(
harness,
null,
- "/dump1?wt=json&useParams=y",
+ "/dump1?useParams=y",
null,
Arrays.asList("params", "d"),
Arrays.asList("val 1", "val 2"),
@@ -709,12 +709,12 @@ public class TestSolrConfigHandler extends RestTestBase {
" }";
- TestSolrConfigHandler.runConfigCommand(harness, "/config/params?wt=json", payload);
+ TestSolrConfigHandler.runConfigCommand(harness, "/config/params", payload);
TestSolrConfigHandler.testForResponseElement(
harness,
null,
- "/config/params?wt=json",
+ "/config/params",
null,
Arrays.asList("response", "params", "y", "c"),
"CY val modified",
@@ -723,7 +723,7 @@ public class TestSolrConfigHandler extends RestTestBase {
TestSolrConfigHandler.testForResponseElement(
harness,
null,
- "/config/params?wt=json",
+ "/config/params",
null,
Arrays.asList("response", "params", "y", "e"),
"EY val",
@@ -738,11 +738,11 @@ public class TestSolrConfigHandler extends RestTestBase {
" }";
- TestSolrConfigHandler.runConfigCommand(harness, "/config/params?wt=json", payload);
+ TestSolrConfigHandler.runConfigCommand(harness, "/config/params", payload);
TestSolrConfigHandler.testForResponseElement(
harness,
null,
- "/config/params?wt=json",
+ "/config/params",
null,
Arrays.asList("response", "params", "y", "p"),
"P val",
@@ -751,17 +751,17 @@ public class TestSolrConfigHandler extends RestTestBase {
TestSolrConfigHandler.testForResponseElement(
harness,
null,
- "/config/params?wt=json",
+ "/config/params",
null,
Arrays.asList("response", "params", "y", "c"),
null,
10);
payload = " {'delete' : 'y'}";
- TestSolrConfigHandler.runConfigCommand(harness, "/config/params?wt=json", payload);
+ TestSolrConfigHandler.runConfigCommand(harness, "/config/params", payload);
TestSolrConfigHandler.testForResponseElement(
harness,
null,
- "/config/params?wt=json",
+ "/config/params",
null,
Arrays.asList("response", "params", "y", "p"),
null,
@@ -786,10 +786,10 @@ public class TestSolrConfigHandler extends RestTestBase {
" }\n" +
"}";
- TestSolrConfigHandler.runConfigCommand(harness, "/config?wt=json", payload);
+ TestSolrConfigHandler.runConfigCommand(harness, "/config", payload);
TestSolrConfigHandler.testForResponseElement(harness,
null,
- "/config/overlay?wt=json",
+ "/config/overlay",
null,
Arrays.asList("overlay", "requestHandler", "aRequestHandler", "class"),
"org.apache.solr.handler.DumpRequestHandler",
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/8d00e53b/solr/core/src/test/org/apache/solr/handler/CheckBackupStatus.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/CheckBackupStatus.java b/solr/core/src/test/org/apache/solr/handler/CheckBackupStatus.java
index f84d89f..bd9b1eb 100644
--- a/solr/core/src/test/org/apache/solr/handler/CheckBackupStatus.java
+++ b/solr/core/src/test/org/apache/solr/handler/CheckBackupStatus.java
@@ -46,7 +46,7 @@ public class CheckBackupStatus extends SolrTestCaseJ4 {
}
public void fetchStatus() throws IOException {
- String masterUrl = client.getBaseURL() + "/" + coreName + ReplicationHandler.PATH + "?command=" + ReplicationHandler.CMD_DETAILS;
+ String masterUrl = client.getBaseURL() + "/" + coreName + ReplicationHandler.PATH + "?wt=xml&command=" + ReplicationHandler.CMD_DETAILS;
response = client.getHttpClient().execute(new HttpGet(masterUrl), new BasicResponseHandler());
if(pException.matcher(response).find()) {
fail("Failed to create backup");