use of com.baidu.hugegraph.structure.HugeElement in project incubator-hugegraph by apache.
the class VertexCoreTest method testScanVertexInPaging.
@Test
public void testScanVertexInPaging() {
HugeGraph graph = graph();
Assume.assumeTrue("Not support scan", storeFeatures().supportsScanToken() || storeFeatures().supportsScanKeyRange());
this.init10VerticesAndCommit();
List<Vertex> vertices = new LinkedList<>();
ConditionQuery query = new ConditionQuery(HugeType.VERTEX);
String backend = graph.backend();
if (backend.equals("cassandra") || backend.equals("scylladb")) {
query.scan(String.valueOf(Long.MIN_VALUE), String.valueOf(Long.MAX_VALUE));
} else {
query.scan(BackendTable.ShardSplitter.START, BackendTable.ShardSplitter.END);
}
query.limit(1);
String page = PageInfo.PAGE_NONE;
while (page != null) {
query.page(page);
Iterator<Vertex> iterator = graph.vertices(query);
while (iterator.hasNext()) {
Vertex vertex = iterator.next();
Assert.assertTrue(query.test((HugeElement) vertex));
vertices.add(vertex);
}
page = PageInfo.pageInfo(iterator);
CloseableIterator.closeIterator(iterator);
}
Assert.assertEquals(10, vertices.size());
}
Aggregations