Github user aljoscha commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3445#discussion_r105937053
  
    --- Diff: 
flink-libraries/flink-cep/src/test/java/org/apache/flink/cep/operator/CEPMigration11to13Test.java
 ---
    @@ -0,0 +1,171 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.flink.cep.operator;
    +
    +import org.junit.Test;
    +
    +public class CEPMigration11to13Test extends CEPMigrationTestBase {
    +
    +   @Test
    +   public void testKeyedCEPFunctionMigration11() throws Exception {
    +           testKeyedCEPFunctionMigration("cep-keyed-savepoint-1.1");
    +   }
    +
    +   @Test
    +   public void testNonKeyedCEPFunctionMigration11() throws Exception {
    +           testNonKeyedCEPFunctionMigration("cep-non-keyed-savepoint-1.1");
    +   }
    +}
    +
    +/*
    +FLINK 1.1 CODE TO PRODUCE THE SAVEPOINTS. (INCLUDE ALSO THE PATTERN CODE 
AT THE BOTTOM FOR BOTH CASES)
    +
    +@Test
    +public void keyedCEPOperatorSavepointGen() throws Exception {
    +
    +   KeySelector<Event, Integer> keySelector = new KeySelector<Event, 
Integer>() {
    +      private static final long serialVersionUID = -4873366487571254798L;
    +
    +      @Override
    +      public Integer getKey(Event value) throws Exception {
    +         return value.getId();
    +      }
    +   };
    +
    +   OneInputStreamOperatorTestHarness<Event, Map<String, Event>> harness = 
new OneInputStreamOperatorTestHarness<>(
    +         new KeyedCEPPatternOperator<>(
    +               Event.createTypeSerializer(),
    +               false,
    +               keySelector,
    +               IntSerializer.INSTANCE,
    +               new NFAFactory()));
    +   harness.configureForKeyedStream(keySelector, 
BasicTypeInfo.INT_TYPE_INFO);
    +   harness.open();
    +
    +   Event startEvent = new Event(42, "start", 1.0);
    +   SubEvent middleEvent = new SubEvent(42, "foo", 1.0, 10.0);
    +   Event endEvent=  new Event(42, "end", 1.0);
    +
    +   harness.processElement(new StreamRecord<Event>(startEvent, 1));
    +   harness.processElement(new StreamRecord<Event>(new Event(42, "foobar", 
1.0), 2));
    +   harness.processElement(new StreamRecord<Event>(new SubEvent(42, 
"barfoo", 1.0, 5.0), 3));
    +
    +   harness.processWatermark(new Watermark(2));
    +
    +   // simulate snapshot/restore with empty element queue but NFA state
    +   StreamTaskState snapshot = harness.snapshot(1, 1);
    +
    +   FileOutputStream out = new 
FileOutputStream("/Users/kkloudas/Desktop/cep-keyed-savepoint-1.1");
    --- End diff --
    
    This should be something like 
`"src/test/resources/cep-keyed-savepoint-1.1"`, same for the other path down 
below. With this, it would generate directly into the directory where the test 
currently is and where the test expects to find it.


---
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.
---

Reply via email to