use of org.apache.solr.client.solrj.response.SolrPingResponse in project lucene-solr by apache.
the class SolrPingTest method testEnabledSolrPing.
@Test
public void testEnabledSolrPing() throws Exception {
SolrPing ping = new SolrPing();
SolrPingResponse rsp = null;
ping.setActionEnable();
ping.process(getSolrClient());
ping.removeAction();
rsp = ping.process(getSolrClient());
Assert.assertNotNull(rsp);
}
use of org.apache.solr.client.solrj.response.SolrPingResponse 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();
}
}
use of org.apache.solr.client.solrj.response.SolrPingResponse in project spring-boot by spring-projects.
the class SolrHealthIndicatorTests method solrIsUp.
@Test
public void solrIsUp() throws Exception {
SolrClient solrClient = mock(SolrClient.class);
SolrPingResponse pingResponse = new SolrPingResponse();
NamedList<Object> response = new NamedList<>();
response.add("status", "OK");
pingResponse.setResponse(response);
given(solrClient.ping()).willReturn(pingResponse);
SolrHealthIndicator healthIndicator = new SolrHealthIndicator(solrClient);
Health health = healthIndicator.health();
assertThat(health.getStatus()).isEqualTo(Status.UP);
assertThat(health.getDetails().get("solrStatus")).isEqualTo("OK");
}
use of org.apache.solr.client.solrj.response.SolrPingResponse in project jackrabbit-oak by apache.
the class EmbeddedSolrServerProviderTest method testEmbeddedSolrServerInitialization.
@Test
public void testEmbeddedSolrServerInitialization() throws Exception {
URI uri = getClass().getResource("/solr").toURI();
File file = new File(uri);
EmbeddedSolrServerConfiguration solrServerConfiguration = new EmbeddedSolrServerConfiguration(file.getAbsolutePath(), "oak");
EmbeddedSolrServerProvider embeddedSolrServerProvider = new EmbeddedSolrServerProvider(solrServerConfiguration);
SolrClient solrServer = embeddedSolrServerProvider.getSolrServer();
assertNotNull(solrServer);
SolrPingResponse ping = solrServer.ping();
assertNotNull(ping);
assertEquals(0, ping.getStatus());
}
use of org.apache.solr.client.solrj.response.SolrPingResponse in project spring-boot by spring-projects.
the class SolrHealthIndicatorTests method mockPingResponse.
private SolrPingResponse mockPingResponse(int status) {
SolrPingResponse pingResponse = new SolrPingResponse();
pingResponse.setResponse(mockResponse(status));
return pingResponse;
}
Aggregations