aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-11-20 16:39:19 +0000
committerGerrit Code Review <gerrit@onap.org>2018-11-20 16:39:19 +0000
commit72a833193094c1c52be0532eb266013596d12bb1 (patch)
tree8541f43670684b9b37a4b3b1fb7e7bd52966b800 /bpmn
parent7616c69868b71882631c9aba15d55915fcd8c441 (diff)
parent898449a5d41b777ebe271bcae9c0ba511fecdb1f (diff)
Merge "Bug Fixes November 16th" into casablanca
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java22
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java22
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java59
5 files changed, 101 insertions, 12 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java
index 93e588f2e1..701817ab58 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java
@@ -29,6 +29,7 @@ import java.util.UUID;
import javax.annotation.PostConstruct;
+import org.apache.commons.lang3.StringUtils;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleTopology;
@@ -92,7 +93,12 @@ public class VnfAdapterObjectMapper {
deleteVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
deleteVolumeGroupRequest.setTenantId(cloudRegion.getTenantId());
deleteVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
- deleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
+ if (!StringUtils.isEmpty(volumeGroup.getHeatStackId())){
+ deleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
+ } else
+ {
+ deleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getVolumeGroupName());
+ }
deleteVolumeGroupRequest.setSkipAAI(true);
deleteVolumeGroupRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
index a36d18c524..1f01772d7a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
@@ -23,6 +23,7 @@ package org.onap.so.client.adapter.vnf.mapper;
import static java.util.Arrays.asList;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -36,6 +37,7 @@ import java.util.Optional;
import javax.annotation.PostConstruct;
+import org.apache.commons.lang3.StringUtils;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiSubInterfaceNetworkData;
@@ -781,16 +783,26 @@ public class VnfAdapterVfModuleObjectMapper {
deleteVfModuleRequest.setTenantId(cloudRegion.getTenantId());
deleteVfModuleRequest.setVnfId(genericVnf.getVnfId());
deleteVfModuleRequest.setVfModuleId(vfModule.getVfModuleId());
- deleteVfModuleRequest.setVfModuleStackId(vfModule.getHeatStackId());//DoDVfMod_heatStackId
- deleteVfModuleRequest.setSkipAAI(true);
- String messageId = vnfAdapterObjectMapperUtils.getRandomUuid();
- deleteVfModuleRequest.setMessageId(messageId);
- deleteVfModuleRequest.setNotificationUrl(vnfAdapterObjectMapperUtils.createCallbackUrl("VNFAResponse", messageId));
+ if (!StringUtils.isEmpty(vfModule.getHeatStackId())){
+ deleteVfModuleRequest.setVfModuleStackId(vfModule.getHeatStackId());//DoDVfMod_heatStackId
+ } else
+ {
+ deleteVfModuleRequest.setVfModuleStackId(vfModule.getVfModuleName());
+ }
+
+ deleteVfModuleRequest.setSkipAAI(true);
+ setIdAndUrl(deleteVfModuleRequest);
MsoRequest msoRequest = buildMsoRequest(requestContext, serviceInstance);
deleteVfModuleRequest.setMsoRequest(msoRequest);
return deleteVfModuleRequest;
}
+ protected void setIdAndUrl(DeleteVfModuleRequest deleteVfModuleRequest) throws UnsupportedEncodingException{
+ String messageId = vnfAdapterObjectMapperUtils.getRandomUuid();
+ deleteVfModuleRequest.setMessageId(messageId);
+ deleteVfModuleRequest.setNotificationUrl(vnfAdapterObjectMapperUtils.createCallbackUrl("VNFAResponse", messageId));
+ }
+
private String convertToString(Object obj) {
String json;
try {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
index 8f5c8dfb5e..f176607dfa 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
@@ -230,7 +230,16 @@ public class VnfAdapterObjectMapperTest {
}
@Test
- public void test_deleteVolumeGroupRequestMapper() throws Exception {
+ public void test_deleteVolumeGroupHeatIdRequestMapper() throws Exception{
+ this.test_deleteVolumeGroupRequestMapper("heatStackId");
+ }
+
+ @Test
+ public void test_deleteVolumeGroupNoHeatIdRequestMapper() throws Exception{
+ this.test_deleteVolumeGroupRequestMapper(null);
+ }
+
+ private void test_deleteVolumeGroupRequestMapper(String heatStackId) throws Exception {
DeleteVolumeGroupRequest expectedDeleteVolumeGroupRequest = new DeleteVolumeGroupRequest();
CloudRegion cloudRegion = new CloudRegion();
@@ -244,8 +253,13 @@ public class VnfAdapterObjectMapperTest {
volumeGroup.setVolumeGroupId("volumeGroupId");
expectedDeleteVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
- volumeGroup.setHeatStackId("heatStackId");
- expectedDeleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
+ if (heatStackId != null){
+ volumeGroup.setHeatStackId("heatStackId");
+ expectedDeleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
+ } else {
+ volumeGroup.setVolumeGroupName("volumeGroupName");
+ expectedDeleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getVolumeGroupName());
+ }
expectedDeleteVolumeGroupRequest.setSkipAAI(true);
@@ -269,7 +283,7 @@ public class VnfAdapterObjectMapperTest {
assertThat(actualDeleteVolumeGroupRequest, sameBeanAs(expectedDeleteVolumeGroupRequest));
}
-
+
@Test
@Ignore
public void test_createVolumeGroupParams() throws Exception {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java
index 32a495e094..a156c382d1 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java
@@ -845,7 +845,7 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest {
jsonToCompare,
DeleteVfModuleRequest.class);
- assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
+ assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl").ignoring("vfModuleStackId"));
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java
index c8f4a222f3..dac26f728a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java
@@ -20,19 +20,38 @@
package org.onap.so.client.adapter.vnf.mapper;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doNothing;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
+import org.junit.Before;
import org.junit.Test;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.entity.MsoRequest;
-public class VnfAdapterVfModuleObjectMapperTest{
+public class VnfAdapterVfModuleObjectMapperTest {
+ @Spy
private VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper();
+
+ @Before
+ public void before() {
+ MockitoAnnotations.initMocks(this);
+ }
@Test
public void createVnfcSubInterfaceKeyTest() {
@@ -64,4 +83,42 @@ public class VnfAdapterVfModuleObjectMapperTest{
}
+ @Test
+ public void test_deleteVfModuleNoHeatIdRequestMapper() throws Exception {
+ DeleteVfModuleRequest expectedDeleteVfModuleRequest = new DeleteVfModuleRequest();
+
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setLcpCloudRegionId("lcpCloudRegionId");
+ expectedDeleteVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+
+ cloudRegion.setTenantId("tenantId");
+ expectedDeleteVfModuleRequest.setTenantId(cloudRegion.getTenantId());
+
+ GenericVnf genericVnf = new GenericVnf();
+ VfModule vfModule = new VfModule();
+ vfModule.setHeatStackId("heatStackId");
+ expectedDeleteVfModuleRequest.setVfModuleStackId("heatStackId");
+ expectedDeleteVfModuleRequest.setSkipAAI(true);
+
+ MsoRequest msoRequest = new MsoRequest();
+ RequestContext requestContext = new RequestContext();
+ requestContext.setMsoRequestId("msoRequestId");
+ msoRequest.setRequestId(requestContext.getMsoRequestId());
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ expectedDeleteVfModuleRequest.setMsoRequest(msoRequest);
+
+ String messageId = "messageId";
+ String endpoint = "endpoint";
+ doNothing().when(mapper).setIdAndUrl(any());
+ expectedDeleteVfModuleRequest.setMessageId(messageId);
+ expectedDeleteVfModuleRequest.setNotificationUrl(endpoint + "/VNFAResponse/" + messageId);
+
+ DeleteVfModuleRequest actualDeleteVfModuleRequest = mapper.deleteVfModuleRequestMapper(requestContext, cloudRegion,
+ serviceInstance, genericVnf, vfModule);
+
+ assertThat(actualDeleteVfModuleRequest, sameBeanAs(expectedDeleteVfModuleRequest).ignoring("messageId").ignoring("notificationUrl"));
+ }
+
}