SOLR-7468: Fix the Kerberos test to use a reconfigured client always.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1681198 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Anshum Gupta 2015-05-22 19:21:11 +00:00
parent 375899fdbd
commit 71c454caed
1 changed files with 14 additions and 8 deletions

View File

@ -30,11 +30,13 @@ import org.apache.hadoop.minikdc.MiniKdc;
import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.impl.HttpClientUtil;
import org.apache.solr.client.solrj.impl.Krb5HttpClientConfigurer;
import org.apache.solr.client.solrj.request.CollectionAdminRequest; import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.client.solrj.response.CollectionAdminResponse; import org.apache.solr.client.solrj.response.CollectionAdminResponse;
import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.cloud.ZkStateReader; import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.CreateMode;
import org.junit.Test; import org.junit.Test;
@ -52,7 +54,7 @@ public class TestSolrCloudWithKerberos extends AbstractFullDistribZkTestBase {
"hi_IN"); "hi_IN");
Configuration originalConfig = Configuration.getConfiguration(); Configuration originalConfig = Configuration.getConfiguration();
@Override @Override
public void distribSetUp() throws Exception { public void distribSetUp() throws Exception {
//SSLTestConfig.setSSLSystemProperties(); //SSLTestConfig.setSSLSystemProperties();
@ -144,26 +146,30 @@ public class TestSolrCloudWithKerberos extends AbstractFullDistribZkTestBase {
@Test @Test
public void testKerberizedSolr() throws Exception { public void testKerberizedSolr() throws Exception {
HttpClientUtil.setConfigurer(new Krb5HttpClientConfigurer());
CloudSolrClient testClient = createCloudClient("testcollection");
CollectionAdminRequest.Create create = new CollectionAdminRequest.Create(); CollectionAdminRequest.Create create = new CollectionAdminRequest.Create();
create.setCollectionName("testcollection"); create.setCollectionName("testcollection");
create.setConfigName("conf1"); create.setConfigName("conf1");
create.setNumShards(1); create.setNumShards(1);
create.setReplicationFactor(1); create.setReplicationFactor(1);
create.process(cloudClient); create.process(testClient);
waitForCollection(cloudClient.getZkStateReader(), "testcollection", 1); waitForCollection(testClient.getZkStateReader(), "testcollection", 1);
CollectionAdminRequest.List list = new CollectionAdminRequest.List(); CollectionAdminRequest.List list = new CollectionAdminRequest.List();
CollectionAdminResponse response = list.process(cloudClient); CollectionAdminResponse response = list.process(testClient);
assertTrue("Expected to see testcollection but it doesn't exist", assertTrue("Expected to see testcollection but it doesn't exist",
((ArrayList) response.getResponse().get("collections")).contains("testcollection")); ((ArrayList) response.getResponse().get("collections")).contains("testcollection"));
cloudClient.setDefaultCollection("testcollection"); testClient.setDefaultCollection("testcollection");
indexDoc(cloudClient, params("commit", "true"), getDoc("id", 1)); indexDoc(testClient, params("commit", "true"), getDoc("id", 1));
//cloudClient.commit(); //cloudClient.commit();
QueryResponse queryResponse = cloudClient.query(new SolrQuery("*:*")); QueryResponse queryResponse = testClient.query(new SolrQuery("*:*"));
assertEquals("Expected #docs and actual isn't the same", 1, queryResponse.getResults().size()); assertEquals("Expected #docs and actual isn't the same", 1, queryResponse.getResults().size());
testClient.close();
} }
@Override @Override