use of com.sequenceiq.flow.domain.FlowLog in project cloudbreak by hortonworks.
the class FlowLogDBServiceTest method runUpdateLastFlowLogStatusTest.
private void runUpdateLastFlowLogStatusTest(boolean failureEvent, StateStatus successful) {
FlowLog flowLog = new FlowLog();
flowLog.setId(ID);
underTest.updateLastFlowLogStatus(flowLog, failureEvent);
verify(flowLogRepository, times(1)).updateLastLogStatusInFlow(ID, successful);
}
use of com.sequenceiq.flow.domain.FlowLog in project cloudbreak by hortonworks.
the class FlowProgressResponseConverterTest method setDefaults.
private void setDefaults(String flowId, FlowLog... flowLogs) {
for (FlowLog fl : flowLogs) {
fl.setFlowId(flowId);
fl.setFinalized(true);
fl.setFlowType(ClassValue.of(TestFlowConfig.class));
fl.setStateStatus(StateStatus.SUCCESSFUL);
}
}
use of com.sequenceiq.flow.domain.FlowLog in project cloudbreak by hortonworks.
the class FlowProgressResponseConverterTest method createFlowLogs.
private List<FlowLog> createFlowLogs(boolean multipleFlowIds) {
List<FlowLog> flowLogs = new ArrayList<>();
FlowLog flowLog1 = new FlowLog();
flowLog1.setCreated(2L);
flowLog1.setCurrentState("FINISHED");
FlowLog flowLog2 = new FlowLog();
flowLog2.setCreated(1L);
flowLog2.setCurrentState("INIT_STATE");
setDefaults("flow1", flowLog1, flowLog2);
flowLogs.add(flowLog1);
flowLogs.add(flowLog2);
if (multipleFlowIds) {
FlowLog flowLog3 = new FlowLog();
flowLog3.setCreated(5L);
flowLog3.setCurrentState("CANCELLED");
FlowLog flowLog4 = new FlowLog();
flowLog4.setCreated(3L);
flowLog4.setCurrentState("INIT_STATE");
flowLogs.add(flowLog3);
flowLogs.add(flowLog4);
setDefaults("flow2", flowLog3, flowLog4);
}
return flowLogs;
}
use of com.sequenceiq.flow.domain.FlowLog in project cloudbreak by hortonworks.
the class UpgradeCcmFlowIntegrationTest method testCcmUpgradeWhenRegisterClusterProxyFail.
@Test
public void testCcmUpgradeWhenRegisterClusterProxyFail() throws CloudbreakOrchestratorException {
doThrow(new BadRequestException()).when(upgradeCcmService).registerClusterProxy(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(FlowLog::getFinalized), "flow has not finalized");
InOrder inOrder = Mockito.inOrder(upgradeCcmService);
inOrder.verify(upgradeCcmService, times(1)).updateTunnel(STACK_ID);
inOrder.verify(upgradeCcmService, times(1)).pushSaltState(STACK_ID, CLUSTER_ID);
inOrder.verify(upgradeCcmService, times(1)).reconfigureNginx(STACK_ID);
inOrder.verify(upgradeCcmService, times(1)).registerClusterProxy(STACK_ID);
inOrder.verify(upgradeCcmService, times(1)).ccmUpgradeFailed(STACK_ID, CLUSTER_ID, Tunnel.CCM);
verify(upgradeCcmService, never()).healthCheckState(STACK_ID);
verify(upgradeCcmService, never()).deregisterAgent(STACK_ID, Tunnel.CCM);
verify(upgradeCcmService, never()).removeAgent(STACK_ID, Tunnel.CCM);
}
use of com.sequenceiq.flow.domain.FlowLog in project cloudbreak by hortonworks.
the class UpgradeCcmFlowIntegrationTest method testCcmUpgradeWhenSuccessful.
@Test
public void testCcmUpgradeWhenSuccessful() throws CloudbreakOrchestratorException {
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(FlowLog::getFinalized), "flow has not finalized");
InOrder inOrder = Mockito.inOrder(upgradeCcmService);
inOrder.verify(upgradeCcmService, times(1)).updateTunnel(STACK_ID);
inOrder.verify(upgradeCcmService, times(1)).pushSaltState(STACK_ID, CLUSTER_ID);
inOrder.verify(upgradeCcmService, times(1)).reconfigureNginx(STACK_ID);
inOrder.verify(upgradeCcmService, times(1)).registerClusterProxy(STACK_ID);
inOrder.verify(upgradeCcmService, times(1)).healthCheck(STACK_ID);
inOrder.verify(upgradeCcmService, times(1)).removeAgent(STACK_ID, Tunnel.CCM);
inOrder.verify(upgradeCcmService, times(1)).deregisterAgent(STACK_ID, Tunnel.CCM);
verify(upgradeCcmService, never()).ccmUpgradeFailed(STACK_ID, CLUSTER_ID, Tunnel.CCM);
}
Aggregations