Search in sources :

Example 6 with SleepChainTriggerEvent

use of com.sequenceiq.flow.component.sleep.event.SleepChainTriggerEvent 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);
}
Also used : FlowAcceptResult(com.sequenceiq.flow.core.model.FlowAcceptResult) SleepChainTriggerEvent(com.sequenceiq.flow.component.sleep.event.SleepChainTriggerEvent) NestedSleepChainTriggerEvent(com.sequenceiq.flow.component.sleep.event.NestedSleepChainTriggerEvent) SleepConfig(com.sequenceiq.flow.component.sleep.event.SleepConfig) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 7 with SleepChainTriggerEvent

use of com.sequenceiq.flow.component.sleep.event.SleepChainTriggerEvent 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);
}
Also used : FlowAcceptResult(com.sequenceiq.flow.core.model.FlowAcceptResult) SleepChainTriggerEvent(com.sequenceiq.flow.component.sleep.event.SleepChainTriggerEvent) NestedSleepChainTriggerEvent(com.sequenceiq.flow.component.sleep.event.NestedSleepChainTriggerEvent) SleepConfig(com.sequenceiq.flow.component.sleep.event.SleepConfig) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

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 FlowAcceptResult (com.sequenceiq.flow.core.model.FlowAcceptResult)7 Test (org.junit.jupiter.api.Test)7 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)7 AcceptResult (com.sequenceiq.cloudbreak.common.event.AcceptResult)1 SleepStartEvent (com.sequenceiq.flow.component.sleep.event.SleepStartEvent)1 FlowTriggerConditionResult (com.sequenceiq.flow.core.FlowTriggerConditionResult)1 Promise (reactor.rx.Promise)1