summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.aai
diff options
context:
space:
mode:
Diffstat (limited to 'models-interactions/model-actors/actor.aai')
-rw-r--r--models-interactions/model-actors/actor.aai/pom.xml6
-rw-r--r--models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java4
-rw-r--r--models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java4
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java21
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperatorTest.java12
5 files changed, 31 insertions, 16 deletions
diff --git a/models-interactions/model-actors/actor.aai/pom.xml b/models-interactions/model-actors/actor.aai/pom.xml
index deb0181be..4e932a11b 100644
--- a/models-interactions/model-actors/actor.aai/pom.xml
+++ b/models-interactions/model-actors/actor.aai/pom.xml
@@ -52,12 +52,6 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
- <artifactId>aai</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>org.onap.policy.common</groupId>
<artifactId>policy-endpoints</artifactId>
<version>${policy.common.version}</version>
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java
index 5f432704c..bc2dde9d8 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java
@@ -27,6 +27,8 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.onap.policy.aai.AaiConstants;
import org.onap.policy.aai.AaiCqResponse;
+import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
+import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
import org.onap.policy.common.utils.coder.StandardCoderObject;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperation;
@@ -85,7 +87,7 @@ public class AaiCustomQueryOperation extends HttpOperation<String> {
headers.put("Accept", MediaType.APPLICATION_JSON);
String url = makeUrl();
- logRestRequest(url, request);
+ logMessage(EventType.OUT, CommInfrastructure.REST, url, request);
// @formatter:off
return handleResponse(outcome, url,
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java
index 3bc359af2..60a28209b 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetOperation.java
@@ -26,6 +26,8 @@ import java.util.concurrent.CompletableFuture;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.onap.policy.aai.AaiConstants;
+import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
+import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
import org.onap.policy.common.utils.coder.StandardCoderObject;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperation;
@@ -92,7 +94,7 @@ public class AaiGetOperation extends HttpOperation<StandardCoderObject> {
headers.put("Accept", MediaType.APPLICATION_JSON);
String url = makeUrl();
- logRestRequest(url, null);
+ logMessage(EventType.OUT, CommInfrastructure.REST, url, null);
// @formatter:off
return handleResponse(outcome, url,
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
index eca5062f1..c95425e7a 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java
@@ -23,6 +23,7 @@ package org.onap.policy.controlloop.actor.aai;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
@@ -30,7 +31,8 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.TimeUnit;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
@@ -92,7 +94,7 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperator<Map<String, St
CompletableFuture<OperationOutcome> future2 = oper.start();
- assertEquals(PolicyResult.SUCCESS, future2.get(5, TimeUnit.SECONDS).getResult());
+ assertEquals(PolicyResult.SUCCESS, getResult(future2));
// tenant response should have been cached within the context
assertNotNull(context.getProperty(AaiGetOperation.getTenantKey(TARGET_ENTITY)));
@@ -116,7 +118,7 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperator<Map<String, St
CompletableFuture<OperationOutcome> future2 = oper.start();
- assertEquals(PolicyResult.SUCCESS, future2.get(5, TimeUnit.SECONDS).getResult());
+ assertEquals(PolicyResult.SUCCESS, getResult(future2));
// should not have replaced tenant response
assertSame(data, context.getProperty(AaiGetOperation.getTenantKey(TARGET_ENTITY)));
@@ -141,7 +143,7 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperator<Map<String, St
CompletableFuture<OperationOutcome> future2 = oper.start();
- assertEquals(PolicyResult.FAILURE_EXCEPTION, future2.get(5, TimeUnit.SECONDS).getResult());
+ assertEquals(PolicyResult.FAILURE_EXCEPTION, getResult(future2));
}
private String makeTenantReply() throws Exception {
@@ -166,11 +168,20 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperator<Map<String, St
context.setProperty(AaiGetOperation.getTenantKey(TARGET_ENTITY), data);
}
+ private PolicyResult getResult(CompletableFuture<OperationOutcome> future2)
+ throws InterruptedException, ExecutionException, TimeoutException {
+
+ executor.runAll(100);
+ assertTrue(future2.isDone());
+
+ return future2.get().getResult();
+ }
+
protected class MyTenantOperator extends HttpOperator {
public MyTenantOperator() {
super(AaiConstants.ACTOR_NAME, AaiGetOperation.TENANT);
- HttpParams http = HttpParams.builder().clientName(MY_CLIENT).path(PATH).build();
+ HttpParams http = HttpParams.builder().clientName(MY_CLIENT).path(PATH).timeoutSec(1).build();
configure(Util.translateToMap(AaiGetOperation.TENANT, http));
start();
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperatorTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperatorTest.java
index ca90ce476..ebe953570 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperatorTest.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiGetOperatorTest.java
@@ -24,12 +24,12 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.TimeUnit;
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.aai.AaiConstants;
@@ -80,7 +80,10 @@ public class AaiGetOperatorTest extends BasicAaiOperator<Void> {
CompletableFuture<OperationOutcome> future2 = oper.startOperationAsync(1, outcome);
assertFalse(future2.isDone());
- assertEquals(PolicyResult.SUCCESS, future2.get(5, TimeUnit.SECONDS).getResult());
+ executor.runAll(100);
+ assertTrue(future2.isDone());
+
+ assertEquals(PolicyResult.SUCCESS, future2.get().getResult());
// data should have been cached within the context
StandardCoderObject data = context.getProperty(AaiGetOperation.getTenantKey(TARGET_ENTITY));
@@ -102,7 +105,10 @@ public class AaiGetOperatorTest extends BasicAaiOperator<Void> {
CompletableFuture<OperationOutcome> future2 = oper.startOperationAsync(1, outcome);
assertFalse(future2.isDone());
- assertEquals(PolicyResult.FAILURE, future2.get(5, TimeUnit.SECONDS).getResult());
+ executor.runAll(100);
+ assertTrue(future2.isDone());
+
+ assertEquals(PolicyResult.FAILURE, future2.get().getResult());
// data should NOT have been cached within the context
assertNull(context.getProperty(AaiGetOperation.getTenantKey(TARGET_ENTITY)));