aboutsummaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-11-15 13:35:42 +0000
committerliamfallon <liam.fallon@est.tech>2019-11-15 15:23:42 +0000
commitd4e3a1b394715c6386f963130e4e081d421ecd1b (patch)
tree1ef224fb04c4d5e93f02f33ef38994b04e52bdf6 /POLICY-SDK-APP
parentd79badf67d5c253eb9883ac823626d7efa16c731 (diff)
Unit/SONAR/Checkstyle in ONAP-REST
Fifth and final batch of JPA pojos (Q-Z), with JUnit added and SONAR/Checkstyle issues addressed. In cases where a class name change caused an update in another package, the license header on files for those knock on changes are not updated. Issue-ID: POLICY-2131 Change-Id: I1cc536a5b8a0cd3c6beff068dd72381f7ae10d12 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'POLICY-SDK-APP')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java4
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java2
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java22
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/dao/SystemLogDbDao.java6
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java18
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java10
-rw-r--r--POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java6
7 files changed, 34 insertions, 34 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java
index 82583c5f5..ef6b98803 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/conf/HibernateSession.java
@@ -32,7 +32,7 @@ import org.hibernate.cfg.Configuration;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.controller.PolicyController;
-import org.onap.policy.rest.jpa.SystemLogDB;
+import org.onap.policy.rest.jpa.SystemLogDb;
@SuppressWarnings("deprecation")
public class HibernateSession {
@@ -51,7 +51,7 @@ public class HibernateSession {
prop.setProperty("hibernate.connection.driver_class", PolicyController.getLogdbDriver());
prop.setProperty("show_sql", "false");
logSessionFactory = new Configuration().addPackage("org.onap.policy.*").addProperties(prop)
- .addAnnotatedClass(SystemLogDB.class).buildSessionFactory();
+ .addAnnotatedClass(SystemLogDb.class).buildSessionFactory();
} catch (Exception ex) {
LOGGER.error("Exception Occured while creating Log database Hibernate session" + ex);
}
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java
index a7a03c021..58765ded1 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java
@@ -366,7 +366,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController {
try {
varbindId =
(VarbindDictionary) commonclassdao.getEntityItem(VarbindDictionary.class, "varbindName", attrib);
- return varbindId.getVarbindOID();
+ return varbindId.getVarbindOid();
} catch (Exception e) {
policyLogger.error("Error during retrieving varbindName " + attrib, e);
return attrib;
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java
index 446e124ed..3da703ab2 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateFirewallController.java
@@ -321,9 +321,9 @@ public class CreateFirewallController extends RestrictedBaseController {
List<Object> tmList = commonClassDao.getDataById(TermList.class, "termName", id);
jpaTermList = (TermList) tmList.get(0);
if (jpaTermList != null) {
- ruleSrcList = jpaTermList.getSrcIPList();
+ ruleSrcList = jpaTermList.getSrcIpList();
if ((ruleSrcList != null) && (!ruleSrcList.isEmpty()) && !"null".equals(ruleSrcList)) {
- displayString.append("Source IP List: " + jpaTermList.getSrcIPList());
+ displayString.append("Source IP List: " + jpaTermList.getSrcIpList());
displayString.append(" ; \t\n");
for (String srcList : ruleSrcList.split(",")) {
if (srcList.startsWith(GROUP)) {
@@ -354,9 +354,9 @@ public class CreateFirewallController extends RestrictedBaseController {
}
displayString.append("\n");
}
- ruleDestList = jpaTermList.getDestIPList();
+ ruleDestList = jpaTermList.getDestIpList();
if (ruleDestList != null && (!ruleDestList.isEmpty()) && !"null".equals(ruleDestList)) {
- displayString.append("Destination IP List: " + jpaTermList.getDestIPList());
+ displayString.append("Destination IP List: " + jpaTermList.getDestIpList());
displayString.append(" ; \t\n");
for (String destList : ruleDestList.split(",")) {
if (destList.startsWith(GROUP)) {
@@ -409,7 +409,7 @@ public class CreateFirewallController extends RestrictedBaseController {
displayString.append("\n\t" + "Name: " + sl.getServiceName());
displayString.append("\n\t" + "Description: " + sl.getServiceDescription());
displayString.append(
- "\n\t" + "Transport-Protocol: " + sl.getServiceTransProtocol());
+ "\n\t" + "Transport-Protocol: " + sl.getServiceTransportProtocol());
displayString.append("\n\t" + "Ports: " + sl.getServicePorts());
displayString.append("\n");
}
@@ -421,7 +421,7 @@ public class CreateFirewallController extends RestrictedBaseController {
displayString.append("\n\t" + "Name: " + sl.getServiceName());
displayString.append("\n\t" + "Description: " + sl.getServiceDescription());
displayString
- .append("\n\t" + "Transport-Protocol: " + sl.getServiceTransProtocol());
+ .append("\n\t" + "Transport-Protocol: " + sl.getServiceTransportProtocol());
displayString.append("\n\t" + "Ports: " + sl.getServicePorts());
displayString.append("\n");
}
@@ -529,7 +529,7 @@ public class CreateFirewallController extends RestrictedBaseController {
for (int j = 0; j < termListData.size(); j++) {
jpaTermList = (TermList) termListData.get(j);
if (jpaTermList.getTermName().equals(termCollectorList.get(tl))) {
- ruleDesc = jpaTermList.getTermDescription();
+ ruleDesc = jpaTermList.getDescription();
if ((ruleDesc != null) && (!ruleDesc.isEmpty())) {
targetTerm.setDescription(ruleDesc);
}
@@ -545,14 +545,14 @@ public class CreateFirewallController extends RestrictedBaseController {
mapToZone = new HashMap<>();
mapToZone.put(tl, ruleToZone);
}
- ruleSrcPrefixList = jpaTermList.getSrcIPList();
+ ruleSrcPrefixList = jpaTermList.getSrcIpList();
if ((ruleSrcPrefixList != null) && (!ruleSrcPrefixList.isEmpty())) {
mapSrcIp = new HashMap<>();
mapSrcIp.put(tl, ruleSrcPrefixList);
}
- ruleDestPrefixList = jpaTermList.getDestIPList();
+ ruleDestPrefixList = jpaTermList.getDestIpList();
if ((ruleDestPrefixList != null) && (!ruleDestPrefixList.isEmpty())) {
mapDestIP = new HashMap<>();
mapDestIP.put(tl, ruleDestPrefixList);
@@ -741,7 +741,7 @@ public class CreateFirewallController extends RestrictedBaseController {
sl = mappingServiceList(t);
targetSl.setName(sl.getServiceName());
targetSl.setDescription(sl.getServiceDescription());
- targetSl.setTransportProtocol(sl.getServiceTransProtocol());
+ targetSl.setTransportProtocol(sl.getServiceTransportProtocol());
targetSl.setType(sl.getServiceType());
targetSl.setPorts(sl.getServicePorts());
servListArray.add(targetSl);
@@ -794,7 +794,7 @@ public class CreateFirewallController extends RestrictedBaseController {
targetSl.setName(expandGroupSl.getServiceName());
targetSl.setDescription(expandGroupSl.getServiceDescription());
- targetSl.setTransportProtocol(expandGroupSl.getServiceTransProtocol());
+ targetSl.setTransportProtocol(expandGroupSl.getServiceTransportProtocol());
targetSl.setType(expandGroupSl.getServiceType());
targetSl.setPorts(expandGroupSl.getServicePorts());
servListArray.add(targetSl);
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/dao/SystemLogDbDao.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/dao/SystemLogDbDao.java
index 3c3f4d397..8883475b8 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/dao/SystemLogDbDao.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/dao/SystemLogDbDao.java
@@ -22,10 +22,10 @@ package org.onap.policy.dao;
import java.util.List;
-import org.onap.policy.rest.jpa.SystemLogDB;
+import org.onap.policy.rest.jpa.SystemLogDb;
public abstract interface SystemLogDbDao {
- public abstract List<SystemLogDB> getLoggingData();
+ public abstract List<SystemLogDb> getLoggingData();
- public abstract List<SystemLogDB> getSystemAlertData();
+ public abstract List<SystemLogDb> getSystemAlertData();
}
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java
index 768a7a41c..46aed213f 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java
@@ -31,7 +31,7 @@ import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.conf.HibernateSession;
import org.onap.policy.controller.PolicyController;
import org.onap.policy.dao.SystemLogDbDao;
-import org.onap.policy.rest.jpa.SystemLogDB;
+import org.onap.policy.rest.jpa.SystemLogDb;
import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.springframework.stereotype.Service;
@@ -41,10 +41,10 @@ public class SystemLogDbDaoImpl implements SystemLogDbDao {
@SuppressWarnings("unchecked")
@Override
- public List<SystemLogDB> getLoggingData() {
+ public List<SystemLogDb> getLoggingData() {
Session session = HibernateSession.getSession();
Transaction tx = session.beginTransaction();
- List<SystemLogDB> system = null;
+ List<SystemLogDb> system = null;
try {
String sqlWhere = null;
if (PolicyController.isjUnit()) {
@@ -53,12 +53,12 @@ public class SystemLogDbDaoImpl implements SystemLogDbDao {
sqlWhere = "date > DATE_SUB(curdate(), INTERVAL 5 DAY) ORDER BY date DESC limit "
+ PolicyController.getLogTableLimit() + "";
}
- Criteria cr = session.createCriteria(SystemLogDB.class);
+ Criteria cr = session.createCriteria(SystemLogDb.class);
cr.add(Restrictions.sqlRestriction(sqlWhere));
system = cr.list();
tx.commit();
} catch (Exception e) {
- logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying SystemLogDB Table" + e);
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying SystemLogDb Table" + e);
} finally {
try {
session.close();
@@ -71,10 +71,10 @@ public class SystemLogDbDaoImpl implements SystemLogDbDao {
@SuppressWarnings("unchecked")
@Override
- public List<SystemLogDB> getSystemAlertData() {
+ public List<SystemLogDb> getSystemAlertData() {
Session session = HibernateSession.getSession();
Transaction tx = session.beginTransaction();
- List<SystemLogDB> system = null;
+ List<SystemLogDb> system = null;
try {
String sqlWhere = null;
if (PolicyController.isjUnit()) {
@@ -83,12 +83,12 @@ public class SystemLogDbDaoImpl implements SystemLogDbDao {
sqlWhere = "date > DATE_SUB(curdate(), INTERVAL 5 DAY) and logtype = 'error' ORDER BY date DESC limit "
+ PolicyController.getSystemAlertTableLimit() + "";
}
- Criteria cr = session.createCriteria(SystemLogDB.class);
+ Criteria cr = session.createCriteria(SystemLogDb.class);
cr.add(Restrictions.sqlRestriction(sqlWhere));
system = cr.list();
tx.commit();
} catch (Exception e) {
- logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying SystemLogDB Table" + e);
+ logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error While Querying SystemLogDb Table" + e);
} finally {
try {
session.close();
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java
index 77d66367b..e9b631f11 100644
--- a/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/admin/PolicyRestControllerTest.java
@@ -170,7 +170,7 @@ public class PolicyRestControllerTest {
ServiceList serviceList = new ServiceList();
serviceList.setServiceName("Test");
serviceList.setServiceType("SERVICE");
- serviceList.setServiceTransProtocol("Test");
+ serviceList.setServiceTransportProtocol("Test");
serviceList.setServiceAppProtocol("Test");
serviceList.setServicePorts("8080");
serviceListData.add(serviceList);
@@ -207,10 +207,10 @@ public class PolicyRestControllerTest {
termListData = new ArrayList<>();
TermList termList = new TermList();
termList.setTermName("Test");
- termList.setFromZones("Test");
- termList.setToZones("Test");
- termList.setSrcIPList("Test");
- termList.setDestIPList("Test");
+ termList.setFromZone("Test");
+ termList.setToZone("Test");
+ termList.setSrcIpList("Test");
+ termList.setDestIpList("Test");
termList.setSrcPortList("Test");
termList.setDestPortList("Test");
termList.setAction("Test");
diff --git a/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java b/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java
index 0a9f9a3c0..3453f6acc 100644
--- a/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java
+++ b/POLICY-SDK-APP/src/test/java/org/onap/policy/daoImp/CommonClassDaoImplTest.java
@@ -49,7 +49,7 @@ import org.onap.policy.rest.jpa.OnapName;
import org.onap.policy.rest.jpa.PolicyEntity;
import org.onap.policy.rest.jpa.PolicyRoles;
import org.onap.policy.rest.jpa.PolicyVersion;
-import org.onap.policy.rest.jpa.SystemLogDB;
+import org.onap.policy.rest.jpa.SystemLogDb;
import org.onap.policy.rest.jpa.UserInfo;
import org.onap.policy.rest.jpa.WatchPolicyNotificationTable;
import org.springframework.orm.hibernate4.LocalSessionFactoryBuilder;
@@ -95,13 +95,13 @@ public class CommonClassDaoImplTest {
CommonClassDaoImpl.setSessionfactory(sessionFactory);
PolicyController.setLogTableLimit("1");
HibernateSession.setSession(sessionFactory);
- SystemLogDB data1 = new SystemLogDB();
+ SystemLogDb data1 = new SystemLogDb();
data1.setDate(new Date());
data1.setLogtype("INFO");
data1.setRemote("Test");
data1.setSystem("Test");
data1.setType("Test");
- SystemLogDB data2 = new SystemLogDB();
+ SystemLogDb data2 = new SystemLogDb();
data2.setDate(new Date());
data2.setLogtype("error");
data2.setRemote("Test");