Github user ilooner commented on a diff in the pull request:
https://github.com/apache/incubator-apex-core/pull/167#discussion_r44966554
--- Diff:
engine/src/test/java/com/datatorrent/stram/engine/GenericNodeTest.java ---
@@ -296,4 +323,67 @@ public void run()
Assert.assertTrue("End window not called", go.endWindowId !=
go.beginWindowId);
}
+ @Test
+ public void testDoubleCheckpointAtleastOnce() throws Exception
+ {
+ testDoubleCheckpointHandling(ProcessingMode.AT_LEAST_ONCE);
+ }
+
+ @Test
+ public void testDoubleCheckpointAtMostOnce() throws Exception
+ {
+ testDoubleCheckpointHandling(ProcessingMode.AT_MOST_ONCE);
+ }
+
+ @Test
+ public void testDoubleCheckpointExactlyOnce() throws Exception
+ {
+ testDoubleCheckpointHandling(ProcessingMode.EXACTLY_ONCE);
+ }
+
+ private void testDoubleCheckpointHandling(ProcessingMode processingMode)
throws Exception
+ {
+ WindowGenerator windowGenerator = new WindowGenerator(new
ScheduledThreadPoolExecutor(1, "WindowGenerator"), 1024);
+ windowGenerator.setResetWindow(0L);
+ windowGenerator.setFirstWindow(0L);
+ windowGenerator.setWindowWidth(100);
+ windowGenerator.setCheckpointCount(1, 0);
+
+ GenericCheckpointOperator gco = new GenericCheckpointOperator();
+ DefaultAttributeMap dam = new DefaultAttributeMap();
+ dam.put(OperatorContext.APPLICATION_WINDOW_COUNT, 2);
+ dam.put(OperatorContext.CHECKPOINT_WINDOW_COUNT, 2);
+
+ final GenericNode in = new GenericNode(gco, new
com.datatorrent.stram.engine.OperatorContext(0, dam, null));
+ in.setId(1);
+
+ TestSink testSink = new TestSink();
+
+ in.connectInputPort("ip1",
windowGenerator.acquireReservoir(String.valueOf(in.id), 1024));
+ in.connectOutputPort("output", testSink);
+
+ windowGenerator.activate(null);
+
+ final AtomicBoolean ab = new AtomicBoolean(false);
+ Thread t = new Thread()
+ {
+ @Override
+ public void run()
+ {
+ ab.set(true);
+ in.activate();
+ in.run();
+ in.deactivate();
+ }
+
+ };
+
+ t.start();
+ Thread.sleep(3000);
--- End diff --
@PramodSSImmaneni made the change
---
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.
---