Prod fixes August 18th 75/61875/1
authorBenjamin, Max (mb388a) <mb388a@us.att.com>
Wed, 22 Aug 2018 16:10:23 +0000 (12:10 -0400)
committerBenjamin, Max (mb388a) <mb388a@us.att.com>
Wed, 22 Aug 2018 16:10:59 +0000 (12:10 -0400)
fixed compilation issues and all unit tests now pass
fix condition that checks for vnf in list to set homing flags
fix resource name variable being null
Skip volume group search for alacarte VF Module creation, since that group is expected to be specified on the input
Remove temporary change to JUnit for creation of volume group.
Add mapping of isBaseVfModule setting to AAIObjectMapper for vfModule.
adding a unit test for hte issue which was fixed
Explicitly return heatStackId variable from VnfAdapter subprocess
Fixing an issue with the workflow processor/asynresource which may lead to
apihandler leaving the active_Request table record in_progress while the bpmn quits the processing due to the error.

Change-Id: I7587193fcb5251f50370d72a1e4c10d112a1c72f
Issue-ID: SO-879
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
18 files changed:
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java [new file with mode: 0644]
bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterface.json [deleted file]
bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterfaces.json [deleted file]
bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java [new file with mode: 0644]
bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn
bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn
bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleBaseMap.json [new file with mode: 0644]

index b5203c6..67fb6a6 100644 (file)
@@ -346,13 +346,15 @@ public class BBInputSetup implements JavaDelegate {
                                ModelInfo vnfModelInfo = new ModelInfo();
                                vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
                                this.mapCatalogVnf(tempVnf, vnfModelInfo, service);
-                               for(VolumeGroup volumeGroup : tempVnf.getVolumeGroups()) {
-                                       String volumeGroupCustId = 
-                                                       this.bbInputSetupUtils.getAAIVolumeGroup(CLOUD_OWNER, 
-                                                                       cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()).getModelCustomizationId();
-                                       if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) {
-                                               lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId());
-                                               break;
+                               if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) == null) {
+                                       for(VolumeGroup volumeGroup : tempVnf.getVolumeGroups()) {
+                                               String volumeGroupCustId = 
+                                                               this.bbInputSetupUtils.getAAIVolumeGroup(CLOUD_OWNER, 
+                                                                               cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()).getModelCustomizationId();
+                                               if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) {
+                                                       lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId());
+                                                       break;
+                                               }
                                        }
                                }
                                break;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java
new file mode 100644 (file)
index 0000000..768bee5
--- /dev/null
@@ -0,0 +1,19 @@
+package org.openecomp.mso.bpmn.common.workflow.service;
+
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
+
+/**
+ * Exception thrown when an error occurs while processing the workflow.
+ * This encapsulates the workflow response so that the same can be sent back to api handler.
+ */
+public class WorkflowProcessorException extends RuntimeException {
+    WorkflowResponse workflowResponse;
+
+    public WorkflowProcessorException(WorkflowResponse workflowResponse) {
+        this.workflowResponse = workflowResponse;
+    }
+
+    public WorkflowResponse getWorkflowResponse() {
+        return workflowResponse;
+    }
+}
diff --git a/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterface.json b/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterface.json
deleted file mode 100644 (file)
index b8c123e..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-{
-       "interface-name": "Xe-7/1/10",
-       "port-description": "VVIG EGRESS",
-       "resource-version": "1494002035673",
-       "relationship-list": {
-               "relationship": [
-                       {
-                               "related-to": "physical-link",
-                               "related-link": "/aai/v11/network/physical-links/physical-link/testPhysicalLinkUcpe",
-                               "relationship-data": [
-                                       {
-                                               "relationship-key": "physical-link.link-name",
-                                               "relationship-value": "L4YS.999964..ATI_EGRESS"
-                                       }
-                               ]
-                       }
-               ]
-       }
-}
diff --git a/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterfaces.json b/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterfaces.json
deleted file mode 100644 (file)
index 9ea3869..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-{
-       "p-interface": [
-               {
-                       "interface-name": "Xe-7/1/10",
-                       "port-description": "VVIG EGRESS",
-                       "resource-version": "1494002035673",
-                       "relationship-list": {
-                               "relationship": [
-                                       {
-                                               "related-to": "physical-link",
-                                               "related-link": "/aai/v11/network/physical-links/physical-link/testPhysicalLinkUcpe",
-                                               "relationship-data": [
-                                                       {
-                                                               "relationship-key": "physical-link.link-name",
-                                                               "relationship-value": "L4YS.999964..ATI_EGRESS"
-                                                       }
-                                               ]
-                                       }
-                               ]
-                       }
-               },
-               {
-                       "interface-name": "Xe-8/2/11",
-                       "port-description": "VVIG EGRESS",
-                       "resource-version": "1494002035673",
-                       "relationship-list": {
-                               "relationship": [
-                                       {
-                                               "related-to": "physical-link",
-                                               "related-link": "/aai/v11/network/physical-links/physical-link/testPhysicalLinkUcpe2",
-                                               "relationship-data": [
-                                                       {
-                                                               "relationship-key": "physical-link.link-name",
-                                                               "relationship-value": "L4YS.999964..ATI_EGRESS"
-                                                       }
-                                               ]
-                                       }
-                               ]
-                       }
-               }
-       ]
-}
\ No newline at end of file
index cfd07d8..ef72149 100644 (file)
@@ -40,6 +40,7 @@ import org.onap.so.bpmn.common.workflow.context.WorkflowContext;
 import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
 import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
 import org.onap.so.logger.MsoLogger;
