Package org.apache.cxf.systest.jaxrs

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


        BookStore bs = cfb.create(BookStore.class);
        assertNotNull(listener.getEp());
        assertEquals("{http://service.rs}BookService",
                     listener.getEp().getEndpointInfo().getName().toString());
        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_FILE1);
        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_FILE1);
        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

    private void doTestGetBook123WebClient(String configFile) throws Exception {
        WebClient client = WebClient.create("https://localhost:" + PORT, configFile);
        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

@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

    @RolesAllowed({"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

        assertEquals(Status.CREATED.getStatusCode(), r.getStatus());
       
        r = createWebClient("/rest/api/bookstore/books").path(id).get();
        assertEquals(Status.OK.getStatusCode(), r.getStatus());
       
        Book book = r.readEntity(Book.class);
        assertEquals(id, book.getId());
    }
View Full Code Here

       
        BookStore bs = JAXRSClientFactory.create("https://localhost:" + PORT, BookStore.class,
                                                 CLIENT_CONFIG_FILE);
        // 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

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.