use of com.sequenceiq.flow.repository.FlowLogRepository in project cloudbreak by hortonworks.
the class CcmUpgradeFlowIntegrationTest method testCcmUpgradeWhenReRegisterFail.
@Test
public void testCcmUpgradeWhenReRegisterFail() {
doThrow(new BadRequestException()).when(ccmUpgradeService).reregister(STACK_ID);
FlowIdentifier flowIdentifier = triggerFlow();
letItFlow(flowIdentifier);
ArgumentCaptor<FlowLog> flowLog = ArgumentCaptor.forClass(FlowLog.class);
verify(flowLogRepository, times(2)).save(flowLog.capture());
Assertions.assertTrue(flowLog.getAllValues().stream().anyMatch(f -> f.getFinalized()), "flow has not finalized");
verify(ccmUpgradeService, times(1)).prepare(STACK_ID);
verify(ccmUpgradeService, times(1)).ccmUpgradeFailed(STACK_ID);
verify(ccmUpgradeService, times(1)).reregister(STACK_ID);
verify(ccmUpgradeService, never()).ccmUpgradePreparationFailed(STACK_ID);
verify(ccmUpgradeService, never()).unregister(STACK_ID);
verify(ccmUpgradeService, never()).removeAutoSsh(STACK_ID);
}
use of com.sequenceiq.flow.repository.FlowLogRepository in project cloudbreak by hortonworks.
the class CcmUpgradeFlowIntegrationTest method testCcmUpgradeWhenPrepFail.
@Test
public void testCcmUpgradeWhenPrepFail() {
doThrow(new BadRequestException()).when(ccmUpgradeService).prepare(STACK_ID);
FlowIdentifier flowIdentifier = triggerFlow();
letItFlow(flowIdentifier);
ArgumentCaptor<FlowLog> flowLog = ArgumentCaptor.forClass(FlowLog.class);
verify(flowLogRepository, times(2)).save(flowLog.capture());
Assertions.assertTrue(flowLog.getAllValues().stream().anyMatch(f -> f.getFinalized()), "flow has not finalized");
verify(ccmUpgradeService, times(1)).prepare(STACK_ID);
verify(ccmUpgradeService, times(1)).ccmUpgradePreparationFailed(STACK_ID);
verify(ccmUpgradeService, never()).ccmUpgradeFailed(STACK_ID);
verify(ccmUpgradeService, never()).reregister(STACK_ID);
verify(ccmUpgradeService, never()).unregister(STACK_ID);
verify(ccmUpgradeService, never()).removeAutoSsh(STACK_ID);
}
use of com.sequenceiq.flow.repository.FlowLogRepository in project cloudbreak by hortonworks.
the class CcmUpgradeFlowIntegrationTest method testCcmUpgradeWhenSuccessful.
@Test
public void testCcmUpgradeWhenSuccessful() {
FlowIdentifier flowIdentifier = triggerFlow();
letItFlow(flowIdentifier);
ArgumentCaptor<FlowLog> flowLog = ArgumentCaptor.forClass(FlowLog.class);
verify(flowLogRepository, times(2)).save(flowLog.capture());
Assertions.assertTrue(flowLog.getAllValues().stream().anyMatch(f -> f.getFinalized()), "flow has not finalized");
verify(ccmUpgradeService, times(1)).reregister(STACK_ID);
verify(ccmUpgradeService, times(1)).unregister(STACK_ID);
verify(ccmUpgradeService, times(1)).prepare(STACK_ID);
verify(ccmUpgradeService, times(1)).removeAutoSsh(STACK_ID);
verify(ccmUpgradeService, never()).ccmUpgradeFailed(STACK_ID);
}
Aggregations