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 2015/07/20 18:29:06 UTC
[16/26] incubator-tinkerpop git commit: Add some tests around SSL.
Add some tests around SSL.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/a2a2ff1a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/a2a2ff1a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/a2a2ff1a
Branch: refs/heads/tp30
Commit: a2a2ff1aeaea0ec9fe138bb7c2c903f32d692006
Parents: 6248cbf
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jul 17 15:40:52 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jul 17 15:40:52 2015 -0400
----------------------------------------------------------------------
.../server/GremlinServerAuthIntegrateTest.java | 16 ++++++++++++++++
.../server/GremlinServerIntegrateTest.java | 18 ++++++++++++++++++
2 files changed, 34 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/a2a2ff1a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuthIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuthIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuthIntegrateTest.java
index 58847b4..f9d845d 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuthIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuthIntegrateTest.java
@@ -95,6 +95,22 @@ public class GremlinServerAuthIntegrateTest extends AbstractGremlinServerIntegra
}
@Test
+ public void shouldFailAuthenticateWithPlainTextNoCredentials() throws Exception {
+ final Cluster cluster = Cluster.build().create();
+ final Client client = cluster.connect();
+
+ try {
+ client.submit("1+1").all();
+ } catch(Exception ex) {
+ final Throwable root = ExceptionUtils.getRootCause(ex);
+ assertEquals(ResponseException.class, root.getClass());
+ assertEquals("Username and/or password are incorrect", root.getMessage());
+ } finally {
+ cluster.close();
+ }
+ }
+
+ @Test
public void shouldFailAuthenticateWithPlainTextBadPassword() throws Exception {
final Cluster cluster = Cluster.build().credentials("stephen", "bad").create();
final Client client = cluster.connect();
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/a2a2ff1a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
----------------------------------------------------------------------
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 a24ff18..2e65a56 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
@@ -105,6 +105,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
settings.channelizer = NioChannelizer.class.getName();
break;
case "shouldEnableSsl":
+ case "shouldEnableSslButFailIfClientConnectsWithoutIt":
settings.ssl = new Settings.SslSettings();
settings.ssl.enabled = true;
break;
@@ -150,6 +151,23 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
}
}
+ @org.junit.Ignore("This test hangs - not sure why")
+ @Test
+ public void shouldEnableSslButFailIfClientConnectsWithoutIt() {
+ // todo: need to get this to pass somehow - should just error out.
+ final Cluster cluster = Cluster.build().enableSsl(false).create();
+ final Client client = cluster.connect();
+
+ try {
+ // this should return "nothing" - there should be no exception
+ assertEquals("test", client.submit("'test'").one().getString());
+ } catch(Exception x) {
+ x.printStackTrace();
+ } 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