use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class CommandSchedulingShould method reschedule_commands_from_storage.
@Test
public void reschedule_commands_from_storage() {
final Timestamp schedulingTime = minutesAgo(3);
final Duration delayPrimary = Durations2.fromMinutes(5);
// = 5 - 3
final Duration newDelayExpected = Durations2.fromMinutes(2);
final List<Command> commandsPrimary = newArrayList(createProject(), addTask(), startProject());
storeAsScheduled(commandsPrimary, delayPrimary, schedulingTime);
commandBus.rescheduleCommands();
final ArgumentCaptor<Command> commandCaptor = ArgumentCaptor.forClass(Command.class);
verify(scheduler, times(commandsPrimary.size())).schedule(commandCaptor.capture());
final List<Command> commandsRescheduled = commandCaptor.getAllValues();
for (Command cmd : commandsRescheduled) {
final long actualDelay = getDelaySeconds(cmd);
Tests.assertSecondsEqual(newDelayExpected.getSeconds(), actualDelay, /*maxDiffSec=*/
1);
}
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class CommandSchedulingShould method update_schedule_options.
@Test
public void update_schedule_options() {
final Command cmd = requestFactory.command().create(Wrapper.forString(newUuid()));
final Timestamp schedulingTime = getCurrentTime();
final Duration delay = Durations2.minutes(5);
final Command cmdUpdated = setSchedule(cmd, delay, schedulingTime);
final CommandContext.Schedule schedule = cmdUpdated.getContext().getSchedule();
assertEquals(delay, schedule.getDelay());
assertEquals(schedulingTime, cmdUpdated.getSystemProperties().getSchedulingTime());
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class ProjectionStorageShould method writeAndReadLastEventTimeTest.
private void writeAndReadLastEventTimeTest(Timestamp expected) {
storage.writeLastHandledEventTime(expected);
final Timestamp actual = storage.readLastHandledEventTime();
assertEquals(expected, actual);
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class ProjectionStorageShould method return_null_if_no_event_time_in_storage.
@Test
public void return_null_if_no_event_time_in_storage() {
final Timestamp time = storage.readLastHandledEventTime();
assertNull(time);
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class BulkWriteOperationShould method store_given_timestamp_in_memory.
@Test
public void store_given_timestamp_in_memory() {
final Set<TestProjection> projections = emptySet();
final Timestamp whenHandled = TimeTests.Past.secondsAgo(5L);
final BulkWriteOperation<Object, TestProjection> operation = newOperation(projections, whenHandled);
assertTrue(operation.isInProgress());
operation.storeLastHandledEventTime(whenHandled);
operation.complete();
assertFalse(operation.isInProgress());
}
Aggregations