summaryrefslogtreecommitdiffstats
path: root/ueb-listener
diff options
context:
space:
mode:
authorlalena.aria <lalena.aria@att.com>2018-07-24 09:28:47 -0400
committerlalena.aria <lalena.aria@att.com>2018-07-24 09:29:14 -0400
commit7e6d57e2c6dcf22567b7ef130d2a3c3a6866fe5f (patch)
treeed11a73451ff32ef74792a75e27c6675bcd2159c /ueb-listener
parent622e7b365132d0504c0408bed9dd5e29d605d619 (diff)
Adding junits for refactored UEB Listener
Changes made: Added null check in SdncBaseModel.java Cleaned up in SdncVFCModel.java Added tests in SdncARModelTest.java, SdncNodeModelTest and SdncVFCModelTest Added files SdncGroupModelTest, SdncServiceModelTest and SdncVFModelTest Change-Id: If0261c94d67a61b0b19db51cbbbff7ae32912d06 Issue-ID: CCSDK-360 Signed-off-by: lalena.aria <lalena.aria@att.com>
Diffstat (limited to 'ueb-listener')
-rw-r--r--ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java28
-rw-r--r--ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java14
-rw-r--r--ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModelTest.java33
-rw-r--r--ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModelTest.java34
-rw-r--r--ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java28
-rw-r--r--ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncServiceModelTest.java77
-rw-r--r--ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModelTest.java79
-rw-r--r--ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModelTest.java95
8 files changed, 343 insertions, 45 deletions
diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java
index fd5a29637..7f0e9398f 100644
--- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java
+++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java
@@ -887,13 +887,15 @@ public class SdncBaseModel {
try {
int rowCount = 0;
CachedRowSet data = jdbcDataSource.getData("SELECT * from " + tableName + " where " + keyName + " = " + keyValue + ";", null, "");
- while(data.next()) {
+ if (data != null) {
+ while(data.next()) {
rowCount ++;
- }
- if (rowCount != 0) {
- LOG.debug("cleanUpExistingToscaData from: " + tableName + " for " + keyValue);
- jdbcDataSource.writeData("DELETE from " + tableName + " where " + keyName + " = " + keyValue + ";", null, null);
- }
+ }
+ if (rowCount != 0) {
+ LOG.debug("cleanUpExistingToscaData from: " + tableName + " for " + keyValue);
+ jdbcDataSource.writeData("DELETE from " + tableName + " where " + keyName + " = " + keyValue + ";", null, null);
+ }
+ }
} catch (SQLException e) {
LOG.error("Could not clean up existing " + tableName + " for " + keyValue, e);
@@ -907,13 +909,15 @@ public class SdncBaseModel {
try {
int rowCount = 0;
CachedRowSet data = jdbcDataSource.getData("SELECT * from " + tableName + " where " + key1Name + " = " + key1Value + " AND " + key2Name + " = " + key2Value + ";", null, "");
- while(data.next()) {
+ if (data != null) {
+ while(data.next()) {
rowCount ++;
- }
- if (rowCount != 0) {
- LOG.debug("cleanUpExistingToscaData from : " + tableName + " for " + key1Value + " and " + key2Value);
- jdbcDataSource.writeData("DELETE from " + tableName + " where " + key1Name + " = " + key1Value + " AND " + key2Name + " = " + key2Value + ";", null, null);
- }
+ }
+ if (rowCount != 0) {
+ LOG.debug("cleanUpExistingToscaData from : " + tableName + " for " + key1Value + " and " + key2Value);
+ jdbcDataSource.writeData("DELETE from " + tableName + " where " + key1Name + " = " + key1Value + " AND " + key2Name + " = " + key2Value + ";", null, null);
+ }
+ }
} catch (SQLException e) {
LOG.error("Could not clean up existing " + tableName + " for " + key1Value + " and " + key2Value, e);
diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java
index 35639b366..5977e2888 100644
--- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java
+++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java
@@ -260,20 +260,6 @@ public class SdncVFCModel extends SdncBaseModel {
return subnetRoleFound;
}
- private Map<String, String> getIpPropMapWithMatchingSubnetRole (ArrayList<Map<String, String>> ipPropParamsList, String subnetRole) {
-
- Map<String, String> ipPropMapMatch = new HashMap<String, String>();
-
- if (subnetRole != null) {
- for (Map<String, String> ipPropMap : ipPropParamsList) {
- if (nullCheck(ipPropMap.get("subnet_role")) == subnetRole) {
- return ipPropMap;
- }
- }
- }
- return ipPropMapMatch;
- }
-
private void addRequiredParameters (Map<String, String> mappingParams) {
// Add parameters which can not be null if they have not already been added - network_role, ipv4_count, ipv6_count
diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModelTest.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModelTest.java
index 360c36c9f..ea6499cd3 100644
--- a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModelTest.java
+++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModelTest.java
@@ -2,22 +2,43 @@ package org.onap.ccsdk.sli.northbound.uebclient;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
-
- import org.junit.Test;
+
+import java.io.IOException;
+
+import org.junit.Before;
+import org.junit.Test;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.toscaparser.api.NodeTemplate;
import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
public class SdncARModelTest {
- @Test
- public void testSdncARModelConstructor() {
+ SdncARModel testSdncARModel = null;
+
+ @Before
+ public void setUp() throws Exception {
ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class);
NodeTemplate nodeTemplate = mock(NodeTemplate.class);
DBResourceManager mockDBResourceManager = mock(DBResourceManager.class);
- SdncARModel testSdncARModel = new SdncARModel(mockCsarHelper,nodeTemplate,mockDBResourceManager);
+ testSdncARModel = new SdncARModel(mockCsarHelper,nodeTemplate,mockDBResourceManager);
assertNotNull(testSdncARModel);
}
+ @Test
+ public void testSetGetSubcategory() {
+ String subcategory = "test-subcategory";
+ testSdncARModel.setSubcategory(subcategory);
+ String result = testSdncARModel.getSubcategory();
+ assertEquals(subcategory, result);
+ }
+
+ @Test
+ public void testInsertAllottedResourceModelData() {
+ try {
+ testSdncARModel.insertAllottedResourceModelData();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
}
-
diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModelTest.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModelTest.java
new file mode 100644
index 000000000..0c6030b44
--- /dev/null
+++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModelTest.java
@@ -0,0 +1,34 @@
+package org.onap.ccsdk.sli.northbound.uebclient;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
+import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.onap.sdc.toscaparser.api.Group;
+import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
+
+ public class SdncGroupModelTest {
+
+ @Test
+ public void testSdncGroupModelConstructor() {
+ ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class);
+ NodeTemplate nodeTemplate = mock(NodeTemplate.class);
+ Group group = mock(Group.class);
+ DBResourceManager mockDBResourceManager = mock(DBResourceManager.class);
+ SdncUebConfiguration mockSdncUebConfiguration = mock(SdncUebConfiguration.class);
+ SdncGroupModel testSdncGroupModel = null;
+ try {
+ testSdncGroupModel = new SdncGroupModel(mockCsarHelper,group,nodeTemplate,mockSdncUebConfiguration,mockDBResourceManager);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertNotNull(testSdncGroupModel);
+ }
+
+ }
+
diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java
index d50c47a40..a77c5adbf 100644
--- a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java
+++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java
@@ -2,12 +2,15 @@ package org.onap.ccsdk.sli.northbound.uebclient;
import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
-
+import static org.mockito.Mockito.*;
+
+import java.io.IOException;
+
import org.junit.Before;
import org.junit.Test;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
-import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.onap.sdc.toscaparser.api.elements.Metadata;
import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
public class SdncNodeModelTest {
@@ -18,7 +21,13 @@ public class SdncNodeModelTest {
public void setUp() throws Exception {
ISdcCsarHelper isdcCsarHelper = mock(ISdcCsarHelper.class);
NodeTemplate nodeTemplate = mock(NodeTemplate.class);
+ Metadata mockMetadata = mock(Metadata.class);
DBResourceManager mockDBResourceManager = mock(DBResourceManager.class);
+
+ when(nodeTemplate.getMetaData()).thenReturn(mockMetadata);
+ when(isdcCsarHelper.getMetadataPropertyValue(mockMetadata, "customizationUUID")).thenReturn("aaaa-bbbb-cccc-dddd");
+ when(isdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, "network_type")).thenReturn("test-network-type");
+
sdncNodeModel = new SdncNodeModel(isdcCsarHelper, nodeTemplate, mockDBResourceManager);
sdncNodeModel.setServiceUUID("0e8d757f-1c80-40af-85de-31d64f1f5af8");
sdncNodeModel.setEcompGeneratedNaming("hello-world");
@@ -39,7 +48,7 @@ public class SdncNodeModelTest {
@Test
public void testGetSqlString() {
String result = sdncNodeModel.getSql("TEST-HELLO");
- String test = "INSERT into NETWORK_MODEL (service_uuid, customization_uuid, model_yaml, ecomp_generated_naming) values (0e8d757f-1c80-40af-85de-31d64f1f5af8, \"\", \"TEST-HELLO\", \"hello-world\");";
+ String test = "INSERT into NETWORK_MODEL (service_uuid, customization_uuid, model_yaml, ecomp_generated_naming, network_type) values (0e8d757f-1c80-40af-85de-31d64f1f5af8, \"aaaa-bbbb-cccc-dddd\", \"TEST-HELLO\", \"hello-world\", \"test-network-type\");";
assertEquals(test, result);
}
@@ -48,4 +57,15 @@ public class SdncNodeModelTest {
String result = sdncNodeModel.getVpnBindingsSql();
assertNotNull(result);
}
+
+ @Test
+ public void testInsertNetworkModelData() {
+ try {
+ sdncNodeModel.insertNetworkModelData();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
}
diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncServiceModelTest.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncServiceModelTest.java
new file mode 100644
index 000000000..95f5a75ec
--- /dev/null
+++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncServiceModelTest.java
@@ -0,0 +1,77 @@
+package org.onap.ccsdk.sli.northbound.uebclient;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.io.IOException;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
+import org.onap.sdc.toscaparser.api.elements.Metadata;
+
+ public class SdncServiceModelTest {
+
+ SdncServiceModel testSdncServiceModel = null;
+
+ @Before
+ public void setUp() throws Exception {
+ ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class);
+ Metadata mockMetadata = mock(Metadata.class);
+
+ when(mockCsarHelper.getMetadataPropertyValue(mockMetadata, "UUID")).thenReturn("aaaa-bbbb-cccc-dddd");
+ when(mockCsarHelper.getMetadataPropertyValue(mockMetadata, "invariantUUID")).thenReturn("bbbb-cccc-dddd-eeee");
+ when(mockCsarHelper.getMetadataPropertyValue(mockMetadata, "namingPolicy")).thenReturn("test-naming-policy");
+
+ testSdncServiceModel = new SdncServiceModel(mockCsarHelper,mockMetadata);
+
+ assertNotNull(testSdncServiceModel);
+ }
+
+ @Test
+ public void testSetGetServiceUUID() {
+ String newServiceUuid = "cccc-dddd-eeee-ffff";
+ testSdncServiceModel.setServiceUUID(newServiceUuid);
+ String result = testSdncServiceModel.getServiceUUID();
+ assertEquals("\"" + newServiceUuid + "\"", result);
+ }
+
+ @Test
+ public void testSetGetServiceInvariantUUID() {
+ String result = testSdncServiceModel.getServiceInvariantUUID();
+ assertEquals(result, "\"bbbb-cccc-dddd-eeee\"");
+ }
+
+ @Test
+ public void testSetGeServiceInstanceNamePrefix() {
+ String serviceInstanceNamePrefix = "test-service-instance-name-prefix";
+ testSdncServiceModel.setServiceInstanceNamePrefix(serviceInstanceNamePrefix);
+ String result = testSdncServiceModel.getServiceInstanceNamePrefix();
+ assertEquals(serviceInstanceNamePrefix, result);
+ }
+
+ @Test
+ public void testSetGetResourceVendor() {
+ String resourceVendor = "Fortinet";
+ testSdncServiceModel.setResourceVendor(resourceVendor);
+ String result = testSdncServiceModel.getResourceVendor();
+ assertEquals(resourceVendor, result);
+ }
+
+ @Test
+ public void testSetGetResourceVendorRelease() {
+ String resourceVendorRelease = "1.0.0";
+ testSdncServiceModel.setResourceVendorRelease(resourceVendorRelease);
+ String result = testSdncServiceModel.getResourceVendorRelease();
+ assertEquals(resourceVendorRelease, result);
+ }
+
+ @Test
+ public void testGetSqlString() {
+ String result = testSdncServiceModel.getSql("TEST-HELLO");
+ String test = "INSERT into SERVICE_MODEL (service_uuid, model_yaml, filename, naming_policy, invariant_uuid) values (\"aaaa-bbbb-cccc-dddd\", \"TEST-HELLO\", \"null\", \"test-naming-policy\", \"bbbb-cccc-dddd-eeee\");";
+ assertEquals(test, result);
+ }
+
+
+ }
diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModelTest.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModelTest.java
index a09c5a2ba..469312359 100644
--- a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModelTest.java
+++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModelTest.java
@@ -1,24 +1,55 @@
package org.onap.ccsdk.sli.northbound.uebclient;
import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
-
-
+import static org.mockito.Mockito.*;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.ArrayList;
+
import org.junit.Before;
import org.junit.Test;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
-import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.onap.sdc.toscaparser.api.elements.Metadata;
import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
public class SdncVFCModelTest {
SdncVFCModel testSdncVFCModel;
+ NodeTemplate mockVFCNodeTemplate = null;
@Before
public void setup() {
ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class);
NodeTemplate mockNodeTemplate = mock(NodeTemplate.class);
+ mockVFCNodeTemplate = mock(NodeTemplate.class);
+ Metadata mockMetadata = mock(Metadata.class);
DBResourceManager mockDBResourceManager = mock(DBResourceManager.class);
+
+ when(mockNodeTemplate.getMetaData()).thenReturn(mockMetadata);
+ when(mockCsarHelper.getMetadataPropertyValue(mockMetadata, "customizationUUID")).thenReturn("aaaa-bbbb-cccc-dddd");
+ when(mockCsarHelper.getNodeTemplatePropertyLeafValue(mockNodeTemplate, "nfc_naming_code")).thenReturn("test-nfc-naming-code");
+
+ Map<String,Map<String,Object>> cpPropertiesMap = new HashMap<String,Map<String,Object>>();
+ Map<String,Object> propertiesMap = new HashMap<String,Object>();
+ propertiesMap.put("network-role", "test-network-role");
+ propertiesMap.put("network-role-tag", "test-network-role-tag");
+
+ ArrayList<Map<String, Object>> ipRequirementsList = new ArrayList<Map<String, Object>>();
+ Map<String,Object> ip4Prop = new HashMap<String,Object>();
+ ip4Prop.put("ip_version", "4");
+ ipRequirementsList.add(ip4Prop);
+ Map<String,Object> ip6Prop = new HashMap<String,Object>();
+ ip4Prop.put("ip_version", "6");
+ ipRequirementsList.add(ip4Prop);
+
+ propertiesMap.put("ip_requirements", ipRequirementsList);
+ cpPropertiesMap.put("cp-node-1", propertiesMap);
+ when(mockCsarHelper.getCpPropertiesFromVfcAsObject(mockVFCNodeTemplate)).thenReturn(cpPropertiesMap);
+
testSdncVFCModel = new SdncVFCModel(mockCsarHelper, mockNodeTemplate, mockDBResourceManager);
testSdncVFCModel.setVmType("Test-type");
testSdncVFCModel.setVmCount("5");
@@ -26,13 +57,43 @@ public class SdncVFCModelTest {
}
@Test
- public void testSdncVFCModelGetVmType() {
- assertEquals(testSdncVFCModel.getVmType(), "Test-type");
+ public void testSdncVFCModelSetGetVmType() {
+ String newVMtype = "new-vm-type";
+ testSdncVFCModel.setVmType(newVMtype);
+ assertEquals(testSdncVFCModel.getVmType(), "new-vm-type");
}
@Test
- public void testSdncVFCModelGetVmCount() {
- assertEquals(testSdncVFCModel.getVmCount(), "5");
+ public void testSdncVFCModelSetGetVmCount() {
+ String newVMcount = "4";
+ testSdncVFCModel.setVmCount(newVMcount);
+ assertEquals(testSdncVFCModel.getVmCount(), "4");
}
-
+
+ @Test
+ public void testInsertVFCModelData() {
+ try {
+ testSdncVFCModel.insertVFCModelData();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testInsertVFCtoNetworkRoleMappingData() {
+ try {
+ testSdncVFCModel.insertVFCtoNetworkRoleMappingData(mockVFCNodeTemplate);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testIpPropParamsMapContainsSubnetRole() {
+ ArrayList<Map<String, String>> testList = new ArrayList<Map<String, String>>();
+ testSdncVFCModel.ipPropParamsMapContainsSubnetRole(testList, "test-subnet-role");
+ }
+
}
diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModelTest.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModelTest.java
new file mode 100644
index 000000000..3f795a354
--- /dev/null
+++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModelTest.java
@@ -0,0 +1,95 @@
+package org.onap.ccsdk.sli.northbound.uebclient;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.io.IOException;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
+import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.onap.sdc.toscaparser.api.elements.Metadata;
+import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
+
+ public class SdncVFModelTest {
+
+ SdncVFModel testSdncVFModel = null;
+
+ @Before
+ public void setUp() throws Exception {
+ ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class);
+ NodeTemplate nodeTemplate = mock(NodeTemplate.class);
+ Metadata mockMetadata = mock(Metadata.class);
+ DBResourceManager mockDBResourceManager = mock(DBResourceManager.class);
+ SdncUebConfiguration mockSdncUebConfiguration = mock(SdncUebConfiguration.class);
+
+ when(nodeTemplate.getMetaData()).thenReturn(mockMetadata);
+ when(mockCsarHelper.getMetadataPropertyValue(mockMetadata, "customizationUUID")).thenReturn("aaaa-bbbb-cccc-dddd");
+ when(mockCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, "nf_naming_code")).thenReturn("test-nf-naming-code");
+
+ try {
+ testSdncVFModel = new SdncVFModel(mockCsarHelper,nodeTemplate,mockDBResourceManager,mockSdncUebConfiguration);
+ testSdncVFModel.setServiceUUID("bbbb-cccc-dddd-eeee");
+ testSdncVFModel.setServiceInvariantUUID("cccc-dddd-eeee-ffff");
+ testSdncVFModel.setVendor("Cisco");
+ testSdncVFModel.setVendorModelDescription("Cisco Equipment Model");
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ assertNotNull(testSdncVFModel);
+ }
+
+ @Test
+ public void testSetGetVendor() {
+ String newVendorModel = "new-vendor-model";
+ testSdncVFModel.setVendor(newVendorModel);
+ String result = testSdncVFModel.getVendor();
+ assertEquals(result, newVendorModel);
+ }
+
+ @Test
+ public void testSetGetVendorModelDescription() {
+ String newVendorModelDescription = "new-vendor-model-description";
+ testSdncVFModel.setVendorModelDescription(newVendorModelDescription);
+ String result = testSdncVFModel.getVendorModelDescription();
+ assertEquals(result, newVendorModelDescription);
+ }
+
+ @Test
+ public void testSetGetNfNamingCode() {
+ String newNfNamingCode = "new-nf-naming-code";
+ testSdncVFModel.setNfNamingCode(newNfNamingCode);
+ String result = testSdncVFModel.getNfNamingCode();
+ assertEquals(result, newNfNamingCode);
+ }
+
+ @Test
+ public void testSetGetServiceUUID() {
+ String newServiceUuid = "cccc-dddd-eeee-ffff";
+ testSdncVFModel.setServiceUUID(newServiceUuid);
+ String result = testSdncVFModel.getServiceUUID();
+ assertEquals(newServiceUuid, result);
+ }
+
+ @Test
+ public void testSetGetServiceInvariantUUID() {
+ String newServiceInvariantUuid = "dddd-eeee-ffff-eeee";
+ testSdncVFModel.setServiceInvariantUUID(newServiceInvariantUuid);
+ String result = testSdncVFModel.getServiceInvariantUUID();
+ assertEquals(result, newServiceInvariantUuid);
+ }
+
+ @Test
+ public void testInsertData() {
+ try {
+ testSdncVFModel.insertData();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ }