use of com.sequenceiq.flow.component.sleep.event.NestedSleepChainTriggerEvent in project cloudbreak by hortonworks.
the class FlowComponentTest method startNestedFlowChainThenWaitForComplete.
@Test
public void startNestedFlowChainThenWaitForComplete() throws InterruptedException {
long resourceId = RESOURCE_ID_SEC.incrementAndGet();
Promise<AcceptResult> accepted1 = new Promise<>();
SleepChainTriggerEvent sleepChainTriggerEvent1 = new SleepChainTriggerEvent(resourceId, Lists.newArrayList(new SleepConfig(SLEEP_TIME, SleepStartEvent.NEVER_FAIL)), accepted1);
SleepChainTriggerEvent sleepChainTriggerEvent2 = new SleepChainTriggerEvent(resourceId, Lists.newArrayList(new SleepConfig(SLEEP_TIME, SleepStartEvent.NEVER_FAIL)), accepted1);
NestedSleepChainTriggerEvent nestedSleepChainTriggerEvent1 = new NestedSleepChainTriggerEvent(resourceId, Lists.newArrayList(sleepChainTriggerEvent1, sleepChainTriggerEvent2), accepted1);
Promise<AcceptResult> accepted2 = new Promise<>();
SleepChainTriggerEvent sleepChainTriggerEvent3 = new SleepChainTriggerEvent(resourceId, Lists.newArrayList(new SleepConfig(SLEEP_TIME, SleepStartEvent.NEVER_FAIL)), accepted2);
SleepChainTriggerEvent sleepChainTriggerEvent4 = new SleepChainTriggerEvent(resourceId, Lists.newArrayList(new SleepConfig(SLEEP_TIME, SleepStartEvent.NEVER_FAIL)), accepted2);
NestedSleepChainTriggerEvent nestedSleepChainTriggerEvent2 = new NestedSleepChainTriggerEvent(resourceId, Lists.newArrayList(sleepChainTriggerEvent3, sleepChainTriggerEvent4), accepted2);
FlowAcceptResult acceptResult1 = startNestedSleepFlowChain(nestedSleepChainTriggerEvent1);
FlowAcceptResult acceptResult2 = startNestedSleepFlowChain(nestedSleepChainTriggerEvent2);
assertRunningInFlowChain(acceptResult1);
assertRunningInFlowChain(acceptResult2);
waitFlowChainToComplete(SLEEP_TIME.multipliedBy(WAIT_FACTOR), acceptResult1);
}
Aggregations