use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class EventPredicatesShould method do_not_accept_zero_length_time_range.
@Test(expected = IllegalArgumentException.class)
public void do_not_accept_zero_length_time_range() {
final Timestamp timestamp = minutesAgo(5);
isBetween(timestamp, timestamp);
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class EventFactory method toEventContext.
private static EventContext toEventContext(IntegrationEventContext value) {
final StringValue producerId = Wrapper.forString(value.getBoundedContextName());
final Timestamp timestamp = value.getTimestamp();
final Any producerAny = pack(producerId);
return EventContext.newBuilder().setTimestamp(timestamp).setProducerId(producerAny).build();
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class EventFactory method createContext.
private static EventContext createContext(Any producerId, CommandContext commandContext, @Nullable Version version) {
final Timestamp timestamp = getCurrentTime();
final EventContext.Builder builder = EventContext.newBuilder().setTimestamp(timestamp).setCommandContext(commandContext).setProducerId(producerId);
if (version != null) {
builder.setVersion(version);
}
return builder.build();
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class Events method getTimestamp.
/**
* Obtains the timestamp of the event.
*/
public static Timestamp getTimestamp(Event event) {
checkNotNull(event);
final Timestamp result = event.getContext().getTimestamp();
return result;
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class Commands method getTimestamp.
private static Timestamp getTimestamp(Command request) {
checkNotNull(request);
final Timestamp result = request.getContext().getActorContext().getTimestamp();
return result;
}
Aggregations