You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2015/11/24 16:26:28 UTC
[1/3] incubator-tinkerpop git commit: TINKERPOP3-984
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master 46bacb3af -> 4b60ff088
TINKERPOP3-984
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/d7c58b31
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/d7c58b31
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/d7c58b31
Branch: refs/heads/master
Commit: d7c58b3112ce22137c54a080e2ad55f85997be85
Parents: 420de5c
Author: Marvin Froeder <ve...@gmail.com>
Authored: Sat Nov 21 13:33:34 2015 +1300
Committer: Marvin Froeder <ve...@gmail.com>
Committed: Sat Nov 21 14:17:21 2015 +1300
----------------------------------------------------------------------
.../groovy/loaders/SugarLoaderTest.groovy | 10 +++---
.../GremlinGroovyScriptEngineIntegrateTest.java | 3 +-
.../GremlinGroovyScriptEngineOverGraphTest.java | 34 ++++++++++++--------
...GroovyScriptEngineSandboxedStandardTest.java | 20 ++++++++----
...nGroovyScriptEngineTinkerPopSandboxTest.java | 5 +--
5 files changed, 44 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d7c58b31/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy
index 19f0da2..d9bb8d7 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy
@@ -78,11 +78,11 @@ class SugarLoaderTest extends AbstractGremlinTest {
assertEquals(6, g.V.count.next())
assertEquals(6, g.V.out.count.next())
assertEquals(6, g.V.out.name.count.next())
- assertEquals(2, g.V(1).out.out.name.count.next());
- g.V(1).next().name = 'okram'
- assertEquals('okram', g.V(1).next().name);
- g.V(1).next()['name'] = 'marko a. rodriguez'
- assertEquals(["okram", "marko a. rodriguez"] as Set, g.V(1).values('name').toSet());
+ assertEquals(2, g.V(graphProvider.convertId(1, Vertex.class)).out.out.name.count.next());
+ g.V(graphProvider.convertId(1, Vertex.class)).next().name = 'okram'
+ assertEquals('okram', g.V(graphProvider.convertId(1, Vertex.class)).next().name);
+ g.V(graphProvider.convertId(1, Vertex.class)).next()['name'] = 'marko a. rodriguez'
+ assertEquals(["okram", "marko a. rodriguez"] as Set, g.V(graphProvider.convertId(1, Vertex.class)).values('name').toSet());
assertEquals(29, g.V.age.is(eq(29)).next())
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d7c58b31/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineIntegrateTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineIntegrateTest.java
index d9144b6..ad65a38 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineIntegrateTest.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineIntegrateTest.java
@@ -20,6 +20,7 @@ package org.apache.tinkerpop.gremlin.groovy.jsr223;
import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
import org.apache.tinkerpop.gremlin.LoadGraphWith;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
import javax.script.Bindings;
@@ -51,7 +52,7 @@ public class GremlinGroovyScriptEngineIntegrateTest extends AbstractGremlinTest
for (int ix = 0; ix < 50001; ix++) {
final Bindings bindings = engine.createBindings();
bindings.put("g", g);
- bindings.put("xxx", (ix % 4) + 1);
+ bindings.put("xxx", graphProvider.convertId((ix % 4) + 1, Vertex.class));
engine.eval(gremlins[ix % 4], bindings);
if (ix > 0 && ix % 5000 == 0) {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d7c58b31/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineOverGraphTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineOverGraphTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineOverGraphTest.java
index 7de26db..8f2120a 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineOverGraphTest.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineOverGraphTest.java
@@ -62,9 +62,10 @@ public class GremlinGroovyScriptEngineOverGraphTest extends AbstractGremlinTest
final ScriptEngine engine = new GremlinGroovyScriptEngine();
final List list = new ArrayList();
engine.put("g", g);
+ engine.put("marko", convertToVertexId("marko"));
engine.put("temp", list);
assertEquals(list.size(), 0);
- engine.eval("g.V(" + convertToVertexId("marko") +").out().fill(temp)");
+ engine.eval("g.V(marko).out().fill(temp)");
assertEquals(list.size(), 3);
}
@@ -122,7 +123,8 @@ public class GremlinGroovyScriptEngineOverGraphTest extends AbstractGremlinTest
public void shouldProperlyHandleBindings() throws Exception {
final ScriptEngine engine = new GremlinGroovyScriptEngine();
engine.put("g", g);
- Assert.assertEquals(g.V(convertToVertexId("marko")).next(), engine.eval("g.V(" + convertToVertexId("marko") + ").next()"));
+ engine.put("marko", convertToVertexId("marko"));
+ Assert.assertEquals(g.V(convertToVertexId("marko")).next(), engine.eval("g.V(marko).next()"));
final Bindings bindings = engine.createBindings();
bindings.put("g", g);
@@ -146,7 +148,8 @@ public class GremlinGroovyScriptEngineOverGraphTest extends AbstractGremlinTest
public void shouldClearBindingsBetweenEvals() throws Exception {
final ScriptEngine engine = new GremlinGroovyScriptEngine();
engine.put("g", g);
- assertEquals(g.V(convertToVertexId("marko")).next(), engine.eval("g.V(" + convertToVertexId("marko") + ").next()"));
+ engine.put("marko", convertToVertexId("marko"));
+ assertEquals(g.V(convertToVertexId("marko")).next(), engine.eval("g.V(marko).next()"));
final Bindings bindings = engine.createBindings();
bindings.put("g", g);
@@ -240,26 +243,29 @@ public class GremlinGroovyScriptEngineOverGraphTest extends AbstractGremlinTest
final Bindings bindings = engine.createBindings();
bindings.put("g", g);
+ bindings.put("marko", convertToVertexId("marko"));
+ bindings.put("vadas", convertToVertexId("vadas"));
// strong referenced global closure
engine.eval("def isVadas(v){v.value('name')=='vadas'}", bindings);
- assertEquals(true, engine.eval("isVadas(g.V(" + convertToVertexId("vadas") + ").next())", bindings));
+ assertEquals(true, engine.eval("isVadas(g.V(vadas).next())", bindings));
// phantom referenced global closure
bindings.put(GremlinGroovyScriptEngine.KEY_REFERENCE_TYPE, GremlinGroovyScriptEngine.REFERENCE_TYPE_PHANTOM);
engine.eval("def isMarko(v){v.value('name')=='marko'}", bindings);
try {
- engine.eval("isMarko(g.V(" + convertToVertexId("marko") + ").next())", bindings);
+ engine.eval("isMarko(g.V(marko).next())", bindings);
fail("the isMarko function should not be present");
} catch (Exception ex) {
}
- assertEquals(true, engine.eval("def isMarko(v){v.value('name')=='marko'}; isMarko(g.V(" + convertToVertexId("marko") + ").next())", bindings));
+ assertEquals(true, engine.eval("def isMarko(v){v.value('name')=='marko'}; isMarko(g.V(marko).next())", bindings));
try {
- engine.eval("isMarko(g.V(" + convertToVertexId("marko") + ").next())", bindings);
+ engine.eval("isMarko(g.V(marko"
+ + ").next())", bindings);
fail("the isMarko function should not be present");
} catch (Exception ex) {
@@ -268,7 +274,7 @@ public class GremlinGroovyScriptEngineOverGraphTest extends AbstractGremlinTest
bindings.remove(GremlinGroovyScriptEngine.KEY_REFERENCE_TYPE);
// isVadas class was a hard reference so it should still be hanging about
- assertEquals(true, engine.eval("isVadas(g.V(" + convertToVertexId("vadas") + ").next())", bindings));
+ assertEquals(true, engine.eval("isVadas(g.V(vadas).next())", bindings));
}
@Test
@@ -279,6 +285,7 @@ public class GremlinGroovyScriptEngineOverGraphTest extends AbstractGremlinTest
final Bindings bindings = engine.createBindings();
bindings.put("g", g);
bindings.put("#jsr223.groovy.engine.keep.globals", "phantom");
+ bindings.put("vadas", convertToVertexId("vadas"));
// this works on its own when the function and the line that uses it is in one "script". this is the
// current workaround
@@ -289,7 +296,7 @@ public class GremlinGroovyScriptEngineOverGraphTest extends AbstractGremlinTest
// validate that isVadas throws an exception since it is not defined
try {
- engine.eval("isVadas(g.V(" + convertToVertexId("vadas") + ").next())", bindings);
+ engine.eval("isVadas(g.V(vadas).next())", bindings);
// fail the test if the above doesn't throw an exception
fail();
@@ -302,7 +309,7 @@ public class GremlinGroovyScriptEngineOverGraphTest extends AbstractGremlinTest
engine.eval("def isVadas(v){v.value('name')=='vadas'}", bindings);
// make sure the function works on its own...no problem
- assertEquals(true, engine.eval("isVadas(g.V(" + convertToVertexId("vadas") + ").next())", bindings));
+ assertEquals(true, engine.eval("isVadas(g.V(vadas).next())", bindings));
// make sure the function works in a closure...this generates a StackOverflowError
assertEquals(g.V(convertToVertexId("vadas")).next(), engine.eval("g.V().filter{isVadas(it.get())}.next()", bindings));
@@ -316,16 +323,17 @@ public class GremlinGroovyScriptEngineOverGraphTest extends AbstractGremlinTest
final Bindings bindings = engine.createBindings();
bindings.put("g", g);
+ bindings.put("vadas", convertToVertexId("vadas"));
// works when it's all defined together
- assertEquals(true, engine.eval("class c { static def isVadas(v){v.value('name')=='vadas'}};c.isVadas(g.V(" + convertToVertexId("vadas") + ").next())", bindings));
+ assertEquals(true, engine.eval("class c { static def isVadas(v){v.value('name')=='vadas'}};c.isVadas(g.V(vadas).next())", bindings));
// let's reset this piece and make sure isVadas is not hanging around.
engine.reset();
// validate that isVadas throws an exception since it is not defined
try {
- engine.eval("c.isVadas(g.V(" + convertToVertexId("vadas") + ").next())", bindings);
+ engine.eval("c.isVadas(g.V(vadas).next())", bindings);
// fail the test if the above doesn't throw an exception
fail("Function should be gone");
@@ -344,7 +352,7 @@ public class GremlinGroovyScriptEngineOverGraphTest extends AbstractGremlinTest
engine.eval("class c { static def isVadas(v){v.name=='vadas'}};null;", bindings);
// make sure the class works on its own...this generates: groovy.lang.MissingPropertyException: No such property: c for class: Script2
- assertEquals(true, engine.eval("c.isVadas(g.V(" + convertToVertexId("vadas") + ").next())", bindings));
+ assertEquals(true, engine.eval("c.isVadas(g.V(vadas).next())", bindings));
}
@Test
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d7c58b31/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineSandboxedStandardTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineSandboxedStandardTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineSandboxedStandardTest.java
index be8ec00..53f3814 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineSandboxedStandardTest.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineSandboxedStandardTest.java
@@ -65,13 +65,15 @@ public class GremlinGroovyScriptEngineSandboxedStandardTest extends AbstractGrem
try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine()) {
final Bindings bindings = engine.createBindings();
bindings.put("g", g);
- assertEquals(g.V(convertToVertexId("marko")).next(), engine.eval("g.V(" + convertToVertexId("marko") + ").next()", bindings));
+ bindings.put("marko", convertToVertexId("marko"));
+ assertEquals(g.V(convertToVertexId("marko")).next(), engine.eval("g.V(marko).next()", bindings));
}
try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(notSandboxed)) {
final Bindings bindings = engine.createBindings();
bindings.put("g", g);
- engine.eval("g.V(" + convertToVertexId("marko") + ").next()", bindings);
+ bindings.put("marko", convertToVertexId("marko"));
+ engine.eval("g.V(marko).next()", bindings);
fail("Type checking should have forced an error as 'g' is not defined");
} catch (Exception ex) {
assertEquals(MultipleCompilationErrorsException.class, ex.getCause().getClass());
@@ -81,8 +83,9 @@ public class GremlinGroovyScriptEngineSandboxedStandardTest extends AbstractGrem
try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(sandboxed)) {
final Bindings bindings = engine.createBindings();
bindings.put("g", g);
- assertEquals(g.V(convertToVertexId("marko")).next(), engine.eval("g.V(" + convertToVertexId("marko") + ").next()", bindings));
- assertEquals(g.V(convertToVertexId("marko")).out("created").count().next(), engine.eval("g.V(" + convertToVertexId("marko") + ").out(\"created\").count().next()", bindings));
+ bindings.put("marko", convertToVertexId("marko"));
+ assertEquals(g.V(convertToVertexId("marko")).next(), engine.eval("g.V(marko).next()", bindings));
+ assertEquals(g.V(convertToVertexId("marko")).out("created").count().next(), engine.eval("g.V(marko).out(\"created\").count().next()", bindings));
}
}
@@ -92,13 +95,15 @@ public class GremlinGroovyScriptEngineSandboxedStandardTest extends AbstractGrem
try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine()) {
final Bindings bindings = engine.createBindings();
bindings.put("graph", graph);
- assertEquals(graph.vertices(convertToVertexId("marko")).next(), engine.eval("graph.vertices(" + convertToVertexId("marko") + ").next()", bindings));
+ bindings.put("marko", convertToVertexId("marko"));
+ assertEquals(graph.vertices(convertToVertexId("marko")).next(), engine.eval("graph.vertices(marko).next()", bindings));
}
try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(notSandboxed)) {
final Bindings bindings = engine.createBindings();
bindings.put("graph", graph);
- assertEquals(graph.vertices(convertToVertexId("marko")).next(), engine.eval("graph.vertices(" + convertToVertexId("marko") + ").next()", bindings));
+ bindings.put("marko", convertToVertexId("marko"));
+ assertEquals(graph.vertices(convertToVertexId("marko")).next(), engine.eval("graph.vertices(marko).next()", bindings));
fail("Type checking should have forced an error as 'graph' is not defined");
} catch (Exception ex) {
assertEquals(MultipleCompilationErrorsException.class, ex.getCause().getClass());
@@ -119,7 +124,8 @@ public class GremlinGroovyScriptEngineSandboxedStandardTest extends AbstractGrem
try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(sandboxed)) {
final Bindings bindings = engine.createBindings();
bindings.put("graph", graph);
- assertEquals(graph.vertices(convertToVertexId("marko")).next(), engine.eval("graph.vertices(" + convertToVertexId("marko") + ").next()", bindings));
+ bindings.put("marko", convertToVertexId("marko"));
+ assertEquals(graph.vertices(convertToVertexId("marko")).next(), engine.eval("graph.vertices(marko).next()", bindings));
}
try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(sandboxed)) {
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d7c58b31/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTinkerPopSandboxTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTinkerPopSandboxTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTinkerPopSandboxTest.java
index 34fbd38..ae90b78 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTinkerPopSandboxTest.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTinkerPopSandboxTest.java
@@ -56,8 +56,9 @@ public class GremlinGroovyScriptEngineTinkerPopSandboxTest extends AbstractGreml
try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox)) {
final Bindings bindings = engine.createBindings();
bindings.put("g", g);
- assertEquals(g.V(convertToVertexId("marko")).next(), engine.eval("g.V(" + convertToVertexId("marko") + ").next()", bindings));
- assertEquals(g.V(convertToVertexId("marko")).out("created").count().next(), engine.eval("g.V(" + convertToVertexId("marko") + ").out(\"created\").count().next()", bindings));
+ bindings.put("marko", convertToVertexId("marko"));
+ assertEquals(g.V(convertToVertexId("marko")).next(), engine.eval("g.V(marko).next()", bindings));
+ assertEquals(g.V(convertToVertexId("marko")).out("created").count().next(), engine.eval("g.V(marko).out(\"created\").count().next()", bindings));
}
}
[2/3] incubator-tinkerpop git commit: Merge branch 'TINKERPOP3-984'
of github.com:velo/incubator-tinkerpop
Posted by ok...@apache.org.
Merge branch 'TINKERPOP3-984' of github.com:velo/incubator-tinkerpop
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/8991f20f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/8991f20f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/8991f20f
Branch: refs/heads/master
Commit: 8991f20f518fc3595626377bf76467636420f71c
Parents: 46bacb3 d7c58b3
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Nov 24 07:03:38 2015 -0700
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Nov 24 07:03:38 2015 -0700
----------------------------------------------------------------------
.../groovy/loaders/SugarLoaderTest.groovy | 10 +++---
.../GremlinGroovyScriptEngineIntegrateTest.java | 3 +-
.../GremlinGroovyScriptEngineOverGraphTest.java | 34 ++++++++++++--------
...GroovyScriptEngineSandboxedStandardTest.java | 20 ++++++++----
...nGroovyScriptEngineTinkerPopSandboxTest.java | 5 +--
5 files changed, 44 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
[3/3] incubator-tinkerpop git commit: we had a back('x') in one of
our SugarLoader tests. Crazy. Also,
tweaks the Groovy tests as recommended by @dkuppitz. Created a
TinkerGraphUUIDProvider which makes sure that complex objects work right. All
tests pass
Posted by ok...@apache.org.
we had a back('x') in one of our SugarLoader tests. Crazy. Also, tweaks the Groovy tests as recommended by @dkuppitz. Created a TinkerGraphUUIDProvider which makes sure that complex objects work right. All tests pass.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/4b60ff08
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/4b60ff08
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/4b60ff08
Branch: refs/heads/master
Commit: 4b60ff088614fba20e94739b4e479d5de5174da5
Parents: 8991f20
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Nov 24 08:26:22 2015 -0700
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Nov 24 08:26:22 2015 -0700
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
.../groovy/loaders/SugarLoaderTest.groovy | 23 +++++---
.../GremlinGroovyScriptEngineOverGraphTest.java | 10 ++--
.../tinkergraph/TinkerGraphProvider.java | 8 +--
.../tinkergraph/TinkerGraphUUIDProvider.java | 57 ++++++++++++++++++++
.../TinkerGraphUUIDGroovyEnvironmentTest.java | 38 +++++++++++++
6 files changed, 121 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4b60ff08/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index e179533..aa4f4f5 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/incubator-tinkerpop/master/docs/
TinkerPop 3.1.1 (NOT OFFICIALLY RELEASED YET)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* Fixed various Gremlin-Groovy tests that assumed `toString()`-able ids.
* Split TinkerPop documentation into different directories.
* Added `explain()`-step which yields a `TraversalExplanation` with a pretty `toString()` detailing the compilation process.
* Fixed a traversal strategy ordering bug in `AdjacentToIncidentStrategy` and `IncidentToAdjacentStrategy`.
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4b60ff08/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy
index d9bb8d7..5fec65a 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy
@@ -21,12 +21,13 @@ package org.apache.tinkerpop.gremlin.groovy.loaders
import org.apache.tinkerpop.gremlin.AbstractGremlinTest
import org.apache.tinkerpop.gremlin.LoadGraphWith
import org.apache.tinkerpop.gremlin.groovy.util.SugarTestHelper
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal
import org.apache.tinkerpop.gremlin.structure.*
import org.apache.tinkerpop.gremlin.structure.util.StringFactory
import org.junit.Test
+import static org.apache.tinkerpop.gremlin.process.traversal.P.eq
import static org.junit.Assert.*
-import static org.apache.tinkerpop.gremlin.process.traversal.P.*
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -78,20 +79,26 @@ class SugarLoaderTest extends AbstractGremlinTest {
assertEquals(6, g.V.count.next())
assertEquals(6, g.V.out.count.next())
assertEquals(6, g.V.out.name.count.next())
- assertEquals(2, g.V(graphProvider.convertId(1, Vertex.class)).out.out.name.count.next());
- g.V(graphProvider.convertId(1, Vertex.class)).next().name = 'okram'
- assertEquals('okram', g.V(graphProvider.convertId(1, Vertex.class)).next().name);
- g.V(graphProvider.convertId(1, Vertex.class)).next()['name'] = 'marko a. rodriguez'
- assertEquals(["okram", "marko a. rodriguez"] as Set, g.V(graphProvider.convertId(1, Vertex.class)).values('name').toSet());
+ assertEquals(2, g.V(convertToVertexId("marko")).out.out.name.count.next());
+ final Object markoId = convertToVertexId(graph, "marko");
+ g.V(markoId).next().name = 'okram'
+ assertEquals('okram', g.V(markoId).next().name);
assertEquals(29, g.V.age.is(eq(29)).next())
+ if (graph.features().vertex().supportsMultiProperties()) {
+ g.V(markoId).next()['name'] = 'marko a. rodriguez'
+ assertEquals(["okram", "marko a. rodriguez"] as Set, g.V(markoId).values('name').toSet());
+ }
}
@Test
@LoadGraphWith(LoadGraphWith.GraphData.MODERN)
public void shouldUseTraverserCategoryCorrectly() {
SugarLoader.load()
- g.V.as('a').out.as('x').name.as('b').back('x').has('age').map { [it.a, it.b, it.age] }.forEach {
- // println it;
+ final Traversal t = g.V.as('a').out.as('x').name.as('b').select('x').has('age').map {
+ [it.path().a, it.path().b, it.age]
+ };
+ assertTrue(t.hasNext())
+ t.forEachRemaining {
assertTrue(it[0] instanceof Vertex)
assertTrue(it[1] instanceof String)
assertTrue(it[2] instanceof Integer)
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4b60ff08/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineOverGraphTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineOverGraphTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineOverGraphTest.java
index 8f2120a..f1838ce 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineOverGraphTest.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineOverGraphTest.java
@@ -36,6 +36,7 @@ import javax.script.Bindings;
import javax.script.CompiledScript;
import javax.script.ScriptEngine;
import javax.script.ScriptException;
+import javax.script.SimpleBindings;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@@ -61,11 +62,12 @@ public class GremlinGroovyScriptEngineOverGraphTest extends AbstractGremlinTest
public void shouldDoSomeGremlin() throws Exception {
final ScriptEngine engine = new GremlinGroovyScriptEngine();
final List list = new ArrayList();
- engine.put("g", g);
- engine.put("marko", convertToVertexId("marko"));
- engine.put("temp", list);
+ final Bindings bindings = engine.createBindings();
+ bindings.put("g", g);
+ bindings.put("marko", convertToVertexId("marko"));
+ bindings.put("temp", list);
assertEquals(list.size(), 0);
- engine.eval("g.V(marko).out().fill(temp)");
+ engine.eval("g.V(marko).out().fill(temp)",bindings);
assertEquals(list.size(), 3);
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4b60ff08/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java
index fd3c160..fcb5fe6 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java
@@ -100,14 +100,14 @@ public class TinkerGraphProvider extends AbstractGraphProvider {
/**
* Determines if a test requires TinkerGraph persistence to be configured with graph location and format.
*/
- private static boolean requiresPersistence(final Class<?> test, final String testMethodName) {
+ protected static boolean requiresPersistence(final Class<?> test, final String testMethodName) {
return test == GraphTest.class && testMethodName.equals("shouldPersistDataOnClose");
}
/**
* Determines if a test requires a different cardinality as the default or not.
*/
- private static boolean requiresListCardinalityAsDefault(final LoadGraphWith.GraphData loadGraphWith,
+ protected static boolean requiresListCardinalityAsDefault(final LoadGraphWith.GraphData loadGraphWith,
final Class<?> test, final String testMethodName) {
return loadGraphWith == LoadGraphWith.GraphData.CREW
|| (test == StarGraphTest.class && testMethodName.equals("shouldAttachWithCreateMethod"))
@@ -117,7 +117,7 @@ public class TinkerGraphProvider extends AbstractGraphProvider {
/**
* Some tests require special configuration for TinkerGraph to properly configure the id manager.
*/
- private TinkerGraph.DefaultIdManager selectIdMakerFromTest(final Class<?> test, final String testMethodName) {
+ protected TinkerGraph.DefaultIdManager selectIdMakerFromTest(final Class<?> test, final String testMethodName) {
if (test.equals(GraphTest.class)) {
final Set<String> testsThatNeedLongIdManager = new HashSet<String>(){{
add("shouldIterateVerticesWithNumericIdSupportUsingDoubleRepresentation");
@@ -180,7 +180,7 @@ public class TinkerGraphProvider extends AbstractGraphProvider {
* Test that load with specific graph data can be configured with a specific id manager as the data type to
* be used in the test for that graph is known.
*/
- private TinkerGraph.DefaultIdManager selectIdMakerFromGraphData(final LoadGraphWith.GraphData loadGraphWith) {
+ protected TinkerGraph.DefaultIdManager selectIdMakerFromGraphData(final LoadGraphWith.GraphData loadGraphWith) {
if (null == loadGraphWith) return TinkerGraph.DefaultIdManager.ANY;
if (loadGraphWith.equals(LoadGraphWith.GraphData.CLASSIC))
return TinkerGraph.DefaultIdManager.INTEGER;
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4b60ff08/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphUUIDProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphUUIDProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphUUIDProvider.java
new file mode 100644
index 0000000..6025fe9
--- /dev/null
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphUUIDProvider.java
@@ -0,0 +1,57 @@
+/*
+ * 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.tinkergraph;
+
+import org.apache.tinkerpop.gremlin.LoadGraphWith;
+import org.apache.tinkerpop.gremlin.TestHelper;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class TinkerGraphUUIDProvider extends TinkerGraphProvider {
+
+ @Override
+ public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName,
+ final LoadGraphWith.GraphData loadGraphWith) {
+ final TinkerGraph.DefaultIdManager idManager = TinkerGraph.DefaultIdManager.UUID;
+ final String idMaker = idManager.name();
+ return new HashMap<String, Object>() {{
+ put(Graph.GRAPH, TinkerGraph.class.getName());
+ put(TinkerGraph.GREMLIN_TINKERGRAPH_VERTEX_ID_MANAGER, idMaker);
+ put(TinkerGraph.GREMLIN_TINKERGRAPH_EDGE_ID_MANAGER, idMaker);
+ put(TinkerGraph.GREMLIN_TINKERGRAPH_VERTEX_PROPERTY_ID_MANAGER, idMaker);
+ if (requiresListCardinalityAsDefault(loadGraphWith, test, testMethodName))
+ put(TinkerGraph.GREMLIN_TINKERGRAPH_DEFAULT_VERTEX_PROPERTY_CARDINALITY, VertexProperty.Cardinality.list.name());
+ if (requiresPersistence(test, testMethodName)) {
+ put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_FORMAT, "gryo");
+ final File tempDir = TestHelper.makeTestDataPath(test, "temp");
+ put(TinkerGraph.GREMLIN_TINKERGRAPH_GRAPH_LOCATION,
+ tempDir.getAbsolutePath() + File.separator + testMethodName + ".kryo");
+ }
+ }};
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4b60ff08/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/groovy/TinkerGraphUUIDGroovyEnvironmentTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/groovy/TinkerGraphUUIDGroovyEnvironmentTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/groovy/TinkerGraphUUIDGroovyEnvironmentTest.java
new file mode 100644
index 0000000..a3dfad7
--- /dev/null
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/groovy/TinkerGraphUUIDGroovyEnvironmentTest.java
@@ -0,0 +1,38 @@
+/*
+ * 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.tinkergraph.structure.groovy;
+
+import org.apache.tinkerpop.gremlin.GraphProviderClass;
+import org.apache.tinkerpop.gremlin.groovy.GroovyEnvironmentSuite;
+import org.apache.tinkerpop.gremlin.groovy.loaders.SugarLoader;
+import org.apache.tinkerpop.gremlin.tinkergraph.TinkerGraphUUIDProvider;
+import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+@RunWith(GroovyEnvironmentSuite.class)
+@GraphProviderClass(provider = TinkerGraphUUIDProvider.class, graph = TinkerGraph.class)
+public class TinkerGraphUUIDGroovyEnvironmentTest {
+ static {
+ SugarLoader.load();
+ }
+}
\ No newline at end of file