mirror of https://github.com/apache/lucene.git
SOLR-13079: refactor and harden common 'suspend-trigger' patern in autoscaling test setup
This commit is contained in:
parent
dcd4a288b4
commit
73299f0f22
|
@ -21,20 +21,37 @@ import java.io.IOException;
|
|||
import java.lang.invoke.MethodHandles;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
|
||||
import org.apache.solr.client.solrj.SolrClient;
|
||||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
import org.apache.solr.client.solrj.SolrResponse;
|
||||
import org.apache.solr.client.solrj.cloud.SolrCloudManager;
|
||||
import org.apache.solr.client.solrj.request.RequestWriter;
|
||||
import org.apache.solr.client.solrj.request.RequestWriter.StringPayloadContentWriter;
|
||||
import org.apache.solr.client.solrj.request.V2Request;
|
||||
import org.apache.solr.client.solrj.response.SolrResponseBase;
|
||||
|
||||
import org.apache.solr.common.cloud.ClusterState;
|
||||
import org.apache.solr.common.cloud.CollectionStatePredicate;
|
||||
import org.apache.solr.common.cloud.DocCollection;
|
||||
import org.apache.solr.common.cloud.Replica;
|
||||
import org.apache.solr.common.cloud.Slice;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.util.TimeOut;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.junit.Assert;
|
||||
|
||||
import static org.apache.solr.common.params.CommonParams.JSON_MIME;
|
||||
|
||||
|
||||
/**
|
||||
* Some useful methods for SolrCloud tests.
|
||||
|
@ -172,4 +189,119 @@ public class CloudTestUtils {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for a particular named trigger to be scheduled.
|
||||
* <p>
|
||||
* This is a convenience method that polls the autoscaling API looking for a trigger with the
|
||||
* specified name using the {@link #DEFAULT_TIMEOUT}. It is particularly useful for tests
|
||||
* that want to know when the Overseer has finished scheduling the automatic triggers on startup.
|
||||
* </p>
|
||||
*
|
||||
* @param cloudManager current instance of {@link SolrCloudManager}
|
||||
* @param triggerName the name of the trigger we need to see sheduled in order to return successfully
|
||||
*/
|
||||
public static long waitForTriggerToBeScheduled(final SolrCloudManager cloudManager,
|
||||
final String triggerName)
|
||||
throws InterruptedException, TimeoutException, IOException {
|
||||
|
||||
TimeOut timeout = new TimeOut(DEFAULT_TIMEOUT, TimeUnit.SECONDS, cloudManager.getTimeSource());
|
||||
while (!timeout.hasTimedOut()) {
|
||||
final SolrResponse response = cloudManager.request(AutoScalingRequest.create(SolrRequest.METHOD.GET, null));
|
||||
final Map<String,?> triggers = (Map<String,?>) response.getResponse().get("triggers");
|
||||
Assert.assertNotNull("null triggers in response from autoscaling request", triggers);
|
||||
|
||||
if ( triggers.containsKey(triggerName) ) {
|
||||
return timeout.timeElapsed(TimeUnit.MILLISECONDS);
|
||||
}
|
||||
timeout.sleep(100);
|
||||
}
|
||||
throw new TimeoutException("Never saw trigger with name: " + triggerName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Suspends the trigger with the specified name
|
||||
* <p>
|
||||
* This is a convenience method that sends a <code>suspend-trigger</code> command to the autoscaling
|
||||
* API for the specified trigger. It is particularly useful for tests that may need to disable automatic
|
||||
* triggers such as <code>.scheduled_maintenance</code> in order to test their own
|
||||
* triggers.
|
||||
* </p>
|
||||
*
|
||||
* @param cloudManager current instance of {@link SolrCloudManager}
|
||||
* @param triggerName the name of the trigger to suspend. This must already be scheduled.
|
||||
*/
|
||||
public static void suspendTrigger(final SolrCloudManager cloudManager,
|
||||
final String triggerName) throws IOException {
|
||||
|
||||
final SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST,
|
||||
"{'suspend-trigger' : {'name' : '"+triggerName+"'} }");
|
||||
final SolrResponse rsp = cloudManager.request(req);
|
||||
final String result = rsp.getResponse().get("result").toString();
|
||||
Assert.assertEquals("Unexpected 'result' in response: " + rsp,
|
||||
"success", result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper class for sending (JSON) autoscaling requests that can randomize between V1 and V2 requests
|
||||
*/
|
||||
public static class AutoScalingRequest extends SolrRequest {
|
||||
|
||||
/**
|
||||
* Creates a request using a randomized root path (V1 vs V2)
|
||||
*
|
||||
* @param m HTTP Method to use
|
||||
* @aram message JSON payload, may be null
|
||||
*/
|
||||
public static SolrRequest create(SolrRequest.METHOD m, String message) {
|
||||
return create(m, null, message);
|
||||
}
|
||||
/**
|
||||
* Creates a request using a randomized root path (V1 vs V2)
|
||||
*
|
||||
* @param m HTTP Method to use
|
||||
* @param subPath optional sub-path under <code>"$ROOT/autoscaling"</code>. may be null,
|
||||
* otherwise must start with "/"
|
||||
* @param message JSON payload, may be null
|
||||
*/
|
||||
public static SolrRequest create(SolrRequest.METHOD m, String subPath, String message) {
|
||||
final boolean useV1 = LuceneTestCase.random().nextBoolean();
|
||||
String path = useV1 ? "/admin/autoscaling" : "/cluster/autoscaling";
|
||||
if (null != subPath) {
|
||||
assert subPath.startsWith("/");
|
||||
path += subPath;
|
||||
}
|
||||
return useV1
|
||||
? new AutoScalingRequest(m, path, message)
|
||||
: new V2Request.Builder(path).withMethod(m).withPayload(message).build();
|
||||
}
|
||||
|
||||
protected final String message;
|
||||
|
||||
/**
|
||||
* Simple request
|
||||
* @param m HTTP Method to use
|
||||
* @param path path to send request to
|
||||
* @param message JSON payload, may be null
|
||||
*/
|
||||
private AutoScalingRequest(METHOD m, String path, String message) {
|
||||
super(m, path);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SolrParams getParams() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequestWriter.ContentWriter getContentWriter(String expectedType) {
|
||||
return message == null ? null : new StringPayloadContentWriter(message, JSON_MIME);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SolrResponse createResponse(SolrClient client) {
|
||||
return new SolrResponseBase();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,13 +31,15 @@ import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
|||
import org.apache.solr.client.solrj.request.CoreAdminRequest;
|
||||
import org.apache.solr.client.solrj.response.CoreAdminResponse;
|
||||
import org.apache.solr.client.solrj.response.RequestStatusState;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.solr.cloud.ReplaceNodeTest.createReplaceNodeRequest;
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
|
||||
@LuceneTestCase.AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/SOLR-11067")
|
||||
public class ReplaceNodeNoTargetTest extends SolrCloudTestCase {
|
||||
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
@ -69,7 +71,7 @@ public class ReplaceNodeNoTargetTest extends SolrCloudTestCase {
|
|||
String setClusterPolicyCommand = "{" +
|
||||
" 'set-cluster-policy': [" +
|
||||
" {'replica':'<5', 'shard': '#EACH', 'node': '#ANY'}]}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
solrClient.request(req);
|
||||
|
||||
log.info("Creating collection...");
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.apache.solr.client.solrj.SolrRequest;
|
|||
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.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.common.cloud.DocCollection;
|
||||
import org.apache.solr.common.cloud.Replica;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
|
@ -36,8 +37,6 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
|
||||
@LogLevel("org.apache.solr.cloud.autoscaling=DEBUG;org.apache.solr.cloud.Overseer=DEBUG;org.apache.solr.cloud.overseer=DEBUG;org.apache.solr.client.solrj.impl.SolrClientDataProvider=DEBUG;org.apache.solr.client.solrj.cloud.autoscaling.PolicyHelper=TRACE")
|
||||
public class TestUtilizeNode extends SolrCloudTestCase {
|
||||
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
@ -114,7 +113,7 @@ public class TestUtilizeNode extends SolrCloudTestCase {
|
|||
"}";
|
||||
log.info("Setting new policy to blacklist jettyX ({}) port={}",
|
||||
jettyX.getNodeName(), jettyX.getLocalPort());
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
NamedList<Object> response = cloudClient.request(req);
|
||||
assertEquals(req + " => " + response,
|
||||
"success", response.get("result").toString());
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
package org.apache.solr.cloud;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
import static org.apache.solr.common.params.CollectionAdminParams.WITH_COLLECTION;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -36,6 +35,7 @@ import org.apache.solr.client.solrj.impl.CloudSolrClient;
|
|||
import org.apache.solr.client.solrj.impl.HttpSolrClient;
|
||||
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
||||
import org.apache.solr.client.solrj.response.CollectionAdminResponse;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.autoscaling.ActionContext;
|
||||
import org.apache.solr.cloud.autoscaling.ComputePlanAction;
|
||||
import org.apache.solr.cloud.autoscaling.ExecutePlanAction;
|
||||
|
@ -133,7 +133,7 @@ public class TestWithCollection extends SolrCloudTestCase {
|
|||
" {'cores':'<10', 'node':'#ANY'}," +
|
||||
" ]" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
solrClient.request(req);
|
||||
|
||||
String chosenNode = cluster.getRandomJetty(random()).getNodeName();
|
||||
|
@ -252,7 +252,7 @@ public class TestWithCollection extends SolrCloudTestCase {
|
|||
" {'replica':'<2', 'node':'#ANY'}," +
|
||||
" ]" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
solrClient.request(req);
|
||||
|
||||
String chosenNode = cluster.getRandomJetty(random()).getNodeName();
|
||||
|
@ -293,7 +293,7 @@ public class TestWithCollection extends SolrCloudTestCase {
|
|||
" {'replica':'<2', 'node':'#ANY'}," +
|
||||
" ]" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
solrClient.request(req);
|
||||
|
||||
String chosenNode = cluster.getRandomJetty(random()).getNodeName();
|
||||
|
@ -343,7 +343,7 @@ public class TestWithCollection extends SolrCloudTestCase {
|
|||
" {'replica':'<2', 'node':'#ANY'}," +
|
||||
" ]" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
solrClient.request(req);
|
||||
|
||||
String chosenNode = cluster.getRandomJetty(random()).getNodeName();
|
||||
|
@ -405,7 +405,7 @@ public class TestWithCollection extends SolrCloudTestCase {
|
|||
" {'replica':'<2', 'node':'#ANY'}," +
|
||||
" ]" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
solrClient.request(req);
|
||||
|
||||
String chosenNode = cluster.getRandomJetty(random()).getNodeName();
|
||||
|
@ -431,7 +431,7 @@ public class TestWithCollection extends SolrCloudTestCase {
|
|||
"{'name' : 'compute', 'class' : '" + CapturingAction.class.getName() + "'}" +
|
||||
"]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
solrClient.request(req);
|
||||
|
||||
Optional<JettySolrRunner> other = cluster.getJettySolrRunners()
|
||||
|
@ -522,7 +522,7 @@ public class TestWithCollection extends SolrCloudTestCase {
|
|||
" {'replica':'<2', 'node':'#ANY'}," +
|
||||
" ]" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
solrClient.request(req);
|
||||
|
||||
String chosenNode = cluster.getJettySolrRunner(0).getNodeName();
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
package org.apache.solr.cloud.autoscaling;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
@ -34,6 +32,7 @@ import org.apache.solr.client.solrj.impl.CloudSolrClient;
|
|||
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
||||
import org.apache.solr.client.solrj.request.V2Request;
|
||||
import org.apache.solr.cloud.CloudDescriptor;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.cloud.ClusterStateUtil;
|
||||
|
@ -113,7 +112,7 @@ public class AutoAddReplicasPlanActionTest extends SolrCloudTestCase{
|
|||
"'removeListeners': true" +
|
||||
"}" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, removeTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, removeTriggerCommand);
|
||||
NamedList response = cluster.getSolrClient().request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -148,7 +147,7 @@ public class AutoAddReplicasPlanActionTest extends SolrCloudTestCase{
|
|||
"'set-cluster-preferences': [" +
|
||||
"{'minimize': 'cores','precision': 0}]" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPreferencesCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPreferencesCommand);
|
||||
|
||||
// you can hit a stale connection from pool when restarting jetty
|
||||
try (CloudSolrClient cloudClient = new CloudSolrClient.Builder(Collections.singletonList(cluster.getZkServer().getZkAddress()),
|
||||
|
|
|
@ -25,23 +25,18 @@ import java.util.concurrent.CountDownLatch;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.solr.client.solrj.SolrClient;
|
||||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
import org.apache.solr.client.solrj.SolrResponse;
|
||||
import org.apache.solr.client.solrj.SolrServerException;
|
||||
import org.apache.solr.client.solrj.cloud.autoscaling.Policy;
|
||||
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
||||
import org.apache.solr.client.solrj.impl.CloudSolrClient;
|
||||
import org.apache.solr.client.solrj.impl.HttpSolrClient;
|
||||
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
||||
import org.apache.solr.client.solrj.request.RequestWriter;
|
||||
import org.apache.solr.client.solrj.request.RequestWriter.StringPayloadContentWriter;
|
||||
import org.apache.solr.client.solrj.request.V2Request;
|
||||
import org.apache.solr.client.solrj.response.CollectionAdminResponse;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.cloud.ZkNodeProps;
|
||||
import org.apache.solr.common.params.AutoScalingParams;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.common.util.TimeSource;
|
||||
import org.apache.solr.common.util.Utils;
|
||||
|
@ -54,7 +49,6 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.solr.common.cloud.ZkStateReader.SOLR_AUTOSCALING_CONF_PATH;
|
||||
import static org.apache.solr.common.params.CommonParams.JSON_MIME;
|
||||
import static org.apache.solr.common.util.Utils.getObjectByPath;
|
||||
|
||||
/**
|
||||
|
@ -96,19 +90,6 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public static SolrRequest createAutoScalingRequest(SolrRequest.METHOD m, String message) {
|
||||
return createAutoScalingRequest(m, null, message);
|
||||
}
|
||||
|
||||
static SolrRequest createAutoScalingRequest(SolrRequest.METHOD m, String subPath, String message) {
|
||||
boolean useV1 = random().nextBoolean();
|
||||
String path = useV1 ? "/admin/autoscaling" : "/cluster/autoscaling";
|
||||
path += subPath != null ? subPath : "";
|
||||
return useV1
|
||||
? new AutoScalingRequest(m, path, message)
|
||||
: new V2Request.Builder(path).withMethod(m).withPayload(message).build();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void beforeTest() throws Exception {
|
||||
// clear any persisted auto scaling configuration
|
||||
|
@ -129,11 +110,11 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"\t}\n" +
|
||||
"}";
|
||||
// these should be no-ops because there are no triggers, and it should succeed
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendEachCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, suspendEachCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
assertEquals(response.get("changed").toString(), "[]");
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, resumeEachCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, resumeEachCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
assertEquals(response.get("changed").toString(), "[]");
|
||||
|
@ -144,7 +125,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'event' : 'nodeLost'," +
|
||||
"'waitFor' : '10m'," +
|
||||
"'enabled' : true}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -156,7 +137,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'enabled' : true" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -165,7 +146,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"\t\t\"name\" : \"node_lost_trigger\"\n" +
|
||||
"\t}\n" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
assertEquals(response.get("changed").toString(), "[node_lost_trigger]");
|
||||
|
@ -190,7 +171,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'name' : '" + Policy.EACH + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
List<String> changed = (List<String>) response.get("changed");
|
||||
|
@ -213,7 +194,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'name' : 'node_added_trigger'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
changed = (List<String>) response.get("changed");
|
||||
|
@ -236,7 +217,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'name' : '" + Policy.EACH + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
changed = (List<String>) response.get("changed");
|
||||
|
@ -260,7 +241,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'timeout' : '1h'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
changed = (List<String>) response.get("changed");
|
||||
|
@ -291,7 +272,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'name' : 'compute_plan'," +
|
||||
"'class' : 'solr.ComputePlanAction'" +
|
||||
"}]}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
@ -316,7 +297,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'waitFor' : '20m'," +
|
||||
"'enabled' : false" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
data = zkClient().getData(SOLR_AUTOSCALING_CONF_PATH, null, null, true);
|
||||
|
@ -344,7 +325,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'url' : 'http://xyz.com/on_node_lost?node={$LOST_NODE_NAME}'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
data = zkClient().getData(SOLR_AUTOSCALING_CONF_PATH, null, null, true);
|
||||
|
@ -362,7 +343,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'name' : 'node_lost_trigger'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, removeTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, removeTriggerCommand);
|
||||
try {
|
||||
solrClient.request(req);
|
||||
fail("expected exception");
|
||||
|
@ -377,7 +358,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"\t\t\"name\" : \"xyz\"\n" +
|
||||
"\t}\n" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, removeListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, removeListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
data = zkClient().getData(SOLR_AUTOSCALING_CONF_PATH, null, null, true);
|
||||
|
@ -391,7 +372,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'name' : 'node_lost_trigger'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, removeTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, removeTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
data = zkClient().getData(SOLR_AUTOSCALING_CONF_PATH, null, null, true);
|
||||
|
@ -410,7 +391,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'url' : 'http://xyz.com/on_node_lost?node={$LOST_NODE_NAME}'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
try {
|
||||
solrClient.request(req);
|
||||
fail("should have thrown Exception");
|
||||
|
@ -433,7 +414,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
" ]" +
|
||||
"}";
|
||||
try {
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
solrClient.request(req);
|
||||
fail("expect exception");
|
||||
} catch (HttpSolrClient.RemoteExecutionException e) {
|
||||
|
@ -460,7 +441,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'name' : 'compute_plan'," +
|
||||
"'class' : 'solr.ComputePlanAction'" +
|
||||
"}]}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
|
||||
try {
|
||||
solrClient.request(req);
|
||||
|
@ -484,7 +465,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'name' : 'compute_plan'," +
|
||||
"'class' : 'solr.ComputePlanAction'" +
|
||||
"}]}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
|
||||
try {
|
||||
solrClient.request(req);
|
||||
|
@ -508,7 +489,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'foo' : 'bar'," +
|
||||
"'class' : 'solr.ComputePlanAction'" +
|
||||
"}]}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
|
||||
try {
|
||||
solrClient.request(req);
|
||||
|
@ -531,7 +512,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'name' : 'compute_plan'," +
|
||||
"'class' : 'solr.ComputePlanAction'" +
|
||||
"}]}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
@ -548,7 +529,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'url' : 'http://xyz.com/on_node_lost?node={$LOST_NODE_NAME}'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
try {
|
||||
solrClient.request(req);
|
||||
fail("should have thrown Exception");
|
||||
|
@ -573,7 +554,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
" {'replica':'<2', 'shard': '#EACH', 'node': '#ANY'}" +
|
||||
" ]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setPolicyCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setPolicyCommand);
|
||||
NamedList<Object> response = null;
|
||||
try {
|
||||
solrClient.request(req);
|
||||
|
@ -594,7 +575,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
" {'replica':'<2', 'shard': '#EACH', 'node': '#ANY'}" +
|
||||
" ]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setPolicyCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setPolicyCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -611,7 +592,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
" {'replica':'<2', 'shard': '#EACH', 'node': '#ANY'}" +
|
||||
" ]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setPolicyCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setPolicyCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
data = zkClient().getData(SOLR_AUTOSCALING_CONF_PATH, null, null, true);
|
||||
|
@ -622,7 +603,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
|
||||
// remove policy
|
||||
String removePolicyCommand = "{remove-policy : policy1}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, removePolicyCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, removePolicyCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
data = zkClient().getData(SOLR_AUTOSCALING_CONF_PATH, null, null, true);
|
||||
|
@ -637,7 +618,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
" {'maximize': 'freedisk','precision': 100}," +
|
||||
" {'minimize': 'sysLoadAvg','precision': 10}]" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setPreferencesCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setPreferencesCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
data = zkClient().getData(SOLR_AUTOSCALING_CONF_PATH, null, null, true);
|
||||
|
@ -650,7 +631,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
" 'set-cluster-preferences': [" +
|
||||
" {'minimize': 'sysLoadAvg','precision': 10}]" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setPreferencesCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setPreferencesCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
data = zkClient().getData(SOLR_AUTOSCALING_CONF_PATH, null, null, true);
|
||||
|
@ -665,7 +646,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
" {'nodeRole':'!overseer', 'replica':0}" +
|
||||
" ]" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
data = zkClient().getData(SOLR_AUTOSCALING_CONF_PATH, null, null, true);
|
||||
|
@ -687,7 +668,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'waitFor' : '0s'," +
|
||||
"'enabled' : true" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -696,7 +677,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
" {'cores':'<10', 'node':'#ANY'}," +
|
||||
" {'replica':'<3', 'shard': '#EACH', 'node': '#ANY'}]" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -707,7 +688,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
" {'minimize': 'sysLoadAvg','precision': 10}," +
|
||||
" {'minimize': 'heapUsage','precision': 10}]" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setPreferencesCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setPreferencesCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -715,11 +696,11 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
" 'xyz':[{'replica':'<2', 'shard': '#EACH', 'node': '#ANY'}]," +
|
||||
" 'policy1':[{'replica':'<2', 'shard': '#EACH', 'node': '#ANY'}]," +
|
||||
" 'policy2':[{'replica':'<7', 'shard': '#EACH', 'node': '#ANY'}]}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setPolicyCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setPolicyCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.GET, null);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.GET, null);
|
||||
response = solrClient.request(req);
|
||||
|
||||
Map triggers = (Map) response.get("triggers");
|
||||
|
@ -746,7 +727,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
assertNotNull(policies.get("xyz"));
|
||||
assertNotNull(policies.get("policy1"));
|
||||
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.GET, "/diagnostics", null);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.GET, "/diagnostics", null);
|
||||
response = solrClient.request(req);
|
||||
|
||||
Map<String, Object> diagnostics = (Map<String, Object>) response.get("diagnostics");
|
||||
|
@ -784,7 +765,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
" {'replica':'<4', 'shard': '#EACH', 'node': '#ANY'}"+
|
||||
" ]" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, tempClusterPolicyCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, tempClusterPolicyCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -796,12 +777,12 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
assertTrue(adminResponse.isSuccess());
|
||||
|
||||
// reset the original cluster policy
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
// get the diagnostics output again
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.GET, "/diagnostics", null);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.GET, "/diagnostics", null);
|
||||
response = solrClient.request(req);
|
||||
diagnostics = (Map<String, Object>) response.get("diagnostics");
|
||||
sortedNodes = (List) diagnostics.get("sortedNodes");
|
||||
|
@ -829,12 +810,12 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
if (l != null && l.contains(runner1.getNodeName())) return true;
|
||||
return false;
|
||||
},
|
||||
createAutoScalingRequest(SolrRequest.METHOD.GET, "/diagnostics", null),
|
||||
AutoScalingRequest.create(SolrRequest.METHOD.GET, "/diagnostics", null),
|
||||
200,
|
||||
20,
|
||||
runner1.getNodeName() + " could not come up ");
|
||||
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.GET, "/suggestions", null);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.GET, "/suggestions", null);
|
||||
response = solrClient.request(req);
|
||||
List l = (List) response.get("suggestions");
|
||||
assertNotNull(l);
|
||||
|
@ -864,7 +845,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"'waitFor' : '0s'," +
|
||||
"'enabled' : true" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = null;
|
||||
try {
|
||||
response = solrClient.request(req);
|
||||
|
@ -882,7 +863,7 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
t2.start();
|
||||
boolean await = updateLatch.await(60, TimeUnit.SECONDS);
|
||||
assertTrue("not all updates executed in time, remaining=" + updateLatch.getCount(), await);
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.GET, null);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.GET, null);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
|
||||
Map triggers = (Map) response.get("triggers");
|
||||
|
@ -913,14 +894,14 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
String setPolicyCommand = "{'set-policy': {" +
|
||||
" 'nodelete':[" +
|
||||
" {'nodeRole':'overseer', 'replica':0}]}}";
|
||||
solrClient.request(createAutoScalingRequest(SolrRequest.METHOD.POST, setPolicyCommand));
|
||||
solrClient.request(AutoScalingRequest.create(SolrRequest.METHOD.POST, setPolicyCommand));
|
||||
CollectionAdminRequest.createCollection("COLL1", "conf", 1, 1)
|
||||
.setPolicy("nodelete")
|
||||
.process(cluster.getSolrClient());
|
||||
String removePolicyCommand = "{remove-policy : nodelete}";
|
||||
createAutoScalingRequest(SolrRequest.METHOD.POST, removePolicyCommand);
|
||||
AutoScalingRequest.create(SolrRequest.METHOD.POST, removePolicyCommand);
|
||||
try {
|
||||
solrClient.request(createAutoScalingRequest(SolrRequest.METHOD.POST, removePolicyCommand));
|
||||
solrClient.request(AutoScalingRequest.create(SolrRequest.METHOD.POST, removePolicyCommand));
|
||||
fail("should have failed");
|
||||
} catch (HttpSolrClient.RemoteExecutionException e) {
|
||||
assertTrue(String.valueOf(getObjectByPath(e.getMetaData(), true, "error/details[0]/errorMessages[0]"))
|
||||
|
@ -939,8 +920,8 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"\t\t\"pqr\" : \"abc\"\n" +
|
||||
"\t}\n" +
|
||||
"}";
|
||||
solrClient.request(createAutoScalingRequest(SolrRequest.METHOD.POST, setPropertiesCommand));
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.GET, null);
|
||||
solrClient.request(AutoScalingRequest.create(SolrRequest.METHOD.POST, setPropertiesCommand));
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.GET, null);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
Map properties = (Map) response.get("properties");
|
||||
assertNotNull(properties);
|
||||
|
@ -952,8 +933,8 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"\t\t\"xyz\" : 123\n" +
|
||||
"\t}\n" +
|
||||
"}";
|
||||
solrClient.request(createAutoScalingRequest(SolrRequest.METHOD.POST, setPropertiesCommand));
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.GET, null);
|
||||
solrClient.request(AutoScalingRequest.create(SolrRequest.METHOD.POST, setPropertiesCommand));
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.GET, null);
|
||||
response = solrClient.request(req);
|
||||
properties = (Map) response.get("properties");
|
||||
assertNotNull(properties);
|
||||
|
@ -966,8 +947,8 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"\t\t\"xyz\" : 456\n" +
|
||||
"\t}\n" +
|
||||
"}";
|
||||
solrClient.request(createAutoScalingRequest(SolrRequest.METHOD.POST, setPropertiesCommand));
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.GET, null);
|
||||
solrClient.request(AutoScalingRequest.create(SolrRequest.METHOD.POST, setPropertiesCommand));
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.GET, null);
|
||||
response = solrClient.request(req);
|
||||
properties = (Map) response.get("properties");
|
||||
assertNotNull(properties);
|
||||
|
@ -980,8 +961,8 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"\t\t\"xyz\" : null\n" +
|
||||
"\t}\n" +
|
||||
"}";
|
||||
solrClient.request(createAutoScalingRequest(SolrRequest.METHOD.POST, setPropertiesCommand));
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.GET, null);
|
||||
solrClient.request(AutoScalingRequest.create(SolrRequest.METHOD.POST, setPropertiesCommand));
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.GET, null);
|
||||
response = solrClient.request(req);
|
||||
properties = (Map) response.get("properties");
|
||||
assertNotNull(properties);
|
||||
|
@ -996,8 +977,8 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
"\t\t\"" + AutoScalingParams.ACTION_THROTTLE_PERIOD_SECONDS + "\" : 5\n" +
|
||||
"\t}\n" +
|
||||
"}";
|
||||
solrClient.request(createAutoScalingRequest(SolrRequest.METHOD.POST, setPropertiesCommand));
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.GET, null);
|
||||
solrClient.request(AutoScalingRequest.create(SolrRequest.METHOD.POST, setPropertiesCommand));
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.GET, null);
|
||||
response = solrClient.request(req);
|
||||
properties = (Map) response.get("properties");
|
||||
assertNotNull(properties);
|
||||
|
@ -1013,42 +994,18 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
|
|||
CloudSolrClient solrClient = cluster.getSolrClient();
|
||||
String setPropertiesCommand = "{'set-cluster-policy': [" +
|
||||
"{'cores': '<4','node': '#ANY'}]}";
|
||||
solrClient.request(createAutoScalingRequest(SolrRequest.METHOD.POST, setPropertiesCommand));
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.GET, null);
|
||||
solrClient.request(AutoScalingRequest.create(SolrRequest.METHOD.POST, setPropertiesCommand));
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.GET, null);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals("<4", Utils.getObjectByPath(response,false,"cluster-policy[0]/cores"));
|
||||
assertEquals("#ANY", Utils.getObjectByPath(response,false,"cluster-policy[0]/node"));
|
||||
setPropertiesCommand = "{'set-cluster-policy': [" +
|
||||
"{'cores': '<3','node': '#ANY'}]}";
|
||||
solrClient.request(createAutoScalingRequest(SolrRequest.METHOD.POST, setPropertiesCommand));
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.GET, null);
|
||||
solrClient.request(AutoScalingRequest.create(SolrRequest.METHOD.POST, setPropertiesCommand));
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.GET, null);
|
||||
response = solrClient.request(req);
|
||||
assertEquals("<3", Utils.getObjectByPath(response,false,"cluster-policy[0]/cores"));
|
||||
assertEquals("#ANY", Utils.getObjectByPath(response,false,"cluster-policy[0]/node"));
|
||||
|
||||
}
|
||||
|
||||
static class AutoScalingRequest extends SolrRequest {
|
||||
protected final String message;
|
||||
|
||||
AutoScalingRequest(METHOD m, String path, String message) {
|
||||
super(m, path);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SolrParams getParams() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequestWriter.ContentWriter getContentWriter(String expectedType) {
|
||||
return message == null ? null : new StringPayloadContentWriter(message, JSON_MIME);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SolrResponse createResponse(SolrClient client) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
|||
import org.apache.solr.client.solrj.impl.CloudSolrClient;
|
||||
import org.apache.solr.client.solrj.impl.SolrClientNodeStateProvider;
|
||||
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.cloud.ClusterState;
|
||||
import org.apache.solr.common.cloud.DocCollection;
|
||||
|
@ -62,7 +63,6 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
import static org.apache.solr.common.params.CollectionParams.CollectionAction.MOVEREPLICA;
|
||||
|
||||
/**
|
||||
|
@ -121,7 +121,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
|
|||
" {'nodeRole':'overseer', 'replica':0}" +
|
||||
" ]" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -130,7 +130,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
|
|||
"{'minimize': 'cores'}," +
|
||||
"{'maximize': 'freedisk','precision': 100}]" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPreferencesCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPreferencesCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -186,7 +186,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
|
|||
"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction'}," +
|
||||
"{'name':'test','class':'" + ComputePlanActionTest.AssertingTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -271,7 +271,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
|
|||
"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction'}," +
|
||||
"{'name':'test','class':'" + ComputePlanActionTest.AssertingTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -340,7 +340,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
|
|||
"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction'}," +
|
||||
"{'name':'test','class':'" + ComputePlanActionTest.AssertingTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -352,7 +352,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
|
|||
" {'nodeRole':'overseer', 'replica':0}" +
|
||||
" ]" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -371,7 +371,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
|
|||
" {'nodeRole':'overseer', 'replica':0}" +
|
||||
" ]" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -449,7 +449,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
|
|||
"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction', 'collections' : 'testSelected1,testSelected2'}," +
|
||||
"{'name':'test','class':'" + ComputePlanActionTest.AssertingTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -546,7 +546,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
|
|||
"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction'}," +
|
||||
"{'name':'test','class':'" + AssertingTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -557,7 +557,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
|
|||
" {'nodeRole':'overseer', 'replica':0}" +
|
||||
" ]" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -641,7 +641,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
|
|||
"{'name':'execute_plan','class':'solr.ExecutePlanAction'}" +
|
||||
"{'name':'test','class':'" + AssertingTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -652,7 +652,7 @@ public class ComputePlanActionTest extends SolrCloudTestCase {
|
|||
" {'nodeRole':'overseer', 'replica':0}" +
|
||||
" ]" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventType;
|
|||
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.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.cloud.ClusterState;
|
||||
import org.apache.solr.common.cloud.DocCollection;
|
||||
|
@ -185,7 +186,7 @@ public class ExecutePlanActionTest extends SolrCloudTestCase {
|
|||
"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction'}," +
|
||||
"{'name':'execute_plan','class':'solr.ExecutePlanAction'}]" +
|
||||
"}}";
|
||||
SolrRequest req = AutoScalingHandlerTest.createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import org.apache.solr.SolrTestCaseJ4;
|
||||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
import org.apache.solr.client.solrj.impl.CloudSolrClient;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.util.LogLevel;
|
||||
|
@ -42,8 +43,6 @@ import org.junit.Before;
|
|||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -89,7 +88,7 @@ public class HttpTriggerListenerTest extends SolrCloudTestCase {
|
|||
"{'name':'test','class':'" + TestDummyAction.class.getName() + "'}" +
|
||||
"]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -107,7 +106,7 @@ public class HttpTriggerListenerTest extends SolrCloudTestCase {
|
|||
"'header.X-Foo' : '${config.name:invalid}'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ 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.cloud.CloudTestUtils;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.cloud.autoscaling.sim.SimCloudManager;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
|
@ -62,7 +63,6 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
import static org.apache.solr.common.cloud.ZkStateReader.SOLR_AUTOSCALING_CONF_PATH;
|
||||
|
||||
/**
|
||||
|
@ -275,7 +275,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'actions' : [{'name' : 'compute_plan', 'class' : 'solr.ComputePlanAction'}," +
|
||||
"{'name' : 'execute_plan', 'class' : '" + ExecutePlanAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -290,7 +290,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'class' : '" + CapturingTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -303,7 +303,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'class' : '" + FinishedProcessingListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -320,7 +320,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'name' : 'index_size_trigger2'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -404,7 +404,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'actions' : [{'name' : 'compute_plan', 'class' : 'solr.ComputePlanAction'}," +
|
||||
"{'name' : 'execute_plan', 'class' : '" + ExecutePlanAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -419,7 +419,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'class' : '" + CapturingTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -432,7 +432,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'class' : '" + FinishedProcessingListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -448,7 +448,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'name' : 'index_size_trigger3'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals("success", response.get("result").toString());
|
||||
|
||||
|
@ -550,7 +550,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'actions' : [{'name' : 'compute_plan', 'class' : 'solr.ComputePlanAction'}," +
|
||||
"{'name' : 'execute_plan', 'class' : '" + ExecutePlanAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -565,7 +565,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'class' : '" + CapturingTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -578,7 +578,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'class' : '" + FinishedProcessingListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -588,7 +588,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'name' : 'index_size_trigger4'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -645,7 +645,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'name' : 'index_size_trigger4'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -668,7 +668,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
solrClient.request(ur, collectionName);
|
||||
|
||||
// resume trigger
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -733,7 +733,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'enabled' : false," +
|
||||
"'actions' : [{'name' : 'compute_plan', 'class' : 'solr.ComputePlanAction'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -748,7 +748,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'class' : '" + CapturingTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -761,7 +761,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'class' : '" + FinishedProcessingListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -778,7 +778,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'name' : 'index_size_trigger5'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -793,7 +793,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'name' : 'index_size_trigger5'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -823,7 +823,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name' : 'compute_plan', 'class' : 'solr.ComputePlanAction'}]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -836,7 +836,7 @@ public class IndexSizeTriggerTest extends SolrCloudTestCase {
|
|||
"'name' : 'index_size_trigger5'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -27,13 +27,14 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.solr.client.solrj.SolrClient;
|
||||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
import org.apache.solr.client.solrj.cloud.SolrCloudManager;
|
||||
import org.apache.solr.client.solrj.cloud.autoscaling.AutoScalingConfig;
|
||||
import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventProcessorStage;
|
||||
import org.apache.solr.client.solrj.impl.CloudSolrClient;
|
||||
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
||||
import org.apache.solr.cloud.CloudTestUtils;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
import org.apache.solr.common.cloud.DocCollection;
|
||||
|
@ -49,7 +50,6 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
import static org.apache.solr.cloud.autoscaling.TriggerIntegrationTest.WAIT_FOR_DELTA_NANOS;
|
||||
|
||||
/**
|
||||
|
@ -72,14 +72,11 @@ public class MetricTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
configureCluster(2)
|
||||
.addConfig("conf", configset("cloud-minimal"))
|
||||
.configure();
|
||||
// disable .scheduled_maintenance
|
||||
String suspendTriggerCommand = "{" +
|
||||
"'suspend-trigger' : {'name' : '.scheduled_maintenance'}" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
SolrClient solrClient = cluster.getSolrClient();
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
// disable .scheduled_maintenance (once it exists)
|
||||
CloudTestUtils.waitForTriggerToBeScheduled(cluster.getOpenOverseer().getSolrCloudManager(), ".scheduled_maintenance");
|
||||
CloudTestUtils.suspendTrigger(cluster.getOpenOverseer().getSolrCloudManager(), ".scheduled_maintenance");
|
||||
|
||||
triggerFiredLatch = new CountDownLatch(1);
|
||||
}
|
||||
|
||||
|
@ -121,7 +118,7 @@ public class MetricTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"{'name':'test','class':'" + MetricAction.class.getName() + "'}" +
|
||||
"]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -135,7 +132,7 @@ public class MetricTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'class' : '" + TestTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand1);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand1);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -191,7 +188,7 @@ public class MetricTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"{'name':'test','class':'" + MetricAction.class.getName() + "'}" +
|
||||
"]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -25,12 +25,13 @@ import java.util.concurrent.CountDownLatch;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.apache.solr.client.solrj.SolrClient;
|
||||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
import org.apache.solr.client.solrj.cloud.SolrCloudManager;
|
||||
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.cloud.CloudTestUtils;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.Overseer;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.cloud.ZkNodeProps;
|
||||
|
@ -47,7 +48,6 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
import static org.apache.solr.cloud.autoscaling.ScheduledTriggers.DEFAULT_SCHEDULED_TRIGGER_DELAY_SECONDS;
|
||||
import static org.apache.solr.cloud.autoscaling.TriggerIntegrationTest.WAIT_FOR_DELTA_NANOS;
|
||||
import static org.apache.solr.common.cloud.ZkStateReader.SOLR_AUTOSCALING_CONF_PATH;
|
||||
|
@ -83,14 +83,10 @@ public class NodeAddedTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
configureCluster(2)
|
||||
.addConfig("conf", configset("cloud-minimal"))
|
||||
.configure();
|
||||
// disable .scheduled_maintenance
|
||||
String suspendTriggerCommand = "{" +
|
||||
"'suspend-trigger' : {'name' : '.scheduled_maintenance'}" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
SolrClient solrClient = cluster.getSolrClient();
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
// disable .scheduled_maintenance (once it exists)
|
||||
CloudTestUtils.waitForTriggerToBeScheduled(cluster.getOpenOverseer().getSolrCloudManager(), ".scheduled_maintenance");
|
||||
CloudTestUtils.suspendTrigger(cluster.getOpenOverseer().getSolrCloudManager(), ".scheduled_maintenance");
|
||||
|
||||
NamedList<Object> overSeerStatus = cluster.getSolrClient().request(CollectionAdminRequest.getOverseerStatus());
|
||||
String overseerLeader = (String) overSeerStatus.get("leader");
|
||||
|
@ -148,7 +144,7 @@ public class NodeAddedTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -175,7 +171,7 @@ public class NodeAddedTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -204,7 +200,7 @@ public class NodeAddedTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -235,7 +231,7 @@ public class NodeAddedTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -25,12 +25,13 @@ import java.util.concurrent.CountDownLatch;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.apache.solr.client.solrj.SolrClient;
|
||||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
import org.apache.solr.client.solrj.cloud.SolrCloudManager;
|
||||
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.cloud.CloudTestUtils;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.Overseer;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.cloud.ZkNodeProps;
|
||||
|
@ -47,7 +48,6 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
import static org.apache.solr.cloud.autoscaling.ScheduledTriggers.DEFAULT_SCHEDULED_TRIGGER_DELAY_SECONDS;
|
||||
import static org.apache.solr.cloud.autoscaling.TriggerIntegrationTest.WAIT_FOR_DELTA_NANOS;
|
||||
import static org.apache.solr.common.cloud.ZkStateReader.SOLR_AUTOSCALING_CONF_PATH;
|
||||
|
@ -80,14 +80,9 @@ public class NodeLostTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
.addConfig("conf", configset("cloud-minimal"))
|
||||
.configure();
|
||||
|
||||
// disable .scheduled_maintenance
|
||||
String suspendTriggerCommand = "{" +
|
||||
"'suspend-trigger' : {'name' : '.scheduled_maintenance'}" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
SolrClient solrClient = cluster.getSolrClient();
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
// disable .scheduled_maintenance (once it exists)
|
||||
CloudTestUtils.waitForTriggerToBeScheduled(cluster.getOpenOverseer().getSolrCloudManager(), ".scheduled_maintenance");
|
||||
CloudTestUtils.suspendTrigger(cluster.getOpenOverseer().getSolrCloudManager(), ".scheduled_maintenance");
|
||||
|
||||
NamedList<Object> overSeerStatus = cluster.getSolrClient().request(CollectionAdminRequest.getOverseerStatus());
|
||||
String overseerLeader = (String) overSeerStatus.get("leader");
|
||||
|
@ -156,7 +151,7 @@ public class NodeLostTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -188,7 +183,7 @@ public class NodeLostTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -226,7 +221,7 @@ public class NodeLostTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
nonOverseerLeaderIndex = i;
|
||||
}
|
||||
}
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -260,7 +255,7 @@ public class NodeLostTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
package org.apache.solr.cloud.autoscaling;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
@ -32,13 +30,14 @@ import java.util.concurrent.locks.ReentrantLock;
|
|||
|
||||
import org.apache.lucene.util.LuceneTestCase.AwaitsFix;
|
||||
|
||||
import org.apache.solr.client.solrj.SolrClient;
|
||||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventProcessorStage;
|
||||
import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventType;
|
||||
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.cloud.CloudTestUtils;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.cloud.LiveNodesListener;
|
||||
import org.apache.solr.common.cloud.ZkStateReader;
|
||||
|
@ -70,14 +69,10 @@ public class NodeMarkersRegistrationTest extends SolrCloudTestCase {
|
|||
.addConfig("conf", configset("cloud-minimal"))
|
||||
.configure();
|
||||
zkStateReader = cluster.getSolrClient().getZkStateReader();
|
||||
// disable .scheduled_maintenance
|
||||
String suspendTriggerCommand = "{" +
|
||||
"'suspend-trigger' : {'name' : '.scheduled_maintenance'}" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
SolrClient solrClient = cluster.getSolrClient();
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
// disable .scheduled_maintenance (once it exists)
|
||||
CloudTestUtils.waitForTriggerToBeScheduled(cluster.getOpenOverseer().getSolrCloudManager(), ".scheduled_maintenance");
|
||||
CloudTestUtils.suspendTrigger(cluster.getOpenOverseer().getSolrCloudManager(), ".scheduled_maintenance");
|
||||
}
|
||||
|
||||
@After
|
||||
|
@ -168,7 +163,7 @@ public class NodeMarkersRegistrationTest extends SolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestEventMarkerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -180,7 +175,7 @@ public class NodeMarkersRegistrationTest extends SolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestEventMarkerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -192,7 +187,7 @@ public class NodeMarkersRegistrationTest extends SolrCloudTestCase {
|
|||
" \"class\" : \"" + AssertingListener.class.getName() + "\"\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListener);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListener);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -25,11 +25,12 @@ import java.util.concurrent.CountDownLatch;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.apache.solr.client.solrj.SolrClient;
|
||||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
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.cloud.CloudTestUtils;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.util.LogLevel;
|
||||
|
@ -38,7 +39,6 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
import static org.apache.solr.cloud.autoscaling.TriggerIntegrationTest.WAIT_FOR_DELTA_NANOS;
|
||||
|
||||
/**
|
||||
|
@ -63,14 +63,11 @@ public class RestoreTriggerStateTest extends SolrCloudTestCase {
|
|||
configureCluster(2)
|
||||
.addConfig("conf", configset("cloud-minimal"))
|
||||
.configure();
|
||||
// disable .scheduled_maintenance
|
||||
String suspendTriggerCommand = "{" +
|
||||
"'suspend-trigger' : {'name' : '.scheduled_maintenance'}" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
SolrClient solrClient = cluster.getSolrClient();
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
// disable .scheduled_maintenance (once it exists)
|
||||
CloudTestUtils.waitForTriggerToBeScheduled(cluster.getOpenOverseer().getSolrCloudManager(), ".scheduled_maintenance");
|
||||
CloudTestUtils.suspendTrigger(cluster.getOpenOverseer().getSolrCloudManager(), ".scheduled_maintenance");
|
||||
|
||||
actionInitCalled = new CountDownLatch(1);
|
||||
triggerFiredLatch = new CountDownLatch(1);
|
||||
actionConstructorCalled = new CountDownLatch(1);
|
||||
|
@ -88,7 +85,7 @@ public class RestoreTriggerStateTest extends SolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.apache.solr.client.solrj.cloud.SolrCloudManager;
|
|||
import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventProcessorStage;
|
||||
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
||||
import org.apache.solr.cloud.CloudTestUtils;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.cloud.autoscaling.sim.SimCloudManager;
|
||||
import org.apache.solr.common.cloud.ClusterState;
|
||||
|
@ -51,8 +52,6 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -90,7 +89,7 @@ public class ScheduledMaintenanceTriggerTest extends SolrCloudTestCase {
|
|||
|
||||
@After
|
||||
public void restoreDefaults() throws Exception {
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST,
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST,
|
||||
"{'set-trigger' : " + AutoScaling.SCHEDULED_MAINTENANCE_TRIGGER_DSL + "}");
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
@ -99,7 +98,7 @@ public class ScheduledMaintenanceTriggerTest extends SolrCloudTestCase {
|
|||
String cmd = "{" +
|
||||
"'remove-listener' : {'name' : 'foo'}" +
|
||||
"}";
|
||||
response = solrClient.request(createAutoScalingRequest(SolrRequest.METHOD.POST, cmd));
|
||||
response = solrClient.request(AutoScalingRequest.create(SolrRequest.METHOD.POST, cmd));
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
}
|
||||
}
|
||||
|
@ -193,7 +192,7 @@ public class ScheduledMaintenanceTriggerTest extends SolrCloudTestCase {
|
|||
"'class' : '" + CapturingTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -208,7 +207,7 @@ public class ScheduledMaintenanceTriggerTest extends SolrCloudTestCase {
|
|||
"{'name' : 'execute_plan', 'class' : '" + ExecutePlanAction.class.getName() + "'}," +
|
||||
"{'name' : 'test', 'class' : '" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
package org.apache.solr.cloud.autoscaling;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -29,11 +27,12 @@ import java.util.concurrent.CountDownLatch;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.apache.solr.client.solrj.SolrClient;
|
||||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
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.cloud.CloudTestUtils;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
|
@ -61,14 +60,11 @@ public class ScheduledTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
configureCluster(2)
|
||||
.addConfig("conf", configset("cloud-minimal"))
|
||||
.configure();
|
||||
// disable .scheduled_maintenance
|
||||
String suspendTriggerCommand = "{" +
|
||||
"'suspend-trigger' : {'name' : '.scheduled_maintenance'}" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
SolrClient solrClient = cluster.getSolrClient();
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
// disable .scheduled_maintenance (once it exists)
|
||||
CloudTestUtils.waitForTriggerToBeScheduled(cluster.getOpenOverseer().getSolrCloudManager(), ".scheduled_maintenance");
|
||||
CloudTestUtils.suspendTrigger(cluster.getOpenOverseer().getSolrCloudManager(), ".scheduled_maintenance");
|
||||
|
||||
triggerFiredLatch = new CountDownLatch(1);
|
||||
}
|
||||
|
||||
|
@ -96,7 +92,7 @@ public class ScheduledTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
" {\"cores\" : \"<2\", \"node\" : \"#EACH\"}\n" +
|
||||
" ]\n" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicy);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicy);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -115,7 +111,7 @@ public class ScheduledTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"{'name' : 'execute','class':'" + ExecutePlanAction.class.getName() + "'}," +
|
||||
"{'name' : 'recorder', 'class': '" + ContextPropertiesRecorderAction.class.getName() + "'}" +
|
||||
"]}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
import com.carrotsearch.randomizedtesting.annotations.Nightly;
|
||||
import com.google.common.util.concurrent.AtomicDouble;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.solr.client.solrj.SolrClient;
|
||||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
import org.apache.solr.client.solrj.cloud.SolrCloudManager;
|
||||
import org.apache.solr.client.solrj.cloud.autoscaling.AutoScalingConfig;
|
||||
|
@ -38,6 +37,7 @@ import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventProcessorStage
|
|||
import org.apache.solr.client.solrj.impl.CloudSolrClient;
|
||||
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
||||
import org.apache.solr.cloud.CloudTestUtils;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.MapWriter;
|
||||
import org.apache.solr.common.cloud.Replica;
|
||||
|
@ -58,7 +58,6 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
import static org.apache.solr.cloud.autoscaling.TriggerIntegrationTest.WAIT_FOR_DELTA_NANOS;
|
||||
import static org.apache.solr.common.cloud.ZkStateReader.SOLR_AUTOSCALING_CONF_PATH;
|
||||
|
||||
|
@ -85,15 +84,13 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
configureCluster(5)
|
||||
.addConfig("conf", configset("cloud-minimal"))
|
||||
.configure();
|
||||
// disable .scheduled_maintenance
|
||||
String suspendTriggerCommand = "{" +
|
||||
"'suspend-trigger' : {'name' : '.scheduled_maintenance'}" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
SolrClient solrClient = cluster.getSolrClient();
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
cloudManager = cluster.getJettySolrRunner(0).getCoreContainer().getZkController().getSolrCloudManager();
|
||||
|
||||
cloudManager = cluster.getOpenOverseer().getSolrCloudManager();
|
||||
|
||||
// disable .scheduled_maintenance (once it exists)
|
||||
CloudTestUtils.waitForTriggerToBeScheduled(cloudManager, ".scheduled_maintenance");
|
||||
CloudTestUtils.suspendTrigger(cloudManager, ".scheduled_maintenance");
|
||||
|
||||
}
|
||||
|
||||
@Before
|
||||
|
@ -145,7 +142,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"{'name':'execute','class':'" + ExecutePlanAction.class.getName() + "'}" +
|
||||
"]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -158,7 +155,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'class' : '" + StartedProcessingListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -172,7 +169,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'class' : '" + CapturingTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -185,7 +182,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'class' : '" + FinishedProcessingListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -200,7 +197,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'name' : 'search_rate_trigger1'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -218,7 +215,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'name' : 'search_rate_trigger1'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -318,7 +315,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"{'name':'execute','class':'" + ExecutePlanAction.class.getName() + "'}" +
|
||||
"]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -331,7 +328,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'class' : '" + StartedProcessingListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -345,7 +342,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'class' : '" + CapturingTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -358,7 +355,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'class' : '" + FinishedProcessingListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -370,7 +367,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'name' : 'search_rate_trigger2'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -387,7 +384,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'name' : 'search_rate_trigger2'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -424,7 +421,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
started = new CountDownLatch(1);
|
||||
|
||||
// resume trigger
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -437,7 +434,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
assertTrue("The trigger did not finish processing", await);
|
||||
|
||||
// suspend trigger
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -482,7 +479,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"{'name':'execute','class':'" + ExecutePlanAction.class.getName() + "'}" +
|
||||
"]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -494,7 +491,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
assertTrue("The trigger did not finish processing", await);
|
||||
|
||||
// suspend trigger
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -572,7 +569,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"{'name':'execute','class':'" + ExecutePlanAction.class.getName() + "'}" +
|
||||
"]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -585,7 +582,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'class' : '" + StartedProcessingListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -599,7 +596,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'class' : '" + CapturingTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -612,7 +609,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'class' : '" + FinishedProcessingListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -624,7 +621,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'name' : 'search_rate_trigger3'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -641,7 +638,7 @@ public class SearchRateTriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'name' : 'search_rate_trigger3'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
package org.apache.solr.cloud.autoscaling;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.util.Collection;
|
||||
|
@ -35,6 +33,7 @@ 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.response.QueryResponse;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.SolrDocument;
|
||||
import org.apache.solr.common.SolrDocumentList;
|
||||
|
@ -112,7 +111,7 @@ public class SystemLogListenerTest extends SolrCloudTestCase {
|
|||
"{'name':'test','class':'" + AssertingTriggerAction.class.getName() + "'}," +
|
||||
"{'name':'error','class':'" + ErrorTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -122,7 +121,7 @@ public class SystemLogListenerTest extends SolrCloudTestCase {
|
|||
"\t\t\"name\" : \"node_lost_trigger.system\"\n" +
|
||||
"\t}\n" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, removeListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, removeListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -145,7 +144,7 @@ public class SystemLogListenerTest extends SolrCloudTestCase {
|
|||
"'class' : '" + SystemLogListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ import org.apache.solr.client.solrj.impl.HttpSolrClient;
|
|||
import org.apache.solr.client.solrj.impl.SolrClientCloudManager;
|
||||
import org.apache.solr.client.solrj.impl.SolrClientNodeStateProvider;
|
||||
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.OverseerTaskProcessor;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.cloud.ZkDistributedQueueFactory;
|
||||
|
@ -65,7 +66,6 @@ import org.junit.rules.ExpectedException;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
import static org.apache.solr.common.util.Utils.getObjectByPath;
|
||||
|
||||
@LuceneTestCase.Slow
|
||||
|
@ -91,7 +91,7 @@ public class TestPolicyCloud extends SolrCloudTestCase {
|
|||
|
||||
public void testCreateCollection() throws Exception {
|
||||
String commands = "{ set-cluster-policy: [ {cores: '0', node: '#ANY'} ] }"; // disallow replica placement anywhere
|
||||
cluster.getSolrClient().request(createAutoScalingRequest(SolrRequest.METHOD.POST, commands));
|
||||
cluster.getSolrClient().request(AutoScalingRequest.create(SolrRequest.METHOD.POST, commands));
|
||||
String collectionName = "testCreateCollection";
|
||||
HttpSolrClient.RemoteSolrException exp = expectThrows(HttpSolrClient.RemoteSolrException.class,
|
||||
() -> CollectionAdminRequest.createCollection(collectionName, "conf", 2, 1).process(cluster.getSolrClient()));
|
||||
|
@ -116,7 +116,7 @@ public class TestPolicyCloud extends SolrCloudTestCase {
|
|||
}
|
||||
|
||||
commands = "{ set-cluster-policy: [ {cores: '<2', node: '#ANY'} ] }";
|
||||
cluster.getSolrClient().request(createAutoScalingRequest(SolrRequest.METHOD.POST, commands));
|
||||
cluster.getSolrClient().request(AutoScalingRequest.create(SolrRequest.METHOD.POST, commands));
|
||||
CollectionAdminRequest.createCollection(collectionName, "conf", 2, 1).process(cluster.getSolrClient());
|
||||
SolrClientCloudManager scm = new SolrClientCloudManager(new ZkDistributedQueueFactory(cluster.getSolrClient().getZkStateReader().getZkClient()), cluster.getSolrClient());
|
||||
Policy.Session session = scm.getDistribStateManager().getAutoScalingConfig().getPolicy().createSession(scm);
|
||||
|
@ -185,7 +185,7 @@ public class TestPolicyCloud extends SolrCloudTestCase {
|
|||
int port = jetty.getLocalPort();
|
||||
|
||||
String commands = "{set-policy :{c1 : [{replica:0 , shard:'#EACH', port: '!" + port + "'}]}}";
|
||||
cluster.getSolrClient().request(AutoScalingHandlerTest.createAutoScalingRequest(SolrRequest.METHOD.POST, commands));
|
||||
cluster.getSolrClient().request(AutoScalingRequest.create(SolrRequest.METHOD.POST, commands));
|
||||
|
||||
String collectionName = "testCreateCollectionAddReplica";
|
||||
CollectionAdminRequest.createCollection(collectionName, "conf", 1, 1)
|
||||
|
@ -213,7 +213,7 @@ public class TestPolicyCloud extends SolrCloudTestCase {
|
|||
int secondNodePort = secondNode.getLocalPort();
|
||||
|
||||
String commands = "{set-policy :{c1 : [{replica:1 , shard:'#EACH', port: '" + firstNodePort + "'}, {replica:1, shard:'#EACH', port:'" + secondNodePort + "'}]}}";
|
||||
NamedList<Object> response = cluster.getSolrClient().request(AutoScalingHandlerTest.createAutoScalingRequest(SolrRequest.METHOD.POST, commands));
|
||||
NamedList<Object> response = cluster.getSolrClient().request(AutoScalingRequest.create(SolrRequest.METHOD.POST, commands));
|
||||
assertEquals("success", response.get("result"));
|
||||
|
||||
String collectionName = "testCreateCollectionSplitShard";
|
||||
|
@ -256,7 +256,7 @@ public class TestPolicyCloud extends SolrCloudTestCase {
|
|||
" {'metrics:abc':'overseer', 'replica':0}" +
|
||||
" ]" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
try {
|
||||
solrClient.request(req);
|
||||
fail("expected exception");
|
||||
|
@ -272,7 +272,7 @@ public class TestPolicyCloud extends SolrCloudTestCase {
|
|||
" {'metrics:solr.node:ADMIN./admin/authorization.clientErrors:count':'>58768765', 'replica':0}" +
|
||||
" ]" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
solrClient.request(req);
|
||||
|
||||
//org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses
|
||||
|
@ -315,7 +315,7 @@ public class TestPolicyCloud extends SolrCloudTestCase {
|
|||
"]}";
|
||||
|
||||
|
||||
cluster.getSolrClient().request(AutoScalingHandlerTest.createAutoScalingRequest(SolrRequest.METHOD.POST, commands));
|
||||
cluster.getSolrClient().request(AutoScalingRequest.create(SolrRequest.METHOD.POST, commands));
|
||||
Map<String, Object> json = Utils.getJson(cluster.getZkClient(), ZkStateReader.SOLR_AUTOSCALING_CONF_PATH, true);
|
||||
assertEquals("full json:" + Utils.toJSONString(json), "!" + nrtPort,
|
||||
Utils.getObjectByPath(json, true, "cluster-policy[0]/port"));
|
||||
|
@ -367,7 +367,7 @@ public class TestPolicyCloud extends SolrCloudTestCase {
|
|||
int port = jetty.getLocalPort();
|
||||
|
||||
String commands = "{set-policy :{c1 : [{replica:1 , shard:'#EACH', port: '" + port + "'}]}}";
|
||||
cluster.getSolrClient().request(AutoScalingHandlerTest.createAutoScalingRequest(SolrRequest.METHOD.POST, commands));
|
||||
cluster.getSolrClient().request(AutoScalingRequest.create(SolrRequest.METHOD.POST, commands));
|
||||
Map<String, Object> json = Utils.getJson(cluster.getZkClient(), ZkStateReader.SOLR_AUTOSCALING_CONF_PATH, true);
|
||||
assertEquals("full json:"+ Utils.toJSONString(json) , "#EACH",
|
||||
Utils.getObjectByPath(json, true, "/policies/c1[0]/shard"));
|
||||
|
|
|
@ -28,13 +28,14 @@ import java.util.concurrent.CountDownLatch;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.apache.solr.client.solrj.SolrClient;
|
||||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
import org.apache.solr.client.solrj.cloud.SolrCloudManager;
|
||||
import org.apache.solr.client.solrj.cloud.autoscaling.AutoScalingConfig;
|
||||
import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventProcessorStage;
|
||||
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
||||
import org.apache.solr.client.solrj.impl.CloudSolrClient;
|
||||
import org.apache.solr.cloud.CloudTestUtils;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.params.AutoScalingParams;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
|
@ -46,7 +47,6 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
import static org.apache.solr.cloud.autoscaling.TriggerIntegrationTest.WAIT_FOR_DELTA_NANOS;
|
||||
|
||||
@LogLevel("org.apache.solr.cloud.autoscaling=DEBUG;org.apache.solr.client.solrj.cloud.autoscaling=DEBUG")
|
||||
|
@ -67,14 +67,10 @@ public class TriggerCooldownIntegrationTest extends SolrCloudTestCase {
|
|||
configureCluster(2)
|
||||
.addConfig("conf", configset("cloud-minimal"))
|
||||
.configure();
|
||||
// disable .scheduled_maintenance
|
||||
String suspendTriggerCommand = "{" +
|
||||
"'suspend-trigger' : {'name' : '.scheduled_maintenance'}" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
SolrClient solrClient = cluster.getSolrClient();
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
// disable .scheduled_maintenance (once it exists)
|
||||
CloudTestUtils.waitForTriggerToBeScheduled(cluster.getOpenOverseer().getSolrCloudManager(), ".scheduled_maintenance");
|
||||
CloudTestUtils.suspendTrigger(cluster.getOpenOverseer().getSolrCloudManager(), ".scheduled_maintenance");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -92,7 +88,7 @@ public class TriggerCooldownIntegrationTest extends SolrCloudTestCase {
|
|||
"{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}" +
|
||||
"]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -105,7 +101,7 @@ public class TriggerCooldownIntegrationTest extends SolrCloudTestCase {
|
|||
"'class' : '" + TestTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand1);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand1);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -153,8 +149,8 @@ public class TriggerCooldownIntegrationTest extends SolrCloudTestCase {
|
|||
"\t\t\"" + AutoScalingParams.TRIGGER_COOLDOWN_PERIOD_SECONDS + "\" : " + modifiedCooldownPeriodSeconds + "\n" +
|
||||
"\t}\n" +
|
||||
"}";
|
||||
solrClient.request(createAutoScalingRequest(SolrRequest.METHOD.POST, setPropertiesCommand));
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.GET, null);
|
||||
solrClient.request(AutoScalingRequest.create(SolrRequest.METHOD.POST, setPropertiesCommand));
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.GET, null);
|
||||
response = solrClient.request(req);
|
||||
|
||||
// reset the trigger and captured events
|
||||
|
|
|
@ -30,7 +30,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import org.apache.solr.client.solrj.SolrClient;
|
||||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
import org.apache.solr.client.solrj.cloud.SolrCloudManager;
|
||||
import org.apache.solr.client.solrj.cloud.autoscaling.AutoScalingConfig;
|
||||
|
@ -39,6 +38,8 @@ 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.response.CollectionAdminResponse;
|
||||
import org.apache.solr.cloud.CloudTestUtils;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.Overseer;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.cloud.ZkNodeProps;
|
||||
|
@ -55,7 +56,6 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
import static org.apache.solr.common.cloud.ZkStateReader.SOLR_AUTOSCALING_CONF_PATH;
|
||||
|
||||
/**
|
||||
|
@ -85,14 +85,10 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {
|
|||
configureCluster(NODE_COUNT)
|
||||
.addConfig("conf", configset("cloud-minimal"))
|
||||
.configure();
|
||||
// disable .scheduled_maintenance
|
||||
String suspendTriggerCommand = "{" +
|
||||
"'suspend-trigger' : {'name' : '.scheduled_maintenance'}" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
SolrClient solrClient = cluster.getSolrClient();
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
// disable .scheduled_maintenance (once it exists)
|
||||
CloudTestUtils.waitForTriggerToBeScheduled(cluster.getOpenOverseer().getSolrCloudManager(), ".scheduled_maintenance");
|
||||
CloudTestUtils.suspendTrigger(cluster.getOpenOverseer().getSolrCloudManager(), ".scheduled_maintenance");
|
||||
}
|
||||
|
||||
private static CountDownLatch getTriggerFiredLatch() {
|
||||
|
@ -193,7 +189,7 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + ThrottlingTesterAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -206,7 +202,7 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + ThrottlingTesterAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -234,7 +230,7 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + ThrottlingTesterAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -246,7 +242,7 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + ThrottlingTesterAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -342,7 +338,7 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
if (!actionInitCalled.await(3, TimeUnit.SECONDS)) {
|
||||
|
@ -453,7 +449,7 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {
|
|||
break;
|
||||
}
|
||||
}
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -542,7 +538,7 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"{'name':'test1','class':'" + TestDummyAction.class.getName() + "'}," +
|
||||
"]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -561,7 +557,7 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'class' : '" + TestTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -576,7 +572,7 @@ public class TriggerIntegrationTest extends SolrCloudTestCase {
|
|||
"'class' : '" + TestTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand1);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand1);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -32,23 +32,19 @@ import java.util.concurrent.TimeUnit;
|
|||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.apache.solr.client.solrj.SolrClient;
|
||||
import org.apache.solr.client.solrj.SolrRequest;
|
||||
import org.apache.solr.client.solrj.cloud.SolrCloudManager;
|
||||
import org.apache.solr.client.solrj.cloud.autoscaling.AutoScalingConfig;
|
||||
import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventType;
|
||||
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
||||
import org.apache.solr.cloud.CloudTestUtils;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.params.AutoScalingParams;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
import org.apache.solr.core.SolrResourceLoader;
|
||||
import org.apache.solr.util.LogLevel;
|
||||
import org.junit.BeforeClass;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
|
||||
@LogLevel("org.apache.solr.cloud.autoscaling=DEBUG;org.apache.solr.client.solrj.cloud.autoscaling=DEBUG")
|
||||
public class TriggerSetPropertiesIntegrationTest extends SolrCloudTestCase {
|
||||
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
@ -58,14 +54,10 @@ public class TriggerSetPropertiesIntegrationTest extends SolrCloudTestCase {
|
|||
configureCluster(2)
|
||||
.addConfig("conf", configset("cloud-minimal"))
|
||||
.configure();
|
||||
// disable .scheduled_maintenance
|
||||
String suspendTriggerCommand = "{" +
|
||||
"'suspend-trigger' : {'name' : '.scheduled_maintenance'}" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
SolrClient solrClient = cluster.getSolrClient();
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
// disable .scheduled_maintenance (once it exists)
|
||||
CloudTestUtils.waitForTriggerToBeScheduled(cluster.getOpenOverseer().getSolrCloudManager(), ".scheduled_maintenance");
|
||||
CloudTestUtils.suspendTrigger(cluster.getOpenOverseer().getSolrCloudManager(), ".scheduled_maintenance");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -693,11 +693,13 @@ public class SimCloudManager implements SolrCloudManager {
|
|||
LocalSolrQueryRequest queryRequest = new LocalSolrQueryRequest(null, params);
|
||||
if (autoscaling) {
|
||||
RequestWriter.ContentWriter cw = req.getContentWriter("application/json");
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
cw.write(baos);
|
||||
String payload = baos.toString("UTF-8");
|
||||
log.trace("-- payload: {}", payload);
|
||||
queryRequest.setContentStreams(Collections.singletonList(new ContentStreamBase.StringStream(payload)));
|
||||
if (null != cw) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
cw.write(baos);
|
||||
String payload = baos.toString("UTF-8");
|
||||
log.trace("-- payload: {}", payload);
|
||||
queryRequest.setContentStreams(Collections.singletonList(new ContentStreamBase.StringStream(payload)));
|
||||
}
|
||||
}
|
||||
queryRequest.getContext().put("httpMethod", req.getMethod().toString());
|
||||
SolrQueryResponse queryResponse = new SolrQueryResponse();
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.apache.solr.client.solrj.cloud.SolrCloudManager;
|
|||
import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventType;
|
||||
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
||||
import org.apache.solr.cloud.CloudTestUtils;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.autoscaling.ActionContext;
|
||||
import org.apache.solr.cloud.autoscaling.ComputePlanAction;
|
||||
import org.apache.solr.cloud.autoscaling.ScheduledTriggers;
|
||||
|
@ -56,7 +57,6 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
import static org.apache.solr.common.params.CollectionParams.CollectionAction.MOVEREPLICA;
|
||||
|
||||
/**
|
||||
|
@ -86,7 +86,7 @@ public class TestSimComputePlanAction extends SimSolrCloudTestCase {
|
|||
" {'nodeRole':'overseer', 'replica':0}" +
|
||||
" ]" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
SolrResponse rsp = cluster.request(req);
|
||||
NamedList<Object> response = rsp.getResponse();
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
@ -96,7 +96,7 @@ public class TestSimComputePlanAction extends SimSolrCloudTestCase {
|
|||
"{'minimize': 'cores'}," +
|
||||
"{'maximize': 'freedisk','precision': 100}]" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPreferencesCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPreferencesCommand);
|
||||
rsp = cluster.request(req);
|
||||
response = rsp.getResponse();
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
@ -134,7 +134,7 @@ public class TestSimComputePlanAction extends SimSolrCloudTestCase {
|
|||
"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction'}," +
|
||||
"{'name':'test','class':'" + TestSimComputePlanAction.AssertingTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -197,7 +197,7 @@ public class TestSimComputePlanAction extends SimSolrCloudTestCase {
|
|||
"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction'}," +
|
||||
"{'name':'test','class':'" + AssertingTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -269,7 +269,7 @@ public class TestSimComputePlanAction extends SimSolrCloudTestCase {
|
|||
"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction'}," +
|
||||
"{'name':'test','class':'" + TestSimComputePlanAction.AssertingTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -281,7 +281,7 @@ public class TestSimComputePlanAction extends SimSolrCloudTestCase {
|
|||
" {'nodeRole':'overseer', 'replica':0}" +
|
||||
" ]" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -300,7 +300,7 @@ public class TestSimComputePlanAction extends SimSolrCloudTestCase {
|
|||
" {'nodeRole':'overseer', 'replica':0}" +
|
||||
" ]" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventType;
|
|||
import org.apache.solr.client.solrj.cloud.autoscaling.VersionedData;
|
||||
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
||||
import org.apache.solr.cloud.CloudTestUtils;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.autoscaling.ActionContext;
|
||||
import org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest;
|
||||
import org.apache.solr.cloud.autoscaling.ExecutePlanAction;
|
||||
import org.apache.solr.cloud.autoscaling.NodeLostTrigger;
|
||||
import org.apache.solr.common.cloud.ClusterState;
|
||||
|
@ -170,7 +170,7 @@ public class TestSimExecutePlanAction extends SimSolrCloudTestCase {
|
|||
"'actions' : [{'name':'compute_plan', 'class' : 'solr.ComputePlanAction'}," +
|
||||
"{'name':'execute_plan','class':'solr.ExecutePlanAction'}]" +
|
||||
"}}";
|
||||
SolrRequest req = AutoScalingHandlerTest.createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
package org.apache.solr.cloud.autoscaling.sim;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
|
@ -29,6 +27,7 @@ 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.cloud.CloudTestUtils;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.autoscaling.ExecutePlanAction;
|
||||
import org.apache.solr.common.SolrDocumentList;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
|
@ -117,7 +116,7 @@ public class TestSimExtremeIndexing extends SimSolrCloudTestCase {
|
|||
"'actions' : [{'name' : 'compute_plan', 'class' : 'solr.ComputePlanAction'}," +
|
||||
"{'name' : 'execute_plan', 'class' : '" + ExecutePlanAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
package org.apache.solr.cloud.autoscaling.sim;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -41,6 +39,7 @@ import org.apache.solr.client.solrj.cloud.autoscaling.Suggester;
|
|||
import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventProcessorStage;
|
||||
import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventType;
|
||||
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.CloudTestUtils;
|
||||
import org.apache.solr.cloud.autoscaling.ActionContext;
|
||||
import org.apache.solr.cloud.autoscaling.CapturedEvent;
|
||||
|
@ -92,6 +91,13 @@ public class TestSimLargeCluster extends SimSolrCloudTestCase {
|
|||
@Before
|
||||
public void setupTest() throws Exception {
|
||||
configureCluster(NUM_NODES, TimeSource.get("simTime:" + SPEED));
|
||||
|
||||
// disable .scheduled_maintenance (once it exists)
|
||||
CloudTestUtils.waitForTriggerToBeScheduled(cluster, ".scheduled_maintenance");
|
||||
CloudTestUtils.suspendTrigger(cluster, ".scheduled_maintenance");
|
||||
// disable .auto_add_replicas (once it exists)
|
||||
CloudTestUtils.waitForTriggerToBeScheduled(cluster, ".auto_add_replicas");
|
||||
CloudTestUtils.suspendTrigger(cluster, ".auto_add_replicas");
|
||||
|
||||
waitForSeconds = 5;
|
||||
triggerStartedCount.set(0);
|
||||
|
@ -99,34 +105,6 @@ public class TestSimLargeCluster extends SimSolrCloudTestCase {
|
|||
triggerStartedLatch = new CountDownLatch(1);
|
||||
triggerFinishedLatch = new CountDownLatch(1);
|
||||
listenerEvents.clear();
|
||||
// disable .scheduled_maintenance and .auto_add_replicas
|
||||
String suspendTriggerCommand = "{" +
|
||||
"'suspend-trigger' : {'name' : '.scheduled_maintenance'}" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
SolrClient solrClient = cluster.simGetSolrClient();
|
||||
NamedList<Object> response;
|
||||
try {
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
} catch (Exception e) {
|
||||
if (!e.toString().contains("No trigger exists")) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
suspendTriggerCommand = "{" +
|
||||
"'suspend-trigger' : {'name' : '.auto_add_replicas'}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
try {
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
} catch (Exception e) {
|
||||
if (!e.toString().contains("No trigger exists")) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class TestTriggerListener extends TriggerListenerBase {
|
||||
|
@ -176,7 +154,7 @@ public class TestSimLargeCluster extends SimSolrCloudTestCase {
|
|||
"{'name':'test','class':'" + FinishTriggerAction.class.getName() + "'}" +
|
||||
"]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -191,7 +169,7 @@ public class TestSimLargeCluster extends SimSolrCloudTestCase {
|
|||
"'class' : '" + TestTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -286,7 +264,7 @@ public class TestSimLargeCluster extends SimSolrCloudTestCase {
|
|||
"{'name':'test','class':'" + FinishTriggerAction.class.getName() + "'}" +
|
||||
"]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -476,7 +454,7 @@ public class TestSimLargeCluster extends SimSolrCloudTestCase {
|
|||
"{'name':'test','class':'" + FinishTriggerAction.class.getName() + "'}" +
|
||||
"]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -489,7 +467,7 @@ public class TestSimLargeCluster extends SimSolrCloudTestCase {
|
|||
"'class' : '" + TestTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -676,7 +654,7 @@ public class TestSimLargeCluster extends SimSolrCloudTestCase {
|
|||
"{'name':'test','class':'" + FinishTriggerAction.class.getName() + "'}" +
|
||||
"]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
String setListenerCommand1 = "{" +
|
||||
|
@ -688,7 +666,7 @@ public class TestSimLargeCluster extends SimSolrCloudTestCase {
|
|||
"'class' : '" + TestTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand1);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand1);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
package org.apache.solr.cloud.autoscaling.sim;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.util.ArrayList;
|
||||
|
@ -39,7 +37,7 @@ import org.apache.solr.client.solrj.cloud.autoscaling.Row;
|
|||
import org.apache.solr.client.solrj.cloud.autoscaling.Variable.Type;
|
||||
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
||||
import org.apache.solr.cloud.CloudTestUtils;
|
||||
import org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.common.cloud.DocCollection;
|
||||
import org.apache.solr.common.cloud.Replica;
|
||||
import org.apache.solr.common.cloud.ZkStateReader;
|
||||
|
@ -121,7 +119,7 @@ public class TestSimPolicyCloud extends SimSolrCloudTestCase {
|
|||
int port = (Integer)cluster.getSimNodeStateProvider().simGetNodeValue(nodeId, ImplicitSnitch.PORT);
|
||||
|
||||
String commands = "{set-policy :{c1 : [{replica:0 , shard:'#EACH', port: '!" + port + "'}]}}";
|
||||
solrClient.request(AutoScalingHandlerTest.createAutoScalingRequest(SolrRequest.METHOD.POST, commands));
|
||||
solrClient.request(AutoScalingRequest.create(SolrRequest.METHOD.POST, commands));
|
||||
|
||||
String collectionName = "testCreateCollectionAddReplica";
|
||||
CollectionAdminRequest.createCollection(collectionName, "conf", 1, 1)
|
||||
|
@ -154,7 +152,7 @@ public class TestSimPolicyCloud extends SimSolrCloudTestCase {
|
|||
}
|
||||
|
||||
String commands = "{set-policy :{c1 : [{replica:1 , shard:'#EACH', port: '" + firstNodePort + "'}, {replica:1, shard:'#EACH', port:'" + secondNodePort + "'}]}}";
|
||||
NamedList<Object> response = solrClient.request(AutoScalingHandlerTest.createAutoScalingRequest(SolrRequest.METHOD.POST, commands));
|
||||
NamedList<Object> response = solrClient.request(AutoScalingRequest.create(SolrRequest.METHOD.POST, commands));
|
||||
assertEquals("success", response.get("result"));
|
||||
|
||||
String collectionName = "testCreateCollectionSplitShard";
|
||||
|
@ -199,7 +197,7 @@ public class TestSimPolicyCloud extends SimSolrCloudTestCase {
|
|||
" {'metrics:abc':'overseer', 'replica':0}" +
|
||||
" ]" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
try {
|
||||
solrClient.request(req);
|
||||
fail("expected exception");
|
||||
|
@ -214,7 +212,7 @@ public class TestSimPolicyCloud extends SimSolrCloudTestCase {
|
|||
" {'metrics:solr.node:ADMIN./admin/authorization.clientErrors:count':'>58768765', 'replica':0}" +
|
||||
" ]" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
solrClient.request(req);
|
||||
|
||||
//org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses
|
||||
|
@ -255,7 +253,7 @@ public class TestSimPolicyCloud extends SimSolrCloudTestCase {
|
|||
"]}";
|
||||
|
||||
|
||||
solrClient.request(AutoScalingHandlerTest.createAutoScalingRequest(SolrRequest.METHOD.POST, commands));
|
||||
solrClient.request(AutoScalingRequest.create(SolrRequest.METHOD.POST, commands));
|
||||
Map<String, Object> json = Utils.getJson(cluster.getDistribStateManager(), ZkStateReader.SOLR_AUTOSCALING_CONF_PATH);
|
||||
assertEquals("full json:" + Utils.toJSONString(json), "!" + nrtPort,
|
||||
Utils.getObjectByPath(json, true, "cluster-policy[0]/port"));
|
||||
|
@ -305,7 +303,7 @@ public class TestSimPolicyCloud extends SimSolrCloudTestCase {
|
|||
int port = (Integer)cluster.getSimNodeStateProvider().simGetNodeValue(nodeId, ImplicitSnitch.PORT);
|
||||
|
||||
String commands = "{set-policy :{c1 : [{replica:1 , shard:'#EACH', port: '" + port + "'}]}}";
|
||||
solrClient.request(AutoScalingHandlerTest.createAutoScalingRequest(SolrRequest.METHOD.POST, commands));
|
||||
solrClient.request(AutoScalingRequest.create(SolrRequest.METHOD.POST, commands));
|
||||
Map<String, Object> json = Utils.getJson(cluster.getDistribStateManager(), ZkStateReader.SOLR_AUTOSCALING_CONF_PATH);
|
||||
assertEquals("full json:"+ Utils.toJSONString(json) , "#EACH",
|
||||
Utils.getObjectByPath(json, true, "/policies/c1[0]/shard"));
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
package org.apache.solr.cloud.autoscaling.sim;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
import static org.apache.solr.cloud.autoscaling.ScheduledTriggers.DEFAULT_SCHEDULED_TRIGGER_DELAY_SECONDS;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -47,6 +46,7 @@ import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventProcessorStage
|
|||
import org.apache.solr.client.solrj.cloud.autoscaling.TriggerEventType;
|
||||
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
||||
import org.apache.solr.cloud.CloudTestUtils;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.autoscaling.ActionContext;
|
||||
import org.apache.solr.cloud.autoscaling.CapturedEvent;
|
||||
import org.apache.solr.cloud.autoscaling.ComputePlanAction;
|
||||
|
@ -126,19 +126,11 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
@Before
|
||||
public void setupTest() throws Exception {
|
||||
configureCluster(2, TimeSource.get("simTime:" + SPEED));
|
||||
|
||||
// disable .scheduled_maintenance
|
||||
String suspendTriggerCommand = "{" +
|
||||
"'suspend-trigger' : {'name' : '.scheduled_maintenance'}" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, suspendTriggerCommand);
|
||||
SolrClient solrClient = cluster.simGetSolrClient();
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
String result = response.get("result").toString();
|
||||
if (!"success".equals(result) && !result.contains("No trigger exists")) {
|
||||
fail("Unexpected response: " + result);
|
||||
}
|
||||
|
||||
// disable .scheduled_maintenance (once it exists)
|
||||
CloudTestUtils.waitForTriggerToBeScheduled(cluster, ".scheduled_maintenance");
|
||||
CloudTestUtils.suspendTrigger(cluster, ".scheduled_maintenance");
|
||||
|
||||
waitForSeconds = 1 + random().nextInt(3);
|
||||
actionConstructorCalled = new CountDownLatch(1);
|
||||
actionInitCalled = new CountDownLatch(1);
|
||||
|
@ -174,7 +166,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + ThrottlingTesterAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -187,7 +179,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + ThrottlingTesterAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -215,7 +207,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + ThrottlingTesterAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -227,7 +219,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + ThrottlingTesterAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -303,7 +295,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -327,7 +319,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -360,7 +352,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -385,7 +377,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -415,7 +407,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -445,7 +437,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -470,7 +462,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -501,7 +493,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -543,7 +535,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
if (!actionInitCalled.await(3, TimeUnit.SECONDS)) {
|
||||
|
@ -648,7 +640,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
|
||||
String overseerLeader = cluster.getSimClusterStateProvider().simGetRandomNode();
|
||||
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -701,7 +693,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -864,7 +856,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestEventMarkerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -876,7 +868,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'enabled' : true," +
|
||||
"'actions' : [{'name':'test','class':'" + TestEventMarkerAction.class.getName() + "'}]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -967,7 +959,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"{'name':'test1','class':'" + TestDummyAction.class.getName() + "'}," +
|
||||
"]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -986,7 +978,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'class' : '" + TestTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -1001,7 +993,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'class' : '" + TestTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand1);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand1);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -1130,7 +1122,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"{'name':'test','class':'" + TestTriggerAction.class.getName() + "'}" +
|
||||
"]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -1143,7 +1135,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'class' : '" + TestTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand1);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand1);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -1249,7 +1241,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"{'name':'finish','class':'" + FinishTriggerAction.class.getName() + "'}," +
|
||||
"]" +
|
||||
"}}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -1263,7 +1255,7 @@ public class TestSimTriggerIntegration extends SimSolrCloudTestCase {
|
|||
"'class' : '" + TestTriggerListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand1);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand1);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.apache.solr.client.solrj.impl.HttpSolrClient;
|
|||
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
|
||||
import org.apache.solr.client.solrj.request.GenericSolrRequest;
|
||||
import org.apache.solr.client.solrj.response.SimpleSolrResponse;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.common.cloud.DocCollection;
|
||||
import org.apache.solr.common.params.ModifiableSolrParams;
|
||||
|
@ -41,7 +42,6 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import static org.apache.solr.client.solrj.SolrRequest.METHOD.GET;
|
||||
import static org.apache.solr.client.solrj.SolrRequest.METHOD.POST;
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
import static org.apache.solr.common.params.CommonParams.COLLECTIONS_HANDLER_PATH;
|
||||
import static org.junit.matchers.JUnitMatchers.containsString;
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class RulesTest extends SolrCloudTestCase {
|
|||
" {'replica': 0, 'port':'" + port + "'}" +
|
||||
" ]" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
cluster.getSolrClient().request(req);
|
||||
|
||||
// but this collection is created with a replica placement rule that says all replicas must be created
|
||||
|
|
|
@ -30,6 +30,7 @@ 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.response.QueryResponse;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.SolrCloudTestCase;
|
||||
import org.apache.solr.cloud.autoscaling.ActionContext;
|
||||
import org.apache.solr.cloud.autoscaling.SystemLogListener;
|
||||
|
@ -53,8 +54,6 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
|
||||
@LogLevel("org.apache.solr.cloud.autoscaling=DEBUG;org.apache.solr.cloud.Overseer=DEBUG;org.apache.solr.cloud.overseer=DEBUG;org.apache.solr.client.solrj.cloud.autoscaling=DEBUG")
|
||||
public class AutoscalingHistoryHandlerTest extends SolrCloudTestCase {
|
||||
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
@ -124,7 +123,7 @@ public class AutoscalingHistoryHandlerTest extends SolrCloudTestCase {
|
|||
" {'replica':'<2', 'shard': '#EACH', 'node': '#ANY'}" +
|
||||
" ]" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
solrClient.request(req);
|
||||
|
||||
|
||||
|
@ -141,7 +140,7 @@ public class AutoscalingHistoryHandlerTest extends SolrCloudTestCase {
|
|||
"{'name':'test','class':'" + TesterAction.class.getName() + "'}" +
|
||||
"]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
NamedList<Object> response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -158,7 +157,7 @@ public class AutoscalingHistoryHandlerTest extends SolrCloudTestCase {
|
|||
"{'name':'test','class':'" + TesterAction.class.getName() + "'}" +
|
||||
"]" +
|
||||
"}}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -168,7 +167,7 @@ public class AutoscalingHistoryHandlerTest extends SolrCloudTestCase {
|
|||
"\t\t\"name\" : \"" + PREFIX + "_node_lost_trigger.system\"\n" +
|
||||
"\t}\n" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, removeListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, removeListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
removeListenerCommand = "{\n" +
|
||||
|
@ -176,7 +175,7 @@ public class AutoscalingHistoryHandlerTest extends SolrCloudTestCase {
|
|||
"\t\t\"name\" : \"" + PREFIX + "_node_added_trigger.system\"\n" +
|
||||
"\t}\n" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, removeListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, removeListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
// set up our own listeners
|
||||
|
@ -191,7 +190,7 @@ public class AutoscalingHistoryHandlerTest extends SolrCloudTestCase {
|
|||
"'class' : '" + SystemLogListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
setListenerCommand = "{" +
|
||||
|
@ -203,7 +202,7 @@ public class AutoscalingHistoryHandlerTest extends SolrCloudTestCase {
|
|||
"'class' : '" + TesterListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -218,7 +217,7 @@ public class AutoscalingHistoryHandlerTest extends SolrCloudTestCase {
|
|||
"'class' : '" + SystemLogListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
setListenerCommand = "{" +
|
||||
|
@ -230,7 +229,7 @@ public class AutoscalingHistoryHandlerTest extends SolrCloudTestCase {
|
|||
"'class' : '" + TesterListener.class.getName() + "'" +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setListenerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
@ -240,7 +239,7 @@ public class AutoscalingHistoryHandlerTest extends SolrCloudTestCase {
|
|||
"'name' : '" + PREFIX + "_node_added_trigger'," +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
resumeTriggerCommand = "{" +
|
||||
|
@ -248,7 +247,7 @@ public class AutoscalingHistoryHandlerTest extends SolrCloudTestCase {
|
|||
"'name' : '" + PREFIX + "_node_lost_trigger'," +
|
||||
"}" +
|
||||
"}";
|
||||
req = createAutoScalingRequest(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
req = AutoScalingRequest.create(SolrRequest.METHOD.POST, resumeTriggerCommand);
|
||||
response = solrClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ import org.apache.solr.client.solrj.embedded.JettySolrRunner;
|
|||
import org.apache.solr.client.solrj.impl.CloudSolrClient;
|
||||
import org.apache.solr.client.solrj.impl.HttpSolrClient;
|
||||
import org.apache.solr.client.solrj.response.QueryResponse;
|
||||
import org.apache.solr.cloud.CloudTestUtils.AutoScalingRequest;
|
||||
import org.apache.solr.cloud.MiniSolrCloudCluster;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
import org.apache.solr.common.util.NamedList;
|
||||
|
@ -56,7 +57,6 @@ import org.junit.Test;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.apache.solr.cloud.autoscaling.AutoScalingHandlerTest.createAutoScalingRequest;
|
||||
|
||||
/**
|
||||
* Tests the SolrCLI.RunExampleTool implementation that supports bin/solr -e [example]
|
||||
|
@ -583,7 +583,7 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {
|
|||
" {'nodeRole':'overseer', 'replica':0}" +
|
||||
" ]" +
|
||||
"}";
|
||||
SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
SolrRequest req = AutoScalingRequest.create(SolrRequest.METHOD.POST, setClusterPolicyCommand);
|
||||
NamedList<Object> response = cloudClient.request(req);
|
||||
assertEquals(response.get("result").toString(), "success");
|
||||
SolrCLI.CreateCollectionTool createCollectionTool = new SolrCLI.CreateCollectionTool(stdoutSim);
|
||||
|
|
Loading…
Reference in New Issue