tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [39/50] tinkerpop git commit: Merge branch 'tp32' into tp33
Date Thu, 09 Aug 2018 14:55:34 GMT
Merge branch 'tp32' into tp33

Conflicts:
	gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyPageRankTest.groovy
	gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyPeerPressureTest.groovy
	gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/AbstractGremlinProcessTest.java
	gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PageRankTest.java


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

Branch: refs/heads/TINKERPOP-1967
Commit: b12a3fdd01f0505773d865538e987de66c74d044
Parents: fa7a7f6 a533878
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Thu Aug 9 10:12:44 2018 -0400
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Thu Aug 9 10:12:44 2018 -0400

----------------------------------------------------------------------
 .../gremlin/process/remote/RemoteGraph.java     |  17 ---
 .../io/graphson/TraversalSerializersV2d0.java   |   4 -
 .../ModernGraphTypeInformation.cs               |   4 +
 .../DriverRemoteTraversalSideEffects.java       |   3 +-
 .../test/cucumber/feature-steps.js              |  14 +-
 .../glv/GraphTraversalSource.template           |   2 +-
 .../gremlin_python/process/graph_traversal.py   |   2 +-
 .../RemoteGraphGroovyTranslatorProvider.java    |   3 +-
 gremlin-test/features/map/PageRank.feature      | 132 +++++++++++++++++++
 gremlin-test/features/map/PeerPressure.feature  |  60 +++++++++
 .../process/AbstractGremlinProcessTest.java     |  26 ++--
 .../traversal/step/map/PageRankTest.java        |  37 +++---
 .../traversal/step/map/PeerPressureTest.java    |  25 ++--
 .../TranslationStrategyProcessTest.java         |   3 +
 .../gremlin/process/FeatureCoverageTest.java    |   6 +-
 15 files changed, 266 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b12a3fdd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/RemoteGraph.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b12a3fdd/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b12a3fdd/gremlin-python/glv/GraphTraversalSource.template
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b12a3fdd/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b12a3fdd/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/RemoteGraphGroovyTranslatorProvider.java
----------------------------------------------------------------------
diff --cc gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/RemoteGraphGroovyTranslatorProvider.java
index 6949426,e170cb1..38935a0
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/RemoteGraphGroovyTranslatorProvider.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/RemoteGraphGroovyTranslatorProvider.java
@@@ -35,28 -29,9 +35,29 @@@ import java.util.Set
   */
  public class RemoteGraphGroovyTranslatorProvider extends RemoteGraphProvider {
  
 +    private static boolean SKIP = false;
 +
 +    private static Set<String> SKIP_TESTS = new HashSet<>(Arrays.asList(
-             "g_injectXg_VX1X_propertiesXnameX_nextX_value"));
++            "g_injectXg_VX1X_propertiesXnameX_nextX_value",
++            "shouldNotHaveAnonymousTraversalMixups"));
 +
 +
 +    @Override
 +    public Map<String, Object> getBaseConfiguration(final String graphName, final
Class<?> test, final String testMethodName,
 +                                                    final LoadGraphWith.GraphData loadGraphWith)
{
 +
 +        final Map<String, Object> config = super.getBaseConfiguration(graphName, test,
testMethodName, loadGraphWith);
 +        SKIP = SKIP_TESTS.contains(testMethodName) || SKIP_TESTS.contains(test.getCanonicalName());
 +        return config;
 +    }
 +
      @Override
      public GraphTraversalSource traversal(final Graph graph) {
 -        final GraphTraversalSource g = graph.traversal();
 -        return g.withStrategies(new TranslationStrategy(g, GroovyTranslator.of("g")));
 +        if (SKIP)
 +            return super.traversal(graph);
 +        else {
 +            final GraphTraversalSource g = super.traversal(graph);
 +            return g.withStrategies(new TranslationStrategy(g, GroovyTranslator.of("g")));
 +        }
      }
  }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b12a3fdd/gremlin-test/features/map/PageRank.feature
