aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test
diff options
context:
space:
mode:
authorAlexey Sandler <alexey.sandler@intl.att.com>2019-10-17 20:21:21 +0300
committerIttay Stern <ittay.stern@att.com>2019-10-23 15:01:37 +0000
commit94f6b1b726958471e2103c65f1330d17b7dec28a (patch)
treeb1054889e00f5a0698bef99bc6fd2d1bee2c2676 /vid-app-common/src/test
parente8d29ab5e3775472f59a4997fa3a5df9319de306 (diff)
register MSO Client to MetricLogClientFilter
Issue-ID: VID-253 Change-Id: Id0e3f13e62170da41981d74dbb5b92e8d3d1b69c Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Diffstat (limited to 'vid-app-common/src/test')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java7
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/mso/rest/OutgoingRequestHeadersTest.java22
2 files changed, 6 insertions, 23 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java
index 792435002..2e321f93e 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/RestMsoImplementationTest.java
@@ -22,6 +22,7 @@
package org.onap.vid.mso;
import static org.assertj.core.api.Java6Assertions.assertThat;
+import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
@@ -30,6 +31,7 @@ import static org.mockito.MockitoAnnotations.initMocks;
import io.joshworks.restclient.request.HttpRequest;
import java.io.IOException;
import java.security.GeneralSecurityException;
+import java.util.List;
import java.util.Optional;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.Entity;
@@ -39,6 +41,7 @@ import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.client.JerseyInvocation;
+import org.hamcrest.MatcherAssert;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.onap.vid.aai.util.HttpClientMode;
@@ -99,7 +102,9 @@ public class RestMsoImplementationTest {
MultivaluedHashMap<String, Object> result = restMsoImplementation.initMsoClient();
// then
- assertThat(result).containsKeys("Authorization","X-ONAP-PartnerName");
+ List<Object> authorizationHeaders = result.get("Authorization");
+ MatcherAssert.assertThat(authorizationHeaders, hasSize(1));
+ assertThat((String) authorizationHeaders.get(0)).startsWith("Basic ");
assertThat(result).doesNotContainKey("notExistingKey");
}
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 cfb9ee6ea..fd66dab52 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
@@ -151,28 +151,6 @@ public class OutgoingRequestHeadersTest {
).map(l -> ImmutableList.of(l).toArray()).collect(Collectors.toList()).toArray(new Object[][]{});
}
- @Test(dataProvider = "msoMethods")
- public void mso(Consumer<RestMsoImplementation> f) throws Exception {
- final TestUtils.JavaxRsClientMocks mocks = setAndGetMocksInsideRestImpl(restMsoImplementation);
-
- f.accept(restMsoImplementation);
- HeadersVerifier headersVerifier = new HeadersVerifier().verifyFirstCall(mocks.getFakeBuilder());
-
- assertThat((String) captureHeaderKeyAndReturnItsValue(mocks.getFakeBuilder(), "Authorization"), startsWith("Basic "));
-
- //verify requestId is same in next call but invocationId is different
-
- //given
- final TestUtils.JavaxRsClientMocks mocks2 = setAndGetMocksInsideRestImpl(restMsoImplementation);
-
- //when
- f.accept(restMsoImplementation);
- //then
- headersVerifier.verifySecondCall(mocks2.getFakeBuilder());
- }
-
-
-
@Test
public void whenProvideMsoRestCallUserId_builderHasXRequestorIDHeader() throws Exception {