summaryrefslogtreecommitdiffstats
path: root/policy-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'policy-core/src')
-rw-r--r--policy-core/src/main/java/org/onap/policy/drools/core/PolicyContainer.java22
-rw-r--r--policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java52
-rw-r--r--policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureApi.java (renamed from policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureAPI.java)6
-rw-r--r--policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockManager.java12
-rw-r--r--policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureApiTest.java (renamed from policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureAPITest.java)8
-rw-r--r--policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockManagerTest.java16
6 files changed, 57 insertions, 59 deletions
diff --git a/policy-core/src/main/java/org/onap/policy/drools/core/PolicyContainer.java b/policy-core/src/main/java/org/onap/policy/drools/core/PolicyContainer.java
index f2a084e4..2c5d87f8 100644
--- a/policy-core/src/main/java/org/onap/policy/drools/core/PolicyContainer.java
+++ b/policy-core/src/main/java/org/onap/policy/drools/core/PolicyContainer.java
@@ -109,7 +109,7 @@ public class PolicyContainer implements Startable {
}
synchronized (containers) {
if (newReleaseId != null) {
- logger.info("Add a new kieContainer in containers: releaseId: {}", newReleaseId.toString());
+ logger.info("Add a new kieContainer in containers: releaseId: {}", newReleaseId);
} else {
logger.warn("input releaseId is null");
}
@@ -289,8 +289,8 @@ public class PolicyContainer implements Startable {
}
logger.info("activatePolicySession:new session was added in sessions with name {}", name);
}
- logger.info("activatePolicySession:session - " + (session == null ? "null" : session.getFullName())
- + " is returned.");
+ logger.info("activatePolicySession:session - {} is returned.",
+ session == null ? "null" : session.getFullName());
return session;
}
}
@@ -317,7 +317,7 @@ public class PolicyContainer implements Startable {
logger.warn("adoptKieSession:input kieSession is null");
throw new IllegalArgumentException("KieSession '" + name + "' is null " + getName());
} else {
- logger.info("adoptKieSession:name: " + name + " kieSession: " + kieSession);
+ logger.info("adoptKieSession:name: {} kieSession: {}", name, kieSession);
}
// fetch KieBase, and verify it belongs to this KieContainer
boolean match = false;
@@ -507,12 +507,12 @@ public class PolicyContainer implements Startable {
return rval;
}
- /*************************/
+ /*=======================*/
/* 'Startable' interface */
- /*************************/
+ /*=======================*/
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public synchronized boolean start() {
@@ -537,7 +537,7 @@ public class PolicyContainer implements Startable {
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public synchronized boolean stop() {
@@ -576,7 +576,7 @@ public class PolicyContainer implements Startable {
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public synchronized void shutdown() {
@@ -594,15 +594,13 @@ public class PolicyContainer implements Startable {
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public boolean isAlive() {
return isStarted;
}
- /*************************/
-
/**
* This method is similar to 'shutdown', but it also frees any persistence resources as well.
*/
diff --git a/policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java b/policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java
index bb2148c0..958933fb 100644
--- a/policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java
+++ b/policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java
@@ -232,12 +232,12 @@ public class PolicySession
}
}
- /***********************************/
+ /*=================================*/
/* 'AgendaEventListener' interface */
- /***********************************/
+ /*=================================*/
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public void afterMatchFired(AfterMatchFiredEvent event) {
@@ -249,7 +249,7 @@ public class PolicySession
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public void afterRuleFlowGroupActivated(RuleFlowGroupActivatedEvent event) {
@@ -261,7 +261,7 @@ public class PolicySession
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public void afterRuleFlowGroupDeactivated(RuleFlowGroupDeactivatedEvent event) {
@@ -273,7 +273,7 @@ public class PolicySession
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public void agendaGroupPopped(AgendaGroupPoppedEvent event) {
@@ -285,7 +285,7 @@ public class PolicySession
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public void agendaGroupPushed(AgendaGroupPushedEvent event) {
@@ -297,7 +297,7 @@ public class PolicySession
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public void beforeMatchFired(BeforeMatchFiredEvent event) {
@@ -309,7 +309,7 @@ public class PolicySession
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public void beforeRuleFlowGroupActivated(RuleFlowGroupActivatedEvent event) {
@@ -321,7 +321,7 @@ public class PolicySession
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public void beforeRuleFlowGroupDeactivated(RuleFlowGroupDeactivatedEvent event) {
@@ -333,7 +333,7 @@ public class PolicySession
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public void matchCancelled(MatchCancelledEvent event) {
@@ -344,7 +344,7 @@ public class PolicySession
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public void matchCreated(MatchCreatedEvent event) {
@@ -354,12 +354,12 @@ public class PolicySession
}
}
- /****************************************/
+ /*======================================*/
/* 'RuleRuntimeEventListener' interface */
- /****************************************/
+ /*======================================*/
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public void objectDeleted(ObjectDeletedEvent event) {
@@ -370,7 +370,7 @@ public class PolicySession
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public void objectInserted(ObjectInsertedEvent event) {
@@ -381,7 +381,7 @@ public class PolicySession
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public void objectUpdated(ObjectUpdatedEvent event) {
@@ -390,7 +390,7 @@ public class PolicySession
+ ": AgendaEventListener.objectUpdated(" + event + ")");
}
}
-
+
/* ============================================================ */
/**
@@ -451,12 +451,12 @@ public class PolicySession
return "Session " + session.getFullName();
}
- /***************************/
+ /*=========================*/
/* 'ThreadModel' interface */
- /***************************/
+ /*=========================*/
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public void start() {
@@ -465,7 +465,7 @@ public class PolicySession
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public void stop() {
@@ -486,7 +486,7 @@ public class PolicySession
}
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public void updated() {
@@ -494,12 +494,12 @@ public class PolicySession
thread.setName(getThreadName());
}
- /************************/
+ /*======================*/
/* 'Runnable' interface */
- /************************/
+ /*======================*/
/**
- * {@inheritDoc}
+ * {@inheritDoc}.
*/
@Override
public void run() {
diff --git a/policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureAPI.java b/policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureApi.java
index 105d6ec9..66766453 100644
--- a/policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureAPI.java
+++ b/policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureApi.java
@@ -35,14 +35,14 @@ import org.onap.policy.drools.utils.OrderedServiceImpl;
* For instance, they may choose to implement an engine-wide locking scheme, or they may
* choose to implement a global locking scheme (e.g., through a shared DB).
*/
-public interface PolicyResourceLockFeatureAPI extends OrderedService {
+public interface PolicyResourceLockFeatureApi extends OrderedService {
/**
* 'FeatureAPI.impl.getList()' returns an ordered list of objects implementing the
* 'FeatureAPI' interface.
*/
- public static OrderedServiceImpl<PolicyResourceLockFeatureAPI> impl =
- new OrderedServiceImpl<>(PolicyResourceLockFeatureAPI.class);
+ public static OrderedServiceImpl<PolicyResourceLockFeatureApi> impl =
+ new OrderedServiceImpl<>(PolicyResourceLockFeatureApi.class);
/**
* Result of a requested operation.
diff --git a/policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockManager.java b/policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockManager.java
index 3612b29d..33f4668c 100644
--- a/policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockManager.java
+++ b/policy-core/src/main/java/org/onap/policy/drools/core/lock/PolicyResourceLockManager.java
@@ -23,7 +23,7 @@ package org.onap.policy.drools.core.lock;
import java.util.List;
import java.util.function.Function;
import java.util.function.Supplier;
-import org.onap.policy.drools.core.lock.PolicyResourceLockFeatureAPI.OperResult;
+import org.onap.policy.drools.core.lock.PolicyResourceLockFeatureApi.OperResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -184,7 +184,7 @@ public class PolicyResourceLockManager extends SimpleLockManager {
* @param defaultFunc default function
* @return {@code true} if success, {@code false} otherwise
*/
- private boolean doBoolIntercept(Function<PolicyResourceLockFeatureAPI, OperResult> interceptFunc,
+ private boolean doBoolIntercept(Function<PolicyResourceLockFeatureApi, OperResult> interceptFunc,
Supplier<Boolean> defaultFunc) {
OperResult result = doIntercept(OperResult.OPER_UNHANDLED, interceptFunc);
@@ -205,9 +205,9 @@ public class PolicyResourceLockManager extends SimpleLockManager {
* @return first non-null value returned by an implementer, <i>continueValue</i> if
* they all returned <i>continueValue</i>
*/
- private static <T> T doIntercept(T continueValue, Function<PolicyResourceLockFeatureAPI, T> func) {
+ private static <T> T doIntercept(T continueValue, Function<PolicyResourceLockFeatureApi, T> func) {
- for (PolicyResourceLockFeatureAPI impl : factory.getImplementers()) {
+ for (PolicyResourceLockFeatureApi impl : factory.getImplementers()) {
try {
T result = func.apply(impl);
if (result != continueValue) {
@@ -248,8 +248,8 @@ public class PolicyResourceLockManager extends SimpleLockManager {
*
* @return the list of feature implementers
*/
- public List<PolicyResourceLockFeatureAPI> getImplementers() {
- return PolicyResourceLockFeatureAPI.impl.getList();
+ public List<PolicyResourceLockFeatureApi> getImplementers() {
+ return PolicyResourceLockFeatureApi.impl.getList();
}
}
}
diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureAPITest.java b/policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureApiTest.java
index 522a3f51..999ae50f 100644
--- a/policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureAPITest.java
+++ b/policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockFeatureApiTest.java
@@ -25,21 +25,21 @@ import static org.junit.Assert.assertFalse;
import org.junit.Before;
import org.junit.Test;
-import org.onap.policy.drools.core.lock.PolicyResourceLockFeatureAPI.OperResult;
+import org.onap.policy.drools.core.lock.PolicyResourceLockFeatureApi.OperResult;
-public class PolicyResourceLockFeatureAPITest {
+public class PolicyResourceLockFeatureApiTest {
private static final String RESOURCE_ID = "the resource";
private static final String OWNER = "the owner";
- private PolicyResourceLockFeatureAPI api;
+ private PolicyResourceLockFeatureApi api;
/**
* set up.
*/
@Before
public void setUp() {
- api = new PolicyResourceLockFeatureAPI() {
+ api = new PolicyResourceLockFeatureApi() {
@Override
public int getSequenceNumber() {
return 0;
diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockManagerTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockManagerTest.java
index 962fb96a..8acafccf 100644
--- a/policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockManagerTest.java
+++ b/policy-core/src/test/java/org/onap/policy/drools/core/lock/PolicyResourceLockManagerTest.java
@@ -41,7 +41,7 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.onap.policy.drools.core.lock.PolicyResourceLockFeatureAPI.OperResult;
+import org.onap.policy.drools.core.lock.PolicyResourceLockFeatureApi.OperResult;
import org.onap.policy.drools.core.lock.PolicyResourceLockManager.Factory;
public class PolicyResourceLockManagerTest {
@@ -64,9 +64,9 @@ public class PolicyResourceLockManagerTest {
*/
private static Factory saveFactory;
- private PolicyResourceLockFeatureAPI impl1;
- private PolicyResourceLockFeatureAPI impl2;
- private List<PolicyResourceLockFeatureAPI> implList;
+ private PolicyResourceLockFeatureApi impl1;
+ private PolicyResourceLockFeatureApi impl2;
+ private List<PolicyResourceLockFeatureApi> implList;
private PolicyResourceLockManager mgr;
@@ -85,8 +85,8 @@ public class PolicyResourceLockManagerTest {
*/
@Before
public void setUp() {
- impl1 = mock(PolicyResourceLockFeatureAPI.class);
- impl2 = mock(PolicyResourceLockFeatureAPI.class);
+ impl1 = mock(PolicyResourceLockFeatureApi.class);
+ impl2 = mock(PolicyResourceLockFeatureApi.class);
initImplementer(impl1);
initImplementer(impl2);
@@ -97,7 +97,7 @@ public class PolicyResourceLockManagerTest {
PolicyResourceLockManager.setFactory(new Factory() {
@Override
- public List<PolicyResourceLockFeatureAPI> getImplementers() {
+ public List<PolicyResourceLockFeatureApi> getImplementers() {
return implList;
}
});
@@ -110,7 +110,7 @@ public class PolicyResourceLockManagerTest {
*
* @param impl implementer
*/
- private void initImplementer(PolicyResourceLockFeatureAPI impl) {
+ private void initImplementer(PolicyResourceLockFeatureApi impl) {
when(impl.beforeLock(anyString(), anyString(), anyInt())).thenReturn(OperResult.OPER_UNHANDLED);
when(impl.beforeRefresh(anyString(), anyString(), anyInt())).thenReturn(OperResult.OPER_UNHANDLED);
when(impl.beforeUnlock(anyString(), anyString())).thenReturn(OperResult.OPER_UNHANDLED);