UT - requestId is same in next call but invocationId is different 34/96534/1
authorEylon Malin <eylon.malin@intl.att.com>
Thu, 3 Oct 2019 04:58:17 +0000 (07:58 +0300)
committerEylon Malin <eylon.malin@intl.att.com>
Thu, 3 Oct 2019 04:58:17 +0000 (07:58 +0300)
Issue-ID: VID-253
Signed-off-by: Eylon Malin <eylon.malin@intl.att.com>
Change-Id: I3c07a26b2644435ca530466f47fb3b77d01dcbe4

vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestHeadersTest.java

index 8c5634f..c4d4474 100644 (file)
@@ -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