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:50 UTC

[03/15] incubator-tinkerpop git commit: Move test to IoTest

Move test to IoTest


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/38ad2a01
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/38ad2a01
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/38ad2a01

Branch: refs/heads/master
Commit: 38ad2a015d2bf6c397d65facc87c70c65babac3f
Parents: 19d0a81
Author: Benjamin Han <be...@siftsec.com>
Authored: Wed Dec 9 15:05:42 2015 -0800
Committer: Benjamin Han <be...@siftsec.com>
Committed: Wed Dec 9 15:05:42 2015 -0800

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/io/IoTest.java  | 25 ++++++++
 .../io/graphson/GraphSONReaderTest.java         | 62 --------------------
 2 files changed, 25 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/38ad2a01/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 40950f9..192fd26 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
@@ -42,6 +42,7 @@ import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONTokens;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.LegacyGraphSONReader;
 import org.apache.tinkerpop.gremlin.structure.io.util.CustomId;
+import org.apache.tinkerpop.gremlin.structure.util.GraphFactory;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 import org.apache.tinkerpop.shaded.jackson.databind.JsonNode;
 import org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper;
@@ -368,6 +369,30 @@ public class IoTest {
             // the id is lossy in migration because TP2 treated ID as String
             assertClassicGraph(graph, false, true);
         }
+
+        @Test
+        public void shouldReadWriteSelfLoopingEdges() {
+            final Configuration sourceConf = graphProvider.newGraphConfiguration("source", this.getClass(), name.getMethodName(), null);
+            final Graph source = GraphFactory.open(sourceConf);
+            final Vertex v1 = source.addVertex();
+            final Vertex v2 = source.addVertex();
+            v1.addEdge("CONTROL", v2);
+            v1.addEdge("SELF-LOOP", v1);
+
+            final Configuration targetConf = graphProvider.newGraphConfiguration("target", this.getClass(), name.getMethodName(), null);
+            final Graph target = GraphFactory.open(targetConf);
+            try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
+                source.io(IoCore.graphson()).writer().create().writeGraph(os, source);
+                try (ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray())) {
+                    target.io(IoCore.graphson()).reader().create().readGraph(is, target);
+                }
+            } catch (IOException ioe) {
+                throw new RuntimeException(ioe);
+            }
+
+            assertEquals(source.traversal().V().count(), target.traversal().V().count());
+            assertEquals(source.traversal().E().count(), target.traversal().E().count());
+        }
     }
 
     public static void assertCrewGraph(final Graph g1, final boolean lossyForId) {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/38ad2a01/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReaderTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReaderTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReaderTest.java
deleted file mode 100644
index 1dbfddb..0000000
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReaderTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.structure.io.graphson;
-
-import org.apache.commons.configuration.Configuration;
-import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.io.IoCore;
-import org.apache.tinkerpop.gremlin.structure.util.GraphFactory;
-import org.junit.Test;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Created by Benjamin Han
- */
-public class GraphSONReaderTest extends AbstractGremlinTest {
-
-    @Test
-    public void shouldReadWriteSelfLoopingEdges() {
-        final Configuration sourceConf = graphProvider.newGraphConfiguration("source", this.getClass(), name.getMethodName(), null);
-        final Graph source = GraphFactory.open(sourceConf);
-        Vertex v1 = source.addVertex();
-        Vertex v2 = source.addVertex();
-        v1.addEdge("CONTROL", v2);
-        v1.addEdge("SELF-LOOP", v1);
-
-        final Configuration targetConf = graphProvider.newGraphConfiguration("target", this.getClass(), name.getMethodName(), null);
-        final Graph target = GraphFactory.open(targetConf);
-        try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-            source.io(IoCore.graphson()).writer().create().writeGraph(os, source);
-            ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());
-            target.io(IoCore.graphson()).reader().create().readGraph(is, target);
-        } catch (IOException ioe) {
-            throw new RuntimeException(ioe);
-        }
-
-        assertEquals(source.traversal().V().count(), target.traversal().V().count());
-        assertEquals(source.traversal().E().count(), target.traversal().E().count());
-    }
-}