SOLR-9324 Fix TestSolrCloudWithSecureImpersonation#testForwarding

This commit is contained in:
Hrishikesh Gadre 2016-11-15 16:32:21 -08:00 committed by yonik
parent 6428772aa2
commit f084e658b7
2 changed files with 12 additions and 5 deletions

View File

@ -343,7 +343,7 @@ public class TestSolrCloudWithSecureImpersonation extends SolrTestCaseJ4 {
@Test @Test
public void testForwarding() throws Exception { public void testForwarding() throws Exception {
String collectionName = "forwardingCollection"; String collectionName = "forwardingCollection";
File configDir = getFile("solr").toPath().resolve("collection1/conf").toFile(); File configDir = TEST_PATH().resolve("collection1/conf").toFile();
miniCluster.uploadConfigDir(configDir, "conf1"); miniCluster.uploadConfigDir(configDir, "conf1");
create1ShardCollection(collectionName, "conf1", miniCluster); create1ShardCollection(collectionName, "conf1", miniCluster);

View File

@ -49,8 +49,9 @@ import org.apache.http.HttpRequestInterceptor;
import org.apache.http.NameValuePair; import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URLEncodedUtils; import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.HttpContext;
import org.apache.solr.client.solrj.impl.HttpClientConfigurer;
import org.apache.solr.client.solrj.impl.HttpClientUtil; import org.apache.solr.client.solrj.impl.HttpClientUtil;
import org.apache.solr.client.solrj.impl.SolrHttpClientBuilder; import org.apache.solr.client.solrj.impl.Krb5HttpClientConfigurer;
import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException;
import org.apache.solr.common.util.ExecutorUtil; import org.apache.solr.common.util.ExecutorUtil;
import org.apache.solr.core.CoreContainer; import org.apache.solr.core.CoreContainer;
@ -97,6 +98,13 @@ public class HttpParamDelegationTokenPlugin extends KerberosPlugin {
} }
}; };
private final HttpClientConfigurer configurer = new Krb5HttpClientConfigurer() {
public void configure(org.apache.http.impl.client.DefaultHttpClient httpClient, org.apache.solr.common.params.SolrParams config) {
super.configure(httpClient, config);
httpClient.addRequestInterceptor(interceptor);
};
};
public HttpParamDelegationTokenPlugin(CoreContainer coreContainer) { public HttpParamDelegationTokenPlugin(CoreContainer coreContainer) {
super(coreContainer); super(coreContainer);
} }
@ -140,9 +148,8 @@ public class HttpParamDelegationTokenPlugin extends KerberosPlugin {
} }
@Override @Override
public SolrHttpClientBuilder getHttpClientBuilder(SolrHttpClientBuilder builder) { public HttpClientConfigurer getClientConfigurer() {
HttpClientUtil.addRequestInterceptor(interceptor); return configurer;
return super.getHttpClientBuilder(builder);
} }
@Override @Override