diff options
author | Krzysztof Gajewski <krzysztof.gajewski@nokia.com> | 2020-05-29 16:05:13 +0200 |
---|---|---|
committer | Krzysztof Gajewski <krzysztof.gajewski@nokia.com> | 2020-05-29 16:05:13 +0200 |
commit | a30ad49b5434b0a2670d51e6aa54ee6ea82deb62 (patch) | |
tree | 05d8e88e0fdd22be50917e2d3f66b240445d1bff /bpmn/MSOCommonBPMN/src/main/java | |
parent | 6c1869316041e314007acb2f777ea89631c890b8 (diff) |
Add JUnit code coverage for InstanceResourceList:
Issue-ID: SO-1576
Signed-off-by: Krzysztof Gajewski <krzysztof.gajewski@nokia.com>
Change-Id: I51496fce24acdb8a9fc1b9fedde20b9cbbb8af68
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java')
-rw-r--r-- | bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java index 3a4df68f02..963210b993 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java @@ -109,16 +109,20 @@ public class InstanceResourceList { } // check if the resource contains vf-module - if (vnfResource != null && vnfResource.getVfModules() != null) { + if (isVnfResourceWithVfModule(vnfResource)) { sequencedResourceList.addAll(vnfResource.getVfModules()); } return sequencedResourceList; } + private static boolean isVnfResourceWithVfModule(VnfResource vnfResource) { + return vnfResource != null && vnfResource.getVfModules() != null; + } + private static List<Resource> getGroupResourceInstanceList(VnfResource vnfResource, JsonObject vfObj) { List<Resource> sequencedResourceList = new ArrayList<>(); - if (vnfResource.getGroupOrder() != null && !StringUtils.isEmpty(vnfResource.getGroupOrder())) { + if (isVnfGroupOrderFilled(vnfResource)) { String[] grpSequence = vnfResource.getGroupOrder().split(","); for (String grpType : grpSequence) { for (GroupResource gResource : vnfResource.getGroups()) { @@ -150,4 +154,8 @@ public class InstanceResourceList { } return sequencedResourceList; } + + private static boolean isVnfGroupOrderFilled(VnfResource vnfResource) { + return vnfResource.getGroupOrder() != null && !StringUtils.isEmpty(vnfResource.getGroupOrder()); + } } |