use of org.janusgraph.graphdb.tinkerpop.io.JanusGraphP 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.janusgraph.graphdb.tinkerpop.io.JanusGraphP in project janusgraph by JanusGraph.
the class JanusGraphPGraphBinarySerializerTest method assertJanusGraphP.
private void assertJanusGraphP(final GraphBinaryMessageSerializerV1 serializer, final JanusGraphP predicate) throws IOException {
final ByteBuf serialized = serializer.serializeResponseAsBinary(ResponseMessage.build(UUID.randomUUID()).result(predicate).create(), allocator);
final ResponseMessage deserialized = serializer.deserializeResponse(serialized);
final JanusGraphP actual = (JanusGraphP) deserialized.getResult().getData();
assertEquals(actual, predicate);
}
use of org.janusgraph.graphdb.tinkerpop.io.JanusGraphP in project janusgraph by JanusGraph.
the class JanusGraphPGraphBinarySerializerTest method shouldCustomSerialization.
@ParameterizedTest
@MethodSource("janusGraphPProvider")
public void shouldCustomSerialization(final JanusGraphP predicate) throws IOException {
final GraphBinaryMessageSerializerV1 serializer = new GraphBinaryMessageSerializerV1(TypeSerializerRegistry.build().addCustomType(JanusGraphP.class, new JanusGraphPBinarySerializer()).addCustomType(Geoshape.class, new GeoshapeGraphBinarySerializer()).create());
assertJanusGraphP(serializer, predicate);
}
Aggregations