aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src/test
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-08-13 15:52:22 -0400
committerJim Hahn <jrh3@att.com>2019-08-15 09:21:28 -0400
commitfdaae76549bafb2e482c02fb26de719c69431b48 (patch)
treea3f477da55f80fe7e4bed3d959d8089cf1971438 /controlloop/common/eventmanager/src/test
parent9e8023a455633c7daf0dd291c6268986e39352d7 (diff)
Modify to work with new drools-pdp
Due to sonar fixes, drools-pdp changed in a way that requires changes to drools-applications. In the case of template.demo, lots of test cases had to be modified, so they were refactored to extract common setup and tear down code. Fixed checkstyle issues. Fixed license date. Change-Id: Ie9e0239b95916ae7ef8c1b669987f7bb07d841b9 Issue-ID: POLICY-1968 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/eventmanager/src/test')
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java14
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java32
2 files changed, 23 insertions, 23 deletions
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
index b7dc1f0d9..0b27ffa49 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManagerTest.java
@@ -65,7 +65,7 @@ import org.onap.policy.controlloop.VirtualControlLoopNotification;
import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager.NewEventStatus;
import org.onap.policy.controlloop.policy.ControlLoopPolicy;
import org.onap.policy.controlloop.policy.PolicyResult;
-import org.onap.policy.drools.system.PolicyEngine;
+import org.onap.policy.drools.system.PolicyEngineConstants;
import org.onap.policy.guard.GuardResult;
import org.onap.policy.guard.PolicyGuard;
import org.onap.policy.guard.PolicyGuard.LockResult;
@@ -115,9 +115,9 @@ public class ControlLoopEventManagerTest {
public static void setUpSimulator() throws Exception {
org.onap.policy.simulators.Util.buildAaiSim();
- PolicyEngine.manager.setEnvironmentProperty(AAI_USERNAME, "AAI");
- PolicyEngine.manager.setEnvironmentProperty(AAI_PASS, "AAI");
- PolicyEngine.manager.setEnvironmentProperty(AAI_URL, "http://localhost:6666");
+ PolicyEngineConstants.getManager().setEnvironmentProperty(AAI_USERNAME, "AAI");
+ PolicyEngineConstants.getManager().setEnvironmentProperty(AAI_PASS, "AAI");
+ PolicyEngineConstants.getManager().setEnvironmentProperty(AAI_URL, "http://localhost:6666");
}
@AfterClass
@@ -141,7 +141,7 @@ public class ControlLoopEventManagerTest {
onset.getAai().put(VNF_ID, VNF_UUID);
onset.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET);
- PolicyEngine.manager.setEnvironmentProperty(AAI_URL, "http://localhost:6666");
+ PolicyEngineConstants.getManager().setEnvironmentProperty(AAI_URL, "http://localhost:6666");
}
@Test
@@ -1008,7 +1008,7 @@ public class ControlLoopEventManagerTest {
@Test(expected = AaiException.class)
public void testQueryAai_QueryException() throws AaiException {
// Force AAI errors
- PolicyEngine.manager.setEnvironmentProperty(AAI_URL, INVALID_URL);
+ PolicyEngineConstants.getManager().setEnvironmentProperty(AAI_URL, INVALID_URL);
makeManager(onset).queryAai(onset);
}
@@ -1231,7 +1231,7 @@ public class ControlLoopEventManagerTest {
// Force AAI error
- PolicyEngine.manager.setEnvironmentProperty(AAI_URL, INVALID_URL);
+ PolicyEngineConstants.getManager().setEnvironmentProperty(AAI_URL, INVALID_URL);
// re-create manager
manager = makeManager(onset);
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java
index 13fe72517..9b1633521 100644
--- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java
+++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java
@@ -68,7 +68,7 @@ import org.onap.policy.controlloop.policy.PolicyResult;
import org.onap.policy.controlloop.policy.Target;
import org.onap.policy.controlloop.policy.TargetType;
import org.onap.policy.controlloop.processor.ControlLoopProcessor;
-import org.onap.policy.drools.system.PolicyEngine;
+import org.onap.policy.drools.system.PolicyEngineConstants;
import org.onap.policy.so.SoResponse;
import org.onap.policy.so.SoResponseWrapper;
import org.onap.policy.vfc.VfcResponse;
@@ -108,9 +108,9 @@ public class ControlLoopOperationManagerTest {
onset.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET);
/* Set environment properties */
- PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666");
- PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI");
- PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI");
+ PolicyEngineConstants.getManager().setEnvironmentProperty("aai.url", "http://localhost:6666");
+ PolicyEngineConstants.getManager().setEnvironmentProperty("aai.username", "AAI");
+ PolicyEngineConstants.getManager().setEnvironmentProperty("aai.password", "AAI");
}
private static EntityManagerFactory emf;
@@ -138,9 +138,9 @@ public class ControlLoopOperationManagerTest {
System.setProperty(OPERATIONS_HISTORY_PU, OPERATIONS_HISTORY_PU_TEST);
// Enter dummy props to avoid nullPointerException
- PolicyEngine.manager.setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_URL, "a");
- PolicyEngine.manager.setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_USER, "b");
- PolicyEngine.manager.setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_PASS, "c");
+ PolicyEngineConstants.getManager().setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_URL, "a");
+ PolicyEngineConstants.getManager().setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_USER, "b");
+ PolicyEngineConstants.getManager().setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_PASS, "c");
// Connect to in-mem db
emf = Persistence.createEntityManagerFactory(OPERATIONS_HISTORY_PU_TEST);
@@ -443,7 +443,7 @@ public class ControlLoopOperationManagerTest {
onsetEvent.getAai().remove(VNF_ID);
manager.getVnfResponse();
- if (!Boolean.valueOf(PolicyEngine.manager.getEnvironmentProperty("aai.customQuery"))) {
+ if (!Boolean.valueOf(PolicyEngineConstants.getManager().getEnvironmentProperty("aai.customQuery"))) {
clom.getEventManager().getVnfResponse().setVnfId(VNF_ID);
assertEquals(VNF_ID, clom.getTarget(policy));
}
@@ -733,11 +733,11 @@ public class ControlLoopOperationManagerTest {
SoResponse soResponse = new SoResponse();
final SoResponseWrapper soRw = new SoResponseWrapper(soResponse, null);
- PolicyEngine.manager.setEnvironmentProperty("guard.disabled", "false");
- PolicyEngine.manager.setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_URL,
+ PolicyEngineConstants.getManager().setEnvironmentProperty("guard.disabled", "false");
+ PolicyEngineConstants.getManager().setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_URL,
"http://somewhere.over.the.rainbow");
- PolicyEngine.manager.setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_USER, DOROTHY);
- PolicyEngine.manager.setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_PASS, "Toto");
+ PolicyEngineConstants.getManager().setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_USER, DOROTHY);
+ PolicyEngineConstants.getManager().setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_PASS, "Toto");
assertEquals(PolicyResult.FAILURE, clom.onResponse(soRw));
@@ -822,11 +822,11 @@ public class ControlLoopOperationManagerTest {
SoResponse soResponse = new SoResponse();
final SoResponseWrapper soRw = new SoResponseWrapper(soResponse, null);
- PolicyEngine.manager.setEnvironmentProperty("guard.disabled", "false");
- PolicyEngine.manager.setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_URL,
+ PolicyEngineConstants.getManager().setEnvironmentProperty("guard.disabled", "false");
+ PolicyEngineConstants.getManager().setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_URL,
"http://somewhere.over.the.rainbow");
- PolicyEngine.manager.setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_USER, DOROTHY);
- PolicyEngine.manager.setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_PASS, "Toto");
+ PolicyEngineConstants.getManager().setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_USER, DOROTHY);
+ PolicyEngineConstants.getManager().setEnvironmentProperty(org.onap.policy.guard.Util.ONAP_KEY_PASS, "Toto");
assertEquals(PolicyResult.FAILURE, clom.onResponse(soRw));
assertFalse(clom.isOperationRunning());