use of org.apache.beam.runners.direct.WatermarkManager.TimerUpdate.TimerUpdateBuilder in project beam by apache.
the class WatermarkManagerTest method timerUpdateBuilderWithCompletedAfterBuildNotAddedToBuilt.
@Test
public void timerUpdateBuilderWithCompletedAfterBuildNotAddedToBuilt() {
TimerUpdateBuilder builder = TimerUpdate.builder(null);
Instant now = Instant.now();
TimerData timer = TimerData.of(StateNamespaces.global(), now, now, TimeDomain.EVENT_TIME);
TimerUpdate built = builder.build();
builder.withCompletedTimers(ImmutableList.of(timer));
assertThat(built.getCompletedTimers(), emptyIterable());
builder.build();
assertThat(built.getCompletedTimers(), emptyIterable());
}
use of org.apache.beam.runners.direct.WatermarkManager.TimerUpdate.TimerUpdateBuilder in project beam by apache.
the class WatermarkManagerTest method timerUpdateWithCompletedTimersNotAddedToExisting.
@Test
public void timerUpdateWithCompletedTimersNotAddedToExisting() {
TimerUpdateBuilder builder = TimerUpdate.builder(null);
Instant now = Instant.now();
TimerData timer = TimerData.of(StateNamespaces.global(), now, now, TimeDomain.EVENT_TIME);
TimerUpdate built = builder.build();
assertThat(built.getCompletedTimers(), emptyIterable());
assertThat(built.withCompletedTimers(ImmutableList.of(timer)).getCompletedTimers(), contains(timer));
assertThat(built.getCompletedTimers(), emptyIterable());
}
use of org.apache.beam.runners.direct.WatermarkManager.TimerUpdate.TimerUpdateBuilder in project beam by apache.
the class WatermarkManagerTest method timerUpdateBuilderWithSetAtEndOfTime.
@Test
public void timerUpdateBuilderWithSetAtEndOfTime() {
Instant timerStamp = BoundedWindow.TIMESTAMP_MAX_VALUE;
TimerData tooFar = TimerData.of(StateNamespaces.global(), timerStamp, timerStamp, TimeDomain.EVENT_TIME);
TimerUpdateBuilder builder = TimerUpdate.builder(StructuralKey.empty());
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage(timerStamp.toString());
builder.setTimer(tooFar);
}
use of org.apache.beam.runners.direct.WatermarkManager.TimerUpdate.TimerUpdateBuilder in project beam by apache.
the class WatermarkManagerTest method timerUpdateBuilderWithSetPastEndOfTime.
@Test
public void timerUpdateBuilderWithSetPastEndOfTime() {
Instant timerStamp = BoundedWindow.TIMESTAMP_MAX_VALUE.plus(Duration.standardMinutes(2));
TimerData tooFar = TimerData.of(StateNamespaces.global(), timerStamp, timerStamp, TimeDomain.EVENT_TIME);
TimerUpdateBuilder builder = TimerUpdate.builder(StructuralKey.empty());
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage(timerStamp.toString());
builder.setTimer(tooFar);
}
use of org.apache.beam.runners.direct.WatermarkManager.TimerUpdate.TimerUpdateBuilder in project beam by apache.
the class WatermarkManagerTest method timerUpdateBuilderWithSetAfterBuildNotAddedToBuilt.
@Test
public void timerUpdateBuilderWithSetAfterBuildNotAddedToBuilt() {
TimerUpdateBuilder builder = TimerUpdate.builder(null);
Instant now = Instant.now();
TimerData timer = TimerData.of(StateNamespaces.global(), now, now, TimeDomain.EVENT_TIME);
TimerUpdate built = builder.build();
builder.setTimer(timer);
assertThat(built.getSetTimers(), emptyIterable());
builder.build();
assertThat(built.getSetTimers(), emptyIterable());
}
Aggregations