tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [2/2] tinkerpop git commit: TINKERPOP-1976 Minor refactoring and test message improvement
Date Sat, 04 Aug 2018 10:02:45 GMT
TINKERPOP-1976 Minor refactoring and test message improvement


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

Branch: refs/heads/TINKERPOP-1976
Commit: bdcdaa7bb59f4d365fd89e99ddb0b1b64aa86b62
Parents: 9cb6204
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Sat Aug 4 06:01:53 2018 -0400
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Sat Aug 4 06:01:53 2018 -0400

----------------------------------------------------------------------
 .../io/graphson/TraversalSerializersV2d0.java         |  4 ----
 .../gremlin/process/AbstractGremlinProcessTest.java   | 14 +++++++-------
 2 files changed, 7 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bdcdaa7b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java
index 040fd1d..2a07723 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java
@@ -37,18 +37,14 @@ import org.apache.tinkerpop.shaded.jackson.core.JsonParser;
 import org.apache.tinkerpop.shaded.jackson.core.JsonProcessingException;
 import org.apache.tinkerpop.shaded.jackson.core.JsonToken;
 import org.apache.tinkerpop.shaded.jackson.databind.DeserializationContext;
-import org.apache.tinkerpop.shaded.jackson.databind.JavaType;
-import org.apache.tinkerpop.shaded.jackson.databind.JsonNode;
 import org.apache.tinkerpop.shaded.jackson.databind.SerializerProvider;
 import org.apache.tinkerpop.shaded.jackson.databind.deser.std.StdDeserializer;
 import org.apache.tinkerpop.shaded.jackson.databind.jsontype.TypeSerializer;
 import org.apache.tinkerpop.shaded.jackson.databind.ser.std.StdScalarSerializer;
 import org.apache.tinkerpop.shaded.jackson.databind.ser.std.StdSerializer;
-import org.apache.tinkerpop.shaded.jackson.databind.type.TypeFactory;
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bdcdaa7b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/AbstractGremlinProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/AbstractGremlinProcessTest.java
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/AbstractGremlinProcessTest.java
index 9dbf261..96dee1d 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/AbstractGremlinProcessTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/AbstractGremlinProcessTest.java
@@ -30,6 +30,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -40,7 +41,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.core.Is.is;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeTrue;
 
 /**
@@ -81,7 +81,7 @@ public abstract class AbstractGremlinProcessTest extends AbstractGremlinTest
{
             final String methodName = testName.contains("[") ? testName.substring(0, testName.indexOf('['))
: testName;
             final IgnoreEngine ignoreEngine = this.getClass().getMethod(methodName).getAnnotation(IgnoreEngine.class);
             if (ignoreEngine != null)
-                assumeTrue(String.format("This test is ignored for %s", ignoreEngine.value()),
!ignoreEngine.value().equals(GraphManager.getTraversalEngineType()));
+                assumeTrue(String.format("%s.%s is ignored for %s", this.getClass().getName(),
testName, ignoreEngine.value()), !ignoreEngine.value().equals(GraphManager.getTraversalEngineType()));
         } catch (NoSuchMethodException nsme) {
             // some tests are parameterized
             throw new RuntimeException(String.format("Could not find test method %s in test
case %s", name.getMethodName(), this.getClass().getName()));
@@ -128,7 +128,7 @@ public abstract class AbstractGremlinProcessTest extends AbstractGremlinTest
{
 
         for (T t : results) {
             if (t instanceof Map) {
-                assertThat("Checking map result existence: " + t, expectedResults.stream().filter(e
-> e instanceof Map).filter(e -> internalCheckMap((Map) e, (Map) t)).findAny().isPresent(),
is(true));
+                assertThat("Checking map result existence: " + t, expectedResults.stream().filter(e
-> e instanceof Map).anyMatch(e -> internalCheckMap((Map) e, (Map) t)), is(true));
             } else {
                 assertThat("Checking result existence: " + t, expectedResults.contains(t),
is(true));
             }
@@ -153,8 +153,8 @@ public abstract class AbstractGremlinProcessTest extends AbstractGremlinTest
{
     }
 
     public static <A, B> void checkMap(final Map<A, B> expectedMap, final Map<A,
B> actualMap) {
-        final List<Map.Entry<A, B>> actualList = actualMap.entrySet().stream().sorted((a,
b) -> a.getKey().toString().compareTo(b.getKey().toString())).collect(Collectors.toList());
-        final List<Map.Entry<A, B>> expectedList = expectedMap.entrySet().stream().sorted((a,
b) -> a.getKey().toString().compareTo(b.getKey().toString())).collect(Collectors.toList());
+        final List<Map.Entry<A, B>> actualList = actualMap.entrySet().stream().sorted(Comparator.comparing(a
-> a.getKey().toString())).collect(Collectors.toList());
+        final List<Map.Entry<A, B>> expectedList = expectedMap.entrySet().stream().sorted(Comparator.comparing(a
-> a.getKey().toString())).collect(Collectors.toList());
         assertEquals(expectedList.size(), actualList.size());
         for (int i = 0; i < actualList.size(); i++) {
             assertEquals(expectedList.get(i).getKey(), actualList.get(i).getKey());
@@ -163,8 +163,8 @@ public abstract class AbstractGremlinProcessTest extends AbstractGremlinTest
{
     }
 
     private static <A, B> boolean internalCheckMap(final Map<A, B> expectedMap,
final Map<A, B> actualMap) {
-        final List<Map.Entry<A, B>> actualList = actualMap.entrySet().stream().sorted((a,
b) -> a.getKey().toString().compareTo(b.getKey().toString())).collect(Collectors.toList());
-        final List<Map.Entry<A, B>> expectedList = expectedMap.entrySet().stream().sorted((a,
b) -> a.getKey().toString().compareTo(b.getKey().toString())).collect(Collectors.toList());
+        final List<Map.Entry<A, B>> actualList = actualMap.entrySet().stream().sorted(Comparator.comparing(a
-> a.getKey().toString())).collect(Collectors.toList());
+        final List<Map.Entry<A, B>> expectedList = expectedMap.entrySet().stream().sorted(Comparator.comparing(a
-> a.getKey().toString())).collect(Collectors.toList());
 
         if (expectedList.size() != actualList.size()) {
             return false;


Mime
View raw message