use of io.spine.server.aggregate.AggregateEventRecord in project core-java by SpineEventEngine.
the class StorageRecord method create.
public static AggregateEventRecord create(Timestamp timestamp) {
final Message eventMessage = Sample.messageOfType(AggProjectCreated.class);
final Event event = eventFactory.createEvent(eventMessage);
final AggregateEventRecord.Builder builder = AggregateEventRecord.newBuilder().setTimestamp(timestamp).setEvent(event);
return builder.build();
}
use of io.spine.server.aggregate.AggregateEventRecord in project core-java by SpineEventEngine.
the class StorageRecords method sequenceFor.
/**
* Returns several records sorted by timestamp ascending.
*
* @param start the timestamp of first record.
*/
public static List<AggregateEventRecord> sequenceFor(ProjectId id, Timestamp start) {
final Duration delta = seconds(10);
final Timestamp timestamp2 = add(start, delta);
final Timestamp timestamp3 = add(timestamp2, delta);
final TestEventFactory eventFactory = newInstance(Given.class);
final Event e1 = eventFactory.createEvent(projectCreated(id, Given.projectName(id)), null, start);
final AggregateEventRecord record1 = StorageRecord.create(start, e1);
final Event e2 = eventFactory.createEvent(taskAdded(id), null, timestamp2);
final AggregateEventRecord record2 = StorageRecord.create(timestamp2, e2);
final Event e3 = eventFactory.createEvent(Given.EventMessage.projectStarted(id), null, timestamp3);
final AggregateEventRecord record3 = StorageRecord.create(timestamp3, e3);
return newArrayList(record1, record2, record3);
}
Aggregations