From 6a4bbd8dded066fae4bc034d65a059e41b06661e Mon Sep 17 00:00:00 2001 From: Eylon Malin Date: Thu, 3 Oct 2019 07:58:17 +0300 Subject: UT - requestId is same in next call but invocationId is different Issue-ID: VID-253 Signed-off-by: Eylon Malin Change-Id: I3c07a26b2644435ca530466f47fb3b77d01dcbe4 --- .../onap/vid/mso/rest/OutgoingRequestHeadersTest.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'vid-app-common/src/test') 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 8c5634fbe..c4d447465 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 @@ -31,6 +31,7 @@ import static org.hamcrest.Matchers.hasToString; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.matchesPattern; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.mockito.Mockito.when; import com.google.common.collect.ImmutableList; @@ -143,9 +144,25 @@ public class OutgoingRequestHeadersTest { Invocation.Builder fakeBuilder = mocks.getFakeBuilder(); Object requestIdValue = verifyXEcompRequestIdHeaderWasAdded(fakeBuilder); assertEquals(requestIdValue, captureHeaderKeyAndReturnItsValue(fakeBuilder, "X-ONAP-RequestID")); - assertRequestHeaderIsUUID(fakeBuilder, "X-InvocationID"); + Object invocationId1 = assertRequestHeaderIsUUID(fakeBuilder, "X-InvocationID"); assertThat((String) captureHeaderKeyAndReturnItsValue(fakeBuilder, "Authorization"), startsWith("Basic ")); verifyXOnapPartnerNameHeaderWasAdded(fakeBuilder); + + //validate requestId is same in next call but invocationId is different + + //given + final TestUtils.JavaxRsClientMocks mocks2 = setAndGetMocksInsideRestImpl(restMsoImplementation); + + //when + f.accept(restMsoImplementation); + Invocation.Builder fakeBuilder2 = mocks2.getFakeBuilder(); + + //then + Object requestIdValue2 = verifyXEcompRequestIdHeaderWasAdded(fakeBuilder2); + assertEquals(requestIdValue, requestIdValue2); + + Object invocationId2 = assertRequestHeaderIsUUID(fakeBuilder2, "X-InvocationID"); + assertNotEquals(invocationId1, invocationId2); } @Test -- cgit 1.2.3-korg