Package org.apache.cxf.systest.jaxrs.jaxws

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


   
    @Test
    public void testAddOrderFormBean() throws Exception {
       
        String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
                                                              BookStoreJaxrsJaxws.class);
        BookSubresource bs = proxy.getBookSubresource("139");
        OrderBean order = new OrderBean();
        order.setId(123L);
        order.setWeight(100);
        OrderBean order2 = bs.addOrder(order);
        assertEquals(Long.valueOf(123L), Long.valueOf(order2.getId()));
View Full Code Here


   
    @Test
    public void testGetBookSubresourceClient2() throws Exception {
       
        String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
                                                                  BookStoreJaxrsJaxws.class);
        doTestSubresource(proxy);
        BookStoreJaxrsJaxws proxy2 = proxy.getBookStore("number1");
        doTestSubresource(proxy2);
        BookStoreJaxrsJaxws proxy3 = proxy2.getBookStore("number1");
        doTestSubresource(proxy3);
    }
View Full Code Here

    public void testGetBookSubresourceWebClientProxyBean() throws Exception {
       
        WebClient client = WebClient.create("http://localhost:" + PORT + "/test/services/rest");
        client.type(MediaType.TEXT_PLAIN_TYPE)
            .accept(MediaType.APPLICATION_XML_TYPE, MediaType.TEXT_XML_TYPE);
        BookStoreJaxrsJaxws proxy =
            JAXRSClientFactory.fromClient(client, BookStoreJaxrsJaxws.class, true);
       
        doTestSubresource(proxy);
       
        BookStoreJaxrsJaxws proxy2 = JAXRSClientFactory.fromClient(
            WebClient.client(proxy), BookStoreJaxrsJaxws.class);
        doTestSubresource(proxy2);
       
    }
View Full Code Here

   
    @Test
    public void testGetBookSubresourceClientFormParam() throws Exception {
       
        String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
                                                                  BookStoreJaxrsJaxws.class);
        BookSubresource bs = proxy.getBookSubresource("679");
        List<String> parts = new ArrayList<String>();
        parts.add("CXF in Action - ");
        parts.add(Integer.toString(679));
        Book b = bs.getTheBook3("679", parts);
        assertEquals(679, b.getId());
View Full Code Here

       
        JAXBElementProvider p = new JAXBElementProvider();
        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

       
        JAXBElementProvider p = new JAXBElementProvider();
        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

   
    @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

   
    @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

   
    @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

   
    @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

TOP

Related Classes of org.apache.cxf.systest.jaxrs.jaxws.BookStoreJaxrsJaxws

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.