aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src/test
diff options
context:
space:
mode:
authordaniel <dc443y@att.com>2017-10-24 06:33:31 -0500
committerdaniel <dc443y@att.com>2017-10-24 13:16:10 -0500
commit1480d327ff8559c1d912108f7d3353fed03fcd2c (patch)
tree8745bec65ea2ee8962f42048ed0362961d0dfc60 /controlloop/common/eventmanager/src/test
parentbaea880ddf0564d81d61bf87ae7f124229bf08f0 (diff)
Change vnf-id to vnf-name
These changes now allow a lookup of the source vnf-id based on the onset's vnf-name. Issue-Id: POLICY-366 Change-Id: I6f6bd500b892dddbbb9e12156b4486208309e21d Signed-off-by: Daniel Cruz <dc443y@att.com>
Diffstat (limited to 'controlloop/common/eventmanager/src/test')
-rw-r--r--controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManagerTest.java44
1 files changed, 39 insertions, 5 deletions
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 c5c0bc967..caa17ff38 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
@@ -29,6 +29,8 @@ import java.time.Instant;
import java.util.HashMap;
import java.util.UUID;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.aai.util.AAIException;
import org.onap.policy.appclcm.LCMRequest;
@@ -42,6 +44,8 @@ import org.onap.policy.controlloop.Util;
import org.onap.policy.controlloop.policy.ControlLoopPolicy;
import org.onap.policy.controlloop.policy.PolicyResult;
import org.onap.policy.controlloop.processor.ControlLoopProcessor;
+import org.onap.policy.drools.http.server.HttpServletServer;
+import org.onap.policy.drools.system.PolicyEngine;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,16 +55,32 @@ public class ControlLoopOperationManagerTest {
static {
onset = new VirtualControlLoopEvent();
onset.requestID = UUID.randomUUID();
- onset.target = "vserver.selflink";
+ onset.target = "generic-vnf.vnf-name";
onset.closedLoopAlarmStart = Instant.now();
onset.AAI = new HashMap<>();
- onset.AAI.put("cloud-region.identity-url", "foo");
- onset.AAI.put("vserver.selflink", "bar");
- onset.AAI.put("vserver.is-closed-loop-disabled", "false");
onset.AAI.put("generic-vnf.vnf-name", "testTriggerSource");
onset.closedLoopEventStatus = 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");
}
+ @BeforeClass
+ public static void setUpSimulator() {
+ try {
+ org.onap.policy.simulators.Util.buildAaiSim();
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+ }
+
+ @AfterClass
+ public static void tearDownSimulator() {
+ HttpServletServer.factory.destroy();
+ }
+
@Test
public void testRetriesFail() {
//
@@ -77,7 +97,14 @@ public class ControlLoopOperationManagerTest {
// create the manager
//
ControlLoopEventManager eventManager = new ControlLoopEventManager(onset.closedLoopControlName, onset.requestID);
-
+ try {
+ eventManager.checkEventSyntax(onset);
+ }
+ catch (ControlLoopException e) {
+ logger.warn(e.toString());
+ fail("The onset failed the syntax check");
+ }
+
ControlLoopOperationManager manager = new ControlLoopOperationManager(onset, processor.getCurrentPolicy(), eventManager);
logger.debug("{}",manager);
//
@@ -192,6 +219,13 @@ public class ControlLoopOperationManagerTest {
// create the manager
//
ControlLoopEventManager eventManager = new ControlLoopEventManager(onset.closedLoopControlName, onset.requestID);
+ try {
+ eventManager.checkEventSyntax(onset);
+ }
+ catch (ControlLoopException e) {
+ logger.warn(e.toString());
+ fail("The onset failed the syntax check");
+ }
ControlLoopOperationManager manager = new ControlLoopOperationManager(onset, processor.getCurrentPolicy(), eventManager);
//