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/10/31 17:22:04 UTC

[01/12] tinkerpop git commit: TraversalStrategy.GlobalCache.getStrategies() is now the point where static{} code blocks are loaded for Graph and GraphComputer classes. Added a test case to TraversalStrategiesTset that demonstrates that the GlobalCache ca [Forced Update!]

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1534 9a8c2d20e -> f3dec2fad (forced update)


TraversalStrategy.GlobalCache.getStrategies() is now the point where static{} code blocks are loaded for Graph and GraphComputer classes. Added a test case to TraversalStrategiesTset that demonstrates that the GlobalCache can be manipulated without fear of static{} re-registering strategies. This is a much much safer model and, moreover, proved correct via testing.


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

Branch: refs/heads/TINKERPOP-1534
Commit: f9bf0444e4bfe09dcea9b8dc05870ddaec4b6180
Parents: 285ff35
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Oct 25 13:02:29 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Oct 25 13:02:29 2016 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   1 +
 .../decoration/VertexProgramStrategy.java       |   5 -
 .../process/traversal/TraversalStrategies.java  |  11 +-
 .../process/TraversalStrategiesTest.java        | 194 ++++++++++++++++++-
 4 files changed, 200 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f9bf0444/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index a281c38..1c7441b 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Added a class loader to `TraversalStrategies.GlobalCache` which guarantees strategies are registered prior to `GlobalCache.getStrategies()`.
 * Fixed a severe bug where `GraphComputer` strategies are not being loaded until the second use of the traversal source.
 
 [[release-3-2-3]]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f9bf0444/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java
index 0eeae3c..89e40cb 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java
@@ -171,11 +171,6 @@ public final class VertexProgramStrategy extends AbstractTraversalStrategy<Trave
             }
         } else
             graphComputerClass = this.computer.getGraphComputerClass();
-        try {
-            Class.forName(graphComputerClass.getCanonicalName());
-        } catch (final ClassNotFoundException e) {
-            throw new IllegalStateException(e.getMessage(), e);
-        }
         final List<TraversalStrategy<?>> graphComputerStrategies = TraversalStrategies.GlobalCache.getStrategies(graphComputerClass).toList();
         traversalSource.getStrategies().addStrategies(graphComputerStrategies.toArray(new TraversalStrategy[graphComputerStrategies.size()]));
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f9bf0444/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
index c271a37..015df70 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
@@ -225,7 +225,6 @@ public interface TraversalStrategies extends Serializable, Cloneable {
                     OrderLimitStrategy.instance(),
                     PathProcessorStrategy.instance(),
                     ComputerVerificationStrategy.instance());
-
             GRAPH_COMPUTER_CACHE.put(GraphComputer.class, graphComputerStrategies);
         }
 
