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 2019/11/25 18:52:52 UTC

[tinkerpop] branch travis-fix updated (d114e1c -> ee70c9a)

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

spmallette pushed a change to branch travis-fix
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git.


 discard d114e1c  polish up
 discard d1d1e85  Revert all travis logging adjustments
 discard 384e88b  Enable all tests
 discard ec0b26d  enabled integration tests back since it won't fail anymore
 discard e09efaa  stop running gremlin-server unit tests
 discard fbedae6  more logging adjustments
 discard 14eb3d6  Fixed logger disabling for netty (i think)
 discard 01460e5  still tweaking logging - hiding some netty stuff as the log exceeds allowable length and job dies in travis.
 discard 912f012  turn up logging and enable a couple test
 discard 885786d  Clean builds with full logging........revert back to WARN
 discard c569729  More logs
 discard aae0ed7  Isolate the single failing test - cmon
 discard 248df27  Run just the one test case that's causing trouble
 discard a76044c  Kill travis_wait
 discard 23ce610  Break up server/console test builds for travis
 discard 46c15eb  Move SSL tests to their own test class
 discard 98c78e7  Temporary better error for kerberos failures
 discard 63e219c  Extend travis wait time for gremlin-server/console tests
 discard 97270c0  don't upgrade, images are fairly up-to-date, and it's slow
 discard 77a5f87  upgrade xenial - maybe something is just broken in the OS
 discard 15b88b8  Give reconnect some extra time on travis
 discard 10ce5ca  Another timeout bump to solve travis.
 discard 106b896  Increase default max wait time for a connection with java driver
 discard 4dadccb  A body of commits to debug/fix a failing travis test
     add 2d0fd64  Bump to Jackson databind 2.9.10.1 CTR
     add 20a5093  Merge branch 'tp33' into tp34
     add 050f66a  Pretty big javadoc cleanup.
     add c7461d7  Merge branch 'tp33' into tp34
     add 75e3acc  Javadoc fixes
     new dde3cbf  A body of commits to debug/fix a failing travis test
     new 0da1cfa  Increase default max wait time for a connection with java driver
     new 00c5d1a  Move SSL tests to their own test class
     new ee70c9a  Break up server/console test builds for travis

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (d114e1c)
            \
             N -- N -- N   refs/heads/travis-fix (ee70c9a)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../GephiTraversalVisualizationStrategy.groovy     |  2 +-
 .../gremlin/process/computer/ComputerResult.java   |  5 ++-
 .../gremlin/process/computer/GraphComputer.java    | 51 ++++++++++++----------
 .../gremlin/process/computer/MapReduce.java        | 13 +++---
 .../gremlin/process/computer/VertexProgram.java    |  6 +--
 .../computer/bulkloading/OneTimeBulkLoader.java    |  8 ++--
 .../computer/traversal/step/VertexComputing.java   |  5 ++-
 .../computer/util/DefaultComputerResult.java       |  6 ++-
 .../remote/traversal/AbstractRemoteTraversal.java  |  4 +-
 .../process/remote/traversal/RemoteTraversal.java  |  2 +-
 .../gremlin/process/traversal/Bindings.java        |  5 +--
 .../gremlin/process/traversal/Compare.java         |  2 +-
 .../tinkerpop/gremlin/process/traversal/Step.java  |  9 ++--
 .../gremlin/process/traversal/Traversal.java       | 17 ++++----
 .../process/traversal/TraversalSideEffects.java    | 10 +++--
 .../gremlin/process/traversal/TraversalSource.java | 24 +++++-----
 .../traversal/dsl/graph/GraphTraversal.java        |  8 ++--
 .../gremlin/process/traversal/step/Barrier.java    | 10 +++--
 .../gremlin/process/traversal/step/Bypassing.java  |  4 +-
 .../process/traversal/step/FromToModulating.java   |  5 ++-
 .../process/traversal/step/GraphComputing.java     |  8 ++--
 .../process/traversal/step/LambdaHolder.java       |  7 ++-
 .../process/traversal/step/MemoryComputing.java    |  4 +-
 .../process/traversal/step/map/GroupStep.java      |  4 +-
 .../process/traversal/step/util/WithOptions.java   | 18 +++++---
 .../step/util/event/MutationListener.java          |  8 ++--
 .../strategy/decoration/EventStrategy.java         |  2 +-
 .../traversal/util/FastNoSuchElementException.java |  4 +-
 .../process/traversal/util/TraversalMatrix.java    |  4 +-
 .../apache/tinkerpop/gremlin/structure/Column.java |  3 +-
 .../apache/tinkerpop/gremlin/structure/Graph.java  | 24 +++++-----
 .../tinkerpop/gremlin/structure/Property.java      |  2 +-
 .../gremlin/structure/VertexProperty.java          |  2 +-
 .../gremlin/structure/io/GraphMigrator.java        |  2 +-
 .../tinkerpop/gremlin/structure/io/IoCore.java     |  6 +--
 .../structure/io/graphml/GraphMLWriter.java        |  2 +-
 .../structure/io/graphson/GraphSONReader.java      |  5 ++-
 .../io/gryo/VertexByteArrayInputStream.java        |  4 +-
 .../structure/io/gryo/kryoshim/InputShim.java      |  5 ++-
 .../structure/io/gryo/kryoshim/KryoShim.java       |  5 ++-
 .../structure/io/gryo/kryoshim/OutputShim.java     |  5 ++-
 .../structure/io/gryo/kryoshim/SerializerShim.java |  5 ++-
 .../gremlin/structure/util/ElementHelper.java      | 38 ++++++++--------
 .../gremlin/structure/util/GraphFactory.java       | 17 ++++----
 .../gremlin/structure/util/StringFactory.java      |  8 ++--
 .../util/star/StarGraphGraphSONDeserializer.java   |  8 ++--
 .../gremlin/util/function/TriConsumer.java         |  2 +-
 .../apache/tinkerpop/gremlin/driver/Client.java    |  6 +--
 .../apache/tinkerpop/gremlin/driver/Settings.java  |  2 +-
 .../driver/ser/AbstractMessageSerializer.java      |  7 ++-
 .../ser/GraphSONMessageSerializerGremlinV2d0.java  |  3 +-
 .../driver/ser/GraphSONMessageSerializerV3d0.java  |  3 +-
 .../tinkerpop/gremlin/driver/ser/Serializers.java  |  6 +--
 .../gremlin/groovy/engine/GremlinExecutor.java     | 13 +++---
 .../gremlin/server/AbstractChannelizer.java        |  6 ++-
 .../apache/tinkerpop/gremlin/server/Context.java   |  3 +-
 .../tinkerpop/gremlin/server/GremlinServer.java    |  2 +-
 .../gremlin/server/channel/NioChannelizer.java     |  4 +-
 .../server/channel/WebSocketChannelizer.java       |  4 +-
 .../gremlin/server/op/AbstractEvalOpProcessor.java |  3 +-
 .../server/op/session/SessionOpProcessor.java      |  6 +--
 .../server/op/standard/StandardOpProcessor.java    |  2 +-
 gremlin-shaded/pom.xml                             |  2 +-
 .../tinkerpop/gremlin/AbstractGraphProvider.java   |  2 +-
 .../tinkerpop/gremlin/AbstractGremlinSuite.java    | 13 +++---
 .../tinkerpop/gremlin/FeatureRequirementSet.java   |  3 +-
 .../org/apache/tinkerpop/gremlin/GraphHelper.java  |  2 +-
 .../apache/tinkerpop/gremlin/GraphProvider.java    | 11 +++--
 .../apache/tinkerpop/gremlin/LoadGraphWith.java    |  3 +-
 .../algorithm/generator/AbstractGenerator.java     |  6 +--
 .../gremlin/structure/FeatureSupportTest.java      | 22 +++++-----
 .../gremlin/structure/GraphConstructionTest.java   |  6 +--
 .../tinkerpop/gremlin/structure/GraphTest.java     |  2 +-
 .../tinkerpop/gremlin/structure/PropertyTest.java  | 12 ++---
 .../tinkerpop/gremlin/structure/VariablesTest.java | 19 ++++----
 .../gremlin/process/GraphMutateBenchmark.java      |  5 ++-
 .../gremlin/process/GraphTraversalBenchmark.java   |  4 +-
 .../apache/tinkerpop/gremlin/hadoop/Constants.java |  4 +-
 .../hadoop/structure/io/GraphFilterAware.java      |  9 ++--
 .../structure/io/script/ScriptInputFormat.java     |  6 +--
 .../structure/io/script/ScriptOutputFormat.java    |  8 ++--
 .../gremlin/neo4j/structure/Neo4jGraph.java        |  2 +-
 .../gremlin/spark/structure/io/InputRDD.java       |  8 ++--
 .../gremlin/spark/structure/io/OutputRDD.java      |  8 ++--
 .../gremlin/tinkergraph/structure/TinkerGraph.java |  7 ++-
 .../structure/TinkerIoRegistryV2d0.java            |  8 ++--
 .../structure/TinkerIoRegistryV3d0.java            |  4 +-
 87 files changed, 340 insertions(+), 304 deletions(-)


