Search in sources :

Example 1 with ProvisionFlowEventChainFactory

use of com.sequenceiq.cloudbreak.core.flow2.chain.ProvisionFlowEventChainFactory in project cloudbreak by hortonworks.

the class OperationServiceTest method testGetOperationProgressByResourceCrnWithDatalake.

@Test
public void testGetOperationProgressByResourceCrnWithDatalake() {
    // GIVEN
    ProvisionFlowEventChainFactory provisionFlowEventChainFactory = new ProvisionFlowEventChainFactory();
    FlowTriggerEventQueue eventQueue = provisionFlowEventChainFactory.createFlowTriggerEventQueue(new StackEvent(null, null));
    given(flowService.getLastFlowOperationByResourceCrn(anyString())).willReturn(Optional.of(operationFlowsView));
    given(operationFlowsView.getOperationType()).willReturn(OperationType.PROVISION);
    given(operationDetailsPopulator.createOperationView(operationFlowsView, OperationResource.DATALAKE, EXPECTED_TYPE_LIST)).willReturn(operationView);
    // WHEN
    OperationView result = underTest.getOperationProgressByResourceCrn(TEST_DATALAKE_CRN, true);
    // THEN
    assertEquals(operationView, result);
    verify(operationDetailsPopulator, times(1)).createOperationView(operationFlowsView, OperationResource.DATALAKE, EXPECTED_TYPE_LIST);
    // Checks that the number of provision flows are the same as in the operation check
    assertEquals(eventQueue.getQueue().size(), EXPECTED_TYPE_LIST.size());
}
Also used : FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) ProvisionFlowEventChainFactory(com.sequenceiq.cloudbreak.core.flow2.chain.ProvisionFlowEventChainFactory) OperationView(com.sequenceiq.flow.api.model.operation.OperationView) Test(org.junit.jupiter.api.Test)

Aggregations

ProvisionFlowEventChainFactory (com.sequenceiq.cloudbreak.core.flow2.chain.ProvisionFlowEventChainFactory)1 StackEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackEvent)1 OperationView (com.sequenceiq.flow.api.model.operation.OperationView)1 FlowTriggerEventQueue (com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue)1 Test (org.junit.jupiter.api.Test)1