Package org.apache.cxf.jaxrs.client

Examples of org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean.create()


        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) {
View Full Code Here


        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");
View Full Code Here

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

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

    private void doTestSDOStructure(String address) throws Exception {
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setDataBinding(new SDODataBinding());
        bean.setAddress(address);
        bean.setResourceClass(SDOResource.class);
        SDOResource client = bean.create(SDOResource.class);
        Structure struct = client.getStructure();
        assertEquals("sdo", struct.getText());
        assertEquals(123.5, struct.getDbl(), 0.01);
        assertEquals(3, struct.getInt());
    }
View Full Code Here

        bean.setAddress("http://localhost:" + PORT + "/databinding/sdo");
        bean.setResourceClass(SDOResource.class);
        List<Interceptor<? extends Message>> list = new ArrayList<Interceptor<? extends Message>>();
        list.add(new LoggingInInterceptor());
        bean.setInInterceptors(list);
        SDOResource client = bean.create(SDOResource.class);
        WebClient.client(client).accept("application/json");
        Structure struct = client.getStructure();
        assertEquals("sdo", struct.getText());
        assertEquals(123.5, struct.getDbl(), 0.01);
        assertEquals(3, struct.getInt());
View Full Code Here

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

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

            sigInterceptor.setStyle(XmlSigOutInterceptor.ENVELOPING_SIG);
        }
        bean.getOutInterceptors().add(sigInterceptor);
        bean.setServiceClass(BookStore.class);
       
        BookStore store = bean.create(BookStore.class);
        try {
            Book book = store.addBook(new Book("CXF", 126L));
            assertEquals(126L, book.getId());
        } catch (ServerWebApplicationException ex) {
            fail(ex.getMessage());
View Full Code Here

    private void doTestSDOStructure(String address) throws Exception {
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setDataBinding(new SDODataBinding());
        bean.setAddress(address);
        bean.setResourceClass(SDOResource.class);
        SDOResource client = bean.create(SDOResource.class);
        Structure struct = client.getStructure();
        assertEquals("sdo", struct.getText());
        assertEquals(123.5, struct.getDbl(), 0.01);
        assertEquals(3, struct.getInt());
    }
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.