Package org.apache.solr.client.solrj

Examples of org.apache.solr.client.solrj.SolrServer.ping()


                    log.debug("found a Solr index definition {}", entry.getName());
                }
                try {
                    SolrServer solrServer = solrServerProvider.getSolrServer();
                    // the query engine should be returned only if the server is alive, otherwise other indexes should be used
                    if (solrServer != null && 0 == solrServer.ping().getStatus()) {
                        tempIndexes.add(new SolrQueryIndex(
                                entry.getName(),
                                solrServer,
                                oakSolrConfigurationProvider.getConfiguration()));
                    }
View Full Code Here


    SolrServer solrServer = mock(SolrServer.class);
    SolrPingResponse pingResponse = new SolrPingResponse();
    NamedList<Object> response = new NamedList<Object>();
    response.add("status", "OK");
    pingResponse.setResponse(response);
    given(solrServer.ping()).willReturn(pingResponse);

    SolrHealthIndicator healthIndicator = new SolrHealthIndicator(solrServer);
    Health health = healthIndicator.health();
    assertEquals(Status.UP, health.getStatus());
    assertEquals("OK", health.getDetails().get("solrStatus"));
View Full Code Here

  }

  @Test
  public void solrIsDown() throws Exception {
    SolrServer solrServer = mock(SolrServer.class);
    given(solrServer.ping()).willThrow(new IOException("Connection failed"));

    SolrHealthIndicator healthIndicator = new SolrHealthIndicator(solrServer);
    Health health = healthIndicator.health();
    assertEquals(Status.DOWN, health.getStatus());
    assertTrue(((String) health.getDetails().get("error"))
View Full Code Here

        EmbeddedSolrServerConfiguration solrServerConfiguration = new EmbeddedSolrServerConfiguration(getClass().getResource("/solr").getFile(),
                getClass().getResource("/solr/solr.xml").getFile(), "oak");
        EmbeddedSolrServerProvider embeddedSolrServerProvider = new EmbeddedSolrServerProvider(solrServerConfiguration);
        SolrServer solrServer = embeddedSolrServerProvider.getSolrServer();
        assertNotNull(solrServer);
        SolrPingResponse ping = solrServer.ping();
        assertNotNull(ping);
        assertEquals(0, ping.getStatus());
    }

}
View Full Code Here

                    log.debug("found a Solr index definition {}", entry.getName());
                }
                try {
                    SolrServer solrServer = solrServerProvider.getSolrServer();
                    // the query engine should be returned only if the server is alive, otherwise other indexes should be used
                    if (solrServer != null && 0 == solrServer.ping().getStatus()) {
                        tempIndexes.add(new SolrQueryIndex(
                                entry.getName(),
                                solrServer,
                                oakSolrConfigurationProvider.getConfiguration()));
                    }
View Full Code Here

                    log.debug("found a Solr index definition {}", entry.getName());
                }
                try {
                    SolrServer solrServer = solrServerProvider.getSolrServer();
                    // the query engine should be returned only if the serve is alive, otherwise other indexes should be used
                    if (solrServer != null && 0 == solrServer.ping().getStatus()) {
                        tempIndexes.add(new SolrQueryIndex(
                                entry.getName(),
                                solrServer,
                                oakSolrConfigurationProvider.getConfiguration()));
                    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.