@@ -239,6 +238,16 @@ public interface TraversalStrategies extends Serializable, Cloneable {
         }
 
         public static TraversalStrategies getStrategies(final Class graphOrGraphComputerClass) {
+            try {
+                // be sure to load the class so that its static{} traversal strategy registration component is loaded.
+                // this is more important for GraphComputer classes as they are typically not instantiated prior to strategy usage like Graph classes.
+                final String graphComputerClassName = null != graphOrGraphComputerClass.getDeclaringClass() ?
+                        graphOrGraphComputerClass.getCanonicalName().replace("." + graphOrGraphComputerClass.getSimpleName(), "$" + graphOrGraphComputerClass.getSimpleName()) :
+                        graphOrGraphComputerClass.getCanonicalName();
+                Class.forName(graphComputerClassName);
+            } catch (final ClassNotFoundException e) {
+                throw new IllegalStateException(e.getMessage(), e);
+            }
             if (Graph.class.isAssignableFrom(graphOrGraphComputerClass)) {
                 final TraversalStrategies traversalStrategies = GRAPH_CACHE.get(graphOrGraphComputerClass);
                 return null == traversalStrategies ? GRAPH_CACHE.get(Graph.class) : traversalStrategies;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f9bf0444/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java
index f316836..3d320db 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java
@@ -18,26 +18,211 @@
  */
 package org.apache.tinkerpop.gremlin.process;
 
+import org.apache.commons.configuration.BaseConfiguration;
+import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.process.computer.ComputerResult;
+import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
+import org.apache.tinkerpop.gremlin.process.computer.MapReduce;
+import org.apache.tinkerpop.gremlin.process.computer.VertexProgram;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Transaction;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.junit.Test;
 
-import java.util.Arrays;
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Future;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 /**
  * @author Matthias Broecheler (me@matthiasb.com)
  */
 public class TraversalStrategiesTest {
 
+    @Test
+    public void shouldAllowUserManipulationOfGlobalCache() throws Exception {
+        ///////////
+        // GRAPH //
+        ///////////
+        TestGraph graph = new TestGraph();
+        TraversalStrategies strategies = graph.traversal().getStrategies();
+        assertFalse(TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList().isEmpty());
+        for (final TraversalStrategy strategy : TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList()) {
+            assertTrue(strategies.getStrategy(strategy.getClass()).isPresent());
+        }
+        for (final TraversalStrategy strategy : TraversalStrategies.GlobalCache.getStrategies(TestGraphComputer.class).toList()) {
+            assertFalse(strategies.getStrategy(strategy.getClass()).isPresent());
+        }
+        assertTrue(strategies.getStrategy(StrategyA.class).isPresent());
+        assertTrue(strategies.getStrategy(StrategyB.class).isPresent());
+        assertFalse(strategies.getStrategy(StrategyC.class).isPresent());
+        assertFalse(strategies.getStrategy(StrategyD.class).isPresent());
+        strategies.addStrategies(new StrategyD());
+        strategies.removeStrategies(StrategyA.class);
+        assertFalse(strategies.getStrategy(StrategyA.class).isPresent());
+        assertTrue(strategies.getStrategy(StrategyD.class).isPresent());
+        ///
+        graph = new TestGraph();
+        strategies = graph.traversal().getStrategies();
+        for (final TraversalStrategy strategy : TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList()) {
+            assertTrue(strategies.getStrategy(strategy.getClass()).isPresent());
+        }
+        for (final TraversalStrategy strategy : TraversalStrategies.GlobalCache.getStrategies(TestGraphComputer.class).toList()) {
+            assertFalse(strategies.getStrategy(strategy.getClass()).isPresent());
+        }
+        assertFalse(strategies.getStrategy(StrategyA.class).isPresent());
+        assertTrue(strategies.getStrategy(StrategyB.class).isPresent());
+        assertFalse(strategies.getStrategy(StrategyC.class).isPresent());
+        assertTrue(strategies.getStrategy(StrategyD.class).isPresent());
+        //////////////////////
+        /// GRAPH COMPUTER ///
+        //////////////////////
+        strategies = TraversalStrategies.GlobalCache.getStrategies(TestGraphComputer.class);
+        assertFalse(TraversalStrategies.GlobalCache.getStrategies(GraphComputer.class).toList().isEmpty());
+        for (final TraversalStrategy strategy : TraversalStrategies.GlobalCache.getStrategies(GraphComputer.class).toList()) {
+            assertTrue(strategies.getStrategy(strategy.getClass()).isPresent());
+        }
+        for (final TraversalStrategy strategy : TraversalStrategies.GlobalCache.getStrategies(TestGraph.class).toList()) {
+            assertFalse(strategies.getStrategy(strategy.getClass()).isPresent());
+        }
+        assertFalse(strategies.getStrategy(StrategyA.class).isPresent());
+        assertFalse(strategies.getStrategy(StrategyB.class).isPresent());
+        assertTrue(strategies.getStrategy(StrategyC.class).isPresent());
+        strategies.addStrategies(new StrategyE());
+        strategies.removeStrategies(StrategyC.class);
+        //
+        strategies = TraversalStrategies.GlobalCache.getStrategies(TestGraphComputer.class);
+        assertFalse(TraversalStrategies.GlobalCache.getStrategies(GraphComputer.class).toList().isEmpty());
+        for (final TraversalStrategy strategy : TraversalStrategies.GlobalCache.getStrategies(GraphComputer.class).toList()) {
+            assertTrue(strategies.getStrategy(strategy.getClass()).isPresent());
+        }
+        for (final TraversalStrategy strategy : TraversalStrategies.GlobalCache.getStrategies(TestGraph.class).toList()) {
+            assertFalse(strategies.getStrategy(strategy.getClass()).isPresent());
+        }
+        assertFalse(strategies.getStrategy(StrategyA.class).isPresent());
+        assertFalse(strategies.getStrategy(StrategyB.class).isPresent());
+        assertFalse(strategies.getStrategy(StrategyC.class).isPresent());
+        assertFalse(strategies.getStrategy(StrategyD.class).isPresent());
+        assertTrue(strategies.getStrategy(StrategyE.class).isPresent());
+    }
+
+    public static class TestGraphComputer implements GraphComputer {
+
+        static {
+            TraversalStrategies.GlobalCache.registerStrategies(TestGraphComputer.class,
+                    TraversalStrategies.GlobalCache.getStrategies(GraphComputer.class).clone().addStrategies(new StrategyC()));
+        }
+
+        @Override
+        public GraphComputer result(ResultGraph resultGraph) {
+            return this;
+        }
+
+        @Override
+        public GraphComputer persist(Persist persist) {
+            return this;
+        }
+
+        @Override
+        public GraphComputer program(VertexProgram vertexProgram) {
+            return this;
+        }
+
+        @Override
+        public GraphComputer mapReduce(MapReduce mapReduce) {
+            return this;
+        }
+
+        @Override
+        public GraphComputer workers(int workers) {
+            return this;
+        }
+
+        @Override
+        public GraphComputer vertices(Traversal<Vertex, Vertex> vertexFilter) throws IllegalArgumentException {
+            return this;
+        }
+
+        @Override
+        public GraphComputer edges(Traversal<Vertex, Edge> edgeFilter) throws IllegalArgumentException {
+            return this;
+        }
+
+        @Override
+        public Future<ComputerResult> submit() {
+            return new CompletableFuture<>();
+        }
+    }
+
+    public static class TestGraph implements Graph {
+
+        static {
+            TraversalStrategies.GlobalCache.registerStrategies(TestGraph.class,
+                    TraversalStrategies.GlobalCache.getStrategies(Graph.class).clone().addStrategies(new StrategyA(), new StrategyB()));
+        }
+
+        @Override
+        public Vertex addVertex(Object... keyValues) {
+            return null;
+        }
+
+        @Override
+        public <C extends GraphComputer> C compute(Class<C> graphComputerClass) throws IllegalArgumentException {
+            return (C) new TestGraphComputer();
+        }
+
+        @Override
+        public GraphComputer compute() throws IllegalArgumentException {
+            return new TestGraphComputer();
+        }
+
+        @Override
+        public Iterator<Vertex> vertices(Object... vertexIds) {
+            return Collections.emptyIterator();
+        }
+
+        @Override
+        public Iterator<Edge> edges(Object... edgeIds) {
+            return Collections.emptyIterator();
+        }
+
+        @Override
+        public Transaction tx() {
+            return null;
+        }
+
+        @Override
+        public void close() throws Exception {
+
+        }
+
+        @Override
+        public Variables variables() {
+            return null;
+        }
+
+        @Override
+        public Configuration configuration() {
+            return new BaseConfiguration();
+        }
+    }
+
     /**
      * Tests that {@link org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies#sortStrategies(java.util.List)}
      * works as advertised. This class defines a bunch of dummy strategies which define an order. It is verified
@@ -113,7 +298,7 @@ public class TraversalStrategiesTest {
         assertTrue(s.indexOf(a) < s.indexOf(b));
 
         // sort and then add more
-        s = new ArrayList<>((List)Arrays.asList(b,a,c));
+        s = new ArrayList<>((List) Arrays.asList(b, a, c));
         s = TraversalStrategies.sortStrategies(s);
         assertEquals(3, s.size());
         assertEquals(a, s.get(0));
@@ -220,7 +405,6 @@ public class TraversalStrategiesTest {
     }
 
 
-
     private static class DummyStrategy<S extends TraversalStrategy> extends AbstractTraversalStrategy<S> {
 
         @Override
@@ -262,7 +446,7 @@ public class TraversalStrategiesTest {
         assertEquals(e, s.get(3));
 
         //full reverse sorting
-        s = Arrays.asList(k,e,d,c,b,a);
+        s = Arrays.asList(k, e, d, c, b, a);
         s = TraversalStrategies.sortStrategies(s);
         assertEquals(6, s.size());
         assertEquals(a, s.get(0));


[04/12] tinkerpop git commit: TINKERPOP-919 Added supportsDuplicateMultiProperties()

Posted by sp...@apache.org.
TINKERPOP-919 Added supportsDuplicateMultiProperties()

That feature allows a graph to specify whether or not it supports multi-properties that allow the same value to be supplied on the same key.


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

Branch: refs/heads/TINKERPOP-1534
Commit: 3a7805c73301ad370e70a410326f23aa92b6e99e
Parents: 2d9bb20
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Oct 25 13:50:48 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Oct 26 11:08:11 2016 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../upgrade/release-3.2.x-incubating.asciidoc   |  8 ++++++
 .../tinkerpop/gremlin/structure/Graph.java      | 12 +++++++++
 .../gremlin/structure/VertexProperty.java       |  4 +++
 .../gremlin/structure/FeatureSupportTest.java   | 27 ++++++++++++++++++--
 .../gremlin/structure/VertexPropertyTest.java   | 26 ++++++++++++++++---
 6 files changed, 73 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3a7805c7/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 73bfa1e..1df17de 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Added `VertexFeatures.supportsDuplicateMultiProperties()` for graphs that only support unique values in multi-properties.
 * Deprecated the "performance" tests in `OptIn`.
 * Fixed a severe bug where `GraphComputer` strategies are not being loaded until the second use of the traversal source.
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3a7805c7/docs/src/upgrade/release-3.2.x-incubating.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
index 0fba8f5..30daae1 100644
--- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
@@ -35,6 +35,14 @@ Upgrading for Providers
 Graph Database Providers
 ^^^^^^^^^^^^^^^^^^^^^^^^
 
+Duplicate Multi-Properties
+++++++++++++++++++++++++++
+
+Added `supportsDuplicateMultiProperties` to `VertexFeatures` so that graph provider who only support unique values as
+multi-properties have more flexibility in describing their graph capabilities.
+
+See: https://issues.apache.org/jira/browse/TINKERPOP-919[TINKERPOP-919]
+
 Deprecated Performance OptIn
 ++++++++++++++++++++++++++++
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3a7805c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
index ed3f12d..255fbca 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
@@ -24,6 +24,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.engine.ComputerTraversalEngine;
 import org.apache.tinkerpop.gremlin.structure.io.Io;
 import org.apache.tinkerpop.gremlin.structure.io.IoRegistry;
 import org.apache.tinkerpop.gremlin.structure.util.FeatureDescriptor;
@@ -512,6 +513,7 @@ public interface Graph extends AutoCloseable, Host {
         public interface VertexFeatures extends ElementFeatures {
             public static final String FEATURE_ADD_VERTICES = "AddVertices";
             public static final String FEATURE_MULTI_PROPERTIES = "MultiProperties";
+            public static final String FEATURE_DUPLICATE_MULTI_PROPERTIES = "DuplicateMultiProperties";
             public static final String FEATURE_META_PROPERTIES = "MetaProperties";
             public static final String FEATURE_REMOVE_VERTICES = "RemoveVertices";
 
@@ -550,6 +552,16 @@ public interface Graph extends AutoCloseable, Host {
             }
 
             /**
+             * Determines if a {@link Vertex} can support non-unique values on the same key. For this value to be
+             * {@code true}, then {@link #supportsMetaProperties()} must also return true. By default this method,
+             * just returns what {@link #supportsMultiProperties()} returns.
+             */
+            @FeatureDescriptor(name = FEATURE_DUPLICATE_MULTI_PROPERTIES)
+            public default boolean supportsDuplicateMultiProperties() {
+                return supportsMultiProperties();
+            }
+
+            /**
              * Determines if a {@link Vertex} can support properties on vertex properties.  It is assumed that a
              * graph will support all the same data types for meta-properties that are supported for regular
              * properties.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3a7805c7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexProperty.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexProperty.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexProperty.java
index ecbefb3..c6b443c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexProperty.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexProperty.java
@@ -99,6 +99,10 @@ public interface VertexProperty<V> extends Property<V>, Element {
             return new UnsupportedOperationException("Multiple properties on a vertex is not supported");
         }
 
+        public static UnsupportedOperationException identicalMultiPropertiesNotSupported() {
+            return new UnsupportedOperationException("Multiple properties on a vertex is supported, but a single key may not hold the same value more than once");
+        }
+
         public static UnsupportedOperationException metaPropertiesNotSupported() {
             return new UnsupportedOperationException("Properties on a vertex property is not supported");
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3a7805c7/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
index 98406b4..c73474c 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
@@ -697,7 +697,8 @@ public class FeatureSupportTest {
             "multiPropertiesNotSupported",
             "metaPropertiesNotSupported",
             "userSuppliedIdsNotSupported",
-            "userSuppliedIdsOfThisTypeNotSupported"
+            "userSuppliedIdsOfThisTypeNotSupported",
+            "identicalMultiPropertiesNotSupported"
     })
     @ExceptionCoverage(exceptionClass = Element.Exceptions.class, methods = {
             "propertyRemovalNotSupported"
@@ -877,6 +878,22 @@ public class FeatureSupportTest {
         @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
         @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
         @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_PROPERTY)
+        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_MULTI_PROPERTIES)
+        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_DUPLICATE_MULTI_PROPERTIES, supported = false)
+        public void shouldSupportIdenticalMultiPropertyIfTheSameKeyCanBeAssignedSameValueMoreThanOnce() throws Exception {
+            try {
+                final Vertex v = graph.addVertex("name", "stephen", "name", "stephen");
+                if (2 == IteratorUtils.count(v.properties()))
+                    fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), VertexFeatures.FEATURE_DUPLICATE_MULTI_PROPERTIES));
+            } catch (Exception ex) {
+                validateException(VertexProperty.Exceptions.identicalMultiPropertiesNotSupported(), ex);
+            }
+        }
+
+        @Test
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_PROPERTY)
         @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_MULTI_PROPERTIES, supported = false)
         public void shouldSupportMultiPropertyIfTheSameKeyCanBeAssignedMoreThanOnce() throws Exception {
             try {
@@ -1023,7 +1040,13 @@ public class FeatureSupportTest {
         @Test
         public void shouldSupportRegularTransactionsIfThreadedTransactionsAreEnabled() {
             if (graphFeatures.supportsThreadedTransactions())
-                assertTrue(graphFeatures.supportsThreadedTransactions());
+                assertThat(graphFeatures.supportsThreadedTransactions(), is(true));
+        }
+
+        @Test
+        public void shouldSupportMultiPropertiesIfSupportingIdenticalMultiProperties() {
+            if (vertexFeatures.supportsDuplicateMultiProperties())
+                assertThat(vertexFeatures.supportsMultiProperties(), is(true));
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3a7805c7/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java
index 845be70..04b431d 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java
@@ -34,6 +34,7 @@ import java.util.Map;
 import java.util.UUID;
 
 import static org.hamcrest.Matchers.hasItem;
+import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertThat;
@@ -288,11 +289,8 @@ public class VertexPropertyTest extends AbstractGremlinTest {
                     }
                 }
             });
-
-
         }
 
-
         @Test
         @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
         @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_MULTI_PROPERTIES)
@@ -329,6 +327,28 @@ public class VertexPropertyTest extends AbstractGremlinTest {
             assertEquals(0, IteratorUtils.count(newMexico.properties(T.key.getAccessor())));
             assertEquals(0, IteratorUtils.count(newMexico.properties(T.value.getAccessor())));
         }
+
+        @Test
+        @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
+        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_MULTI_PROPERTIES)
+        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_DUPLICATE_MULTI_PROPERTIES)
+        public void shouldAllowIdenticalValuedMultiProperties() {
+            final Vertex v = graph.addVertex();
+            v.property(VertexProperty.Cardinality.list, "name", "stephen");
+            v.property(VertexProperty.Cardinality.list, "name", "stephen");
+            v.property(VertexProperty.Cardinality.list, "name", "steve");
+            v.property(VertexProperty.Cardinality.list, "name", "stephen");
+            v.property(VertexProperty.Cardinality.list, "color", "red");
+
+            tryCommit(graph, g -> {
+                final Vertex vertex = graph.vertices(v).next();
+                assertEquals(4, IteratorUtils.count(vertex.properties("name")));
+                assertEquals(1, IteratorUtils.count(vertex.properties("color")));
+                assertEquals(5, IteratorUtils.count(vertex.properties()));
+
+                assertThat(IteratorUtils.set(vertex.values("name")), contains("stephen", "steve"));
+            });
+        }
     }
 
     public static class VertexPropertyRemoval extends AbstractGremlinTest {


[12/12] tinkerpop git commit: TINKERPOP-1534 Improve GraphProvider ability to release resources

Posted by sp...@apache.org.
TINKERPOP-1534 Improve GraphProvider ability to release resources

Specifically, made AbstractGremlinSuite attept to close() a GraphProvider if it implemented AutoCloseable. Added better logging to gremlin-python server start/stop script. Removed DriverRemoteConnectionTest as it was an ignored test anyway and a remnant of the original way we tested gremlin-python. Implemented AutoCloseable on RemoteGraphProvider to kill Gremlin Server which is no longer started statically.


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

Branch: refs/heads/TINKERPOP-1534
Commit: f3dec2fadcb877e4f93ffbd9fc2a10a56da122c8
Parents: 1eac35b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Oct 28 11:55:47 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 31 13:21:36 2016 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   1 +
 gremlin-python/pom.xml                          |  15 +-
 .../driver/DriverRemoteConnectionTest.java      | 153 -------------------
 .../tinkerpop/gremlin/server/GremlinServer.java |   5 +
 .../driver/remote/RemoteGraphProvider.java      |  20 ++-
 .../tinkerpop/gremlin/AbstractGremlinSuite.java |  18 +++
 .../apache/tinkerpop/gremlin/GraphManager.java  |   8 +-
 7 files changed, 57 insertions(+), 163 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f3dec2fa/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index cf8c007..b253458 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Improved ability to release resources in `GraphProvider` instances in the test suite.
 * `SparkGraphComputer` no longer starts a worker iteration if the worker's partition is empty.
 * Added `ProjectStep.getProjectKeys()` for strategies that rely on such information.
 * Added `VertexFeatures.supportsDuplicateMultiProperties()` for graphs that only support unique values in multi-properties.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f3dec2fa/gremlin-python/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-python/pom.xml b/gremlin-python/pom.xml
index 1a550fa..923380d 100644
--- a/gremlin-python/pom.xml
+++ b/gremlin-python/pom.xml
@@ -526,10 +526,17 @@ import org.apache.tinkerpop.gremlin.server.GremlinServer
 
 if (${skipTests}) return
 
-log.info("Tests for native gremlin-python complete - shutting down Gremlin Server")
-project.getContextValue("gremlin.py.server").stop().join()
-project.getContextValue("gremlin.py.server.secure").stop().join()
-log.info("Gremlin Server shutdown")
+log.info("Tests for native gremlin-python complete")
+
+def server = project.getContextValue("gremlin.py.server")
+log.info("Shutting down $server")
+server.stop().join()
+
+def serverSecure = project.getContextValue("gremlin.py.server.secure")
+log.info("Shutting down $serverSecure")
+serverSecure.stop().join()
+
+log.info("All Gremlin Server instances are shutdown for gremlin-python")
 ]]>
                                         </script>
                                     </scripts>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f3dec2fa/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/driver/DriverRemoteConnectionTest.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/driver/DriverRemoteConnectionTest.java b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/driver/DriverRemoteConnectionTest.java
deleted file mode 100644
index 27952a8..0000000
--- a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/driver/DriverRemoteConnectionTest.java
+++ /dev/null
@@ -1,153 +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.python.driver;
-
-import org.apache.tinkerpop.gremlin.TestHelper;
-import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalSideEffects;
-import org.apache.tinkerpop.gremlin.server.GremlinServer;
-import org.apache.tinkerpop.gremlin.server.Settings;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Writer;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-@org.junit.Ignore
-public class DriverRemoteConnectionTest {
-
-    private static boolean PYTHON_EXISTS = false;
-
-    @BeforeClass
-    public static void setup() {
-        try {
-            final Optional<String> pythonVersion = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("python --version").getErrorStream()))
-                    .lines()
-                    .filter(line -> line.trim().startsWith("Python "))
-                    .findAny();
-            PYTHON_EXISTS = pythonVersion.isPresent();
-            System.out.println("Python virtual machine: " + pythonVersion.orElse("None"));
-            if (PYTHON_EXISTS)
-                new GremlinServer(Settings.read(DriverRemoteConnectionTest.class.getResourceAsStream("gremlin-server-modern-secure-py.yaml"))).start().join();
-        } catch (final Exception ex) {
-            ex.printStackTrace();
-        }
-    }
-
-    private static List<String> submit(final String... scriptLines) throws IOException {
-        final StringBuilder builder = new StringBuilder();
-        builder.append("from gremlin_python import statics\n");
-        builder.append("from gremlin_python.structure.graph import Graph\n");
-        builder.append("from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection\n");
-        builder.append("from gremlin_python.structure.io.graphson import GraphSONWriter\n\n");
-        builder.append("statics.load_statics(globals())\n");
-        builder.append("graph = Graph()\n");
-        builder.append("g = graph.traversal().withRemote(DriverRemoteConnection('ws://localhost:8182','g',username='stephen', password='password'))\n");
-        for (int i = 0; i < scriptLines.length - 1; i++) {
-            builder.append(scriptLines[i] + "\n");
-        }
-        builder.append("final = " + scriptLines[scriptLines.length - 1] + "\n");
-        builder.append("if isinstance(final,dict):\n");
-        builder.append("  for key in final.keys():\n");
-        builder.append("    print (str(key),str(final[key]))\n");
-        builder.append("elif isinstance(final,str):\n");
-        builder.append("  print final\n");
-        builder.append("else:\n");
-        builder.append("  for result in final:\n");
-        builder.append("    print result\n\n");
-
-        File file = TestHelper.generateTempFile(DriverRemoteConnectionTest.class, "temp", "py");
-        final Writer writer = new BufferedWriter(new FileWriter(file.getAbsoluteFile()));
-        writer.write(builder.toString());
-        writer.flush();
-        writer.close();
-
-        final BufferedReader reader = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("python " + file.getAbsolutePath()).getInputStream()));
-        final List<String> lines = reader.lines().map(String::trim).collect(Collectors.toList());
-        reader.close();
-        file.delete();
-        return lines;
-
-    }
-
-    @Test
-    public void testTraversals() throws Exception {
-        if (!PYTHON_EXISTS) return;
-
-        List<String> result = DriverRemoteConnectionTest.submit("g.V().count()");
-        assertEquals(1, result.size());
-        assertEquals("6", result.get(0));
-        //
-        result = DriverRemoteConnectionTest.submit("g.V(1).out('created').name");
-        assertEquals(1, result.size());
-        assertEquals("lop", result.get(0));
-        //
-        result = DriverRemoteConnectionTest.submit("g.V(1).out()");
-        assertEquals(3, result.size());
-        assertTrue(result.contains("v[4]"));
-        assertTrue(result.contains("v[2]"));
-        assertTrue(result.contains("v[3]"));
-        //
-        result = DriverRemoteConnectionTest.submit("g.V().repeat(out()).times(2).name");
-        assertEquals(2, result.size());
-        assertTrue(result.contains("lop"));
-        assertTrue(result.contains("ripple"));
-    }
-
-    @Test
-    public void testSideEffects() throws Exception {
-        if (!PYTHON_EXISTS) return;
-
-        List<String> result = DriverRemoteConnectionTest.submit(
-                "t = g.V().out().iterate()",
-                "str(t.side_effects)");
-        assertEquals(1, result.size());
-        assertEquals(new DefaultTraversalSideEffects().toString(), result.get(0));
-        //
-        result = DriverRemoteConnectionTest.submit(
-                "t = g.V().out('created').groupCount('m').by('name').iterate()",
-                "t.side_effects['m']");
-        assertEquals(2, result.size());
-        assertTrue(result.contains("('ripple', '1')"));
-        assertTrue(result.contains("('lop', '3')"));
-        //
-        result = DriverRemoteConnectionTest.submit(
-                "t = g.V().out('created').groupCount('m').by('name').aggregate('n').iterate()",
-                "t.side_effects.keys()");
-        assertEquals(2, result.size());
-        assertTrue(result.contains("m"));
-        assertTrue(result.contains("n"));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f3dec2fa/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java
index 268a903..ed0fd7c 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GremlinServer.java
@@ -405,4 +405,9 @@ public class GremlinServer {
         if (settings.gremlinPool == 0)
             settings.gremlinPool = Runtime.getRuntime().availableProcessors();
     }
+
+    @Override
+    public String toString() {
+        return "GremlinServer " + settings.host + ":" + settings.port;
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f3dec2fa/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/RemoteGraphProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/RemoteGraphProvider.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/RemoteGraphProvider.java
index eae229a..f071671 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/RemoteGraphProvider.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/RemoteGraphProvider.java
@@ -36,12 +36,13 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.TimeUnit;
 import java.util.function.Supplier;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-public class RemoteGraphProvider extends AbstractGraphProvider {
+public class RemoteGraphProvider extends AbstractGraphProvider implements AutoCloseable {
     private static final Set<Class> IMPLEMENTATION = new HashSet<Class>() {{
         add(RemoteGraph.class);
     }};
@@ -52,11 +53,20 @@ public class RemoteGraphProvider extends AbstractGraphProvider {
     //private final Cluster cluster = Cluster.build().maxContentLength(1024000).serializer(Serializers.GRAPHSON_V2D0).create();
     private final Client client = cluster.connect();
 
-    static {
+    public RemoteGraphProvider() {
         try {
             startServer();
         } catch (Exception ex) {
-            ex.printStackTrace();
+            throw new RuntimeException(ex);
+        }
+    }
+
+    @Override
+    public void close() throws Exception {
+        try {
+            stopServer();
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
         }
     }
 
@@ -120,11 +130,11 @@ public class RemoteGraphProvider extends AbstractGraphProvider {
 
         server = new GremlinServer(settings);
 
-        server.start().join();
+        server.start().get(100, TimeUnit.SECONDS);
     }
 
     public static void stopServer() throws Exception {
-        server.stop().join();
+        server.stop().get(100, TimeUnit.SECONDS);
         server = null;
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f3dec2fa/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java
index fa9d0e6..b896f8b 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java
@@ -29,6 +29,7 @@ import org.junit.runner.notification.RunNotifier;
 import org.junit.runners.Suite;
 import org.junit.runners.model.InitializationError;
 import org.junit.runners.model.RunnerBuilder;
+import org.junit.runners.model.Statement;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -213,6 +214,23 @@ public abstract class AbstractGremlinSuite extends Suite {
         afterTestExecution((Class<? extends AbstractGremlinTest>) runner.getDescription().getTestClass());
     }
 
+    @Override
+    protected Statement withAfterClasses(final Statement statement) {
+        final Statement wrappedStatement = new Statement() {
+            @Override
+            public void evaluate() throws Throwable {
+                statement.evaluate();
+
+                // release resources in GraphProviders that implement AutoCloseable
+                final GraphProvider gp = GraphManager.getGraphProvider();
+                if (gp instanceof AutoCloseable)
+                    ((AutoCloseable) gp).close();
+            }
+        };
+
+        return super.withAfterClasses(wrappedStatement);
+    }
+
     /**
      * Called just prior to test class execution.  Return false to ignore test class. By default this always returns
      * true.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f3dec2fa/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 571658d..6886465 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
@@ -72,7 +72,7 @@ public class GraphManager {
      * When {@link #openTestGraph(Configuration)} is called the created object is stored in a list and when tests are
      * complete the {@link #tryClearGraphs()} is called. When this is called, an attempt is made to close all open graphs.
      */
-    public static class ManagedGraphProvider implements GraphProvider {
+    public static class ManagedGraphProvider implements GraphProvider, AutoCloseable {
         private static final Logger logger = LoggerFactory.getLogger(ManagedGraphProvider.class);
         private final GraphProvider innerGraphProvider;
         private final List<Pair<Graph, Configuration>> openGraphs = new ArrayList<>();
@@ -177,6 +177,12 @@ public class GraphManager {
         public Optional<TestListener> getTestListener() {
             return innerGraphProvider.getTestListener();
         }
+
+        @Override
+        public void close() throws Exception {
+            if (innerGraphProvider instanceof AutoCloseable)
+                ((AutoCloseable) innerGraphProvider).close();
+        }
     }
 
 }


[08/12] tinkerpop git commit: Merge branch 'tp32-tests' of https://github.com/ngageoint/tinkerpop into tp32

Posted by sp...@apache.org.
Merge branch 'tp32-tests' of https://github.com/ngageoint/tinkerpop into tp32


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

Branch: refs/heads/TINKERPOP-1534
Commit: 8ae1a09215560585658cd260cf273591a95795fc
Parents: 1282a7a 7aa9782
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Sat Oct 29 15:14:30 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Sat Oct 29 15:14:30 2016 -0600

----------------------------------------------------------------------
 .../clustering/peerpressure/PeerPressureVertexProgram.java     | 4 ++--
 .../computer/bulkdumping/BulkDumperVertexProgramTest.java      | 6 ------
 .../apache/tinkerpop/gremlin/structure/TransactionTest.java    | 2 +-
 3 files changed, 3 insertions(+), 9 deletions(-)
----------------------------------------------------------------------



[03/12] tinkerpop git commit: Avoid starting VP worker iterations that never end

Posted by sp...@apache.org.
Avoid starting VP worker iterations that never end

SparkExecutor.executeVertexProgramIteration was written in such a way
that an empty RDD partition would cause it to invoke
VertexProgram.workerIterationStart without ever invoking
VertexProgram.workerIterationEnd.  This seems like a contract
violation.  I have at least one VP that relies on
workerIterationStart|End to allocate and release resources.  Failing
to invoke End like this causes a leak in that VP, as it would for any
VP that uses that resource management pattern.


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

Branch: refs/heads/TINKERPOP-1534
Commit: 36e1159a80f539b8bd4a884e5c1cf304ec52c4f9
Parents: b262c7e
Author: Dan LaRocque <da...@hopcount.org>
Authored: Tue Oct 25 19:37:17 2016 -0500
Committer: Dan LaRocque <da...@hopcount.org>
Committed: Tue Oct 25 20:37:17 2016 -0400

----------------------------------------------------------------------
 .../gremlin/spark/process/computer/SparkExecutor.java          | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/36e1159a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/SparkExecutor.java
----------------------------------------------------------------------
diff --git a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/SparkExecutor.java b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/SparkExecutor.java
index 8dd2381..6e65e26 100644
--- a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/SparkExecutor.java
+++ b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/SparkExecutor.java
@@ -91,9 +91,15 @@ public final class SparkExecutor {
                 // for each partition of vertices emit a view and their outgoing messages
                 .mapPartitionsToPair(partitionIterator -> {
                     KryoShimServiceLoader.applyConfiguration(graphComputerConfiguration);
+
+                    // if the partition is empty, return without starting a new VP iteration
+                    if (!partitionIterator.hasNext())
+                        return Collections.emptyList();
+
                     final VertexProgram<M> workerVertexProgram = VertexProgram.createVertexProgram(HadoopGraph.open(graphComputerConfiguration), vertexProgramConfiguration); // each partition(Spark)/worker(TP3) has a local copy of the vertex program (a worker's task)
                     final String[] vertexComputeKeysArray = VertexProgramHelper.vertexComputeKeysAsArray(workerVertexProgram.getVertexComputeKeys()); // the compute keys as an array
                     final SparkMessenger<M> messenger = new SparkMessenger<>();
+
                     workerVertexProgram.workerIterationStart(memory.asImmutable()); // start the worker
                     return () -> IteratorUtils.map(partitionIterator, vertexViewIncoming -> {
                         final StarGraph.StarVertex vertex = vertexViewIncoming._2()._1().get(); // get the vertex from the vertex writable


[07/12] tinkerpop git commit: added ProjectStep.getProjectKeys() -- should we make this an unmodifiable list.

Posted by sp...@apache.org.
added ProjectStep.getProjectKeys() -- should we make this an unmodifiable list.


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

Branch: refs/heads/TINKERPOP-1534
Commit: 1282a7ae14344ba21664631584be0462c67eba40
Parents: c4682f1
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Sat Oct 29 15:12:06 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Sat Oct 29 15:12:06 2016 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                               | 1 +
 .../gremlin/process/traversal/step/map/ProjectStep.java          | 4 ++++
 2 files changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1282a7ae/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 48f08ef..baf50a1 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Added `ProjectStep.getProjectKeys()` for strategies that rely on such information.
 * Added `VertexFeatures.supportsDuplicateMultiProperties()` for graphs that only support unique values in multi-properties.
 * Deprecated the "performance" tests in `OptIn`.
 * Added `Pick.none` and `Pick.any` to the serializers and importers.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1282a7ae/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProjectStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProjectStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProjectStep.java
index 83e095a..3ddd4a6 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProjectStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProjectStep.java
@@ -97,6 +97,10 @@ public final class ProjectStep<S, E> extends MapStep<S, Map<String, E>> implemen
         this.traversalRing.addTraversal(this.integrateChild(selectTraversal));
     }
 
+    public List<String> getProjectKeys() {
+        return this.projectKeys;
+    }
+
     @Override
     public Set<TraverserRequirement> getRequirements() {
         return this.getSelfAndChildRequirements();


[11/12] tinkerpop git commit: updated CHANGELOG

Posted by sp...@apache.org.
updated CHANGELOG


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

Branch: refs/heads/TINKERPOP-1534
Commit: 1eac35b9b6b13860293292dd8a141a44fd3af7e0
Parents: d8eaf20 b0bedf6
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Sat Oct 29 15:19:21 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Sat Oct 29 15:19:21 2016 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   2 +
 .../decoration/VertexProgramStrategy.java       |   5 -
 .../process/traversal/TraversalStrategies.java  |  11 +-
 .../process/TraversalStrategiesTest.java        | 195 ++++++++++++++++++-
 4 files changed, 202 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1eac35b9/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --cc CHANGELOG.asciidoc
index baf50a1,1c7441b..cf8c007
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@@ -26,10 -26,7 +26,12 @@@ image::https://raw.githubusercontent.co
  TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
++* `SparkGraphComputer` no longer starts a worker iteration if the worker's partition is empty.
 +* Added `ProjectStep.getProjectKeys()` for strategies that rely on such information.
 +* Added `VertexFeatures.supportsDuplicateMultiProperties()` for graphs that only support unique values in multi-properties.
 +* Deprecated the "performance" tests in `OptIn`.
 +* Added `Pick.none` and `Pick.any` to the serializers and importers.
+ * Added a class loader to `TraversalStrategies.GlobalCache` which guarantees strategies are registered prior to `GlobalCache.getStrategies()`.
  * Fixed a severe bug where `GraphComputer` strategies are not being loaded until the second use of the traversal source.
  
  [[release-3-2-3]]


[06/12] tinkerpop git commit: Merge branch 'TINKERPOP-919' into tp32

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-919' into tp32


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

Branch: refs/heads/TINKERPOP-1534
Commit: c4682f172f04a9e38b69a9c9a9829ebc7caf3cad
Parents: 630c1ff 3a7805c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Oct 28 18:26:00 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Oct 28 18:26:00 2016 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../upgrade/release-3.2.x-incubating.asciidoc   |  8 ++++++
 .../tinkerpop/gremlin/structure/Graph.java      | 12 +++++++++
 .../gremlin/structure/VertexProperty.java       |  4 +++
 .../gremlin/structure/FeatureSupportTest.java   | 27 ++++++++++++++++++--
 .../gremlin/structure/VertexPropertyTest.java   | 26 ++++++++++++++++---
 6 files changed, 73 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c4682f17/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --cc CHANGELOG.asciidoc
index 88fcde2,1df17de..48f08ef
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@@ -26,8 -26,8 +26,9 @@@ image::https://raw.githubusercontent.co
  TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
+ * Added `VertexFeatures.supportsDuplicateMultiProperties()` for graphs that only support unique values in multi-properties.
  * Deprecated the "performance" tests in `OptIn`.
 +* Added `Pick.none` and `Pick.any` to the serializers and importers.
  * Fixed a severe bug where `GraphComputer` strategies are not being loaded until the second use of the traversal source.
  
  [[release-3-2-3]]


[10/12] tinkerpop git commit: Merge branch 'TINKERPOP-1525-tp32' of https://github.com/dalaro/incubator-tinkerpop into tp32

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-1525-tp32' of https://github.com/dalaro/incubator-tinkerpop into tp32


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

Branch: refs/heads/TINKERPOP-1534
Commit: d8eaf20822952908037220b6659f9d801e873c73
Parents: 7c1ee36 36e1159
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Sat Oct 29 15:17:11 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Sat Oct 29 15:17:11 2016 -0600

----------------------------------------------------------------------
 .../gremlin/spark/process/computer/SparkExecutor.java          | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------



[02/12] tinkerpop git commit: added authorship to TraversalStrategies java file.

Posted by sp...@apache.org.
added authorship to TraversalStrategies java file.


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

Branch: refs/heads/TINKERPOP-1534
Commit: b0bedf6b441edddbfd2e005641fee0a044b3b552
Parents: f9bf044
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Oct 25 13:07:01 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Oct 25 13:07:01 2016 -0600

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java   | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b0bedf6b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java
index 3d320db..bb58a06 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java
@@ -52,6 +52,7 @@ import static org.junit.Assert.fail;
 
 /**
  * @author Matthias Broecheler (me@matthiasb.com)
+ * @author Marko A. Rodriguez (marko@markorodriguez.com)
  */
 public class TraversalStrategiesTest {
 


[05/12] tinkerpop git commit: Lazy message scope initialization in PeerPressureVertexProgram. Remove vertex id checks in BulkDumperVertexProgramTest. Don't rollback transaction if already closed in TransactionTest.

Posted by sp...@apache.org.
Lazy message scope initialization in PeerPressureVertexProgram. Remove vertex id checks in BulkDumperVertexProgramTest. Don't rollback transaction if already closed in TransactionTest.


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

Branch: refs/heads/TINKERPOP-1534
Commit: 7aa9782c40300531bf08bd140897b50bcd0acdd1
Parents: 5a16f4c
Author: sjudeng <sj...@users.noreply.github.com>
Authored: Wed Oct 26 16:48:23 2016 -0500
Committer: sjudeng <sj...@users.noreply.github.com>
Committed: Wed Oct 26 16:48:23 2016 -0500

----------------------------------------------------------------------
 .../clustering/peerpressure/PeerPressureVertexProgram.java     | 4 ++--
 .../computer/bulkdumping/BulkDumperVertexProgramTest.java      | 6 ------
 .../apache/tinkerpop/gremlin/structure/TransactionTest.java    | 2 +-
 3 files changed, 3 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7aa9782c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
index 56de255..b681807 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
@@ -58,8 +58,6 @@ public class PeerPressureVertexProgram extends StaticVertexProgram<Pair<Serializ
 
     private MessageScope.Local<?> voteScope = MessageScope.Local.of(__::outE);
     private MessageScope.Local<?> countScope = MessageScope.Local.of(new MessageScope.Local.ReverseTraversalSupplier(this.voteScope));
-    private final Set<MessageScope> VOTE_SCOPE = new HashSet<>(Collections.singletonList(this.voteScope));
-    private final Set<MessageScope> COUNT_SCOPE = new HashSet<>(Collections.singletonList(this.countScope));
 
     public static final String CLUSTER = "gremlin.peerPressureVertexProgram.cluster";
     private static final String VOTE_STRENGTH = "gremlin.peerPressureVertexProgram.voteStrength";
@@ -120,6 +118,8 @@ public class PeerPressureVertexProgram extends StaticVertexProgram<Pair<Serializ
 
     @Override
     public Set<MessageScope> getMessageScopes(final Memory memory) {
+        final Set<MessageScope> VOTE_SCOPE = new HashSet<>(Collections.singletonList(this.voteScope));
+        final Set<MessageScope> COUNT_SCOPE = new HashSet<>(Collections.singletonList(this.countScope));
         return this.distributeVote && memory.isInitialIteration() ? COUNT_SCOPE : VOTE_SCOPE;
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7aa9782c/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkdumping/BulkDumperVertexProgramTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkdumping/BulkDumperVertexProgramTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkdumping/BulkDumperVertexProgramTest.java
index c55114e..62104c0 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkdumping/BulkDumperVertexProgramTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkdumping/BulkDumperVertexProgramTest.java
@@ -48,7 +48,6 @@ public class BulkDumperVertexProgramTest extends AbstractGremlinProcessTest {
                 assertEquals(1, IteratorUtils.count(v.values("age", "lang")));
                 final String name = v.value("name");
                 if (name.equals("marko")) {
-                    assertEquals(1, v.id());
                     assertEquals("person", v.label());
                     assertEquals(Integer.valueOf(29), v.value("age"));
                     assertEquals(3, IteratorUtils.count(v.edges(Direction.OUT)));
@@ -56,21 +55,18 @@ public class BulkDumperVertexProgramTest extends AbstractGremlinProcessTest {
                     assertEquals(1, IteratorUtils.count(v.edges(Direction.OUT, "created")));
                     assertEquals(0, IteratorUtils.count(v.edges(Direction.IN)));
                 } else if (name.equals("vadas")) {
-                    assertEquals(2, v.id());
                     assertEquals("person", v.label());
                     assertEquals(Integer.valueOf(27), v.value("age"));
                     assertEquals(0, IteratorUtils.count(v.edges(Direction.OUT)));
                     assertEquals(1, IteratorUtils.count(v.edges(Direction.IN)));
                     assertEquals(1, IteratorUtils.count(v.edges(Direction.IN, "knows")));
                 } else if (name.equals("lop")) {
-                    assertEquals(3, v.id());
                     assertEquals("software", v.label());
                     assertEquals("java", v.value("lang"));
                     assertEquals(0, IteratorUtils.count(v.edges(Direction.OUT)));
                     assertEquals(3, IteratorUtils.count(v.edges(Direction.IN)));
                     assertEquals(3, IteratorUtils.count(v.edges(Direction.IN, "created")));
                 } else if (name.equals("josh")) {
-                    assertEquals(4, v.id());
                     assertEquals("person", v.label());
                     assertEquals(Integer.valueOf(32), v.value("age"));
                     assertEquals(2, IteratorUtils.count(v.edges(Direction.OUT)));
@@ -78,14 +74,12 @@ public class BulkDumperVertexProgramTest extends AbstractGremlinProcessTest {
                     assertEquals(1, IteratorUtils.count(v.edges(Direction.IN)));
                     assertEquals(1, IteratorUtils.count(v.edges(Direction.IN, "knows")));
                 } else if (name.equals("ripple")) {
-                    assertEquals(5, v.id());
                     assertEquals("software", v.label());
                     assertEquals("java", v.value("lang"));
                     assertEquals(0, IteratorUtils.count(v.edges(Direction.OUT)));
                     assertEquals(1, IteratorUtils.count(v.edges(Direction.IN)));
                     assertEquals(1, IteratorUtils.count(v.edges(Direction.IN, "created")));
                 } else if (name.equals("peter")) {
-                    assertEquals(6, v.id());
                     assertEquals("person", v.label());
                     assertEquals(Integer.valueOf(35), v.value("age"));
                     assertEquals(1, IteratorUtils.count(v.edges(Direction.OUT)));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7aa9782c/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java
index 2b953ab..4dbbc5f 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java
@@ -648,7 +648,7 @@ public class TransactionTest extends AbstractGremlinTest {
         } catch (Exception ex) {
             assertThat(ex, instanceOf(IllegalStateException.class));
         } finally {
-            threadedG.tx().rollback();
+            if (threadedG.tx().isOpen()) threadedG.tx().rollback();
         }
     }
 


[09/12] tinkerpop git commit: reexposed GroovyPeerPressure

Posted by sp...@apache.org.
reexposed GroovyPeerPressure


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

Branch: refs/heads/TINKERPOP-1534
Commit: 7c1ee367c9e627c3a1d028a06283b2c5873358d7
Parents: 8ae1a09
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Sat Oct 29 15:16:04 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Sat Oct 29 15:16:04 2016 -0600

----------------------------------------------------------------------
 .../tinkerpop/gremlin/process/GroovyProcessComputerSuite.java      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7c1ee367/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
index f3918b6..e411c1e 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
@@ -148,7 +148,7 @@ public class GroovyProcessComputerSuite extends ProcessComputerSuite {
             GroovyOrderTest.Traversals.class,
             GroovyPageRankTest.Traversals.class,
             GroovyPathTest.Traversals.class,
-            // GroovyPeerPressureTest.Traversals.class, (ordering of ids in multi-threaded environments is non-deterministic)
+            GroovyPeerPressureTest.Traversals.class,
             GroovyProfileTest.Traversals.class,
             GroovyProjectTest.Traversals.class,
             GroovyProgramTest.Traversals.class,