Examples of BookStoreJaxrsJaxws


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");
        Book b = bs.getTheBook3("679", "CXF in Action - ", new Integer(679));
        assertEquals(679, b.getId());
        assertEquals("CXF in Action - 679", b.getName());
    }
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

        bean.setResourceClass(BookStoreJaxrsJaxws.class);
        TestFeature testFeature = new TestFeature();
        List<AbstractFeature> features = new ArrayList<AbstractFeature>();
        features.add((AbstractFeature)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

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((AbstractFeature)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", "fault from bad interceptor".equals(e.getMessage()));
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((AbstractFeature)testFeature);
        bean.setFeatures(features);
        BookStoreJaxrsJaxws proxy = (BookStoreJaxrsJaxws)bean.create();
        WebClient.getConfig(proxy).getRequestContext().put("org.apache.cxf.http.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 interecptors not called when checked exception thrown from server
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
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.