Package org.apache.cxf.systest.jaxrs

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


        String endpointAddress =
            "http://localhost:" + PORT + "/service/jaas2";
        SecureBookStoreNoAnnotations proxy =
            JAXRSClientFactory.create(endpointAddress, SecureBookStoreNoAnnotations.class,
                                      "bob", "bobspassword", null);
        Book book = proxy.getThatBook(123L);
        assertEquals(123L, book.getId());
    }
View Full Code Here


        WebClient wc = WebClient.create("http://localhost:" + PORT + "/bookstorestorage/bookforms",
                                        "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

        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

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

    private void doTestGetBook123Proxy(String configFile) throws Exception {
        BookStore bs = JAXRSClientFactory.create("https://localhost:" + PORT, BookStore.class,
                configFile);
        // 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

        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);
        ctx.close();
    }
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

                              ? RandomStrategy.class
                              : SequentialStrategy.class);
            String bookId = expectServerException ? "9999" : "123";
            Exception ex = null;
            try {
                Book book = bookStore.getBook(bookId);
                assertNotNull("expected non-null response", book);
                assertEquals("unexpected id", 123L, book.getId());
            } catch (Exception error) {
                if (!expectServerException) {
                    //String currEndpoint = getCurrentEndpointAddress(bookStore);
                    //assertTrue(currEndpoint.equals(inactiveReplica));
                    throw error;
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.