use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class AggregateStorageShould method write_records_and_load_history_till_last_snapshot.
@Test
public void write_records_and_load_history_till_last_snapshot() {
final Duration delta = seconds(10);
final Timestamp time1 = getCurrentTime();
final Timestamp time2 = add(time1, delta);
final Timestamp time3 = add(time2, delta);
storage.writeRecord(id, Given.StorageRecord.create(time1));
storage.writeSnapshot(id, newSnapshot(time2));
testWriteRecordsAndLoadHistory(time3);
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class AggregateShould method return_non_null_time_when_was_last_modified.
@Test
public void return_non_null_time_when_was_last_modified() {
final Timestamp creationTime = new TestAggregate(ID).whenModified();
assertNotNull(creationTime);
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class AggregateShould method record_modification_time_when_command_handled.
@Test
public void record_modification_time_when_command_handled() {
try {
final Timestamp frozenTime = Time.getCurrentTime();
Time.setProvider(new TimeTests.FrozenMadHatterParty(frozenTime));
dispatch(aggregate, env(createProject));
assertEquals(frozenTime, aggregate.whenModified());
} finally {
Time.resetProvider();
}
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class ProjectionStorageShould method write_and_read_last_event_time_several_times.
@Test
public void write_and_read_last_event_time_several_times() {
final Timestamp time1 = getCurrentTime();
final Timestamp time2 = add(time1, fromSeconds(10L));
writeAndReadLastEventTimeTest(time1);
writeAndReadLastEventTimeTest(time2);
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class Commands method wereAfter.
/**
* Creates a predicate for filtering commands created after the passed timestamp.
*/
public static Predicate<Command> wereAfter(final Timestamp from) {
checkNotNull(from);
return new Predicate<Command>() {
@Override
public boolean apply(@Nullable Command request) {
checkNotNull(request);
final Timestamp timestamp = getTimestamp(request);
return Timestamps2.isLaterThan(timestamp, from);
}
};
}
Aggregations