You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by xi...@apache.org on 2024/10/10 05:50:24 UTC
(tinkerpop) branch graphbinary-bulked-list updated (3524f5ee38 -> 92820db61b)
This is an automated email from the ASF dual-hosted git repository.
xiazcy pushed a change to branch graphbinary-bulked-list
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
discard 3524f5ee38 Updated BulkSet and List serializers in Java and Python to align with `bulklist` in GraphBinaryV4 IO spec
new 92820db61b Updated BulkSet and List serializers in Java and Python to implement list `bulk` flag in GraphBinaryV4 IO spec
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (3524f5ee38)
\
N -- N -- N refs/heads/graphbinary-bulked-list (92820db61b)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
CHANGELOG.asciidoc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(tinkerpop) 01/01: Updated BulkSet and List serializers in Java and Python to implement list `bulk` flag in GraphBinaryV4 IO spec
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiazcy pushed a commit to branch graphbinary-bulked-list
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit 92820db61b6db77b8e6abc9243c8e363115f38f5
Author: Yang Xia <55...@users.noreply.github.com>
AuthorDate: Wed Oct 9 22:50:15 2024 -0700
Updated BulkSet and List serializers in Java and Python to implement list `bulk` flag in GraphBinaryV4 IO spec
---
CHANGELOG.asciidoc | 1 +
.../structure/io/binary/GraphBinaryWriter.java | 7 +++
.../io/binary/TypeSerializerRegistry.java | 2 +-
.../io/binary/types/BulkSetSerializer.java | 11 +----
.../structure/io/binary/types/ListSerializer.java | 25 ++++++++++
.../io/binary/types/SimpleTypeSerializer.java | 3 ++
.../gremlin_python/structure/io/graphbinaryV4.py | 51 +++++++++------------
.../src/main/python/tests/structure/io/model.py | 4 +-
.../tests/structure/io/test_graphbinaryv4model.py | 11 ++---
.../io/graphbinary/empty-bulklist-v4.gbin | Bin 0 -> 6 bytes
.../structure/io/graphbinary/empty-bulkset-v4.gbin | Bin 6 -> 0 bytes
.../structure/io/graphbinary/var-bulklist-v4.gbin | Bin 0 -> 43 bytes
.../structure/io/graphbinary/var-bulkset-v4.gbin | Bin 43 -> 0 bytes
.../io/AbstractTypedCompatibilityTest.java | 33 ++++++++-----
.../tinkerpop/gremlin/structure/io/Model.java | 4 +-
.../gremlin/util/ser/AbstractRoundTripTest.java | 43 ++---------------
.../GraphSONMessageSerializerV4RoundTripTest.java | 2 +-
17 files changed, 95 insertions(+), 102 deletions(-)
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 95ab1c2628..4ab67c916b 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -66,6 +66,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
* Add `DateTime` serializer for Java and Python according to GraphBinaryV4 IO spec.
* Replaced `Date` with `OffsetDateTime` in Java core.
* Update serializers for `label` as a singleton list of string according to GraphBinaryV4 IO spec.
+* Updated List and BulkSet serializers in Java and Python to implement `bulk` value flag for List according to GraphBinaryV4 IO spec.
* The `maxContentLength` setting for Gremlin Driver has been renamed to `maxResponseContentLength` and now blocks incoming responses that are too large based on total response size.
* The `maxContentLength` setting for Gremlin Server has been renamed to `maxRequestContentLength`.
* Add missing strategies to the `TraversalStrategies` global cache as well as `CoreImports` in `gremlin-groovy`.
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/GraphBinaryWriter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/GraphBinaryWriter.java
index 53a2a55868..29cdfd6816 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/GraphBinaryWriter.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/GraphBinaryWriter.java
@@ -46,6 +46,7 @@ public class GraphBinaryWriter {
private final static byte VALUE_FLAG_NULL = 1;
private final static byte VALUE_FLAG_NONE = 0;
private final static byte VALUE_FLAG_ORDERED = 2;
+ private final static byte VALUE_FLAG_BULK = 2;
public final static byte VERSION_BYTE = (byte)0x81;
private final static byte[] unspecifiedNullBytes = new byte[] { DataType.UNSPECIFIED_NULL.getCodeByte(), 0x01};
private final static byte[] customTypeCodeBytes = new byte[] { DataType.CUSTOM.getCodeByte() };
@@ -144,5 +145,11 @@ public class GraphBinaryWriter {
buffer.writeByte(VALUE_FLAG_ORDERED);
}
+ /**
+ * Writes a single byte with value 2, representing an ordered value_flag.
+ */
+ public void writeValueFlagBulk(Buffer buffer) {
+ buffer.writeByte(VALUE_FLAG_BULK);
+ }
}
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/TypeSerializerRegistry.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/TypeSerializerRegistry.java
index db6193d266..6ee2a5fc60 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/TypeSerializerRegistry.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/TypeSerializerRegistry.java
@@ -91,6 +91,7 @@ public class TypeSerializerRegistry {
new RegistryEntry<>(String.class, new StringSerializer()),
new RegistryEntry<>(Double.class, SingleTypeSerializer.DoubleSerializer),
new RegistryEntry<>(Float.class, SingleTypeSerializer.FloatSerializer),
+ new RegistryEntry<>(BulkSet.class, new BulkSetSerializer()), // needs to register before list so ListSerializer is registered as LIST by overwrite
new RegistryEntry<>(List.class, new ListSerializer()),
new RegistryEntry<>(Map.class, new MapSerializer()),
new RegistryEntry<>(Set.class, new SetSerializer()),
@@ -110,7 +111,6 @@ public class TypeSerializerRegistry {
new RegistryEntry<>(ByteBuffer.class, new ByteBufferSerializer()),
new RegistryEntry<>(Short.class, SingleTypeSerializer.ShortSerializer),
new RegistryEntry<>(Boolean.class, SingleTypeSerializer.BooleanSerializer),
- new RegistryEntry<>(BulkSet.class, new BulkSetSerializer()), //todo: to be removed when bulk implemented in list
new RegistryEntry<>(Tree.class, new TreeSerializer()),
new RegistryEntry<>(Marker.class, SingleTypeSerializer.MarkerSerializer),
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/BulkSetSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/BulkSetSerializer.java
index 7811f73366..09ff2ddf2f 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/BulkSetSerializer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/BulkSetSerializer.java
@@ -32,19 +32,12 @@ import java.util.Map;
*/
public class BulkSetSerializer extends SimpleTypeSerializer<BulkSet> {
public BulkSetSerializer() {
- super(DataType.BULKSET);
+ super(DataType.LIST);
}
@Override
protected BulkSet readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException {
- final int length = buffer.readInt();
-
- final BulkSet result = new BulkSet();
- for (int i = 0; i < length; i++) {
- result.add(context.read(buffer), buffer.readLong());
- }
-
- return result;
+ throw new UnsupportedOperationException("BulkSet is used as an internal serializer for bulk lists, deserializing into BulkSet is not supported");
}
@Override
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/ListSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/ListSerializer.java
index 74ac14bd31..68098f7a4c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/ListSerializer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/ListSerializer.java
@@ -24,6 +24,7 @@ import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter;
import org.apache.tinkerpop.gremlin.structure.io.Buffer;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
public class ListSerializer extends SimpleTypeSerializer<List> {
@@ -33,6 +34,30 @@ public class ListSerializer extends SimpleTypeSerializer<List> {
super(DataType.LIST);
}
+ @Override
+ public List readValue(final Buffer buffer, final GraphBinaryReader context, final boolean nullable) throws IOException {
+ if (nullable) {
+ final byte valueFlag = buffer.readByte();
+ if ((valueFlag & 1) == 1) {
+ return null;
+ }
+ if ((valueFlag & 2) == 2) {
+ final int length = buffer.readInt();
+ final ArrayList result = new ArrayList(length);
+ for (int i = 0; i < length; i++) {
+ Object item = context.read(buffer);
+ long bulk = buffer.readLong();
+ for (int j = 0; j < bulk; j++) {
+ result.add(item);
+ }
+ }
+ return result;
+ }
+ }
+
+ return readValue(buffer, context);
+ }
+
@Override
protected List readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException {
// The collection is a List<>
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/SimpleTypeSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/SimpleTypeSerializer.java
index fc546894c2..23eba48a70 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/SimpleTypeSerializer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/SimpleTypeSerializer.java
@@ -18,6 +18,7 @@
*/
package org.apache.tinkerpop.gremlin.structure.io.binary.types;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet;
import org.apache.tinkerpop.gremlin.structure.io.binary.DataType;
import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryReader;
import org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter;
@@ -89,6 +90,8 @@ public abstract class SimpleTypeSerializer<T> implements TypeSerializer<T> {
if (nullable) {
if (value instanceof LinkedHashMap) {
context.writeValueFlagOrdered(buffer);
+ } else if (value instanceof BulkSet) {
+ context.writeValueFlagBulk(buffer);
} else {
context.writeValueFlagNone(buffer);
}
diff --git a/gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV4.py b/gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV4.py
index 7419661215..b71802fe3b 100644
--- a/gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV4.py
+++ b/gremlin-python/src/main/python/gremlin_python/structure/io/graphbinaryV4.py
@@ -68,7 +68,6 @@ class DataType(Enum):
bytebuffer = 0x25
short = 0x26
boolean = 0x27
- bulkset = 0x2a # todo: to be removed when bulk is implemented in list
tree = 0x2b # not supported - no tree object in Python yet
char = 0x80
duration = 0x81
@@ -199,7 +198,7 @@ class _GraphBinaryTypeIO(object, metaclass=GraphBinaryTypeType):
def objectify(self, d, reader, nullable=True):
raise NotImplementedError()
-
+
class LongIO(_GraphBinaryTypeIO):
@@ -456,15 +455,30 @@ class ListIO(_GraphBinaryTypeIO):
@classmethod
def objectify(cls, buff, reader, nullable=True):
- return cls.is_null(buff, reader, cls._read_list, nullable)
+ flag = 0x00
+ if nullable:
+ flag = buff.read(1)[0]
+ if flag == 0x01:
+ return None
+ else:
+ return cls._read_list(buff, reader, flag)
+ return cls._read_list(buff, reader, flag)
@classmethod
- def _read_list(cls, b, r):
+ def _read_list(cls, b, r, flag):
size = cls.read_int(b)
the_list = []
- while size > 0:
- the_list.append(r.read_object(b))
- size = size - 1
+ if flag == 0x02:
+ while size > 0:
+ itm = r.read_object(b)
+ bulk = int64_unpack(b.read(8))
+ for y in range(bulk):
+ the_list.append(itm)
+ size = size - 1
+ else:
+ while size > 0:
+ the_list.append(r.read_object(b))
+ size = size - 1
return the_list
@@ -772,29 +786,6 @@ class BooleanIO(_GraphBinaryTypeIO):
nullable)
-# todo: to be removed when updated with bulking in list
-class BulkSetDeserializer(_GraphBinaryTypeIO):
-
- graphbinary_type = DataType.bulkset
-
- @classmethod
- def objectify(cls, buff, reader, nullable=True):
- return cls.is_null(buff, reader, cls._read_bulkset, nullable)
-
- @classmethod
- def _read_bulkset(cls, b, r):
- size = cls.read_int(b)
- the_list = []
- while size > 0:
- itm = r.read_object(b)
- bulk = int64_unpack(b.read(8))
- for y in range(bulk):
- the_list.append(itm)
- size = size - 1
-
- return the_list
-
-
class DurationIO(_GraphBinaryTypeIO):
python_type = timedelta
graphbinary_type = DataType.duration
diff --git a/gremlin-python/src/main/python/tests/structure/io/model.py b/gremlin-python/src/main/python/tests/structure/io/model.py
index 2440d65ef7..e0a33c433c 100644
--- a/gremlin-python/src/main/python/tests/structure/io/model.py
+++ b/gremlin-python/src/main/python/tests/structure/io/model.py
@@ -65,8 +65,8 @@ model["true-boolean"] = True
model["false-boolean"] = False
model["single-byte-string"] = "abc"
model["mixed-string"] = "abc\u0391\u0392\u0393"
-model["var-bulkset"] = ["marko", "josh", "josh"]
-model["empty-bulkset"] = []
+model["var-bulklist"] = ["marko", "josh", "josh"]
+model["empty-bulklist"] = []
model["zero-duration"] = datetime.timedelta()
model["traversal-edge"] = Edge(
13,
diff --git a/gremlin-python/src/main/python/tests/structure/io/test_graphbinaryv4model.py b/gremlin-python/src/main/python/tests/structure/io/test_graphbinaryv4model.py
index 9515ba6902..ab18c91443 100644
--- a/gremlin-python/src/main/python/tests/structure/io/test_graphbinaryv4model.py
+++ b/gremlin-python/src/main/python/tests/structure/io/test_graphbinaryv4model.py
@@ -146,7 +146,6 @@ def test_var_type_list():
def test_empty_list():
run("empty-list")
-@pytest.mark.skip(reason="Date has been removed in GraphBinary, need to update test files")
def test_var_type_map():
# can't write tuple
run_read("var-type-map")
@@ -214,13 +213,11 @@ def test_id_t():
def test_out_direction():
run("out-direction")
-def test_var_bulkset():
- # no serializer for BulkSet
- run_read("var-bulkset")
+def test_var_bulklist():
+ run_read("var-bulklist")
-def test_empty_bulkset():
- # no serializer for BulkSet
- run_read("empty-bulkset")
+def test_var_bulklist():
+ run_read("empty-bulklist")
def test_single_byte_char():
# char is serialized as string
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphbinary/empty-bulklist-v4.gbin b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphbinary/empty-bulklist-v4.gbin
new file mode 100644
index 0000000000..0f238fc146
Binary files /dev/null and b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphbinary/empty-bulklist-v4.gbin differ
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphbinary/empty-bulkset-v4.gbin b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphbinary/empty-bulkset-v4.gbin
deleted file mode 100644
index 2f23c6bd4d..0000000000
Binary files a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphbinary/empty-bulkset-v4.gbin and /dev/null differ
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphbinary/var-bulklist-v4.gbin b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphbinary/var-bulklist-v4.gbin
new file mode 100644
index 0000000000..7d1dd49283
Binary files /dev/null and b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphbinary/var-bulklist-v4.gbin differ
diff --git a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphbinary/var-bulkset-v4.gbin b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphbinary/var-bulkset-v4.gbin
deleted file mode 100644
index 4542906626..0000000000
Binary files a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/structure/io/graphbinary/var-bulkset-v4.gbin and /dev/null differ
diff --git a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/AbstractTypedCompatibilityTest.java b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/AbstractTypedCompatibilityTest.java
index b9dbc0efa4..e39869d474 100644
--- a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/AbstractTypedCompatibilityTest.java
+++ b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/AbstractTypedCompatibilityTest.java
@@ -69,6 +69,7 @@ import java.time.YearMonth;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.Arrays;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
@@ -882,27 +883,35 @@ public abstract class AbstractTypedCompatibilityTest extends AbstractCompatibili
}
@Test
- public void shouldReadWriteVarBulkSet() throws Exception {
- final String resourceName = "var-bulkset";
+ @Ignore("re-enable after GraphSONV4 bulklist is implemented")
+ public void shouldReadWriteVarBulkList() throws Exception {
+ final String resourceName = "var-bulklist";
final BulkSet resource = findModelEntryObject(resourceName);
- final BulkSet fromStatic = read(readFromResource(resourceName), BulkSet.class);
- final BulkSet recycled = read(write(fromStatic, BulkSet.class, resourceName), BulkSet.class);
+ final List fromStatic = read(readFromResource(resourceName), List.class);
+ final List recycled = read(write(fromStatic, BulkSet.class, resourceName), List.class);
assertEquals(fromStatic, recycled);
- assertEquals(resource, fromStatic);
- assertEquals(resource, recycled);
+ // we no longer deserialize into BulkSets, needs the expanded list
+ List expandedResource = new ArrayList<>();
+ resource.spliterator().forEachRemaining(expandedResource::add);
+ assertEquals(expandedResource, fromStatic);
+ assertEquals(expandedResource, recycled);
}
@Test
- public void shouldReadWriteEmptyBulkSet() throws Exception {
- final String resourceName = "empty-bulkset";
+ @Ignore("re-enable after GraphSONV4 bulklist is implemented")
+ public void shouldReadWriteEmptyBulkList() throws Exception {
+ final String resourceName = "empty-bulklist";
final BulkSet resource = findModelEntryObject(resourceName);
- final BulkSet fromStatic = read(readFromResource(resourceName), BulkSet.class);
- final BulkSet recycled = read(write(fromStatic, BulkSet.class, resourceName), BulkSet.class);
+ final List fromStatic = read(readFromResource(resourceName), List.class);
+ final List recycled = read(write(fromStatic, BulkSet.class, resourceName), List.class);
assertEquals(fromStatic, recycled);
- assertEquals(resource, fromStatic);
- assertEquals(resource, recycled);
+ // we no longer deserialize into BulkSets, needs the expanded list
+ List expandedResource = new ArrayList<>();
+ resource.spliterator().forEachRemaining(expandedResource::add);
+ assertEquals(expandedResource, fromStatic);
+ assertEquals(expandedResource, recycled);
}
@Test
diff --git a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/Model.java b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/Model.java
index 5d1b65f877..aa28ebaa43 100644
--- a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/Model.java
+++ b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/structure/io/Model.java
@@ -162,8 +162,8 @@ public class Model {
final BulkSet<String> bulkSet = new BulkSet<>();
bulkSet.add("marko", 1);
bulkSet.add("josh", 2);
- addGraphProcessEntry(bulkSet, "var-bulkset", "");
- addGraphProcessEntry(new BulkSet(), "empty-bulkset", "");
+ addGraphProcessEntry(bulkSet, "var-bulklist", "");
+ addGraphProcessEntry(new BulkSet(), "empty-bulklist", "");
addGraphProcessEntry(g.V().hasLabel("person").asAdmin().nextTraverser(), "vertex-traverser", "");
addGraphProcessEntry(g.V().both().barrier().asAdmin().nextTraverser(), "bulked-traverser", "");
diff --git a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/AbstractRoundTripTest.java b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/AbstractRoundTripTest.java
index d361784f07..cfa1009d45 100644
--- a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/AbstractRoundTripTest.java
+++ b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/AbstractRoundTripTest.java
@@ -18,63 +18,28 @@
*/
package org.apache.tinkerpop.gremlin.util.ser;
-import org.apache.tinkerpop.gremlin.process.computer.Computer;
-import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
-import org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraverser;
-import org.apache.tinkerpop.gremlin.process.traversal.GremlinLang;
-import org.apache.tinkerpop.gremlin.process.traversal.Operator;
-import org.apache.tinkerpop.gremlin.process.traversal.Order;
-import org.apache.tinkerpop.gremlin.process.traversal.P;
-import org.apache.tinkerpop.gremlin.process.traversal.Pick;
-import org.apache.tinkerpop.gremlin.process.traversal.Pop;
-import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
-import org.apache.tinkerpop.gremlin.process.traversal.Scope;
-import org.apache.tinkerpop.gremlin.process.traversal.TextP;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.TraversalStrategyProxy;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics;
-import org.apache.tinkerpop.gremlin.process.traversal.util.Metrics;
import org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalMetrics;
-import org.apache.tinkerpop.gremlin.structure.Column;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.apache.tinkerpop.gremlin.structure.io.IoTest;
import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceEdge;
import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceProperty;
import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertex;
import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertexProperty;
import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
-import org.apache.tinkerpop.gremlin.util.function.Lambda;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.math.BigDecimal;
import java.math.BigInteger;
-import java.net.InetAddress;
import java.nio.ByteBuffer;
-import java.sql.Timestamp;
-import java.text.DateFormat;
import java.time.Duration;
-import java.time.Instant;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.MonthDay;
-import java.time.OffsetDateTime;
-import java.time.OffsetTime;
-import java.time.Period;
-import java.time.Year;
-import java.time.YearMonth;
-import java.time.ZoneOffset;
-import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -83,7 +48,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
@@ -91,7 +55,6 @@ import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.hasLabel;
-import static org.apache.tinkerpop.gremlin.util.MockitoHamcrestMatcherAdapter.reflectionEquals;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
@@ -212,7 +175,11 @@ public abstract class AbstractRoundTripTest {
new Object[] {"Graph", g.E().subgraph("k").cap("k").next(), (Consumer<Graph>) graph -> {
IoTest.assertModernGraph(graph, true, false);
}},
- new Object[] {"BulkSet", bulkSet, null},
+ new Object[] {"BulkList", bulkSet, (Consumer<List>) bulklist -> {
+ List bulkSetExpanded = new ArrayList<>();
+ bulkSet.spliterator().forEachRemaining(bulkSetExpanded::add);
+ assertEquals(bulkSetExpanded, bulklist);
+ }},
new Object[] {"Tree", tree, null},
// collections
diff --git a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONMessageSerializerV4RoundTripTest.java b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONMessageSerializerV4RoundTripTest.java
index 0b3c5abce5..09e4457c1c 100644
--- a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONMessageSerializerV4RoundTripTest.java
+++ b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONMessageSerializerV4RoundTripTest.java
@@ -40,7 +40,7 @@ public class GraphSONMessageSerializerV4RoundTripTest extends AbstractRoundTripT
public final GraphSONMessageSerializerV4 serializer = new GraphSONMessageSerializerV4();
private static final List<String> skippedTests
- = Arrays.asList("ReferenceVertex", "ReferenceVertexProperty", "ReferenceProperty", "Graph");
+ = Arrays.asList("ReferenceVertex", "ReferenceVertexProperty", "ReferenceProperty", "Graph", "BulkList"); // enable BulkList after implemented
@Test
public void shouldWriteAndRead() throws Exception {