Package org.apache.cxf.systest.jaxrs

Examples of org.apache.cxf.systest.jaxrs.Book


       
        BookStore bs = JAXRSClientFactory.create("https://localhost:" + PORT, BookStore.class,
                                                 CLIENT_CONFIG_FILE2);
        // just to verify the interface call goes through CGLIB proxy too
        assertEquals("https://localhost:" + PORT, WebClient.client(bs).getBaseURI().toString());
        Book b = bs.getSecureBook("123");
        assertEquals(b.getId(), 123);
        b = bs.getSecureBook("123");
        assertEquals(b.getId(), 123);
    }
View Full Code Here


    @Test
    public void testGetBook123ProxyToWebClient() throws Exception {
       
        BookStore bs = JAXRSClientFactory.create("https://localhost:" + PORT, BookStore.class,
                                                 CLIENT_CONFIG_FILE);
        Book b = bs.getSecureBook("123");
        assertEquals(b.getId(), 123);
        WebClient wc = WebClient.fromClient(WebClient.client(bs));
        wc.path("/bookstore/securebooks/123").accept(MediaType.APPLICATION_XML_TYPE);
        Book b2 = wc.get(Book.class);
        assertEquals(123, b2.getId());
    }
View Full Code Here

    @Test
    public void testGetBook123WebClientToProxy() throws Exception {
       
        WebClient wc = WebClient.create("https://localhost:" + PORT, CLIENT_CONFIG_FILE);
        wc.path("/bookstore/securebooks/123").accept(MediaType.APPLICATION_XML_TYPE);
        Book b = wc.get(Book.class);
        assertEquals(123, b.getId());
       
        wc.back(true);
       
        BookStore bs = JAXRSClientFactory.fromClient(wc, BookStore.class);
        Book b2 = bs.getSecureBook("123");
        assertEquals(b2.getId(), 123);
       
    }
View Full Code Here

       
        WebClient client = WebClient.create("https://localhost:" + PORT, CLIENT_CONFIG_FILE);
        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

       
        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

        books.put(book.getId(), book);
        return books.get(book.getId());
    }
   
    private void init() {
        Book book = new Book();
        book.setId(new Long(123));
        book.setName("CXF in Action");
        books.put(book.getId(), book);
    }
View Full Code Here

    public Book addFastinfoBook(Book book) {
        return book;
    }
   
    public Book getFastinfoBook() {
        return new Book("CXF2", 2L);
    }
View Full Code Here

        WebClient wc = WebClient.create("http://localhost:9080/bookstorestorage/bookforms",
                                        "foo", "bar", null);
       
        Response r = wc.form(new Form().set("name", "CXF Rocks").set("id", "123"));
       
        Book b = readBook((InputStream)r.getEntity());
        assertEquals("CXF Rocks", b.getName());
        assertEquals(123L, b.getId());
    }
View Full Code Here

@Path("/bookstorestorage/")
public class SecureBookStoreNoInterface {
    private Map<Long, Book> books = new HashMap<Long, Book>();
 
    public SecureBookStoreNoInterface() {
        Book book = new Book();
        book.setId(123L);
        book.setName("CXF in Action");
        books.put(book.getId(), book);
    }
View Full Code Here

    @Secured({"ROLE_USER", "ROLE_ADMIN" })
    public Book getBookFromFormParams(@FormParam("name") String name, @FormParam("id") long id) {
        if (name == null || id == 0) {
            throw new RuntimeException("FormParams are not set");
        }
        return new Book(name, id);
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.systest.jaxrs.Book

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.