Search in sources :

Example 1 with UpgradeCcmEvent

use of com.sequenceiq.freeipa.flow.stack.upgrade.ccm.event.UpgradeCcmEvent in project cloudbreak by hortonworks.

the class UpgradeCcmActions method finished.

@Bean(name = UPGRADE_CCM_FINISHED_STATE_NAME)
public Action<?, ?> finished() {
    return new AbstractUpgradeCcmEventAction() {

        @Override
        protected void doExecute(UpgradeCcmContext context, UpgradeCcmEvent payload, Map<Object, Object> variables) {
            LOGGER.info("FreeIPA CCM upgrade finished {}", payload);
            upgradeCcmService.finishedState(context.getStack().getId());
            completeOperation(context.getStack().getAccountId(), context.getStack().getEnvironmentCrn(), variables);
            sendEvent(context, UPGRADE_CCM_FINISHED_EVENT.event(), new StackEvent(context.getStack().getId()));
        }
    };
}
Also used : UpgradeCcmEvent(com.sequenceiq.freeipa.flow.stack.upgrade.ccm.event.UpgradeCcmEvent) StackEvent(com.sequenceiq.freeipa.flow.stack.StackEvent) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean)

Example 2 with UpgradeCcmEvent

use of com.sequenceiq.freeipa.flow.stack.upgrade.ccm.event.UpgradeCcmEvent in project cloudbreak by hortonworks.

the class UpgradeCcmChangeTunnelHandler method doAccept.

@Override
protected Selectable doAccept(HandlerEvent<UpgradeCcmEvent> event) {
    UpgradeCcmEvent request = event.getData();
    LOGGER.info("Changing tunnel for CCM upgrade...");
    upgradeCcmService.changeTunnel(request.getResourceId());
    return UPGRADE_CCM_TUNNEL_CHANGE_FINISHED_EVENT.createBasedOn(request);
}
Also used : UpgradeCcmEvent(com.sequenceiq.freeipa.flow.stack.upgrade.ccm.event.UpgradeCcmEvent)

Example 3 with UpgradeCcmEvent

use of com.sequenceiq.freeipa.flow.stack.upgrade.ccm.event.UpgradeCcmEvent in project cloudbreak by hortonworks.

the class UpgradeCcmCheckPrerequisitesHandler method doAccept.

@Override
protected Selectable doAccept(HandlerEvent<UpgradeCcmEvent> event) {
    UpgradeCcmEvent request = event.getData();
    LOGGER.info("Checking prerequisites for CCM upgrade...");
    upgradeCcmService.checkPrerequsities(request.getResourceId());
    return UPGRADE_CCM_CHECK_PREREQUISITES_FINISHED_EVENT.createBasedOn(request);
}
Also used : UpgradeCcmEvent(com.sequenceiq.freeipa.flow.stack.upgrade.ccm.event.UpgradeCcmEvent)

Example 4 with UpgradeCcmEvent

use of com.sequenceiq.freeipa.flow.stack.upgrade.ccm.event.UpgradeCcmEvent in project cloudbreak by hortonworks.

the class UpgradeCcmCheckPrerequisitesHandlerTest method setUp.

@BeforeEach
void setUp() {
    UpgradeCcmEvent upgradeCcmEvent = new UpgradeCcmEvent("selector", STACK_ID, Tunnel.CCM);
    event = new Event<>(upgradeCcmEvent);
}
Also used : UpgradeCcmEvent(com.sequenceiq.freeipa.flow.stack.upgrade.ccm.event.UpgradeCcmEvent) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with UpgradeCcmEvent

use of com.sequenceiq.freeipa.flow.stack.upgrade.ccm.event.UpgradeCcmEvent in project cloudbreak by hortonworks.

the class UpgradeCcmGenericHandlerTest method testHandlerVerifyServiceMethodCall.

@ArgumentsSource(TestScenarios.class)
@ParameterizedTest(name = "Handler: {0}, Verified method: {2}, Tunnel: {3}")
void testHandlerVerifyServiceMethodCall(String testname, Class<? extends AbstractUpgradeCcmEventHandler> handlerClass, String methodToVerify, Tunnel tunnel, VerificationMode mockVerificationMode, String expectedEndState) throws Exception {
    injectMocks(handlerClass);
    UpgradeCcmEvent upgradeCcmEvent = new UpgradeCcmEvent("selector", STACK_ID, tunnel);
    Event<UpgradeCcmEvent> event = new Event<>(upgradeCcmEvent);
    underTest.accept(event);
    UpgradeCcmService.class.getMethod(methodToVerify, Long.class).invoke(verify(upgradeCcmService, mockVerificationMode), STACK_ID);
    verify(eventBus).notify(eq(expectedEndState), eventCaptor.capture());
    Event<UpgradeCcmEvent> eventResult = eventCaptor.getValue();
    assertThat(eventResult.getData().getOldTunnel()).isEqualTo(tunnel);
    assertThat(eventResult.getData().selector()).isEqualTo(expectedEndState);
    assertThat(eventResult.getData().getResourceId()).isEqualTo(STACK_ID);
}
Also used : UpgradeCcmEvent(com.sequenceiq.freeipa.flow.stack.upgrade.ccm.event.UpgradeCcmEvent) UpgradeCcmService(com.sequenceiq.freeipa.flow.stack.upgrade.ccm.UpgradeCcmService) Event(reactor.bus.Event) UpgradeCcmEvent(com.sequenceiq.freeipa.flow.stack.upgrade.ccm.event.UpgradeCcmEvent) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Aggregations

UpgradeCcmEvent (com.sequenceiq.freeipa.flow.stack.upgrade.ccm.event.UpgradeCcmEvent)11 BeforeEach (org.junit.jupiter.api.BeforeEach)2 CloudbreakOrchestratorException (com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorException)1 StackEvent (com.sequenceiq.freeipa.flow.stack.StackEvent)1 UpgradeCcmService (com.sequenceiq.freeipa.flow.stack.upgrade.ccm.UpgradeCcmService)1 UpgradeCcmFailureEvent (com.sequenceiq.freeipa.flow.stack.upgrade.ccm.event.UpgradeCcmFailureEvent)1 Map (java.util.Map)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 ArgumentsSource (org.junit.jupiter.params.provider.ArgumentsSource)1 Bean (org.springframework.context.annotation.Bean)1 Event (reactor.bus.Event)1