summaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/daoImp/SystemLogDbDaoImpl.java25
1 files changed, 23 insertions, 2 deletions
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 4fa64ceb3..49024ba0d 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
@@ -42,6 +42,17 @@ import org.onap.policy.common.logging.flexlogger.Logger;
@Service("SystemLogDbDao")
public class SystemLogDbDaoImpl implements SystemLogDbDao {
private static final Logger logger = FlexLogger.getLogger(SystemLogDbDaoImpl.class);
+
+ private static boolean jUnit = false;
+
+ public static boolean isjUnit() {
+ return jUnit;
+ }
+
+ public static void setjUnit(boolean jUnit) {
+ SystemLogDbDaoImpl.jUnit = jUnit;
+ }
+
@SuppressWarnings("unchecked")
@Override
public List<SystemLogDB> getLoggingData() {
@@ -49,7 +60,12 @@ public class SystemLogDbDaoImpl implements SystemLogDbDao {
Transaction tx = session.beginTransaction();
List<SystemLogDB> system = null;
try {
- String sqlWhere = "date > DATE_SUB(curdate(), INTERVAL 5 DAY) ORDER BY date DESC limit "+PolicyController.getLogTableLimit()+"";
+ String sqlWhere = null;
+ if(jUnit){
+ sqlWhere = "";
+ }else{
+ sqlWhere = "date > DATE_SUB(curdate(), INTERVAL 5 DAY) ORDER BY date DESC limit "+PolicyController.getLogTableLimit()+"";
+ }
Criteria cr = session.createCriteria(SystemLogDB.class);
cr.add(Restrictions.sqlRestriction(sqlWhere));
system = cr.list();
@@ -73,7 +89,12 @@ public class SystemLogDbDaoImpl implements SystemLogDbDao {
Transaction tx = session.beginTransaction();
List<SystemLogDB> system = null;
try {
- String sqlWhere = "date > DATE_SUB(curdate(), INTERVAL 5 DAY) and logtype = 'error' ORDER BY date DESC limit "+PolicyController.getSystemAlertTableLimit()+"";
+ String sqlWhere = null;
+ if(jUnit){
+ sqlWhere = "";
+ }else{
+ sqlWhere = "date > DATE_SUB(curdate(), INTERVAL 5 DAY) and logtype = 'error' ORDER BY date DESC limit "+PolicyController.getSystemAlertTableLimit()+"";
+ }
Criteria cr = session.createCriteria(SystemLogDB.class);
cr.add(Restrictions.sqlRestriction(sqlWhere));
system = cr.list();