use of com.datatorrent.common.util.DefaultDelayOperator in project apex-core by apache.
the class DelayOperatorTest method testFibonacciRecovery1.
@Test(timeout = 60000)
public void testFibonacciRecovery1() throws Exception {
LogicalPlan dag = StramTestSupport.createDAG(testMeta);
TestGeneratorInputOperator dummyInput = dag.addOperator("DUMMY", TestGeneratorInputOperator.class);
FailableFibonacciOperator fib = dag.addOperator("FIB", FailableFibonacciOperator.class);
DefaultDelayOperator opDelay = dag.addOperator("opDelay", DefaultDelayOperator.class);
fib.failableOperator = new FailableOperator(fib, 3, true);
dag.addStream("dummy_to_operator", dummyInput.outport, fib.dummyInputPort);
dag.addStream("operator_to_delay", fib.output, opDelay.input);
dag.addStream("delay_to_operator", opDelay.output, fib.input);
dag.getAttributes().put(LogicalPlan.CHECKPOINT_WINDOW_COUNT, 2);
dag.getAttributes().put(LogicalPlan.STREAMING_WINDOW_SIZE_MILLIS, 300);
dag.getAttributes().put(LogicalPlan.HEARTBEAT_INTERVAL_MILLIS, 50);
final StramLocalCluster localCluster = new StramLocalCluster(dag);
localCluster.setPerContainerBufferServer(true);
localCluster.run(new ExitCondition(30, FailableOperator.isFailureSimulated));
assertFalse(ExitCondition.message, ExitCondition.failed);
assertTrue(FibonacciOperator.results.size() >= 30);
assertFibonacci();
}
use of com.datatorrent.common.util.DefaultDelayOperator in project apex-core by apache.
the class DelayOperatorTest method testFibonacci.
@Test(timeout = 60000)
public void testFibonacci() throws Exception {
LogicalPlan dag = new LogicalPlan();
TestGeneratorInputOperator dummyInput = dag.addOperator("DUMMY", TestGeneratorInputOperator.class);
FibonacciOperator fib = dag.addOperator("FIB", FibonacciOperator.class);
DefaultDelayOperator opDelay = dag.addOperator("opDelay", DefaultDelayOperator.class);
dag.addStream("dummy_to_operator", dummyInput.outport, fib.dummyInputPort);
dag.addStream("operator_to_delay", fib.output, opDelay.input);
dag.addStream("delay_to_operator", opDelay.output, fib.input);
new StramLocalCluster(dag).run(new ExitCondition(10, null));
assertFalse(ExitCondition.message, ExitCondition.failed);
assertFibonacci();
}
Aggregations