+import org.openecomp.mso.bpmn.common.workflow.service.WorkflowProcessorException;
 import org.slf4j.MDC;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -92,7 +93,6 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
        
        /**
         * Asynchronous JAX-RS method that starts a process instance.
-        * @param asyncResponse an object that will receive the asynchronous response
         * @param processKey the process key
         * @param variableMap input variables to the process
         * @return 
@@ -114,7 +114,10 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
                        processor.startProcess(processKey, variableMap);
                        WorkflowResponse response = waitForResponse(getRequestId(inputVariables)); 
                        return Response.status(202).entity(response).build();   
-               } catch (Exception e) {
+               } catch (WorkflowProcessorException e) {
+                       WorkflowResponse response =  e.getWorkflowResponse();
+                       return Response.status(500).entity(response).build();
+               }catch (Exception e) {
                        WorkflowResponse response =  buildUnkownError(getRequestId(inputVariables),e.getMessage());             
                        return Response.status(500).entity(response).build();   
                }               
index edc05af..da24ba1 100644 (file)
@@ -28,11 +28,10 @@ import java.util.UUID;
 import org.camunda.bpm.engine.RuntimeService;
 import org.camunda.bpm.engine.runtime.ProcessInstance;
 import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
-import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse;
-import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
 import org.onap.so.logger.MsoLogger;
+import org.openecomp.mso.bpmn.common.workflow.service.WorkflowProcessorException;
 import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
@@ -79,13 +78,12 @@ public class WorkflowProcessor extends ProcessEngineAwareService {
                        msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
                                        logMarker + "Error in starting the process: " + e.getMessage());
 
-                       WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
-                       callbackResponse.setStatusCode(500);
-                       callbackResponse.setMessage("Fail");
-                       callbackResponse.setResponse("Error occurred while executing the process: " + e);
-
-                       WorkflowContextHolder.getInstance().processCallback(processKey, processInstanceId,
-                                       getRequestId(inputVariables), callbackResponse);
+                       WorkflowResponse workflowResponse = new WorkflowResponse();
+                       workflowResponse.setResponse("Error occurred while executing the process: " + e);
+                       workflowResponse.setProcessInstanceID(processInstanceId);
+                       workflowResponse.setMessageCode(500);
+                       workflowResponse.setMessage("Fail");
+                       throw new WorkflowProcessorException(workflowResponse);
                }
        }
        
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java
new file mode 100644 (file)
index 0000000..ff5e18c
--- /dev/null
@@ -0,0 +1,78 @@
+/*- 
+ * ============LICENSE_START======================================================= 
+ * ONAP - SO 
+ * ================================================================================ 
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================ 
+ * Licensed under the Apache License, Version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at 
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License. 
+ * ============LICENSE_END========================================================= 
+ */ 
+
+package org.onap.so.bpmn.common.workflow.service;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.ws.rs.core.Response;
+
+import org.camunda.bpm.engine.test.Deployment;
+import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
+import org.junit.Test;
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
+
+
+public class WorkflowAsyncResourceExceptionHandlingTest {
+
+       @Test
+       @Deployment(resources = { "testAsyncResource.bpmn" })
+       public void asyncRequestSuccess() throws InterruptedException {
+               VariableMapImpl variableMap = new VariableMapImpl();
+
+               Map<String, Object> variableValueType = new HashMap<>();
+
+               Map<String, Object> requestMsg = new HashMap<>();
+               requestMsg.put("value", "");
+               requestMsg.put("type", "String");
+
+               Map<String, Object> msorequestId = new HashMap<>();
+               msorequestId.put("type", "String");
+               msorequestId.put("value",UUID.randomUUID().toString());
+
+               Map<String, Object> timeout = new HashMap<>();
+               timeout.put("type", "String");
+               timeout.put("value","5");
+
+               variableValueType.put("testAsyncRequestMsg", requestMsg);
+               variableValueType.put("mso-request-id", msorequestId);
+               variableValueType.put("mso-service-request-timeout", timeout);
+
+               variableMap.put("variables", variableValueType);
+               WorkflowAsyncResource workflowAsyncResource = new WorkflowAsyncResource();
+               workflowAsyncResource.setProcessor(new WorkflowProcessor());
+               Response res = workflowAsyncResource.startProcessInstanceByKey("randomKey", variableMap);
+               assertEquals(500,res.getStatus());
+               WorkflowResponse workflowResponse = (WorkflowResponse)res.getEntity();
+               assertNotNull(workflowResponse);
+               assertEquals(500, workflowResponse.getMessageCode());
+               assertTrue(workflowResponse.getResponse().startsWith("Error occurred while executing the process:"));
+               assertEquals("Fail", workflowResponse.getMessage());
+
+
+       }
+
+}
index abc017c..bd24eea 100644 (file)
@@ -29,7 +29,7 @@
         <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
         <camunda:out source="WorkflowException" target="WorkflowException" />
         <camunda:in source="VNFREST_Request" target="VNFREST_Request" />
