summaryrefslogtreecommitdiffstats
path: root/examples/examples-aadm
diff options
context:
space:
mode:
authorRam Krishna Verma <ram_krishna.verma@bell.ca>2020-07-14 15:17:25 +0000
committerGerrit Code Review <gerrit@onap.org>2020-07-14 15:17:25 +0000
commit592e04f6301dd38ae48d38501cc251fc3d5ad2fb (patch)
treef2e2abc1a89a51ee348a3aee5fa2f87c9ffb4f5a /examples/examples-aadm
parent9a306c4444ca86f409d40b2e032ab2a12f3031ff (diff)
parentaa987aab348f13d477c6cf32e61689d396ebfba5 (diff)
Merge "Fix assertTrue SONAR issues in apex-pdp/examples and apex-pdp/model"
Diffstat (limited to 'examples/examples-aadm')
-rw-r--r--examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java5
-rw-r--r--examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmUseCaseTest.java25
2 files changed, 16 insertions, 14 deletions
diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java
index a44a4cc1a..fe9914061 100644
--- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java
+++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmModelTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +21,7 @@
package org.onap.policy.apex.examples.aadm;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
@@ -44,7 +45,7 @@ public class AadmModelTest {
@Test
public void testModelValid() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValid();
- assertTrue(result.toString().equals(VALID_MODEL_STRING));
+ assertEquals(VALID_MODEL_STRING, result.toString());
}
@Test
diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmUseCaseTest.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmUseCaseTest.java
index 8e05aff51..430074ea8 100644
--- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmUseCaseTest.java
+++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmUseCaseTest.java
@@ -22,6 +22,7 @@
package org.onap.policy.apex.examples.aadm;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -157,7 +158,7 @@ public class AadmUseCaseTest {
assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
// no DOS_IN_eNodeB set so return probe action
- assertTrue(result.get("ACTTASK").equals("probe"));
+ assertEquals("probe", result.get("ACTTASK"));
assertTrue((boolean) result.get("TCP_ON"));
assertTrue((boolean) result.get("PROBE_ON"));
logger.info("Receiving action event with {} action", result.get("ACTTASK"));
@@ -195,7 +196,7 @@ public class AadmUseCaseTest {
assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
// DOS_IN_eNodeB set to be more than throughput so return act action
- assertTrue(result.get("ACTTASK").equals("act"));
+ assertEquals("act", result.get("ACTTASK"));
// only one imsi was sent to process, so stop probe and tcp
assertTrue(!(boolean) result.get("TCP_ON"));
assertTrue(!(boolean) result.get("PROBE_ON"));
@@ -232,7 +233,7 @@ public class AadmUseCaseTest {
result = listener.getResult();
assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
- assertTrue(result.get("ACTTASK").equals("probe"));
+ assertEquals("probe", result.get("ACTTASK"));
assertTrue((boolean) result.get("TCP_ON"));
assertTrue((boolean) result.get("PROBE_ON"));
assertEquals(99, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
@@ -267,7 +268,7 @@ public class AadmUseCaseTest {
result = listener.getResult();
assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
- assertTrue(result.get("ACTTASK").equals("act"));
+ assertEquals("act", result.get("ACTTASK"));
assertTrue(!(boolean) result.get("TCP_ON"));
assertTrue(!(boolean) result.get("PROBE_ON"));
assertEquals(98, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
@@ -304,7 +305,7 @@ public class AadmUseCaseTest {
result = listener.getResult();
assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
- assertTrue(result.get("ACTTASK").equals("act"));
+ assertEquals("act", result.get("ACTTASK"));
assertTrue(!(boolean) result.get("TCP_ON"));
assertTrue(!(boolean) result.get("PROBE_ON"));
assertEquals(100, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
@@ -337,7 +338,7 @@ public class AadmUseCaseTest {
result = listener.getResult();
assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
- assertTrue(result.get("ACTTASK").equals("probe"));
+ assertEquals("probe", result.get("ACTTASK"));
assertTrue((boolean) result.get("TCP_ON"));
assertTrue((boolean) result.get("PROBE_ON"));
assertEquals(99, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
@@ -375,7 +376,7 @@ public class AadmUseCaseTest {
result = listener.getResult();
assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
- assertTrue(result.get("ACTTASK").equals("probe"));
+ assertEquals("probe", result.get("ACTTASK"));
assertTrue((boolean) result.get("TCP_ON"));
assertTrue((boolean) result.get("PROBE_ON"));
assertEquals(102, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
@@ -408,7 +409,7 @@ public class AadmUseCaseTest {
result = listener.getResult();
assertTrue(result.getName().startsWith("XSTREAM_AADM_ACT_EVENT"));
assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
- assertTrue(result.get("ACTTASK").equals("probe"));
+ assertEquals("probe", result.get("ACTTASK"));
assertTrue((boolean) result.get("TCP_ON"));
assertTrue((boolean) result.get("PROBE_ON"));
assertEquals(102, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount());
@@ -417,8 +418,8 @@ public class AadmUseCaseTest {
apexEngine.handleEvent(result);
result = listener.getResult();
assertTrue(result.getName().startsWith("SAPCBlacklistSubscriberEvent"));
- assertTrue(result.get("PROFILE").equals("ServiceA"));
- assertTrue(result.get("BLACKLIST_ON").equals(true));
+ assertEquals("ServiceA", result.get("PROFILE"));
+ assertTrue((boolean) result.get("BLACKLIST_ON"));
event = apexEngine.createEvent(new AxArtifactKey("PeriodicEvent", "0.0.1"));
event.put("PERIODIC_EVENT_COUNT", (long) 100);
@@ -431,8 +432,8 @@ public class AadmUseCaseTest {
assertTrue(result.getName().startsWith("SAPCBlacklistSubscriberEvent"));
assertEquals("ExecutionIDs are different", event.getExecutionId(), result.getExecutionId());
assertEquals(0L, result.get("IMSI"));
- assertTrue(result.get("PROFILE").equals("ServiceA"));
- assertTrue(result.get("BLACKLIST_ON").equals(false));
+ assertEquals("ServiceA", result.get("PROFILE"));
+ assertFalse((boolean) result.get("BLACKLIST_ON"));
apexEngine.stop();
}