----------------------------------------------------------------------
diff --cc gremlin-test/features/map/PageRank.feature
index 0000000,bf2ed26..8ead2d4
mode 000000,100644..100644
--- a/gremlin-test/features/map/PageRank.feature
+++ b/gremlin-test/features/map/PageRank.feature
@@@ -1,0 -1,142 +1,132 @@@
+ # 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.
+ 
+ Feature: Step - pageRank()
+                 
+   Scenario: g_V_pageRank_hasXpageRankX
+     Given the modern graph
+     And the traversal of
+       """
+       g.withComputer().V().pageRank().has("gremlin.pageRankVertexProgram.pageRank")
+       """
+     When iterated to list
+     Then the result should be unordered
+       | result |
+       | v[marko] |
+       | v[vadas] |
+       | v[lop] |
+       | v[josh] |
+       | v[ripple] |
+       | v[peter] |
+     And the graph should return 6 for count of "g.withComputer().V().pageRank().has(\"gremlin.pageRankVertexProgram.pageRank\")"
+ 
+   Scenario: g_V_outXcreatedX_pageRank_byXbothEX_byXprojectRankX_timesX0X_valueMapXname_projectRankX
+     Given the modern graph
+     And the traversal of
+       """
+       g.withComputer().V().out("created").pageRank().by(__.bothE()).by("projectRank").times(0).valueMap("name",
"projectRank")
+       """
+     When iterated to list
+     Then the result should be unordered
+       | result |
+       | m[{"name": ["lop"], "projectRank": [3.0]}] |
+       | m[{"name": ["lop"], "projectRank": [3.0]}] |
+       | m[{"name": ["lop"], "projectRank": [3.0]}] |
+       | m[{"name": ["ripple"], "projectRank": [1.0]}] |
+ 
+   Scenario: g_V_pageRank_order_byXpageRank_decrX_byXnameX_name
+     Given the modern graph
+     And the traversal of
+       """
+       g.withComputer().V().pageRank().order().by("gremlin.pageRankVertexProgram.pageRank",
Order.decr).by("name").values("name")
+       """
+     When iterated to list
+     Then the result should be ordered
+       | result |
+       | lop    |
+       | ripple |
+       | josh   |
+       | vadas  |
+       | marko  |
+       | peter  |
+ 
+   Scenario: g_V_pageRank_order_byXpageRank_decrX_name_limitX2X
+     Given the modern graph
+     And the traversal of
+       """
+       g.withComputer().V().pageRank().order().by("gremlin.pageRankVertexProgram.pageRank",
Order.decr).values("name").limit(2)
+       """
+     When iterated to list
+     Then the result should be ordered
+       | result |
+       | lop    |
+       | ripple |
+ 
+   Scenario: g_V_pageRank_byXoutEXknowsXX_byXfriendRankX_valueMapXname_friendRankX
+     Given the modern graph
+     And the traversal of
+       """
+       g.withComputer().V().pageRank().by(__.outE("knows")).by("friendRank").valueMap("name",
"friendRank")
+       """
+     When iterated to list
+     Then the result should be unordered
+       | result |
 -      | m[{"name": ["marko"], "friendRank": [0.15000000000000002]}] |
 -      | m[{"name": ["vadas"], "friendRank": [0.21375000000000002]}] |
 -      | m[{"name": ["lop"], "friendRank": [0.15000000000000002]}] |
 -      | m[{"name": ["josh"], "friendRank": [0.21375000000000002]}] |
 -      | m[{"name": ["ripple"], "friendRank": [0.15000000000000002]}] |
 -      | m[{"name": ["peter"], "friendRank": [0.15000000000000002]}] |
