use of org.apache.solr.client.solrj.response.CollectionAdminResponse in project lucene-solr by apache.
the class CollectionsAPISolrJTest method testSplitShard.
@Test
public void testSplitShard() throws Exception {
final String collectionName = "solrj_test_splitshard";
CollectionAdminRequest.createCollection(collectionName, "conf", 2, 1).process(cluster.getSolrClient());
CollectionAdminResponse response = CollectionAdminRequest.splitShard(collectionName).setShardName("shard1").process(cluster.getSolrClient());
assertEquals(0, response.getStatus());
assertTrue(response.isSuccess());
Map<String, NamedList<Integer>> coresStatus = response.getCollectionCoresStatus();
assertEquals(0, (int) coresStatus.get(Assign.buildCoreName(collectionName, "shard1_0", Replica.Type.NRT, 1)).get("status"));
assertEquals(0, (int) coresStatus.get(Assign.buildCoreName(collectionName, "shard1_1", Replica.Type.NRT, 1)).get("status"));
waitForState("Expected all shards to be active and parent shard to be removed", collectionName, (n, c) -> {
if (c.getSlice("shard1").getState() == Slice.State.ACTIVE)
return false;
for (Replica r : c.getReplicas()) {
if (r.isActive(n) == false)
return false;
}
return true;
});
// Test splitting using split.key
response = CollectionAdminRequest.splitShard(collectionName).setSplitKey("b!").process(cluster.getSolrClient());
assertEquals(0, response.getStatus());
assertTrue(response.isSuccess());
waitForState("Expected 5 slices to be active", collectionName, (n, c) -> c.getActiveSlices().size() == 5);
}
use of org.apache.solr.client.solrj.response.CollectionAdminResponse in project lucene-solr by apache.
the class CollectionsAPISolrJTest method testList.
@Test
public void testList() throws IOException, SolrServerException {
CollectionAdminResponse response = new CollectionAdminRequest.List().process(cluster.getSolrClient());
assertEquals(0, response.getStatus());
assertNotNull("collection list should not be null", response.getResponse().get("collections"));
}
use of org.apache.solr.client.solrj.response.CollectionAdminResponse in project lucene-solr by apache.
the class CollectionsAPISolrJTest method testCloudInfoInCoreStatus.
@Test
public void testCloudInfoInCoreStatus() throws IOException, SolrServerException {
String collectionName = "corestatus_test";
CollectionAdminResponse response = CollectionAdminRequest.createCollection(collectionName, "conf", 2, 2).setStateFormat(1).process(cluster.getSolrClient());
assertEquals(0, response.getStatus());
assertTrue(response.isSuccess());
String nodeName = ((NamedList) response.getResponse().get("success")).getName(0);
String corename = (String) ((NamedList) ((NamedList) response.getResponse().get("success")).getVal(0)).get("core");
try (HttpSolrClient coreclient = getHttpSolrClient(cluster.getSolrClient().getZkStateReader().getBaseUrlForNodeName(nodeName))) {
CoreAdminResponse status = CoreAdminRequest.getStatus(corename, coreclient);
Map m = status.getResponse().asMap(5);
assertEquals(collectionName, Utils.getObjectByPath(m, true, Arrays.asList("status", corename, "cloud", "collection")));
assertNotNull(Utils.getObjectByPath(m, true, Arrays.asList("status", corename, "cloud", "shard")));
assertNotNull(Utils.getObjectByPath(m, true, Arrays.asList("status", corename, "cloud", "replica")));
}
}
use of org.apache.solr.client.solrj.response.CollectionAdminResponse in project lucene-solr by apache.
the class CollectionsAPISolrJTest method testOverseerStatus.
@Test
public void testOverseerStatus() throws IOException, SolrServerException {
CollectionAdminResponse response = new CollectionAdminRequest.OverseerStatus().process(cluster.getSolrClient());
assertEquals(0, response.getStatus());
assertNotNull("overseer_operations shouldn't be null", response.getResponse().get("overseer_operations"));
}
use of org.apache.solr.client.solrj.response.CollectionAdminResponse in project lucene-solr by apache.
the class DeleteStatusTest method testDeletingNonExistentRequests.
@Test
public void testDeletingNonExistentRequests() throws Exception {
final CloudSolrClient client = cluster.getSolrClient();
CollectionAdminResponse rsp = CollectionAdminRequest.deleteAsyncId("foo").process(client);
assertEquals("[foo] not found in stored responses", rsp.getResponse().get("status"));
}
Aggregations