Lazy message scope initialization in PeerPressureVertexProgram. Remove vertex id checks in BulkDumperVertexProgramTest. Don't rollback transaction if already closed in TransactionTest.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/7aa9782c Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/7aa9782c Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/7aa9782c Branch: refs/heads/TINKERPOP-1490 Commit: 7aa9782c40300531bf08bd140897b50bcd0acdd1 Parents: 5a16f4c Author: sjudeng <sjud...@users.noreply.github.com> Authored: Wed Oct 26 16:48:23 2016 -0500 Committer: sjudeng <sjud...@users.noreply.github.com> Committed: Wed Oct 26 16:48:23 2016 -0500 ---------------------------------------------------------------------- .../clustering/peerpressure/PeerPressureVertexProgram.java | 4 ++-- .../computer/bulkdumping/BulkDumperVertexProgramTest.java | 6 ------ .../apache/tinkerpop/gremlin/structure/TransactionTest.java | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7aa9782c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java ---------------------------------------------------------------------- diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java index 56de255..b681807 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java @@ -58,8 +58,6 @@ public class PeerPressureVertexProgram extends StaticVertexProgram<Pair<Serializ private MessageScope.Local<?> voteScope = MessageScope.Local.of(__::outE); private MessageScope.Local<?> countScope = MessageScope.Local.of(new MessageScope.Local.ReverseTraversalSupplier(this.voteScope)); - private final Set<MessageScope> VOTE_SCOPE = new HashSet<>(Collections.singletonList(this.voteScope)); - private final Set<MessageScope> COUNT_SCOPE = new HashSet<>(Collections.singletonList(this.countScope)); public static final String CLUSTER = "gremlin.peerPressureVertexProgram.cluster"; private static final String VOTE_STRENGTH = "gremlin.peerPressureVertexProgram.voteStrength"; @@ -120,6 +118,8 @@ public class PeerPressureVertexProgram extends StaticVertexProgram<Pair<Serializ @Override public Set<MessageScope> getMessageScopes(final Memory memory) { + final Set<MessageScope> VOTE_SCOPE = new HashSet<>(Collections.singletonList(this.voteScope)); + final Set<MessageScope> COUNT_SCOPE = new HashSet<>(Collections.singletonList(this.countScope)); return this.distributeVote && memory.isInitialIteration() ? COUNT_SCOPE : VOTE_SCOPE; } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7aa9782c/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkdumping/BulkDumperVertexProgramTest.java ---------------------------------------------------------------------- diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkdumping/BulkDumperVertexProgramTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkdumping/BulkDumperVertexProgramTest.java index c55114e..62104c0 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkdumping/BulkDumperVertexProgramTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkdumping/BulkDumperVertexProgramTest.java @@ -48,7 +48,6 @@ public class BulkDumperVertexProgramTest extends AbstractGremlinProcessTest { assertEquals(1, IteratorUtils.count(v.values("age", "lang"))); final String name = v.value("name"); if (name.equals("marko")) { - assertEquals(1, v.id()); assertEquals("person", v.label()); assertEquals(Integer.valueOf(29), v.value("age")); assertEquals(3, IteratorUtils.count(v.edges(Direction.OUT))); @@ -56,21 +55,18 @@ public class BulkDumperVertexProgramTest extends AbstractGremlinProcessTest { assertEquals(1, IteratorUtils.count(v.edges(Direction.OUT, "created"))); assertEquals(0, IteratorUtils.count(v.edges(Direction.IN))); } else if (name.equals("vadas")) { - assertEquals(2, v.id()); assertEquals("person", v.label()); assertEquals(Integer.valueOf(27), v.value("age")); assertEquals(0, IteratorUtils.count(v.edges(Direction.OUT))); assertEquals(1, IteratorUtils.count(v.edges(Direction.IN))); assertEquals(1, IteratorUtils.count(v.edges(Direction.IN, "knows"))); } else if (name.equals("lop")) { - assertEquals(3, v.id()); assertEquals("software", v.label()); assertEquals("java", v.value("lang")); assertEquals(0, IteratorUtils.count(v.edges(Direction.OUT))); assertEquals(3, IteratorUtils.count(v.edges(Direction.IN))); assertEquals(3, IteratorUtils.count(v.edges(Direction.IN, "created"))); } else if (name.equals("josh")) { - assertEquals(4, v.id()); assertEquals("person", v.label()); assertEquals(Integer.valueOf(32), v.value("age")); assertEquals(2, IteratorUtils.count(v.edges(Direction.OUT))); @@ -78,14 +74,12 @@ public class BulkDumperVertexProgramTest extends AbstractGremlinProcessTest { assertEquals(1, IteratorUtils.count(v.edges(Direction.IN))); assertEquals(1, IteratorUtils.count(v.edges(Direction.IN, "knows"))); } else if (name.equals("ripple")) { - assertEquals(5, v.id()); assertEquals("software", v.label()); assertEquals("java", v.value("lang")); assertEquals(0, IteratorUtils.count(v.edges(Direction.OUT))); assertEquals(1, IteratorUtils.count(v.edges(Direction.IN))); assertEquals(1, IteratorUtils.count(v.edges(Direction.IN, "created"))); } else if (name.equals("peter")) { - assertEquals(6, v.id()); assertEquals("person", v.label()); assertEquals(Integer.valueOf(35), v.value("age")); assertEquals(1, IteratorUtils.count(v.edges(Direction.OUT))); http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7aa9782c/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java ---------------------------------------------------------------------- diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java index 2b953ab..4dbbc5f 100644 --- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java +++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java @@ -648,7 +648,7 @@ public class TransactionTest extends AbstractGremlinTest { } catch (Exception ex) { assertThat(ex, instanceOf(IllegalStateException.class)); } finally { - threadedG.tx().rollback(); + if (threadedG.tx().isOpen()) threadedG.tx().rollback(); } }