Package org.apache.cxf.jaxrs.client

Examples of org.apache.cxf.jaxrs.client.WebClient.form()


    public void testBookFromHttpRequestParameters() throws Exception {
       
        WebClient wc = WebClient.create("http://localhost:" + PORT + "/bookstorestorage/bookforms2",
                                        "foo", "bar", null);
        wc.accept("application/xml");
        Response r = wc.form(new Form().param("name", "CXF Rocks").param("id", "123"));
       
        Book b = readBook((InputStream)r.getEntity());
        assertEquals("CXF Rocks", b.getName());
        assertEquals(123L, b.getId());
    }
View Full Code Here


    @Test
    public void testTooManyFormParams() throws Exception {
        String endpointAddress =
            "http://localhost:" + PORT + "/the/thebooks9/depth-form";
        WebClient wc = WebClient.create(endpointAddress);
        Response r = wc.form(new Form().set("a", "b"));
        assertEquals(204, r.getStatus());
        r = wc.form(new Form().set("a", "b").set("c", "b"));
        assertEquals(413, r.getStatus());
    }
   
View Full Code Here

        String endpointAddress =
            "http://localhost:" + PORT + "/the/thebooks9/depth-form";
        WebClient wc = WebClient.create(endpointAddress);
        Response r = wc.form(new Form().set("a", "b"));
        assertEquals(204, r.getStatus());
        r = wc.form(new Form().set("a", "b").set("c", "b"));
        assertEquals(413, r.getStatus());
    }
   
   
    @Test
View Full Code Here

    @Test
    public void testTooManyFormParams() throws Exception {
        String endpointAddress =
            "http://localhost:" + PORT + "/the/thebooks9/depth-form";
        WebClient wc = WebClient.create(endpointAddress);
        Response r = wc.form(new Form().set("a", "b"));
        assertEquals(204, r.getStatus());
        r = wc.form(new Form().set("a", "b").set("c", "b"));
        assertEquals(413, r.getStatus());
    }
   
View Full Code Here

        String endpointAddress =
            "http://localhost:" + PORT + "/the/thebooks9/depth-form";
        WebClient wc = WebClient.create(endpointAddress);
        Response r = wc.form(new Form().set("a", "b"));
        assertEquals(204, r.getStatus());
        r = wc.form(new Form().set("a", "b").set("c", "b"));
        assertEquals(413, r.getStatus());
    }
   
   
    @Test
View Full Code Here

   
    @Test
    public void testPostEmptyForm() throws Exception {
        String address = "http://localhost:" + PORT + "/bookstore/emptyform";
        WebClient wc = WebClient.create(address);
        Response r = wc.form(new org.apache.cxf.jaxrs.ext.form.Form());
        assertEquals("empty form", r.readEntity(String.class));
    }
   
    @Test
    public void testGetBookDescriptionHttpResponse() throws Exception {
View Full Code Here

    }

    public void registerClientApplication() throws Exception {
      WebClient rs = WebClient.create("http://localhost:" + port + "/services/oauth/registerProvider");
      WebClient.getConfig(rs).getHttpConduit().getClient().setReceiveTimeout(10000000L);
      rs.form(new Form().set("appName", "Restaurant Reservations")
                    .set("appURI", "http://localhost:" + port + "/services/reservations/reserve"));
    }
   
    public void createUserAccount() throws Exception {
      WebClient rs = WebClient.create("http://localhost:" + port + "/services/social/registerUser");
View Full Code Here

    }
   
    public void createUserAccount() throws Exception {
      WebClient rs = WebClient.create("http://localhost:" + port + "/services/social/registerUser");
      WebClient.getConfig(rs).getHttpConduit().getClient().setReceiveTimeout(10000000L);
      rs.form(new Form().set("user", "barry@social.com").set("password", "1234"));
     
      printUserCalendar();
    }
   
    private void printUserCalendar() {
View Full Code Here

   
    private void updateAndGetUserCalendar(int hour, String event) {
      WebClient client = createClient("http://localhost:" + port + "/services/social/accounts/calendar",
          "barry@social.com", "1234");
      Form form = new Form().set("hour", hour).set("event", event);
      client.form(form);
      printUserCalendar();
    }
   
    public void reserveTable() throws Exception {
      WebClient rs = createClient("http://localhost:" + port + "/services/reservations/reserve/table",
View Full Code Here

    }
   
    public void reserveTable() throws Exception {
      WebClient rs = createClient("http://localhost:" + port + "/services/reservations/reserve/table",
          "barry@restaurant.com", "5678");
      Response r = rs.form(new Form().set("name", "Barry")
                                 .set("phone", "12345678")
                                 .set("hour", "7"));
     
      int status = r.getStatus();
      Object locationHeader = r.getMetadata().getFirst("Location");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.