You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/05/16 13:19:05 UTC
incubator-tinkerpop git commit: Feature check before asserting
metaproperties TINKERPOP3-685
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master 36fc0286b -> 4c104cebf
Feature check before asserting metaproperties TINKERPOP3-685
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/4c104ceb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/4c104ceb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/4c104ceb
Branch: refs/heads/master
Commit: 4c104cebfa23e95ef18862388ccb3746f19d50d9
Parents: 36fc028
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Sat May 16 07:18:26 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Sat May 16 07:18:26 2015 -0400
----------------------------------------------------------------------
.../org/apache/tinkerpop/gremlin/TestHelper.java | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c104ceb/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/TestHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/TestHelper.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/TestHelper.java
index 7a43de5..a9e4f31 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/TestHelper.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/TestHelper.java
@@ -152,13 +152,26 @@ public final class TestHelper {
public static void validateVertexPropertyEquality(final VertexProperty originalVertexProperty, final VertexProperty otherVertexProperty) {
assertEquals(originalVertexProperty, otherVertexProperty);
assertEquals(otherVertexProperty, originalVertexProperty);
+
if (originalVertexProperty.isPresent()) {
assertEquals(originalVertexProperty.key(), otherVertexProperty.key());
assertEquals(originalVertexProperty.value(), otherVertexProperty.value());
assertEquals(originalVertexProperty.element(), otherVertexProperty.element());
- assertEquals(originalVertexProperty.keys().size(), otherVertexProperty.keys().size());
- for (final String key : originalVertexProperty.keys()) {
- validatePropertyEquality(originalVertexProperty.property(key), otherVertexProperty.property(key));
+
+ final boolean originalSupportsMetaProperties = originalVertexProperty.graph().features().vertex().supportsMetaProperties();
+ final boolean otherSupportsMetaProperties = otherVertexProperty.graph().features().vertex().supportsMetaProperties();
+
+ // if one supports and the other doesn't then neither should have meta properties.
+ if (originalSupportsMetaProperties && !otherSupportsMetaProperties)
+ assertEquals(0, originalVertexProperty.keys().size());
+ else if (!originalSupportsMetaProperties && otherSupportsMetaProperties)
+ assertEquals(0, otherVertexProperty.keys().size());
+ else {
+ // both support it, so assert in full
+ assertEquals(originalVertexProperty.keys().size(), otherVertexProperty.keys().size());
+ for (final String key : originalVertexProperty.keys()) {
+ validatePropertyEquality(originalVertexProperty.property(key), otherVertexProperty.property(key));
+ }
}
}
}