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

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


The following commit(s) were added to refs/heads/master-http by this push:
     new 89d24e6128 fix some tests (#2574)
89d24e6128 is described below

commit 89d24e6128c5503ea3f7dae291f8b650754d9c76
Author: Valentyn Kahamlyk <vkagam...@users.noreply.github.com>
AuthorDate: Tue Apr 23 12:46:45 2024 -0700

    fix some tests (#2574)
---
 .../apache/tinkerpop/gremlin/driver/Client.java    |  2 +-
 .../gremlin/driver/RequestMessageTest.java         | 13 -------
 .../server/GremlinResultSetIntegrateTest.java      | 20 ++--------
 .../server/GremlinServerHttpIntegrateTest.java     |  6 +--
 .../gremlin/server/GremlinServerIntegrateTest.java | 44 +++++++++++-----------
 .../org/apache/tinkerpop/gremlin/util/Tokens.java  |  9 -----
 .../gremlin/util/message/RequestMessageV4.java     |  9 ++++-
 7 files changed, 37 insertions(+), 66 deletions(-)

diff --git 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java
index 1bf3c1dbb8..8051a9ccb9 100644
--- 
a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java
+++ 
b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java
@@ -783,7 +783,7 @@ public abstract class Client {
         }
 
         /**
-         * Adds the {@link Tokens#ARGS_SESSION} value to every {@link 
RequestMessageV4}.
+         * todo.
          */
         @Override
         public RequestMessageV4.Builder buildMessage(final 
RequestMessageV4.Builder builder) {
diff --git 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/RequestMessageTest.java
 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/RequestMessageTest.java
index a6ccb585da..a8778af020 100644
--- 
a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/RequestMessageTest.java
+++ 
b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/RequestMessageTest.java
@@ -33,19 +33,6 @@ import static org.junit.Assert.assertNotNull;
  */
 public class RequestMessageTest {
 
-    @Test
-    public void shouldOverrideRequest() {
-        final UUID request = UUID.randomUUID();
-        final RequestMessage msg = 
RequestMessage.build("op").overrideRequestId(request).create();
-        assertEquals(request, msg.getRequestId());
-    }
-
-    @Test
-    public void shouldSetProcessor() {
-        final RequestMessage msg = 
RequestMessage.build("op").processor("ppp").create();
-        assertEquals("ppp", msg.getProcessor());
-    }
-
     @Test
     public void shouldSetOpWithDefaults() {
         final RequestMessage msg = RequestMessage.build("op").create();
diff --git 
a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java
 
b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java
index 8e02c8b8de..ea34978f45 100644
--- 
a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java
+++ 
b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinResultSetIntegrateTest.java
@@ -40,7 +40,7 @@ import 
org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceProperty;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
 import org.apache.tinkerpop.gremlin.util.MessageSerializer;
 import org.apache.tinkerpop.gremlin.util.Tokens;
-import org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1;
+import org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV4;
 import org.apache.tinkerpop.gremlin.util.ser.Serializers;
 import org.hamcrest.CoreMatchers;
 import org.junit.After;
@@ -72,10 +72,10 @@ public class GremlinResultSetIntegrateTest extends 
AbstractGremlinServerIntegrat
 
     @Parameterized.Parameters(name = "{0}")
     public static Iterable<Object[]> data() {
-        final MessageSerializer<GraphBinaryMapper> 
graphBinaryMessageSerializerV1 = new GraphBinaryMessageSerializerV1();
+        final MessageSerializer<GraphBinaryMapper> 
graphBinaryMessageSerializerV4 = new GraphBinaryMessageSerializerV4();
 
         return Arrays.asList(new Object[][]{
-                {Serializers.GRAPHBINARY_V1, graphBinaryMessageSerializerV1}
+                {Serializers.GRAPHBINARY_V1, graphBinaryMessageSerializerV4}
         });
     }
 
@@ -96,20 +96,6 @@ public class GremlinResultSetIntegrateTest extends 
AbstractGremlinServerIntegrat
         cluster.close();
     }
 
-    @Test
-    public void shouldReturnResponseAttributesViaNoContent() throws Exception {
-        final ResultSet results = client.submit("[]");
-        final Map<String,Object> attr = results.statusAttributes().get(20000, 
TimeUnit.MILLISECONDS);
-        assertThat(attr.containsKey(Tokens.ARGS_HOST), is(true));
-    }
-
-    @Test
-    public void shouldReturnResponseAttributesViaSuccess() throws Exception {
-        final ResultSet results = client.submit("gmodern.V()");
-        final Map<String,Object> attr = results.statusAttributes().get(20000, 
TimeUnit.MILLISECONDS);
-        assertThat(attr.containsKey(Tokens.ARGS_HOST), is(true));
-    }
-
     @Test
     public void shouldHandleVertexResultFromTraversalBulked() throws Exception 
{
         final Graph graph = TinkerGraph.open();
diff --git 
a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java
 
b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java
index be52d154fd..152806ca81 100644
--- 
a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java
+++ 
b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java
@@ -1203,15 +1203,15 @@ public class GremlinServerHttpIntegrateTest extends 
AbstractGremlinServerIntegra
 
             final String json = EntityUtils.toString(response.getEntity());
             final JsonNode node = mapper.readTree(json);
-            assertEquals("some error", 
node.get("status").get("message").textValue());
-            assertEquals(595, node.get("status").get("code").intValue());
+            assertThat(node.get("status").get("message").textValue(), 
startsWith("some error"));
+            assertEquals(500, node.get("status").get("code").intValue());
 
             final Header[] footers = getTrailingHeaders(response);
             assertEquals(2, footers.length);
             assertEquals("code", footers[0].getName());
             assertEquals("500", footers[0].getValue());
             assertEquals("message", footers[1].getName());
-            assertEquals("some error", footers[1].getValue());
+            assertThat(footers[1].getValue(), startsWith("some+error"));
         }
     }
 
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 3d4b35ef7a..d495ba0397 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
@@ -303,7 +303,7 @@ public class GremlinServerIntegrateTest extends 
AbstractGremlinServerIntegration
 
     @Test
     public void shouldScriptEvaluationErrorForRemoteTraversal() throws 
Exception {
-        final GraphTraversalSource g = traversal().withRemote(conf);
+        final GraphTraversalSource g = traversal().with(conf);
 
         try {
             // tests bad lambda
@@ -333,7 +333,7 @@ public class GremlinServerIntegrateTest extends 
AbstractGremlinServerIntegration
 
     @Test
     public void shouldTimeOutRemoteTraversal() throws Exception {
-        final GraphTraversalSource g = traversal().withRemote(conf);
+        final GraphTraversalSource g = traversal().with(conf);
 
         try {
             // tests sleeping thread
@@ -363,7 +363,7 @@ public class GremlinServerIntegrateTest extends 
AbstractGremlinServerIntegration
 
     @Test
     public void shouldTimeOutRemoteTraversalWithPerRequestOption() throws 
Exception {
-        final GraphTraversalSource g = traversal().withRemote(conf);
+        final GraphTraversalSource g = traversal().with(conf);
 
         try {
             // tests sleeping thread
@@ -500,7 +500,7 @@ public class GremlinServerIntegrateTest extends 
AbstractGremlinServerIntegration
     }
 
     @Test
-    public void shouldRespectHighWaterMarkSettingAndSucceed() throws Exception 
{
+    public void shouldRespectHighWaterMarkSettingAndSucceed() {
         // 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
         // test for most cases
@@ -772,24 +772,26 @@ public class GremlinServerIntegrateTest extends 
AbstractGremlinServerIntegration
         }
     }
 
-    @Test
-    public void shouldReceiveFailureOnBadGraphSONSerialization() throws 
Exception {
-        final Cluster cluster = 
TestClientFactory.build().serializer(Serializers.GRAPHSON_V4).create();
-        final Client client = cluster.connect();
-
-        try {
-            client.submit("class C { def C getC(){return this}}; new 
C()").all().join();
-            fail("Should throw an exception.");
-        } catch (RuntimeException re) {
-            final Throwable root = ExceptionHelper.getRootCause(re);
-            assertThat(root.getMessage(), CoreMatchers.startsWith("Error 
during serialization: Direct self-reference leading to cycle (through reference 
chain:"));
+    // GraphSON does not support deserialization of streaming data
 
-            // validate that we can still send messages to the server
-            assertEquals(2, client.submit("1+1").all().join().get(0).getInt());
-        } finally {
-            cluster.close();
-        }
-    }
+//    @Test
+//    public void shouldReceiveFailureOnBadGraphSONSerialization() throws 
Exception {
+//        final Cluster cluster = 
TestClientFactory.build().serializer(Serializers.GRAPHSON_V4).create();
+//        final Client client = cluster.connect();
+//
+//        try {
+//            client.submit("class C { def C getC(){return this}}; new 
C()").all().join();
+//            fail("Should throw an exception.");
+//        } catch (RuntimeException re) {
+//            final Throwable root = ExceptionHelper.getRootCause(re);
+//            assertThat(root.getMessage(), CoreMatchers.startsWith("Error 
during serialization: Direct self-reference leading to cycle (through reference 
chain:"));
+//
+//            // validate that we can still send messages to the server
+//            assertEquals(2, 
client.submit("1+1").all().join().get(0).getInt());
+//        } finally {
+//            cluster.close();
+//        }
+//    }
 
 //    TODO: this test isn't valid right now since this error is thrown by 
netty so doesn't map properly to RequestId
 //          sent by the driver. Re-enable once this changes.
diff --git 
a/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/Tokens.java 
b/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/Tokens.java
index 848a946b9d..1fd45981eb 100644
--- a/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/Tokens.java
+++ b/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/Tokens.java
@@ -87,9 +87,6 @@ public final class Tokens {
      * request to execute on the server.
      */
     public static final String ARGS_EVAL_TIMEOUT = "evaluationTimeout";
-    public static final String ARGS_HOST = "host";
-    public static final String ARGS_SESSION = "session";
-    public static final String ARGS_MANAGE_TRANSACTION = "manageTransaction";
     /**
      * The name of the argument that allows to control the serialization of 
properties on the server.
      */
@@ -117,12 +114,6 @@ public final class Tokens {
 
     public static final String VAL_TRAVERSAL_SOURCE_ALIAS = "g";
 
-    /**
-     * The value of this key holds a string representation of the data held by 
a {@link Failure} as produced by
-     * {@link Failure#format()}.
-     */
-    public static final String STATUS_ATTRIBUTE_FAIL_STEP_MESSAGE = 
"failStepMessage";
-
     /**
      * Refers to the hierarchy of exception names for a particular exception 
thrown on the server.
      */
diff --git 
a/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/RequestMessageV4.java
 
b/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/RequestMessageV4.java
index c5b255ce0a..7e456d9ad2 100644
--- 
a/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/RequestMessageV4.java
+++ 
b/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/RequestMessageV4.java
@@ -70,10 +70,15 @@ public final class RequestMessageV4 {
     private RequestMessageV4() { }
 
     /**
-     * The id of the current request and is used to track the message within 
Gremlin Server and in its response.  This
-     * value should be unique per request made.
+     * The id of the current request.
+     * used only in GLV, not transmitted to the server.
      */
     public UUID getRequestId() {
+        if (!fields.containsKey(Tokens.REQUEST_ID)) {
+            // just assign random DI for now. It will not be send to server.
+            fields.put(Tokens.REQUEST_ID, UUID.randomUUID());
+        }
+
         return getField(Tokens.REQUEST_ID);
     }
 

Reply via email to