++      | m[{"name": ["marko"], "friendRank": [0.14598537777608422]}] |
++      | m[{"name": ["vadas"], "friendRank": [0.20802924444783155]}] |
++      | m[{"name": ["lop"], "friendRank": [0.14598537777608422]}] |
++      | m[{"name": ["josh"], "friendRank": [0.20802924444783155]}] |
++      | m[{"name": ["ripple"], "friendRank": [0.14598537777608422]}] |
++      | m[{"name": ["peter"], "friendRank": [0.14598537777608422]}] |
+ 
+   Scenario: g_V_hasLabelXpersonX_pageRank_byXpageRankX_order_byXpageRankX_valueMapXname_pageRankX
 -    Given the modern graph
 -    And the traversal of
++    Given an unsupported test
++    Then nothing should happen because
+       """
 -      g.withComputer().V().hasLabel("person").pageRank().by("pageRank").order().by("pageRank").valueMap("name",
"pageRank")
++      The result is not completely deterministic with respect to the decimals that pageRank()
produces and the
++      GLV framework does not have a notion for asserting anything beyond an equals() sort
of state.
+       """
 -    When iterated to list
 -    Then the result should be unordered
 -      | result |
 -      | m[{"name": ["marko"], "pageRank": [0.15000000000000002]}] |
 -      | m[{"name": ["vadas"], "pageRank": [0.19250000000000003]}] |
 -      | m[{"name": ["josh"], "pageRank": [0.19250000000000003]}] |
 -      | m[{"name": ["peter"], "pageRank": [0.15000000000000002]}] |
+ 
+   Scenario: g_V_pageRank_byXpageRankX_asXaX_outXknowsX_pageRank_asXbX_selectXa_bX
 -    Given the modern graph
 -    And the traversal of
++    Given an unsupported test
++    Then nothing should happen because
+       """
 -      g.withComputer().V().pageRank().by("pageRank").as("a").out("knows").values("pageRank").as("b").select("a",
"b")
++      The result is not completely deterministic with respect to the decimals that pageRank()
produces and the
++      GLV framework does not have a notion for asserting anything beyond an equals() sort
of state.
+       """
 -    When iterated to list
 -    Then the result should be unordered
 -      | result |
 -      | m[{"a": "v[marko]", "b": 0.19250000000000003}] |
 -      | m[{"a": "v[marko]", "b": 0.19250000000000003}] |
+ 
+   Scenario: g_V_hasLabelXsoftwareX_hasXname_rippleX_pageRankX1X_byXinEXcreatedXX_timesX1X_byXpriorsX_inXcreatedX_unionXboth__identityX_valueMapXname_priorsX
+     Given the modern graph
+     And the traversal of
+       """
+       g.withComputer().V().hasLabel("software").has("name", "ripple").pageRank(1.0).by(__.inE("created")).times(1).by("priors").in("created").union(__.both(),
__.identity()).valueMap("name", "priors")
+       """
+     When iterated to list
+     Then the result should be unordered
+       | result |
+       | m[{"name": ["josh"], "priors": [1.0]}] |
+       | m[{"name": ["marko"], "priors": [0.0]}] |
+       | m[{"name": ["lop"], "priors": [0.0]}] |
+       | m[{"name": ["ripple"], "priors": [0.0]}] |
+ 
+   Scenario: g_V_outXcreatedX_groupXmX_byXlabelX_pageRankX1X_byXpageRankX_byXinEX_timesX1X_inXcreatedX_groupXmX_byXpageRankX_capXmX()
+     Given an unsupported test
+     Then nothing should happen because
+       """
+       The result returned is not supported under GraphSON 2.x and therefore cannot be properly
asserted. More
+       specifically it has long keys which basically get toString()'d under GraphSON 2.x.
This test can be supported
+       with GraphSON 3.x.
+       """

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b12a3fdd/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/AbstractGremlinProcessTest.java
----------------------------------------------------------------------
diff --cc gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/AbstractGremlinProcessTest.java
index 2861724,c3f4dc2..4749e93
--- 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
@@@ -128,9 -136,7 +136,9 @@@ public abstract class AbstractGremlinPr
  
          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 if (t instanceof List) {
-                 assertThat("Checking list result existence: " + t, expectedResults.stream().filter(e
-> e instanceof List).filter(e -> internalCheckList((List) e, (List) t)).findAny().isPresent(),
is(true));
++                assertThat("Checking list result existence: " + t, expectedResults.stream().filter(e
-> e instanceof List).anyMatch(e -> internalCheckList((List) e, (List) t)), is(true));
              } else {
                  assertThat("Checking result existence: " + t, expectedResults.contains(t),
is(true));
              }