-        <camunda:out source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
+        <camunda:out source="heatStackId" target="heatStackId" />
       </bpmn:extensionElements>
       <bpmn:incoming>SequenceFlow_16g4dz0</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0ecr393</bpmn:outgoing>
index a95dc9c..ffe74d1 100644 (file)
@@ -28,7 +28,7 @@
         <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
         <camunda:out source="WorkflowException" target="WorkflowException" />
         <camunda:in source="VNFREST_Request" target="VNFREST_Request" />
-        <camunda:out source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
+        <camunda:out source="heatStackId" target="heatStackId" />
       </bpmn:extensionElements>
       <bpmn:incoming>SequenceFlow_0kfkpbh</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_06flg6h</bpmn:outgoing>
index 07d0b18..832a96c 100644 (file)
@@ -24,7 +24,7 @@
         <camunda:out source="WorkflowException" target="WorkflowException" />
         <camunda:in source="deleteVfModuleRequest" target="deleteVfModuleRequest" />
         <camunda:in source="VNFREST_Request" target="VNFREST_Request" />
-        <camunda:out source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
+        <camunda:out source="heatStackId" target="heatStackId" />
       </bpmn:extensionElements>
       <bpmn:incoming>SequenceFlow_08tvhtf</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_02lpx87</bpmn:outgoing>
index 9c1fba6..b059a77 100644 (file)
@@ -144,9 +144,11 @@ public class AAIUpdateTasks {
        public void updateHeatStackIdVolumeGroup(BuildingBlockExecution execution) {
                try {
                        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+                       String heatStackId = execution.getVariable("heatStackId");
                        
                        VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
                        CloudRegion cloudRegion = gBBInput.getCloudRegion();
+                       volumeGroup.setHeatStackId(heatStackId);
                        
                        aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
                } catch (Exception ex) {
@@ -296,8 +298,10 @@ public class AAIUpdateTasks {
        
        public void updateHeatStackIdVfModule(BuildingBlockExecution execution) {               
                try {
+                       String heatStackId = execution.getVariable("heatStackId");
                        VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
                        GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+                       vfModule.setHeatStackId(heatStackId);
                        aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf);                  
                } catch (Exception ex) {
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
index 0b71245..554af37 100644 (file)
@@ -65,6 +65,7 @@ public class VnfAdapterImpl {
                        execution.setVariable("isDebugLogEnabled", "true");
                        execution.setVariable("mso-request-id", gBBInput.getRequestContext().getMsoRequestId());
                        execution.setVariable("mso-service-instance-id", serviceInstance.getServiceInstanceId());
+                       execution.setVariable("heatStackId", null);
                } catch (Exception ex) {
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
                }
@@ -80,23 +81,25 @@ public class VnfAdapterImpl {
                     String heatStackId = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleStackId();
                     if(!StringUtils.isEmpty(heatStackId)) {
                         vfModule.setHeatStackId(heatStackId);
+                        execution.setVariable("heatStackId", heatStackId);
                     }
                 } else if(vnfRestResponse instanceof DeleteVfModuleResponse) {
                     VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
                     Boolean vfModuleDelete = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleDeleted();
                     if(null!= vfModuleDelete && vfModuleDelete) {
                         vfModule.setHeatStackId(null);
+                        execution.setVariable("heatStackId", null);
                     }
                 } else if(vnfRestResponse instanceof CreateVolumeGroupResponse) {
                     VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
                     String heatStackId = ((CreateVolumeGroupResponse) vnfRestResponse).getVolumeGroupStackId();
                     if(!StringUtils.isEmpty(heatStackId)) {
                         volumeGroup.setHeatStackId(heatStackId);
+                        execution.setVariable("heatStackId", heatStackId);
                     }else{
                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "HeatStackId is missing from create VolumeGroup Vnf Adapter response.");
                     }
-                }
-                execution.setVariable("generalBuildingBlock", execution.getGeneralBuildingBlock());
+                }                
             }
                } catch (Exception ex) {
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
index c6a63e1..00c85df 100644 (file)
@@ -136,6 +136,7 @@ public class WorkflowAction {
                        RequestDetails requestDetails = sIRequest.getRequestDetails();
                        Resource resource = extractResourceIdAndTypeFromUri(uri);
                        WorkflowType resourceType = resource.getResourceType();
+                       execution.setVariable("resourceName", resourceType.toString());
                        String resourceId = "";
                        if (resource.isGenerated()) {
                                resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType,
@@ -240,7 +241,7 @@ public class WorkflowAction {
                                }
                                if (resourceType == WorkflowType.SERVICE
                                                && (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE))
-                                               && !resourceCounter.stream().filter(x -> VNF.equals(x.getResourceType())).collect(Collectors.toList()).isEmpty()) {
+                                               && !resourceCounter.stream().filter(x -> WorkflowType.VNF.equals(x.getResourceType())).collect(Collectors.toList()).isEmpty()) {
                                        execution.setVariable("homing", true);
                                        execution.setVariable("calledHoming", false);
                                }
index 94dfdcc..8661c8e 100644 (file)
@@ -96,6 +96,7 @@ public class AAIObjectMapper {
                                        map().setModelInvariantId(source.getModelInfoVfModule().getModelInvariantUUID());
                                        map().setModelVersionId(source.getModelInfoVfModule().getModelUUID());
                                        map().setPersonaModelVersion(source.getModelInfoVfModule().getModelInvariantUUID());
+                                       map().setIsBaseVfModule(source.getModelInfoVfModule().getIsBaseBoolean());
 
                                }
                        });
index c9433a6..b457529 100644 (file)
@@ -204,11 +204,13 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
        
        @Test
        public void updateHeatStackIdVfModuleTest() throws Exception {
+               execution.setVariable("heatStackId", "newHeatStackId");
                doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf);
 
                aaiUpdateTasks.updateHeatStackIdVfModule(execution);
 
                verify(aaiVfModuleResources, times(1)).updateHeatStackIdVfModule(vfModule, genericVnf);
+               assertEquals("newHeatStackId", vfModule.getHeatStackId());
        }
        
        @Test
