Github user spmallette commented on a diff in the pull request:

    https://github.com/apache/tinkerpop/pull/451#discussion_r82212090
  
    --- Diff: 
gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
 ---
    @@ -814,18 +829,88 @@ public void 
shouldStillSupportDeprecatedRebindingsParameterOnServer() throws Exc
     
         @Test
         public void shouldSupportLambdasUsingWithRemote() throws Exception {
    -        final Supplier<Graph> graphGetter = () -> 
server.getServerGremlinExecutor().getGraphManager().getGraphs().get("graph");
    -        final Configuration conf = new BaseConfiguration() {{
    -            setProperty(Graph.GRAPH, RemoteGraph.class.getName());
    -            setProperty(GREMLIN_REMOTE_CONNECTION_CLASS, 
DriverRemoteConnection.class.getName());
    -            
setProperty(DriverRemoteConnection.GREMLIN_REMOTE_DRIVER_SOURCENAME, "g");
    -            setProperty("hidden.for.testing.only", graphGetter);
    -        }};
    -
             final Graph graph = EmptyGraph.instance();
             final GraphTraversalSource g = graph.traversal().withRemote(conf);
             g.addV("person").property("age", 20).iterate();
             g.addV("person").property("age", 10).iterate();
             assertEquals(50L, 
g.V().hasLabel("person").map(Lambda.function("it.get().value('age') + 
10")).sum().next());
         }
    +
    +    @Test
    +    public void shouldGetSideEffectKeysUsingWithRemote() throws Exception {
    +        final Graph graph = EmptyGraph.instance();
    +        final GraphTraversalSource g = graph.traversal().withRemote(conf);
    +        g.addV("person").property("age", 20).iterate();
    +        g.addV("person").property("age", 10).iterate();
    +        final GraphTraversal traversal = 
g.V().aggregate("a").aggregate("b");
    +        traversal.iterate();
    +        final DriverRemoteTraversalSideEffects se = 
(DriverRemoteTraversalSideEffects) traversal.asAdmin().getSideEffects();
    +
    +        // Get keys
    +        final Set<String> sideEffectKeys = se.keys();
    +        assertEquals(2, sideEffectKeys.size());
    +
    +        // Get side effects
    +        final BulkSet aSideEffects = se.get("a");
    +        assertThat(aSideEffects.isEmpty(), is(false));
    +        final BulkSet bSideEffects = se.get("b");
    +        assertThat(bSideEffects.isEmpty(), is(false));
    +
    +        // Should get local keys/side effects after close
    +        se.close();
    +
    +        final Set<String> localSideEffectKeys = se.keys();
    +        assertEquals(2, localSideEffectKeys.size());
    +
    +        final BulkSet localASideEffects = se.get("a");
    +        assertThat(localASideEffects.isEmpty(), is(false));
    +
    +        final BulkSet localBSideEffects = se.get("b");
    +        assertThat(localBSideEffects.isEmpty(), is(false));
    +    }
    +
    +    @Test
    +    public void shouldCloseSideEffectsUsingWithRemote() throws Exception {
    +        final Graph graph = EmptyGraph.instance();
    +        final GraphTraversalSource g = graph.traversal().withRemote(conf);
    +        g.addV("person").property("age", 20).iterate();
    +        g.addV("person").property("age", 10).iterate();
    +        final GraphTraversal traversal = 
g.V().aggregate("a").aggregate("b");
    +        traversal.iterate();
    +        final DriverRemoteTraversalSideEffects se = 
(DriverRemoteTraversalSideEffects) traversal.asAdmin().getSideEffects();
    +        final BulkSet sideEffects = se.get("a");
    +        assertThat(sideEffects.isEmpty(), is(false));
    +        se.close();
    +
    +        // Can't get new side effects after close
    +        assertNull(se.get("b"));
    +
    +        // Earlier keys should be cached locally
    +        final Set<String> localSideEffectKeys = se.keys();
    +        assertEquals(1, localSideEffectKeys.size());
    +        final BulkSet localSideEffects = se.get("a");
    +        assertThat(localSideEffects.isEmpty(), is(false));
    +
    +        // Try to get side effect from server
    +        final Cluster cluster = Cluster.build("localhost").create();
    +        final Client client = cluster.connect();
    +        Field field = 
DriverRemoteTraversalSideEffects.class.getDeclaredField("serverSideEffect");
    --- End diff --
    
    please `final` your `Field` and `UUID` variables. glad the reflection trick 
worked for this test.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to