Search in sources :

Example 31 with DelegateExecutionFake

use of org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake in project so by onap.

the class MultiStageSkipListenerTest method testProcessMultiStageSkip.

@Test
public void testProcessMultiStageSkip() {
    String vfModuleId = "vfModuleId";
    String vnfId = "vnfId";
    List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
    WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
    workflowResourceIds.setServiceInstanceId("serviceInstanceId");
    workflowResourceIds.setVnfId(vnfId);
    BuildingBlock bb = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
    ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setResourceId(vfModuleId).setBuildingBlock(bb).setWorkflowResourceIds(workflowResourceIds);
    flowsToExecute.add(ebb);
    flowsToExecute.add(new ExecuteBuildingBlock());
    flowsToExecute.add(new ExecuteBuildingBlock());
    BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake());
    org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule();
    vfModule.setVfModuleId(vfModuleId);
    org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
    vnf.setModelCustomizationId("modelCustomizationUUID");
    VnfResourceCustomization vnfCust = new VnfResourceCustomization();
    vnfCust.setModelCustomizationUUID("modelCustomizationUUID");
    vnfCust.setMultiStageDesign("true");
    when(catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(vnf.getModelCustomizationId())).thenReturn(vnfCust);
    when(bbInputSetupUtils.getAAIVfModule(eq(vnfId), eq(vfModuleId))).thenReturn(null);
    when(bbInputSetupUtils.getAAIGenericVnf(eq(vnfId))).thenReturn(vnf);
    multiStageSkipListener.run(flowsToExecute, flowsToExecute.get(0), execution);
    assertEquals("Flows should only have Assign", flowsToExecute.size(), 1);
    assertEquals("Flows should only have Assign", flowsToExecute.get(0).getBuildingBlock().getBpmnFlowName(), "AssignVfModuleBB");
}
Also used : BuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) ArrayList(java.util.ArrayList) DelegateExecutionFake(org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake) WorkflowResourceIds(org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) BuildingBlockExecution(org.onap.so.bpmn.common.BuildingBlockExecution) DelegateExecutionImpl(org.onap.so.bpmn.common.DelegateExecutionImpl) VnfResourceCustomization(org.onap.so.db.catalog.beans.VnfResourceCustomization) Test(org.junit.Test)

Example 32 with DelegateExecutionFake

use of org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake in project so by onap.

the class MultiStageSkipListenerTest method postCompletionRequestsDbListenerTest.

@Test
public void postCompletionRequestsDbListenerTest() {
    InfraActiveRequests request = new InfraActiveRequests();
    BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake());
    multiStageSkipListener.run(request, execution);
    assertEquals("Successfully completed Assign Building Block only due to multi-stage-design VNF", request.getFlowStatus());
}
Also used : BuildingBlockExecution(org.onap.so.bpmn.common.BuildingBlockExecution) DelegateExecutionImpl(org.onap.so.bpmn.common.DelegateExecutionImpl) DelegateExecutionFake(org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake) InfraActiveRequests(org.onap.so.db.request.beans.InfraActiveRequests) Test(org.junit.Test)

Example 33 with DelegateExecutionFake

use of org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake in project so by onap.

the class WorkflowActionBBTasksUpdateReqDbTest method before.

@Before
public void before() throws Exception {
    execution = new DelegateExecutionFake();
    org.onap.aai.domain.yang.ServiceInstance servInstance = new org.onap.aai.domain.yang.ServiceInstance();
    servInstance.setServiceInstanceId("TEST");
    when(bbSetupUtils.getAAIServiceInstanceByName(anyString(), any())).thenReturn(servInstance);
    workflowAction.setBbInputSetupUtils(bbSetupUtils);
    workflowAction.setBbInputSetup(bbInputSetup);
}
Also used : DelegateExecutionFake(org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake) Before(org.junit.Before)

Example 34 with DelegateExecutionFake

use of org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake in project so by onap.

the class WorkflowActionBBTasksTest method before.

@Before
public void before() throws Exception {
    execution = new DelegateExecutionFake();
    ServiceInstance servInstance = new ServiceInstance();
    servInstance.setServiceInstanceId("TEST");
    when(bbSetupUtils.getAAIServiceInstanceByName(anyString(), anyObject())).thenReturn(servInstance);
    workflowAction.setBbInputSetupUtils(bbSetupUtils);
    workflowAction.setBbInputSetup(bbInputSetup);
}
Also used : ServiceInstance(org.onap.aai.domain.yang.ServiceInstance) DelegateExecutionFake(org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake) Before(org.junit.Before)

Example 35 with DelegateExecutionFake

use of org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake in project so by onap.

the class PnfCDSRequestProviderTest method prepareDelegateExecutionObj.

private DelegateExecution prepareDelegateExecutionObj(String scope, String action) {
    DelegateExecution execution = new DelegateExecutionFake();
    execution.setVariable(PROCESS_KEY, TEST_PROCESS_KEY);
    execution.setVariable(PNF_CORRELATION_ID, TEST_PNF_CORRELATION_ID);
    execution.setVariable(MODEL_UUID, TEST_MODEL_UUID);
    execution.setVariable(SERVICE_INSTANCE_ID, TEST_SERVICE_INSTANCE_ID);
    execution.setVariable(MSO_REQUEST_ID, TEST_MSO_REQUEST_ID);
    execution.setVariable(PNF_UUID, TEST_PNF_UUID);
    execution.setVariable(PRC_INSTANCE_NAME, TEST_PNF_RESOURCE_INSTANCE_NAME);
    execution.setVariable(PRC_CUSTOMIZATION_UUID, TEST_PNF_RESOURCE_CUSTOMIZATION_UUID);
    execution.setVariable(PRC_TARGET_SOFTWARE_VERSION, TEST_SOFTWARE_VERSION);
    execution.setVariable(SCOPE, scope);
    execution.setVariable(ACTION, action);
    execution.setVariable(PRC_BLUEPRINT_NAME, TEST_PNF_RESOURCE_BLUEPRINT_NAME);
    execution.setVariable(PRC_BLUEPRINT_VERSION, TEST_PNF_RESOURCE_BLUEPRINT_VERSION);
    return execution;
}
Also used : DelegateExecution(org.camunda.bpm.engine.delegate.DelegateExecution) DelegateExecutionFake(org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake)

Aggregations

DelegateExecutionFake (org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake)35 DelegateExecutionImpl (org.onap.so.bpmn.common.DelegateExecutionImpl)17 Before (org.junit.Before)15 DelegateExecution (org.camunda.bpm.engine.delegate.DelegateExecution)12 Test (org.junit.Test)11 BuildingBlockExecution (org.onap.so.bpmn.common.BuildingBlockExecution)7 WorkflowException (org.onap.so.bpmn.core.WorkflowException)3 BpmnError (org.camunda.bpm.engine.delegate.BpmnError)2 ServiceInstance (org.onap.aai.domain.yang.ServiceInstance)2 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)2 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)2 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)2 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)2 BBInputSetup (org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup)2 BBInputSetupUtils (org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils)2 CatalogDbClient (org.onap.so.db.catalog.client.CatalogDbClient)2 Serializable (java.io.Serializable)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)1