diff options
author | Eylon Malin <eylon.malin@intl.att.com> | 2019-10-03 07:58:17 +0300 |
---|---|---|
committer | Eylon Malin <eylon.malin@intl.att.com> | 2019-10-03 07:58:17 +0300 |
commit | 6a4bbd8dded066fae4bc034d65a059e41b06661e (patch) | |
tree | 534a9bd75d8a9a3d46106804fd5df8e8648bdabb /vid-app-common | |
parent | ab9cd4374e918187907e19a57585bc57b72f1bc7 (diff) |
UT - requestId is same in next call but invocationId is different
Issue-ID: VID-253
Signed-off-by: Eylon Malin <eylon.malin@intl.att.com>
Change-Id: I3c07a26b2644435ca530466f47fb3b77d01dcbe4
Diffstat (limited to 'vid-app-common')
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestHeadersTest.java | 19 |
1 files changed, 18 insertions, 1 deletions
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 |