aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.appclcm/src
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-04-05 21:07:07 -0400
committerPamela Dragosh <pdragosh@research.att.com>2019-04-08 10:42:22 -0400
commitada55be1b59899e461dc5177782e381f89cbc407 (patch)
tree7bdb3eb5fe44e166a75a3333bf81f2293a3585de /models-interactions/model-actors/actor.appclcm/src
parenteb7127ac85b3df30a09277721a5f9271033843e7 (diff)
Remove drools PDP dependency
Removing working memory and use of PolicyEngine from drools in these classes. Cleaned up some unused imports and checkstyle. Issue-ID: POLICY-1264 Change-Id: Id059da9689a721b0eafc6b310adcbdad43574ce7 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.appclcm/src')
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java27
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java2
-rw-r--r--models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java9
3 files changed, 7 insertions, 31 deletions
diff --git a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
index 5768cd12a..21cce2fd6 100644
--- a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
+++ b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
@@ -24,7 +24,6 @@ package org.onap.policy.controlloop.actor.appclcm;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-
import java.util.AbstractMap;
import java.util.AbstractMap.SimpleEntry;
import java.util.Collections;
@@ -32,7 +31,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-
import org.onap.policy.aai.AaiManager;
import org.onap.policy.aai.AaiNqInstanceFilters;
import org.onap.policy.aai.AaiNqInventoryResponseItem;
@@ -52,7 +50,6 @@ import org.onap.policy.controlloop.VirtualControlLoopEvent;
import org.onap.policy.controlloop.actorserviceprovider.spi.Actor;
import org.onap.policy.controlloop.policy.Policy;
import org.onap.policy.controlloop.policy.PolicyResult;
-import org.onap.policy.drools.system.PolicyEngine;
import org.onap.policy.rest.RestManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -144,7 +141,8 @@ public class AppcLcmActorServiceProvider implements Actor {
* @return the target entities vnf id to act upon
* @throws AaiException it an error occurs
*/
- public static String vnfNamedQuery(String resourceId, String sourceVnfId) throws AaiException {
+ public static String vnfNamedQuery(String resourceId, String sourceVnfId, String aaiUrl,
+ String aaiUser, String aaiPassword) throws AaiException {
// TODO: This request id should not be hard coded in future releases
UUID requestId = UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087");
@@ -163,9 +161,8 @@ public class AppcLcmActorServiceProvider implements Actor {
aaiRequest.setInstanceFilters(new AaiNqInstanceFilters());
aaiRequest.getInstanceFilters().getInstanceFilter().add(filter);
- AaiNqResponse aaiResponse = new AaiManager(new RestManager()).postQuery(getPeManagerEnvProperty("aai.url"),
- getPeManagerEnvProperty("aai.username"), getPeManagerEnvProperty("aai.password"), aaiRequest,
- requestId);
+ AaiNqResponse aaiResponse = new AaiManager(new RestManager()).postQuery(aaiUrl,
+ aaiUser, aaiPassword, aaiRequest, requestId);
if (aaiResponse == null) {
throw new AaiException("The named query response was null");
@@ -341,20 +338,4 @@ public class AppcLcmActorServiceProvider implements Actor {
}
return new AbstractMap.SimpleEntry<>(result, message);
}
-
- /**
- * This method reads and validates environmental properties coming from the policy engine. Null
- * properties cause an {@link IllegalArgumentException} runtime exception to be thrown
- *
- * @param enginePropertyName the name of the parameter to retrieve
- * @return the property value
- */
- private static String getPeManagerEnvProperty(String enginePropertyName) {
- String enginePropertyValue = PolicyEngine.manager.getEnvironmentProperty(enginePropertyName);
- if (enginePropertyValue == null) {
- throw new IllegalArgumentException("The value of policy engine manager environment property \""
- + enginePropertyName + "\" may not be null");
- }
- return enginePropertyValue;
- }
}
diff --git a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java
index daf1af711..61394f2ab 100644
--- a/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java
+++ b/models-interactions/model-actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmRecipeFormatter.java
@@ -24,7 +24,7 @@ package org.onap.policy.controlloop.actor.appclcm;
import com.google.common.collect.Lists;
import java.util.stream.Collectors;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
class AppcLcmRecipeFormatter {
diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java
index 39cdc43ab..da95611d4 100644
--- a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java
+++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProviderTest.java
@@ -49,7 +49,6 @@ import org.onap.policy.controlloop.policy.Policy;
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.drools.system.PolicyEngine;
import org.onap.policy.simulators.Util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -116,11 +115,6 @@ public class AppcLcmActorServiceProviderTest {
dmaapResponse.setRpcName(policy.getRecipe().toLowerCase());
dmaapResponse.setType("response");
- /* Set environment properties */
- PolicyEngine.manager.setEnvironmentProperty("aai.url", "http://localhost:6666");
- PolicyEngine.manager.setEnvironmentProperty("aai.username", "AAI");
- PolicyEngine.manager.setEnvironmentProperty("aai.password", "AAI");
-
/* A sample APPC LCM request. */
LcmRequest appcRequest = new LcmRequest();
@@ -317,7 +311,8 @@ public class AppcLcmActorServiceProviderTest {
String resourceId = "82194af1-3c2c-485a-8f44-420e22a9eaa4";
String targetVnfId = null;
try {
- targetVnfId = AppcLcmActorServiceProvider.vnfNamedQuery(resourceId, "vnf01");
+ targetVnfId = AppcLcmActorServiceProvider.vnfNamedQuery(resourceId, "vnf01",
+ "http://localhost:6666", "AAI", "AAI");
} catch (AaiException e) {
logger.warn(e.toString());
fail("no vnf-id found");