mirror of https://github.com/apache/lucene.git
SOLR-7468: Close the cloud client created for test in a finally block.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1681413 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c3b3de98bb
commit
5a96141d7f
|
@ -146,30 +146,34 @@ public class TestSolrCloudWithKerberos extends AbstractFullDistribZkTestBase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testKerberizedSolr() throws Exception {
|
public void testKerberizedSolr() throws Exception {
|
||||||
HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer());
|
CloudSolrClient testClient = null;
|
||||||
CloudSolrClient testClient = createCloudClient("testcollection");
|
try {
|
||||||
|
HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer());
|
||||||
CollectionAdminRequest.Create create = new CollectionAdminRequest.Create();
|
testClient = createCloudClient("testcollection");
|
||||||
create.setCollectionName("testcollection");
|
|
||||||
create.setConfigName("conf1");
|
|
||||||
create.setNumShards(1);
|
|
||||||
create.setReplicationFactor(1);
|
|
||||||
create.process(testClient);
|
|
||||||
|
|
||||||
waitForCollection(testClient.getZkStateReader(), "testcollection", 1);
|
|
||||||
CollectionAdminRequest.List list = new CollectionAdminRequest.List();
|
|
||||||
|
|
||||||
CollectionAdminResponse response = list.process(testClient);
|
|
||||||
assertTrue("Expected to see testcollection but it doesn't exist",
|
|
||||||
((ArrayList) response.getResponse().get("collections")).contains("testcollection"));
|
|
||||||
|
|
||||||
testClient.setDefaultCollection("testcollection");
|
|
||||||
indexDoc(testClient, params("commit", "true"), getDoc("id", 1));
|
|
||||||
//cloudClient.commit();
|
|
||||||
|
|
||||||
QueryResponse queryResponse = testClient.query(new SolrQuery("*:*"));
|
CollectionAdminRequest.Create create = new CollectionAdminRequest.Create();
|
||||||
assertEquals("Expected #docs and actual isn't the same", 1, queryResponse.getResults().size());
|
create.setCollectionName("testcollection");
|
||||||
testClient.close();
|
create.setConfigName("conf1");
|
||||||
|
create.setNumShards(1);
|
||||||
|
create.setReplicationFactor(1);
|
||||||
|
create.process(testClient);
|
||||||
|
|
||||||
|
waitForCollection(testClient.getZkStateReader(), "testcollection", 1);
|
||||||
|
CollectionAdminRequest.List list = new CollectionAdminRequest.List();
|
||||||
|
|
||||||
|
CollectionAdminResponse response = list.process(testClient);
|
||||||
|
assertTrue("Expected to see testcollection but it doesn't exist",
|
||||||
|
((ArrayList) response.getResponse().get("collections")).contains("testcollection"));
|
||||||
|
|
||||||
|
testClient.setDefaultCollection("testcollection");
|
||||||
|
indexDoc(testClient, params("commit", "true"), getDoc("id", 1));
|
||||||
|
|
||||||
|
QueryResponse queryResponse = testClient.query(new SolrQuery("*:*"));
|
||||||
|
assertEquals("Expected #docs and actual isn't the same", 1, queryResponse.getResults().size());
|
||||||
|
} finally {
|
||||||
|
if(testClient != null)
|
||||||
|
testClient.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue