use of com.baidu.hugegraph.structure.traverser.CustomizedCrosspoints in project incubator-hugegraph-toolchain by apache.
the class CommonTraverserApiTest method testCustomizedCrosspoints.
@Test
public void testCustomizedCrosspoints() {
Object lopId = getVertexId("software", "name", "lop");
Object joshId = getVertexId("person", "name", "josh");
Object rippleId = getVertexId("software", "name", "ripple");
CrosspointsRequest.Builder builder = CrosspointsRequest.builder();
builder.sources().ids(lopId, rippleId);
builder.pathPatterns().steps().direction(Direction.IN).labels("created").degree(-1);
builder.withPath(true).withVertex(true).capacity(-1).limit(-1);
CustomizedCrosspoints customizedCrosspoints = customizedCrosspointsAPI.post(builder.build());
List<Object> crosspoints = customizedCrosspoints.crosspoints();
Assert.assertEquals(1, crosspoints.size());
Assert.assertEquals(joshId, crosspoints.get(0));
List<Path> paths = customizedCrosspoints.paths();
Assert.assertEquals(2, paths.size());
List<Object> path1 = ImmutableList.of(rippleId, joshId);
List<Object> path2 = ImmutableList.of(lopId, joshId);
List<List<Object>> expectedPaths = ImmutableList.of(path1, path2);
Assert.assertTrue(expectedPaths.contains(paths.get(0).objects()));
Assert.assertTrue(expectedPaths.contains(paths.get(1).objects()));
Set<?> vertices = customizedCrosspoints.vertices().stream().map(Vertex::id).collect(Collectors.toSet());
List<Object> expectedVids = ImmutableList.of(rippleId, joshId, lopId);
Assert.assertTrue(expectedVids.containsAll(vertices));
}
Aggregations