You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2020/02/26 20:36:59 UTC

[tinkerpop] 04/05: All SSL tests moved to their own class

This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit bb0a9dfbdcce8b0504a66402fa03ca674aa115ef
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Wed Feb 26 14:54:28 2020 -0500

    All SSL tests moved to their own class
    
    Need to move the new ones added after merge of #1244 CTR
---
 CHANGELOG.asciidoc                                 |  2 +
 .../gremlin/server/GremlinServerIntegrateTest.java | 78 ----------------------
 .../server/GremlinServerSslIntegrateTest.java      | 78 ++++++++++++++++++++++
 3 files changed, 80 insertions(+), 78 deletions(-)

diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index d7af336..76f1779 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -23,6 +23,8 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 [[release-3-4-7]]
 === TinkerPop 3.4.7 (Release Date: NOT OFFICIALLY RELEASED YET)
 
+This release also includes changes from <<release-3-3-11, 3.3.11>>.
+
 
 [[release-3-4-6]]
 === TinkerPop 3.4.6 (Release Date: February 20, 2020)
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
index 7cb785e..23d4fe0 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
@@ -204,19 +204,6 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
             case "shouldCloseChannelIfClientDoesntRespond":
                 settings.idleConnectionTimeout = 1000;
                 break;
-            case "shouldEnableSslAndClientCertificateAuthWithDifferentStoreType":
-            case "shouldEnableSslAndClientCertificateAuthAndFailWithIncorrectKeyStoreType":
-            case "shouldEnableSslAndClientCertificateAuthAndFailWithIncorrectTrustStoreType":
-                settings.ssl = new Settings.SslSettings();
-                settings.ssl.enabled = true;
-                settings.ssl.needClientAuth = ClientAuth.REQUIRE;
-                settings.ssl.keyStore = JKS_SERVER_KEY;
-                settings.ssl.keyStorePassword = KEY_PASS;
-                settings.ssl.keyStoreType = KEYSTORE_TYPE_JKS;
-                settings.ssl.trustStore = P12_SERVER_TRUST;
-                settings.ssl.trustStorePassword = KEY_PASS;
-                settings.ssl.trustStoreType = TRUSTSTORE_TYPE_PKCS12;
-                break;
             default:
                 break;
         }
@@ -1207,69 +1194,4 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
             assertThat(ex.getMessage(), containsString("The Gremlin statement that was submitted exceeds the maximum compilation size allowed by the JVM"));
         }
     }
-
-    @Test
-    public void shouldEnableSslAndClientCertificateAuthWithDifferentStoreType() {
-        final Cluster cluster = TestClientFactory.build().enableSsl(true)
-                .keyStore(JKS_CLIENT_KEY).keyStorePassword(KEY_PASS).keyStoreType(KEYSTORE_TYPE_JKS)
-                .trustStore(P12_CLIENT_TRUST).trustStorePassword(KEY_PASS).trustStoreType(TRUSTSTORE_TYPE_PKCS12)
-                .create();
-        final Client client = cluster.connect();
-
-        try {
-            assertEquals("test", client.submit("'test'").one().getString());
-        } finally {
-            cluster.close();
-        }
-
-        final Cluster cluster2 = TestClientFactory.build().enableSsl(true)
-                .keyStore(P12_CLIENT_KEY).keyStorePassword(KEY_PASS).keyStoreType(KEYSTORE_TYPE_PKCS12)
-                .trustStore(JKS_CLIENT_TRUST).trustStorePassword(KEY_PASS).trustStoreType(TRUSTSTORE_TYPE_JKS)
-                .create();
-        final Client client2 = cluster2.connect();
-
-        try {
-            assertEquals("test", client2.submit("'test'").one().getString());
-        } finally {
-            cluster2.close();
-        }
-    }
-
-    @Test
-    public void shouldEnableSslAndClientCertificateAuthAndFailWithIncorrectKeyStoreType() {
-        final Cluster cluster = TestClientFactory.build().enableSsl(true)
-                .keyStore(JKS_CLIENT_KEY).keyStorePassword(KEY_PASS).keyStoreType(KEYSTORE_TYPE_PKCS12)
-                .trustStore(P12_CLIENT_TRUST).trustStorePassword(KEY_PASS).trustStoreType(TRUSTSTORE_TYPE_PKCS12)
-                .create();
-        final Client client = cluster.connect();
-
-        try {
-            String res = client.submit("'test'").one().getString();
-            fail("Should throw exception because incorrect keyStoreType is specified");
-        } catch (Exception x) {
-            final Throwable root = ExceptionUtils.getRootCause(x);
-            assertThat(root, instanceOf(TimeoutException.class));
-        } finally {
-            cluster.close();
-        }
-    }
-
-    @Test
-    public void shouldEnableSslAndClientCertificateAuthAndFailWithIncorrectTrustStoreType() {
-        final Cluster cluster = TestClientFactory.build().enableSsl(true)
-                .keyStore(P12_CLIENT_KEY).keyStorePassword(KEY_PASS).keyStoreType(KEYSTORE_TYPE_PKCS12)
-                .trustStore(JKS_CLIENT_TRUST).trustStorePassword(KEY_PASS).trustStoreType(TRUSTSTORE_TYPE_PKCS12)
-                .create();
-        final Client client = cluster.connect();
-
-        try {
-            client.submit("'test'").one();
-            fail("Should throw exception because incorrect trustStoreType is specified");
-        } catch (Exception x) {
-            final Throwable root = ExceptionUtils.getRootCause(x);
-            assertThat(root, instanceOf(TimeoutException.class));
-        } finally {
-            cluster.close();
-        }
-    }
 }
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSslIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSslIntegrateTest.java
index 7a3d499..ab75b8e 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSslIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSslIntegrateTest.java
@@ -131,6 +131,19 @@ public class GremlinServerSslIntegrateTest extends AbstractGremlinServerIntegrat
                 settings.ssl.keyStoreType = KEYSTORE_TYPE_JKS;
                 settings.ssl.sslCipherSuites = Collections.singletonList("TLS_DHE_RSA_WITH_AES_128_CBC_SHA");
                 break;