@@@ -164,21 -170,9 +172,21 @@@
          }
      }
  
 +    private static <A> boolean internalCheckList(final List<A> expectedList,
final List<A> actualList) {
 +        if (expectedList.size() != actualList.size()) {
 +            return false;
 +        }
 +        for (int i = 0; i < actualList.size(); i++) {
 +            if (!actualList.get(i).equals(expectedList.get(i))) {
 +                return false;
 +            }
 +        }
 +        return true;
 +    }
 +
      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;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b12a3fdd/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PageRankTest.java
----------------------------------------------------------------------
diff --cc gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PageRankTest.java
index 07a2b04,0c0a91d..620d0e3
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PageRankTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PageRankTest.java
@@@ -51,9 -52,9 +52,9 @@@ public abstract class PageRankTest exte
  
      public abstract Traversal<Vertex, Map<String, List<Object>>> get_g_V_outXcreatedX_pageRank_byXbothEX_byXprojectRankX_timesX0X_valueMapXname_projectRankX();
  
-     public abstract Traversal<Vertex, String> get_g_V_pageRank_order_byXpageRank_descX_name();
 -    public abstract Traversal<Vertex, String> get_g_V_pageRank_order_byXpageRank_decrX_byXnameX_name();
++    public abstract Traversal<Vertex, String> get_g_V_pageRank_order_byXpageRank_descX_byXnameX_name();
  
 -    public abstract Traversal<Vertex, String> get_g_V_pageRank_order_byXpageRank_decrX_name_limitX2X();
 +    public abstract Traversal<Vertex, String> get_g_V_pageRank_order_byXpageRank_descX_name_limitX2X();
  
      public abstract Traversal<Vertex, Map<String, List<Object>>> get_g_V_pageRank_byXoutEXknowsXX_byXfriendRankX_valueMapXname_friendRankX();
  
@@@ -99,8 -94,8 +94,8 @@@
  
      @Test
      @LoadGraphWith(MODERN)
-     public void g_V_pageRank_order_byXpageRank_descX_name() {
-         final Traversal<Vertex, String> traversal = get_g_V_pageRank_order_byXpageRank_descX_name();
 -    public void g_V_pageRank_order_byXpageRank_decrX_byXnameX_name() {
 -        final Traversal<Vertex, String> traversal = get_g_V_pageRank_order_byXpageRank_decrX_byXnameX_name();
++    public void g_V_pageRank_order_byXpageRank_descX_byXnameX_name() {
++        final Traversal<Vertex, String> traversal = get_g_V_pageRank_order_byXpageRank_descX_byXnameX_name();
          printTraversalForm(traversal);
          final List<String> names = traversal.toList();
          assertEquals(6, names.size());
@@@ -256,8 -251,8 +251,8 @@@
          }
  
          @Override
-         public Traversal<Vertex, String> get_g_V_pageRank_order_byXpageRank_descX_name()
{
-             return g.V().pageRank().order().by(PageRankVertexProgram.PAGE_RANK, Order.desc).values("name");
 -        public Traversal<Vertex, String> get_g_V_pageRank_order_byXpageRank_decrX_byXnameX_name()
{
 -            return g.V().pageRank().order().by(PageRankVertexProgram.PAGE_RANK, Order.decr).by("name").values("name");
++        public Traversal<Vertex, String> get_g_V_pageRank_order_byXpageRank_descX_byXnameX_name()
{
++            return g.V().pageRank().order().by(PageRankVertexProgram.PAGE_RANK, Order.desc).by("name").values("name");
          }
  
          @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b12a3fdd/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PeerPressureTest.java
----------------------------------------------------------------------


Mime
View raw message