Search in sources :

Example 1 with StackCreationService

use of com.sequenceiq.cloudbreak.core.flow2.stack.provision.service.StackCreationService in project cloudbreak by hortonworks.

the class StackImageUpdateActionsTest method prepareImageAction.

@Test
public void prepareImageAction() {
    FlowEvent flowEvent = Mockito.mock(FlowEvent.class);
    when(stateContext.getEvent()).thenReturn(flowEvent);
    when(flowEvent.name()).thenReturn(EVENT_NAME);
    StackEvent payload = new StackEvent(StackImageUpdateEvent.UPDATE_IMAGE_FINESHED_EVENT.event(), 1L);
    when(stateContext.getMessageHeader(HEADERS.DATA.name())).thenReturn(payload);
    when(state.getId()).thenReturn(StackImageUpdateState.IMAGE_PREPARE_STATE);
    prepareImageAction.execute(stateContext);
    verify(stackCreationService, times(1)).prepareImage(any(Stack.class), eq(variables));
    verify(eventBus, times(1)).notify(eq(CloudPlatformRequest.selector(PrepareImageRequest.class)), any(Event.class));
}
Also used : FlowEvent(com.sequenceiq.flow.core.FlowEvent) StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) FlowEvent(com.sequenceiq.flow.core.FlowEvent) StackFailureEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackFailureEvent) StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) Event(reactor.bus.Event) ResourceEvent(com.sequenceiq.cloudbreak.event.ResourceEvent) ImageUpdateEvent(com.sequenceiq.cloudbreak.reactor.api.event.stack.ImageUpdateEvent) StackImageUpdateTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.StackImageUpdateTriggerEvent) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.Test)

Aggregations

StackImageUpdateTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.StackImageUpdateTriggerEvent)1 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 ResourceEvent (com.sequenceiq.cloudbreak.event.ResourceEvent)1 StackEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackEvent)1 StackFailureEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackFailureEvent)1 ImageUpdateEvent (com.sequenceiq.cloudbreak.reactor.api.event.stack.ImageUpdateEvent)1 FlowEvent (com.sequenceiq.flow.core.FlowEvent)1 Test (org.junit.Test)1 Event (reactor.bus.Event)1