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()));
}
};
}
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);
}
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);
}
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);
}
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);
}
Aggregations