Examples of BookStoreJaxrsJaxws


Examples of org.apache.cxf.systest.jaxrs.jaxws.BookStoreJaxrsJaxws

       
        JAXBElementProvider<Object> p = new JAXBElementProvider<Object>();
        p.setConsumeMediaTypes(Collections.singletonList("application/fastinfoset"));
        p.setProduceMediaTypes(Collections.singletonList("application/fastinfoset"));
       
        BookStoreJaxrsJaxws client = JAXRSClientFactory.create(
                                  "http://localhost:" + PORT + "/test/services/rest4",
                                  BookStoreSoapRestFastInfoset2.class,
                                  Collections.singletonList(p));
       
        Book b = new Book("CXF", 1L);
       
        Book b2 = client.addFastinfoBook(b);
       
        assertEquals(b2.getName(), b.getName());
        assertEquals(b2.getId(), b.getId());
       
        checkFiInterceptors(WebClient.getConfig(client));
View Full Code Here

Examples of org.apache.cxf.systest.jaxrs.jaxws.BookStoreJaxrsJaxws

       
        JAXBElementProvider<Object> p = new JAXBElementProvider<Object>();
        p.setConsumeMediaTypes(Collections.singletonList("application/fastinfoset"));
        p.setProduceMediaTypes(Collections.singletonList("application/fastinfoset"));
       
        BookStoreJaxrsJaxws client = JAXRSClientFactory.create(
                                  "http://localhost:" + PORT + "/test/services/rest5",
                                  BookStoreSoapRestFastInfoset3.class,
                                  Collections.singletonList(p));
       
        Book b = new Book("CXF", 1L);
       
        // Just to make sure it is enforced
        Map<String, Object> props = WebClient.getConfig(client).getRequestContext();
        props.put(FIStaxOutInterceptor.FI_ENABLED, Boolean.TRUE);
       
        Book b2 = client.addFastinfoBook(b);
       
        assertEquals(b2.getName(), b.getName());
        assertEquals(b2.getId(), b.getId());
       
        checkFiInterceptors(WebClient.getConfig(client));
View Full Code Here

Examples of org.apache.cxf.systest.jaxrs.jaxws.BookStoreJaxrsJaxws

   
    @Test
    public void testGetBook123Client() throws Exception {
       
        String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
                                                                  BookStoreJaxrsJaxws.class);
        HTTPConduit conduit = (HTTPConduit)WebClient.getConfig(proxy).getConduit();
       
        Book b = proxy.getBook(new Long("123"));
        assertEquals(123, b.getId());
        assertEquals("CXF in Action", b.getName());
       
        HTTPConduit conduit2 = (HTTPConduit)WebClient.getConfig(proxy).getConduit();
        assertSame(conduit, conduit2);
       
        conduit.getClient().setAutoRedirect(true);
        b = proxy.getBook(new Long("123"));
        assertEquals(123, b.getId());
        assertEquals("CXF in Action", b.getName());
    }
View Full Code Here

Examples of org.apache.cxf.systest.jaxrs.jaxws.BookStoreJaxrsJaxws

   
    @Test
    public void testGetBook356ClientException() throws Exception {
       
        String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
                                          BookStoreJaxrsJaxws.class,
                                          Collections.singletonList(new TestResponseExceptionMapper()));
       
        try {
            proxy.getBook(356L);
            fail();
        } catch (BookNotFoundFault ex) {
            assertEquals("No Book with id 356 is available", ex.getMessage());
        }
    }
View Full Code Here

Examples of org.apache.cxf.systest.jaxrs.jaxws.BookStoreJaxrsJaxws

    @Test(expected = NotFoundException.class)  
    public void testCheckBookClientException() {
       
        String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
                                          BookStoreJaxrsJaxws.class,
                                          Collections.singletonList(new NotFoundResponseExceptionMapper()));
        proxy.checkBook(100L);
    }
View Full Code Here

Examples of org.apache.cxf.systest.jaxrs.jaxws.BookStoreJaxrsJaxws

    @Test
    public void testCheckBookClientErrorResponse() {
       
        String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
                                          BookStoreJaxrsJaxws.class,
                                          Collections.singletonList(new DummyResponseExceptionMapper()));
        Response response = proxy.checkBook(100L);
        assertEquals(HttpStatus.SC_NOT_FOUND, response.getStatus());
    }
View Full Code Here

Examples of org.apache.cxf.systest.jaxrs.jaxws.BookStoreJaxrsJaxws

   
    @Test
    public void testGetBookSubresourceClient() throws Exception {
       
        String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
                                                                  BookStoreJaxrsJaxws.class);
        BookSubresource bs = proxy.getBookSubresource("125");
        Book b = bs.getTheBook();
        assertEquals(125, b.getId());
        assertEquals("CXF in Action", b.getName());
    }
View Full Code Here

Examples of org.apache.cxf.systest.jaxrs.jaxws.BookStoreJaxrsJaxws

   
    @Test
    public void testGetBookSubresourceClientWithContext() throws Exception {
       
        String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
                                                                  BookStoreJaxrsJaxws.class);
        BookSubresource bs = proxy.getBookSubresource("125");
        Book b = bs.getTheBookWithContext(null);
        assertEquals(125, b.getId());
        assertEquals("CXF in Action", b.getName());
    }
View Full Code Here

Examples of org.apache.cxf.systest.jaxrs.jaxws.BookStoreJaxrsJaxws

   
    @Test
    public void testGetBookSubresourceClientNoProduces() throws Exception {
       
        String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
                                                                  BookStoreJaxrsJaxws.class);
        BookSubresource bs = proxy.getBookSubresource("125");
        Book b = bs.getTheBookNoProduces();
        assertEquals(125, b.getId());
        assertEquals("CXF in Action", b.getName());
    }
View Full Code Here

Examples of org.apache.cxf.systest.jaxrs.jaxws.BookStoreJaxrsJaxws

   
    @Test
    public void testGetBookSubresourceParamExtensions() throws Exception {
       
        String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
                                                              BookStoreJaxrsJaxws.class);
        WebClient.getConfig(proxy).getOutInterceptors().add(new LoggingOutInterceptor());
        BookSubresource bs = proxy.getBookSubresource("139");
        Book bean = new Book("CXF Rocks", 139L);
        Book b = bs.getTheBook4(bean, bean, bean, bean);
        assertEquals(139, b.getId());
        assertEquals("CXF Rocks", 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.