aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/actors/actor.appclcm
diff options
context:
space:
mode:
authorLiam Fallon <liam.fallon@ericsson.com>2017-12-14 07:40:18 -0800
committerLiam Fallon <liam.fallon@ericsson.com>2017-12-14 20:07:40 -0800
commitfe4cd8e4c08a19ac543ca93c577b8b3a12a1524f (patch)
tree263a3c0dc2ad9504c6a891f6c5b9d025b0fa74b7 /controlloop/common/actors/actor.appclcm
parent5cfd3b7066e6a6305e140fa59b1fccb8e3c5f81b (diff)
Cleanup of A&AI message model module.
Fields have been made fields private in POJOs, and wrote JUnit unit tests to bring up code coverage. AAIManager also changed to use non-static methods so that it can be stubbed with Mockito. Change-Id: I871427ced5db8a1dfd6495fef4e6d84adf264e65 Signed-off-by: Liam Fallon <liam.fallon@ericsson.com> Issue-ID: POLICY-455 Signed-off-by: Liam Fallon <liam.fallon@ericsson.com>
Diffstat (limited to 'controlloop/common/actors/actor.appclcm')
-rw-r--r--controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java25
1 files changed, 13 insertions, 12 deletions
diff --git a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
index 936dd0243..0f4a00423 100644
--- a/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
+++ b/controlloop/common/actors/actor.appclcm/src/main/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmActorServiceProvider.java
@@ -51,6 +51,7 @@ 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;
@@ -110,15 +111,15 @@ public class AppcLcmActorServiceProvider implements Actor {
private static String parseAAIResponse(List<AAINQInventoryResponseItem> items, String resourceId) {
String vnfId = null;
for (AAINQInventoryResponseItem item: items) {
- if ((item.genericVNF != null)
- && (item.genericVNF.modelInvariantId != null)
- && (resourceId.equals(item.genericVNF.modelInvariantId))) {
- vnfId = item.genericVNF.vnfID;
+ if ((item.getGenericVNF() != null)
+ && (item.getGenericVNF().getModelInvariantId() != null)
+ && (resourceId.equals(item.getGenericVNF().getModelInvariantId()))) {
+ vnfId = item.getGenericVNF().getVnfID();
break;
}
else {
- if((item.items != null) && (item.items.getInventoryResponseItems() != null)) {
- vnfId = parseAAIResponse(item.items.getInventoryResponseItems(), resourceId);
+ if((item.getItems() != null) && (item.getItems().getInventoryResponseItems() != null)) {
+ vnfId = parseAAIResponse(item.getItems().getInventoryResponseItems(), resourceId);
}
}
}
@@ -144,9 +145,9 @@ public class AppcLcmActorServiceProvider implements Actor {
UUID requestId = UUID.fromString("a93ac487-409c-4e8c-9e5f-334ae8f99087");
AAINQRequest aaiRequest = new AAINQRequest();
- aaiRequest.queryParameters = new AAINQQueryParameters();
- aaiRequest.queryParameters.namedQuery = new AAINQNamedQuery();
- aaiRequest.queryParameters.namedQuery.namedQueryUUID = requestId;
+ aaiRequest.setQueryParameters(new AAINQQueryParameters());
+ aaiRequest.getQueryParameters().setNamedQuery(new AAINQNamedQuery());
+ aaiRequest.getQueryParameters().getNamedQuery().setNamedQueryUUID(requestId);
Map<String, Map<String, String>> filter = new HashMap<>();
Map<String, String> filterItem = new HashMap<>();
@@ -154,8 +155,8 @@ public class AppcLcmActorServiceProvider implements Actor {
filterItem.put("vnf-id", sourceVnfId);
filter.put("generic-vnf", filterItem);
- aaiRequest.instanceFilters = new AAINQInstanceFilters();
- aaiRequest.instanceFilters.getInstanceFilter().add(filter);
+ aaiRequest.setInstanceFilters(new AAINQInstanceFilters());
+ aaiRequest.getInstanceFilters().getInstanceFilter().add(filter);
/*
* Obtain A&AI credentials from properties.environment file
@@ -165,7 +166,7 @@ public class AppcLcmActorServiceProvider implements Actor {
String aaiUsername = PolicyEngine.manager.getEnvironmentProperty("aai.username");
String aaiPassword = PolicyEngine.manager.getEnvironmentProperty("aai.password");
- AAINQResponse aaiResponse = AAIManager.postQuery(
+ AAINQResponse aaiResponse = new AAIManager(new RESTManager()).postQuery(
aaiUrl,
aaiUsername, aaiPassword,
aaiRequest, requestId);