diff options
author | vmuthukrishnan <vmuthukrishnan@aarnanetworks.com> | 2019-08-13 17:44:22 +0000 |
---|---|---|
committer | Takamune Cho <takamune.cho@att.com> | 2019-08-30 23:40:59 +0000 |
commit | 35d8f73bfed6211b4d0e799880f991b001dbe0a6 (patch) | |
tree | 37511ceeca250948888432c28011046439dbdf17 /appc-config/appc-flow-controller/provider/src/test | |
parent | a0c771eb01a35f907394582f3febb42d39f25799 (diff) |
Updated jersey from com.sun.jersey to org.glassfish.jersey
ODL upgrade
Change-Id: I1167ad7cdb429c9c3e2808db820e3fc26e605383
Signed-off-by: vmuthukrishnan <vmuthukrishnan@aarnanetworks.com>
Issue-ID: APPC-1630
Diffstat (limited to 'appc-config/appc-flow-controller/provider/src/test')
-rw-r--r-- | appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/executorImpl/RestExecutorTest.java | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/executorImpl/RestExecutorTest.java b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/executorImpl/RestExecutorTest.java index 0b64c1390..e5517bfe8 100644 --- a/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/executorImpl/RestExecutorTest.java +++ b/appc-config/appc-flow-controller/provider/src/test/java/org/onap/appc/flow/controller/executorImpl/RestExecutorTest.java @@ -28,13 +28,12 @@ import static javax.ws.rs.core.Response.Status.OK; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.when; +import static org.mockito.Mockito.mock; -import com.sun.jersey.api.client.Client; -import com.sun.jersey.api.client.ClientResponse; -import com.sun.jersey.api.client.WebResource; import java.net.URI; import java.util.HashMap; import java.util.Map; @@ -47,6 +46,13 @@ import org.mockito.MockitoAnnotations; import org.mockito.Spy; import org.onap.appc.flow.controller.data.Transaction; +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 javax.ws.rs.client.Entity; +import javax.ws.rs.core.MediaType; + public class RestExecutorTest { private static final String ANY = "notNullString"; @@ -60,11 +66,11 @@ public class RestExecutorTest { @Mock private Client client; @Mock - private WebResource webResource; + private WebTarget webResource; @Mock - private WebResource.Builder webResourceBuilder; + private Invocation.Builder webResourceBuilder; @Mock - private ClientResponse clientResponse; + final private Response clientResponse = mock(Response.class); @Before @@ -77,18 +83,19 @@ public class RestExecutorTest { MockitoAnnotations.initMocks(this); doReturn(client).when(restExecutor).createClient(any()); - when(client.resource(any(URI.class))).thenReturn(webResource); + when(client.target(any(URI.class))).thenReturn(webResource); - when(webResource.accept(anyString())).thenReturn(webResourceBuilder); - when(webResource.type(anyString())).thenReturn(webResourceBuilder); + when(webResource.request(eq("Content-Type"),anyString())).thenReturn(webResourceBuilder); + when(webResource.request(anyString())).thenReturn(webResourceBuilder); - when(webResourceBuilder.get(ClientResponse.class)).thenReturn(clientResponse); - when(webResourceBuilder.post(ClientResponse.class, ANY)).thenReturn(clientResponse); - when(webResourceBuilder.put(ClientResponse.class, ANY)).thenReturn(clientResponse); - when(webResource.delete(ClientResponse.class)).thenReturn(clientResponse); + when(webResourceBuilder.get(eq(Response.class))).thenReturn(clientResponse); + when(webResourceBuilder.post(any(Entity.class),eq(Response.class))).thenReturn(clientResponse); + when(webResourceBuilder.put(any(Entity.class),eq(Response.class))).thenReturn(clientResponse); + when(webResource.request(anyString()).delete(eq(Response.class))).thenReturn(clientResponse); + when(webResourceBuilder.delete(eq(Response.class))).thenReturn(clientResponse); when(clientResponse.getStatus()).thenReturn(OK.getStatusCode()); - when(clientResponse.getEntity(String.class)).thenReturn(OK.getReasonPhrase()); + when(clientResponse.readEntity(String.class)).thenReturn(OK.getReasonPhrase()); } @Test @@ -135,8 +142,8 @@ public class RestExecutorTest { public void checkClienResponse_whenStatusNOK() throws Exception { try { when(clientResponse.getStatus()).thenReturn(FORBIDDEN.getStatusCode()); - when(clientResponse.getEntity(String.class)).thenReturn(FORBIDDEN.getReasonPhrase()); - transaction.setExecutionRPC(HttpMethod.GET); + when(clientResponse.readEntity(String.class)).thenReturn(FORBIDDEN.getReasonPhrase()); + transaction.setExecutionRPC(HttpMethod.GET); outputMessage = restExecutor.execute(transaction, null); |