use of com.sequenceiq.flow.api.model.FlowCheckResponse in project cloudbreak by hortonworks.
the class FlowServiceTest method testWhenFlowChainNotFound.
@Test
public void testWhenFlowChainNotFound() {
when(flowChainLogService.findByFlowChainIdOrderByCreatedDesc(anyString())).thenReturn(List.of());
FlowCheckResponse flowCheckResponse = underTest.getFlowChainState(FLOW_CHAIN_ID);
assertFalse(flowCheckResponse.getHasActiveFlow());
assertEquals(FLOW_CHAIN_ID, flowCheckResponse.getFlowChainId());
verify(flowChainLogService).findByFlowChainIdOrderByCreatedDesc(anyString());
verifyZeroInteractions(flowLogDBService);
}
use of com.sequenceiq.flow.api.model.FlowCheckResponse in project cloudbreak by hortonworks.
the class FlowServiceTest method testCompletedFlowChain.
@Test
public void testCompletedFlowChain() {
setUpFlowChain(flowChainLog(), false, List.of(flowLog(FlowConstants.FINISHED_STATE, NO_NEXT_EVENT, 3), flowLog(INTERMEDIATE_STATE, NEXT_EVENT, 2), flowLog(FlowConstants.INIT_STATE, NEXT_EVENT, 1)));
FlowCheckResponse flowCheckResponse = underTest.getFlowChainState(FLOW_CHAIN_ID);
assertFalse(flowCheckResponse.getHasActiveFlow());
assertEquals(FLOW_CHAIN_ID, flowCheckResponse.getFlowChainId());
}
use of com.sequenceiq.flow.api.model.FlowCheckResponse in project cloudbreak by hortonworks.
the class FlowServiceTest method testCompletedAfterTwoRetryFlowChain.
@Test
public void testCompletedAfterTwoRetryFlowChain() {
setUpFlowChain(flowChainLog(), false, List.of(flowLog(FlowConstants.FINISHED_STATE, NO_NEXT_EVENT, 8), flowLog(INTERMEDIATE_STATE, NEXT_EVENT, 7), flowLog(FlowConstants.FINISHED_STATE, NO_NEXT_EVENT, 6), flowLog(INTERMEDIATE_STATE, FAIL_HANDLED_NEXT_EVENT, 5), flowLog(INTERMEDIATE_STATE, NEXT_EVENT, 4), flowLog(FlowConstants.FINISHED_STATE, NO_NEXT_EVENT, 3), flowLog(INTERMEDIATE_STATE, FAIL_HANDLED_NEXT_EVENT, 2), flowLog(FlowConstants.INIT_STATE, NEXT_EVENT, 1)));
FlowCheckResponse flowCheckResponse = underTest.getFlowChainState(FLOW_CHAIN_ID);
assertFalse(flowCheckResponse.getHasActiveFlow());
assertEquals(FLOW_CHAIN_ID, flowCheckResponse.getFlowChainId());
}
use of com.sequenceiq.flow.api.model.FlowCheckResponse in project cloudbreak by hortonworks.
the class FlowServiceTest method testFailedAndRestartedFlowChain.
@Test
public void testFailedAndRestartedFlowChain() {
setUpFlowChain(flowChainLog(), false, List.of(flowLog(INTERMEDIATE_STATE, NEXT_EVENT, 4), flowLog(FlowConstants.FINISHED_STATE, NO_NEXT_EVENT, 3), flowLog(INTERMEDIATE_STATE, FAIL_HANDLED_NEXT_EVENT, 2), flowLog(FlowConstants.INIT_STATE, NEXT_EVENT, 1)));
FlowCheckResponse flowCheckResponse = underTest.getFlowChainState(FLOW_CHAIN_ID);
assertTrue(flowCheckResponse.getHasActiveFlow());
assertEquals(FLOW_CHAIN_ID, flowCheckResponse.getFlowChainId());
}
use of com.sequenceiq.flow.api.model.FlowCheckResponse in project cloudbreak by hortonworks.
the class FlowServiceTest method testHasFlowRunningByFlowId.
@Test
public void testHasFlowRunningByFlowId() {
setUpFlow(FLOW_ID, List.of(pendingFlowLog(INTERMEDIATE_STATE, NEXT_EVENT, 2), flowLog(FlowConstants.INIT_STATE, NEXT_EVENT, 1)));
FlowCheckResponse flowCheckResponse = underTest.getFlowState(FLOW_ID);
assertTrue(flowCheckResponse.getHasActiveFlow());
assertNotNull(flowCheckResponse.getFlowId());
verify(flowLogDBService).findAllByFlowIdOrderByCreatedDesc(anyString());
verifyZeroInteractions(flowChainLogService);
}
Aggregations