use of org.apache.tinkerpop.gremlin.process.traversal.Bytecode in project janusgraph by JanusGraph.
the class JanusGraphIoRegistryTest method serializationTest.
private void serializationTest(GraphTraversal[] traversals) throws SerializationException {
Builder mapper = GryoMapper.build().addRegistry(JanusGraphIoRegistry.getInstance());
MessageSerializer binarySerializer = new GryoMessageSerializerV1d0(mapper);
for (GraphTraversal traversal : traversals) {
Bytecode expectedBytecode = traversal.asAdmin().getBytecode();
RequestMessage requestMessage = RequestMessage.build(Tokens.OPS_BYTECODE).processor("traversal").addArg(Tokens.ARGS_GREMLIN, expectedBytecode).create();
ByteBuf bb = binarySerializer.serializeRequestAsBinary(requestMessage, allocator);
final int mimeLen = bb.readByte();
bb.readBytes(new byte[mimeLen]);
RequestMessage deser = binarySerializer.deserializeRequest(bb);
Bytecode result = (Bytecode) deser.getArgs().get(Tokens.ARGS_GREMLIN);
assertEquals(expectedBytecode, result);
}
}
Aggregations