summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src
diff options
context:
space:
mode:
authorElena Kuleshov <EK1439@att.com>2018-09-19 14:03:47 -0400
committerElena Kuleshov <EK1439@att.com>2018-09-19 15:41:11 -0400
commit5648fffeaf625dde2b9207ceae87979082a68409 (patch)
tree7c59ec034f8c958010e2bdfda4586129154f2434 /bpmn/MSOCommonBPMN/src
parentc18addf7b6fb56a55b0ecfd5030c43308c46186d (diff)
Workflow Activities Execution Environment
Add a license header to ExecuteActivity.java Fix a JUnit by modifying the values for the expected variables. BBInput changes to support CM flows Implement JavaDelegate for activities execution Change-Id: I9cfc51241d414b85441d1a8443a950b97d14b65f Issue-ID: SO-827 Signed-off-by: Elena Kuleshov <EK1439@att.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java44
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java29
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json29
3 files changed, 93 insertions, 9 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index 6d5fb2f825..eb4f4ca0d5 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -190,14 +190,19 @@ public class BBInputSetup implements JavaDelegate {
if(requestDetails == null) {
requestDetails = bbInputSetupUtils.getRequestDetails(requestId);
}
- ModelType modelType = requestDetails.getModelInfo().getModelType();
- if (aLaCarte && modelType.equals(ModelType.service)) {
- return this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId);
- } else if (aLaCarte && !modelType.equals(ModelType.service)) {
- return this.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId,
- vnfType);
- } else {
- return this.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
+ if (requestDetails.getModelInfo() == null) {
+ return this.getGBBCM(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId);
+ }
+ else {
+ ModelType modelType = requestDetails.getModelInfo().getModelType();
+ if (aLaCarte && modelType.equals(ModelType.service)) {
+ return this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId);
+ } else if (aLaCarte && !modelType.equals(ModelType.service)) {
+ return this.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId,
+ vnfType);
+ } else {
+ return this.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
+ }
}
}
@@ -236,6 +241,25 @@ public class BBInputSetup implements JavaDelegate {
throw new Exception("Could not find relevant information for related Service Instance");
}
}
+
+ protected GeneralBuildingBlock getGBBCM(ExecuteBuildingBlock executeBB,
+ RequestDetails requestDetails, Map<ResourceKey, String> lookupKeyMap, String requestAction,
+ String resourceId) throws Exception {
+ ServiceInstance serviceInstance = new ServiceInstance();
+ String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID);
+ serviceInstance.setServiceInstanceId(serviceInstanceId);
+
+ List<GenericVnf> genericVnfs = serviceInstance.getVnfs();
+
+ String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID);
+ org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId);
+
+ GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnf);
+ genericVnfs.add(genericVnf);
+
+ return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, new Customer());
+
+ }
protected void populateObjectsOnAssignAndCreateFlows(RequestDetails requestDetails, Service service, String bbName,
ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String vnfType)
@@ -790,7 +814,9 @@ public class BBInputSetup implements JavaDelegate {
customer = mapCustomer(globalCustomerId, subscriptionServiceType);
}
outputBB.setServiceInstance(serviceInstance);
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ if (customer.getServiceSubscription() != null) {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ }
outputBB.setCustomer(customer);
return outputBB;
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index 9897c04ad8..d0ecedf878 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -301,6 +301,35 @@ public class BBInputSetupTest {
assertThat(actual, sameBeanAs(expected));
}
+
+ @Test
+ public void testGetGBBCM() throws Exception {
+ GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockCMExpected.json"),
+ GeneralBuildingBlock.class);
+
+ ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock();
+ executeBB.setRequestId("requestId");
+ RequestDetails requestDetails = new RequestDetails();
+ requestDetails.setModelInfo(null);
+ RequestParameters requestParams = new RequestParameters();
+ requestParams.setaLaCarte(true);
+ requestDetails.setRequestParameters(requestParams);
+ RequestInfo requestInfo = new RequestInfo();
+ requestInfo.setSuppressRollback(true);
+ requestDetails.setRequestInfo(requestInfo);
+ doReturn(requestDetails).when(SPY_bbInputSetupUtils).getRequestDetails(executeBB.getRequestId());
+ Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ String resourceId = "123";
+ String requestAction = "createInstance";
+ doReturn(expected).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
+ requestAction, resourceId);
+ doNothing().when(SPY_bbInputSetup).populateLookupKeyMapWithIds(any(WorkflowResourceIds.class), any());
+ doReturn(null).when(bbInputSetupMapperLayer).mapAAIGenericVnfIntoGenericVnf(any(org.onap.aai.domain.yang.GenericVnf.class));
+ GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBCM(executeBB, requestDetails, lookupKeyMap, requestAction,
+ resourceId);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
@Test
public void testGetGBBALaCarteNonService() throws Exception {
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json
new file mode 100644
index 0000000000..8cd04fdd8e
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json
@@ -0,0 +1,29 @@
+{
+ "requestContext": {
+ "source": "VID",
+ "mso-request-id": "requestId",
+ "action": "createInstance",
+ "requestParameters": {
+ "userParams": [],
+ "aLaCarte": true
+ },
+ "configurationParameters": []
+ },
+ "orchContext": {
+ "is-rollback-enabled": true
+ },
+ "cloudRegion": {
+ "cloud-owner": "att-aic"
+ },
+ "userInput": null,
+ "customer": {
+ "vpn-bindings": []
+ },
+ "serviceInstance": {
+ "vnfs": [null],
+ "pnfs": [],
+ "allotted-resources": [],
+ "networks": [],
+ "configurations": []
+ }
+}