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 2019/09/26 17:03:19 UTC
[tinkerpop] 03/04: Merge branch 'tp34'
This is an automated email from the ASF dual-hosted git repository.
spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit a96ef0337c5cd6259e3f6abba87a81e3da6750b7
Merge: 928541f a8751c3
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Thu Sep 26 11:48:15 2019 -0400
Merge branch 'tp34'
CHANGELOG.asciidoc | 5 +-
docs/src/upgrade/release-3.3.x.asciidoc | 16 +++
.../AbstractWarningVerificationStrategy.java | 111 +++++++++++++++++++++
.../EdgeLabelVerificationStrategy.java | 69 ++-----------
.../ReservedKeysVerificationStrategy.java | 106 ++++++++++++++++++++
.../EdgeLabelVerificationStrategyTest.java | 6 +-
...a => ReservedKeysVerificationStrategyTest.java} | 38 ++++---
.../Verification/EdgeLabelVerificationStrategy.cs | 49 +++++++++
.../ReservedKeysVerificationStrategy.cs | 55 ++++++++++
.../GraphTraversalSourceTests.cs | 2 +
.../main/jython/gremlin_python/driver/protocol.py | 3 +-
.../jython/gremlin_python/process/strategies.py | 18 +++-
.../tests/driver/test_driver_remote_connection.py | 15 ++-
.../tinkergraph/structure/TinkerGraphTest.java | 31 +++++-
14 files changed, 437 insertions(+), 87 deletions(-)
diff --cc gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
index e95a267,174fbc6..3cb9fa0
--- a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
@@@ -180,7 -181,129 +181,19 @@@ class TestDriverRemoteConnection(object
g = traversal().withRemote(remote_connection).withComputer()
assert 6 == g.V().count().next()
assert 6 == g.E().count().next()
+ #
+ g = traversal().withRemote(remote_connection). \
+ withStrategies(ReservedKeysVerificationStrategy(throw_exception=True))
+ try:
+ g.addV("person").property("id", "please-don't-use-id").iterate()
+ assert False
+ except GremlinServerError as gse:
+ assert gse.status_code == 500
+ except KeyError as ke:
+ # gross we need to fix this: https://issues.apache.org/jira/browse/TINKERPOP-2297
+ # would prefer to assert a GremlinServerError status code
+ assert True
- def test_side_effects(self, remote_connection):
- statics.load_statics(globals())
- #
- g = traversal().withRemote(remote_connection)
- ###
- t = g.V().hasLabel("project").name.iterate()
- assert 0 == len(t.side_effects.keys())
- with pytest.raises(Exception):
- m = t.side_effects["m"]
- ###
- t = g.V().out("created").groupCount("m").by("name")
- results = t.toSet()
- assert 2 == len(results)
- assert Vertex(3) in results
- assert Vertex(5) in results
- assert 1 == len(t.side_effects.keys())
- assert "m" in t.side_effects.keys()
- m = t.side_effects["m"]
- assert isinstance(m, dict)
- assert 2 == len(m)
- assert 3 == m["lop"]
- assert 1 == m["ripple"]
-
- # check status attributes
- assert "host" in t.side_effects.status_attributes
-
- ##
- t = g.V().out("created").groupCount("m").by("name").name.aggregate("n")
- results = t.toSet()
- assert 2 == len(results)
- assert "lop" in results
- assert "ripple" in results
- assert 2 == len(t.side_effects.keys())
- assert "m" in t.side_effects.keys()
- assert "n" in t.side_effects.keys()
- n = t.side_effects.get("n")
- assert isinstance(n, dict)
- assert 2 == len(n)
- assert "lop" in n.keys()
- assert "ripple" in n.keys()
- assert 3 == n["lop"]
- assert 1 == n["ripple"]
-
- t = g.withSideEffect('m', 32).V().map(lambda: "x: x.sideEffects('m')")
- results = t.toSet()
- assert 1 == len(results)
- assert 32 == list(results)[0]
- assert 32 == t.side_effects['m']
- assert 1 == len(t.side_effects.keys())
- with pytest.raises(Exception):
- x = t.side_effects["x"]
-
- a = g.V().has("name", "marko").next()
- b = g.V().has("name", "peter").next()
- edge = g.withSideEffect("b", b).V(a).addE("knows").to("b").next()
- assert "knows" == edge.label
- assert a == edge.outV
- assert b == edge.inV
- g.V().has("name", "marko").outE("knows").where(__.inV().has("name", "peter")).drop().iterate()
- ##
- edge = g.withSideEffect("a", a).withSideEffect("b", b).V().limit(1).addE("knows").from_("a").to("b").next()
- assert "knows" == edge.label
- assert a == edge.outV
- assert b == edge.inV
- g.V().has("name", "marko").outE("knows").where(__.inV().has("name", "peter")).drop().iterate()
-
- def test_side_effect_close(self, remote_connection):
- g = traversal().withRemote(remote_connection)
- t = g.V().aggregate('a').aggregate('b')
- t.toList()
-
- # The 'a' key should return some side effects
- results = t.side_effects.get('a')
- assert results
-
- # Close result is None
- results = t.side_effects.close()
- assert not results
-
- # Shouldn't get any new info from server
- # 'b' isn't in local cache
- results = t.side_effects.get('b')
- assert not results
-
- # But 'a' should still be cached locally
- results = t.side_effects.get('a')
- assert results
-
- # 'a' should have been added to local keys cache, but not 'b'
- results = t.side_effects.keys()
- assert len(results) == 1
- a, = results
- assert a == 'a'
-
- # Try to get 'b' directly from server, should throw error
- with pytest.raises(Exception):
- t.side_effects.value_lambda('b')
-
- def test_promise(self, remote_connection):
- g = traversal().withRemote(remote_connection)
- future = g.V().aggregate('a').promise()
- t = future.result()
- assert len(t.toList()) == 6
- a, = t.side_effects.keys()
- assert a == 'a'
- results = t.side_effects.get('a')
- assert results
- results = t.side_effects.close()
- assert not results
-
def test_in_tornado_app():
# Make sure nothing weird with loops