Myasuka commented on a change in pull request #11624: [FLINK-16949] Enhance 
AbstractStreamOperatorTestHarness to use customized TtlTimeProvider
URL: https://github.com/apache/flink/pull/11624#discussion_r402898687
 
 

 ##########
 File path: 
flink-streaming-java/src/test/java/org/apache/flink/streaming/util/AbstractStreamOperatorTestHarnessTest.java
 ##########
 @@ -52,4 +55,24 @@ public void testInitializeAfterOpenning() throws Throwable {
                result.open();
                result.initializeState(new OperatorSubtaskState());
        }
+
+       @Test
+       public void testSetTtlTimeProvider() throws Exception {
+               AbstractStreamOperatorTestHarness<Integer> result;
+               AbstractStreamOperator operator = new 
AbstractStreamOperator<Integer>() {};
+               result =
+                       new AbstractStreamOperatorTestHarness<>(
+                               operator,
+                               1,
+                               1,
+                               0);
+               result.config.setStateKeySerializer(IntSerializer.INSTANCE);
+
+               long expectedTimeStamp = 42;
+               result.setTtlTimeProvider(() -> expectedTimeStamp);
+               result.initializeState(new OperatorSubtaskState());
+               result.open();
+               Assert.assertEquals(expectedTimeStamp,
+                       ((AbstractKeyedStateBackend<?>) 
operator.getKeyedStateBackend()).getTtlTimeProvider().currentTimestamp());
 
 Review comment:
   This sounds good, and I will update this test.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to