From f1ea637a60bace906db5619d71a914ad601e9478 Mon Sep 17 00:00:00 2001 From: Bogumil Zebek Date: Thu, 13 Aug 2020 07:35:53 +0200 Subject: StndDefined event routing - Update WS error response - Update DPO configuration Change-Id: Id4eb5ea50af6d55c839047c4f39b9f99487e95de Issue-ID: DCAEGEN2-1771 Signed-off-by: Zebek Bogumil --- .../org/onap/dcae/restapi/VesRestControllerTest.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/test/java') diff --git a/src/test/java/org/onap/dcae/restapi/VesRestControllerTest.java b/src/test/java/org/onap/dcae/restapi/VesRestControllerTest.java index e5e7239c..10423053 100644 --- a/src/test/java/org/onap/dcae/restapi/VesRestControllerTest.java +++ b/src/test/java/org/onap/dcae/restapi/VesRestControllerTest.java @@ -191,7 +191,8 @@ public class VesRestControllerTest { verifyErrorResponse( response, "SVC2006", - "Mandatory input attribute event.commonEventHeader.stndDefinedNamespace is missing from request" + "Mandatory input %1 %2 is missing from request", + List.of("attribute", "event.commonEventHeader.stndDefinedNamespace") ); verifyThatEventWasNotSend(); } @@ -215,7 +216,8 @@ public class VesRestControllerTest { verifyErrorResponse( response, "SVC2006", - "Mandatory input attribute event.commonEventHeader.stndDefinedNamespace is empty in request" + "Mandatory input %1 %2 is empty in request", + List.of("attribute", "event.commonEventHeader.stndDefinedNamespace") ); verifyThatEventWasNotSend(); } @@ -251,13 +253,14 @@ public class VesRestControllerTest { when(applicationSettings.jsonSchema(eq(VERSION_V7))).thenReturn(loadedJsonSchemas.get(VERSION_V7).get()); } - private void verifyErrorResponse(ResponseEntity response, String messageId, String messageText) throws com.fasterxml.jackson.core.JsonProcessingException { - final Map errorDetails = fetchErrorDetails(response); - assertThat(errorDetails).containsEntry("messageId", messageId); - assertThat(errorDetails).containsEntry("text", messageText); + private void verifyErrorResponse(ResponseEntity response, String messageId, String messageText, List variables) throws com.fasterxml.jackson.core.JsonProcessingException { + final Map errorDetails = fetchErrorDetails(response); + assertThat((Map)errorDetails).containsEntry("messageId", messageId); + assertThat((Map)errorDetails).containsEntry("text", messageText); + assertThat((Map>)errorDetails).containsEntry("variables", variables); } - private Map fetchErrorDetails(ResponseEntity response) throws com.fasterxml.jackson.core.JsonProcessingException { + private Map fetchErrorDetails(ResponseEntity response) throws com.fasterxml.jackson.core.JsonProcessingException { final String body = response.getBody(); ObjectMapper mapper = new ObjectMapper(); Map>> map = mapper.readValue(body, Map.class); -- cgit 1.2.3-korg