tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ok...@apache.org
Subject [1/3] tinkerpop git commit: Fixed an attachement-bug in with a solution generalized to .
Date Thu, 19 Oct 2017 17:37:23 GMT
Repository: tinkerpop
Updated Branches:
  refs/heads/master 66a7856bd -> c12f45ca9


Fixed an attachement-bug in  with a solution generalized to .


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

Branch: refs/heads/master
Commit: 79b621c9a0ddc2d96f951c54ee3f1db3c8490d4c
Parents: 19e261c
Author: Marko A. Rodriguez <okrammarko@gmail.com>
Authored: Wed Oct 18 16:45:16 2017 -0600
Committer: Marko A. Rodriguez <okrammarko@gmail.com>
Committed: Wed Oct 18 16:45:16 2017 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                      |  1 +
 .../process/traversal/step/sideEffect/StartStep.java    |  7 ++++++-
 .../traversal/step/sideEffect/InjectStepTest.java       |  5 ++++-
 .../tests/driver/test_driver_remote_connection.py       | 12 +++++++++---
 4 files changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/79b621c9/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 8ecff99..778660e 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -23,6 +23,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 [[release-3-2-7]]
 === TinkerPop 3.2.7 (Release Date: NOT OFFICIALLY RELEASED YET)
 
+* Fixed an "attachement"-bug in `InjectStep` with a solution generalized to `StartStep`.
 * Truncate the script in error logs and error return messages for "Method code too large"
errors in Gremlin Server.
 * Fixed a bug in `LambdaRestrictionStrategy` where it was too eager to consider a step as
being a lambda step.
 * `ReferenceVertex` was missing its `label()` string. `ReferenceElement` now supports all
label handling.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/79b621c9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/StartStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/StartStep.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/StartStep.java
index cfb7323..77d4a48 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/StartStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/StartStep.java
@@ -22,6 +22,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
+import org.apache.tinkerpop.gremlin.structure.util.Attachable;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 
 import java.util.ArrayList;
@@ -65,7 +66,11 @@ public class StartStep<S> extends AbstractStep<S, S> {
             }
             this.first = false;
         }
-        return this.starts.next();
+        ///
+        final Traverser.Admin<S> start = this.starts.next();
+        if (start.get() instanceof Attachable && this.getTraversal().getGraph().isPresent())
+            start.set(((Attachable<S>) start.get()).attach(Attachable.Method.get(this.getTraversal().getGraph().get())));
+        return start;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/79b621c9/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/InjectStepTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/InjectStepTest.java
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/InjectStepTest.java
index fd72b1b..fced802 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/InjectStepTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/InjectStepTest.java
@@ -33,7 +33,10 @@ public class InjectStepTest extends StepTest {
     @Override
     protected List<Traversal> getTraversals() {
         return Arrays.asList(
-                __.identity()
+                __.identity(),
+                __.inject("a", "b"),
+                __.inject("a"),
+                __.inject("b")
         );
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/79b621c9/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
index 0f8c06b..1071493 100644
--- a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
@@ -67,7 +67,8 @@ class TestDriverRemoteConnection(object):
         # # todo: need a traversal metrics deserializer
         g.V().out().profile().next()
         # #
-        results = g.V().has('name','peter').as_('a').out('created').as_('b').select('a','b').by(__.valueMap()).toList()
+        results = g.V().has('name', 'peter').as_('a').out('created').as_('b').select('a',
'b').by(
+            __.valueMap()).toList()
         assert 1 == len(results)
         assert 'peter' == results[0]['a']['name'][0]
         assert 35 == results[0]['a']['age'][0]
@@ -75,6 +76,11 @@ class TestDriverRemoteConnection(object):
         assert 'java' == results[0]['b']['lang'][0]
         assert 2 == len(results[0]['a'])
         assert 2 == len(results[0]['b'])
+        # #
+        results = g.V(1).inject(g.V(2).next()).values('name').toList()
+        assert 2 == len(results)
+        assert 'marko' in results
+        assert 'vadas' in results
 
     def test_strategies(self, remote_connection):
         statics.load_statics(globals())
@@ -169,13 +175,13 @@ class TestDriverRemoteConnection(object):
         assert "knows" == edge.label
         assert a == edge.outV
         assert b == edge.inV
-        g.V().has("name","marko").outE("knows").where(__.inV().has("name","peter")).drop().iterate()
+        g.V().has("name", "marko").outE("knows").where(__.inV().has("name", "peter")).drop().iterate()
         ##
         edge = g.withSideEffect("a", a).withSideEffect("b", b).V().limit(1).addE("knows").from_("a").to("b").next()
         assert "knows" == edge.label
         assert a == edge.outV
         assert b == edge.inV
-        g.V().has("name","marko").outE("knows").where(__.inV().has("name","peter")).drop().iterate()
+        g.V().has("name", "marko").outE("knows").where(__.inV().has("name", "peter")).drop().iterate()
 
     def test_side_effect_close(self, remote_connection):
         g = Graph().traversal().withRemote(remote_connection)


Mime
View raw message