Search in sources :

Example 1 with ProvisionFlowEventChainFactory

use of com.sequenceiq.freeipa.flow.chain.ProvisionFlowEventChainFactory in project cloudbreak by hortonworks.

the class FlowOperationServiceTest method testGetOperationProgressByResourceCrn.

@Test
public void testGetOperationProgressByResourceCrn() {
    // 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.FREEIPA, EXPECTED_TYPE_LIST)).willReturn(new OperationView());
    // WHEN
    underTest.getOperationProgressByEnvironmentCrn(TEST_ENV_CRN, false);
    // THEN
    verify(operationDetailsPopulator, times(1)).createOperationView(operationFlowsView, OperationResource.FREEIPA, EXPECTED_TYPE_LIST);
    // Checks that the number of provision flows are the same as in the operation check
    assertEquals(EXPECTED_TYPE_LIST.size(), eventQueue.getQueue().size());
}
Also used : FlowTriggerEventQueue(com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue) StackEvent(com.sequenceiq.freeipa.flow.stack.StackEvent) ProvisionFlowEventChainFactory(com.sequenceiq.freeipa.flow.chain.ProvisionFlowEventChainFactory) OperationView(com.sequenceiq.flow.api.model.operation.OperationView) Test(org.junit.jupiter.api.Test)

Aggregations

OperationView (com.sequenceiq.flow.api.model.operation.OperationView)1 FlowTriggerEventQueue (com.sequenceiq.flow.core.chain.config.FlowTriggerEventQueue)1 ProvisionFlowEventChainFactory (com.sequenceiq.freeipa.flow.chain.ProvisionFlowEventChainFactory)1 StackEvent (com.sequenceiq.freeipa.flow.stack.StackEvent)1 Test (org.junit.jupiter.api.Test)1