Search in sources :

Example 21 with FlowAcceptResult

use of com.sequenceiq.flow.core.model.FlowAcceptResult in project cloudbreak by hortonworks.

the class FlowComponentTest method startSecondFlowWhenFirstCompletedThenWaitForComplete.

@Test
public void startSecondFlowWhenFirstCompletedThenWaitForComplete() throws InterruptedException {
    long resourceId = RESOURCE_ID_SEC.incrementAndGet();
    SleepStartEvent sleepStartEvent1 = SleepStartEvent.neverFail(resourceId, SLEEP_TIME);
    FlowAcceptResult acceptResult1 = startSleepFlow(sleepStartEvent1);
    assertRunningInFlow(acceptResult1);
    waitFlowToComplete(SLEEP_TIME.multipliedBy(WAIT_FACTOR), acceptResult1);
    SleepStartEvent sleepStartEvent2 = SleepStartEvent.neverFail(resourceId, SLEEP_TIME);
    FlowAcceptResult acceptResult2 = startSleepFlow(sleepStartEvent2);
    assertRunningInFlow(acceptResult2);
    waitFlowToComplete(SLEEP_TIME.multipliedBy(WAIT_FACTOR), acceptResult2);
}
Also used : FlowAcceptResult(com.sequenceiq.flow.core.model.FlowAcceptResult) SleepStartEvent(com.sequenceiq.flow.component.sleep.event.SleepStartEvent) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

FlowAcceptResult (com.sequenceiq.flow.core.model.FlowAcceptResult)21 Test (org.junit.jupiter.api.Test)16 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)16 SleepStartEvent (com.sequenceiq.flow.component.sleep.event.SleepStartEvent)10 NestedSleepChainTriggerEvent (com.sequenceiq.flow.component.sleep.event.NestedSleepChainTriggerEvent)7 SleepChainTriggerEvent (com.sequenceiq.flow.component.sleep.event.SleepChainTriggerEvent)7 SleepConfig (com.sequenceiq.flow.component.sleep.event.SleepConfig)7 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)6 AcceptResult (com.sequenceiq.cloudbreak.common.event.AcceptResult)4 FlowNotAcceptedException (com.sequenceiq.cloudbreak.exception.FlowNotAcceptedException)3 FlowsAlreadyRunningException (com.sequenceiq.cloudbreak.exception.FlowsAlreadyRunningException)3 Acceptable (com.sequenceiq.cloudbreak.common.event.Acceptable)2 CloudbreakApiException (com.sequenceiq.cloudbreak.exception.CloudbreakApiException)2 BadRequestException (javax.ws.rs.BadRequestException)2 Promise (reactor.rx.Promise)2 DetailedStackStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.common.DetailedStackStatus)1 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 StackStatus (com.sequenceiq.cloudbreak.domain.stack.StackStatus)1 FlowTriggerConditionResult (com.sequenceiq.flow.core.FlowTriggerConditionResult)1 BaseFlowEvent (com.sequenceiq.flow.reactor.api.event.BaseFlowEvent)1