aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-03-27 20:10:07 +0000
committerGerrit Code Review <gerrit@onap.org>2019-03-27 20:10:07 +0000
commit49aa3b9d1f754af2ff9c11510c00a875c9c3e7d7 (patch)
treec667c4190566a2202e8d8a7284717e185fd9f6f8 /bpmn
parent66e2da67751e823a1feb4afac9aaa880e1841013 (diff)
parentc8dc961a21b7a30ae91d53948a93be3551cae9a9 (diff)
Merge "JUnit tests for VnfResource"
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java36
1 files changed, 35 insertions, 1 deletions
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java
index a83337fc5b..5271bb3c53 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/VnfResourceTest.java
@@ -22,13 +22,17 @@ package org.onap.so.bpmn.core.domain;
import static org.junit.Assert.*;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
public class VnfResourceTest {
-
+
+ private final static String ALL_VF_MODULES_JSON =
+ "{\"ArrayList\":[{\"resourceType\":\"MODULE\",\"resourceInstance\":{},\"homingSolution\":{\"license\":{},\"rehome\":false},\"vfModuleName\":\"vfModuleName\",\"vfModuleType\":\"vfModuleType\",\"heatStackId\":\"heatStackId\",\"hasVolumeGroup\":true,\"isBase\":true,\"vfModuleLabel\":\"vfModuleLabel\",\"initialCount\":0},{\"resourceType\":\"MODULE\",\"resourceInstance\":{},\"homingSolution\":{\"license\":{},\"rehome\":false},\"vfModuleName\":\"vfModuleName\",\"vfModuleType\":\"vfModuleType\",\"heatStackId\":\"heatStackId\",\"hasVolumeGroup\":true,\"isBase\":true,\"vfModuleLabel\":\"vfModuleLabel\",\"initialCount\":0}]}";
+
private VnfResource vnf= new VnfResource();
List<ModuleResource> moduleResources;
@@ -63,4 +67,34 @@ public class VnfResourceTest {
assertTrue(vnfResource != null);
}
+ @Test
+ public void testVfModules() {
+
+ moduleResources = new ArrayList<>();
+
+ ModuleResource moduleresource = new ModuleResource();
+ moduleresource.setVfModuleName("vfModuleName");
+ moduleresource.setHeatStackId("heatStackId");
+ moduleresource.setIsBase(true);
+ moduleresource.setVfModuleLabel("vfModuleLabel");
+ moduleresource.setInitialCount(0);
+ moduleresource.setVfModuleType("vfModuleType");
+ moduleresource.setHasVolumeGroup(true);
+
+ moduleResources.add(moduleresource);
+
+ vnf.setModules(moduleResources);
+ assertEquals(vnf.getVfModules(), moduleResources);
+
+ List<ModuleResource> moduleResources = vnf.getAllVfModuleObjects();
+ assertEquals(1, moduleResources.size());
+
+ vnf.addVfModule(moduleresource);
+ moduleResources = vnf.getAllVfModuleObjects();
+ assertEquals(2, moduleResources.size());
+
+ assertEquals(ALL_VF_MODULES_JSON, vnf.getAllVfModulesJson());
+
+ }
+
}