use of org.apache.flink.cep.utils.NFATestHarness in project flink by apache.
the class NFAIterativeConditionTimeContextTest method testEventTimestamp.
@Test
public void testEventTimestamp() throws Exception {
final Event event = event().withId(1).build();
final long timestamp = 3;
final Pattern<Event, ?> pattern = Pattern.<Event>begin("start").where(new IterativeCondition<Event>() {
@Override
public boolean filter(Event value, Context<Event> ctx) throws Exception {
return ctx.timestamp() == timestamp;
}
});
final NFATestHarness testHarness = forPattern(pattern).build();
final List<List<Event>> resultingPattern = testHarness.feedRecord(new StreamRecord<>(event, timestamp));
comparePatterns(resultingPattern, Collections.singletonList(Collections.singletonList(event)));
}
Aggregations