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 2015/03/11 19:26:37 UTC
[21/50] [abbrv] incubator-tinkerpop git commit: more more tests..
more more tests..
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/899429cc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/899429cc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/899429cc
Branch: refs/heads/master
Commit: 899429cc86fc624583c3ea38eb95b776d208dd57
Parents: da955b4
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Mon Mar 9 16:02:33 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Mon Mar 9 16:02:33 2015 -0600
----------------------------------------------------------------------
.../generator/CommunityGeneratorTest.java | 58 +++----
.../generator/DistributionGeneratorTest.java | 18 +--
.../graph/traversal/step/map/BackTest.java | 6 +-
.../graph/traversal/step/map/MatchTest.java | 90 +++++------
.../traversal/step/sideEffect/TreeTest.java | 10 +-
.../tinkerpop/gremlin/structure/EdgeTest.java | 42 +++---
.../tinkerpop/gremlin/structure/GraphTest.java | 143 +++++++-----------
.../structure/GraphWritePerformanceTest.java | 18 +--
.../gremlin/structure/PropertyTest.java | 74 ++++-----
.../strategy/PartitionStrategyTest.java | 36 ++---
.../strategy/ReadOnlyStrategyTest.java | 46 +++---
.../structure/strategy/StrategyGraphTest.java | 116 +++++++-------
.../strategy/SubgraphStrategyTest.java | 150 +++++++++----------
.../util/detached/DetachedPropertyTest.java | 4 +-
.../structure/io/script/ScriptRecordReader.java | 18 +--
15 files changed, 397 insertions(+), 432 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/899429cc/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/CommunityGeneratorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/CommunityGeneratorTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/CommunityGeneratorTest.java
index e015ca4..8414bd5 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/CommunityGeneratorTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/CommunityGeneratorTest.java
@@ -18,13 +18,13 @@
*/
package org.apache.tinkerpop.gremlin.algorithm.generator;
+import org.apache.commons.configuration.Configuration;
import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
import org.apache.tinkerpop.gremlin.FeatureRequirementSet;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.util.StreamFactory;
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
-import org.apache.commons.configuration.Configuration;
import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;
@@ -83,26 +83,26 @@ public class CommunityGeneratorTest {
@FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
public void shouldGenerateDifferentGraph() throws Exception {
final Configuration configuration = graphProvider.newGraphConfiguration("g1", this.getClass(), name.getMethodName());
- final Graph g1 = graphProvider.openTestGraph(configuration);
+ final Graph graph1 = graphProvider.openTestGraph(configuration);
try {
- communityGeneratorTest(g, () -> 123456789l);
+ communityGeneratorTest(graph, () -> 123456789l);
- afterLoadGraphWith(g1);
- communityGeneratorTest(g1, () -> 987654321l);
+ afterLoadGraphWith(graph1);
+ communityGeneratorTest(graph1, () -> 987654321l);
- assertTrue(g.E().count().next() > 0);
- assertTrue(g.V().count().next() > 0);
- assertTrue(g1.E().count().next() > 0);
- assertTrue(g1.V().count().next() > 0);
+ assertTrue(IteratorUtils.count(graph.edges()) > 0);
+ assertTrue(IteratorUtils.count(graph.vertices()) > 0);
+ assertTrue(IteratorUtils.count(graph1.edges()) > 0);
+ assertTrue(IteratorUtils.count(graph1.vertices()) > 0);
// don't assert counts of edges...those may be the same, just ensure that not every vertex has the
// same number of edges between graphs. that should make it harder for the test to fail.
- assertFalse(same(g, g1));
+ assertFalse(same(graph, graph1));
} catch (Exception ex) {
throw ex;
} finally {
- graphProvider.clear(g1, configuration);
+ graphProvider.clear(graph1, configuration);
}
assertFalse(failures.get() >= ultimateFailureThreshold);
@@ -112,26 +112,26 @@ public class CommunityGeneratorTest {
@FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
public void shouldGenerateSameGraph() throws Exception {
final Configuration configuration = graphProvider.newGraphConfiguration("g1", this.getClass(), name.getMethodName());
- final Graph g1 = graphProvider.openTestGraph(configuration);
+ final Graph graph1 = graphProvider.openTestGraph(configuration);
try {
- communityGeneratorTest(g, () -> 123456789l);
+ communityGeneratorTest(graph, () -> 123456789l);
- afterLoadGraphWith(g1);
- communityGeneratorTest(g1, () -> 123456789l);
+ afterLoadGraphWith(graph1);
+ communityGeneratorTest(graph1, () -> 123456789l);
- assertTrue(g.E().count().next() > 0);
- assertTrue(g.V().count().next() > 0);
- assertTrue(g1.E().count().next() > 0);
- assertTrue(g1.V().count().next() > 0);
- assertEquals(g.E().count().next(), g1.E().count().next());
+ assertTrue(IteratorUtils.count(graph.edges()) > 0);
+ assertTrue(IteratorUtils.count(graph.vertices()) > 0);
+ assertTrue(IteratorUtils.count(graph1.edges()) > 0);
+ assertTrue(IteratorUtils.count(graph1.vertices()) > 0);
+ assertEquals(IteratorUtils.count(graph.edges()), IteratorUtils.count(graph1.edges()));
// ensure that every vertex has the same number of edges between graphs.
- assertTrue(same(g, g1));
+ assertTrue(same(graph, graph1));
} catch (Exception ex) {
throw ex;
} finally {
- graphProvider.clear(g1, configuration);
+ graphProvider.clear(graph1, configuration);
}
assertFalse(failures.get() >= ultimateFailureThreshold);
@@ -145,7 +145,7 @@ public class CommunityGeneratorTest {
}
protected Iterable<Vertex> verticesByOid(final Graph graph) {
- List<Vertex> vertices = graph.V().toList();
+ List<Vertex> vertices = IteratorUtils.list(graph.vertices());
Collections.sort(vertices,
(v1, v2) -> ((Integer) v1.value("oid")).compareTo((Integer) v2.value("oid")));
return vertices;
@@ -193,7 +193,7 @@ public class CommunityGeneratorTest {
@FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
public void shouldProcessVerticesEdges() {
final Distribution dist = new NormalDistribution(2);
- final CommunityGenerator generator = CommunityGenerator.build(g)
+ final CommunityGenerator generator = CommunityGenerator.build(graph)
.label("knows")
.edgeProcessor(e -> e.<String>property("data", "test"))
.vertexProcessor((v, m) -> {
@@ -207,11 +207,11 @@ public class CommunityGeneratorTest {
.expectedNumEdges(1000).create();
final long edgesGenerated = generator.generate();
assertTrue(edgesGenerated > 0);
- tryCommit(g, g -> {
- assertEquals(new Long(edgesGenerated), new Long(IteratorUtils.count(g.edges())));
- assertTrue(IteratorUtils.count(g.vertices()) > 0);
- assertTrue(StreamFactory.stream(g.edges()).allMatch(e -> e.value("data").equals("test")));
- assertTrue(StreamFactory.stream(g.vertices()).allMatch(
+ tryCommit(graph, graph -> {
+ assertEquals(new Long(edgesGenerated), new Long(IteratorUtils.count(graph.edges())));
+ assertTrue(IteratorUtils.count(graph.vertices()) > 0);
+ assertTrue(StreamFactory.stream(graph.edges()).allMatch(e -> e.value("data").equals("test")));
+ assertTrue(StreamFactory.stream(graph.vertices()).allMatch(
v -> v.value("test").equals("data") && v.property("communityIndex").isPresent()
));
});
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/899429cc/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/DistributionGeneratorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/DistributionGeneratorTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/DistributionGeneratorTest.java
index 2b67f91..d0f3d96 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/DistributionGeneratorTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/DistributionGeneratorTest.java
@@ -18,13 +18,13 @@
*/
package org.apache.tinkerpop.gremlin.algorithm.generator;
+import org.apache.commons.configuration.Configuration;
import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
import org.apache.tinkerpop.gremlin.FeatureRequirementSet;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.util.StreamFactory;
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
-import org.apache.commons.configuration.Configuration;
import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;
@@ -115,9 +115,9 @@ public class DistributionGeneratorTest {
final Configuration configuration = graphProvider.newGraphConfiguration("g1", this.getClass(), name.getMethodName());
final Graph g1 = graphProvider.openTestGraph(configuration);
try {
- final Iterable<Vertex> vordered = verticesByOid(g);
- final DistributionGenerator generator = makeGenerator(g).seedGenerator(() -> 123456789l).inVertices(vordered).outVertices(vordered).create();
- distributionGeneratorTest(g, generator);
+ final Iterable<Vertex> vordered = verticesByOid(graph);
+ final DistributionGenerator generator = makeGenerator(graph).seedGenerator(() -> 123456789l).inVertices(vordered).outVertices(vordered).create();
+ distributionGeneratorTest(graph, generator);
afterLoadGraphWith(g1);
final Iterable<Vertex> vordered1 = verticesByOid(g1);
@@ -125,7 +125,7 @@ public class DistributionGeneratorTest {
distributionGeneratorTest(g1, generator1);
// ensure that every vertex has the same number of edges between graphs.
- assertTrue(same(g, g1));
+ assertTrue(same(graph, g1));
} catch (Exception ex) {
throw ex;
} finally {
@@ -141,7 +141,7 @@ public class DistributionGeneratorTest {
}
protected Iterable<Vertex> verticesByOid(final Graph graph) {
- List<Vertex> vertices = graph.V().toList();
+ List<Vertex> vertices = IteratorUtils.list(graph.vertices());
Collections.sort(vertices,
(v1, v2) -> ((Integer) v1.value("oid")).compareTo((Integer) v2.value("oid")));
return vertices;
@@ -150,7 +150,7 @@ public class DistributionGeneratorTest {
private void distributionGeneratorTest(final Graph graph, final DistributionGenerator generator) {
final int numEdges = generator.generate();
assertTrue(numEdges > 0);
- tryCommit(graph, g -> assertEquals(new Long(numEdges), g.E().count().next()));
+ tryCommit(graph, g -> assertEquals(numEdges, IteratorUtils.count(g.edges())));
}
}
@@ -161,7 +161,7 @@ public class DistributionGeneratorTest {
@FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
public void shouldProcessEdges() {
final Distribution dist = new NormalDistribution(2);
- final DistributionGenerator generator = DistributionGenerator.build(g)
+ final DistributionGenerator generator = DistributionGenerator.build(graph)
.label("knows")
.edgeProcessor(e -> e.<String>property("data", "test"))
.outDistribution(dist)
@@ -169,7 +169,7 @@ public class DistributionGeneratorTest {
.expectedNumEdges(100).create();
final int edgesGenerated = generator.generate();
assertTrue(edgesGenerated > 0);
- tryCommit(g, g -> {
+ tryCommit(graph, g -> {
assertEquals(new Long(edgesGenerated), new Long(IteratorUtils.count(g.edges())));
assertTrue(IteratorUtils.count(g.vertices()) > 0);
assertTrue(StreamFactory.stream(g.edges()).allMatch(e -> e.value("data").equals("test")));
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/899429cc/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/BackTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/BackTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/BackTest.java
index f55acc9..d37f766 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/BackTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/BackTest.java
@@ -147,9 +147,9 @@ public abstract class BackTest extends AbstractGremlinProcessTest {
Traversal<Vertex, Vertex> traversal = get_g_V_asXhereXout_name_backXhereX();
printTraversalForm(traversal);
super.checkResults(new HashMap<Vertex, Long>() {{
- put(convertToVertex(g, "marko"), 3l);
- put(convertToVertex(g, "josh"), 2l);
- put(convertToVertex(g, "peter"), 1l);
+ put(convertToVertex(graph, "marko"), 3l);
+ put(convertToVertex(graph, "josh"), 2l);
+ put(convertToVertex(graph, "peter"), 1l);
}}, traversal);
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/899429cc/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MatchTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MatchTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MatchTest.java
index 3102db9..58af180 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MatchTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MatchTest.java
@@ -125,12 +125,12 @@ public abstract class MatchTest extends AbstractGremlinProcessTest {
final Traversal<Vertex, Map<String, Vertex>> traversal = get_g_V_matchXa_out_bX();
printTraversalForm(traversal);
assertResults(vertexToStr, traversal,
- new Bindings<Vertex>().put("a", convertToVertex(g, "marko")).put("b", convertToVertex(g, "lop")),
- new Bindings<Vertex>().put("a", convertToVertex(g, "marko")).put("b", convertToVertex(g, "josh")),
- new Bindings<Vertex>().put("a", convertToVertex(g, "marko")).put("b", convertToVertex(g, "vadas")),
- new Bindings<Vertex>().put("a", convertToVertex(g, "josh")).put("b", convertToVertex(g, "ripple")),
- new Bindings<Vertex>().put("a", convertToVertex(g, "josh")).put("b", convertToVertex(g, "lop")),
- new Bindings<Vertex>().put("a", convertToVertex(g, "peter")).put("b", convertToVertex(g, "lop")));
+ new Bindings<Vertex>().put("a", convertToVertex(graph, "marko")).put("b", convertToVertex(graph, "lop")),
+ new Bindings<Vertex>().put("a", convertToVertex(graph, "marko")).put("b", convertToVertex(graph, "josh")),
+ new Bindings<Vertex>().put("a", convertToVertex(graph, "marko")).put("b", convertToVertex(graph, "vadas")),
+ new Bindings<Vertex>().put("a", convertToVertex(graph, "josh")).put("b", convertToVertex(graph, "ripple")),
+ new Bindings<Vertex>().put("a", convertToVertex(graph, "josh")).put("b", convertToVertex(graph, "lop")),
+ new Bindings<Vertex>().put("a", convertToVertex(graph, "peter")).put("b", convertToVertex(graph, "lop")));
}
@Test
@@ -162,8 +162,8 @@ public abstract class MatchTest extends AbstractGremlinProcessTest {
final Traversal<Vertex, Map<String, Vertex>> traversal = get_g_V_matchXa_knows_b__b_created_cX();
printTraversalForm(traversal);
assertResults(vertexToStr, traversal,
- new Bindings<Vertex>().put("a", convertToVertex(g, "marko")).put("b", convertToVertex(g, "josh")).put("c", convertToVertex(g, "lop")),
- new Bindings<Vertex>().put("a", convertToVertex(g, "marko")).put("b", convertToVertex(g, "josh")).put("c", convertToVertex(g, "ripple")));
+ new Bindings<Vertex>().put("a", convertToVertex(graph, "marko")).put("b", convertToVertex(graph, "josh")).put("c", convertToVertex(graph, "lop")),
+ new Bindings<Vertex>().put("a", convertToVertex(graph, "marko")).put("b", convertToVertex(graph, "josh")).put("c", convertToVertex(graph, "ripple")));
}
@Test
@@ -172,8 +172,8 @@ public abstract class MatchTest extends AbstractGremlinProcessTest {
final Traversal<Vertex, Map<String, Vertex>> traversal = get_g_V_matchXa_knows_b__a_created_cX();
printTraversalForm(traversal);
assertResults(vertexToStr, traversal,
- new Bindings<Vertex>().put("a", convertToVertex(g, "marko")).put("b", convertToVertex(g, "vadas")).put("c", convertToVertex(g, "lop")),
- new Bindings<Vertex>().put("a", convertToVertex(g, "marko")).put("b", convertToVertex(g, "josh")).put("c", convertToVertex(g, "lop")));
+ new Bindings<Vertex>().put("a", convertToVertex(graph, "marko")).put("b", convertToVertex(graph, "vadas")).put("c", convertToVertex(graph, "lop")),
+ new Bindings<Vertex>().put("a", convertToVertex(graph, "marko")).put("b", convertToVertex(graph, "josh")).put("c", convertToVertex(graph, "lop")));
}
@Test
@@ -182,8 +182,8 @@ public abstract class MatchTest extends AbstractGremlinProcessTest {
final Traversal<Vertex, Map<String, Vertex>> traversal = get_g_V_matchXd_0knows_a__d_hasXname_vadasX__a_knows_b__b_created_cX();
printTraversalForm(traversal);
assertResults(vertexToStr, traversal,
- new Bindings<Vertex>().put("d", convertToVertex(g, "vadas")).put("a", convertToVertex(g, "marko")).put("b", convertToVertex(g, "josh")).put("c", convertToVertex(g, "lop")),
- new Bindings<Vertex>().put("d", convertToVertex(g, "vadas")).put("a", convertToVertex(g, "marko")).put("b", convertToVertex(g, "josh")).put("c", convertToVertex(g, "ripple")));
+ new Bindings<Vertex>().put("d", convertToVertex(graph, "vadas")).put("a", convertToVertex(graph, "marko")).put("b", convertToVertex(graph, "josh")).put("c", convertToVertex(graph, "lop")),
+ new Bindings<Vertex>().put("d", convertToVertex(graph, "vadas")).put("a", convertToVertex(graph, "marko")).put("b", convertToVertex(graph, "josh")).put("c", convertToVertex(graph, "ripple")));
}
@Test
@@ -298,8 +298,8 @@ public abstract class MatchTest extends AbstractGremlinProcessTest {
Traversal<Vertex, Map<String, Vertex>> traversal = get_g_V_matchXa_hasXname_GarciaX__a_0writtenBy_b__a_0sungBy_bX();
printTraversalForm(traversal);
assertResults(vertexToStr, traversal,
- new Bindings<Vertex>().put("a", convertToVertex(g, "Garcia")).put("b", convertToVertex(g, "CREAM PUFF WAR")),
- new Bindings<Vertex>().put("a", convertToVertex(g, "Garcia")).put("b", convertToVertex(g, "CRYPTICAL ENVELOPMENT")));
+ new Bindings<Vertex>().put("a", convertToVertex(graph, "Garcia")).put("b", convertToVertex(graph, "CREAM PUFF WAR")),
+ new Bindings<Vertex>().put("a", convertToVertex(graph, "Garcia")).put("b", convertToVertex(graph, "CRYPTICAL ENVELOPMENT")));
}
@Test
@@ -309,11 +309,11 @@ public abstract class MatchTest extends AbstractGremlinProcessTest {
printTraversalForm(traversal);
assertResults(vertexToStr, traversal,
new Bindings<Vertex>()
- .put("a", convertToVertex(g, "Garcia"))
- .put("b", convertToVertex(g, "I WANT TO TELL YOU"))
- .put("c", convertToVertex(g, "STIR IT UP"))
- .put("d", convertToVertex(g, "George_Harrison"))
- .put("e", convertToVertex(g, "Bob_Marley")));
+ .put("a", convertToVertex(graph, "Garcia"))
+ .put("b", convertToVertex(graph, "I WANT TO TELL YOU"))
+ .put("c", convertToVertex(graph, "STIR IT UP"))
+ .put("d", convertToVertex(graph, "George_Harrison"))
+ .put("e", convertToVertex(graph, "Bob_Marley")));
}
@Test
@@ -341,35 +341,35 @@ public abstract class MatchTest extends AbstractGremlinProcessTest {
printTraversalForm(traversal);
assertResults(vertexToStr, traversal,
new Bindings<Vertex>()
- .put("a", convertToVertex(g, "Garcia"))
- .put("b", convertToVertex(g, "CREAM PUFF WAR"))
- .put("c", convertToVertex(g, "CREAM PUFF WAR"))
- .put("d", convertToVertex(g, "Garcia")),
+ .put("a", convertToVertex(graph, "Garcia"))
+ .put("b", convertToVertex(graph, "CREAM PUFF WAR"))
+ .put("c", convertToVertex(graph, "CREAM PUFF WAR"))
+ .put("d", convertToVertex(graph, "Garcia")),
new Bindings<Vertex>()
- .put("a", convertToVertex(g, "Garcia"))
- .put("b", convertToVertex(g, "CREAM PUFF WAR"))
- .put("c", convertToVertex(g, "CRYPTICAL ENVELOPMENT"))
- .put("d", convertToVertex(g, "Garcia")),
+ .put("a", convertToVertex(graph, "Garcia"))
+ .put("b", convertToVertex(graph, "CREAM PUFF WAR"))
+ .put("c", convertToVertex(graph, "CRYPTICAL ENVELOPMENT"))
+ .put("d", convertToVertex(graph, "Garcia")),
new Bindings<Vertex>()
- .put("a", convertToVertex(g, "Garcia"))
- .put("b", convertToVertex(g, "CRYPTICAL ENVELOPMENT"))
- .put("c", convertToVertex(g, "CREAM PUFF WAR"))
- .put("d", convertToVertex(g, "Garcia")),
+ .put("a", convertToVertex(graph, "Garcia"))
+ .put("b", convertToVertex(graph, "CRYPTICAL ENVELOPMENT"))
+ .put("c", convertToVertex(graph, "CREAM PUFF WAR"))
+ .put("d", convertToVertex(graph, "Garcia")),
new Bindings<Vertex>()
- .put("a", convertToVertex(g, "Garcia"))
- .put("b", convertToVertex(g, "CRYPTICAL ENVELOPMENT"))
- .put("c", convertToVertex(g, "CRYPTICAL ENVELOPMENT"))
- .put("d", convertToVertex(g, "Garcia")),
+ .put("a", convertToVertex(graph, "Garcia"))
+ .put("b", convertToVertex(graph, "CRYPTICAL ENVELOPMENT"))
+ .put("c", convertToVertex(graph, "CRYPTICAL ENVELOPMENT"))
+ .put("d", convertToVertex(graph, "Garcia")),
new Bindings<Vertex>()
- .put("a", convertToVertex(g, "Grateful_Dead"))
- .put("b", convertToVertex(g, "CANT COME DOWN"))
- .put("c", convertToVertex(g, "DOWN SO LONG"))
- .put("d", convertToVertex(g, "Garcia")),
+ .put("a", convertToVertex(graph, "Grateful_Dead"))
+ .put("b", convertToVertex(graph, "CANT COME DOWN"))
+ .put("c", convertToVertex(graph, "DOWN SO LONG"))
+ .put("d", convertToVertex(graph, "Garcia")),
new Bindings<Vertex>()
- .put("a", convertToVertex(g, "Grateful_Dead"))
- .put("b", convertToVertex(g, "THE ONLY TIME IS NOW"))
- .put("c", convertToVertex(g, "DOWN SO LONG"))
- .put("d", convertToVertex(g, "Garcia")));
+ .put("a", convertToVertex(graph, "Grateful_Dead"))
+ .put("b", convertToVertex(graph, "THE ONLY TIME IS NOW"))
+ .put("c", convertToVertex(graph, "DOWN SO LONG"))
+ .put("d", convertToVertex(graph, "Garcia")));
});
}
@@ -431,8 +431,8 @@ public abstract class MatchTest extends AbstractGremlinProcessTest {
// apply the query to the graph, gathering non-trivial branch factors
assertResults(query.solveFor(iter),
- new Bindings<>().put("d", convertToVertex(g, "vadas")).put("a", convertToVertex(g, "marko")).put("b", convertToVertex(g, "josh")).put("c", convertToVertex(g, "lop")),
- new Bindings<>().put("d", convertToVertex(g, "vadas")).put("a", convertToVertex(g, "marko")).put("b", convertToVertex(g, "josh")).put("c", convertToVertex(g, "ripple")));
+ new Bindings<>().put("d", convertToVertex(graph, "vadas")).put("a", convertToVertex(graph, "marko")).put("b", convertToVertex(graph, "josh")).put("c", convertToVertex(graph, "lop")),
+ new Bindings<>().put("d", convertToVertex(graph, "vadas")).put("a", convertToVertex(graph, "marko")).put("b", convertToVertex(graph, "josh")).put("c", convertToVertex(graph, "ripple")));
query.optimize();
//System.out.println(query.summarize());
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/899429cc/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/TreeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/TreeTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/TreeTest.java
index b1e4674..7f46632 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/TreeTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/sideEffect/TreeTest.java
@@ -95,11 +95,11 @@ public abstract class TreeTest extends AbstractGremlinProcessTest {
final Tree tree = traversal.next();
assertFalse(traversal.hasNext());
assertEquals(1, tree.size());
- assertTrue(tree.containsKey(convertToVertex(g, "marko")));
- assertEquals(1, ((Map) tree.get(convertToVertex(g, "marko"))).size());
- assertTrue(((Map) tree.get(convertToVertex(g, "marko"))).containsKey(convertToVertex(g, "josh")));
- assertTrue(((Map) ((Map) tree.get(convertToVertex(g, "marko"))).get(convertToVertex(g, "josh"))).containsKey(convertToVertex(g, "lop")));
- assertTrue(((Map) ((Map) tree.get(convertToVertex(g, "marko"))).get(convertToVertex(g, "josh"))).containsKey(convertToVertex(g, "ripple")));
+ assertTrue(tree.containsKey(convertToVertex(graph, "marko")));
+ assertEquals(1, ((Map) tree.get(convertToVertex(graph, "marko"))).size());
+ assertTrue(((Map) tree.get(convertToVertex(graph, "marko"))).containsKey(convertToVertex(graph, "josh")));
+ assertTrue(((Map) ((Map) tree.get(convertToVertex(graph, "marko"))).get(convertToVertex(graph, "josh"))).containsKey(convertToVertex(graph, "lop")));
+ assertTrue(((Map) ((Map) tree.get(convertToVertex(graph, "marko"))).get(convertToVertex(graph, "josh"))).containsKey(convertToVertex(graph, "ripple")));
});
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/899429cc/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/EdgeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/EdgeTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/EdgeTest.java
index 1a1d9d4..35b427b 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/EdgeTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/EdgeTest.java
@@ -57,8 +57,8 @@ public class EdgeTest {
@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)
public void shouldHaveStandardStringRepresentation() {
- final Vertex v1 = g.addVertex();
- final Vertex v2 = g.addVertex();
+ final Vertex v1 = graph.addVertex();
+ final Vertex v2 = graph.addVertex();
final Edge e = v1.addEdge("friends", v2);
assertEquals(StringFactory.edgeString(e), e.toString());
@@ -68,7 +68,7 @@ public class EdgeTest {
@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)
public void shouldHaveExceptionConsistencyWhenUsingNullEdgeLabel() {
- final Vertex v = g.addVertex();
+ final Vertex v = graph.addVertex();
try {
v.addEdge(null, v);
fail("Call to Vertex.addEdge() should throw an exception when label is null");
@@ -81,7 +81,7 @@ public class EdgeTest {
@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)
public void shouldHaveExceptionConsistencyWhenUsingNullVertex() {
- final Vertex v = g.addVertex();
+ final Vertex v = graph.addVertex();
try {
v.addEdge("to-nothing", null);
fail("Call to Vertex.addEdge() should throw an exception when vertex is null");
@@ -94,7 +94,7 @@ public class EdgeTest {
@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)
public void shouldHaveExceptionConsistencyWhenUsingEmptyVertexLabel() {
- final Vertex v = g.addVertex();
+ final Vertex v = graph.addVertex();
try {
v.addEdge("", v);
fail("Call to Vertex.addEdge() should throw an exception when label is empty");
@@ -108,7 +108,7 @@ public class EdgeTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
public void shouldHaveExceptionConsistencyWhenUsingSystemVertexLabel() {
final String label = Graph.Hidden.hide("systemLabel");
- final Vertex v = g.addVertex();
+ final Vertex v = graph.addVertex();
try {
v.addEdge(label, v);
fail("Call to Vertex.addEdge() should throw an exception when label is a system key");
@@ -128,7 +128,6 @@ public class EdgeTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = FEATURE_STRING_VALUES)
public void shouldAutotypeStringProperties() {
- final Graph graph = g;
final Vertex v = graph.addVertex();
final Edge e = v.addEdge("knows", v, "string", "marko");
final String name = e.value("string");
@@ -141,7 +140,6 @@ public class EdgeTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = FEATURE_INTEGER_VALUES)
public void shouldAutotypIntegerProperties() {
- final Graph graph = g;
final Vertex v = graph.addVertex();
final Edge e = v.addEdge("knows", v, "integer", 33);
final Integer age = e.value("integer");
@@ -153,7 +151,6 @@ public class EdgeTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = FEATURE_BOOLEAN_VALUES)
public void shouldAutotypeBooleanProperties() {
- final Graph graph = g;
final Vertex v = graph.addVertex();
final Edge e = v.addEdge("knows", v, "boolean", true);
final Boolean best = e.value("boolean");
@@ -165,7 +162,6 @@ public class EdgeTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = FEATURE_DOUBLE_VALUES)
public void shouldAutotypeDoubleProperties() {
- final Graph graph = g;
final Vertex v = graph.addVertex();
final Edge e = v.addEdge("knows", v, "double", 0.1d);
final Double best = e.value("double");
@@ -177,7 +173,6 @@ public class EdgeTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = FEATURE_LONG_VALUES)
public void shouldAutotypeLongProperties() {
- final Graph graph = g;
final Vertex v = graph.addVertex();
final Edge e = v.addEdge("knows", v, "long", 1l);
final Long best = e.value("long");
@@ -189,7 +184,6 @@ public class EdgeTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = FEATURE_FLOAT_VALUES)
public void shouldAutotypeFloatProperties() {
- final Graph graph = g;
final Vertex v = graph.addVertex();
final Edge e = v.addEdge("knows", v, "float", 0.1f);
final Float best = e.value("float");
@@ -201,7 +195,7 @@ public class EdgeTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = FEATURE_STRING_VALUES)
public void shouldGetPropertyKeysOnEdge() {
- final Vertex v = g.addVertex();
+ final Vertex v = graph.addVertex();
final Edge e = v.addEdge("friend", v, "name", "marko", "location", "desert", "status", "dope");
Set<String> keys = e.keys();
assertEquals(3, keys.size());
@@ -238,18 +232,18 @@ public class EdgeTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
public void shouldNotGetConcurrentModificationException() {
for (int i = 0; i < 25; i++) {
- final Vertex v = g.addVertex();
+ final Vertex v = graph.addVertex();
v.addEdge("friend", v);
}
- tryCommit(g, assertVertexEdgeCounts(25, 25));
+ tryCommit(graph, assertVertexEdgeCounts(25, 25));
for (Edge e : g.E().toList()) {
e.remove();
- tryCommit(g);
+ tryCommit(graph);
}
- tryCommit(g, assertVertexEdgeCounts(25, 0));
+ tryCommit(graph, assertVertexEdgeCounts(25, 0));
}
@Test
@@ -258,8 +252,8 @@ public class EdgeTest {
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_REMOVE_EDGES)
public void shouldNotHaveAConcurrentModificationExceptionWhenIteratingAndRemovingAddingEdges() {
- final Vertex v1 = g.addVertex("name", "marko");
- final Vertex v2 = g.addVertex("name", "puppy");
+ final Vertex v1 = graph.addVertex("name", "marko");
+ final Vertex v2 = graph.addVertex("name", "puppy");
v1.addEdge("knows", v2, "since", 2010);
v1.addEdge("pets", v2);
v1.addEdge("walks", v2, "location", "arroyo");
@@ -282,7 +276,7 @@ public class EdgeTest {
@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)
public void shouldReturnEmptyIteratorIfNoProperties() {
- final Vertex v = g.addVertex();
+ final Vertex v = graph.addVertex();
final Edge e = v.addEdge("knows", v);
assertEquals(0, IteratorUtils.count(e.properties()));
}
@@ -291,8 +285,8 @@ public class EdgeTest {
@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)
public void shouldReturnOutThenInOnVertexIterator() {
- final Vertex a = g.addVertex();
- final Vertex b = g.addVertex();
+ final Vertex a = graph.addVertex();
+ final Vertex b = graph.addVertex();
final Edge e = a.addEdge("knows", b);
assertEquals(a, e.outVertex());
assertEquals(b, e.inVertex());
@@ -328,11 +322,11 @@ public class EdgeTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_REMOVE_VERTICES)
public void shouldThrowExceptionIfEdgeWasRemoved() {
- final Vertex v1 = g.addVertex("name", "stephen");
+ final Vertex v1 = graph.addVertex("name", "stephen");
final Edge e = v1.addEdge("knows", v1, "x", "y");
final Object id = e.id();
e.remove();
- tryCommit(g, g -> {
+ tryCommit(graph, graph -> {
try {
functionToTest.accept(e);
fail("Should have thrown exception as the Edge was already removed");
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/899429cc/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
index a92e58a..e061323 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
@@ -42,7 +42,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
-import static org.apache.tinkerpop.gremlin.structure.Graph.Features.GraphFeatures.FEATURE_PERSISTENCE;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.junit.Assert.*;
@@ -62,7 +61,7 @@ public class GraphTest extends AbstractGremlinTest {
*/
@Test
public void shouldImplementAndExposeFeatures() {
- final Graph.Features features = g.features();
+ final Graph.Features features = graph.features();
assertNotNull(features);
final AtomicInteger counter = new AtomicInteger(0);
@@ -90,20 +89,9 @@ public class GraphTest extends AbstractGremlinTest {
}
@Test
- public void shouldHaveExceptionConsistencyWhenFindVertexByIdThatIsNonExistentViaTraversal() {
- try {
- g.V(10000l).next();
- fail("Call to g.V(10000l) should throw an exception");
- } catch (Exception ex) {
- assertThat(ex, instanceOf(Graph.Exceptions.elementNotFound(Vertex.class, 10000l).getClass()));
- }
-
- }
-
- @Test
public void shouldHaveExceptionConsistencyWhenFindVertexByIdThatIsNonExistentViaIterator() {
try {
- g.vertices(10000l).next();
+ graph.vertices(10000l).next();
fail("Call to g.V(10000l) should throw an exception");
} catch (Exception ex) {
assertThat(ex, instanceOf(Graph.Exceptions.elementNotFound(Vertex.class, 10000l).getClass()));
@@ -112,20 +100,9 @@ public class GraphTest extends AbstractGremlinTest {
}
@Test
- public void shouldHaveExceptionConsistencyWhenFindEdgeByIdThatIsNonExistentViaTraversal() {
- try {
- g.E(10000l).next();
- fail("Call to g.E(10000l) should throw an exception");
- } catch (Exception ex) {
- assertThat(ex, instanceOf(Graph.Exceptions.elementNotFound(Edge.class, 10000l).getClass()));
- }
-
- }
-
- @Test
public void shouldHaveExceptionConsistencyWhenFindEdgeByIdThatIsNonExistentViaIterator() {
try {
- g.edges(10000l).next();
+ graph.edges(10000l).next();
fail("Call to g.E(10000l) should throw an exception");
} catch (Exception ex) {
assertThat(ex, instanceOf(Graph.Exceptions.elementNotFound(Edge.class, 10000l).getClass()));
@@ -138,9 +115,9 @@ public class GraphTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_USER_SUPPLIED_IDS)
public void shouldHaveExceptionConsistencyWhenAssigningSameIdOnVertex() {
final Object o = GraphManager.getGraphProvider().convertId("1");
- g.addVertex(T.id, o);
+ graph.addVertex(T.id, o);
try {
- g.addVertex(T.id, o);
+ graph.addVertex(T.id, o);
fail("Assigning the same ID to an Element should throw an exception");
} catch (Exception ex) {
assertThat(ex, instanceOf(Graph.Exceptions.vertexWithIdAlreadyExists(0).getClass()));
@@ -153,9 +130,9 @@ public class GraphTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_USER_SUPPLIED_IDS)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
public void shouldAddVertexWithUserSuppliedNumericId() {
- g.addVertex(T.id, 1000l);
- tryCommit(g, graph -> {
- final Vertex v = g.vertices(1000l).next();
+ graph.addVertex(T.id, 1000l);
+ tryCommit(graph, graph -> {
+ final Vertex v = graph.vertices(1000l).next();
assertEquals(1000l, v.id());
});
}
@@ -165,9 +142,9 @@ public class GraphTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_USER_SUPPLIED_IDS)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_STRING_IDS)
public void shouldAddVertexWithUserSuppliedStringId() {
- g.addVertex(T.id, "1000");
- tryCommit(g, graph -> {
- final Vertex v = g.vertices("1000").next();
+ graph.addVertex(T.id, "1000");
+ tryCommit(graph, graph -> {
+ final Vertex v = graph.vertices("1000").next();
assertEquals("1000", v.id());
});
}
@@ -178,9 +155,9 @@ public class GraphTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_UUID_IDS)
public void shouldAddVertexWithUserSuppliedUuidId() {
final UUID uuid = UUID.randomUUID();
- g.addVertex(T.id, uuid);
- tryCommit(g, graph -> {
- final Vertex v = g.vertices(uuid).next();
+ graph.addVertex(T.id, uuid);
+ tryCommit(graph, graph -> {
+ final Vertex v = graph.vertices(uuid).next();
assertEquals(uuid, v.id());
});
}
@@ -191,24 +168,24 @@ public class GraphTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ANY_IDS)
public void shouldAddVertexWithUserSuppliedAnyId() {
final UUID uuid = UUID.randomUUID();
- g.addVertex(T.id, uuid);
- tryCommit(g, graph -> {
- final Vertex v = g.vertices(uuid).next();
+ graph.addVertex(T.id, uuid);
+ tryCommit(graph, graph -> {
+ final Vertex v = graph.vertices(uuid).next();
assertEquals(uuid, v.id());
});
- g.addVertex(T.id, uuid.toString());
- tryCommit(g, graph -> {
- final Vertex v = g.vertices(uuid.toString()).next();
+ graph.addVertex(T.id, uuid.toString());
+ tryCommit(graph, graph -> {
+ final Vertex v = graph.vertices(uuid.toString()).next();
assertEquals(uuid.toString(), v.id());
});
// this is different from "FEATURE_CUSTOM_IDS" as TinkerGraph does not define a specific id class
// (i.e. TinkerId) for the identifier.
IoTest.CustomId customId = new IoTest.CustomId("test", uuid);
- g.addVertex(T.id, customId);
- tryCommit(g, graph -> {
- final Vertex v = g.vertices(customId).next();
+ graph.addVertex(T.id, customId);
+ tryCommit(graph, graph -> {
+ final Vertex v = graph.vertices(customId).next();
assertEquals(customId, v.id());
});
}
@@ -217,8 +194,8 @@ public class GraphTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_MULTI_PROPERTIES, supported = false)
public void shouldOverwriteEarlierKeyValuesWithLaterKeyValuesOnAddVertexIfNoMultiProperty() {
- final Vertex v = g.addVertex("test", "A", "test", "B", "test", "C");
- tryCommit(g, graph -> {
+ final Vertex v = graph.addVertex("test", "A", "test", "B", "test", "C");
+ tryCommit(graph, graph -> {
assertEquals(1, IteratorUtils.count(v.properties("test")));
assertTrue(StreamFactory.stream(v.values("test")).anyMatch(t -> t.equals("C")));
});
@@ -228,8 +205,8 @@ public class GraphTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_MULTI_PROPERTIES)
public void shouldOverwriteEarlierKeyValuesWithLaterKeyValuesOnAddVertexIfMultiProperty() {
- final Vertex v = g.addVertex("test", "A", "test", "B", "test", "C");
- tryCommit(g, graph -> {
+ final Vertex v = graph.addVertex("test", "A", "test", "B", "test", "C");
+ tryCommit(graph, graph -> {
assertEquals(3, IteratorUtils.count(v.properties("test")));
assertTrue(StreamFactory.stream(v.values("test")).anyMatch(t -> t.equals("A")));
assertTrue(StreamFactory.stream(v.values("test")).anyMatch(t -> t.equals("B")));
@@ -243,7 +220,7 @@ public class GraphTest extends AbstractGremlinTest {
*/
@Test
public void shouldHaveStandardStringRepresentation() throws Exception {
- assertTrue(g.toString().matches(".*\\[.*\\]"));
+ assertTrue(graph.toString().matches(".*\\[.*\\]"));
}
/**
@@ -260,8 +237,8 @@ public class GraphTest extends AbstractGremlinTest {
final List<Edge> edges = new ArrayList<>();
final Random random = new Random();
- IntStream.range(0, vertexCount).forEach(i -> vertices.add(g.addVertex()));
- tryCommit(g, assertVertexEdgeCounts(vertexCount, 0));
+ IntStream.range(0, vertexCount).forEach(i -> vertices.add(graph.addVertex()));
+ tryCommit(graph, assertVertexEdgeCounts(vertexCount, 0));
IntStream.range(0, edgeCount).forEach(i -> {
boolean created = false;
@@ -275,7 +252,7 @@ public class GraphTest extends AbstractGremlinTest {
}
});
- tryCommit(g, assertVertexEdgeCounts(vertexCount, edgeCount));
+ tryCommit(graph, assertVertexEdgeCounts(vertexCount, edgeCount));
int counter = 0;
for (Edge e : edges) {
@@ -283,7 +260,7 @@ public class GraphTest extends AbstractGremlinTest {
e.remove();
final int currentCounter = counter;
- tryCommit(g, assertVertexEdgeCounts(vertexCount, edgeCount - currentCounter));
+ tryCommit(graph, assertVertexEdgeCounts(vertexCount, edgeCount - currentCounter));
}
}
@@ -299,8 +276,8 @@ public class GraphTest extends AbstractGremlinTest {
final List<Vertex> vertices = new ArrayList<>();
final List<Edge> edges = new ArrayList<>();
- IntStream.range(0, vertexCount).forEach(i -> vertices.add(g.addVertex()));
- tryCommit(g, assertVertexEdgeCounts(vertexCount, 0));
+ IntStream.range(0, vertexCount).forEach(i -> vertices.add(graph.addVertex()));
+ tryCommit(graph, assertVertexEdgeCounts(vertexCount, 0));
for (int i = 0; i < vertexCount; i = i + 2) {
final Vertex a = vertices.get(i);
@@ -308,7 +285,7 @@ public class GraphTest extends AbstractGremlinTest {
edges.add(a.addEdge(GraphManager.getGraphProvider().convertLabel("a" + UUID.randomUUID()), b));
}
- tryCommit(g, assertVertexEdgeCounts(vertexCount, vertexCount / 2));
+ tryCommit(graph, assertVertexEdgeCounts(vertexCount, vertexCount / 2));
int counter = 0;
for (Vertex v : vertices) {
@@ -317,7 +294,7 @@ public class GraphTest extends AbstractGremlinTest {
if ((counter + 1) % 2 == 0) {
final int currentCounter = counter;
- tryCommit(g, assertVertexEdgeCounts(
+ tryCommit(graph, assertVertexEdgeCounts(
vertexCount - currentCounter, edges.size() - ((currentCounter + 1) / 2)));
}
}
@@ -331,15 +308,15 @@ public class GraphTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_REMOVE_VERTICES)
public void shouldRemoveVerticesWithoutConcurrentModificationException() {
for (int i = 0; i < 100; i++) {
- g.addVertex();
+ graph.addVertex();
}
- final Iterator<Vertex> vertexIterator = g.vertices();
+ final Iterator<Vertex> vertexIterator = graph.vertices();
assertTrue(vertexIterator.hasNext());
while (vertexIterator.hasNext()) {
vertexIterator.next().remove();
}
assertFalse(vertexIterator.hasNext());
- tryCommit(g, g -> assertFalse(g.vertices().hasNext()));
+ tryCommit(graph, graph -> assertFalse(graph.vertices().hasNext()));
}
/**
@@ -351,10 +328,10 @@ public class GraphTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_REMOVE_EDGES)
public void shouldRemoveEdgesWithoutConcurrentModificationException() {
for (int i = 0; i < 50; i++) {
- g.addVertex().addEdge("link", g.addVertex());
+ graph.addVertex().addEdge("link", graph.addVertex());
}
- final Iterator<Edge> edgeIterator = g.edges();
+ final Iterator<Edge> edgeIterator = graph.edges();
assertTrue(edgeIterator.hasNext());
while (edgeIterator.hasNext()) {
edgeIterator.next().remove();
@@ -362,8 +339,8 @@ public class GraphTest extends AbstractGremlinTest {
assertFalse(edgeIterator.hasNext());
// TODO: Neo4j fails on this: tryCommit(g, g -> assertFalse(g.iterators().edgeIterator().hasNext()));
- tryCommit(g);
- assertFalse(g.edges().hasNext());
+ tryCommit(graph);
+ assertFalse(graph.edges().hasNext());
}
/**
@@ -374,7 +351,6 @@ public class GraphTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
public void shouldEvaluateConnectivityPatterns() {
final GraphProvider graphProvider = GraphManager.getGraphProvider();
- final Graph graph = this.g;
final Vertex a;
final Vertex b;
@@ -467,7 +443,6 @@ public class GraphTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
public void shouldTraverseInOutFromVertexWithSingleEdgeLabelFilter() {
final GraphProvider graphProvider = GraphManager.getGraphProvider();
- final Graph graph = g;
final Vertex a = graph.addVertex();
final Vertex b = graph.addVertex();
@@ -518,7 +493,6 @@ public class GraphTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
public void shouldTraverseInOutFromVertexWithMultipleEdgeLabelFilter() {
final GraphProvider graphProvider = GraphManager.getGraphProvider();
- final Graph graph = g;
final Vertex a = graph.addVertex();
final Vertex b = graph.addVertex();
final Vertex c = graph.addVertex();
@@ -556,7 +530,6 @@ public class GraphTest extends AbstractGremlinTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
public void shouldTestTreeConnectivity() {
final GraphProvider graphProvider = GraphManager.getGraphProvider();
- final Graph graph = g;
int branchSize = 11;
final Vertex start = graph.addVertex();
@@ -575,21 +548,20 @@ public class GraphTest extends AbstractGremlinTest {
assertEquals(0l, IteratorUtils.count(start.edges(Direction.IN)));
assertEquals(branchSize, IteratorUtils.count(start.edges(Direction.OUT)));
- for (Edge e : IteratorUtils.list(start.edges(Direction.OUT))) {
- assertEquals(graphProvider.convertId("test1"), e.label());
- //assertEquals(new Long(branchSize), e.inV().out().count().next());
- //assertEquals(new Long(1), e.inV().inE().count().next());
- /*for (Edge f : e.inV().outE().toList()) {
- assertEquals(graphProvider.convertId("test2"), f.label());
- assertEquals(new Long(branchSize), f.inV().out().count().next());
- assertEquals(new Long(1), f.inV().in().count().next());
- for (Edge g : f.inV().outE().toList()) {
- assertEquals(graphProvider.convertId("test3"), g.label());
- assertEquals(new Long(0), g.inV().out().count().next());
- assertEquals(new Long(1), g.inV().in().count().next());
+ for (Edge a : IteratorUtils.list(start.edges(Direction.OUT))) {
+ assertEquals(graphProvider.convertId("test1"), a.label());
+ assertEquals(branchSize, IteratorUtils.count(a.inVertex().vertices(Direction.OUT)));
+ assertEquals(1, IteratorUtils.count(a.inVertex().vertices(Direction.IN)));
+ for (Edge b : IteratorUtils.list(a.inVertex().edges(Direction.OUT))) {
+ assertEquals(graphProvider.convertId("test2"), b.label());
+ assertEquals(branchSize, IteratorUtils.count(b.inVertex().vertices(Direction.OUT)));
+ assertEquals(1, IteratorUtils.count(b.inVertex().vertices(Direction.IN)));
+ for (Edge c : IteratorUtils.list(b.inVertex().edges(Direction.OUT))) {
+ assertEquals(graphProvider.convertId("test3"), c.label());
+ assertEquals(0, IteratorUtils.count(c.inVertex().vertices(Direction.OUT)));
+ assertEquals(1, IteratorUtils.count(c.inVertex().vertices(Direction.IN)));
}
- }*/
- // TODO!!!!!!!!
+ }
}
int totalVertices = 0;
@@ -602,10 +574,9 @@ public class GraphTest extends AbstractGremlinTest {
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
- @FeatureRequirement(featureClass = Graph.Features.GraphFeatures.class, feature = FEATURE_PERSISTENCE)
+ @FeatureRequirement(featureClass = Graph.Features.GraphFeatures.class, feature = Graph.Features.GraphFeatures.FEATURE_PERSISTENCE)
public void shouldPersistDataOnClose() throws Exception {
final GraphProvider graphProvider = GraphManager.getGraphProvider();
- final Graph graph = g;
final Vertex v = graph.addVertex();
final Vertex u = graph.addVertex();
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/899429cc/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphWritePerformanceTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphWritePerformanceTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphWritePerformanceTest.java
index 8c34f41..1a9e4b0 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphWritePerformanceTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphWritePerformanceTest.java
@@ -59,11 +59,11 @@ public class GraphWritePerformanceTest {
public void writeEmptyVertices() throws Exception {
final int verticesToGenerate = 100000;
for (int ix = 0; ix < verticesToGenerate; ix++) {
- g.addVertex();
- tryBatchCommit(g, ix);
+ graph.addVertex();
+ tryBatchCommit(graph, ix);
}
- assertVertexEdgeCounts(verticesToGenerate, 0).accept(g);
+ assertVertexEdgeCounts(verticesToGenerate, 0).accept(graph);
}
@Test
@@ -72,15 +72,15 @@ public class GraphWritePerformanceTest {
final int verticesToGenerate = 100000;
Optional<Vertex> lastVertex = Optional.empty();
for (int ix = 0; ix < verticesToGenerate; ix++) {
- final Vertex v = g.addVertex();
+ final Vertex v = graph.addVertex();
if (lastVertex.isPresent())
v.addEdge("parent", lastVertex.get());
lastVertex = Optional.of(v);
- tryBatchCommit(g, ix);
+ tryBatchCommit(graph, ix);
}
- assertVertexEdgeCounts(verticesToGenerate, verticesToGenerate - 1).accept(g);
+ assertVertexEdgeCounts(verticesToGenerate, verticesToGenerate - 1).accept(graph);
}
}
@@ -97,7 +97,7 @@ public class GraphWritePerformanceTest {
public void writeGryo() throws Exception {
final GraphWriter writer = GryoWriter.build().create();
final OutputStream os = new ByteArrayOutputStream();
- writer.writeGraph(os, g);
+ writer.writeGraph(os, graph);
}
@Test
@@ -106,7 +106,7 @@ public class GraphWritePerformanceTest {
public void writeGraphML() throws Exception {
final GraphWriter writer = GraphMLWriter.build().create();
final OutputStream os = new ByteArrayOutputStream();
- writer.writeGraph(os, g);
+ writer.writeGraph(os, graph);
}
@Test
@@ -115,7 +115,7 @@ public class GraphWritePerformanceTest {
public void writeGraphSON() throws Exception {
final GraphWriter writer = GraphSONWriter.build().create();
final OutputStream os = new ByteArrayOutputStream();
- writer.writeGraph(os, g);
+ writer.writeGraph(os, graph);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/899429cc/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/PropertyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/PropertyTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/PropertyTest.java
index 10d8f67..c3ea06f 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/PropertyTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/PropertyTest.java
@@ -60,7 +60,7 @@ public class PropertyTest {
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
public void shouldHaveStandardStringRepresentation() {
- final Vertex v = g.addVertex("name", "marko");
+ final Vertex v = graph.addVertex("name", "marko");
final Property p = v.property("name");
assertEquals(StringFactory.propertyString(p), p.toString());
}
@@ -68,9 +68,9 @@ public class PropertyTest {
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
public void shouldReturnEmptyPropertyIfKeyNonExistent() {
- final Vertex v = g.addVertex("name", "marko");
- tryCommit(g, (graph) -> {
- final Vertex v1 = g.vertices(v.id()).next();
+ final Vertex v = graph.addVertex("name", "marko");
+ tryCommit(graph, (graph) -> {
+ final Vertex v1 = graph.vertices(v.id()).next();
final VertexProperty p = v1.property("nonexistent-key");
assertEquals(VertexProperty.empty(), p);
});
@@ -80,9 +80,9 @@ public class PropertyTest {
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_REMOVE_PROPERTY)
public void shouldAllowRemovalFromVertexWhenAlreadyRemoved() {
- final Vertex v = g.addVertex("name", "marko");
- tryCommit(g);
- final Vertex v1 = g.vertices(v.id()).next();
+ final Vertex v = graph.addVertex("name", "marko");
+ tryCommit(graph);
+ final Vertex v1 = graph.vertices(v.id()).next();
try {
final Property p = v1.property("name");
p.remove();
@@ -99,12 +99,12 @@ public class PropertyTest {
@FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_REMOVE_PROPERTY)
public void shouldAllowRemovalFromEdgeWhenAlreadyRemoved() {
- final Vertex v = g.addVertex("name", "marko");
- tryCommit(g);
- final Vertex v1 = g.vertices(v.id()).next();
+ final Vertex v = graph.addVertex("name", "marko");
+ tryCommit(graph);
+ final Vertex v1 = graph.vertices(v.id()).next();
try {
- final Edge edge = v1.addEdge("knows", g.addVertex());
+ final Edge edge = v1.addEdge("knows", graph.addVertex());
final Property p = edge.property("stars", 5);
p.remove();
p.remove();
@@ -156,7 +156,7 @@ public class PropertyTest {
@FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = FEATURE_PROPERTIES)
public void shouldThrowOnGraphAddVertex() throws Exception {
try {
- this.g.addVertex(arguments);
+ this.graph.addVertex(arguments);
fail(String.format("Call to addVertex should have thrown an exception with these arguments [%s]", arguments));
} catch (Exception ex) {
validateException(expectedException, ex);
@@ -169,7 +169,7 @@ public class PropertyTest {
@FeatureRequirement(featureClass = Graph.Features.EdgePropertyFeatures.class, feature = FEATURE_PROPERTIES)
public void shouldThrowOnGraphAddEdge() throws Exception {
try {
- final Vertex v = this.g.addVertex();
+ final Vertex v = this.graph.addVertex();
v.addEdge("label", v, arguments);
fail(String.format("Call to addVertex should have thrown an exception with these arguments [%s]", arguments));
} catch (Exception ex) {
@@ -189,7 +189,7 @@ public class PropertyTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = FEATURE_PROPERTIES)
public void shouldGetValueThatIsNotPresentOnVertex() {
- final Vertex v = g.addVertex();
+ final Vertex v = graph.addVertex();
try {
v.value("does-not-exist");
fail("Call to Element.value() with a key that is not present should throw an exception");
@@ -204,7 +204,7 @@ public class PropertyTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = FEATURE_PROPERTIES)
public void shouldGetValueThatIsNotPresentOnEdge() {
- final Vertex v = g.addVertex();
+ final Vertex v = graph.addVertex();
final Edge e = v.addEdge("label", v);
try {
e.value("does-not-exist");
@@ -258,7 +258,7 @@ public class PropertyTest {
@FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = VertexPropertyFeatures.FEATURE_ADD_PROPERTY)
public void testGraphVertexSetPropertyStandard() throws Exception {
try {
- final Vertex v = this.g.addVertex();
+ final Vertex v = this.graph.addVertex();
v.property(key, val);
fail(String.format("Call to Vertex.setProperty should have thrown an exception with these arguments [%s, %s]", key, val));
} catch (Exception ex) {
@@ -273,7 +273,7 @@ public class PropertyTest {
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_PROPERTY)
public void shouldThrowOnGraphEdgeSetPropertyStandard() throws Exception {
try {
- final Vertex v = this.g.addVertex();
+ final Vertex v = this.graph.addVertex();
v.addEdge("label", v).property(key, val);
fail(String.format("Call to Edge.setProperty should have thrown an exception with these arguments [%s, %s]", key, val));
} catch (Exception ex) {
@@ -364,7 +364,7 @@ public class PropertyTest {
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_PROPERTY)
public void shouldSetValueOnEdge() throws Exception {
- assumeThat(g.features().supports(EdgePropertyFeatures.class, featureName), is(true));
+ assumeThat(graph.features().supports(EdgePropertyFeatures.class, featureName), is(true));
final Edge edge = createEdgeForPropertyFeatureTests();
edge.property("aKey", value);
assertPropertyValue(edge);
@@ -374,8 +374,8 @@ public class PropertyTest {
@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)
public void shouldSetValueOnVertex() throws Exception {
- assumeThat(g.features().supports(VertexPropertyFeatures.class, featureName), is(true));
- final Vertex vertex = g.addVertex();
+ assumeThat(graph.features().supports(VertexPropertyFeatures.class, featureName), is(true));
+ final Vertex vertex = graph.addVertex();
vertex.property("aKey", value);
assertPropertyValue(vertex);
}
@@ -384,7 +384,7 @@ public class PropertyTest {
@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)
public void shouldSetValueOnEdgeOnAdd() throws Exception {
- assumeThat(g.features().supports(EdgePropertyFeatures.class, featureName), is(true));
+ assumeThat(graph.features().supports(EdgePropertyFeatures.class, featureName), is(true));
final Edge edge = createEdgeForPropertyFeatureTests("aKey", value);
assertPropertyValue(edge);
}
@@ -392,20 +392,20 @@ public class PropertyTest {
@Test
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
public void shouldSetValueOnVertexOnAdd() throws Exception {
- assumeThat(g.features().supports(VertexPropertyFeatures.class, featureName), is(true));
- final Vertex vertex = g.addVertex("aKey", value);
+ assumeThat(graph.features().supports(VertexPropertyFeatures.class, featureName), is(true));
+ final Vertex vertex = graph.addVertex("aKey", value);
assertPropertyValue(vertex);
}
private void assertPropertyValue(final Element element) {
if (value instanceof Map)
- tryCommit(g, graph -> {
+ tryCommit(graph, graph -> {
final Map map = element.<Map>property("aKey").value();
assertEquals(((Map) value).size(), map.size());
((Map) value).keySet().forEach(k -> assertEquals(((Map) value).get(k), map.get(k)));
});
else if (value instanceof List)
- tryCommit(g, graph -> {
+ tryCommit(graph, graph -> {
final List l = element.<List>property("aKey").value();
assertEquals(((List) value).size(), l.size());
for (int ix = 0; ix < ((List) value).size(); ix++) {
@@ -413,12 +413,12 @@ public class PropertyTest {
}
});
else if (value instanceof MockSerializable)
- tryCommit(g, graph -> {
+ tryCommit(graph, graph -> {
final MockSerializable mock = element.<MockSerializable>property("aKey").value();
assertEquals(((MockSerializable) value).getTestField(), mock.getTestField());
});
else if (value instanceof boolean[])
- tryCommit(g, graph -> {
+ tryCommit(graph, graph -> {
final boolean[] l = element.<boolean[]>property("aKey").value();
assertEquals(((boolean[]) value).length, l.length);
for (int ix = 0; ix < ((boolean[]) value).length; ix++) {
@@ -426,7 +426,7 @@ public class PropertyTest {
}
});
else if (value instanceof double[])
- tryCommit(g, graph -> {
+ tryCommit(graph, graph -> {
final double[] l = element.<double[]>property("aKey").value();
assertEquals(((double[]) value).length, l.length);
for (int ix = 0; ix < ((double[]) value).length; ix++) {
@@ -434,7 +434,7 @@ public class PropertyTest {
}
});
else if (value instanceof float[])
- tryCommit(g, graph -> {
+ tryCommit(graph, graph -> {
final float[] l = element.<float[]>property("aKey").value();
assertEquals(((float[]) value).length, l.length);
for (int ix = 0; ix < ((float[]) value).length; ix++) {
@@ -442,7 +442,7 @@ public class PropertyTest {
}
});
else if (value instanceof int[])
- tryCommit(g, graph -> {
+ tryCommit(graph, graph -> {
final int[] l = element.<int[]>property("aKey").value();
assertEquals(((int[]) value).length, l.length);
for (int ix = 0; ix < ((int[]) value).length; ix++) {
@@ -450,7 +450,7 @@ public class PropertyTest {
}
});
else if (value instanceof long[])
- tryCommit(g, graph -> {
+ tryCommit(graph, graph -> {
final long[] l = element.<long[]>property("aKey").value();
assertEquals(((long[]) value).length, l.length);
for (int ix = 0; ix < ((long[]) value).length; ix++) {
@@ -458,7 +458,7 @@ public class PropertyTest {
}
});
else if (value instanceof String[])
- tryCommit(g, graph -> {
+ tryCommit(graph, graph -> {
final String[] l = element.<String[]>property("aKey").value();
assertEquals(((String[]) value).length, l.length);
for (int ix = 0; ix < ((String[]) value).length; ix++) {
@@ -466,18 +466,18 @@ public class PropertyTest {
}
});
else
- tryCommit(g, graph -> assertEquals(value, element.property("aKey").value()));
+ tryCommit(graph, graph -> assertEquals(value, element.property("aKey").value()));
}
private Edge createEdgeForPropertyFeatureTests() {
- final Vertex vertexA = g.addVertex();
- final Vertex vertexB = g.addVertex();
+ final Vertex vertexA = graph.addVertex();
+ final Vertex vertexB = graph.addVertex();
return vertexA.addEdge(GraphManager.getGraphProvider().convertLabel("knows"), vertexB);
}
private Edge createEdgeForPropertyFeatureTests(final String k, Object v) {
- final Vertex vertexA = g.addVertex();
- final Vertex vertexB = g.addVertex();
+ final Vertex vertexA = graph.addVertex();
+ final Vertex vertexB = graph.addVertex();
return vertexA.addEdge(GraphManager.getGraphProvider().convertLabel("knows"), vertexB, k, v);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/899429cc/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/PartitionStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/PartitionStrategyTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/PartitionStrategyTest.java
index cde0157..3891d67 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/PartitionStrategyTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/strategy/PartitionStrategyTest.java
@@ -44,7 +44,7 @@ public class PartitionStrategyTest extends AbstractGremlinTest {
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
public void shouldAppendPartitionToVertex() {
- final Vertex v = g.addVertex("any", "thing");
+ final Vertex v = graph.addVertex("any", "thing");
assertNotNull(v);
assertEquals("thing", v.property("any").value());
@@ -54,7 +54,7 @@ public class PartitionStrategyTest extends AbstractGremlinTest {
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
public void shouldHidePartitionKeyOnVertex() {
- final Vertex v = g.addVertex("any", "thing");
+ final Vertex v = graph.addVertex("any", "thing");
assertNotNull(v);
assertEquals("thing", v.property("any").value());
@@ -68,8 +68,8 @@ public class PartitionStrategyTest extends AbstractGremlinTest {
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
public void shouldAppendPartitionToEdge() {
- final Vertex v1 = g.addVertex("any", "thing");
- final Vertex v2 = g.addVertex("some", "thing");
+ final Vertex v1 = graph.addVertex("any", "thing");
+ final Vertex v2 = graph.addVertex("some", "thing");
final Edge e = v1.addEdge("connectsTo", v2, "every", "thing");
assertNotNull(v1);
@@ -89,8 +89,8 @@ public class PartitionStrategyTest extends AbstractGremlinTest {
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
public void shouldHidePartitionKeyOnEdge() {
- final Vertex v1 = g.addVertex("any", "thing");
- final Vertex v2 = g.addVertex("some", "thing");
+ final Vertex v1 = graph.addVertex("any", "thing");
+ final Vertex v2 = graph.addVertex("some", "thing");
final Edge e = v1.addEdge("connectsTo", v2, "every", "thing");
assertNotNull(e);
@@ -106,10 +106,10 @@ public class PartitionStrategyTest extends AbstractGremlinTest {
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
public void shouldWriteVerticesToMultiplePartitions() {
- final Vertex vA = g.addVertex("any", "a");
- final PartitionStrategy strategy = (PartitionStrategy) ((StrategyGraph) g).getStrategy();
+ final Vertex vA = graph.addVertex("any", "a");
+ final PartitionStrategy strategy = (PartitionStrategy) ((StrategyGraph) graph).getStrategy();
strategy.setWritePartition("B");
- final Vertex vB = g.addVertex("any", "b");
+ final Vertex vB = graph.addVertex("any", "b");
assertNotNull(vA);
assertEquals("a", vA.property("any").value());
@@ -144,10 +144,10 @@ public class PartitionStrategyTest extends AbstractGremlinTest {
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
public void shouldThrowExceptionOnvInDifferentPartition() {
- final Vertex vA = g.addVertex("any", "a");
+ final Vertex vA = graph.addVertex("any", "a");
assertEquals(vA.id(), g.V(vA.id()).id().next());
- final PartitionStrategy strategy = (PartitionStrategy) ((StrategyGraph) g).getStrategy();
+ final PartitionStrategy strategy = (PartitionStrategy) ((StrategyGraph) graph).getStrategy();
strategy.clearReadPartitions();
try {
@@ -162,11 +162,11 @@ public class PartitionStrategyTest extends AbstractGremlinTest {
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
public void shouldThrowExceptionOneInDifferentPartition() {
- final Vertex vA = g.addVertex("any", "a");
+ final Vertex vA = graph.addVertex("any", "a");
final Edge e = vA.addEdge("knows", vA);
assertEquals(e.id(), g.E(e.id()).id().next());
- final PartitionStrategy strategy = (PartitionStrategy) ((StrategyGraph) g).getStrategy();
+ final PartitionStrategy strategy = (PartitionStrategy) ((StrategyGraph) graph).getStrategy();
strategy.clearReadPartitions();
try {
@@ -181,17 +181,17 @@ public class PartitionStrategyTest extends AbstractGremlinTest {
@Test
@FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
public void shouldWriteToMultiplePartitions() {
- final Vertex vA = g.addVertex("any", "a");
- final Vertex vAA = g.addVertex("any", "aa");
+ final Vertex vA = graph.addVertex("any", "a");
+ final Vertex vAA = graph.addVertex("any", "aa");
final Edge eAtoAA = vA.addEdge("a->a", vAA);
- final PartitionStrategy strategy = (PartitionStrategy) ((StrategyGraph) g).getStrategy();
+ final PartitionStrategy strategy = (PartitionStrategy) ((StrategyGraph) graph).getStrategy();
strategy.setWritePartition("B");
- final Vertex vB = g.addVertex("any", "b");
+ final Vertex vB = graph.addVertex("any", "b");
vA.addEdge("a->b", vB);
strategy.setWritePartition("C");
- final Vertex vC = g.addVertex("any", "c");
+ final Vertex vC = graph.addVertex("any", "c");
final Edge eBtovC = vB.addEdge("b->c", vC);
final Edge eAtovC = vA.addEdge("a->c", vC);