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());
}
Aggregations