use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class MessageFieldValidator method isTimestamp.
private boolean isTimestamp() {
final ImmutableList<Message> values = getValues();
final Message value = values.isEmpty() ? null : values.get(0);
final boolean isTimestamp = value instanceof Timestamp;
return isTimestamp;
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class ChangesShould method create_TimestampChange_instance.
@Test
public void create_TimestampChange_instance() {
final Timestamp fiveMinutesAgo = TimeTests.Past.minutesAgo(5);
final Timestamp now = Time.getCurrentTime();
final TimestampChange result = Changes.of(fiveMinutesAgo, now);
assertEquals(fiveMinutesAgo, result.getPreviousValue());
assertEquals(now, result.getNewValue());
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class BulkWriteOperation method checkExpiration.
/**
* Verifies if the operation lasts for too long. If so, completes the operation,
* otherwise performs no action.
*
* <p>Performs no action if the operation is already finished.
*
* @see #complete()
*/
void checkExpiration() {
if (!isInProgress()) {
return;
}
final Timestamp currentTime = getCurrentTime();
if (Timestamps2.compare(currentTime, expirationTime) > 0) {
log().warn("Completing bulk write operation before all the events are processed.");
complete();
}
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class TestCommandContextFactory method createCommandContext.
/** Creates a new {@link CommandContext} instance. */
public static CommandContext createCommandContext() {
final UserId userId = newUserId(newUuid());
final Timestamp now = getCurrentTime();
return createCommandContext(userId, now);
}
use of com.google.protobuf.Timestamp in project core-java by SpineEventEngine.
the class Timestamps2Should method reset_time_provider_to_default.
@Test
public void reset_time_provider_to_default() {
final Timestamp aMinuteAgo = subtract(systemTime(), fromMinutes(1));
setProvider(new TimeTests.FrozenMadHatterParty(aMinuteAgo));
resetProvider();
assertNotEquals(aMinuteAgo, getCurrentTime());
}
Aggregations