use of com.sequenceiq.flow.core.model.FlowAcceptResult in project cloudbreak by hortonworks.
the class FlowComponentTest method retryFirstFailedThenCompletedFlowFails.
@Test
public void retryFirstFailedThenCompletedFlowFails() throws InterruptedException {
long resourceId = RESOURCE_ID_SEC.incrementAndGet();
SleepStartEvent sleepStartEvent = new SleepStartEvent(resourceId, SLEEP_TIME, LocalDateTime.now().plus(SLEEP_TIME.multipliedBy(2)));
FlowAcceptResult acceptResult = startSleepFlow(sleepStartEvent);
assertRunningInFlow(acceptResult);
waitFlowToFail(SLEEP_TIME.multipliedBy(WAIT_FACTOR), acceptResult);
FlowIdentifier flowIdentifier = flow2Handler.retryLastFailedFlow(resourceId, noOp());
assertEquals(FlowType.FLOW, flowIdentifier.getType());
assertEquals(acceptResult.getAsFlowId(), flowIdentifier.getPollableId());
waitFlowToComplete(SLEEP_TIME.multipliedBy(WAIT_FACTOR), acceptResult);
assertThrows(BadRequestException.class, () -> flow2Handler.retryLastFailedFlow(resourceId, noOp()));
}
use of com.sequenceiq.flow.core.model.FlowAcceptResult in project cloudbreak by hortonworks.
the class FlowComponentTest method startFlowChainThenWaitForComplete.
@Test
public void startFlowChainThenWaitForComplete() throws InterruptedException {
long resourceId = RESOURCE_ID_SEC.incrementAndGet();
SleepChainTriggerEvent sleepChainTriggerEvent = new SleepChainTriggerEvent(resourceId, Lists.newArrayList(new SleepConfig(SLEEP_TIME, SleepStartEvent.NEVER_FAIL), new SleepConfig(SLEEP_TIME, SleepStartEvent.NEVER_FAIL)));
FlowAcceptResult acceptResult = startSleepFlowChain(sleepChainTriggerEvent);
assertRunningInFlowChain(acceptResult);
waitFlowChainToComplete(SLEEP_TIME.multipliedBy(WAIT_FACTOR), acceptResult);
}
use of com.sequenceiq.flow.core.model.FlowAcceptResult in project cloudbreak by hortonworks.
the class FlowComponentTest method startFlowChainThenWaitForFail.
@Test
public void startFlowChainThenWaitForFail() throws InterruptedException {
long resourceId = RESOURCE_ID_SEC.incrementAndGet();
SleepChainTriggerEvent sleepChainTriggerEvent = new SleepChainTriggerEvent(resourceId, Lists.newArrayList(new SleepConfig(SLEEP_TIME, SleepStartEvent.NEVER_FAIL), new SleepConfig(SLEEP_TIME, SleepStartEvent.ALWAYS_FAIL)));
FlowAcceptResult acceptResult = startSleepFlowChain(sleepChainTriggerEvent);
assertRunningInFlowChain(acceptResult);
waitFlowChainToFail(SLEEP_TIME.multipliedBy(WAIT_FACTOR), acceptResult);
}
use of com.sequenceiq.flow.core.model.FlowAcceptResult in project cloudbreak by hortonworks.
the class FlowComponentTest method startFlowThenWaitForComplete.
@Test
public void startFlowThenWaitForComplete() throws InterruptedException {
long resourceId = RESOURCE_ID_SEC.incrementAndGet();
SleepStartEvent sleepStartEvent = SleepStartEvent.neverFail(resourceId, SLEEP_TIME);
FlowAcceptResult acceptResult = startSleepFlow(sleepStartEvent);
assertRunningInFlow(acceptResult);
waitFlowToComplete(SLEEP_TIME.multipliedBy(WAIT_FACTOR), acceptResult);
}
use of com.sequenceiq.flow.core.model.FlowAcceptResult in project cloudbreak by hortonworks.
the class FlowComponentTest method startIdempotentFlowWhileTheOtherIsRunningReturnsOriginalFlowId.
@Test
public void startIdempotentFlowWhileTheOtherIsRunningReturnsOriginalFlowId() throws InterruptedException {
long resourceId = RESOURCE_ID_SEC.incrementAndGet();
SleepStartEvent sleepStartEvent1 = SleepStartEvent.neverFail(resourceId, SLEEP_TIME);
SleepStartEvent sleepStartEvent2 = SleepStartEvent.neverFail(resourceId, SLEEP_TIME);
FlowAcceptResult acceptResult1 = startSleepFlow(sleepStartEvent1);
FlowAcceptResult acceptResult2 = startSleepFlow(sleepStartEvent2);
assertRunningInFlow(acceptResult1);
assertRunningInFlow(acceptResult2);
waitFlowToComplete(SLEEP_TIME.multipliedBy(WAIT_FACTOR), acceptResult2);
}
Aggregations