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 2016/03/12 01:53:58 UTC

[1/8] incubator-tinkerpop git commit: Renamed test so that it is actually an integration test.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-575 0a46b285c -> 6c438f43f


Renamed test so that it is actually an integration test.

Added generate-all.groovy for the RemoteServer integration testing.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/7e758275
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/7e758275
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/7e758275

Branch: refs/heads/TINKERPOP-575
Commit: 7e7582756325aeda86096a07aec4e6fb42532deb
Parents: 0a46b28
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Mar 11 18:10:27 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Mar 11 18:10:27 2016 -0500

----------------------------------------------------------------------
 gremlin-server/scripts/generate-all.groovy      | 32 +++++++++++++
 .../gremlin/server/WithServerIntegrateTest.java | 49 ++++++++++++++++++++
 .../server/WithServerIntegrationTest.java       | 49 --------------------
 3 files changed, 81 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7e758275/gremlin-server/scripts/generate-all.groovy
----------------------------------------------------------------------
diff --git a/gremlin-server/scripts/generate-all.groovy b/gremlin-server/scripts/generate-all.groovy
new file mode 100644
index 0000000..ec3ab69
--- /dev/null
+++ b/gremlin-server/scripts/generate-all.groovy
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+// an init script that returns a Map allows explicit setting of global bindings.
+def globals = [:]
+
+// Generates the modern graph into an "empty" TinkerGraph via LifeCycleHook.
+// Note that the name of the key in the "global" map is unimportant.
+globals << [hook : [
+  onStartUp: { ctx ->
+    TinkerFactory.generateClassic(classic)
+    TinkerFactory.generateModern(modern)
+    TinkerFactory.generateTheCrew(crew)
+    grateful.io(gryo()).readGraph('../data/grateful-dead.kryo')
+  }
+] as LifeCycleHook]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7e758275/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/WithServerIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/WithServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/WithServerIntegrateTest.java
new file mode 100644
index 0000000..683a164
--- /dev/null
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/WithServerIntegrateTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.Cluster;
+import org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection;
+import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
+import org.junit.Test;
+
+import java.util.Collections;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class WithServerIntegrateTest extends AbstractGremlinServerIntegrationTest {
+    @Override
+    public Settings overrideSettings(final Settings settings) {
+        settings.scriptEngines.get("gremlin-groovy").scripts = Collections.singletonList("scripts/generate-modern.groovy");
+        return settings;
+    }
+
+    @Test
+    public void shouldDoServerGraphReturningVertices() {
+        final Cluster cluster = Cluster.open();
+        final Graph graph = RemoteGraph.open(DriverRemoteConnection.using(cluster), TinkerGraph.class);
+        final GraphTraversalSource g = graph.traversal();
+        g.V().forEachRemaining(v -> System.out.println("TEST: " + v.toString()));
+        cluster.close();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7e758275/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/WithServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/WithServerIntegrationTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/WithServerIntegrationTest.java
deleted file mode 100644
index 40c8f8a..0000000
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/WithServerIntegrationTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.Cluster;
-import org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection;
-import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
-import org.junit.Test;
-
-import java.util.Collections;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class WithServerIntegrationTest extends AbstractGremlinServerIntegrationTest {
-    @Override
-    public Settings overrideSettings(final Settings settings) {
-        settings.scriptEngines.get("gremlin-groovy").scripts = Collections.singletonList("scripts/generate-modern.groovy");
-        return settings;
-    }
-
-    @Test
-    public void shouldDoServerGraphReturningVertices() {
-        final Cluster cluster = Cluster.open();
-        final Graph graph = RemoteGraph.open(DriverRemoteConnection.using(cluster), TinkerGraph.class);
-        final GraphTraversalSource g = graph.traversal();
-        g.V().forEachRemaining(v -> System.out.println("TEST: " + v.toString()));
-        cluster.close();
-    }
-}


[6/8] incubator-tinkerpop git commit: Minor refactoring to get apply strategies more efficiently.

Posted by sp...@apache.org.
Minor refactoring to get apply strategies more efficiently.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/71a28267
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/71a28267
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/71a28267

Branch: refs/heads/TINKERPOP-575
Commit: 71a28267681098f7fde5bf9b064f4ca3823c20d3
Parents: 2757ef9
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Mar 11 19:51:15 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Mar 11 19:51:15 2016 -0500

----------------------------------------------------------------------
 .../gremlin/server/op/traversal/TraversalOpProcessor.java          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/71a28267/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java
index d915ce7..5d9f23e 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/op/traversal/TraversalOpProcessor.java
@@ -147,7 +147,7 @@ public class TraversalOpProcessor extends AbstractOpProcessor {
 
                     try {
                         // compile the traversal - without it getEndStep() has nothing in it
-                        traversal.hasNext();
+                        traversal.asAdmin().applyStrategies();
                         handleIterator(context, new DetachingIterator(traversal.asAdmin().getEndStep()));
                     } catch (TimeoutException ex) {
                         final String errorMessage = String.format("Response iteration exceeded the configured threshold for request [%s] - %s", msg.getRequestId(), ex.getMessage());


[2/8] incubator-tinkerpop git commit: Made sure generate-all.groovy doesn't get into the distribution.

Posted by sp...@apache.org.
Made sure generate-all.groovy doesn't get into the distribution.

That script is just for tests.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/90e0e429
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/90e0e429
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/90e0e429

Branch: refs/heads/TINKERPOP-575
Commit: 90e0e429b97f74e90a79de88e46d839b55438713
Parents: 7e75827
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Mar 11 18:11:18 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Mar 11 18:11:18 2016 -0500

----------------------------------------------------------------------
 gremlin-server/src/assembly/distribution.xml | 2 +-
 gremlin-server/src/assembly/standalone.xml   | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/90e0e429/gremlin-server/src/assembly/distribution.xml
----------------------------------------------------------------------
diff --git a/gremlin-server/src/assembly/distribution.xml b/gremlin-server/src/assembly/distribution.xml
index 4eb5129..879900c 100644
--- a/gremlin-server/src/assembly/distribution.xml
+++ b/gremlin-server/src/assembly/distribution.xml
@@ -41,7 +41,7 @@ limitations under the License.
             <outputDirectory>data</outputDirectory>
         </fileSet>
         <fileSet>
-            <directory>scripts</directory>
+            <directory>target/apache-${project.artifactId}-${project.version}-standalone/scripts</directory>
         </fileSet>
         <fileSet>
             <directory>target/apache-${project.artifactId}-${project.version}-standalone/ext</directory>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/90e0e429/gremlin-server/src/assembly/standalone.xml
----------------------------------------------------------------------
diff --git a/gremlin-server/src/assembly/standalone.xml b/gremlin-server/src/assembly/standalone.xml
index f6a3641..cbb862e 100644
--- a/gremlin-server/src/assembly/standalone.xml
+++ b/gremlin-server/src/assembly/standalone.xml
@@ -38,6 +38,9 @@ limitations under the License.
         <fileSet>
             <directory>scripts</directory>
             <outputDirectory>/scripts</outputDirectory>
+            <excludes>
+                <exclude>generate-all.groovy</exclude>
+            </excludes>
         </fileSet>
         <fileSet>
             <directory>../target/docs/htmlsingle</directory>


[5/8] incubator-tinkerpop git commit: Added LinkedList to GryoMapper.

Posted by sp...@apache.org.
Added LinkedList to GryoMapper.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/2757ef93
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/2757ef93
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/2757ef93

Branch: refs/heads/TINKERPOP-575
Commit: 2757ef93bf41e0e54b2b12608dc6068ee9445f0d
Parents: 84c96e1
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Mar 11 19:50:08 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Mar 11 19:50:08 2016 -0500

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2757ef93/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
index acd66cf..3bf7abc 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
@@ -105,6 +105,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -260,6 +261,7 @@ public final class GryoMapper implements Mapper<Kryo> {
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(KryoSerializable.class, null, 36));
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(LinkedHashMap.class, null, 47));
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(LinkedHashSet.class, null, 71));
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(LinkedList.class, null, 116));  // ***LAST ID***
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(LINKED_HASH_MAP_ENTRY_CLASS, null, 15));
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Locale.class, null, 22));
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(StringBuffer.class, null, 43));
@@ -300,7 +302,7 @@ public final class GryoMapper implements Mapper<Kryo> {
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(HashSet.class, null, 62));
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(BulkSet.class, null, 64));
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(MutableMetrics.class, null, 69));
-            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(ImmutableMetrics.class, null, 115)); // ***LAST ID***
+            add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(ImmutableMetrics.class, null, 115));
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(StandardTraversalMetrics.class, null, 70));
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(MapMemory.class, null, 73));
             add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(MapReduce.NullObject.class, null, 74));


