summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.aai
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-10-09 12:26:14 -0400
committerJim Hahn <jrh3@att.com>2020-10-09 12:27:30 -0400
commit5de305749237525d35d7f59a53d3866a3cee3675 (patch)
tree5fbd3064becf8ee09f99c666ba58ddabe3de8221 /models-interactions/model-actors/actor.aai
parent45a07d18b4aea9c45a6e84330892d8867948a603 (diff)
Specify "Accept" header in A&AI requests
Modified the A&AI superclass to specify application/json for the Accept header. Removed the header from the subclasses. Issue-ID: POLICY-2863 Change-Id: I90974e305cb36ee2fa01999be4d79225a510e55b Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.aai')
-rw-r--r--models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java3
-rw-r--r--models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java5
-rw-r--r--models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiUtil.java2
-rw-r--r--models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java1
4 files changed, 4 insertions, 7 deletions
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java
index d89d8350a..a4b30652d 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java
@@ -26,7 +26,6 @@ import java.util.Map;
import java.util.concurrent.CompletableFuture;
import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
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;
@@ -70,8 +69,6 @@ public class AaiGetPnfOperation extends AaiGetOperation {
protected CompletableFuture<OperationOutcome> startOperationAsync(int attempt, OperationOutcome outcome) {
Map<String, Object> headers = makeHeaders();
- headers.put("Accept", MediaType.APPLICATION_JSON);
-
StringBuilder str = new StringBuilder(getClient().getBaseUrl());
String path = getPath() + URI_SEP + URLEncoder.encode(getTargetEntity(), StandardCharsets.UTF_8);
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java
index fe1179833..add9c647a 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java
@@ -24,7 +24,6 @@ import java.util.Map;
import java.util.concurrent.CompletableFuture;
import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
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;
@@ -65,9 +64,7 @@ public class AaiGetTenantOperation extends AaiGetOperation {
@Override
protected CompletableFuture<OperationOutcome> startOperationAsync(int attempt, OperationOutcome outcome) {
- Map<String, Object> headers = makeHeaders();
-
- headers.put("Accept", MediaType.APPLICATION_JSON);
+ final Map<String, Object> headers = makeHeaders();
StringBuilder str = new StringBuilder(getClient().getBaseUrl());
diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiUtil.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiUtil.java
index 14edc3aa1..c44e9d80d 100644
--- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiUtil.java
+++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiUtil.java
@@ -22,6 +22,7 @@ package org.onap.policy.controlloop.actor.aai;
import java.util.HashMap;
import java.util.Map;
+import javax.ws.rs.core.MediaType;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
/**
@@ -44,6 +45,7 @@ public class AaiUtil {
headers.put("X-FromAppId", "POLICY");
headers.put("X-TransactionId", params.getRequestId().toString());
+ headers.put("Accept", MediaType.APPLICATION_JSON);
return headers;
}
diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java
index 1f481ae0f..9479d063b 100644
--- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java
+++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java
@@ -70,5 +70,6 @@ public abstract class BasicAaiOperation extends BasicHttpOperation {
protected void verifyHeaders(Map<String, Object> headers) {
assertEquals("POLICY", headers.get("X-FromAppId").toString());
assertEquals(params.getRequestId().toString(), headers.get("X-TransactionId"));
+ assertEquals("application/json", headers.get("Accept").toString());
}
}