[ https://issues.apache.org/jira/browse/TINKERPOP-2824?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17699075#comment-17699075 ]
ASF GitHub Bot commented on TINKERPOP-2824: ------------------------------------------- vkagamlyk commented on code in PR #1843: URL: https://github.com/apache/tinkerpop/pull/1843#discussion_r1132733325 ########## gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSerializationIntegrateTest.java: ########## @@ -0,0 +1,149 @@ +/* + * 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 org.apache.tinkerpop.gremlin.driver.Client; +import org.apache.tinkerpop.gremlin.driver.Cluster; +import org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection; +import org.apache.tinkerpop.gremlin.process.traversal.AnonymousTraversalSource; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Edge; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; +import org.apache.tinkerpop.gremlin.util.ser.AbstractMessageSerializer; +import org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1; +import org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV2d0; +import org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV3d0; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; + +import static org.junit.Assert.assertEquals; + +@RunWith(Parameterized.class) +public class GremlinServerSerializationIntegrateTest extends AbstractGremlinServerIntegrationTest { + + private AbstractMessageSerializer serializer; + private Cluster cluster = null; + private Client client = null; + private GraphTraversalSource g = null; + + public GremlinServerSerializationIntegrateTest(AbstractMessageSerializer serializer) { + this.serializer = serializer; + } + + @Parameterized.Parameters + public static Collection serializers() { + return Arrays.asList(new Object[][] { + { new GraphBinaryMessageSerializerV1() }, + { new GraphSONMessageSerializerV3d0() }, + { new GraphSONMessageSerializerV2d0() } + }); + } + + @Before + public void openConnection() { + cluster = TestClientFactory.build().serializer(serializer).create(); + client = cluster.connect(); + g = AnonymousTraversalSource.traversal().withRemote( + DriverRemoteConnection.using(cluster, "gmodern")); + } + + @After + public void closeConnection() { + if (cluster != null) cluster.close(); + } + + @Test + public void shouldDeserializeVertexPropertiesForGremlin() { + final Vertex vertex = client.submit("gmodern.V(1)").one().getVertex(); + + assertVertexWithProperties(vertex); + } + + @Test + public void shouldSkipVertexPropertiesForGremlin() { + final Vertex vertex = client.submit("gmodern.with('materializeProperties', 'tokens').V(1)").one().getVertex(); + + assertEquals(Collections.emptyIterator(), vertex.properties()); Review Comment: added in https://github.com/apache/tinkerpop/pull/1843/commits/6884272f19b8ed97a9de3f53033e651b3fa437bf > Properties on Elements > ---------------------- > > Key: TINKERPOP-2824 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2824 > Project: TinkerPop > Issue Type: Improvement > Components: dotnet, driver, go, javascript, process, python > Affects Versions: 3.5.4 > Reporter: Valentyn Kahamlyk > Assignee: Valentyn Kahamlyk > Priority: Major > Labels: breaking > > Problem: When a user writes `g.V()` they get back a Vertex object. The > problem is that depending on the execution context of the traversal, the > result could be quite different, with or without properties. > Solution: Implement new finalization strategy DetachStrategy(detachMode, > properties) where mode is one of ALL, NONE or CUSTOM. `properties` is list of > properties name, are taken into account only for CUSTOM mode. > Discussion thread in dev list: [Proposal to handle properties on response > Elements-Apache Mail > Archives|https://lists.apache.org/thread/l8rw7ydj7kym8vhtwk50nhbp45ng9986] > Stephen's thread in dev list: [The Issue of Detachment-Apache Mail > Archives|https://lists.apache.org/thread/xltcon4zxnwq4fyw2r2126syyrqm8spy] -- This message was sent by Atlassian Jira (v8.20.10#820010)