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