use of org.apache.solr.client.solrj.response.CollectionAdminResponse in project lucene-solr by apache.
the class TestBlobHandler method createSystemCollection.
public static void createSystemCollection(SolrClient client) throws SolrServerException, IOException {
CollectionAdminResponse response1;
CollectionAdminRequest.Create createCollectionRequest = CollectionAdminRequest.createCollection(".system", 1, 2);
response1 = createCollectionRequest.process(client);
assertEquals(0, response1.getStatus());
assertTrue(response1.isSuccess());
}
use of org.apache.solr.client.solrj.response.CollectionAdminResponse in project lucene-solr by apache.
the class TestBlobHandler method doBlobHandlerTest.
@Test
public void doBlobHandlerTest() throws Exception {
try (SolrClient client = createNewSolrClient("", getBaseUrl((HttpSolrClient) clients.get(0)))) {
CollectionAdminResponse response1;
CollectionAdminRequest.Create createCollectionRequest = CollectionAdminRequest.createCollection(".system", 1, 2);
response1 = createCollectionRequest.process(client);
assertEquals(0, response1.getStatus());
assertTrue(response1.isSuccess());
DocCollection sysColl = cloudClient.getZkStateReader().getClusterState().getCollection(".system");
Replica replica = sysColl.getActiveSlicesMap().values().iterator().next().getLeader();
String baseUrl = replica.getStr(ZkStateReader.BASE_URL_PROP);
String url = baseUrl + "/.system/config/requestHandler";
Map map = TestSolrConfigHandlerConcurrent.getAsMap(url, cloudClient);
assertNotNull(map);
assertEquals("solr.BlobHandler", getObjectByPath(map, true, Arrays.asList("config", "requestHandler", "/blob", "class")));
map = TestSolrConfigHandlerConcurrent.getAsMap(baseUrl + "/.system/schema/fields/blob", cloudClient);
assertNotNull(map);
assertEquals("blob", getObjectByPath(map, true, Arrays.asList("field", "name")));
assertEquals("bytes", getObjectByPath(map, true, Arrays.asList("field", "type")));
checkBlobPost(baseUrl, cloudClient);
}
}
use of org.apache.solr.client.solrj.response.CollectionAdminResponse in project lucene-solr by apache.
the class CreateCollectionCleanupTest method testCreateCollectionCleanup.
@Test
public void testCreateCollectionCleanup() throws Exception {
final CloudSolrClient cloudClient = cluster.getSolrClient();
// Create a collection that would fail
CollectionAdminRequest.Create create = CollectionAdminRequest.createCollection("foo", "conf1", 1, 1);
Properties properties = new Properties();
properties.put(CoreAdminParams.DATA_DIR, "/some_invalid_dir/foo");
create.setProperties(properties);
CollectionAdminResponse rsp = create.process(cloudClient);
assertFalse(rsp.isSuccess());
// Confirm using LIST that the collection does not exist
assertFalse(CollectionAdminRequest.listCollections(cloudClient).contains("foo"));
}
use of org.apache.solr.client.solrj.response.CollectionAdminResponse in project lucene-solr by apache.
the class DeleteStatusTest method testAsyncIdsMayBeDeleted.
@Test
public void testAsyncIdsMayBeDeleted() throws Exception {
final CloudSolrClient client = cluster.getSolrClient();
final String collection = "deletestatus";
final String asyncId = CollectionAdminRequest.createCollection(collection, "conf1", 1, 1).processAsync(client);
waitForRequestState(asyncId, client, MAX_WAIT_TIMEOUT);
assertEquals(RequestStatusState.COMPLETED, CollectionAdminRequest.requestStatus(asyncId).process(client).getRequestStatus());
CollectionAdminResponse rsp = CollectionAdminRequest.deleteAsyncId(asyncId).process(client);
assertEquals("successfully removed stored response for [" + asyncId + "]", rsp.getResponse().get("status"));
assertEquals(RequestStatusState.NOT_FOUND, CollectionAdminRequest.requestStatus(asyncId).process(client).getRequestStatus());
}
use of org.apache.solr.client.solrj.response.CollectionAdminResponse in project lucene-solr by apache.
the class CollectionsAPISolrJTest method testCreateAndDeleteCollection.
@Test
public void testCreateAndDeleteCollection() throws Exception {
String collectionName = "solrj_test";
CollectionAdminResponse response = CollectionAdminRequest.createCollection(collectionName, "conf", 2, 2).setStateFormat(1).process(cluster.getSolrClient());
assertEquals(0, response.getStatus());
assertTrue(response.isSuccess());
Map<String, NamedList<Integer>> coresStatus = response.getCollectionCoresStatus();
assertEquals(4, coresStatus.size());
for (int i = 0; i < 4; i++) {
NamedList<Integer> status = coresStatus.get(Assign.buildCoreName(collectionName, "shard" + (i / 2 + 1), Replica.Type.NRT, (i % 2 + 1)));
assertEquals(0, (int) status.get("status"));
assertTrue(status.get("QTime") > 0);
}
response = CollectionAdminRequest.deleteCollection(collectionName).process(cluster.getSolrClient());
assertEquals(0, response.getStatus());
assertTrue(response.isSuccess());
Map<String, NamedList<Integer>> nodesStatus = response.getCollectionNodesStatus();
assertEquals(4, nodesStatus.size());
waitForState("Expected " + collectionName + " to disappear from cluster state", collectionName, (n, c) -> c == null);
// Test Creating a collection with new stateformat.
collectionName = "solrj_newstateformat";
response = CollectionAdminRequest.createCollection(collectionName, "conf", 2, 2).setStateFormat(2).process(cluster.getSolrClient());
assertEquals(0, response.getStatus());
assertTrue(response.isSuccess());
waitForState("Expected " + collectionName + " to appear in cluster state", collectionName, (n, c) -> c != null);
}
Aggregations