Package org.apache.cxf.jaxrs.client

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


    public void testGetBook123WebClientWithURLConduitId() throws Exception {
       
        WebClient client = WebClient.create("https://localhost:" + PORT, CLIENT_CONFIG_FILE2);
        assertEquals("https://localhost:" + PORT, client.getBaseURI().toString());
       
        client.path("/bookstore/securebooks/123").accept(MediaType.APPLICATION_XML_TYPE);
        Book b = client.get(Book.class);
        assertEquals(123, b.getId());
       
    }
   
View Full Code Here


    @Test
    public void testFeed() throws Exception {
        String listing = WebClient.create("http://localhost:" + PORT + "/services").get(String.class);
        assertTrue(listing, listing.contains("http://localhost:" + PORT + "/atom/logs"));
        WebClient wc = WebClient.create("http://localhost:" + PORT + "/resource/root");
        wc.path("/log").get();
        Thread.sleep(3000);
       
        checkSimpleFeed(getFeed("http://localhost:" + PORT + "/atom/logs").getEntries());
        checkSimpleFeed(getFeed("http://localhost:" + PORT + "/atom/logs").getEntries());
    
View Full Code Here

            .accept("application/atom+xml;type=entry");
        HTTPConduit conduit = WebClient.getConfig(wcEntry).getHttpConduit();
        conduit.getClient().setReceiveTimeout(1000000);
        conduit.getClient().setConnectionTimeout(1000000);
        for (int i = 0; i < 8; i++) {
            Entry entry = wcEntry.path("entry/" + i).get(Entry.class);
            entry.toString();
            entries.add(entry);
            wcEntry.back(true);
        }
        checkSimpleFeed(entries);
View Full Code Here

    }
   
    @Test
    public void testPagedFeed() throws Exception {
        WebClient wc = WebClient.create("http://localhost:" + PORT + "/resource2/paged");
        wc.path("/log").get();
        Thread.sleep(3000);
       
        verifyPages("http://localhost:" + PORT + "/atom2/logs", "next", 3, 2, "theNamedLogger");
        verifyPages("http://localhost:" + PORT + "/atom2/logs/3", "previous", 2, 3, "theNamedLogger");
    }
View Full Code Here

    public void testPagedFeedWithReadWriteStorage() throws Exception {
        WebClient wc = WebClient.create("http://localhost:" + PORT + "/resource3/storage");
        HTTPConduit conduit = WebClient.getConfig(wc).getHttpConduit();
        conduit.getClient().setReceiveTimeout(1000000);
        conduit.getClient().setConnectionTimeout(1000000);
        wc.path("/log").get();
        Thread.sleep(3000);
       
        verifyStoragePages("http://localhost:"
                           + PORT + "/atom3/logs", "next", "Resource3", "theStorageLogger");
        List<org.apache.cxf.management.web.logging.LogRecord> list = Storage.getRecords();
View Full Code Here

    public void testWebClientUnwrapBookWithXslt() throws Exception {
        XSLTJaxbProvider provider = new XSLTJaxbProvider();
        provider.setInTemplate("classpath:/org/apache/cxf/systest/jaxrs/resources/unwrapbook.xsl");
        WebClient wc = WebClient.create("http://localhost:" + PORT + "/bookstore/books/wrapper",
                             Collections.singletonList(provider));
        wc.path("{id}", 123);
        Book book = wc.get(Book.class);
        assertNotNull(book);
        assertEquals(123L, book.getId());
       
    }
View Full Code Here

   
    @Test
    public void testGetBook123WebClient() throws Exception {
        String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
        WebClient client = WebClient.create(baseAddress);
        client.path("/bookstore/123").accept(MediaType.APPLICATION_XML_TYPE);
        Book b = client.get(Book.class);
        assertEquals(123, b.getId());
        assertEquals("CXF in Action", b.getName());
    }
   
View Full Code Here

   
    @Test
    public void testGetBook123XMLSource() throws Exception {
        String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
        WebClient client = WebClient.create(baseAddress);
        client.path("/bookstore/123").accept(MediaType.APPLICATION_XML_TYPE);
        XMLSource source = client.get(XMLSource.class);
        source.setBuffering(true);
        Book b = source.getNode("/Book", Book.class);
        assertEquals(123, b.getId());
        assertEquals("CXF in Action", b.getName());
View Full Code Here

   
    @Test
    public void testNoBookWebClient() throws Exception {
        String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
        WebClient client = WebClient.create(baseAddress);
        client.path("/bookstore/books/0/subresource").accept(MediaType.APPLICATION_XML_TYPE);
        Book b = client.get(Book.class);
        assertNull(b);
        assertEquals(204, client.getResponse().getStatus());
    }
   
View Full Code Here

   
    @Test
    public void testGetBook123WebClientResponse() throws Exception {
        String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
        WebClient client = WebClient.create(baseAddress);
        client.path("/bookstore/123").accept(MediaType.APPLICATION_XML_TYPE);
        Book b = readBook((InputStream)client.get().getEntity());
        assertEquals(123, b.getId());
        assertEquals("CXF in Action", b.getName());
    }
   
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.