Search in sources :

Example 6 with Acceptable

use of com.sequenceiq.cloudbreak.cloud.Acceptable in project cloudbreak by hortonworks.

the class ReactorFlowManagerTest method setUp.

@Before
public void setUp() {
    reset(reactor);
    reset(eventFactory);
    when(reactor.notify((Object) anyObject(), any(Event.class))).thenReturn(new EventBus(new ThreadPoolExecutorDispatcher(1, 1)));
    Acceptable acceptable = new Acceptable() {

        @Override
        public Promise<Boolean> accepted() {
            Promise<Boolean> a = new Promise<>();
            a.accept(true);
            return a;
        }

        @Override
        public Long getStackId() {
            return stackId;
        }
    };
    Stack stack = TestUtil.stack();
    stack.setCluster(TestUtil.cluster());
    when(stackService.get(anyLong())).thenReturn(stack);
    when(stackService.getById(anyLong())).thenReturn(TestUtil.stack());
    when(stackService.getByIdView(anyLong())).thenReturn(TestUtil.stackView());
    when(eventFactory.createEventWithErrHandler(anyObject())).thenReturn(new Event<>(acceptable));
}
Also used : Promise(reactor.rx.Promise) Acceptable(com.sequenceiq.cloudbreak.cloud.Acceptable) Event(reactor.bus.Event) ClusterTerminationEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.termination.ClusterTerminationEvent) ThreadPoolExecutorDispatcher(reactor.core.dispatch.ThreadPoolExecutorDispatcher) EventBus(reactor.bus.EventBus) Stack(com.sequenceiq.cloudbreak.domain.Stack) Before(org.junit.Before)

Example 7 with Acceptable

use of com.sequenceiq.cloudbreak.cloud.Acceptable in project cloudbreak by hortonworks.

the class ReactorFlowManager method triggerStackStart.

public void triggerStackStart(Long stackId) {
    String selector = FlowChainTriggers.FULL_START_TRIGGER_EVENT;
    Acceptable startTriggerEvent = new StackEvent(selector, stackId);
    notify(selector, startTriggerEvent);
}
Also used : StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) Acceptable(com.sequenceiq.cloudbreak.cloud.Acceptable)

Aggregations

Acceptable (com.sequenceiq.cloudbreak.cloud.Acceptable)7 ClusterAndStackDownscaleTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.ClusterAndStackDownscaleTriggerEvent)2 Stack (com.sequenceiq.cloudbreak.domain.Stack)2 ScalingType (com.sequenceiq.cloudbreak.common.type.ScalingType)1 CloudbreakApiException (com.sequenceiq.cloudbreak.controller.CloudbreakApiException)1 FlowsAlreadyRunningException (com.sequenceiq.cloudbreak.controller.FlowsAlreadyRunningException)1 ClusterTerminationEvent (com.sequenceiq.cloudbreak.core.flow2.cluster.termination.ClusterTerminationEvent)1 ClusterScaleTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.ClusterScaleTriggerEvent)1 StackAndClusterUpscaleTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.StackAndClusterUpscaleTriggerEvent)1 StackDownscaleTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.StackDownscaleTriggerEvent)1 StackEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackEvent)1 Before (org.junit.Before)1 Event (reactor.bus.Event)1 EventBus (reactor.bus.EventBus)1 ThreadPoolExecutorDispatcher (reactor.core.dispatch.ThreadPoolExecutorDispatcher)1 Promise (reactor.rx.Promise)1