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 1ce6fe764fdc7871de1842d6a97f48a156cfdabd Merge: a8751c3 ed72e81 Author: Stephen Mallette <sp...@genoprime.com> AuthorDate: Thu Sep 26 17:15:36 2019 -0400 Merge branch 'tp33' into tp34 .../apache/tinkerpop/gremlin/driver/Client.java | 5 +- .../tinkerpop/gremlin/driver/Connection.java | 23 ------- .../tinkerpop/gremlin/driver/ConnectionPool.java | 16 +++-- .../apache/tinkerpop/gremlin/driver/Handler.java | 45 ++----------- .../driver/exception/NoHostAvailableException.java | 31 --------- .../server/handler/SaslAuthenticationHandler.java | 15 ++--- .../gremlin/server/GremlinDriverIntegrateTest.java | 11 ++-- .../server/GremlinServerAuthIntegrateTest.java | 66 ++----------------- .../server/GremlinServerAuthKrb5IntegrateTest.java | 75 ++-------------------- .../gremlin/server/GremlinServerIntegrateTest.java | 15 ++--- 10 files changed, 46 insertions(+), 256 deletions(-) diff --cc gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java index 774adaf,7b12890..74cf761 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java @@@ -85,29 -82,15 +83,15 @@@ final class Handler @Override protected void channelRead0(final ChannelHandlerContext channelHandlerContext, final ResponseMessage response) throws Exception { - // We are only interested in AUTHENTICATE or UNAUTHORIZED responses here. Everything else can - // get passed down the pipeline. - if (response.getStatus().getCode() == ResponseStatusCode.UNAUTHORIZED) - channelHandlerContext.attr(saslClientKey).set(null); - + // We are only interested in AUTHENTICATE responses here. Everything else can + // get passed down the pipeline if (response.getStatus().getCode() == ResponseStatusCode.AUTHENTICATE) { - final Attribute<SaslClient> saslClient = channelHandlerContext.attr(saslClientKey); - final Attribute<Subject> subject = channelHandlerContext.attr(subjectKey); + final Attribute<SaslClient> saslClient = ((AttributeMap) channelHandlerContext).attr(saslClientKey); + final Attribute<Subject> subject = ((AttributeMap) channelHandlerContext).attr(subjectKey); final RequestMessage.Builder messageBuilder = RequestMessage.build(Tokens.OPS_AUTHENTICATION); - // First time through we don't have a sasl client if (saslClient.get() == null) { - try { - subject.set(login()); - } catch (LoginException le) { - // prevent the client side LoginException from bubbling up since Connection.validate() swallows - // the LoginException and doesn't give feedback to the user. - final ResponseMessage clientSideError = ResponseMessage.build(response.getRequestId()) - .code(ResponseStatusCode.FORBIDDEN).statusMessage(le.getMessage()).create(); - channelHandlerContext.fireChannelRead(clientSideError); - return; - } - + subject.set(login()); try { saslClient.set(saslClient(getHostName(channelHandlerContext))); } catch (SaslException saslException) { diff --cc gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java index d176685,817b8a6..0d1b1c8 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java +++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java @@@ -24,16 -24,11 +24,15 @@@ import org.apache.tinkerpop.gremlin.Tes import org.apache.tinkerpop.gremlin.driver.Channelizer; import org.apache.tinkerpop.gremlin.driver.Client; import org.apache.tinkerpop.gremlin.driver.Cluster; +import org.apache.tinkerpop.gremlin.driver.RequestOptions; import org.apache.tinkerpop.gremlin.driver.Result; import org.apache.tinkerpop.gremlin.driver.ResultSet; +import org.apache.tinkerpop.gremlin.driver.Tokens; - import org.apache.tinkerpop.gremlin.driver.exception.NoHostAvailableException; import org.apache.tinkerpop.gremlin.driver.exception.ResponseException; import org.apache.tinkerpop.gremlin.driver.handler.WebSocketClientHandler; +import org.apache.tinkerpop.gremlin.driver.message.RequestMessage; import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode; +import org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection; import org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0; import org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderGryoSerializer; import org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0; @@@ -968,24 -937,8 +968,23 @@@ public class GremlinDriverIntegrateTes } @Test + public void shouldWorkWithGraphBinaryV1Serialization() throws Exception { + final Cluster cluster = TestClientFactory.build().serializer(Serializers.GRAPHBINARY_V1D0).create(); + final Client client = cluster.connect(); + + final List<Result> r = client.submit("TinkerFactory.createModern().traversal().V(1)").all().join(); + assertEquals(1, r.size()); + + final Vertex v = r.get(0).get(ReferenceVertex.class); + assertEquals(1, v.id()); + assertEquals("person", v.label()); + + cluster.close(); + } + + @Test public void shouldFailClientSideWithTooLargeAResponse() { - final int maxContentLength = 128; - final Cluster cluster = TestClientFactory.build().maxContentLength(maxContentLength).create(); + final Cluster cluster = TestClientFactory.build().maxContentLength(1).create(); final Client client = cluster.connect(); try { diff --cc gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuthKrb5IntegrateTest.java index 0ca812d,29dab88..029a408 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuthKrb5IntegrateTest.java +++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerAuthKrb5IntegrateTest.java @@@ -23,34 -23,24 +23,24 @@@ import org.apache.tinkerpop.gremlin.dri import org.apache.tinkerpop.gremlin.driver.Cluster; import org.apache.tinkerpop.gremlin.driver.MessageSerializer; import org.apache.tinkerpop.gremlin.driver.exception.ResponseException; - import org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection; import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode; +import org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1; import org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0; import org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0; - import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.server.auth.Krb5Authenticator; + import org.ietf.jgss.GSSException; import org.junit.Before; import org.junit.Test; import org.slf4j.LoggerFactory; import java.io.File; - import java.util.Collections; import java.util.HashMap; - import java.util.List; import java.util.Map; - import java.util.concurrent.Callable; - import java.util.concurrent.ExecutorService; - import java.util.concurrent.Executors; - import java.util.concurrent.Future; - import java.util.concurrent.TimeUnit; import java.util.concurrent.ExecutionException; + import javax.security.auth.login.LoginException; -import java.util.concurrent.TimeoutException; - import static org.apache.tinkerpop.gremlin.process.traversal.AnonymousTraversalSource.traversal; - import static org.hamcrest.MatcherAssert.assertThat; - import static org.hamcrest.core.IsInstanceOf.instanceOf; - import static org.hamcrest.core.StringContains.containsString; import static org.junit.Assert.assertEquals; + import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; /**