From ea46d04a9bc5569bd29b83bdeb58f52a88d876c3 Mon Sep 17 00:00:00 2001 From: Eylon Malin Date: Wed, 2 Oct 2019 14:57:35 +0300 Subject: send INVOCATION_ID header via RestMsoImplementation Issue-ID: VID-253 Signed-off-by: Eylon Malin Change-Id: Ifc199a3ef0faf2c02b73a065667866f25c20bd56 --- .../org/onap/vid/mso/rest/OutgoingRequestHeadersTest.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'vid-app-common/src/test/java/org') diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestHeadersTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestHeadersTest.java index 01e484f4b..8c5634fbe 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestHeadersTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestHeadersTest.java @@ -143,7 +143,7 @@ public class OutgoingRequestHeadersTest { Invocation.Builder fakeBuilder = mocks.getFakeBuilder(); Object requestIdValue = verifyXEcompRequestIdHeaderWasAdded(fakeBuilder); assertEquals(requestIdValue, captureHeaderKeyAndReturnItsValue(fakeBuilder, "X-ONAP-RequestID")); - + assertRequestHeaderIsUUID(fakeBuilder, "X-InvocationID"); assertThat((String) captureHeaderKeyAndReturnItsValue(fakeBuilder, "Authorization"), startsWith("Basic ")); verifyXOnapPartnerNameHeaderWasAdded(fakeBuilder); } @@ -192,12 +192,15 @@ public class OutgoingRequestHeadersTest { private Object verifyXEcompRequestIdHeaderWasAdded(Invocation.Builder fakeBuilder) { final String requestIdHeader = "x-ecomp-requestid"; - final String uuidRegex = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"; - Object requestId = captureHeaderKeyAndReturnItsValue(fakeBuilder, requestIdHeader); + return assertRequestHeaderIsUUID(fakeBuilder, requestIdHeader); + } - assertThat("header '" + requestIdHeader + "' should be a uuid", requestId, + private Object assertRequestHeaderIsUUID(Invocation.Builder fakeBuilder, String headerName) { + Object headerValue = captureHeaderKeyAndReturnItsValue(fakeBuilder, headerName); + final String uuidRegex = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"; + assertThat("header '" + headerName + "' should be a uuid", headerValue, allOf(instanceOf(String.class), hasToString(matchesPattern(uuidRegex)))); - return requestId; + return headerValue; } private void verifyXOnapPartnerNameHeaderWasAdded(Invocation.Builder fakeBuilder) { -- cgit 1.2.3-korg