Search in sources :

Example 1 with UpgradeCcmService

use of com.sequenceiq.freeipa.flow.stack.upgrade.ccm.UpgradeCcmService 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

UpgradeCcmService (com.sequenceiq.freeipa.flow.stack.upgrade.ccm.UpgradeCcmService)1 UpgradeCcmEvent (com.sequenceiq.freeipa.flow.stack.upgrade.ccm.event.UpgradeCcmEvent)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 ArgumentsSource (org.junit.jupiter.params.provider.ArgumentsSource)1 Event (reactor.bus.Event)1