use of com.datastax.oss.dsbulk.tests.driver.MockAsyncResultSet in project dsbulk by datastax.
the class ReadResultPublisherTest method mockPage.
private static CompletionStage<AsyncResultSet> mockPage(CompletionStage<AsyncResultSet> previous, int size) {
CompletableFuture<AsyncResultSet> future = new CompletableFuture<>();
ExecutionInfo executionInfo = mock(ExecutionInfo.class);
when(executionInfo.getPagingState()).thenReturn(previous == null ? null : ByteBuffer.wrap(new byte[] { 1 }));
future.complete(new MockAsyncResultSet(size, executionInfo, previous));
previous = future;
return previous;
}
use of com.datastax.oss.dsbulk.tests.driver.MockAsyncResultSet in project dsbulk by datastax.
the class WriteResultPublisherTest method setUpSession.
private static CqlSession setUpSession() {
CqlSession session = mock(CqlSession.class);
CompletableFuture<AsyncResultSet> future = new CompletableFuture<>();
ExecutionInfo executionInfo = mock(ExecutionInfo.class);
future.complete(new MockAsyncResultSet(0, executionInfo, null));
when(session.executeAsync(any(SimpleStatement.class))).thenReturn(future);
return session;
}
Aggregations