Examples of JAXRSClientFactoryBean


Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

    protected JAXRSServerFactoryBean newJAXRSServerFactoryBean() {
        return new JAXRSServerFactoryBean();
    }
   
    protected JAXRSClientFactoryBean newJAXRSClientFactoryBean() {
        return new JAXRSClientFactoryBean();
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

    public JAXRSClientFactoryBean createJAXRSClientFactoryBean() {
        return createJAXRSClientFactoryBean(getAddress());
    }
   
    public JAXRSClientFactoryBean createJAXRSClientFactoryBean(String address) {
        JAXRSClientFactoryBean answer = newJAXRSClientFactoryBean();
        setupJAXRSClientFactoryBean(answer, address);
        return answer;
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

        assertEquals(204, response.getStatus());
    }
   
    @Test
    public void testEmptyPostProxy() throws Exception {
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setAddress("http://localhost:" + PORT);
        bean.setResourceClass(BookStore.class);
        BookStore store = bean.create(BookStore.class);
        store.emptypost();
        assertEquals(204, WebClient.client(store).getResponse().getStatus());
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

        assertEquals(204, response.getStatus());
    }
   
    @Test
    public void testEmptyPostProxy() throws Exception {
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setAddress("http://localhost:9080");
        bean.setResourceClass(BookStore.class);
        BookStore store = bean.create(BookStore.class);
        store.emptypost();
        assertEquals(204, WebClient.client(store).getResponse().getStatus());
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

    }
   
    @Test
    public void testXopWebClient() throws Exception {
        String address = "http://localhost:9085/bookstore/xop";
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setAddress(address);
        bean.setProperties(Collections.singletonMap(org.apache.cxf.message.Message.MTOM_ENABLED,
                                                    (Object)"true"));
        WebClient client = bean.createWebClient();
        HTTPConduit conduit = WebClient.getConfig(client).getHttpConduit();
        conduit.getClient().setReceiveTimeout(1000000);
        conduit.getClient().setConnectionTimeout(1000000);
       
        client.type("multipart/related").accept("text/plain");
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

    }
   
    @Test
    public void testGetBookFastinfoset() throws Exception {
       
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setAddress("http://localhost:9092/test/services/rest3/bookstore/fastinfoset2");
        bean.getInInterceptors().add(new FIStaxInInterceptor());
        JAXBElementProvider p = new JAXBElementProvider();
        p.setConsumeMediaTypes(Collections.singletonList("application/fastinfoset"));
        bean.setProvider(p);
       
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(FIStaxInInterceptor.FI_GET_SUPPORTED, Boolean.TRUE);
        bean.setProperties(props);
       
        WebClient client = bean.createWebClient();
        Book b = client.accept("application/fastinfoset").get(Book.class);
        assertEquals("CXF2", b.getName());
        assertEquals(2L, b.getId());
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

    }
   
    @Test
    public void testPostGetBookFastinfoset() throws Exception {
       
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setAddress("http://localhost:9092/test/services/rest3/bookstore/fastinfoset");
        bean.getOutInterceptors().add(new FIStaxOutInterceptor());
        bean.getInInterceptors().add(new FIStaxInInterceptor());
        JAXBElementProvider p = new JAXBElementProvider();
        p.setConsumeMediaTypes(Collections.singletonList("application/fastinfoset"));
        p.setProduceMediaTypes(Collections.singletonList("application/fastinfoset"));
        bean.setProvider(p);
       
        Map<String, Object> props = new HashMap<String, Object>();
        props.put(FIStaxOutInterceptor.FI_ENABLED, Boolean.TRUE);
        bean.setProperties(props);
       
        WebClient client = bean.createWebClient();
        Book b = new Book("CXF", 1L);
        Book b2 = client.type("application/fastinfoset").accept("application/fastinfoset")
            .post(b, Book.class);
        assertEquals(b2.getName(), b.getName());
        assertEquals(b2.getId(), b.getId());
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

    }
   
    @Test
    public void testNoBook357WebClient() throws Exception {
       
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        Map<String, Object> properties = new HashMap<String, Object>();
        properties.put("org.apache.cxf.http.throw_io_exceptions", Boolean.TRUE);
        bean.setProperties(properties);
        bean.setAddress("http://localhost:9092/test/services/rest/bookstore/356");
        WebClient wc = bean.createWebClient();
        Response response = wc.get();
        assertEquals(404, response.getStatus());
        String msg = IOUtils.readStringFromStream((InputStream)response.getEntity());
        assertEquals("No Book with id 356 is available", msg);
       
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

   
    @Test
    public void testOtherInterceptorDrainingStream() throws Exception {

        String baseAddress = "http://localhost:9092/test/services/rest";
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setAddress(baseAddress);
        bean.getInInterceptors().add(new TestStreamDrainInterptor());
        WebClient client = bean.createWebClient();
        client.path("/bookstore/123").accept(MediaType.APPLICATION_XML_TYPE);
        Book b = client.get(Book.class);
        assertEquals(123, b.getId());
        assertEquals("CXF in Action", b.getName());
    }   
View Full Code Here

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean

    }
   
    @Test
    public void testAddFeatureToClient() throws Exception {
        String baseAddress = "http://localhost:9092/test/services/rest";
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setAddress(baseAddress);
        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
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.