[7/8] incubator-tinkerpop git commit: Added a TestListener to notify GraphProviders of test start/stop activities.

Posted by sp...@apache.org.
Added a TestListener to notify GraphProviders of test start/stop activities.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/0b1f58bd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/0b1f58bd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/0b1f58bd

Branch: refs/heads/TINKERPOP-575
Commit: 0b1f58bd4abb84197e84de7a7961239273336bda
Parents: 71a2826
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Mar 11 19:52:10 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Mar 11 19:52:10 2016 -0500

----------------------------------------------------------------------
 .../tinkerpop/gremlin/AbstractGremlinTest.java   |  2 ++
 .../apache/tinkerpop/gremlin/GraphManager.java   |  6 ++++++
 .../apache/tinkerpop/gremlin/GraphProvider.java  | 19 +++++++++++++++++++
 3 files changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0b1f58bd/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
index 394d5c7..3f5b5c3 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
@@ -76,6 +76,7 @@ public abstract class AbstractGremlinTest {
         final LoadGraphWith.GraphData loadGraphWithData = null == loadGraphWith ? null : loadGraphWith.value();
 
         graphProvider = GraphManager.getGraphProvider();
+        graphProvider.getTestListener().ifPresent(l -> l.onTestStart(this.getClass(), name.getMethodName()));
         config = graphProvider.standardGraphConfiguration(this.getClass(), name.getMethodName(), loadGraphWithData);
 
         // this should clear state from a previously unfinished test. since the graph does not yet exist,
@@ -130,6 +131,7 @@ public abstract class AbstractGremlinTest {
     @After
     public void tearDown() throws Exception {
         if (null != graphProvider) {
+            graphProvider.getTestListener().ifPresent(l -> l.onTestEnd(this.getClass(), name.getMethodName()));
             graphProvider.clear(graph, config);
 
             // All GraphProvider objects should be an instance of ManagedGraphProvider, as this is handled by GraphManager

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0b1f58bd/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
index 4f43a08..571658d 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphManager.java
@@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 
 /**
@@ -171,6 +172,11 @@ public class GraphManager {
         public Set<Class> getImplementations() {
             return innerGraphProvider.getImplementations();
         }
+
+        @Override
+        public Optional<TestListener> getTestListener() {
+            return innerGraphProvider.getTestListener();
+        }
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0b1f58bd/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
index 0e3a448..ee77702 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
@@ -49,6 +49,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 
 /**
@@ -285,6 +286,14 @@ public interface GraphProvider {
     }
 
     /**
+     * Returns a {@link TestListener} implementation that provides feedback to the {@link GraphProvider} implementation.
+     * By default, this returns an empty listener.
+     */
+    public default Optional<TestListener> getTestListener() {
+        return Optional.empty();
+    }
+
+    /**
      * An annotation to be applied to a {@code GraphProvider} implementation that provides additional information
      * about its intentions. The {@code Descriptor} is required by those {@code GraphProvider} implementations
      * that will be assigned to test suites that use
@@ -302,4 +311,14 @@ public interface GraphProvider {
          */
         public Class<? extends GraphComputer> computer();
     }
+
+    public interface TestListener {
+        public default void onTestStart(final Class<?> test, final String testName) {
+            // do nothing
+        }
+
+        public default void onTestEnd(final Class<?> test, final String testName) {
+            // do nothing
+        }
+    }
 }


[4/8] incubator-tinkerpop git commit: GroupStep can't hold transients or else RemoteGraph doesn't serialize things properly.

Posted by sp...@apache.org.
GroupStep can't hold transients or else RemoteGraph doesn't serialize things properly.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/84c96e18
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/84c96e18
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/84c96e18

Branch: refs/heads/TINKERPOP-575
Commit: 84c96e18531966ad4c0748d20d346c8c4814457b
Parents: d942a12
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Mar 11 19:49:16 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Mar 11 19:49:16 2016 -0500

----------------------------------------------------------------------
 .../tinkerpop/gremlin/process/traversal/step/map/GroupStep.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/84c96e18/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroupStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroupStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroupStep.java
index 164395d..ce0e0d2 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroupStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroupStep.java
@@ -165,8 +165,8 @@ public final class GroupStep<S, K, V> extends ReducingBarrierStep<S, Map<K, V>>
 
         private static final GroupBiOperator COMPUTER_INSTANCE = new GroupBiOperator();
 
-        private transient Traversal.Admin<?, V> valueReduceTraversal;
-        private transient Map<K, Integer> counters;
+        private Traversal.Admin<?, V> valueReduceTraversal;
+        private Map<K, Integer> counters;
         private final boolean onGraphComputer;
 
         public GroupBiOperator(final Traversal.Admin<?, V> valueReduceTraversal) {


[8/8] incubator-tinkerpop git commit: Many changes to get the process suite working against RemoteGraph.

Posted by sp...@apache.org.
Many changes to get the process suite working against RemoteGraph.

Lots of failing tests remain, but lots of tests passing too.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/6c438f43
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/6c438f43
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/6c438f43

Branch: refs/heads/TINKERPOP-575
Commit: 6c438f43f322ea8d00fe3d2a2e69d019557379c4
Parents: 0b1f58b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Mar 11 19:53:01 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Mar 11 19:53:01 2016 -0500

----------------------------------------------------------------------
 .../gremlin/process/remote/RemoteGraph.java     |   1 +
 .../remote/traversal/step/map/RemoteStep.java   |  17 +-
 .../traversal/strategy/RemoteStrategy.java      |   1 +
 .../driver/remote/DriverRemoteConnection.java   |  48 +++++-
 .../gremlin/remote/RemoteGraphProvider.java     | 159 +++++++++++++++++++
 ...RemoteGraphProcessStandardIntegrateTest.java |  33 ++++
 .../gremlin/server/ServerTestHelper.java        |   2 +-
 .../remote/gremlin-server-integration.yaml      |  63 ++++++++
 pom.xml                                         |   2 +-
 9 files changed, 301 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6c438f43/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraph.java
index d6e0827..f818ba0 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraph.java
@@ -41,6 +41,7 @@ import java.util.Iterator;
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
+@Graph.OptIn(Graph.OptIn.SUITE_PROCESS_STANDARD)
 public class RemoteGraph implements Graph {
 
     private final RemoteConnection connection;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6c438f43/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/step/map/RemoteStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/step/map/RemoteStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/step/map/RemoteStep.java
index d8e1792..2394b94 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/step/map/RemoteStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/step/map/RemoteStep.java
@@ -24,14 +24,11 @@ import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
 import org.apache.tinkerpop.gremlin.process.traversal.util.PureTraversal;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 
-import java.util.Collections;
 import java.util.Iterator;
-import java.util.List;
 import java.util.NoSuchElementException;
 
 /**
@@ -39,7 +36,7 @@ import java.util.NoSuchElementException;
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-public class RemoteStep<S,E> extends AbstractStep<S, E> implements TraversalParent {
+public class RemoteStep<S,E> extends AbstractStep<S, E> {
     private transient RemoteConnection remoteConnection;
     private PureTraversal pureTraversal;
     private Iterator<Traverser> currentIterator;
@@ -49,12 +46,6 @@ public class RemoteStep<S,E> extends AbstractStep<S, E> implements TraversalPare
         super(traversal);
         this.remoteConnection = remoteConnection;
         pureTraversal = new PureTraversal<>(traversalToRemote.asAdmin());
-        this.integrateChild(pureTraversal.get());
-    }
-
-    @Override
-    public List<Traversal.Admin<S, E>> getGlobalChildren() {
-        return Collections.singletonList(pureTraversal.get());
     }
 
     @Override
@@ -62,12 +53,6 @@ public class RemoteStep<S,E> extends AbstractStep<S, E> implements TraversalPare
         return StringFactory.stepString(this, pureTraversal.get());
     }
 
-    @Override
-    public void setTraversal(final Traversal.Admin<?, ?> parentTraversal) {
-        super.setTraversal(parentTraversal);
-        this.integrateChild(pureTraversal.get());
-    }
-
     @SuppressWarnings("unchecked")
     @Override
     protected Traverser processNextStart() throws NoSuchElementException {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6c438f43/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/strategy/RemoteStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/strategy/RemoteStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/strategy/RemoteStrategy.java
index 297f62f..052b784 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/strategy/RemoteStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/traversal/strategy/RemoteStrategy.java
@@ -72,6 +72,7 @@ public class RemoteStrategy extends AbstractTraversalStrategy<TraversalStrategy.
 
         final Traversal.Admin<?, ?> serverTraversal = new DefaultTraversal<>();
         TraversalHelper.removeToTraversal(traversal.getStartStep(), EmptyStep.instance(), (Traversal.Admin) serverTraversal);
+        serverTraversal.setSideEffects(traversal.getSideEffects());
         final RemoteStep serverStep = new RemoteStep(traversal, serverTraversal, remoteGraph.getConnection());
         traversal.addStep(serverStep);
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6c438f43/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteConnection.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteConnection.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteConnection.java
index b707a29..7de5aaf 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteConnection.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/remote/DriverRemoteConnection.java
@@ -27,9 +27,16 @@ import org.apache.tinkerpop.gremlin.process.remote.RemoteConnectionException;
 import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.util.Attachable;
 import org.apache.tinkerpop.gremlin.structure.util.GraphFactory;
 
 import java.util.Iterator;
+import java.util.Optional;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
 
 /**
  * A {@link RemoteConnection} implementation for Gremlin Server. Each {@code DriverServerConnection} is bound to one
@@ -38,29 +45,33 @@ import java.util.Iterator;
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public class DriverRemoteConnection implements RemoteConnection {
-
+    private static final boolean attachElements = Boolean.valueOf(System.getProperty("is.testing", "false"));
     private final Client client;
     private final boolean tryCloseCluster;
     private final String connectionGraphName;
+    private transient Optional<Configuration> conf = Optional.empty();
 
     public DriverRemoteConnection(final Configuration conf) {
         if (conf.containsKey("clusterConfigurationFile") && conf.containsKey("clusterConfiguration"))
             throw new IllegalStateException("A configuration should not contain both 'clusterConfigurationFile' and 'clusterConfiguration'");
 
-        if (!conf.containsKey("clusterConfigurationFile") && !conf.containsKey("clusterConfiguration"))
-            throw new IllegalStateException("A configuration must contain either 'clusterConfigurationFile' and 'clusterConfiguration'");
-
         connectionGraphName = conf.getString("connectionGraphName", "graph");
 
         try {
-            final Cluster cluster = conf.containsKey("clusterConfigurationFile") ?
-                Cluster.open(conf.getString("clusterConfigurationFile")) : Cluster.open(conf.subset("clusterConfiguration"));
+            final Cluster cluster;
+            if (!conf.containsKey("clusterConfigurationFile") && !conf.containsKey("clusterConfiguration"))
+                cluster = Cluster.open();
+            else
+                cluster = conf.containsKey("clusterConfigurationFile") ?
+                        Cluster.open(conf.getString("clusterConfigurationFile")) : Cluster.open(conf.subset("clusterConfiguration"));
+
             client = cluster.connect(Client.Settings.build().unrollTraversers(false).create()).alias(connectionGraphName);
         } catch (Exception ex) {
             throw new IllegalStateException(ex);
         }
 
         tryCloseCluster = true;
+        this.conf = Optional.of(conf);
     }
 
     private DriverRemoteConnection(final Cluster cluster, final boolean tryCloseCluster, final String connectionGraphName){
@@ -135,7 +146,13 @@ public class DriverRemoteConnection implements RemoteConnection {
     @Override
     public Iterator<Traverser> submit(final Traversal t) throws RemoteConnectionException {
         try {
-            return new TraverserIterator(client.submit(t).iterator());
+            if (attachElements)
+                return new TraverserIterator(client.submit(t).iterator());
+            else {
+                if (!conf.isPresent()) throw new IllegalStateException("Traverser can't be reattached for testing");
+                final Graph graph = ((Supplier<Graph>) conf.get().getProperty("hidden.for.testing.only")).get();
+                return new AttachingTraverserIterator(client.submit(t).iterator(), graph);
+            }
         } catch (Exception ex) {
             throw new RemoteConnectionException(ex);
         }
@@ -177,4 +194,21 @@ public class DriverRemoteConnection implements RemoteConnection {
             return (Traverser) o;
         }
     }
+
+    static class AttachingTraverserIterator extends TraverserIterator {
+        private final Graph graph;
+
+        public AttachingTraverserIterator(final Iterator<Result> resultIterator, final Graph graph) {
+            super(resultIterator);
+            this.graph = graph;
+        }
+
+        @Override
+        public Traverser next() {
+            final Traverser traverser = super.next();
+            if (traverser.get() instanceof Attachable && !(traverser.get() instanceof Property))
+                traverser.asAdmin().set(((Attachable<Element>) traverser.get()).attach(Attachable.Method.get(graph)));
+            return traverser;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6c438f43/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/remote/RemoteGraphProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/remote/RemoteGraphProvider.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/remote/RemoteGraphProvider.java
new file mode 100644
index 0000000..5ac1579
--- /dev/null
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/remote/RemoteGraphProvider.java
@@ -0,0 +1,159 @@
+/*
+ * 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.remote;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.AbstractGraphProvider;
+import org.apache.tinkerpop.gremlin.LoadGraphWith;
+import org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection;
+import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph;
+import org.apache.tinkerpop.gremlin.process.traversal.step.filter.DropTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddEdgeTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddVertexTest;
+import org.apache.tinkerpop.gremlin.server.GremlinServer;
+import org.apache.tinkerpop.gremlin.server.ServerTestHelper;
+import org.apache.tinkerpop.gremlin.server.Settings;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.PropertyTest;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+import java.util.function.Supplier;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class RemoteGraphProvider extends AbstractGraphProvider {
+    private static final Set<Class> IMPLEMENTATION = new HashSet<Class>() {{
+        add(RemoteGraph.class);
+    }};
+
+    private TestListener testListener = new RemoteGraphTestListener();
+    private static GremlinServer server;
+
+    private Executor executors = Executors.newFixedThreadPool(4);
+
+    static {
+        try {
+            startServer();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    @Override
+    public Map<String, Object> getBaseConfiguration(final String graphName, Class<?> test, final String testMethodName,
+                                                    final LoadGraphWith.GraphData loadGraphWith) {
+        final String serverGraphName;
+        switch (loadGraphWith) {
+            case CLASSIC:
+                serverGraphName = "classic";
+                break;
+            case MODERN:
+                serverGraphName = "modern";
+                break;
+            case GRATEFUL:
+                serverGraphName = "grateful";
+                break;
+            case CREW:
+                serverGraphName = "crew";
+                break;
+            default:
+                serverGraphName = "graph";
+                break;
+        }
+
+        final Supplier<Graph> graphGetter = () -> server.getServerGremlinExecutor().getGraphManager().getGraphs().get(serverGraphName);
+        return new HashMap<String, Object>() {{
+            put(Graph.GRAPH, RemoteGraph.class.getName());
+            put(RemoteGraph.GREMLIN_SERVERGRAPH_GRAPH_CLASS, TinkerGraph.class.getName());
+            put(RemoteGraph.GREMLIN_SERVERGRAPH_SERVER_CONNECTION_CLASS, DriverRemoteConnection.class.getName());
+            put("connectionGraphName", serverGraphName);
+            put("hidden.for.testing.only", graphGetter);
+        }};
+    }
+
+    @Override
+    public void clear(final Graph graph, final Configuration configuration) throws Exception {
+        if (graph != null) {
+            executors.execute(() -> {
+                try {
+                    graph.close();
+                } catch (Exception ex) {
+                    ex.printStackTrace();
+                }
+            });
+        }
+    }
+
+    @Override
+    public void loadGraphData(final Graph graph, final LoadGraphWith loadGraphWith, final Class testClass, final String testName) {
+        // server already loads with the all the graph instances for LoadGraphWith
+    }
+
+    @Override
+    public Set<Class> getImplementations() {
+        return IMPLEMENTATION;
+    }
+
+    @Override
+    public Optional<TestListener> getTestListener() {
+        return Optional.of(testListener);
+    }
+
+    public static void startServer() throws Exception {
+        final InputStream stream = RemoteGraphProvider.class.getResourceAsStream("gremlin-server-integration.yaml");
+        final Settings settings = Settings.read(stream);
+        ServerTestHelper.rewritePathsInGremlinServerSettings(settings);
+        server = new GremlinServer(settings);
+
+        server.start().join();
+    }
+
+    public static void stopServer() throws Exception {
+        server.stop().join();
+        server = null;
+    }
+
+    public class RemoteGraphTestListener implements TestListener {
+        @Override
+        public void onTestEnd(final Class<?> test, final String testName) {
+            if (test.equals(DropTest.Traversals.class) ||
+                    test.equals(AddEdgeTest.Traversals.class) ||
+                    test.equals(AddVertexTest.Traversals.class)) {
+                try {
+                    stopServer();
+                    startServer();
+                } catch (Exception ex) {
+                    throw new RuntimeException(ex);
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6c438f43/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/remote/process/RemoteGraphProcessStandardIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/remote/process/RemoteGraphProcessStandardIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/remote/process/RemoteGraphProcessStandardIntegrateTest.java
new file mode 100644
index 0000000..8af0e4e
--- /dev/null
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/remote/process/RemoteGraphProcessStandardIntegrateTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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.remote.process;
+
+import org.apache.tinkerpop.gremlin.GraphProviderClass;
+import org.apache.tinkerpop.gremlin.process.ProcessStandardSuite;
+import org.apache.tinkerpop.gremlin.process.remote.RemoteGraph;
+import org.apache.tinkerpop.gremlin.remote.RemoteGraphProvider;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+@RunWith(ProcessStandardSuite.class)
+@GraphProviderClass(provider = RemoteGraphProvider.class, graph = RemoteGraph.class)
+public class RemoteGraphProcessStandardIntegrateTest {
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6c438f43/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/ServerTestHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/ServerTestHelper.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/ServerTestHelper.java
index 914efc3..e846673 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/ServerTestHelper.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/ServerTestHelper.java
@@ -31,7 +31,7 @@ public class ServerTestHelper {
      *  gremlin-server directory to get stuff to reference scripts properly from the file system from any directory.
      *  If an overriden path is determined to be absolute then the path is not re-written.
      */
-    static void rewritePathsInGremlinServerSettings(final Settings overridenSettings) {
+    public static void rewritePathsInGremlinServerSettings(final Settings overridenSettings) {
         final String buildDir = System.getProperty("build.dir");
         final String homeDir = buildDir.substring(0, buildDir.indexOf("gremlin-server") + "gremlin-server".length());
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6c438f43/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/remote/gremlin-server-integration.yaml
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/remote/gremlin-server-integration.yaml b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/remote/gremlin-server-integration.yaml
new file mode 100644
index 0000000..c8a78fb
--- /dev/null
+++ b/gremlin-server/src/test/resources/org/apache/tinkerpop/gremlin/remote/gremlin-server-integration.yaml
@@ -0,0 +1,63 @@
+# 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.
+
+host: localhost
+port: 8182
+threadPoolWorker: 1
+gremlinPool: 8
+scriptEvaluationTimeout: 30000
+serializedResponseTimeout: 30000
+graphs: {
+  graph: conf/tinkergraph-empty.properties,
+  classic: conf/tinkergraph-empty.properties,
+  modern: conf/tinkergraph-empty.properties,
+  crew: conf/tinkergraph-empty.properties,
+  grateful: conf/tinkergraph-empty.properties}
+plugins:
+  - tinkerpop.tinkergraph
+scriptEngines: {
+  gremlin-groovy: {
+    imports: [java.lang.Math],
+    staticImports: [java.lang.Math.PI],
+    scripts: [scripts/generate-all.groovy]},
+  nashorn: {
+      imports: [java.lang.Math],
+      staticImports: [java.lang.Math.PI]}}
+serializers:
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { useMapperFromGraph: graph, custom: [groovy.json.JsonBuilder;org.apache.tinkerpop.gremlin.driver.ser.JsonBuilderGryoSerializer]}}
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true}}
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { useMapperFromGraph: graph }}
+  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { useMapperFromGraph: graph }}
+processors:
+  - { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
+metrics: {
+  consoleReporter: {enabled: true, interval: 180000},
+  csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
+  jmxReporter: {enabled: true},
+  slf4jReporter: {enabled: true, interval: 180000},
+  gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
+  graphiteReporter: {enabled: false, interval: 180000}}
+strictTransactionManagement: false
+threadPoolBoss: 1
+maxInitialLineLength: 4096
+maxHeaderSize: 8192
+maxChunkSize: 8192
+maxContentLength: 65536
+maxAccumulationBufferComponents: 1024
+resultIterationBatchSize: 64
+writeBufferHighWaterMark: 32768
+writeBufferHighWaterMark: 65536

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/6c438f43/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 15ad9d6..14345c5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -355,7 +355,7 @@ limitations under the License.
                                 <argLine>-Dlog4j.configuration=${log4j-test.properties} -Dhost=localhost -Dport=8182
                                     -Djub.consumers=CONSOLE,H2 -Djub.db.file=target/performance/h2/benchmarks
                                     -Djub.charts.dir=target/performance/charts -Djub.customkey=${project.parent.version}
-                                    -Dbuild.dir=${project.build.directory}
+                                    -Dbuild.dir=${project.build.directory} -Dis.testing=true
                                 </argLine>
                                 <summaryFile>target/failsafe-reports/failsafe-integration.xml</summaryFile>
                             </configuration>


[3/8] incubator-tinkerpop git commit: Rework tests that used "graph" instance for asserts.

Posted by sp...@apache.org.
Rework tests that used "graph" instance for asserts.

Remote tests really don't have access to a true "graph" because they use RemoteGraph and therefore those methods won't work and tests failed.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/d942a127
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/d942a127
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/d942a127

Branch: refs/heads/TINKERPOP-575
Commit: d942a1273fc4d48d80c847d3cf8eba67604b4934
Parents: 90e0e42
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Mar 11 18:13:03 2016 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Mar 11 18:13:03 2016 -0500

----------------------------------------------------------------------
 .../step/filter/GroovyWhereTest.groovy          |  2 +-
 .../process/traversal/step/filter/DropTest.java | 14 +++----
 .../traversal/step/filter/WhereTest.java        |  2 +-
 .../process/traversal/step/map/AddEdgeTest.java | 44 ++++++++++----------
 .../traversal/step/map/AddVertexTest.java       | 16 +++----
 5 files changed, 39 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d942a127/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyWhereTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyWhereTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyWhereTest.groovy
index 9c21e68..83d9b6c 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyWhereTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyWhereTest.groovy
@@ -88,7 +88,7 @@ public abstract class GroovyWhereTest {
         @Override
         public Traversal<Vertex, Vertex> get_g_withSideEffectXa_graph_verticesX2XX_VX1X_out_whereXneqXaXX(
                 final Object v1Id, final Object v2Id) {
-            new ScriptTraversal<>(g, "gremlin-groovy", "g.withSideEffect('a'){graph.vertices(v2Id).next()}.V(v1Id).out.where(neq('a'))", "graph", graph, "v1Id", v1Id, "v2Id", v2Id)
+            new ScriptTraversal<>(g, "gremlin-groovy", "g.withSideEffect('a'){g.V(v2Id).next()}.V(v1Id).out.where(neq('a'))", "graph", graph, "v1Id", v1Id, "v2Id", v2Id)
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d942a127/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropTest.java
index f6eebe8..f33997e 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropTest.java
@@ -55,8 +55,8 @@ public abstract class DropTest extends AbstractGremlinTest {
         final Traversal<Vertex, Vertex> traversal = get_g_V_drop();
         printTraversalForm(traversal);
         assertFalse(traversal.hasNext());
-        assertEquals(0, IteratorUtils.count(graph.vertices()));
-        assertEquals(0, IteratorUtils.count(graph.edges()));
+        assertEquals(0, IteratorUtils.count(g.V()));
+        assertEquals(0, IteratorUtils.count(g.E()));
     }
 
     @Test
@@ -66,8 +66,8 @@ public abstract class DropTest extends AbstractGremlinTest {
         final Traversal<Vertex, Edge> traversal = get_g_V_outE_drop();
         printTraversalForm(traversal);
         assertFalse(traversal.hasNext());
-        assertEquals(6, IteratorUtils.count(graph.vertices()));
-        assertEquals(0, IteratorUtils.count(graph.edges()));
+        assertEquals(6, IteratorUtils.count(g.V()));
+        assertEquals(0, IteratorUtils.count(g.E()));
     }
 
     @Test
@@ -77,9 +77,9 @@ public abstract class DropTest extends AbstractGremlinTest {
         final Traversal<Vertex, VertexProperty> traversal = get_g_V_properties_drop();
         printTraversalForm(traversal);
         assertFalse(traversal.hasNext());
-        assertEquals(6, IteratorUtils.count(graph.vertices()));
-        assertEquals(6, IteratorUtils.count(graph.edges()));
-        graph.vertices().forEachRemaining(vertex -> assertEquals(0, IteratorUtils.count(vertex.properties())));
+        assertEquals(6, IteratorUtils.count(g.V()));
+        assertEquals(6, IteratorUtils.count(g.E()));
+        g.V().forEachRemaining(vertex -> assertEquals(0, IteratorUtils.count(vertex.properties())));
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d942a127/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTest.java
index eb6300b..a3ba0cc 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTest.java
@@ -372,7 +372,7 @@ public abstract class WhereTest extends AbstractGremlinProcessTest {
 
         @Override
         public Traversal<Vertex, Vertex> get_g_withSideEffectXa_graph_verticesX2XX_VX1X_out_whereXneqXaXX(final Object v1Id, final Object v2Id) {
-            return g.withSideEffect("a", graph.vertices(v2Id).next()).V(v1Id).out().where(neq("a"));
+            return g.withSideEffect("a", g.V(v2Id).next()).V(v1Id).out().where(neq("a"));
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d942a127/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeTest.java
index 9bd6695..b1b21cd 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeTest.java
@@ -87,8 +87,8 @@ public abstract class AddEdgeTest extends AbstractGremlinProcessTest {
 
         }
         assertEquals(1, count);
-        assertEquals(7, IteratorUtils.count(graph.edges()));
-        assertEquals(6, IteratorUtils.count(graph.vertices()));
+        assertEquals(7, IteratorUtils.count(g.E()));
+        assertEquals(6, IteratorUtils.count(g.V()));
     }
 
     @Test
@@ -106,8 +106,8 @@ public abstract class AddEdgeTest extends AbstractGremlinProcessTest {
 
         }
         assertEquals(1, count);
-        assertEquals(7, IteratorUtils.count(graph.edges()));
-        assertEquals(6, IteratorUtils.count(graph.vertices()));
+        assertEquals(7, IteratorUtils.count(g.E()));
+        assertEquals(6, IteratorUtils.count(g.V()));
     }
 
     @Test
@@ -128,8 +128,8 @@ public abstract class AddEdgeTest extends AbstractGremlinProcessTest {
 
         }
         assertEquals(1, count);
-        assertEquals(7, IteratorUtils.count(graph.edges()));
-        assertEquals(6, IteratorUtils.count(graph.vertices()));
+        assertEquals(7, IteratorUtils.count(g.E()));
+        assertEquals(6, IteratorUtils.count(g.V()));
     }
 
     @Test
@@ -149,8 +149,8 @@ public abstract class AddEdgeTest extends AbstractGremlinProcessTest {
 
         }
         assertEquals(1, count);
-        assertEquals(7, IteratorUtils.count(graph.edges()));
-        assertEquals(6, IteratorUtils.count(graph.vertices()));
+        assertEquals(7, IteratorUtils.count(g.E()));
+        assertEquals(6, IteratorUtils.count(g.V()));
     }
 
     @Test
@@ -169,12 +169,12 @@ public abstract class AddEdgeTest extends AbstractGremlinProcessTest {
             count++;
         }
         assertEquals(36, count);
-        assertEquals(42, IteratorUtils.count(graph.edges()));
-        for (final Vertex vertex : IteratorUtils.list(graph.vertices())) {
+        assertEquals(42, IteratorUtils.count(g.E()));
+        for (final Vertex vertex : IteratorUtils.list(g.V())) {
             assertEquals(6, IteratorUtils.count(vertex.edges(Direction.OUT, "existsWith")));
             assertEquals(6, IteratorUtils.count(vertex.edges(Direction.IN, "existsWith")));
         }
-        assertEquals(6, IteratorUtils.count(graph.vertices()));
+        assertEquals(6, IteratorUtils.count(g.V()));
     }
 
     @Test
@@ -192,12 +192,12 @@ public abstract class AddEdgeTest extends AbstractGremlinProcessTest {
             count++;
         }
         assertEquals(36, count);
-        assertEquals(42, IteratorUtils.count(graph.edges()));
-        for (final Vertex vertex : IteratorUtils.list(graph.vertices())) {
+        assertEquals(42, IteratorUtils.count(g.E()));
+        for (final Vertex vertex : IteratorUtils.list(g.V())) {
             assertEquals(6, IteratorUtils.count(vertex.edges(Direction.OUT, "existsWith")));
             assertEquals(6, IteratorUtils.count(vertex.edges(Direction.IN, "existsWith")));
         }
-        assertEquals(6, IteratorUtils.count(graph.vertices()));
+        assertEquals(6, IteratorUtils.count(g.V()));
     }
 
     @Test
@@ -222,8 +222,8 @@ public abstract class AddEdgeTest extends AbstractGremlinProcessTest {
 
         }
         assertEquals(6, count);
-        assertEquals(12, IteratorUtils.count(graph.edges()));
-        assertEquals(6, IteratorUtils.count(graph.vertices()));
+        assertEquals(12, IteratorUtils.count(g.E()));
+        assertEquals(6, IteratorUtils.count(g.V()));
     }
 
     @Test
@@ -247,8 +247,8 @@ public abstract class AddEdgeTest extends AbstractGremlinProcessTest {
 
         }
         assertEquals(6, count);
-        assertEquals(12, IteratorUtils.count(graph.edges()));
-        assertEquals(6, IteratorUtils.count(graph.vertices()));
+        assertEquals(12, IteratorUtils.count(g.E()));
+        assertEquals(6, IteratorUtils.count(g.V()));
     }
 
     @Test
@@ -273,8 +273,8 @@ public abstract class AddEdgeTest extends AbstractGremlinProcessTest {
 
         }
         assertEquals(4, count);
-        assertEquals(10, IteratorUtils.count(graph.edges()));
-        assertEquals(6, IteratorUtils.count(graph.vertices()));
+        assertEquals(10, IteratorUtils.count(g.E()));
+        assertEquals(6, IteratorUtils.count(g.V()));
     }
 
     @Test
