summaryrefslogtreecommitdiffstats
path: root/feature-session-persistence
diff options
context:
space:
mode:
Diffstat (limited to 'feature-session-persistence')
-rw-r--r--feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsPersistenceProperties.java2
-rw-r--r--feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSessionEntity.java9
-rw-r--r--feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java26
-rw-r--r--feature-session-persistence/src/test/resources/logback-test.xml33
4 files changed, 40 insertions, 30 deletions
diff --git a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsPersistenceProperties.java b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsPersistenceProperties.java
index fabcbc03..1c935b0c 100644
--- a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsPersistenceProperties.java
+++ b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsPersistenceProperties.java
@@ -21,6 +21,8 @@
package org.onap.policy.drools.persistence;
public class DroolsPersistenceProperties {
+ private DroolsPersistenceProperties() {
+ }
/*
* feature-session-persistence.properties parameter key values
*/
diff --git a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSessionEntity.java b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSessionEntity.java
index 71f5ec9a..e9c5b33b 100644
--- a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSessionEntity.java
+++ b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSessionEntity.java
@@ -91,22 +91,23 @@ public class DroolsSessionEntity implements Serializable, DroolsSession {
public void setSessionId(long sessionId) {
this.sessionId = sessionId;
}
-
+
+ @Override
public Date getCreatedDate() {
return createdDate;
}
-
+ @Override
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
-
+ @Override
public Date getUpdatedDate() {
return updatedDate;
}
-
+ @Override
public void setUpdatedDate(Date updatedDate) {
this.updatedDate = updatedDate;
}
diff --git a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java
index b48690b0..db33d05a 100644
--- a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java
+++ b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java
@@ -143,7 +143,7 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
policyContainer.setAdjunct(this, rval);
}
- return ((ContainerAdjunct) rval);
+ return (ContainerAdjunct) rval;
}
/**
@@ -151,7 +151,7 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
*/
@Override
public int getSequenceNumber() {
- return (1);
+ return 1;
}
/**
@@ -201,9 +201,9 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
public PolicySession.ThreadModel selectThreadModel(PolicySession session) {
PolicyContainer policyContainer = session.getPolicyContainer();
if (isPersistenceEnabled(policyContainer, session.getName())) {
- return (new PersistentThreadModel(session, getProperties(policyContainer)));
+ return new PersistentThreadModel(session, getProperties(policyContainer));
}
- return (null);
+ return null;
}
/**
@@ -372,8 +372,8 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
KieSessionConfiguration kConf = kieSvcFact.newKieSessionConfiguration();
- KieSession kieSession = (desiredSessionId >= 0 ? loadKieSession(kieBaseName, desiredSessionId, env, kConf)
- : null);
+ KieSession kieSession = desiredSessionId >= 0 ? loadKieSession(kieBaseName, desiredSessionId, env, kConf)
+ : null;
if (kieSession == null) {
// loadKieSession() returned null or desiredSessionId < 0
@@ -609,7 +609,7 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
*/
private long getSessionId(DroolsSessionConnector conn, String sessnm) {
DroolsSession sess = conn.get(sessnm);
- return (sess != null ? sess.getSessionId() : -1);
+ return sess != null ? sess.getSessionId() : -1;
}
/**
@@ -650,10 +650,10 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
if (properties != null) {
// fetch the 'type' property
String type = getProperty(properties, sessionName, "type");
- rval = ("auto".equals(type) || "native".equals(type));
+ rval = "auto".equals(type) || "native".equals(type);
}
- return (rval);
+ return rval;
}
/**
@@ -665,10 +665,10 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
*/
private Properties getProperties(PolicyContainer container) {
try {
- return (fact.getPolicyContainer(container).getProperties());
+ return fact.getPolicyContainer(container).getProperties();
} catch (IllegalArgumentException e) {
logger.error("getProperties exception: ", e);
- return (null);
+ return null;
}
}
@@ -694,7 +694,7 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
value = properties.getProperty("persistence." + property);
}
- return (value);
+ return value;
}
/* ============================================================ */
@@ -790,7 +790,7 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
* @return the String to use as the thread name
*/
private String getThreadName() {
- return ("Session " + session.getFullName() + " (persistent)");
+ return "Session " + session.getFullName() + " (persistent)";
}
/***************************/
diff --git a/feature-session-persistence/src/test/resources/logback-test.xml b/feature-session-persistence/src/test/resources/logback-test.xml
index 5aeaf90f..6e919eb9 100644
--- a/feature-session-persistence/src/test/resources/logback-test.xml
+++ b/feature-session-persistence/src/test/resources/logback-test.xml
@@ -22,18 +22,25 @@
<configuration>
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
- <Pattern>
- %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M\(%line\) - %msg%n
- </Pattern>
- </encoder>
- </appender>
-
- <logger name="org.onap.policy.drools.persistence" level="INFO"/>
-
- <root level="warn">
- <appender-ref ref="STDOUT"/>
- </root>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+ <Pattern>
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M\(%line\) - %msg%n
+ </Pattern>
+ </encoder>
+ </appender>
+ <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <file>logs/debug.log</file>
+ <encoder>
+ <Pattern>
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M\(%line\) - %msg%n
+ </Pattern>
+ </encoder>
+ </appender>
+
+ <root level="debug">
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="FILE" />
+ </root>
</configuration>