Github user tillrohrmann commented on a diff in the pull request:
https://github.com/apache/flink/pull/3381#discussion_r102471183
--- Diff:
flink-libraries/flink-cep/src/test/java/org/apache/flink/cep/nfa/compiler/NFACompilerTest.java
---
@@ -42,6 +45,43 @@
public class NFACompilerTest extends TestLogger {
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @Test
+ public void testNFACompilerUniquePatternName() {
+
+ // adjust the rule
+ expectedException.expect(MalformedPatternException.class);
+ expectedException.expectMessage("Duplicate pattern name: start.
Pattern names must be unique.");
+
+ Pattern<Event, ?> invalidPattern =
Pattern.<Event>begin("start").where(new FilterFunction<Event>() {
+ private static final long serialVersionUID =
-3863103355752267133L;
+
+ @Override
+ public boolean filter(Event value) throws Exception {
+ return value.getName().equals("start");
+ }
+ }).followedBy("middle").subtype(SubEvent.class).where(new
FilterFunction<SubEvent>() {
+ private static final long serialVersionUID =
-1413973420880409702L;
+
+ @Override
+ public boolean filter(SubEvent value) throws Exception {
+ return value.getVolume() > 10.0;
+ }
+ }).followedBy("start").subtype(SubEvent.class).where(new
FilterFunction<SubEvent>() {
+ private static final long serialVersionUID =
-1413973420880409702L;
+
+ @Override
+ public boolean filter(SubEvent value) throws Exception {
+ return value.getVolume() > 11.0;
+ }
+ }).within(Time.milliseconds(10));
--- End diff --
Test pattern could be much more concise for the test case.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---