Repository: calcite-avatica Updated Branches: refs/heads/branch-avatica-1.12 ade9219f7 -> 2320e56af (forced update)
CALCITE-2285 Support client cert keystore for Avatica Client (Addendum, Remove unused code) Closes #61 Signed-off-by: Josh Elser <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/calcite-avatica/repo Commit: http://git-wip-us.apache.org/repos/asf/calcite-avatica/commit/6a19451f Tree: http://git-wip-us.apache.org/repos/asf/calcite-avatica/tree/6a19451f Diff: http://git-wip-us.apache.org/repos/asf/calcite-avatica/diff/6a19451f Branch: refs/heads/branch-avatica-1.12 Commit: 6a19451f7e9ed1a6adad51203de2377a96e7c615 Parents: 97c8a16 Author: Karan Mehta <[email protected]> Authored: Thu Jun 14 21:00:12 2018 -0700 Committer: Josh Elser <[email protected]> Committed: Fri Jun 15 12:43:08 2018 -0400 ---------------------------------------------------------------------- .../avatica/remote/AvaticaCommonsHttpClientImpl.java | 9 --------- .../AvaticaCommonsHttpClientImplSocketFactoryTest.java | 7 ------- 2 files changed, 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6a19451f/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImpl.java b/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImpl.java index e7e6aa0..0981efe 100644 --- a/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImpl.java +++ b/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImpl.java @@ -88,7 +88,6 @@ public class AvaticaCommonsHttpClientImpl implements AvaticaHttpClient, protected CredentialsProvider credentialsProvider = null; protected Lookup<AuthSchemeProvider> authRegistry = null; - protected boolean configureHttpsSocket = false; protected File truststore = null; protected File keystore = null; protected String truststorePassword = null; @@ -134,11 +133,6 @@ public class AvaticaCommonsHttpClientImpl implements AvaticaHttpClient, } protected void configureHttpsRegistry(RegistryBuilder<ConnectionSocketFactory> registryBuilder) { - if (!configureHttpsSocket) { - LOG.debug("HTTPS Socket not being configured because no truststore/keystore provided"); - return; - } - try { SSLContext sslContext = getSSLContext(); final HostnameVerifier verifier = getHostnameVerifier(hostnameVerification); @@ -284,7 +278,6 @@ public class AvaticaCommonsHttpClientImpl implements AvaticaHttpClient, "Truststore is must be an existing, regular file: " + truststore); } this.truststorePassword = Objects.requireNonNull(password); - configureHttpsSocket = true; initializeClient(); } @@ -296,13 +289,11 @@ public class AvaticaCommonsHttpClientImpl implements AvaticaHttpClient, } this.keystorePassword = Objects.requireNonNull(keystorepassword); this.keyPassword = Objects.requireNonNull(keypassword); - configureHttpsSocket = true; initializeClient(); } @Override public void setHostnameVerification(HostnameVerification verification) { this.hostnameVerification = Objects.requireNonNull(verification); - configureHttpsSocket = true; initializeClient(); } } http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6a19451f/core/src/test/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImplSocketFactoryTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImplSocketFactoryTest.java b/core/src/test/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImplSocketFactoryTest.java index a75222a..b05b8dc 100644 --- a/core/src/test/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImplSocketFactoryTest.java +++ b/core/src/test/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImplSocketFactoryTest.java @@ -26,7 +26,6 @@ import org.junit.Test; import java.io.File; import java.net.URL; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doNothing; @@ -51,8 +50,6 @@ public class AvaticaCommonsHttpClientImplSocketFactoryTest { @Test public void testPlainSocketFactory() throws Exception { configureHttpClient(); - assertFalse("Https socket should not be configured" - + " without truststore/keystore", client.configureHttpsSocket); verifyFactoryInstance(client, HTTP_REGISTRY, PlainConnectionSocketFactory.class); verifyFactoryInstance(client, HTTPS_REGISTRY, null); verify(client, times(0)).loadTrustStore(any(SSLContextBuilder.class)); @@ -62,8 +59,6 @@ public class AvaticaCommonsHttpClientImplSocketFactoryTest { @Test public void testTrustStoreLoadedInFactory() throws Exception { configureHttpsClient(); client.setTrustStore(storeFile, password); - assertTrue("Https socket should be configured" - + " with truststore", client.configureHttpsSocket); verifyFactoryInstance(client, HTTP_REGISTRY, null); verifyFactoryInstance(client, HTTPS_REGISTRY, SSLConnectionSocketFactory.class); verify(client, times(1)).configureSocketFactories(); @@ -74,8 +69,6 @@ public class AvaticaCommonsHttpClientImplSocketFactoryTest { @Test public void testKeyStoreLoadedInFactory() throws Exception { configureHttpsClient(); client.setKeyStore(storeFile, password, password); - assertTrue("Https socket should be configured" - + " with keystore", client.configureHttpsSocket); verifyFactoryInstance(client, HTTP_REGISTRY, null); verifyFactoryInstance(client, HTTPS_REGISTRY, SSLConnectionSocketFactory.class); verify(client, times(1)).configureSocketFactories();
