use of org.apache.tinkerpop.gremlin.driver.ser.SerializationException in project janusgraph by JanusGraph.
the class JanusGraphIoRegistryTest method testTinkerPopPredicatesAsGryo.
/**
* This is necessary since we replace the default TinkerPop PSerializer
*
* @throws Exception
*/
@Test
public void testTinkerPopPredicatesAsGryo() throws SerializationException {
// Don't change this trivially. At the time of this writing (TinkerPop
// 3.2.3), this is how many P predicate methods were defined. If this
// fails, then JanusGraphPSerializer needs to be updated to add/remove
// any TinkerPop predicates!
assertEquals(15, Stream.of(P.class.getDeclaredMethods()).filter(m -> Modifier.isStatic(m.getModifiers())).filter(p -> {
log.debug("Predicate: {}", p);
return !p.isSynthetic();
}).count());
Graph graph = EmptyGraph.instance();
GraphTraversalSource g = graph.traversal();
// TinkerPop Predicates
GraphTraversal[] traversals = { g.V().has("age", within(5000)), g.V().has("age", without(5000)), g.V().has("age", within(5000, 45)), g.V().has("age", inside(45, 5000)), g.V().and(has("age", between(45, 5000)), has("name", within("pluto"))), g.V().or(has("age", between(45, 5000)), has("name", within("pluto", "neptune"))) };
serializationTest(traversals);
}
Aggregations