+            case "shouldEnableSslAndClientCertificateAuthWithDifferentStoreType":
+            case "shouldEnableSslAndClientCertificateAuthAndFailWithIncorrectKeyStoreType":
+            case "shouldEnableSslAndClientCertificateAuthAndFailWithIncorrectTrustStoreType":
+                settings.ssl = new Settings.SslSettings();
+                settings.ssl.enabled = true;
+                settings.ssl.needClientAuth = ClientAuth.REQUIRE;
+                settings.ssl.keyStore = JKS_SERVER_KEY;
+                settings.ssl.keyStorePassword = KEY_PASS;
+                settings.ssl.keyStoreType = KEYSTORE_TYPE_JKS;
+                settings.ssl.trustStore = P12_SERVER_TRUST;
+                settings.ssl.trustStorePassword = KEY_PASS;
+                settings.ssl.trustStoreType = TRUSTSTORE_TYPE_PKCS12;
+                break;
         }
 
         return settings;
@@ -337,4 +350,69 @@ public class GremlinServerSslIntegrateTest extends AbstractGremlinServerIntegrat
             cluster.close();
         }
     }
+
+    @Test
+    public void shouldEnableSslAndClientCertificateAuthWithDifferentStoreType() {
+        final Cluster cluster = TestClientFactory.build().enableSsl(true)
+                .keyStore(JKS_CLIENT_KEY).keyStorePassword(KEY_PASS).keyStoreType(KEYSTORE_TYPE_JKS)
+                .trustStore(P12_CLIENT_TRUST).trustStorePassword(KEY_PASS).trustStoreType(TRUSTSTORE_TYPE_PKCS12)
+                .create();
+        final Client client = cluster.connect();
+
+        try {
+            assertEquals("test", client.submit("'test'").one().getString());
+        } finally {
+            cluster.close();
+        }
+
+        final Cluster cluster2 = TestClientFactory.build().enableSsl(true)
+                .keyStore(P12_CLIENT_KEY).keyStorePassword(KEY_PASS).keyStoreType(KEYSTORE_TYPE_PKCS12)
+                .trustStore(JKS_CLIENT_TRUST).trustStorePassword(KEY_PASS).trustStoreType(TRUSTSTORE_TYPE_JKS)
+                .create();
+        final Client client2 = cluster2.connect();
+
+        try {
+            assertEquals("test", client2.submit("'test'").one().getString());
+        } finally {
+            cluster2.close();
+        }
+    }
+
+    @Test
+    public void shouldEnableSslAndClientCertificateAuthAndFailWithIncorrectKeyStoreType() {
+        final Cluster cluster = TestClientFactory.build().enableSsl(true)
+                .keyStore(JKS_CLIENT_KEY).keyStorePassword(KEY_PASS).keyStoreType(KEYSTORE_TYPE_PKCS12)
+                .trustStore(P12_CLIENT_TRUST).trustStorePassword(KEY_PASS).trustStoreType(TRUSTSTORE_TYPE_PKCS12)
+                .create();
+        final Client client = cluster.connect();
+
+        try {
+            String res = client.submit("'test'").one().getString();
+            fail("Should throw exception because incorrect keyStoreType is specified");
+        } catch (Exception x) {
+            final Throwable root = ExceptionUtils.getRootCause(x);
+            assertThat(root, instanceOf(TimeoutException.class));
+        } finally {
+            cluster.close();
+        }
+    }
+
+    @Test
+    public void shouldEnableSslAndClientCertificateAuthAndFailWithIncorrectTrustStoreType() {
+        final Cluster cluster = TestClientFactory.build().enableSsl(true)
+                .keyStore(P12_CLIENT_KEY).keyStorePassword(KEY_PASS).keyStoreType(KEYSTORE_TYPE_PKCS12)
+                .trustStore(JKS_CLIENT_TRUST).trustStorePassword(KEY_PASS).trustStoreType(TRUSTSTORE_TYPE_PKCS12)
+                .create();
+        final Client client = cluster.connect();
+
+        try {
+            client.submit("'test'").one();
+            fail("Should throw exception because incorrect trustStoreType is specified");
+        } catch (Exception x) {
+            final Throwable root = ExceptionUtils.getRootCause(x);
+            assertThat(root, instanceOf(TimeoutException.class));
+        } finally {
+            cluster.close();
+        }
+    }
 }