Search in sources :

Example 1 with UpgradeCcmContext

use of com.sequenceiq.freeipa.flow.stack.upgrade.ccm.action.UpgradeCcmContext in project cloudbreak by hortonworks.

the class UpgradeCcmFlowIntegrationTest method verifyFinishingStatCalls.

private void verifyFinishingStatCalls(boolean success) {
    verify(upgradeCcmService, times(success ? 1 : 0)).finishedState(STACK_ID);
    verify(operationService, times(success ? 1 : 0)).completeOperation(any(), any(), any(), any());
    ArgumentCaptor<UpgradeCcmContext> contextCaptor = ArgumentCaptor.forClass(UpgradeCcmContext.class);
    ArgumentCaptor<UpgradeCcmFailureEvent> payloadCaptor = ArgumentCaptor.forClass(UpgradeCcmFailureEvent.class);
    verify(upgradeCcmService, times(success ? 0 : 1)).failedState(contextCaptor.capture(), payloadCaptor.capture());
    if (!success) {
        UpgradeCcmContext context = contextCaptor.getValue();
        UpgradeCcmFailureEvent payload = payloadCaptor.getValue();
        assertEquals(STACK_ID, context.getStack().getId());
        assertEquals(STACK_ID, payload.getResourceId());
    }
    verify(operationService, times(success ? 0 : 1)).failOperation(any(), any(), any());
}
Also used : UpgradeCcmContext(com.sequenceiq.freeipa.flow.stack.upgrade.ccm.action.UpgradeCcmContext) UpgradeCcmFailureEvent(com.sequenceiq.freeipa.flow.stack.upgrade.ccm.event.UpgradeCcmFailureEvent)

Example 2 with UpgradeCcmContext

use of com.sequenceiq.freeipa.flow.stack.upgrade.ccm.action.UpgradeCcmContext in project cloudbreak by hortonworks.

the class UpgradeCcmFlowChainIntegrationTest method verifyFinishingStatCalls.

private void verifyFinishingStatCalls(boolean ccmUpgradeSuccess, boolean userDataUpdateSuccess) throws Exception {
    verify(upgradeCcmService, times(ccmUpgradeSuccess ? 1 : 0)).finishedState(STACK_ID);
    verify(resourcesApi, times(userDataUpdateSuccess ? 1 : 0)).updateUserData(any(), any(), any(), eq(USER_DATA));
    ArgumentCaptor<UpgradeCcmContext> contextCaptor = ArgumentCaptor.forClass(UpgradeCcmContext.class);
    ArgumentCaptor<UpgradeCcmFailureEvent> payloadCaptor = ArgumentCaptor.forClass(UpgradeCcmFailureEvent.class);
    verify(upgradeCcmService, times(ccmUpgradeSuccess ? 0 : 1)).failedState(contextCaptor.capture(), payloadCaptor.capture());
    if (!ccmUpgradeSuccess) {
        UpgradeCcmContext context = contextCaptor.getValue();
        UpgradeCcmFailureEvent payload = payloadCaptor.getValue();
        assertEquals(STACK_ID, context.getStack().getId());
        assertEquals(STACK_ID, payload.getResourceId());
    }
    verify(operationService, times(ccmUpgradeSuccess && userDataUpdateSuccess ? 1 : 0)).completeOperation(any(), any(), any(), any());
    verify(operationService, times(ccmUpgradeSuccess && userDataUpdateSuccess ? 0 : 1)).failOperation(any(), any(), any());
}
Also used : UpgradeCcmContext(com.sequenceiq.freeipa.flow.stack.upgrade.ccm.action.UpgradeCcmContext) UpgradeCcmFailureEvent(com.sequenceiq.freeipa.flow.stack.upgrade.ccm.event.UpgradeCcmFailureEvent)

Aggregations

UpgradeCcmContext (com.sequenceiq.freeipa.flow.stack.upgrade.ccm.action.UpgradeCcmContext)2 UpgradeCcmFailureEvent (com.sequenceiq.freeipa.flow.stack.upgrade.ccm.event.UpgradeCcmFailureEvent)2