Examples of BookStoreJaxrsJaxws


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);
        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

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

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

   
    @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

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

    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

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

   
    @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

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

    }
   
    @Test
    public void testAddGetBook123Client() throws Exception {
        String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
        BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
                                                                  BookStoreJaxrsJaxws.class);
        Book b = new Book();
        b.setId(124);
        b.setName("CXF in Action - 2");
        Book b2 = proxy.addBook(b);
        assertNotSame(b, b2);
        assertEquals(124, b2.getId());
        assertEquals("CXF in Action - 2", b2.getName());
    }
View Full Code Here

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

            "http://localhost:" + PORT + "/test/services/soap/bookservice?wsdl";
        URL wsdlUrl = new URL(wsdlAddress);
        BookSoapService service =
            new BookSoapService(wsdlUrl,
                                new QName("http://books.com", "BookService"));
        BookStoreJaxrsJaxws store = service.getBookPort();
        Book book = store.getBook(new Long(123));
        assertEquals("id is wrong", book.getId(), 123);
    }
View Full Code Here

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

        String wsdlAddress =
            "http://localhost:" + PORT + "/test/services/soap-transform/bookservice?wsdl";
        BookSoapService service =
            new BookSoapService(new URL(wsdlAddress),
                                new QName("http://books.com", "BookService"));
        BookStoreJaxrsJaxws store = service.getBookPort();
       
        TransformOutInterceptor out =  new TransformOutInterceptor();
        Map<String, String> mapOut = new HashMap<String, String>();
        // Book content (id, name) is unqualified, thus the following works
        // because JAXB will report
        // - {http://jaxws.jaxrs.systest.cxf.apache.org/}Book
        // - id
        // - name
        // and only the qualified top-level Book tag gets matched by the following
        // mapping
        mapOut.put("{http://jaxws.jaxrs.systest.cxf.apache.org/}*", "*");
        out.setOutTransformElements(mapOut);
       
        TransformInInterceptor in =  new TransformInInterceptor();
        Map<String, String> mapIn = new HashMap<String, String>();
        // mapIn.put("*", "{http://jaxws.jaxrs.systest.cxf.apache.org/}*");
        // won't work for a case where a totally unqualified getBookResponse needs to be
        // qualified such that only the top-level getBookResponse is processed because of '*'.
        // Such a mapping would work nicely if we had say a package-info making both
        // Book id & name qualified; otherwise we need to choose what tag we need to qualify
       
        // mapIn.put("*", "{http://jaxws.jaxrs.systest.cxf.apache.org/}*");
        // works too if the schema validation is disabled
       
        mapIn.put("getBookResponse", "{http://jaxws.jaxrs.systest.cxf.apache.org/}getBookResponse");
        in.setInTransformElements(mapIn);
       
        Client cl = ClientProxy.getClient(store);
        ((HTTPConduit)cl.getConduit()).getClient().setReceiveTimeout(10000000);
        cl.getInInterceptors().add(in);
        cl.getOutInterceptors().add(out);
       
        Book book = store.getBook(new Long(123));
        assertEquals("id is wrong", book.getId(), 123);
       
    }
View Full Code Here

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

        bean.setResourceClass(BookStoreJaxrsJaxws.class);
        TestFeature testFeature = new TestFeature();
        List<AbstractFeature> features = new ArrayList<AbstractFeature>();
        features.add(testFeature);
        bean.setFeatures(features);
        BookStoreJaxrsJaxws proxy = (BookStoreJaxrsJaxws)bean.create();
        Book b = proxy.getBook(new Long("123"));
        assertTrue("Out Interceptor not invoked", testFeature.handleMessageOnOutInterceptorCalled());
        assertTrue("In Interceptor not invoked", testFeature.handleMessageOnInInterceptorCalled());   
        assertEquals(123, b.getId());
        assertEquals("CXF in Action", 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.