use of com.sequenceiq.flow.component.sleep.event.SleepStartEvent in project cloudbreak by hortonworks.
the class FlowComponentTest method startFlowThenWaitForFail.
@Test
public void startFlowThenWaitForFail() throws InterruptedException {
long resourceId = RESOURCE_ID_SEC.incrementAndGet();
SleepStartEvent sleepStartEvent = SleepStartEvent.alwaysFail(resourceId, SLEEP_TIME);
FlowAcceptResult acceptResult = startSleepFlow(sleepStartEvent);
assertRunningInFlow(acceptResult);
waitFlowToFail(SLEEP_TIME.multipliedBy(WAIT_FACTOR), acceptResult);
}
use of com.sequenceiq.flow.component.sleep.event.SleepStartEvent in project cloudbreak by hortonworks.
the class FlowComponentTest method retryFailedFlowAllowedMultipleTimes.
@Test
public void retryFailedFlowAllowedMultipleTimes() throws InterruptedException {
long resourceId = RESOURCE_ID_SEC.incrementAndGet();
SleepStartEvent sleepStartEvent = SleepStartEvent.alwaysFail(resourceId, SLEEP_TIME);
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());
waitFlowToFail(SLEEP_TIME.multipliedBy(WAIT_FACTOR), acceptResult);
flowIdentifier = flow2Handler.retryLastFailedFlow(resourceId, noOp());
assertEquals(FlowType.FLOW, flowIdentifier.getType());
assertEquals(acceptResult.getAsFlowId(), flowIdentifier.getPollableId());
waitFlowToFail(SLEEP_TIME.multipliedBy(WAIT_FACTOR), acceptResult);
}
use of com.sequenceiq.flow.component.sleep.event.SleepStartEvent in project cloudbreak by hortonworks.
the class FlowComponentTest method startingDifferentFlowFailsBeforeFirstCompletes.
@Test
public void startingDifferentFlowFailsBeforeFirstCompletes() throws InterruptedException {
long resourceId = RESOURCE_ID_SEC.incrementAndGet();
SleepStartEvent sleepStartEvent1 = SleepStartEvent.neverFail(resourceId, SLEEP_TIME);
SleepStartEvent sleepStartEvent2 = SleepStartEvent.alwaysFail(resourceId, SLEEP_TIME);
FlowAcceptResult acceptResult = startSleepFlow(sleepStartEvent1);
FlowAcceptResult rejectResult = startSleepFlow(sleepStartEvent2);
assertRunningInFlow(acceptResult);
assertRejected(rejectResult);
waitFlowToComplete(SLEEP_TIME.multipliedBy(WAIT_FACTOR), acceptResult);
}
use of com.sequenceiq.flow.component.sleep.event.SleepStartEvent in project cloudbreak by hortonworks.
the class FlowComponentTest method retryPendingFlowFails.
@Test
public void retryPendingFlowFails() throws InterruptedException {
long resourceId = RESOURCE_ID_SEC.incrementAndGet();
SleepStartEvent sleepStartEvent = SleepStartEvent.neverFail(resourceId, SLEEP_TIME);
FlowAcceptResult acceptResult = startSleepFlow(sleepStartEvent);
assertRunningInFlow(acceptResult);
BadRequestException exception = assertThrows(BadRequestException.class, () -> flow2Handler.retryLastFailedFlow(resourceId, noOp()));
assertEquals("Retry cannot be performed, because there is already an active flow.", exception.getMessage());
waitFlowToComplete(SLEEP_TIME.multipliedBy(WAIT_FACTOR), acceptResult);
}
use of com.sequenceiq.flow.component.sleep.event.SleepStartEvent in project cloudbreak by hortonworks.
the class FlowComponentTest method startingFlowChainFailsWhenFlowIsAlreadyRunning.
@Test
public void startingFlowChainFailsWhenFlowIsAlreadyRunning() throws InterruptedException {
long resourceId = RESOURCE_ID_SEC.incrementAndGet();
SleepStartEvent sleepStartEvent = SleepStartEvent.neverFail(resourceId, SLEEP_TIME);
SleepChainTriggerEvent sleepChainTriggerEvent = new SleepChainTriggerEvent(resourceId, Lists.newArrayList(new SleepConfig(SLEEP_TIME, SleepStartEvent.NEVER_FAIL), new SleepConfig(SLEEP_TIME, SleepStartEvent.NEVER_FAIL)));
FlowAcceptResult acceptResult = startSleepFlow(sleepStartEvent);
FlowAcceptResult rejectResult = startSleepFlowChain(sleepChainTriggerEvent);
assertRunningInFlow(acceptResult);
assertRejected(rejectResult);
waitFlowToComplete(SLEEP_TIME.multipliedBy(WAIT_FACTOR), acceptResult);
}
Aggregations