Examples of WebClient


Examples of org.apache.cxf.jaxrs.client.WebClient

        assertNull(response.getMetadata().getFirst("Content-Type"));
    }
   
    @Test
    public void testEmptyPut() throws Exception {
        WebClient wc =
            WebClient.create("http://localhost:"
                             + PORT + "/bookstore/emptyput");
        Response response = wc.put(null);
        assertEquals(204, response.getStatus());
        assertNull(response.getMetadata().getFirst("Content-Type"));
       
        response = wc.put("");
        assertEquals(204, response.getStatus());
        assertNull(response.getMetadata().getFirst("Content-Type"));
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.WebClient

        checkBook("http://localhost:" + PORT + "/bookstore/books/check/125", false)
    }
   
    @Test
    public void testBookExistsWebClientPrimitiveBoolean() throws Exception {
        WebClient wc = WebClient.create("http://localhost:" + PORT + "/bookstore/books/check/123");
        wc.accept("text/plain");
        assertTrue(wc.get(boolean.class));
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.WebClient

        assertTrue(store.checkBook(123L));
    }
   
    @Test
    public void testBookExistsWebClientBooleanObject() throws Exception {
        WebClient wc = WebClient.create("http://localhost:" + PORT + "/bookstore/books/check/123");
        wc.accept("text/plain");
        assertTrue(wc.get(Boolean.class));
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.WebClient

        assertTrue(wc.get(Boolean.class));
    }
   
    @Test
    public void testBookExistsMalformedMt() throws Exception {
        WebClient wc =
            WebClient.create("http://localhost:" + PORT + "/bookstore/books/check/malformedmt/123");
        wc.accept(MediaType.TEXT_PLAIN);
        WebClient.getConfig(wc).getInInterceptors().add(new ReplaceContentTypeInterceptor());
        assertTrue(wc.get(Boolean.class));
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.WebClient

    }
   
    @Test
    public void testGetHeadBook123WebClient() throws Exception {
        String address = "http://localhost:" + PORT + "/bookstore/getheadbook/";
        WebClient client = WebClient.create(address);
        Response r = client.head();
        assertEquals("HEAD_HEADER_VALUE", r.getMetadata().getFirst("HEAD_HEADER"));
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.WebClient

    }
   
    @Test
    public void testGetHeadBook123WebClient2() throws Exception {
        String address = "http://localhost:" + PORT + "/bookstore/getheadbook/";
        WebClient client = WebClient.create(address);
        Book b = client.get(Book.class);
        assertEquals(b.getId(), 123L);
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.WebClient

    }
   
    @Test
    public void testGetBookFromResponseWithWebClientAndReader() throws Exception {
        String address = "http://localhost:" + PORT + "/bookstore/genericresponse/123";
        WebClient wc = WebClient.create(address);
        Response r = wc.accept("application/xml").get();
        assertEquals(200, r.getStatus());
        Book book = r.readEntity(Book.class);
        assertEquals(123L, book.getId());
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.WebClient

    }
   
    @Test
    public void testGetBookFromResponseWithWebClient() throws Exception {
        String address = "http://localhost:" + PORT + "/bookstore/genericresponse/123";
        WebClient wc = WebClient.create(address);
        Response r = wc.accept("application/xml").get();
        assertEquals(200, r.getStatus());
        Book book = r.readEntity(Book.class);
        assertEquals(123L, book.getId());
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.WebClient

   
    @Test
    public void testSearchBook123WithWebClient() throws Exception {
        String address = "http://localhost:" + PORT + "/bookstore/books/search";
                         
        WebClient client = WebClient.create(address);
        Book b = client.query("_s", "name==CXF*;id=ge=123;id=lt=124").get(Book.class);
        assertEquals(b.getId(), 123L);
       
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.WebClient

    @Test
    public void testGetSearchBookSQL() throws Exception {
        String address = "http://localhost:" + PORT
            + "/bookstore/books/querycontext/id=ge=123";
                         
        WebClient client = WebClient.create(address);
        client.accept("text/plain");
        String sql = client.get(String.class);
        assertEquals("SELECT * FROM books WHERE id >= '123'", sql);
    }
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.