@@ -298,8 +298,8 @@ public abstract class AddEdgeTest extends AbstractGremlinProcessTest {
 
         }
         assertEquals(4, count);
-        assertEquals(10, IteratorUtils.count(graph.edges()));
-        assertEquals(6, IteratorUtils.count(graph.vertices()));
+        assertEquals(10, IteratorUtils.count(g.E()));
+        assertEquals(6, IteratorUtils.count(g.V()));
     }
 
     public static class Traversals extends AddEdgeTest {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d942a127/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexTest.java
index 5a616f8..4387eb7 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexTest.java
@@ -81,7 +81,7 @@ public abstract class AddVertexTest extends AbstractGremlinTest {
         assertEquals(29, vertex.<Integer>value("age").intValue());
         assertEquals("puppy", vertex.<String>value("name"));
         assertFalse(traversal.hasNext());
-        assertEquals(7, IteratorUtils.count(graph.vertices()));
+        assertEquals(7, IteratorUtils.count(g.V()));
     }
 
 
@@ -100,7 +100,7 @@ public abstract class AddVertexTest extends AbstractGremlinTest {
             count++;
         }
         assertEquals(6, count);
-        assertEquals(12, IteratorUtils.count(graph.vertices()));
+        assertEquals(12, IteratorUtils.count(g.V()));
 
     }
 
