diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-09-16 16:52:32 +0200 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-09-17 11:36:04 +0200 |
commit | 9817670cf1b469b887e16e0a80dc855cf97e859f (patch) | |
tree | c0f75d6e63e884c1c47d20e9cde22a83e50062b6 /aai-els-onap-logging/src/test | |
parent | 089252de752d987756ae339b4a719ad689d02aa9 (diff) |
Migrate remnants of jersey 1 to 2 in aai-common
- use org.glassfish.jersey instead of com.sun.jersey
Issue-ID: AAI-3990
Change-Id: Ice5731a241be3adf03a64a66fe6f595e5970c7c0
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Diffstat (limited to 'aai-els-onap-logging/src/test')
-rw-r--r-- | aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/RestControllerClientLoggingInterceptorTest.java | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/RestControllerClientLoggingInterceptorTest.java b/aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/RestControllerClientLoggingInterceptorTest.java index 9c4b2655..84e032d8 100644 --- a/aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/RestControllerClientLoggingInterceptorTest.java +++ b/aai-els-onap-logging/src/test/java/org/onap/aai/aailog/filter/RestControllerClientLoggingInterceptorTest.java @@ -22,14 +22,14 @@ package org.onap.aai.aailog.filter; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; - -import com.sun.jersey.api.client.ClientRequest; +import static org.mockito.Mockito.when; import java.net.InetAddress; import java.net.URI; import java.net.URISyntaxException; import java.net.UnknownHostException; +import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.core.MultivaluedHashMap; import javax.ws.rs.core.MultivaluedMap; @@ -38,6 +38,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; +import org.mockito.Mock; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import org.onap.logging.filter.base.Constants; @@ -47,17 +48,24 @@ import org.slf4j.MDC; @RunWith(MockitoJUnitRunner.class) public class RestControllerClientLoggingInterceptorTest { - private ClientRequest clientRequest; + @Spy + private ClientRequestContext clientRequest; @Spy @InjectMocks - private RestControllerClientLoggingInterceptor restControllerClientLoggingInterceptor; + private RestControllerClientRequestLoggingInterceptor restControllerClientLoggingInterceptor; @Before public void init() throws URISyntaxException { System.setProperty("javax.ws.rs.ext.RuntimeDelegate", "com.sun.ws.rs.ext.RuntimeDelegateImpl"); - clientRequest = ClientRequest.create().build( - new URI("https://localhost:9999/aai/v1/cloud-infrastructure/complexes/complex/complex-1"), "GET"); + when(clientRequest.getHeaders()).thenReturn(new MultivaluedHashMap<String, Object>()); + when(clientRequest.getUri()) + .thenReturn(new URI("https://localhost:9999/aai/v1/cloud-infrastructure/complexes/complex/complex-1")); + + // clientRequest = ClientRequest.create().build( + // new + // URI("https://localhost:9999/aai/v1/cloud-infrastructure/complexes/complex/complex-1"), + // "GET"); } @After @@ -71,6 +79,10 @@ public class RestControllerClientLoggingInterceptorTest { String transId = "37b3ab2a-e57e-4fe8-8d8f-eee3019efce6"; MultivaluedMap<String, Object> requestHeaders = new MultivaluedHashMap<String, Object>(); requestHeaders.add(Constants.HttpHeaders.TRANSACTION_ID, transId); + when(clientRequest.getHeaders()).thenReturn(requestHeaders); + when(clientRequest.getUri()) + .thenReturn(new URI("https://localhost:9999/aai/v1/cloud-infrastructure/complexes/complex/complex-1")); + clientRequest.getHeaders().putAll(requestHeaders); restControllerClientLoggingInterceptor.pre(clientRequest); MultivaluedMap<String, Object> headers = clientRequest.getHeaders(); |