use of com.datastax.dse.driver.internal.core.graph.MultiPageGraphResultSet in project java-driver by datastax.
the class GraphPagingIT method should_cancel_result_set.
@Test
public void should_cancel_result_set() {
// given
DriverExecutionProfile profile = enableGraphPaging().withInt(DseDriverOption.GRAPH_CONTINUOUS_PAGING_MAX_ENQUEUED_PAGES, 1).withInt(DseDriverOption.GRAPH_CONTINUOUS_PAGING_PAGE_SIZE, 10);
// when
GraphStatement statement = ScriptGraphStatement.newInstance("g.V().hasLabel('person').values('name')").setGraphName(SESSION_RULE.getGraphName()).setTraversalSource("g").setExecutionProfile(profile);
MultiPageGraphResultSet results = (MultiPageGraphResultSet) SESSION_RULE.session().execute(statement);
assertThat(((MultiPageGraphResultSet.RowIterator) results.iterator()).isCancelled()).isFalse();
assertThat(((CountingIterator) results.iterator()).remaining()).isEqualTo(10);
results.cancel();
assertThat(((MultiPageGraphResultSet.RowIterator) results.iterator()).isCancelled()).isTrue();
assertThat(((CountingIterator) results.iterator()).remaining()).isEqualTo(10);
for (int i = 0; i < 10; i++) {
results.one();
}
}
Aggregations