use of org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter in project janusgraph by JanusGraph.
the class RelationIdentifierGraphBinarySerializerTest method readValueAndWriteValueShouldBeSymmetric.
@ParameterizedTest
@MethodSource("relationIdentifierProvider")
public void readValueAndWriteValueShouldBeSymmetric(final RelationIdentifier relationIdentifier) throws IOException {
final TypeSerializerRegistry registry = TypeSerializerRegistry.build().addCustomType(RelationIdentifier.class, new RelationIdentifierGraphBinarySerializer()).create();
final GraphBinaryReader reader = new GraphBinaryReader(registry);
final GraphBinaryWriter writer = new GraphBinaryWriter(registry);
for (boolean nullable : new boolean[] { true, false }) {
final Buffer buffer = bufferFactory.create(allocator.buffer());
writer.writeValue(relationIdentifier, buffer, nullable);
final RelationIdentifier actual = reader.readValue(buffer, RelationIdentifier.class, nullable);
assertEquals(actual.toString(), relationIdentifier.toString());
buffer.release();
}
}
use of org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter in project janusgraph by JanusGraph.
the class JanusGraphPGraphBinarySerializerTest method readValueAndWriteValueShouldBeSymmetric.
@ParameterizedTest
@MethodSource("janusGraphPProvider")
public void readValueAndWriteValueShouldBeSymmetric(final JanusGraphP predicate) throws IOException {
final TypeSerializerRegistry registry = TypeSerializerRegistry.build().addCustomType(JanusGraphP.class, new JanusGraphPBinarySerializer()).addCustomType(Geoshape.class, new GeoshapeGraphBinarySerializer()).create();
final GraphBinaryReader reader = new GraphBinaryReader(registry);
final GraphBinaryWriter writer = new GraphBinaryWriter(registry);
for (boolean nullable : new boolean[] { true, false }) {
final Buffer buffer = bufferFactory.create(allocator.buffer());
writer.writeValue(predicate, buffer, nullable);
final JanusGraphP actual = reader.readValue(buffer, JanusGraphP.class, nullable);
assertEquals(actual.toString(), predicate.toString());
buffer.release();
}
}
use of org.apache.tinkerpop.gremlin.structure.io.binary.GraphBinaryWriter in project janusgraph by JanusGraph.
the class GeoshapeGraphBinarySerializerTest method readValueAndWriteValueShouldBeSymmetric.
@ParameterizedTest
@MethodSource("geoshapeProvider")
public void readValueAndWriteValueShouldBeSymmetric(Geoshape geoshape) throws IOException {
final TypeSerializerRegistry registry = TypeSerializerRegistry.build().addCustomType(Geoshape.class, new GeoshapeGraphBinarySerializer()).create();
final GraphBinaryReader reader = new GraphBinaryReader(registry);
final GraphBinaryWriter writer = new GraphBinaryWriter(registry);
for (boolean nullable : new boolean[] { true, false }) {
final Buffer buffer = bufferFactory.create(allocator.buffer());
writer.writeValue(geoshape, buffer, nullable);
final Geoshape actual = reader.readValue(buffer, Geoshape.class, nullable);
assertEquals(actual, geoshape);
buffer.release();
}
}
Aggregations