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 2016/01/12 22:10:54 UTC

[07/15] incubator-tinkerpop git commit: Fix graphMl reader test

Fix graphMl reader 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/7b700c13
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/7b700c13
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/7b700c13

Branch: refs/heads/master
Commit: 7b700c130a5af9bf598c1a7d2ebec918daf9630c
Parents: 413caf5
Author: Benjamin Han <be...@siftsec.com>
Authored: Thu Dec 10 09:15:07 2015 -0800
Committer: Benjamin Han <be...@siftsec.com>
Committed: Thu Dec 10 09:15:07 2015 -0800

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/io/IoTest.java      | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7b700c13/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java
index 2635b85..1c1e567 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/IoTest.java
@@ -263,17 +263,15 @@ public class IoTest {
             v1.addEdge("CONTROL", v2);
             v1.addEdge("SELF-LOOP", v1);
 
-            final GraphMLWriter w = GraphMLWriter.build().create();
-            final File f = TestHelper.generateTempFile(this.getClass(), "test", ".txt");
-            try (final OutputStream out = new FileOutputStream(f)) {
-                w.writeGraph(out, graph);
-            }
-
             final Configuration targetConf = graphProvider.newGraphConfiguration("target", this.getClass(), name.getMethodName(), null);
             final Graph target = GraphFactory.open(targetConf);
-            final GraphMLReader r = GraphMLReader.build().create();
-            try (final InputStream in = new FileInputStream(f)) {
-                r.readGraph(in, target);
+            try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
+                source.io(IoCore.graphml()).writer().create().writeGraph(os, source);
+                try (ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray())) {
+                    target.io(IoCore.graphml()).reader().create().readGraph(is, target);
+                }
+            } catch (IOException ioe) {
+                throw new RuntimeException(ioe);
             }
 
             assertEquals(IteratorUtils.count(source.vertices()), IteratorUtils.count(target.vertices()));