Examples of BookStoreJaxrsJaxws


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

        final boolean addBadOutInterceptor = true;
        TestFeature testFeature = new TestFeature(addBadOutInterceptor);
        List<AbstractFeature> features = new ArrayList<AbstractFeature>();
        features.add(testFeature);
        bean.setFeatures(features);
        BookStoreJaxrsJaxws proxy = (BookStoreJaxrsJaxws)bean.create();
        try {
            //321 is special case - causes error code of 525
            proxy.getBook(new Long("123"));
            fail("Method should have thrown an exception");
        } catch (Exception e) {
            assertTrue("Out Interceptor not invoked", testFeature.handleMessageOnOutInterceptorCalled());
            assertTrue("In Interceptor not invoked", !testFeature.handleMessageOnInInterceptorCalled());
            assertTrue("Wrong exception caught",
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();
        WebClient.getConfig(proxy).getRequestContext().put("org.apache.cxf.transport.no_io_exceptions", false);
        try {
            //321 is special case - causes error code of 525
            proxy.getBook(new Long(param));
            fail("Method should have thrown an exception");
        } catch (Exception e) {
            assertTrue("Out Interceptor not invoked", testFeature.handleMessageOnOutInterceptorCalled());
            if ("322".equals(param)) {
                //In interceptors not called when checked exception thrown from server
View Full Code Here

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

       
        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

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

       
        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).getResponseContext();
        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
    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 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
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.