diff options
Diffstat (limited to 'models-interactions/model-actors/actor.aai')
2 files changed, 8 insertions, 10 deletions
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 2cc2a69f4..718047cfc 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 @@ -117,9 +117,10 @@ public class AaiCustomQueryOperation extends HttpOperation<String> { String url = str.toString(); - logMessage(EventType.OUT, CommInfrastructure.REST, url, request); + String strRequest = prettyPrint(request); + logMessage(EventType.OUT, CommInfrastructure.REST, url, strRequest); - Entity<Map<String, String>> entity = Entity.entity(request, MediaType.APPLICATION_JSON); + Entity<String> entity = Entity.entity(strRequest, MediaType.APPLICATION_JSON); return handleResponse(outcome, url, callback -> webldr.async().put(entity, callback)); } 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 ca6cfb2f8..386eb219a 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 @@ -38,14 +38,11 @@ import java.util.TreeMap; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; -import javax.ws.rs.client.Entity; import javax.ws.rs.client.InvocationCallback; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; import org.mockito.Mock; import org.onap.policy.aai.AaiConstants; import org.onap.policy.aai.AaiCqResponse; @@ -70,9 +67,6 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation<Map<String, S private static final String MY_VSERVER = "my-vserver-name"; private static final String SIM_VSERVER = "OzVServer"; - @Captor - private ArgumentCaptor<Entity<Map<String, String>>> entityCaptor; - @Mock private Actor tenantActor; @@ -215,10 +209,13 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation<Map<String, S oper.start(); executor.runAll(100); - verify(webAsync).put(entityCaptor.capture(), any(InvocationCallback.class)); + verify(webAsync).put(requestCaptor.capture(), any(InvocationCallback.class)); + + String reqText = requestCaptor.getValue().getEntity(); + Map<String,String> reqMap = coder.decode(reqText, Map.class); // sort the request fields so they match the order in cq.json - Map<String, String> request = new TreeMap<>(entityCaptor.getValue().getEntity()); + Map<String, String> request = new TreeMap<>(reqMap); verifyRequest("cq.json", request); } |