@@ -270,11 +272,13 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
        }
        @Test
        public void updateHeatStackIdVolumeGroupTest() throws Exception {
+               execution.setVariable("heatStackId", "newHeatStackId");
                doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
 
                aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution);
 
                verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
+               assertEquals("newHeatStackId", volumeGroup.getHeatStackId());
        }
        
        @Test
index 283f888..7867136 100644 (file)
@@ -772,7 +772,7 @@ public class WorkflowActionTest extends BaseTaskTest {
                assertEquals(UUID.randomUUID().toString().length(),ebbs.get(14).getWorkflowResourceIds().getVnfId().length());
                assertEquals(ebbs.get(15).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB");
                assertEquals(3,ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
-
+               assertEquals(true, execution.getVariable("homing"));
        }
        
        @Test
index 6edda44..c3b0048 100644 (file)
@@ -245,6 +245,32 @@ public class AAIObjectMapperTest{
                assertThat(reqMapper1, sameBeanAs(AAIVfModule));
 
        }
+       
+       @Test
+       public void vfModuleBaseMap() throws Exception {
+               VfModule vfModule = new VfModule();
+               vfModule.setVfModuleId("a");
+               vfModule.setVfModuleName("b");
+               vfModule.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+               ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
+               modelInfoVfModule.setModelCustomizationUUID("f");
+               modelInfoVfModule.setModelInvariantUUID("g");
+               modelInfoVfModule.setModelUUID("h");
+               modelInfoVfModule.setIsBaseBoolean(true);
+               vfModule.setModelInfoVfModule(modelInfoVfModule);
+
+               org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule);
+
+               String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiVfModuleBaseMap.json")));
+
+               ObjectMapper omapper = new ObjectMapper();
+               org.onap.aai.domain.yang.VfModule reqMapper1 = omapper.readValue(
+                               jsonToCompare,
+                               org.onap.aai.domain.yang.VfModule.class);
+
+               assertThat(reqMapper1, sameBeanAs(AAIVfModule));
+
+       }
 
        @Test
        public void testMapInstanceGroup() {
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleBaseMap.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleBaseMap.json
new file mode 100644 (file)
index 0000000..9637e00
--- /dev/null
@@ -0,0 +1,12 @@
+{
+   
+  "modelCustomizationId" : "f",   
+   "vfModuleId" : "a",
+   "vfModuleName" : "b",
+   "modelInvariantId" : "g",
+   "modelVersionId" : "h",
+   "orchestrationStatus" : "Assigned",
+   "personaModelVersion" : "g",
+   "isBaseVfModule" : true
+   
+}
\ No newline at end of file