Search in sources :

Example 1 with Movie

use of com.baeldung.model.Movie in project tutorials by eugenp.

the class RestEasyClientLiveTest method testListAllMovies.

@Test
public void testListAllMovies() {
    final ResteasyClient client = new ResteasyClientBuilder().build();
    final ResteasyWebTarget target = client.target(FULL_PATH);
    final ServicesInterface proxy = target.proxy(ServicesInterface.class);
    Response moviesResponse = proxy.addMovie(transformerMovie);
    moviesResponse.close();
    moviesResponse = proxy.addMovie(batmanMovie);
    moviesResponse.close();
    final List<Movie> movies = proxy.listMovies();
    System.out.println(movies);
}
Also used : Response(javax.ws.rs.core.Response) ResteasyClientBuilder(org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder) Movie(com.baeldung.model.Movie) ResteasyClient(org.jboss.resteasy.client.jaxrs.ResteasyClient) ResteasyWebTarget(org.jboss.resteasy.client.jaxrs.ResteasyWebTarget) ServicesInterface(com.baeldung.client.ServicesInterface) Test(org.junit.Test)

Example 2 with Movie

use of com.baeldung.model.Movie in project tutorials by eugenp.

the class RestEasyClientLiveTest method testMovieByImdbId.

@Test
public void testMovieByImdbId() {
    final String transformerImdbId = "tt0418279";
    final ResteasyClient client = new ResteasyClientBuilder().build();
    final ResteasyWebTarget target = client.target(FULL_PATH);
    final ServicesInterface proxy = target.proxy(ServicesInterface.class);
    final Response moviesResponse = proxy.addMovie(transformerMovie);
    moviesResponse.close();
    final Movie movies = proxy.movieByImdbId(transformerImdbId);
    System.out.println(movies);
}
Also used : Response(javax.ws.rs.core.Response) ResteasyClientBuilder(org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder) Movie(com.baeldung.model.Movie) 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)2 Movie (com.baeldung.model.Movie)2 Response (javax.ws.rs.core.Response)2 ResteasyClient (org.jboss.resteasy.client.jaxrs.ResteasyClient)2 ResteasyClientBuilder (org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder)2 ResteasyWebTarget (org.jboss.resteasy.client.jaxrs.ResteasyWebTarget)2 Test (org.junit.Test)2