Package javax.ws.rs.client

Examples of javax.ws.rs.client.SyncInvoker


    public void testPost() {
        GenericType<Response> generic = new GenericType<Response>(Response.class);
        Entity entity = Entity.entity("entity", MediaType.WILDCARD_TYPE);

        WebTarget target = target("resource");
        SyncInvoker sync = target.request();

        Response response = sync.post(entity, generic);
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("entity", response.readEntity(String.class));
    }
View Full Code Here


    @Test
    public void testGet() {
        GenericType<Response> generic = new GenericType<Response>(Response.class);

        WebTarget target = target("resource");
        SyncInvoker sync = target.request();
        Response response = sync.get(generic);
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("get", response.readEntity(String.class));
    }
View Full Code Here

    @Test
    public void testGetGenericString() {
        GenericType<String> generic = new GenericType<String>(String.class);

        WebTarget target = target("resource");
        SyncInvoker sync = target.request();
        final String entity = sync.get(generic);
        Assert.assertEquals("get", entity);
    }
View Full Code Here

      }

    private void generalTestPost(int status) {
      Entity<String> entity = Entity.entity("entity", MediaType.WILDCARD_TYPE);
          WebTarget target = target("resource").path(Integer.toString(status));
          SyncInvoker sync = target.request();
          Response response = sync.post(entity, Response.class);
          Assert.assertEquals(status, response.getStatus());
          Assert.assertEquals("entity", response.readEntity(String.class));
    }
View Full Code Here

TOP

Related Classes of javax.ws.rs.client.SyncInvoker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.