diff options
author | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2019-04-30 07:04:39 +0530 |
---|---|---|
committer | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2019-05-02 16:34:39 +0530 |
commit | 5ed1062dcc39cfa7a99b8a5b6882a75f4acffea6 (patch) | |
tree | 3087a18d758354ff3fddd544abefb197ebbbf256 /bpmn/MSOCommonBPMN/src/test/java | |
parent | acb8997a69725a39270a6527b33995f51c1e4586 (diff) |
Modify instance resource list creation
Modify instance resource list creation to avoid hard locking of
model name in UUI request.
e.g.
VF resource and gruop resource has resource input
vf { resource_input : { key1:value2, key2:[vf_prop_list,INDEX,key]|default}
Derive the key ("vf_prop_list") from resource input and use this
info to map UUI request.
UUI req:
{
...
resourceInput: {
vf_prop_list : /// mapped with resource input of resource
{
....
Change-Id: Ic40079a094b2628bcf6f5758121b7492ee3c1353
Issue-ID: SO-1393
Signed-off-by: subhash kumar singh <subhash.kumar.singh@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.java | 46 |
1 files changed, 46 insertions, 0 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 new file mode 100644 index 0000000000..3be67c965c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java @@ -0,0 +1,46 @@ +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.Resource; +import org.onap.so.bpmn.core.domain.ResourceType; +import org.onap.so.bpmn.core.domain.VnfResource; +import org.onap.so.bpmn.core.domain.VnfcResource; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class InstnaceResourceListTest { + + public static String RESOURCE_PATH = "src/test/resources/__files/InstanceResourceList/"; + + @Test + public void testInstanceResourceList() throws IOException { + 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(ResourceType.VNF, instanceResourceList.get(0).getResourceType()); + Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(1).getResourceType()); + Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(2).getResourceType()); + Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(3).getResourceType()); + } + + private List<Resource> createResourceSequence() { + List<Resource> resourceList = new ArrayList<>(); + VnfResource vnfResource = new VnfResource(); + vnfResource.setResourceInput("{\"a\":\"[sdwansiteresource_list,INDEX,sdwansiteresource_list]\"}"); + + VnfcResource vnfcResource = new VnfcResource(); + vnfcResource.setResourceInput("{\"a\":\"[sdwansitewan_list,INDEX,test]\"}"); + + GroupResource groupResource = new GroupResource(); + groupResource.setVnfcs(Arrays.asList(vnfcResource)); + + return Arrays.asList(vnfResource, groupResource); + } +} |