Search in sources :

Example 1 with SolrPing

use of org.apache.solr.client.solrj.request.SolrPing in project lucene-solr by apache.

the class PingRequestHandlerTest method testPingInClusterWithNoHealthCheck.

public void testPingInClusterWithNoHealthCheck() throws Exception {
    MiniSolrCloudCluster miniCluster = new MiniSolrCloudCluster(NUM_SERVERS, createTempDir(), buildJettyConfig("/solr"));
    final CloudSolrClient cloudSolrClient = miniCluster.getSolrClient();
    try {
        assertNotNull(miniCluster.getZkServer());
        List<JettySolrRunner> jettys = miniCluster.getJettySolrRunners();
        assertEquals(NUM_SERVERS, jettys.size());
        for (JettySolrRunner jetty : jettys) {
            assertTrue(jetty.isRunning());
        }
        // create collection
        String collectionName = "testSolrCloudCollection";
        String configName = "solrCloudCollectionConfig";
        miniCluster.uploadConfigSet(SolrTestCaseJ4.TEST_PATH().resolve("collection1").resolve("conf"), configName);
        CollectionAdminRequest.createCollection(collectionName, configName, NUM_SHARDS, REPLICATION_FACTOR).process(miniCluster.getSolrClient());
        // Send distributed and non-distributed ping query
        SolrPingWithDistrib reqDistrib = new SolrPingWithDistrib();
        reqDistrib.setDistrib(true);
        SolrPingResponse rsp = reqDistrib.process(cloudSolrClient, collectionName);
        assertEquals(0, rsp.getStatus());
        assertTrue(rsp.getResponseHeader().getBooleanArg(("zkConnected")));
        SolrPing reqNonDistrib = new SolrPing();
        rsp = reqNonDistrib.process(cloudSolrClient, collectionName);
        assertEquals(0, rsp.getStatus());
        assertTrue(rsp.getResponseHeader().getBooleanArg(("zkConnected")));
    } finally {
        miniCluster.shutdown();
    }
}
Also used : SolrPingResponse(org.apache.solr.client.solrj.response.SolrPingResponse) JettySolrRunner(org.apache.solr.client.solrj.embedded.JettySolrRunner) SolrPing(org.apache.solr.client.solrj.request.SolrPing) MiniSolrCloudCluster(org.apache.solr.cloud.MiniSolrCloudCluster) CloudSolrClient(org.apache.solr.client.solrj.impl.CloudSolrClient)

Aggregations

JettySolrRunner (org.apache.solr.client.solrj.embedded.JettySolrRunner)1 CloudSolrClient (org.apache.solr.client.solrj.impl.CloudSolrClient)1 SolrPing (org.apache.solr.client.solrj.request.SolrPing)1 SolrPingResponse (org.apache.solr.client.solrj.response.SolrPingResponse)1 MiniSolrCloudCluster (org.apache.solr.cloud.MiniSolrCloudCluster)1