use of io.spine.server.projection.BulkWriteOperation in project core-java by SpineEventEngine.
the class BulkWriteOperationShould method complete_on_timeout.
@SuppressWarnings("MagicNumber")
@Test
public void complete_on_timeout() throws InterruptedException {
final Duration duration = Durations2.nanos(1L);
final FlushCallback callback = spy(new EmptyCallback());
// Due to `spy` usage
@SuppressWarnings("unchecked") final BulkWriteOperation operation = spy(new BulkWriteOperation(duration, callback));
assertTrue(operation.isInProgress());
Thread.sleep(10L);
operation.checkExpiration();
assertFalse(operation.isInProgress());
verify(operation).complete();
verify(callback).onFlushResults(any(Set.class), any(Timestamp.class));
}
use of io.spine.server.projection.BulkWriteOperation in project core-java by SpineEventEngine.
the class BulkWriteOperationShould method newOperation.
private static BulkWriteOperation<Object, TestProjection> newOperation() {
final Duration duration = Durations2.seconds(100);
final BulkWriteOperation<Object, TestProjection> operation = new BulkWriteOperation<>(duration, new EmptyCallback());
return operation;
}
use of io.spine.server.projection.BulkWriteOperation in project core-java by SpineEventEngine.
the class BulkWriteOperationShould method return_own_in_progress_state.
@Test
public void return_own_in_progress_state() {
final BulkWriteOperation operation = newOperation();
assertTrue(operation.isInProgress());
operation.complete();
assertFalse(operation.isInProgress());
}
use of io.spine.server.projection.BulkWriteOperation in project core-java by SpineEventEngine.
the class BulkWriteOperationShould method close_on_complete.
@Test
public void close_on_complete() {
final BulkWriteOperation operationSpy = spy(newOperation());
operationSpy.complete();
verify(operationSpy).close();
}
use of io.spine.server.projection.BulkWriteOperation in project core-java by SpineEventEngine.
the class BulkWriteOperationShould method newOperation.
private static BulkWriteOperation<Object, TestProjection> newOperation(Set<TestProjection> projections, Timestamp lastHandldEventTime) {
final Duration duration = Durations2.seconds(100);
final BulkWriteOperation<Object, TestProjection> operation = new BulkWriteOperation<>(duration, new AssertResults(projections, lastHandldEventTime));
return operation;
}
Aggregations