summaryrefslogtreecommitdiffstats
path: root/ueb-listener/src/main
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/src/main
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/src/main')
-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
2 files changed, 16 insertions, 26 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 fd5a2963..7f0e9398 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 35639b36..5977e288 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