summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-11-16 20:37:57 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-11-17 01:46:26 -0500
commit898449a5d41b777ebe271bcae9c0ba511fecdb1f (patch)
tree3f6fcb64b39269b00ffa683b3d8b03281a6aca40 /bpmn/so-bpmn-tasks
parent1ad4536823e70b099947595ccfa6534055ddc9c4 (diff)
Bug Fixes November 16th
fix failing junit when heatID not available provide name if ID is not present on delete op removed logic to skip unassign sdnc in rollback flows Move default settings to CrVfModRequest pojo. Check for null backout and failIfExists params - 1810. Updated exception message and test Added tests for networkCustomization not found Added tests for delete and update network Separated networkResourceCustomization and networkResource lookups Removed version check as not necessary for setting boolean Change-Id: Ia4b409244dc5ebdbb163d4a178713115719366ca Issue-ID: SO-1231 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks')
-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"));
+ }
+
}