Search in sources :

Example 6 with ServicesInterface

use of com.baeldung.client.ServicesInterface in project tutorials by eugenp.

the class RestEasyClientLiveTest method testUpdateMovie.

@Test
public void testUpdateMovie() {
    final ResteasyClient client = new ResteasyClientBuilder().build();
    final ResteasyWebTarget target = client.target(FULL_PATH);
    final ServicesInterface proxy = target.proxy(ServicesInterface.class);
    Response moviesResponse = proxy.addMovie(batmanMovie);
    moviesResponse.close();
    batmanMovie.setTitle("Batman Begins");
    moviesResponse = proxy.updateMovie(batmanMovie);
    if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) {
        System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus());
    }
    moviesResponse.close();
    System.out.println("Response Code: " + moviesResponse.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) ResteasyClientBuilder(org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder) ResteasyClient(org.jboss.resteasy.client.jaxrs.ResteasyClient) ResteasyWebTarget(org.jboss.resteasy.client.jaxrs.ResteasyWebTarget) ServicesInterface(com.baeldung.client.ServicesInterface) Test(org.junit.Test)

Aggregations

ServicesInterface (com.baeldung.client.ServicesInterface)6 Response (javax.ws.rs.core.Response)6 ResteasyClient (org.jboss.resteasy.client.jaxrs.ResteasyClient)6 ResteasyClientBuilder (org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder)6 ResteasyWebTarget (org.jboss.resteasy.client.jaxrs.ResteasyWebTarget)6 Test (org.junit.Test)6 Movie (com.baeldung.model.Movie)2 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)1 PoolingHttpClientConnectionManager (org.apache.http.impl.conn.PoolingHttpClientConnectionManager)1 ApacheHttpClient4Engine (org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine)1