aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/test/java
diff options
context:
space:
mode:
authorsarada prasad sahoo <sarada.prasad.sahoo@huawei.com>2019-06-07 14:46:36 +0530
committersarada prasad sahoo <sarada.prasad.sahoo@huawei.com>2019-07-02 11:43:28 +0530
commitf4bf9e7ad4746fbec415c0ad34fa57f168840e30 (patch)
tree8e194f0c32fc033a2025fad9a438e47cd1e8219a /bpmn/MSOCommonBPMN/src/test/java
parent8e42b4e3fd9c00d73d371ccdbe2147733821bb56 (diff)
Enhanced List Level flow with backward support
Modified the e2e service instance flow to support both new list types groups along with backward compatibility to support old types alloted resources, network etc. Change-Id: Ie8fc8a4550a90b44736b6b9de058e2a2e187570c Issue-ID: SO-1393 Signed-off-by: sarada prasad sahoo <sarada.prasad.sahoo@huawei.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test/java')
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java76
1 files changed, 71 insertions, 5 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java
index 3be67c965c..f3233f2350 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java
@@ -3,6 +3,7 @@ package org.onap.so.bpmn.common.resource;
import org.junit.Assert;
import org.junit.Test;
import org.onap.so.bpmn.core.domain.GroupResource;
+import org.onap.so.bpmn.core.domain.ModelInfo;
import org.onap.so.bpmn.core.domain.Resource;
import org.onap.so.bpmn.core.domain.ResourceType;
import org.onap.so.bpmn.core.domain.VnfResource;
@@ -23,15 +24,67 @@ public class InstnaceResourceListTest {
String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json")));
List<Resource> instanceResourceList =
InstanceResourceList.getInstanceResourceList(createResourceSequence(), uuiRequest);
- Assert.assertEquals(4, instanceResourceList.size());
+ Assert.assertEquals(7, instanceResourceList.size());
Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(1).getResourceType());
- Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(2).getResourceType());
+ Assert.assertEquals("device", instanceResourceList.get(1).getModelInfo().getModelName());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(2).getResourceType());
+ Assert.assertEquals("sitewan", instanceResourceList.get(2).getModelInfo().getModelName());
Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(3).getResourceType());
+ Assert.assertEquals("sitewan", instanceResourceList.get(3).getModelInfo().getModelName());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(4).getResourceType());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(5).getResourceType());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(6).getResourceType());
}
- private List<Resource> createResourceSequence() {
- List<Resource> resourceList = new ArrayList<>();
+ // Test when PK is empty
+ @Test
+ public void testSimpleVFResource() throws IOException {
+ String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json")));
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setResourceInput("{\"a\":\"ipaddress|127.0.0.1\"}");
+ List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(vnfResource, uuiRequest);
+ Assert.assertEquals(1, instanceResourceList.size());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
+ }
+
+ // Test when PK is not empty and PK does not contain any groups
+ @Test
+ public void testVFWithEmptyGroupResource() throws IOException {
+ String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json")));
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setResourceInput("{\"a\":\"[emptygroup_list,INDEX,name]\"}");
+ List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(vnfResource, uuiRequest);
+ Assert.assertEquals(1, instanceResourceList.size());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
+ }
+
+ // Test when PK is not empty and contains a group which SK is empty
+ @Test
+ public void testVFWithEmptyGroupKeyResource() throws IOException {
+ String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json")));
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setResourceInput("{\"a\":\"[emptygroup_list,INDEX,name]\"}");
+
+ VnfcResource vnfcResource = new VnfcResource();
+ vnfcResource.setResourceInput("{\"a\":\"test|default_value\"}");
+ GroupResource groupResource = new GroupResource();
+ groupResource.setVnfcs(Arrays.asList(vnfcResource));
+ ModelInfo wanModel = new ModelInfo();
+ wanModel.setModelName("wan");
+ groupResource.setModelInfo(wanModel);
+
+ vnfResource.setGroupOrder("wan");
+ vnfResource.setGroups(Arrays.asList(groupResource));
+
+ List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(vnfResource, uuiRequest);
+ Assert.assertEquals(2, instanceResourceList.size());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(1).getResourceType());
+ Assert.assertEquals("wan", instanceResourceList.get(1).getModelInfo().getModelName());
+ }
+
+ private VnfResource createResourceSequence() {
VnfResource vnfResource = new VnfResource();
vnfResource.setResourceInput("{\"a\":\"[sdwansiteresource_list,INDEX,sdwansiteresource_list]\"}");
@@ -40,7 +93,20 @@ public class InstnaceResourceListTest {
GroupResource groupResource = new GroupResource();
groupResource.setVnfcs(Arrays.asList(vnfcResource));
+ ModelInfo wanModel = new ModelInfo();
+ wanModel.setModelName("sitewan");
+ groupResource.setModelInfo(wanModel);
+
+ VnfcResource vnfcDeviceResource = new VnfcResource();
+ vnfcDeviceResource.setResourceInput("{\"a\":\"[sdwandevice_list,INDEX,test]\"}");
+ GroupResource groupResource2 = new GroupResource();
+ groupResource2.setVnfcs(Arrays.asList(vnfcDeviceResource));
+ ModelInfo deviceModel = new ModelInfo();
+ deviceModel.setModelName("device");
+ groupResource2.setModelInfo(deviceModel);
- return Arrays.asList(vnfResource, groupResource);
+ vnfResource.setGroupOrder("device,sitewan");
+ vnfResource.setGroups(Arrays.asList(groupResource, groupResource2));
+ return vnfResource;
}
}