From f084e658b77e1ec98021146318cc37772b73de51 Mon Sep 17 00:00:00 2001 From: Hrishikesh Gadre Date: Tue, 15 Nov 2016 16:32:21 -0800 Subject: [PATCH] SOLR-9324 Fix TestSolrCloudWithSecureImpersonation#testForwarding --- .../TestSolrCloudWithSecureImpersonation.java | 2 +- .../security/HttpParamDelegationTokenPlugin.java | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.java b/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.java index ef41e4d315a..8d7a1a6a33d 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.java @@ -343,7 +343,7 @@ public class TestSolrCloudWithSecureImpersonation extends SolrTestCaseJ4 { @Test public void testForwarding() throws Exception { String collectionName = "forwardingCollection"; - File configDir = getFile("solr").toPath().resolve("collection1/conf").toFile(); + File configDir = TEST_PATH().resolve("collection1/conf").toFile(); miniCluster.uploadConfigDir(configDir, "conf1"); create1ShardCollection(collectionName, "conf1", miniCluster); diff --git a/solr/core/src/test/org/apache/solr/security/HttpParamDelegationTokenPlugin.java b/solr/core/src/test/org/apache/solr/security/HttpParamDelegationTokenPlugin.java index 7a4f69fa903..42d99a28a3c 100644 --- a/solr/core/src/test/org/apache/solr/security/HttpParamDelegationTokenPlugin.java +++ b/solr/core/src/test/org/apache/solr/security/HttpParamDelegationTokenPlugin.java @@ -49,8 +49,9 @@ import org.apache.http.HttpRequestInterceptor; import org.apache.http.NameValuePair; import org.apache.http.client.utils.URLEncodedUtils; 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.SolrHttpClientBuilder; +import org.apache.solr.client.solrj.impl.Krb5HttpClientConfigurer; import org.apache.solr.common.SolrException; import org.apache.solr.common.util.ExecutorUtil; 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) { super(coreContainer); } @@ -140,9 +148,8 @@ public class HttpParamDelegationTokenPlugin extends KerberosPlugin { } @Override - public SolrHttpClientBuilder getHttpClientBuilder(SolrHttpClientBuilder builder) { - HttpClientUtil.addRequestInterceptor(interceptor); - return super.getHttpClientBuilder(builder); + public HttpClientConfigurer getClientConfigurer() { + return configurer; } @Override