public void injectElement(InputT value, Instant timestamp) throws Exception { Collection<W> windows = windowFn.assignWindows( new TriggerTester.StubAssignContext<W>( windowFn, value, timestamp, Arrays.asList(GlobalWindow.INSTANCE))); logInteraction( "Element %s at time %d put in windows %s", value, timestamp.getMillis(), windows); runner.processElement(WindowedValue.of(value, timestamp, windows, PaneInfo.NO_FIRING)); }
/** Advance the processing time to the specified time, firing any timers that should fire. */ public void advanceProcessingTime(Instant newProcessingTime) throws Exception { Preconditions.checkState( !newProcessingTime.isBefore(processingTime), "Cannot move processing time backwards from %s to %s", processingTime.getMillis(), newProcessingTime.getMillis()); logInteraction("Advancing processing time to %d", newProcessingTime.getMillis()); processingTime = newProcessingTime; timerInternals.advanceProcessingTime(runner, newProcessingTime); }
/** Advance the watermark to the specified time, firing any timers that should fire. */ public void advanceWatermark(Instant newWatermark) throws Exception { Preconditions.checkState( !newWatermark.isBefore(watermark), "Cannot move watermark time backwards from %s to %s", watermark.getMillis(), newWatermark.getMillis()); logInteraction("Advancing watermark to %d", newWatermark.getMillis()); watermark = newWatermark; timerInternals.advanceWatermark(runner, newWatermark); }