Search in sources :

Example 1 with BaseFlowEvent

use of com.sequenceiq.flow.reactor.api.event.BaseFlowEvent in project cloudbreak by hortonworks.

the class HelloWorldFlowChainFactory method createFlowTriggerEventQueue.

@Override
public FlowTriggerEventQueue createFlowTriggerEventQueue(BaseFlowEvent event) {
    Queue<Selectable> flowEventChain = new ConcurrentLinkedDeque<>();
    flowEventChain.add(new BaseFlowEvent(HELLOWORLD_TRIGGER_EVENT.event(), event.getResourceId(), event.getResourceCrn(), event.accepted()));
    return new FlowTriggerEventQueue(getName(), event, flowEventChain);
}
Also used : BaseFlowEvent(com.sequenceiq.flow.reactor.api.event.BaseFlowEvent) FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) ConcurrentLinkedDeque(java.util.concurrent.ConcurrentLinkedDeque)

Example 2 with BaseFlowEvent

use of com.sequenceiq.flow.reactor.api.event.BaseFlowEvent in project cloudbreak by hortonworks.

the class ReactorNotifierTest method testNonAllowedFlowInMaintenanceMode.

@Test(expected = CloudbreakApiException.class)
public void testNonAllowedFlowInMaintenanceMode() {
    Stack stack = TestUtil.stack();
    stack.setCluster(TestUtil.cluster());
    stack.setStackStatus(new StackStatus(stack, DetailedStackStatus.MAINTENANCE_MODE_ENABLED));
    when(stackService.getByIdWithTransaction(1L)).thenReturn(stack);
    BaseFlowEvent baseFlowEvent = new BaseFlowEvent("dontcare", 1L, "crn");
    when(eventFactory.createEventWithErrHandler(anyMap(), any(Acceptable.class))).thenReturn(new Event<Acceptable>(baseFlowEvent));
    underTest.notify(1L, "RANDOM", baseFlowEvent, stackService::getByIdWithTransaction);
    verify(reactor, never()).notify(anyString(), any(Event.class));
}
Also used : BaseFlowEvent(com.sequenceiq.flow.reactor.api.event.BaseFlowEvent) StackStatus(com.sequenceiq.cloudbreak.domain.stack.StackStatus) DetailedStackStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.common.DetailedStackStatus) Acceptable(com.sequenceiq.cloudbreak.common.event.Acceptable) Event(reactor.bus.Event) BaseFlowEvent(com.sequenceiq.flow.reactor.api.event.BaseFlowEvent) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.Test)

Example 3 with BaseFlowEvent

use of com.sequenceiq.flow.reactor.api.event.BaseFlowEvent in project cloudbreak by hortonworks.

the class SdxReactorFlowManagerTest method setUp.

@BeforeEach
void setUp() throws InterruptedException {
    sdxCluster = getValidSdxCluster();
    when(acceptResultPromise.await(anyLong(), any())).thenReturn(FlowAcceptResult.runningInFlow("flowId"));
    BaseFlowEvent baseFlowEvent = new BaseFlowEvent("dontcare", 1L, "crn", acceptResultPromise);
    lenient().when(eventFactory.createEventWithErrHandler(anyMap(), any(Acceptable.class))).thenReturn(new Event(baseFlowEvent));
}
Also used : BaseFlowEvent(com.sequenceiq.flow.reactor.api.event.BaseFlowEvent) Acceptable(com.sequenceiq.cloudbreak.common.event.Acceptable) DatalakeUpgradeFlowChainStartEvent(com.sequenceiq.datalake.flow.datalake.upgrade.event.DatalakeUpgradeFlowChainStartEvent) Event(reactor.bus.Event) BaseFlowEvent(com.sequenceiq.flow.reactor.api.event.BaseFlowEvent) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

BaseFlowEvent (com.sequenceiq.flow.reactor.api.event.BaseFlowEvent)3 Acceptable (com.sequenceiq.cloudbreak.common.event.Acceptable)2 Event (reactor.bus.Event)2 DetailedStackStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.common.DetailedStackStatus)1 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)1 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 StackStatus (com.sequenceiq.cloudbreak.domain.stack.StackStatus)1 DatalakeUpgradeFlowChainStartEvent (com.sequenceiq.datalake.flow.datalake.upgrade.event.DatalakeUpgradeFlowChainStartEvent)1 FlowTriggerEventQueue (com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue)1 ConcurrentLinkedDeque (java.util.concurrent.ConcurrentLinkedDeque)1 Test (org.junit.Test)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1