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/04/22 20:41:54 UTC
incubator-tinkerpop git commit: Converted stargraph serialization
sizer into a test.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master 630b8f100 -> 169ba7988
Converted stargraph serialization sizer into a test.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/169ba798
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/169ba798
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/169ba798
Branch: refs/heads/master
Commit: 169ba7988750cf48ce6f07c20344d39c81db7b92
Parents: 630b8f1
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Apr 22 14:41:26 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Apr 22 14:41:26 2015 -0400
----------------------------------------------------------------------
.../tinkergraph/structure/TinkerGraphTest.java | 40 ++++++++++----------
1 file changed, 19 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/169ba798/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
index dcadedb..52febd7 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
@@ -177,54 +177,52 @@ public class TinkerGraphTest {
}
@Test
- @Ignore
- public void testPlay5() throws Exception {
- Graph graph = TinkerGraph.open();
+ public void shouldHaveSizeOfStarGraphLessThanDetached() throws Exception {
+ final Graph graph = TinkerGraph.open();
final Random random = new Random();
final Vertex vertex = graph.addVertex("person");
- System.out.println(randomString(4));
for(int i=0;i<100000;i++) {
vertex.addEdge("knows",graph.addVertex("person"),"since",random.nextLong(),"created","blah");
}
+
StarGraph starGraph = StarGraph.of(vertex);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
GryoWriter.build().create().writeObject(outputStream, starGraph);
outputStream.flush();
- System.out.println("Size of star graph (1): " + outputStream.size());
+ final int starGraph1 = outputStream.size();
+ System.out.println("Size of star graph (1): " + starGraph1);
///
starGraph = GryoReader.build().create().readObject(new ByteArrayInputStream(outputStream.toByteArray()));
outputStream = new ByteArrayOutputStream();
GryoWriter.build().create().writeObject(outputStream, starGraph);
outputStream.flush();
- System.out.println("Size of star graph (2): " + outputStream.size());
+ final int starGraph2 = outputStream.size();
+ System.out.println("Size of star graph (2): " + starGraph2);
+
+ assertEquals(starGraph1, starGraph2);
+
//
starGraph = GryoReader.build().create().readObject(new ByteArrayInputStream(outputStream.toByteArray()));
outputStream = new ByteArrayOutputStream();
GryoWriter.build().create().writeObject(outputStream, starGraph);
outputStream.flush();
- System.out.println("Size of star graph (3): " + outputStream.size());
+ final int starGraph3 = outputStream.size();
+ System.out.println("Size of star graph (3): " + starGraph3);
+
+ assertEquals(starGraph1, starGraph3);
+ assertEquals(starGraph2, starGraph3);
- //starGraph.getStarVertex().edges(Direction.OUT).forEachRemaining(System.out::println);
+ //starGraph.getStarVertex().edges(Direction.OUT).forEachRemaining(System.out::println);
/////////
outputStream = new ByteArrayOutputStream();
GryoWriter.build().create().writeVertex(outputStream, vertex, Direction.BOTH);
outputStream.flush();
- System.out.println("Size of detached vertex (1): " + outputStream.size());
+ final int detached = outputStream.size();
+ System.out.println("Size of detached vertex (1): " + detached);
-
-
- }
-
- private String randomString(final int length) {
- Random random = new Random();
- String randomString = new String();
- for(int i =0;i<length;i++) {
- final String temp = String.valueOf((char) random.nextInt());
- randomString = randomString + (temp.equals("~") ? "a" : temp);
- }
- return randomString;
+ assertTrue(starGraph1 < detached);
}
@Test