tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [26/50] [abbrv] tinkerpop git commit: TINKERPOP-1385 Bound profile test assertions to TinkerGraph
Date Wed, 19 Jul 2017 19:19:25 GMT
TINKERPOP-1385 Bound profile test assertions to TinkerGraph

Assertions were too stringent for graph providers who had complex strategies.


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

Branch: refs/heads/TINKERPOP-1716
Commit: d27fc7d2465af97aa583cb6c072391273286d322
Parents: 402678b
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Sun Jul 9 09:54:21 2017 -0400
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Sun Jul 9 09:54:21 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../process/traversal/step/map/ProfileTest.java | 38 ++++++++++++++------
 2 files changed, 29 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d27fc7d2/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 96e79ab..05e20bb 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -28,6 +28,7 @@ TinkerPop 3.2.6 (Release Date: NOT OFFICIALLY RELEASED YET)
 
 This release also includes changes from <<release-3-1-8, 3.1.8>>.
 
+* `ProfileTest` is now less stringent about assertions which will reduce burdens on providers.
 * `ReferenceFactory` and `DetachedFactory` now detach elements in collections accordingly.
 * Deprecated the `useMapperFromGraph` configuration option for Gremlin Server serializers.
 * `JavaTranslator` is now smart about handling `BulkSet` and `Tree`.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d27fc7d2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProfileTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProfileTest.java
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProfileTest.java
index 1af6ba3..7ac3059 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProfileTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProfileTest.java
@@ -53,11 +53,14 @@ import java.util.concurrent.TimeUnit;
 import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.GRATEFUL;
 import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN;
 import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.both;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeThat;
 
 /**
  * @author Bob Briody (http://bobbriody.com)
@@ -105,12 +108,15 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest
{
         final Traversal<Vertex, Vertex> traversal = get_g_V_out_out_profileXmetricsX();
         printTraversalForm(traversal);
         traversal.iterate();
-        validate_g_V_out_out_profile_modern(traversal, traversal.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY));
+        validate_g_V_out_out_profile_modern(traversal, traversal.asAdmin().getSideEffects().get(METRICS_KEY));
     }
 
     private void validate_g_V_out_out_profile_modern(final Traversal traversal, final TraversalMetrics
traversalMetrics) {
         traversalMetrics.toString(); // ensure no exceptions are thrown
 
+        assumeThat("The following assertions apply to TinkerGraph only as provider strategies
can alter the steps to not comply with expectations",
+                graph.getClass().getSimpleName(), equalTo("TinkerGraph"));
+
         Metrics metrics = traversalMetrics.getMetrics(0);
         assertEquals(6, metrics.getCount(TraversalMetrics.TRAVERSER_COUNT_ID).longValue());
         assertEquals(6, metrics.getCount(TraversalMetrics.ELEMENT_COUNT_ID).longValue());
@@ -149,13 +155,16 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest
{
         final Traversal<Vertex, Vertex> traversal = get_g_V_out_out_profileXmetricsX();
         printTraversalForm(traversal);
         traversal.iterate();
-        final TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY);
+        final TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().get(METRICS_KEY);
         validate_g_V_out_out_profile_grateful(traversalMetrics);
     }
 
-    private void validate_g_V_out_out_profile_grateful(TraversalMetrics traversalMetrics)
{
+    private void validate_g_V_out_out_profile_grateful(final TraversalMetrics traversalMetrics)
{
         traversalMetrics.toString(); // ensure no exceptions are thrown
 
+        assumeThat("The following assertions apply to TinkerGraph only as provider strategies
can alter the steps to not comply with expectations",
+                graph.getClass().getSimpleName(), equalTo("TinkerGraph"));
+
         Metrics metrics = traversalMetrics.getMetrics(0);
         assertEquals(808, metrics.getCount(TraversalMetrics.TRAVERSER_COUNT_ID).longValue());
         assertEquals(808, metrics.getCount(TraversalMetrics.ELEMENT_COUNT_ID).longValue());
@@ -202,13 +211,16 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest
{
         printTraversalForm(traversal);
         traversal.iterate();
         assertEquals("There should be 7 steps in this traversal (counting injected profile
steps).", 7, traversal.asAdmin().getSteps().size());
-        TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY);
+        TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().get(METRICS_KEY);
         validate_g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profile(traversalMetrics);
     }
 
-    private void validate_g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profile(TraversalMetrics
traversalMetrics) {
+    private void validate_g_V_sideEffectXThread_sleepX10XX_sideEffectXThread_sleepX5XX_profile(final
TraversalMetrics traversalMetrics) {
         traversalMetrics.toString(); // ensure no exceptions are thrown
 
+        assumeThat("The following assertions apply to TinkerGraph only as provider strategies
can alter the steps to not comply with expectations",
+                graph.getClass().getSimpleName(), equalTo("TinkerGraph"));
+
         // Grab the second (sideEffect{sleep}) step and check the times.
         Metrics metrics = traversalMetrics.getMetrics(1);
         // 6 elements w/ a 10ms sleep each = 60ms with 10ms for other computation.
@@ -247,15 +259,18 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest
{
         final Traversal<Vertex, Vertex> traversal = get_g_V_repeatXbothX_timesX3X_profileXmetricsX();
         printTraversalForm(traversal);
         traversal.iterate();
-        final TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY);
+        final TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().get(METRICS_KEY);
         validate_g_V_repeat_both_modern_profile(traversalMetrics,
                 traversal.asAdmin().getStrategies().toList().contains(RepeatUnrollStrategy.instance())
&&
                         !traversal.asAdmin().getStrategies().toList().contains(ComputerVerificationStrategy.instance()));
     }
 
-    private void validate_g_V_repeat_both_modern_profile(TraversalMetrics traversalMetrics,
boolean withRepeatUnrollStrategy) {
+    private void validate_g_V_repeat_both_modern_profile(final TraversalMetrics traversalMetrics,
final boolean withRepeatUnrollStrategy) {
         traversalMetrics.toString(); // ensure no exceptions are thrown
 
+        assumeThat("The following assertions apply to TinkerGraph only as provider strategies
can alter the steps to not comply with expectations",
+                graph.getClass().getSimpleName(), equalTo("TinkerGraph"));
+
         Metrics metrics = traversalMetrics.getMetrics(0);
         assertEquals(6, metrics.getCount(TraversalMetrics.TRAVERSER_COUNT_ID).longValue());
         assertEquals(6, metrics.getCount(TraversalMetrics.ELEMENT_COUNT_ID).longValue());
@@ -286,9 +301,12 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest
{
 
     /////////////
 
-    private void validate_g_V_whereXinXcreatedX_count_isX1XX_name_profile(Traversal traversal,
TraversalMetrics traversalMetrics) {
+    private void validate_g_V_whereXinXcreatedX_count_isX1XX_name_profile(final Traversal
traversal, final TraversalMetrics traversalMetrics) {
         traversalMetrics.toString(); // ensure no exceptions are thrown
 
+        assumeThat("The following assertions apply to TinkerGraph only as provider strategies
can alter the steps to not comply with expectations",
+                graph.getClass().getSimpleName(), equalTo("TinkerGraph"));
+
         assertEquals("There should be 3 top-level metrics.", 3, traversalMetrics.getMetrics().size());
 
         Metrics metrics = traversalMetrics.getMetrics(0);
@@ -321,7 +339,7 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
         final Traversal<Vertex, String> traversal = get_g_V_whereXinXcreatedX_count_isX1XX_name_profileXmetricsX();
         printTraversalForm(traversal);
         traversal.iterate();
-        final TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY);
+        final TraversalMetrics traversalMetrics = traversal.asAdmin().getSideEffects().get(METRICS_KEY);
         validate_g_V_whereXinXcreatedX_count_isX1XX_name_profile(traversal, traversalMetrics);
     }
 
@@ -377,7 +395,7 @@ public abstract class ProfileTest extends AbstractGremlinProcessTest {
         assertTrue(mockStep.callbackCalled);
 
         if (!onGraphComputer(t.asAdmin())) {
-            final TraversalMetrics traversalMetrics = t.asAdmin().getSideEffects().<TraversalMetrics>get(METRICS_KEY);
+            final TraversalMetrics traversalMetrics = t.asAdmin().getSideEffects().get(METRICS_KEY);
             assertEquals(100, traversalMetrics.getMetrics(3).getCount("bogusCount").longValue());
         }
     }


Mime
View raw message