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