Search in sources :

Example 16 with FlowCheckResponse

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);
}
Also used : FlowCheckResponse(com.sequenceiq.flow.api.model.FlowCheckResponse) Test(org.junit.Test)

Example 17 with FlowCheckResponse

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());
}
Also used : FlowCheckResponse(com.sequenceiq.flow.api.model.FlowCheckResponse) Test(org.junit.Test)

Example 18 with FlowCheckResponse

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());
}
Also used : FlowCheckResponse(com.sequenceiq.flow.api.model.FlowCheckResponse) Test(org.junit.Test)

Example 19 with FlowCheckResponse

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());
}
Also used : FlowCheckResponse(com.sequenceiq.flow.api.model.FlowCheckResponse) Test(org.junit.Test)

Example 20 with FlowCheckResponse

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);
}
Also used : FlowCheckResponse(com.sequenceiq.flow.api.model.FlowCheckResponse) Test(org.junit.Test)

Aggregations

FlowCheckResponse (com.sequenceiq.flow.api.model.FlowCheckResponse)23 Test (org.junit.Test)10 FlowLog (com.sequenceiq.flow.domain.FlowLog)3 FlowChainLog (com.sequenceiq.flow.domain.FlowChainLog)2 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)1 FlowPublicEndpoint (com.sequenceiq.flow.api.FlowPublicEndpoint)1 TestFailException (com.sequenceiq.it.cloudbreak.exception.TestFailException)1 NotFoundException (javax.ws.rs.NotFoundException)1 Test (org.junit.jupiter.api.Test)1