Package org.apache.cxf.jaxrs.client

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


        String address = "http://localhost:" + PORT;
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setProvider(new BookStore.StringArrayBodyReaderWriter());
        bean.setAddress(address);
        bean.setResourceClass(BookStore.class);
        BookStore store = bean.create(BookStore.class);
        String[] str = store.getBookStringArray();
        assertEquals("Good book", str[0]);
    }
   
    @Test
View Full Code Here


        String address = "http://localhost:" + PORT;
        JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
        bean.setProvider(new BookStore.StringListBodyReaderWriter());
        bean.setAddress(address);
        bean.setResourceClass(BookStore.class);
        BookStore store = bean.create(BookStore.class);
        List<String> str = store.getBookListArray();
        assertEquals("Good book", str.get(0));
    }
   
    @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

    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

            new ClassPathXmlApplicationContext(new String[] {CLIENT_CONFIG_FILE5});
        Object bean = ctx.getBean("bookService.proxyFactory");
        assertNotNull(bean);
        JAXRSClientFactoryBean cfb = (JAXRSClientFactoryBean) bean;
       
        WebClient wc = (WebClient)cfb.create();
        assertEquals("https://localhost:" + PORT, wc.getBaseURI().toString());
       
        wc.accept("application/xml");
        wc.path("bookstore/securebooks/123");
        TheBook b = wc.get(TheBook.class);
View Full Code Here

            new ClassPathXmlApplicationContext(new String[] {cfgFile});
        Object bean = ctx.getBean("bookService.proxyFactory");
        assertNotNull(bean);
        JAXRSClientFactoryBean cfb = (JAXRSClientFactoryBean) bean;
       
        BookStore bs = cfb.create(BookStore.class);
        assertEquals("https://localhost:" + PORT, WebClient.client(bs).getBaseURI().toString());
        Book b = bs.getSecureBook("123");
        assertEquals(b.getId(), 123);
        b = bs.getSecureBook("123");
        assertEquals(b.getId(), 123);
View Full Code Here

            new ClassPathXmlApplicationContext(new String[] {CLIENT_CONFIG_FILE4});
        Object bean = ctx.getBean("bookService.proxyFactory");
        assertNotNull(bean);
        JAXRSClientFactoryBean cfb = (JAXRSClientFactoryBean) bean;
       
        BookStore bs = cfb.create(BookStore.class);
        assertEquals("https://localhost:" + PORT, WebClient.client(bs).getBaseURI().toString());
       
        WebClient wc = WebClient.fromClient(WebClient.client(bs));
        assertEquals("https://localhost:" + PORT, WebClient.client(bs).getBaseURI().toString());
        wc.accept("application/xml");
View Full Code Here

            new ClassPathXmlApplicationContext(new String[] {CLIENT_CONFIG_FILE5});
        Object bean = ctx.getBean("bookService.proxyFactory");
        assertNotNull(bean);
        JAXRSClientFactoryBean cfb = (JAXRSClientFactoryBean) bean;
       
        WebClient wc = (WebClient)cfb.create();
        assertEquals("https://localhost:" + PORT, wc.getBaseURI().toString());
       
        wc.accept("application/xml");
        wc.path("bookstore/securebooks/123");
        TheBook b = wc.get(TheBook.class);
View Full Code Here

        JAXRSClientFactoryBean cfb = (JAXRSClientFactoryBean) bean;
        Bus bus = cfb.getBus();
        ClientLifeCycleManager manager = bus.getExtension(ClientLifeCycleManager.class);
        TestClientLifeCycleListener listener = new TestClientLifeCycleListener();
        manager.registerListener(listener);
        BookStore bs = cfb.create(BookStore.class);
        assertNotNull(listener.getEp());
        assertEquals("{http://service.rs}BookService",
                     listener.getEp().getEndpointInfo().getName().toString());
        assertEquals("https://localhost:" + PORT, WebClient.client(bs).getBaseURI().toString());
        Book b = bs.getSecureBook("123");
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.