summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@est.tech>2019-11-05 14:37:09 +0000
committera.sreekumar <ajith.sreekumar@est.tech>2019-11-14 12:15:55 +0000
commit40a1f22ff8d28e78b6512c0a10d454b37f015fdb (patch)
tree8d92efb03c45615bf8697db4adcee558a80eb9e7 /examples
parent8c95a09fd412c89b1eaf7d0658005ffba24025bd (diff)
Retaining context in APEX Engine based on policies received in PdpUpdate
Change-Id: I73fad5bf76ed6b4979f5ab76013f204ea82da30b Issue-ID: POLICY-2215 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
Diffstat (limited to 'examples')
-rw-r--r--examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/AadmUseCaseTest.java3
-rw-r--r--examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionTslUseCaseTest.java14
-rw-r--r--examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnTslUseCaseTest.java5
-rw-r--r--examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpUseCaseTest.java5
4 files changed, 15 insertions, 12 deletions
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 fbab071b6..1269d4401 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
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -122,7 +123,7 @@ public class AadmUseCaseTest {
final ApexEngineImpl apexEngine = (ApexEngineImpl) new ApexEngineFactory().createApexEngine(key);
final TestApexActionListener listener = new TestApexActionListener("Test");
apexEngine.addEventListener("listener", listener);
- apexEngine.updateModel(apexPolicyModel);
+ apexEngine.updateModel(apexPolicyModel, false);
apexEngine.start();
final AxEvent axEvent = getTriggerEvent(apexPolicyModel);
diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionTslUseCaseTest.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionTslUseCaseTest.java
index 40df82cdb..7ada6a795 100644
--- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionTslUseCaseTest.java
+++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionTslUseCaseTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +27,6 @@ import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.Random;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -73,12 +73,12 @@ public class AnomalyDetectionTslUseCaseTest {
@Before
public void beforeTest() {
schemaParameters = new SchemaParameters();
-
+
schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
ParameterService.register(schemaParameters);
-
+
contextParameters = new ContextParameters();
contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME);
@@ -90,7 +90,7 @@ public class AnomalyDetectionTslUseCaseTest {
ParameterService.register(contextParameters.getDistributorParameters());
ParameterService.register(contextParameters.getLockManagerParameters());
ParameterService.register(contextParameters.getPersistorParameters());
-
+
engineParameters = new EngineParameters();
engineParameters.getExecutorParameterMap().put("MVEL", new MvelExecutorParameters());
engineParameters.getExecutorParameterMap().put("JAVA", new JavaExecutorParameters());
@@ -103,7 +103,7 @@ public class AnomalyDetectionTslUseCaseTest {
@After
public void afterTest() {
ParameterService.deregister(engineParameters);
-
+
ParameterService.deregister(contextParameters.getDistributorParameters());
ParameterService.deregister(contextParameters.getLockManagerParameters());
ParameterService.deregister(contextParameters.getPersistorParameters());
@@ -135,7 +135,7 @@ public class AnomalyDetectionTslUseCaseTest {
final TestApexActionListener listener1 = new TestApexActionListener("TestListener1");
apexEngine1.addEventListener("listener", listener1);
- apexEngine1.updateModel(apexPolicyModel);
+ apexEngine1.updateModel(apexPolicyModel, false);
apexEngine1.start();
final EnEvent triggerEvent =
apexEngine1.createEvent(new AxArtifactKey("AnomalyDetectionTriggerEvent", "0.0.1"));
@@ -191,7 +191,7 @@ public class AnomalyDetectionTslUseCaseTest {
final TestApexActionListener listener1 = new TestApexActionListener("TestListener1");
apexEngine1.addEventListener("listener1", listener1);
- apexEngine1.updateModel(apexPolicyModel);
+ apexEngine1.updateModel(apexPolicyModel, false);
apexEngine1.start();
final EnEvent triggerEvent =
diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnTslUseCaseTest.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnTslUseCaseTest.java
index bf6c08f16..d40dcc672 100644
--- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnTslUseCaseTest.java
+++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnTslUseCaseTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -134,7 +135,7 @@ public class AutoLearnTslUseCaseTest {
final TestApexActionListener listener1 = new TestApexActionListener("TestListener1");
apexEngine1.addEventListener("listener", listener1);
- apexEngine1.updateModel(apexPolicyModel);
+ apexEngine1.updateModel(apexPolicyModel, false);
apexEngine1.start();
final EnEvent triggerEvent = apexEngine1.createEvent(new AxArtifactKey("AutoLearnTriggerEvent", "0.0.1"));
final double rval = rand.nextGaussian();
@@ -189,7 +190,7 @@ public class AutoLearnTslUseCaseTest {
final TestApexActionListener listener1 = new TestApexActionListener("TestListener1");
apexEngine1.addEventListener("listener1", listener1);
- apexEngine1.updateModel(apexPolicyModel);
+ apexEngine1.updateModel(apexPolicyModel, false);
apexEngine1.start();
final EnEvent triggerEvent = apexEngine1.createEvent(new AxArtifactKey("AutoLearnTriggerEvent", "0.0.1"));
diff --git a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpUseCaseTest.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpUseCaseTest.java
index f957e7ec3..0d6192988 100644
--- a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpUseCaseTest.java
+++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/MfpUseCaseTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -134,7 +135,7 @@ public class MfpUseCaseTest {
final TestSaleAuthListener listener = new TestSaleAuthListener("Test");
apexEngine.addEventListener("listener", listener);
- apexEngine.updateModel(apexPolicyModel);
+ apexEngine.updateModel(apexPolicyModel, false);
apexEngine.start();
final AxEvent axEventin = apexPolicyModel.getEvents().get(new AxArtifactKey("SALE_INPUT:0.0.1"));
@@ -182,7 +183,7 @@ public class MfpUseCaseTest {
final TestSaleAuthListener listener = new TestSaleAuthListener("Test");
apexEngine.addEventListener("listener", listener);
- apexEngine.updateModel(apexPolicyModel);
+ apexEngine.updateModel(apexPolicyModel, false);
apexEngine.start();
final AxEvent axEventin = apexPolicyModel.getEvents().get(new AxArtifactKey("SALE_INPUT:0.0.1"));