(tinkerpop) 01/01: initial implementation
This is an automated email from the ASF dual-hosted git repository. valentyn pushed a commit to branch valentyn/update-response-format in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 6f8d3a1c96e959c6ee0b77e7e9310e44d46b5dd5 Author: Valentyn Kahamlyk AuthorDate: Tue Apr 16 18:10:27 2024 -0700 initial implementation --- .../gremlin/util/message/ResponseMessage.java | 31 +-- .../gremlin/util/message/ResponseStatus.java | 19 +- .../ser/AbstractGraphSONMessageSerializerV4.java | 7 ++-- .../util/ser/GraphBinaryMessageSerializerV4.java | 33 +++- .../tinkerpop/gremlin/util/ser/SerTokens.java | 1 + .../util/ser/GraphSONMessageSerializerV4Test.java | 44 -- .../GraphSONUntypedMessageSerializerV4Test.java| 37 ++ .../binary/GraphBinaryMessageSerializerV4Test.java | 27 +++-- 8 files changed, 99 insertions(+), 100 deletions(-) diff --git a/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/ResponseMessage.java b/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/ResponseMessage.java index 0a92190f6f..6dc2780dd5 100644 --- a/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/ResponseMessage.java +++ b/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/ResponseMessage.java @@ -103,6 +103,10 @@ public final class ResponseMessage { } } +public static Builder build() { +return new Builder(); +} + public static Builder build(final RequestMessage requestMessage) { return new Builder(requestMessage); } @@ -115,19 +119,24 @@ public final class ResponseMessage { return new Builder(requestId); } -public static Builder buildV4(final UUID requestId) { -return new Builder(requestId, true); +public static Builder buildV4() { +return new Builder(); } public final static class Builder { private final UUID requestId; -private ResponseStatusCode code = ResponseStatusCode.SUCCESS; +private ResponseStatusCode code = null; private Object result = null; -private String statusMessage = ""; +private String statusMessage = null; +private String exception = null; private Map attributes = Collections.emptyMap(); private Map metaData = Collections.emptyMap(); +private Builder() { +requestId = null; +} + private Builder(final RequestMessage requestMessage) { this.requestId = requestMessage.getRequestId(); } @@ -140,13 +149,6 @@ public final class ResponseMessage { this.requestId = requestId; } -// builder for TP4 -private Builder(final UUID requestId, final boolean v4) { -this.requestId = requestId; -this.code = null; -this.statusMessage = null; -} - public Builder code(final ResponseStatusCode code) { this.code = code; return this; @@ -157,6 +159,11 @@ public final class ResponseMessage { return this; } +public Builder exception(final String exception) { +this.exception = exception; +return this; +} + public Builder statusAttributes(final Map attributes) { this.attributes = attributes; return this; @@ -192,7 +199,7 @@ public final class ResponseMessage { if (code == null && statusMessage == null) { return new ResponseMessage(requestId, null, responseResult); } -final ResponseStatus responseStatus = new ResponseStatus(code, statusMessage, attributes); +final ResponseStatus responseStatus = new ResponseStatus(code, statusMessage, exception); return new ResponseMessage(requestId, responseStatus, responseResult); } } diff --git a/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/ResponseStatus.java b/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/ResponseStatus.java index dbc2995085..4bc2ca6ecb 100644 --- a/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/ResponseStatus.java +++ b/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/ResponseStatus.java @@ -18,6 +18,7 @@ */ package org.apache.tinkerpop.gremlin.util.message; +import java.util.Collections; import java.util.Map; /** @@ -26,12 +27,21 @@ import java.util.Map; public final class ResponseStatus { private final ResponseStatusCode code; private final String message; +private final String exception; private final Map attributes; public ResponseStatus(final ResponseStatusCode code, final String message, final Map attributes) { this.code = code; this.message = message; this.attributes =
(tinkerpop) 01/01: Initial implementation of matrix testing.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch ken/matrixtesting in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit c1e1bfdbce09cab08d08a53a53886a2d645f4274 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Thu Feb 8 16:52:17 2024 -0800 Initial implementation of matrix testing. --- matrixtest.sh | 84 +++ 1 file changed, 84 insertions(+) diff --git a/matrixtest.sh b/matrixtest.sh new file mode 100644 index 00..c8077c2511 --- /dev/null +++ b/matrixtest.sh @@ -0,0 +1,84 @@ +#!/bin/bash +# +# +# 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. +# + +if [ -z "$1" ]; then + echo 'Missing required parameter. Expected a server version. E.g. 3.7.0' + exit 1 +fi + +export CONTAINER_TIMEOUT=300.0 # Timeout needed in case tests hang. +export ABS_PROJECT_HOME=$PWD +export GREMLIN_SERVER=$1 # Server version. + +# Need the following because gremlin-test jar with server version needed for KDC. +# This is currently how it is specified in the Dockerfiles. +git reset --hard > /dev/null +git checkout $GREMLIN_SERVER > /dev/null +mvn install -pl gremlin-test > /dev/null + +# Docker Compose files were added in 3.5.5 +for GREMLIN_DRIVER in $(git tag --list 3.5.[5-9]* 3.[6-9]*); do + [ "$GREMLIN_DRIVER" == "$GREMLIN_SERVER" ] && break + + echo "Testing driver ${GREMLIN_DRIVER} with server ${GREMLIN_SERVER}" + + git reset --hard > /dev/null + git checkout $GREMLIN_DRIVER > /dev/null + [ $? -ne 0 ] && exit $? + git checkout $GREMLIN_SERVER gremlin-server/ docker/ > /dev/null + [ $? -ne 0 ] && exit $? + + log_directory=logs/${GREMLIN_DRIVER}driver_${GREMLIN_SERVER}server + mkdir -p $log_directory + cd ./gremlin-javascript/src/main/javascript/gremlin-javascript + timeout --foreground $CONTAINER_TIMEOUT docker-compose up --build --exit-code-from gremlin-js-integration-tests > ${ABS_PROJECT_HOME}/${log_directory}/javascript.log 2>&1 + status=$? + docker-compose down + [ $status -ne 0 ] && echo "Failed. ${GREMLIN_DRIVER} driver is incompatible with ${GREMLIN_SERVER} server." && exit $status + cd ../../../../.. + + cd ./gremlin-dotnet/ + timeout --foreground $CONTAINER_TIMEOUT docker-compose up --build --exit-code-from gremlin-dotnet-integration-tests > ${ABS_PROJECT_HOME}/${log_directory}/dotnet.log 2>&1 + status=$? + docker-compose down + [ $status -ne 0 ] && echo "Failed. ${GREMLIN_DRIVER} driver is incompatible with ${GREMLIN_SERVER} server." && exit $status + cd .. + + cd ./gremlin-go/ + timeout --foreground $CONTAINER_TIMEOUT docker-compose up --build --exit-code-from gremlin-go-integration-tests > ${ABS_PROJECT_HOME}/${log_directory}/go.log 2>&1 + status=$? + docker-compose down + [ $status -ne 0 ] && echo "Failed. ${GREMLIN_DRIVER} driver is incompatible with ${GREMLIN_SERVER} server." && exit $status + cd .. + + cd gremlin-python + mkdir tmp_test_dir # Copy src to temp directory to prevent polluting src directories with extra test files + cp -R src/main/python/* tmp_test_dir + export BUILD_DIR=$PWD/tmp_test_dir + timeout --foreground $CONTAINER_TIMEOUT docker-compose up --build --abort-on-container-exit gremlin-server-test-python gremlin-python-integration-tests > ${ABS_PROJECT_HOME}/${log_directory}/python.log 2>&1 + status=$? + rm -r tmp_test_dir + docker-compose down + [ $status -ne 0 ] && echo "Failed. ${GREMLIN_DRIVER} driver is incompatible with ${GREMLIN_SERVER} server." && exit $status + cd .. + + echo "Success. ${GREMLIN_DRIVER} driver is compatible with ${GREMLIN_SERVER} server." +done \ No newline at end of file