@@ -116,7 +116,7 @@ public abstract class AddVertexTest extends AbstractGremlinTest {
         assertEquals("person", stephen.label());
         assertEquals("stephen", stephen.value("name"));
         assertEquals(1, IteratorUtils.count(stephen.properties()));
-        assertEquals(7, IteratorUtils.count(graph.vertices()));
+        assertEquals(7, IteratorUtils.count(g.V()));
     }
 
     @Test
@@ -132,7 +132,7 @@ public abstract class AddVertexTest extends AbstractGremlinTest {
         assertEquals("person", stephen.label());
         assertThat((List<String>) IteratorUtils.asList(stephen.values("name")), containsInAnyOrder("stephen", "stephenm"));
         assertEquals(2, IteratorUtils.count(stephen.properties()));
-        assertEquals(7, IteratorUtils.count(graph.vertices()));
+        assertEquals(7, IteratorUtils.count(g.V()));
     }
 
     @Test
@@ -147,7 +147,7 @@ public abstract class AddVertexTest extends AbstractGremlinTest {
         assertEquals("person", stephen.label());
         assertEquals("stephenm", stephen.value("name"));
         assertEquals(1, IteratorUtils.count(stephen.properties()));
-        assertEquals(7, IteratorUtils.count(graph.vertices()));
+        assertEquals(7, IteratorUtils.count(g.V()));
     }
 
     @Test
@@ -165,7 +165,7 @@ public abstract class AddVertexTest extends AbstractGremlinTest {
         assertEquals(2010, Integer.parseInt(stephen.property("name").value("since").toString()));
         assertEquals(1, IteratorUtils.count(stephen.property("name").properties()));
         assertEquals(1, IteratorUtils.count(stephen.properties()));
-        assertEquals(7, IteratorUtils.count(graph.vertices()));
+        assertEquals(7, IteratorUtils.count(g.V()));
     }
 
     @Test
@@ -255,7 +255,7 @@ public abstract class AddVertexTest extends AbstractGremlinTest {
             count++;
         }
         assertEquals(6, count);
-        assertEquals(12, IteratorUtils.count(graph.vertices()));
+        assertEquals(12, IteratorUtils.count(g.V()));
 
     }
 
@@ -271,7 +271,7 @@ public abstract class AddVertexTest extends AbstractGremlinTest {
         assertEquals("person", stephen.label());
         assertEquals("stephen", stephen.value("name"));
         assertEquals(1, IteratorUtils.count(stephen.properties()));
-        assertEquals(7, IteratorUtils.count(graph.vertices()));
+        assertEquals(7, IteratorUtils.count(g.V()));
     }