use of org.apache.beam.runners.direct.WatermarkManager.TimerUpdate in project beam by apache.
the class WatermarkManagerTest method timerUpdateBuilderBuildAddsAllAddedTimers.
@Test
public void timerUpdateBuilderBuildAddsAllAddedTimers() {
TimerData set = TimerData.of(StateNamespaces.global(), new Instant(10L), new Instant(10L), TimeDomain.EVENT_TIME);
TimerData deleted = TimerData.of(StateNamespaces.global(), new Instant(24L), new Instant(24L), TimeDomain.PROCESSING_TIME);
TimerData completedOne = TimerData.of(StateNamespaces.global(), new Instant(1024L), new Instant(1024L), TimeDomain.SYNCHRONIZED_PROCESSING_TIME);
TimerData completedTwo = TimerData.of(StateNamespaces.global(), new Instant(2048L), new Instant(2048L), TimeDomain.EVENT_TIME);
TimerUpdate update = TimerUpdate.builder(StructuralKey.of("foo", StringUtf8Coder.of())).withCompletedTimers(ImmutableList.of(completedOne, completedTwo)).setTimer(set).deletedTimer(deleted).build();
assertThat(update.getCompletedTimers(), containsInAnyOrder(completedOne, completedTwo));
assertThat(update.getSetTimers(), contains(set));
assertThat(update.getDeletedTimers(), contains(deleted));
}
use of org.apache.beam.runners.direct.WatermarkManager.TimerUpdate in project beam by apache.
the class WatermarkManagerTest method timerUpdateBuilderWithDeleteThenSetHasOnlySet.
@Test
public void timerUpdateBuilderWithDeleteThenSetHasOnlySet() {
TimerUpdateBuilder builder = TimerUpdate.builder(null);
Instant now = Instant.now();
TimerData timer = TimerData.of(StateNamespaces.global(), now, now, TimeDomain.EVENT_TIME);
TimerUpdate built = builder.deletedTimer(timer).setTimer(timer).build();
assertThat(built.getSetTimers(), contains(timer));
assertThat(built.getDeletedTimers(), emptyIterable());
}
use of org.apache.beam.runners.direct.WatermarkManager.TimerUpdate in project beam by apache.
the class WatermarkManagerTest method timerUpdateBuilderWithDeleteAfterBuildNotAddedToBuilt.
@Test
public void timerUpdateBuilderWithDeleteAfterBuildNotAddedToBuilt() {
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.deletedTimer(timer);
assertThat(built.getDeletedTimers(), emptyIterable());
builder.build();
assertThat(built.getDeletedTimers(), emptyIterable());
}
Aggregations