summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2018-09-21 16:11:46 -0400
committerJim Hahn <jrh3@att.com>2018-09-21 16:11:46 -0400
commit4f77be6b3524aefe5763393babc2ffdcb64cf72e (patch)
tree64dc8ce1659f34aab6f17853ab3228d3d7e7dec0
parent88d1b6ccc92a42c94c2cd462789a90fcf245efb2 (diff)
new sonar issues in drools-pdp
No "@Test" methods - renamed class from XxxTest to XxxMock. Changed functional call syntax. Change-Id: I954c2549705e80c00aed8ecbcb19f386cc8b0310 Issue-ID: POLICY-1137 Signed-off-by: Jim Hahn <jrh3@att.com>
-rw-r--r--feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/State.java2
-rw-r--r--policy-core/src/test/java/org/onap/policy/drools/core/DroolsContainerTest.java22
-rw-r--r--policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionFeatureApiMock.java (renamed from policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionFeatureApiTest.java)2
-rw-r--r--policy-core/src/test/resources/META-INF/services/org.onap.policy.drools.core.PolicySessionFeatureAPI2
4 files changed, 14 insertions, 14 deletions
diff --git a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/State.java b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/State.java
index edffb3fe..3d939392 100644
--- a/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/State.java
+++ b/feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/state/State.java
@@ -86,7 +86,7 @@ public abstract class State {
* Cancels the timers added by this state.
*/
public final void cancelTimers() {
- timers.forEach(timer -> timer.cancel());
+ timers.forEach(CancellableScheduledTask::cancel);
}
/**
diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/DroolsContainerTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/DroolsContainerTest.java
index d2d0dec2..76fa1350 100644
--- a/policy-core/src/test/java/org/onap/policy/drools/core/DroolsContainerTest.java
+++ b/policy-core/src/test/java/org/onap/policy/drools/core/DroolsContainerTest.java
@@ -67,12 +67,12 @@ public class DroolsContainerTest {
@Test
public void createAndUpdate() throws Exception {
// make sure feature log starts out clean
- PolicySessionFeatureApiTest.getLog();
+ PolicySessionFeatureApiMock.getLog();
// run 'globalInit', and verify expected feature hook fired
PolicyContainer.globalInit(new String[0]);
assertEquals(Arrays.asList("globalInit"),
- PolicySessionFeatureApiTest.getLog());
+ PolicySessionFeatureApiMock.getLog());
// initial conditions -- there should be no containers
assertEquals(0, PolicyContainer.getPolicyContainers().size());
@@ -88,7 +88,7 @@ public class DroolsContainerTest {
assertEquals(Arrays.asList("activatePolicySession",
"newPolicySession",
"selectThreadModel"),
- PolicySessionFeatureApiTest.getLog());
+ PolicySessionFeatureApiMock.getLog());
// this container should be on the list
{
@@ -137,7 +137,7 @@ public class DroolsContainerTest {
// verify expected feature hooks fired
assertEquals(Arrays.asList("selectThreadModel"),
- PolicySessionFeatureApiTest.getLog());
+ PolicySessionFeatureApiMock.getLog());
// verify new container attributes
assertEquals("org.onap.policy.drools-pdp:drools-artifact1:17.2.0-SNAPSHOT",
@@ -163,7 +163,7 @@ public class DroolsContainerTest {
// verify expected feature hooks fired
assertEquals(Arrays.asList("disposeKieSession"),
- PolicySessionFeatureApiTest.getLog());
+ PolicySessionFeatureApiMock.getLog());
}
// final conditions -- there should be no containers
@@ -179,15 +179,15 @@ public class DroolsContainerTest {
@Test
public void versionList() throws Exception {
// make sure feature log starts out clean
- PolicySessionFeatureApiTest.getLog();
+ PolicySessionFeatureApiMock.getLog();
// trigger exceptions in all feature hooks
- PolicySessionFeatureApiTest.setExceptionTrigger(true);
+ PolicySessionFeatureApiMock.setExceptionTrigger(true);
// run 'globalInit', and verify expected feature hook fired
PolicyContainer.globalInit(new String[0]);
assertEquals(Arrays.asList("globalInit-exception"),
- PolicySessionFeatureApiTest.getLog());
+ PolicySessionFeatureApiMock.getLog());
// initial conditions -- there should be no containers
assertEquals(0, PolicyContainer.getPolicyContainers().size());
@@ -208,7 +208,7 @@ public class DroolsContainerTest {
assertEquals(Arrays.asList("activatePolicySession-exception",
"newPolicySession-exception",
"selectThreadModel-exception"),
- PolicySessionFeatureApiTest.getLog());
+ PolicySessionFeatureApiMock.getLog());
// this container should be on the list
{
@@ -292,10 +292,10 @@ public class DroolsContainerTest {
// verify expected feature hooks fired
assertEquals(Arrays.asList("destroyKieSession-exception"),
- PolicySessionFeatureApiTest.getLog());
+ PolicySessionFeatureApiMock.getLog());
// clear exception trigger
- PolicySessionFeatureApiTest.setExceptionTrigger(false);
+ PolicySessionFeatureApiMock.setExceptionTrigger(false);
}
// final conditions -- there should be no containers
diff --git a/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionFeatureApiTest.java b/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionFeatureApiMock.java
index aef4e265..d838f6bd 100644
--- a/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionFeatureApiTest.java
+++ b/policy-core/src/test/java/org/onap/policy/drools/core/PolicySessionFeatureApiMock.java
@@ -28,7 +28,7 @@ import org.kie.api.runtime.KieSession;
* 'PolicySessionFeatureAPI', and providing a means to indicate
* which hooks have been invoked.
*/
-public class PolicySessionFeatureApiTest implements PolicySessionFeatureAPI {
+public class PolicySessionFeatureApiMock implements PolicySessionFeatureAPI {
// contains the log entries since the most recent 'getLog()' call
private static ArrayList<String> log = new ArrayList<>();
diff --git a/policy-core/src/test/resources/META-INF/services/org.onap.policy.drools.core.PolicySessionFeatureAPI b/policy-core/src/test/resources/META-INF/services/org.onap.policy.drools.core.PolicySessionFeatureAPI
index 6bc87035..3af9beea 100644
--- a/policy-core/src/test/resources/META-INF/services/org.onap.policy.drools.core.PolicySessionFeatureAPI
+++ b/policy-core/src/test/resources/META-INF/services/org.onap.policy.drools.core.PolicySessionFeatureAPI
@@ -1 +1 @@
-org.onap.policy.drools.core.PolicySessionFeatureApiTest
+org.onap.policy.drools.core.PolicySessionFeatureApiMock