use of com.datastax.dse.driver.api.core.graph.GraphResultSet in project java-driver by datastax.
the class GraphTraversalITBase method should_return_correct_results_when_bulked.
/**
* Ensures that traversals with barriers (which return results bulked) contain the correct amount
* of end results.
*
* <p>This will fail if ran against DSE < 5.0.9 or DSE < 5.1.2.
*/
@Test
public void should_return_correct_results_when_bulked() {
Assumptions.assumeThat(ccmRule().getCcmBridge().getDseVersion().get().compareTo(Version.parse("5.1.2")) > 0).isTrue();
GraphResultSet rs = session().execute(newInstance(graphTraversalSource().E().label().barrier()));
List<String> results = rs.all().stream().map(GraphNode::asString).sorted().collect(Collectors.toList());
assertThat(results).hasSize(6).containsSequence("created", "created", "created", "created").containsSequence("knows", "knows");
}
use of com.datastax.dse.driver.api.core.graph.GraphResultSet in project java-driver by datastax.
the class GraphResultSetsTest method should_create_result_set_from_multiple_pages.
@Test
public void should_create_result_set_from_multiple_pages() {
// Given
AsyncGraphResultSet page1 = mockPage(true, 0, 1, 2);
AsyncGraphResultSet page2 = mockPage(true, 3, 4, 5);
AsyncGraphResultSet page3 = mockPage(false, 6, 7, 8);
complete(page1.fetchNextPage(), page2);
complete(page2.fetchNextPage(), page3);
// When
GraphResultSet resultSet = GraphResultSets.toSync(page1);
// Then
assertThat(resultSet.iterator().hasNext()).isTrue();
assertThat(resultSet.getRequestExecutionInfo()).isSameAs(page1.getRequestExecutionInfo());
assertThat(((MultiPageGraphResultSet) resultSet).getRequestExecutionInfos()).containsExactly(page1.getRequestExecutionInfo());
Iterator<GraphNode> iterator = resultSet.iterator();
assertNextRow(iterator, 0);
assertNextRow(iterator, 1);
assertNextRow(iterator, 2);
assertThat(iterator.hasNext()).isTrue();
// This should have triggered the fetch of page2
assertThat(resultSet.getRequestExecutionInfo()).isEqualTo(page2.getRequestExecutionInfo());
assertThat(((MultiPageGraphResultSet) resultSet).getRequestExecutionInfos()).containsExactly(page1.getRequestExecutionInfo(), page2.getRequestExecutionInfo());
assertNextRow(iterator, 3);
assertNextRow(iterator, 4);
assertNextRow(iterator, 5);
assertThat(iterator.hasNext()).isTrue();
// This should have triggered the fetch of page3
assertThat(resultSet.getRequestExecutionInfo()).isEqualTo(page3.getRequestExecutionInfo());
assertThat(((MultiPageGraphResultSet) resultSet).getRequestExecutionInfos()).containsExactly(page1.getRequestExecutionInfo(), page2.getRequestExecutionInfo(), page3.getRequestExecutionInfo());
assertNextRow(iterator, 6);
assertNextRow(iterator, 7);
assertNextRow(iterator, 8);
}
Aggregations