2020-08-03 14:28:08 +02:00
|
|
|
|
|
|
|
package eu.dnetlib.dhp.oa.provision;
|
|
|
|
|
|
|
|
import org.apache.solr.client.solrj.response.SolrPingResponse;
|
|
|
|
import org.apache.solr.client.solrj.response.UpdateResponse;
|
|
|
|
import org.junit.jupiter.api.Assertions;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
2020-11-18 10:58:05 +01:00
|
|
|
public class SolrAdminApplicationTest extends SolrTest {
|
2020-08-03 14:28:08 +02:00
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testPing() throws Exception {
|
2020-11-18 10:58:05 +01:00
|
|
|
SolrPingResponse pingResponse = miniCluster.getSolrClient().ping();
|
2020-08-03 14:28:08 +02:00
|
|
|
log.info("pingResponse: '{}'", pingResponse.getStatus());
|
2020-12-11 12:44:17 +01:00
|
|
|
Assertions.assertTrue(pingResponse.getStatus() == 0);
|
2020-08-03 14:28:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testAdminApplication_DELETE() throws Exception {
|
|
|
|
|
|
|
|
SolrAdminApplication admin = new SolrAdminApplication(miniCluster.getSolrClient().getZkHost());
|
|
|
|
|
|
|
|
UpdateResponse rsp = (UpdateResponse) admin
|
|
|
|
.execute(SolrAdminApplication.Action.DELETE_BY_QUERY, DEFAULT_COLLECTION, "*:*", false);
|
|
|
|
|
|
|
|
Assertions.assertTrue(rsp.getStatus() == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testAdminApplication_COMMIT() throws Exception {
|
|
|
|
|
|
|
|
SolrAdminApplication admin = new SolrAdminApplication(miniCluster.getSolrClient().getZkHost());
|
|
|
|
|
|
|
|
UpdateResponse rsp = (UpdateResponse) admin.commit(DEFAULT_COLLECTION);
|
|
|
|
|
|
|
|
Assertions.assertTrue(rsp.getStatus() == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|