From 35d8f73bfed6211b4d0e799880f991b001dbe0a6 Mon Sep 17 00:00:00 2001 From: vmuthukrishnan Date: Tue, 13 Aug 2019 17:44:22 +0000 Subject: Updated jersey from com.sun.jersey to org.glassfish.jersey ODL upgrade Change-Id: I1167ad7cdb429c9c3e2808db820e3fc26e605383 Signed-off-by: vmuthukrishnan Issue-ID: APPC-1630 --- .../appc/ccadaptor/ConfigComponentAdaptorTest.java | 30 ++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'appc-config/appc-config-adaptor/provider/src/test/java') diff --git a/appc-config/appc-config-adaptor/provider/src/test/java/org/onap/appc/ccadaptor/ConfigComponentAdaptorTest.java b/appc-config/appc-config-adaptor/provider/src/test/java/org/onap/appc/ccadaptor/ConfigComponentAdaptorTest.java index c987bb2c9..772a0a14d 100644 --- a/appc-config/appc-config-adaptor/provider/src/test/java/org/onap/appc/ccadaptor/ConfigComponentAdaptorTest.java +++ b/appc-config/appc-config-adaptor/provider/src/test/java/org/onap/appc/ccadaptor/ConfigComponentAdaptorTest.java @@ -29,9 +29,12 @@ package org.onap.appc.ccadaptor; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; -import com.sun.jersey.api.client.Client; -import com.sun.jersey.api.client.ClientResponse; -import com.sun.jersey.api.client.WebResource; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.client.Invocation; +import javax.ws.rs.core.Response; + import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -333,12 +336,12 @@ public class ConfigComponentAdaptorTest { @Test public void testPrepare() { Client mockClient = Mockito.mock(Client.class); - WebResource mockWebResource = Mockito.mock(WebResource.class); - ClientResponse mockClientResponse = Mockito.mock(ClientResponse.class); + WebTarget mockWebResource = Mockito.mock(WebTarget.class); + Response mockClientResponse = Response.ok().build(); ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(null)); Mockito.doReturn(mockClientResponse).when(cca).getClientResponse(Mockito.anyObject(), Mockito.anyString(), Mockito.anyString()); - Mockito.doReturn(mockWebResource).when(mockClient).resource(Mockito.anyString()); + Mockito.doReturn(mockWebResource).when(mockClient).target(Mockito.anyString()); Mockito.doReturn(mockClient).when(cca).getClient(); Map parameters = new HashMap<>(); parameters.put("action", "prepare"); @@ -369,12 +372,12 @@ public class ConfigComponentAdaptorTest { @Test public void testPrepareComplexTemplate() { Client mockClient = Mockito.mock(Client.class); - WebResource mockWebResource = Mockito.mock(WebResource.class); - ClientResponse mockClientResponse = Mockito.mock(ClientResponse.class); + WebTarget mockWebResource = Mockito.mock(WebTarget.class); + Response mockClientResponse = Response.ok().build(); ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(null)); Mockito.doReturn(mockClientResponse).when(cca).getClientResponse(Mockito.anyObject(), Mockito.anyString(), Mockito.anyString()); - Mockito.doReturn(mockWebResource).when(mockClient).resource(Mockito.anyString()); + Mockito.doReturn(mockWebResource).when(mockClient).target(Mockito.anyString()); Mockito.doReturn(mockClient).when(cca).getClient(); String complexTemplateString = cca.readFile("/prepare.xml"); Mockito.when(cca.readFile(Mockito.anyString())).thenReturn(complexTemplateString); @@ -390,12 +393,13 @@ public class ConfigComponentAdaptorTest { @Test public void testAudit() { Client mockClient = Mockito.mock(Client.class); - WebResource mockWebResource = Mockito.mock(WebResource.class); - ClientResponse mockClientResponse = Mockito.mock(ClientResponse.class); + WebTarget mockWebResource = Mockito.mock(WebTarget.class); + Response mockClientResponse = Response.ok().build(); + ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(null)); Mockito.doReturn(mockClientResponse).when(cca).getClientResponse(Mockito.anyObject(), Mockito.anyString(), Mockito.anyString()); - Mockito.doReturn(mockWebResource).when(mockClient).resource(Mockito.anyString()); + Mockito.doReturn(mockWebResource).when(mockClient).target(Mockito.anyString()); Mockito.doReturn(mockClient).when(cca).getClient(); Map parameters = new HashMap<>(); parameters.put("action", "audit"); @@ -408,7 +412,7 @@ public class ConfigComponentAdaptorTest { @Test public void testActivate() { - ClientResponse mockClientResponse = Mockito.mock(ClientResponse.class); + Response mockClientResponse = Response.ok().build(); ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(null)); Mockito.doReturn(mockClientResponse).when(cca).getClientResponse(Mockito.anyObject(), Mockito.anyString(), Mockito.anyString()); -- cgit 1.2.3-korg