diff options
author | Ittay Stern <ittay.stern@att.com> | 2019-09-26 07:50:07 +0300 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2019-10-02 12:38:31 +0300 |
commit | a92741c73951498d10644635da2335391ac56e02 (patch) | |
tree | 1553e9e9cf7288165c960544f508817c90db2968 /vid-app-common/src/test/java/org/onap | |
parent | 32208b52da320c4013b577b55dde8f41bebaa240 (diff) |
Verify partner-name header sent to AAI, SO
Issue-ID: VID-253
Change-Id: I80c710db1eb3f48c52b7ecebb234e75a503bf65d
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-app-common/src/test/java/org/onap')
4 files changed, 13 insertions, 4 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java index 558dc269f..83fff4f5d 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java @@ -1255,7 +1255,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { UUID workflow_UUID = new UUID(3,30); String path = "/instanceManagement/v1/serviceInstances/"+serviceInstanceId+"/vnfs/"+vnfInstanceId+"/workflows/"+workflow_UUID; - given(msoInterface.invokeWorkflow(eq(request), eq(path), MockitoHamcrest.argThat(allOf(hasEntry("X-RequestorID", "testRequester"),hasEntry("X-ONAP-PartnerName", "VID"))))).willReturn(okResponse); + given(msoInterface.invokeWorkflow(eq(request), eq(path), MockitoHamcrest.argThat(allOf(hasEntry("X-RequestorID", "testRequester"),hasEntry("X-ONAP-PartnerName", "VID.VID"))))).willReturn(okResponse); // when MsoResponseWrapper response = msoBusinessLogic.invokeVnfWorkflow(request, "testRequester", serviceInstanceId, vnfInstanceId, workflow_UUID); diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java index 5486becad..63c17dfe7 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTest.java @@ -832,7 +832,7 @@ public class MsoRestClientTest { Map<String,String> extraHeaders = new HashMap<>(); extraHeaders.put("X-ONAP-RequestID",requestId.toString()); - extraHeaders.put("X-ONAP-PartnerName","VID"); + extraHeaders.put("X-ONAP-PartnerName","VID.VID"); extraHeaders.put("X-RequestorID","testRequester"); // when diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java index ac82a6e53..123737f4f 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java @@ -32,7 +32,7 @@ import static com.xebialabs.restito.semantics.Condition.post; import static com.xebialabs.restito.semantics.Condition.uri; import static com.xebialabs.restito.semantics.Condition.withHeader; import static net.javacrumbs.jsonunit.JsonAssert.assertJsonEquals; -import static org.onap.vid.mso.rest.MsoRestClientNew.X_ONAP_PARTNER_NAME; +import static org.onap.vid.logging.Headers.PARTNER_NAME; import static org.onap.vid.utils.Logging.ONAP_REQUEST_ID_HEADER_KEY; import com.fasterxml.jackson.databind.ObjectMapper; @@ -235,7 +235,7 @@ class MsoRestClientTestUtil implements AutoCloseable { withHeader(HttpHeaders.ACCEPT), withHeader(HttpHeaders.CONTENT_TYPE), withHeader(MsoRestClientNew.X_FROM_APP_ID), - withHeader(X_ONAP_PARTNER_NAME, "VID"), + withHeader(PARTNER_NAME.getHeaderName(), "VID.VID"), withHeader(SystemProperties.ECOMP_REQUEST_ID), withHeader(ONAP_REQUEST_ID_HEADER_KEY) ); 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 b4b14b3cf..01e484f4b 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 @@ -145,6 +145,7 @@ public class OutgoingRequestHeadersTest { assertEquals(requestIdValue, captureHeaderKeyAndReturnItsValue(fakeBuilder, "X-ONAP-RequestID")); assertThat((String) captureHeaderKeyAndReturnItsValue(fakeBuilder, "Authorization"), startsWith("Basic ")); + verifyXOnapPartnerNameHeaderWasAdded(fakeBuilder); } @Test @@ -176,6 +177,7 @@ public class OutgoingRequestHeadersTest { f.accept(aaiRestInterface); verifyXEcompRequestIdHeaderWasAdded(mocks.getFakeBuilder()); + verifyXOnapPartnerNameHeaderWasAdded(mocks.getFakeBuilder()); } // @Test(dataProvider = "schedulerMethods") @@ -198,6 +200,13 @@ public class OutgoingRequestHeadersTest { return requestId; } + private void verifyXOnapPartnerNameHeaderWasAdded(Invocation.Builder fakeBuilder) { + assertThat( + captureHeaderKeyAndReturnItsValue(fakeBuilder, Headers.PARTNER_NAME.getHeaderName()), + is("VID.VID") + ); + } + private Object captureHeaderKeyAndReturnItsValue(Invocation.Builder fakeBuilder, String headerName) { // Checks that the builder was called with either one of header("x-ecomp-requestid", uuid) // or the plural brother: headers(Map.of("x-ecomp-requestid", Set.of(uuid)) |