[tinkerpop] 04/04: Break up server/console test builds for travis

Posted by sp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ee70c9a1854e29b83889fae982b0196353ae640a
Author: stephen <sp...@gmail.com>
AuthorDate: Fri Nov 15 10:46:36 2019 -0500

    Break up server/console test builds for travis
---
 .travis.yml                                                       | 8 ++++++--
 .../apache/tinkerpop/gremlin/server/auth/Krb5Authenticator.java   | 2 +-
 .../tinkerpop/gremlin/server/GremlinServerIntegrateTest.java      | 2 +-
 .../gremlin/server/GremlinServerSessionIntegrateTest.java         | 2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index e5f8621..89a230f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -41,8 +41,12 @@ jobs:
       name: "javascript"
     - script:
       - "mvn clean install -q -DskipTests"
-      - "travis_wait 60 mvn verify -pl :gremlin-server,:gremlin-console -DskipIntegrationTests=false"
-      name: "gremlin server/console"
+      - "mvn verify -pl :gremlin-server -DskipTests -DskipIntegrationTests=false"
+      name: "gremlin server"
+    - script:
+        - "mvn clean install -q -DskipTests"
+        - "mvn verify -pl :gremlin-console -DskipIntegrationTests=false"
+      name: "gremlin console"
     - script:
       - "mvn clean install -q -DskipTests"
       - "travis_wait 60 mvn verify -pl :spark-gremlin -DskipIntegrationTests=false"
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/auth/Krb5Authenticator.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/auth/Krb5Authenticator.java
index cd5cf65..0cadc99 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/auth/Krb5Authenticator.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/auth/Krb5Authenticator.java
@@ -114,7 +114,7 @@ public class Krb5Authenticator implements Authenticator {
                 // GSSAPI is the only available mechanism for this authenticator
                 final Map props = new HashMap<String, Object>();
                 final String[] principalParts = principalName.split("/|@");
-                if (principalParts.length < 3) throw new IllegalArgumentException("Use principal name of format 'service/fqdn@kdcrealm' - not this nonsense" + principalName);
+                if (principalParts.length < 3) throw new IllegalArgumentException("Use principal name of format 'service/fqdn@kdcrealm'");
                 saslServer = Sasl.createSaslServer(mechanism, principalParts[0], principalParts[1], props, Krb5SaslAuthenticator.this);
             } catch(Exception e) {
                 logger.error("Creating sasl server failed: ", e);
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 cbb1f1f..5448a26 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
@@ -887,7 +887,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
 
     @Test
     public void shouldFailOnDeadHost() throws Exception {
-        final Cluster cluster = TestClientFactory.build().maxWaitForConnection(90000).create();
+        final Cluster cluster = TestClientFactory.build().create();
         final Client client = cluster.connect();
 
         // ensure that connection to server is good
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
index 9a3e4ff..de13d99 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
@@ -327,7 +327,7 @@ public class GremlinServerSessionIntegrateTest  extends AbstractGremlinServerInt
 
     @Test
     public void shouldEnsureSessionBindingsAreThreadSafe() throws Exception {
-        final Cluster cluster = TestClientFactory.build().maxWaitForConnection(90000).
+        final Cluster cluster = TestClientFactory.build().
                 minInProcessPerConnection(16).maxInProcessPerConnection(64).create();
         final Client client = cluster.connect(name.getMethodName());
 


[tinkerpop] 03/04: Move SSL tests to their own test class

Posted by sp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 00c5d1aafe527e4a65137164a1ad3a3a21fec7ed
Author: stephen <sp...@gmail.com>
AuthorDate: Fri Nov 15 08:44:27 2019 -0500

    Move SSL tests to their own test class
---
 .../gremlin/server/GremlinServerIntegrateTest.java | 309 -------------------
 .../server/GremlinServerSslIntegrateTest.java      | 340 +++++++++++++++++++++
 2 files changed, 340 insertions(+), 309 deletions(-)

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 0510328..cbb1f1f 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
@@ -18,12 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.server;
 
-import io.netty.handler.ssl.ClientAuth;
-import io.netty.handler.ssl.SslContext;
-import io.netty.handler.ssl.SslContextBuilder;
-import io.netty.handler.ssl.SslProvider;
-import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
-import io.netty.handler.ssl.util.SelfSignedCertificate;
 import org.apache.commons.configuration.BaseConfiguration;
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.lang3.exception.ExceptionUtils;
@@ -67,7 +61,6 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import java.lang.reflect.Field;
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -104,10 +97,6 @@ import static org.junit.Assert.fail;
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegrationTest {
-    private static final String PEM_SERVER_KEY = "src/test/resources/server.key.pk8";
-    private static final String PEM_SERVER_CRT = "src/test/resources/server.crt";
-    private static final String PEM_CLIENT_KEY = "src/test/resources/client.key.pk8";
-    private static final String PEM_CLIENT_CRT = "src/test/resources/client.crt";
     private Level previousLogLevel;
 
     private Log4jRecordingAppender recordingAppender = null;
@@ -179,103 +168,6 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
             case "shouldBatchResultsByTwos":
                 settings.resultIterationBatchSize = 2;
                 break;
-            case "shouldEnableSsl":
-            case "shouldEnableSslButFailIfClientConnectsWithoutIt":
-                settings.ssl = new Settings.SslSettings();
-                settings.ssl.enabled = true;
-                settings.ssl.keyStore = JKS_SERVER_KEY;
-                settings.ssl.keyStorePassword = KEY_PASS;
-                settings.ssl.keyStoreType = KEYSTORE_TYPE_JKS;
-                break;
-            case "shouldEnableSslWithSslContextProgrammaticallySpecified":
-                settings.ssl = new Settings.SslSettings();
-                settings.ssl.enabled = true;
-                settings.ssl.overrideSslContext(createServerSslContext());
-                break;
-            case "shouldEnableSslAndClientCertificateAuthWithLegacyPem":
-                settings.ssl = new Settings.SslSettings();
-                settings.ssl.enabled = true;
-                settings.ssl.needClientAuth = ClientAuth.REQUIRE;
-                settings.ssl.keyCertChainFile = PEM_SERVER_CRT;
-                settings.ssl.keyFile = PEM_SERVER_KEY;
-                settings.ssl.keyPassword = KEY_PASS;
-                // Trust the client
-                settings.ssl.trustCertChainFile = PEM_CLIENT_CRT;
-                break;
-            case "shouldEnableSslAndClientCertificateAuthAndFailWithoutCertWithLegacyPem":
-                settings.ssl = new Settings.SslSettings();
-                settings.ssl.enabled = true;
-                settings.ssl.needClientAuth = ClientAuth.REQUIRE;
-                settings.ssl.keyCertChainFile = PEM_SERVER_CRT;
-                settings.ssl.keyFile = PEM_SERVER_KEY;
-                settings.ssl.keyPassword = KEY_PASS;
-                // Trust the client
-                settings.ssl.trustCertChainFile = PEM_CLIENT_CRT;
-                break;
-            case "shouldEnableSslAndClientCertificateAuthAndFailWithoutTrustedClientCertWithLegacyPem":
-                settings.ssl = new Settings.SslSettings();
-                settings.ssl.enabled = true;
-                settings.ssl.needClientAuth = ClientAuth.REQUIRE;
-                settings.ssl.keyCertChainFile = PEM_SERVER_CRT;
-                settings.ssl.keyFile = PEM_SERVER_KEY;
-                settings.ssl.keyPassword = KEY_PASS;
-                // Trust ONLY the server cert
-                settings.ssl.trustCertChainFile = PEM_SERVER_CRT;
-                break;
-            case "shouldEnableSslAndClientCertificateAuthWithPkcs12":
-                settings.ssl = new Settings.SslSettings();
-                settings.ssl.enabled = true;
-                settings.ssl.needClientAuth = ClientAuth.REQUIRE;
-                settings.ssl.keyStore = P12_SERVER_KEY;
-                settings.ssl.keyStorePassword = KEY_PASS;
-                settings.ssl.keyStoreType = KEYSTORE_TYPE_PKCS12;
-                settings.ssl.trustStore = P12_SERVER_TRUST;
-                settings.ssl.trustStorePassword = KEY_PASS;
-                break;
-            case "shouldEnableSslAndClientCertificateAuth":
-                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 = JKS_SERVER_TRUST;
-                settings.ssl.trustStorePassword = KEY_PASS;
-                break;
-            case "shouldEnableSslAndClientCertificateAuthAndFailWithoutCert":
-                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 = JKS_SERVER_TRUST;
-                settings.ssl.trustStorePassword = KEY_PASS;
-                break;
-            case "shouldEnableSslAndClientCertificateAuthAndFailWithoutTrustedClientCert":
-                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;
-                break;
-            case "shouldEnableSslAndFailIfProtocolsDontMatch":
-                settings.ssl = new Settings.SslSettings();
-                settings.ssl.enabled = true;
-                settings.ssl.keyStore = JKS_SERVER_KEY;
-                settings.ssl.keyStorePassword = KEY_PASS;
-                settings.ssl.keyStoreType = KEYSTORE_TYPE_JKS;
-                settings.ssl.sslEnabledProtocols = Arrays.asList("TLSv1.1");
-                break;
-            case "shouldEnableSslAndFailIfCiphersDontMatch":
-                settings.ssl = new Settings.SslSettings();
-                settings.ssl.enabled = true;
-                settings.ssl.keyStore = JKS_SERVER_KEY;
-                settings.ssl.keyStorePassword = KEY_PASS;
-                settings.ssl.keyStoreType = KEYSTORE_TYPE_JKS;
-                settings.ssl.sslCipherSuites = Arrays.asList("TLS_DHE_RSA_WITH_AES_128_CBC_SHA");
-                break;
             case "shouldUseSimpleSandbox":
                 settings.scriptEngines.get("gremlin-groovy").plugins.put(GroovyCompilerGremlinPlugin.class.getName(), getScriptEngineConfForSimpleSandbox());
                 // remove the script because it isn't used in the test but also because it's not CompileStatic ready
@@ -317,18 +209,6 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
         return settings;
     }
 
-    private static SslContext createServerSslContext() {
-        final SslProvider provider = SslProvider.JDK;
-
-        try {
-            // this is not good for production - just testing
-            final SelfSignedCertificate ssc = new SelfSignedCertificate();
-            return SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()).sslProvider(provider).build();
-        } catch (Exception ce) {
-            throw new RuntimeException("Couldn't setup self-signed certificate for test");
-        }
-    }
-
     private static Map<String, Object> getScriptEngineConfForSimpleSandbox() {
         final Map<String,Object> scriptEngineConf = new HashMap<>();
         scriptEngineConf.put("compilation", COMPILE_STATIC.name());
@@ -607,195 +487,6 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
     }
 
     @Test
-    public void shouldEnableSsl() {
-        final Cluster cluster = TestClientFactory.build().enableSsl(true).keyStore(JKS_SERVER_KEY).keyStorePassword(KEY_PASS).sslSkipCertValidation(true).create();
-        final Client client = cluster.connect();
-
-        try {
-            // this should return "nothing" - there should be no exception
-            assertEquals("test", client.submit("'test'").one().getString());
-        } finally {
-            cluster.close();
-        }
-    }
-
-    @Test
-    public void shouldEnableSslWithSslContextProgrammaticallySpecified() throws Exception {
-        // just for testing - this is not good for production use
-        final SslContextBuilder builder = SslContextBuilder.forClient();
-        builder.trustManager(InsecureTrustManagerFactory.INSTANCE);
-        builder.sslProvider(SslProvider.JDK);
-
-        final Cluster cluster = TestClientFactory.build().enableSsl(true).sslContext(builder.build()).create();
-        final Client client = cluster.connect();
-
-        try {
-            // this should return "nothing" - there should be no exception
-            assertEquals("test", client.submit("'test'").one().getString());
-        } finally {
-            cluster.close();
-        }
-    }
-
-    @Test
-    public void shouldEnableSslButFailIfClientConnectsWithoutIt() {
-        final Cluster cluster = TestClientFactory.build().enableSsl(false).create();
-        final Client client = cluster.connect();
-
-        try {
-            client.submit("'test'").one();
-            fail("Should throw exception because ssl is enabled on the server but not on client");
-        } catch(Exception x) {
-            final Throwable root = ExceptionUtils.getRootCause(x);
-            assertThat(root, instanceOf(TimeoutException.class));
-        } finally {
-            cluster.close();
-        }
-    }
-
-    @Test
-    public void shouldEnableSslAndClientCertificateAuthWithLegacyPem() {
-        final Cluster cluster = TestClientFactory.build().enableSsl(true)
-                .keyCertChainFile(PEM_CLIENT_CRT).keyFile(PEM_CLIENT_KEY)
-                .keyPassword(KEY_PASS).trustCertificateChainFile(PEM_SERVER_CRT).create();
-        final Client client = cluster.connect();
-
-        try {
-            assertEquals("test", client.submit("'test'").one().getString());
-        } finally {
-            cluster.close();
-        }
-    }
-
-    @Test
-    public void shouldEnableSslAndClientCertificateAuthAndFailWithoutCertWithLegacyPem() {
-        final Cluster cluster = TestClientFactory.build().enableSsl(true).keyStore(JKS_SERVER_KEY).keyStorePassword(KEY_PASS).sslSkipCertValidation(true).create();
-        final Client client = cluster.connect();
-
-        try {
-            client.submit("'test'").one();
-            fail("Should throw exception because ssl client auth is enabled on the server but client does not have a cert");
-        } catch(Exception x) {
-            final Throwable root = ExceptionUtils.getRootCause(x);
-            assertThat(root, instanceOf(TimeoutException.class));
-        } finally {
-            cluster.close();
-        }
-    }
-
-    @Test
-    public void shouldEnableSslAndClientCertificateAuthAndFailWithoutTrustedClientCertWithLegacyPem() {
-        final Cluster cluster = TestClientFactory.build().enableSsl(true)
-                .keyCertChainFile(PEM_CLIENT_CRT).keyFile(PEM_CLIENT_KEY)
-                .keyPassword(KEY_PASS).trustCertificateChainFile(PEM_SERVER_CRT).create();
-        final Client client = cluster.connect();
-
-        try {
-            client.submit("'test'").one();
-            fail("Should throw exception because ssl client auth is enabled on the server but does not trust client's cert");
-        } catch(Exception x) {
-            final Throwable root = ExceptionUtils.getRootCause(x);
-            assertThat(root, instanceOf(TimeoutException.class));
-        } finally {
-            cluster.close();
-        }
-    }
-
-    @Test
-    public void shouldEnableSslAndClientCertificateAuthWithPkcs12() {
-        final Cluster cluster = TestClientFactory.build().enableSsl(true).keyStore(P12_CLIENT_KEY).keyStorePassword(KEY_PASS)
-                .keyStoreType(KEYSTORE_TYPE_PKCS12).trustStore(P12_CLIENT_TRUST).trustStorePassword(KEY_PASS).create();
-        final Client client = cluster.connect();
-
-        try {
-            assertEquals("test", client.submit("'test'").one().getString());
-        } finally {
-            cluster.close();
-        }
-    }
-
-    @Test
-    public void shouldEnableSslAndClientCertificateAuth() {
-        final Cluster cluster = TestClientFactory.build().enableSsl(true).keyStore(JKS_CLIENT_KEY).keyStorePassword(KEY_PASS)
-                .keyStoreType(KEYSTORE_TYPE_JKS).trustStore(JKS_CLIENT_TRUST).trustStorePassword(KEY_PASS).create();
-        final Client client = cluster.connect();
-
-        try {
-            assertEquals("test", client.submit("'test'").one().getString());
-        } finally {
-            cluster.close();
-        }
-    }
-
-    @Test
-    public void shouldEnableSslAndClientCertificateAuthAndFailWithoutCert() {
-        final Cluster cluster = TestClientFactory.build().enableSsl(true).keyStore(JKS_SERVER_KEY).keyStorePassword(KEY_PASS)
-                .keyStoreType(KEYSTORE_TYPE_JKS).sslSkipCertValidation(true).create();
-        final Client client = cluster.connect();
-
-        try {
-            client.submit("'test'").one();
-            fail("Should throw exception because ssl client auth is enabled on the server but client does not have a cert");
-        } catch (Exception x) {
-            final Throwable root = ExceptionUtils.getRootCause(x);
-            assertThat(root, instanceOf(TimeoutException.class));
-        } finally {
-            cluster.close();
-        }
-    }
-
-    @Test
-    public void shouldEnableSslAndClientCertificateAuthAndFailWithoutTrustedClientCert() {
-        final Cluster cluster = TestClientFactory.build().enableSsl(true).keyStore(JKS_CLIENT_KEY).keyStorePassword(KEY_PASS)
-                .keyStoreType(KEYSTORE_TYPE_JKS).trustStore(JKS_CLIENT_TRUST).trustStorePassword(KEY_PASS).create();
-        final Client client = cluster.connect();
-
-        try {
-            client.submit("'test'").one();
-            fail("Should throw exception because ssl client auth is enabled on the server but does not trust client's cert");
-        } catch (Exception x) {
-            final Throwable root = ExceptionUtils.getRootCause(x);
-            assertThat(root, instanceOf(TimeoutException.class));
-        } finally {
-            cluster.close();
-        }
-    }
-
-    @Test
-    public void shouldEnableSslAndFailIfProtocolsDontMatch() {
-        final Cluster cluster = TestClientFactory.build().enableSsl(true).keyStore(JKS_SERVER_KEY).keyStorePassword(KEY_PASS)
-                .sslSkipCertValidation(true).sslEnabledProtocols(Arrays.asList("TLSv1.2")).create();
-        final Client client = cluster.connect();
-
-        try {
-            client.submit("'test'").one();
-            fail("Should throw exception because ssl client requires TLSv1.2 whereas server supports only TLSv1.1");
-        } catch (Exception x) {
-            final Throwable root = ExceptionUtils.getRootCause(x);
-            assertThat(root, instanceOf(TimeoutException.class));
-        } finally {
-            cluster.close();
-        }
-    }
-
-    @Test
-    public void shouldEnableSslAndFailIfCiphersDontMatch() {
-        final Cluster cluster = TestClientFactory.build().enableSsl(true).keyStore(JKS_SERVER_KEY).keyStorePassword(KEY_PASS)
-                .sslSkipCertValidation(true).sslCipherSuites(Arrays.asList("SSL_RSA_WITH_RC4_128_SHA")).create();
-        final Client client = cluster.connect();
-
-        try {
-            client.submit("'test'").one();
-            fail("Should throw exception because ssl client requires TLSv1.2 whereas server supports only TLSv1.1");
-        } catch (Exception x) {
-            final Throwable root = ExceptionUtils.getRootCause(x);
-            assertThat(root, instanceOf(TimeoutException.class));
-        } finally {
-            cluster.close();
-        }
-    }
-
-    @Test
     public void shouldRespectHighWaterMarkSettingAndSucceed() throws Exception {
         // the highwatermark should get exceeded on the server and thus pause the writes, but have no problem catching
         // itself up - this is a tricky tests to get passing on all environments so this assumption will deny the
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
new file mode 100644
index 0000000..7a3d499
--- /dev/null
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSslIntegrateTest.java
@@ -0,0 +1,340 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.server;
+
+import io.netty.handler.ssl.ClientAuth;
+import io.netty.handler.ssl.SslContext;
+import io.netty.handler.ssl.SslContextBuilder;
+import io.netty.handler.ssl.SslProvider;
+import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
+import io.netty.handler.ssl.util.SelfSignedCertificate;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+import org.apache.tinkerpop.gremlin.driver.Client;
+import org.apache.tinkerpop.gremlin.driver.Cluster;
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.concurrent.TimeoutException;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class GremlinServerSslIntegrateTest extends AbstractGremlinServerIntegrationTest {
+    private static final String PEM_SERVER_KEY = "src/test/resources/server.key.pk8";
+    private static final String PEM_SERVER_CRT = "src/test/resources/server.crt";
+    private static final String PEM_CLIENT_KEY = "src/test/resources/client.key.pk8";
+    private static final String PEM_CLIENT_CRT = "src/test/resources/client.crt";
+
+    /**
+     * Configure specific Gremlin Server settings for specific tests.
+     */
+    @Override
+    public Settings overrideSettings(final Settings settings) {
+        final String nameOfTest = name.getMethodName();
+        switch (nameOfTest) {
+            case "shouldEnableSsl":
+            case "shouldEnableSslButFailIfClientConnectsWithoutIt":
+                settings.ssl = new Settings.SslSettings();
+                settings.ssl.enabled = true;
+                settings.ssl.keyStore = JKS_SERVER_KEY;
+                settings.ssl.keyStorePassword = KEY_PASS;
+                settings.ssl.keyStoreType = KEYSTORE_TYPE_JKS;
+                break;
+            case "shouldEnableSslWithSslContextProgrammaticallySpecified":
+                settings.ssl = new Settings.SslSettings();
+                settings.ssl.enabled = true;
+                settings.ssl.overrideSslContext(createServerSslContext());
+                break;
+            case "shouldEnableSslAndClientCertificateAuthWithLegacyPem":
+            case "shouldEnableSslAndClientCertificateAuthAndFailWithoutCertWithLegacyPem":
+                settings.ssl = new Settings.SslSettings();
+                settings.ssl.enabled = true;
+                settings.ssl.needClientAuth = ClientAuth.REQUIRE;
+                settings.ssl.keyCertChainFile = PEM_SERVER_CRT;
+                settings.ssl.keyFile = PEM_SERVER_KEY;
+                settings.ssl.keyPassword = KEY_PASS;
+                // Trust the client
+                settings.ssl.trustCertChainFile = PEM_CLIENT_CRT;
+                break;
+            // Trust the client
+            case "shouldEnableSslAndClientCertificateAuthAndFailWithoutTrustedClientCertWithLegacyPem":
+                settings.ssl = new Settings.SslSettings();
+                settings.ssl.enabled = true;
+                settings.ssl.needClientAuth = ClientAuth.REQUIRE;
+                settings.ssl.keyCertChainFile = PEM_SERVER_CRT;
+                settings.ssl.keyFile = PEM_SERVER_KEY;
+                settings.ssl.keyPassword = KEY_PASS;
+                // Trust ONLY the server cert
+                settings.ssl.trustCertChainFile = PEM_SERVER_CRT;
+                break;
+            case "shouldEnableSslAndClientCertificateAuthWithPkcs12":
+                settings.ssl = new Settings.SslSettings();
+                settings.ssl.enabled = true;
+                settings.ssl.needClientAuth = ClientAuth.REQUIRE;
+                settings.ssl.keyStore = P12_SERVER_KEY;
+                settings.ssl.keyStorePassword = KEY_PASS;
+                settings.ssl.keyStoreType = KEYSTORE_TYPE_PKCS12;
+                settings.ssl.trustStore = P12_SERVER_TRUST;
+                settings.ssl.trustStorePassword = KEY_PASS;
+                break;
+            case "shouldEnableSslAndClientCertificateAuth":
+            case "shouldEnableSslAndClientCertificateAuthAndFailWithoutCert":
+                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 = JKS_SERVER_TRUST;
+                settings.ssl.trustStorePassword = KEY_PASS;
+                break;
+            case "shouldEnableSslAndClientCertificateAuthAndFailWithoutTrustedClientCert":
+                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;
+                break;
+            case "shouldEnableSslAndFailIfProtocolsDontMatch":
+                settings.ssl = new Settings.SslSettings();
+                settings.ssl.enabled = true;
+                settings.ssl.keyStore = JKS_SERVER_KEY;
+                settings.ssl.keyStorePassword = KEY_PASS;
+                settings.ssl.keyStoreType = KEYSTORE_TYPE_JKS;
+                settings.ssl.sslEnabledProtocols = Collections.singletonList("TLSv1.1");
+                break;
+            case "shouldEnableSslAndFailIfCiphersDontMatch":
+                settings.ssl = new Settings.SslSettings();
+                settings.ssl.enabled = true;
+                settings.ssl.keyStore = JKS_SERVER_KEY;
+                settings.ssl.keyStorePassword = KEY_PASS;
+                settings.ssl.keyStoreType = KEYSTORE_TYPE_JKS;
+                settings.ssl.sslCipherSuites = Collections.singletonList("TLS_DHE_RSA_WITH_AES_128_CBC_SHA");
+                break;
+        }
+
+        return settings;
+    }
+
+    private static SslContext createServerSslContext() {
+        final SslProvider provider = SslProvider.JDK;
+
+        try {
+            // this is not good for production - just testing
+            final SelfSignedCertificate ssc = new SelfSignedCertificate();
+            return SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()).sslProvider(provider).build();
+        } catch (Exception ce) {
+            throw new RuntimeException("Couldn't setup self-signed certificate for test");
+        }
+    }
+
+
+    @Test
+    public void shouldEnableSsl() {
+        final Cluster cluster = TestClientFactory.build().enableSsl(true).keyStore(JKS_SERVER_KEY).keyStorePassword(KEY_PASS).sslSkipCertValidation(true).create();
+        final Client client = cluster.connect();
+
+        try {
+            // this should return "nothing" - there should be no exception
+            assertEquals("test", client.submit("'test'").one().getString());
+        } finally {
+            cluster.close();
+        }
+    }
+
+    @Test
+    public void shouldEnableSslWithSslContextProgrammaticallySpecified() throws Exception {
+        // just for testing - this is not good for production use
+        final SslContextBuilder builder = SslContextBuilder.forClient();
+        builder.trustManager(InsecureTrustManagerFactory.INSTANCE);
+        builder.sslProvider(SslProvider.JDK);
+
+        final Cluster cluster = TestClientFactory.build().enableSsl(true).sslContext(builder.build()).create();
+        final Client client = cluster.connect();
+
+        try {
+            // this should return "nothing" - there should be no exception
+            assertEquals("test", client.submit("'test'").one().getString());
+        } finally {
+            cluster.close();
+        }
+    }
+
+    @Test
+    public void shouldEnableSslButFailIfClientConnectsWithoutIt() {
+        final Cluster cluster = TestClientFactory.build().enableSsl(false).create();
+        final Client client = cluster.connect();
+
+        try {
+            client.submit("'test'").one();
+            fail("Should throw exception because ssl is enabled on the server but not on client");
+        } catch(Exception x) {
+            final Throwable root = ExceptionUtils.getRootCause(x);
+            assertThat(root, instanceOf(TimeoutException.class));
+        } finally {
+            cluster.close();
+        }
+    }
+
+    @Test
+    public void shouldEnableSslAndClientCertificateAuthWithLegacyPem() {
+        final Cluster cluster = TestClientFactory.build().enableSsl(true)
+                .keyCertChainFile(PEM_CLIENT_CRT).keyFile(PEM_CLIENT_KEY)
+                .keyPassword(KEY_PASS).trustCertificateChainFile(PEM_SERVER_CRT).create();
+        final Client client = cluster.connect();
+
+        try {
+            assertEquals("test", client.submit("'test'").one().getString());
+        } finally {
+            cluster.close();
+        }
+    }
+
+    @Test
+    public void shouldEnableSslAndClientCertificateAuthAndFailWithoutCertWithLegacyPem() {
+        final Cluster cluster = TestClientFactory.build().enableSsl(true).keyStore(JKS_SERVER_KEY).keyStorePassword(KEY_PASS).sslSkipCertValidation(true).create();
+        final Client client = cluster.connect();
+
+        try {
+            client.submit("'test'").one();
+            fail("Should throw exception because ssl client auth is enabled on the server but client does not have a cert");
+        } catch(Exception x) {
+            final Throwable root = ExceptionUtils.getRootCause(x);
+            assertThat(root, instanceOf(TimeoutException.class));
+        } finally {
+            cluster.close();
+        }
+    }
+
+    @Test
+    public void shouldEnableSslAndClientCertificateAuthAndFailWithoutTrustedClientCertWithLegacyPem() {
+        final Cluster cluster = TestClientFactory.build().enableSsl(true)
+                .keyCertChainFile(PEM_CLIENT_CRT).keyFile(PEM_CLIENT_KEY)
+                .keyPassword(KEY_PASS).trustCertificateChainFile(PEM_SERVER_CRT).create();
+        final Client client = cluster.connect();
+
+        try {
+            client.submit("'test'").one();
+            fail("Should throw exception because ssl client auth is enabled on the server but does not trust client's cert");
+        } catch(Exception x) {
+            final Throwable root = ExceptionUtils.getRootCause(x);
+            assertThat(root, instanceOf(TimeoutException.class));
+        } finally {
+            cluster.close();
+        }
+    }
+
+    @Test
+    public void shouldEnableSslAndClientCertificateAuthWithPkcs12() {
+        final Cluster cluster = TestClientFactory.build().enableSsl(true).keyStore(P12_CLIENT_KEY).keyStorePassword(KEY_PASS)
+                .keyStoreType(KEYSTORE_TYPE_PKCS12).trustStore(P12_CLIENT_TRUST).trustStorePassword(KEY_PASS).create();
+        final Client client = cluster.connect();
+
+        try {
+            assertEquals("test", client.submit("'test'").one().getString());
+        } finally {
+            cluster.close();
+        }
+    }
+
+    @Test
+    public void shouldEnableSslAndClientCertificateAuth() {
+        final Cluster cluster = TestClientFactory.build().enableSsl(true).keyStore(JKS_CLIENT_KEY).keyStorePassword(KEY_PASS)
+                .keyStoreType(KEYSTORE_TYPE_JKS).trustStore(JKS_CLIENT_TRUST).trustStorePassword(KEY_PASS).create();
+        final Client client = cluster.connect();
+
+        try {
+            assertEquals("test", client.submit("'test'").one().getString());
+        } finally {
+            cluster.close();
+        }
+    }
+
+    @Test
+    public void shouldEnableSslAndClientCertificateAuthAndFailWithoutCert() {
+        final Cluster cluster = TestClientFactory.build().enableSsl(true).keyStore(JKS_SERVER_KEY).keyStorePassword(KEY_PASS)
+                .keyStoreType(KEYSTORE_TYPE_JKS).sslSkipCertValidation(true).create();
+        final Client client = cluster.connect();
+
+        try {
+            client.submit("'test'").one();
+            fail("Should throw exception because ssl client auth is enabled on the server but client does not have a cert");
+        } catch (Exception x) {
+            final Throwable root = ExceptionUtils.getRootCause(x);
+            assertThat(root, instanceOf(TimeoutException.class));
+        } finally {
+            cluster.close();
+        }
+    }
+
+    @Test
+    public void shouldEnableSslAndClientCertificateAuthAndFailWithoutTrustedClientCert() {
+        final Cluster cluster = TestClientFactory.build().enableSsl(true).keyStore(JKS_CLIENT_KEY).keyStorePassword(KEY_PASS)
+                .keyStoreType(KEYSTORE_TYPE_JKS).trustStore(JKS_CLIENT_TRUST).trustStorePassword(KEY_PASS).create();
+        final Client client = cluster.connect();
+
+        try {
+            client.submit("'test'").one();
+            fail("Should throw exception because ssl client auth is enabled on the server but does not trust client's cert");
+        } catch (Exception x) {
+            final Throwable root = ExceptionUtils.getRootCause(x);
+            assertThat(root, instanceOf(TimeoutException.class));
+        } finally {
+            cluster.close();
+        }
+    }
+
+    @Test
+    public void shouldEnableSslAndFailIfProtocolsDontMatch() {
+        final Cluster cluster = TestClientFactory.build().enableSsl(true).keyStore(JKS_SERVER_KEY).keyStorePassword(KEY_PASS)
+                .sslSkipCertValidation(true).sslEnabledProtocols(Arrays.asList("TLSv1.2")).create();
+        final Client client = cluster.connect();
+
+        try {
+            client.submit("'test'").one();
+            fail("Should throw exception because ssl client requires TLSv1.2 whereas server supports only TLSv1.1");
+        } catch (Exception x) {
+            final Throwable root = ExceptionUtils.getRootCause(x);
+            assertThat(root, instanceOf(TimeoutException.class));
+        } finally {
+            cluster.close();
+        }
+    }
+
+    @Test
+    public void shouldEnableSslAndFailIfCiphersDontMatch() {
+        final Cluster cluster = TestClientFactory.build().enableSsl(true).keyStore(JKS_SERVER_KEY).keyStorePassword(KEY_PASS)
+                .sslSkipCertValidation(true).sslCipherSuites(Arrays.asList("SSL_RSA_WITH_RC4_128_SHA")).create();
+        final Client client = cluster.connect();
+
+        try {
+            client.submit("'test'").one();
+            fail("Should throw exception because ssl client requires TLSv1.2 whereas server supports only TLSv1.1");
+        } catch (Exception x) {
+            final Throwable root = ExceptionUtils.getRootCause(x);
+            assertThat(root, instanceOf(TimeoutException.class));
+        } finally {
+            cluster.close();
+        }
+    }
+}


[tinkerpop] 01/04: A body of commits to debug/fix a failing travis test

Posted by sp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit dde3cbfc8e07dab279f689e951ea4c7cdea051ee
Author: stephen <sp...@gmail.com>
AuthorDate: Mon Nov 11 08:23:31 2019 -0500

    A body of commits to debug/fix a failing travis test
    
    Prevent a null pointer when session kill futuer is not present CTR
    
    Cleanup travis logs a bit by increasing compilation time.
    
    Noticed the logs were filled with WARN messages about init scripts taking longer than the default time of 5 seconds to compile. Must just be slower on Travis as we don't see this elsewhere.
    
    Make the first request in a synchronous fashion
    
    test if waiting helps close connections
    
    try-catch-finally to better handle Cluster.close() in tests
    
    Remove sleep() from test to see if that makes a difference
    
    Increase time willing to wait for a connection
---
 .../gremlin-server-integration-secure.yaml         |  1 +
 .../gremlin-server/gremlin-server-integration.yaml |  1 +
 .../gremlin/server/op/session/Session.java         |  8 +++-
 .../server/op/session/SessionOpProcessor.java      |  1 -
 .../server/GremlinServerSessionIntegrateTest.java  | 50 ++++++++++++++--------
 .../gremlin/server/gremlin-server-integration.yaml |  1 +
 6 files changed, 41 insertions(+), 21 deletions(-)

diff --git a/docker/gremlin-server/gremlin-server-integration-secure.yaml b/docker/gremlin-server/gremlin-server-integration-secure.yaml
index 2274852..c489e07 100644
--- a/docker/gremlin-server/gremlin-server-integration-secure.yaml
+++ b/docker/gremlin-server/gremlin-server-integration-secure.yaml
@@ -29,6 +29,7 @@ scriptEngines: {
   gremlin-groovy: {
     plugins: { org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
                org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
+               org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyCompilerGremlinPlugin: {expectedCompilationTime: 30000},
                org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
                org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/generate-all.groovy]}}},
   gremlin-jython: {},
diff --git a/docker/gremlin-server/gremlin-server-integration.yaml b/docker/gremlin-server/gremlin-server-integration.yaml
index 4ccaf32..7c5445a 100644
--- a/docker/gremlin-server/gremlin-server-integration.yaml
+++ b/docker/gremlin-server/gremlin-server-integration.yaml
@@ -29,6 +29,7 @@ scriptEngines: {
   gremlin-groovy: {
     plugins: { org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
                org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
+               org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyCompilerGremlinPlugin: {expectedCompilationTime: 30000},
                org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
                org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/generate-all.groovy]}}},
   gremlin-jython: {},
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/Session.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/Session.java
index f41a0fb..7191d04 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/Session.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/Session.java
@@ -34,6 +34,7 @@ import javax.script.Bindings;
 import javax.script.SimpleBindings;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Optional;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -155,7 +156,12 @@ public class Session {
      * session kill will mean.
      */
     public void manualKill(final boolean force) {
-        kill.get().cancel(true);
+        // seems there is a situation where kill can get nulled. seems to only happen in travis as a result of test
+        // runs and i'm guessing it has something to do with a combination of shutdown and session close though i'm
+        // not sure why. perhaps this "fix" just masks up a deeper problem but as i reason on it now, it seems mostly
+        // bound to shutdown situations which basically means the forced end of the session anyway, so perhaps the
+        // root cause isn't something that needs immediate chasing (at least until it can be shown otherwise anyway)
+        Optional.ofNullable(kill.get()).ifPresent(f -> f.cancel(true));
         kill(force);
     }
 
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/SessionOpProcessor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/SessionOpProcessor.java
index ff66e0b..22d30eb 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/SessionOpProcessor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/session/SessionOpProcessor.java
@@ -124,7 +124,6 @@ public class SessionOpProcessor extends AbstractEvalOpProcessor {
     /**
      * Session based requests accept a "close" operator in addition to "eval". A close will trigger the session to be
      * killed and any uncommitted transaction to be rolled-back.
-     * @return
      */
     @Override
     public Optional<ThrowingConsumer<Context>> selectOther(final RequestMessage requestMessage) throws OpProcessorException {
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
index 07944e8..889228c 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
@@ -327,32 +327,44 @@ public class GremlinServerSessionIntegrateTest  extends AbstractGremlinServerInt
 
     @Test
     public void shouldEnsureSessionBindingsAreThreadSafe() throws Exception {
-        final Cluster cluster = TestClientFactory.build().minInProcessPerConnection(16).maxInProcessPerConnection(64).create();
+        final Cluster cluster = TestClientFactory.build().maxWaitForConnection(90000).
+                minInProcessPerConnection(16).maxInProcessPerConnection(64).create();
         final Client client = cluster.connect(name.getMethodName());
 
-        client.submitAsync("a=100;b=1000;c=10000;null");
-        final int requests = 10000;
-        final List<CompletableFuture<ResultSet>> futures = new ArrayList<>(requests);
-        IntStream.range(0, requests).forEach(i -> {
-            try {
-                futures.add(client.submitAsync("a+b+c"));
-            } catch (Exception ex) {
-                throw new RuntimeException(ex);
+        try {
+            client.submit("a=100;b=1000;c=10000;null").all().get();
+            final int requests = 10000;
+            final List<CompletableFuture<ResultSet>> futures = new ArrayList<>(requests);
+            IntStream.range(0, requests).forEach(i -> {
+                try {
+                    futures.add(client.submitAsync("a+b+c"));
+                } catch (Exception ex) {
+                    throw new RuntimeException(ex);
+                }
+            });
+
+            System.out.println("shouldEnsureSessionBindingsAreThreadSafe: sent 10000");
+            assertEquals(requests, futures.size());
+
+            System.out.println("shouldEnsureSessionBindingsAreThreadSafe: asserting 10000");
+            int counter = 0;
+            for (CompletableFuture<ResultSet> f : futures) {
+                final Result r = f.get().all().get(30000, TimeUnit.MILLISECONDS).get(0);
+                assertEquals(11100, r.getInt());
+                counter++;
             }
-        });
 
-        assertEquals(requests, futures.size());
+            assertEquals(requests, counter);
+            System.out.println("shouldEnsureSessionBindingsAreThreadSafe: asserted 10000");
 
-        int counter = 0;
-        for(CompletableFuture<ResultSet> f : futures) {
-            final Result r = f.get().all().get(30000, TimeUnit.MILLISECONDS).get(0);
-            assertEquals(11100, r.getInt());
-            counter++;
+        } catch (Exception ex) {
+            fail(ex.getMessage());
+        } finally {
+            System.out.println("shouldEnsureSessionBindingsAreThreadSafe: calling cluster.close");
+            cluster.close();
+            System.out.println("shouldEnsureSessionBindingsAreThreadSafe: called cluster.close");
         }
 
-        assertEquals(requests, counter);
-
-        cluster.close();
     }
 
     @Test
diff --git a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
index adf05cd..601e404 100644
--- a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
+++ b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml
@@ -42,6 +42,7 @@ scriptEngines: {
   gremlin-groovy: {
     plugins: { org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
                org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
+               org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyCompilerGremlinPlugin: {expectedCompilationTime: 30000},
                org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
                org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/generate-all.groovy]}}}}
 serializers:


[tinkerpop] 02/04: Increase default max wait time for a connection with java driver

Posted by sp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0da1cfac6322c6919eea4274177de3df63e244d4
Author: stephen <sp...@gmail.com>
AuthorDate: Wed Nov 13 19:07:44 2019 -0500

    Increase default max wait time for a connection with java driver
    
    Cleaned up some dead log messages from debugging
---
 .travis.yml                                        |  4 +++-
 .../tinkerpop/gremlin/driver/Connection.java       |  2 +-
 .../gremlin/server/auth/Krb5Authenticator.java     |  2 +-
 .../gremlin/server/GremlinServerIntegrateTest.java | 22 +++++++++++++++-------
 .../server/GremlinServerSessionIntegrateTest.java  |  6 ------
 5 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index c9bc45e..e5f8621 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -39,7 +39,9 @@ jobs:
       name: "python"
     - script: "mvn clean install -q -DskipTests && mvn verify -pl :gremlin-javascript"
       name: "javascript"
-    - script: "mvn clean install -q -DskipTests && mvn verify -pl :gremlin-server,:gremlin-console -DskipIntegrationTests=false"
+    - script:
+      - "mvn clean install -q -DskipTests"
+      - "travis_wait 60 mvn verify -pl :gremlin-server,:gremlin-console -DskipIntegrationTests=false"
       name: "gremlin server/console"
     - script:
       - "mvn clean install -q -DskipTests"
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java
index e700d49..aa0868f 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java
@@ -61,7 +61,7 @@ final class Connection {
 
     public static final int MAX_IN_PROCESS = 4;
     public static final int MIN_IN_PROCESS = 1;
-    public static final int MAX_WAIT_FOR_CONNECTION = 3000;
+    public static final int MAX_WAIT_FOR_CONNECTION = 16000;
     public static final int MAX_WAIT_FOR_SESSION_CLOSE = 3000;
     public static final int MAX_CONTENT_LENGTH = 65536;
 
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/auth/Krb5Authenticator.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/auth/Krb5Authenticator.java
index 0cadc99..cd5cf65 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/auth/Krb5Authenticator.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/auth/Krb5Authenticator.java
@@ -114,7 +114,7 @@ public class Krb5Authenticator implements Authenticator {
                 // GSSAPI is the only available mechanism for this authenticator
                 final Map props = new HashMap<String, Object>();
                 final String[] principalParts = principalName.split("/|@");
-                if (principalParts.length < 3) throw new IllegalArgumentException("Use principal name of format 'service/fqdn@kdcrealm'");
+                if (principalParts.length < 3) throw new IllegalArgumentException("Use principal name of format 'service/fqdn@kdcrealm' - not this nonsense" + principalName);
                 saslServer = Sasl.createSaslServer(mechanism, principalParts[0], principalParts[1], props, Krb5SaslAuthenticator.this);
             } catch(Exception e) {
                 logger.error("Creating sasl server failed: ", e);
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 20980d2..0510328 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
@@ -1196,7 +1196,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
 
     @Test
     public void shouldFailOnDeadHost() throws Exception {
-        final Cluster cluster = TestClientFactory.build().create();
+        final Cluster cluster = TestClientFactory.build().maxWaitForConnection(90000).create();
         final Client client = cluster.connect();
 
         // ensure that connection to server is good
@@ -1220,13 +1220,21 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
 
             // restart server
             this.startServer();
-            // the retry interval is 1 second, wait a bit longer
-            TimeUnit.SECONDS.sleep(5);
-
-            List<Result> results = client.submit("1+1").all().join();
-            assertEquals(1, results.size());
-            assertEquals(2, results.get(0).getInt());
 
+            // try a bunch of times to reconnect. on slower systems this may simply take longer...looking at you travis
+            for (int ix = 1; ix < 11; ix++) {
+                // the retry interval is 1 second, wait a bit longer
+                TimeUnit.SECONDS.sleep(5);
+
+                try {
+                    final List<Result> results = client.submit("1+1").all().join();
+                    assertEquals(1, results.size());
+                    assertEquals(2, results.get(0).getInt());
+                } catch (Exception ex) {
+                    if (ix == 10)
+                        fail("Should have eventually succeeded");
+                }
+            }
         } finally {
             cluster.close();
         }
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
index 889228c..9a3e4ff 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateTest.java
@@ -343,10 +343,8 @@ public class GremlinServerSessionIntegrateTest  extends AbstractGremlinServerInt
                 }
             });
 
-            System.out.println("shouldEnsureSessionBindingsAreThreadSafe: sent 10000");
             assertEquals(requests, futures.size());
 
-            System.out.println("shouldEnsureSessionBindingsAreThreadSafe: asserting 10000");
             int counter = 0;
             for (CompletableFuture<ResultSet> f : futures) {
                 final Result r = f.get().all().get(30000, TimeUnit.MILLISECONDS).get(0);
@@ -355,14 +353,10 @@ public class GremlinServerSessionIntegrateTest  extends AbstractGremlinServerInt
             }
 
             assertEquals(requests, counter);
-            System.out.println("shouldEnsureSessionBindingsAreThreadSafe: asserted 10000");
-
         } catch (Exception ex) {
             fail(ex.getMessage());
         } finally {
-            System.out.println("shouldEnsureSessionBindingsAreThreadSafe: calling cluster.close");
             cluster.close();
-            System.out.println("shouldEnsureSessionBindingsAreThreadSafe: called cluster.close");
         }
 
     }