use of org.apache.cxf.systest.jaxrs.jaxws.BookStoreJaxrsJaxws in project cxf by apache.
the class JAXRSSoapBookTest method testPostGetBookFastinfosetProxy.
@Test
public void testPostGetBookFastinfosetProxy() throws Exception {
JAXBElementProvider<Object> p = new JAXBElementProvider<Object>();
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));
}
use of org.apache.cxf.systest.jaxrs.jaxws.BookStoreJaxrsJaxws in project cxf by apache.
the class JAXRSSoapBookTest method testGetBookSoap.
@Test
public void testGetBookSoap() throws Exception {
String wsdlAddress = "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);
}
use of org.apache.cxf.systest.jaxrs.jaxws.BookStoreJaxrsJaxws in project cxf by apache.
the class JAXRSSoapBookTest method testPostGetBookFastinfosetProxyInterceptors.
@Test
public void testPostGetBookFastinfosetProxyInterceptors() throws Exception {
JAXBElementProvider<Object> p = new JAXBElementProvider<Object>();
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).getRequestContext();
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));
}
use of org.apache.cxf.systest.jaxrs.jaxws.BookStoreJaxrsJaxws in project cxf by apache.
the class JAXRSSoapBookTest method testGetBookSubresourceWebClientProxyBean.
@Test
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);
}
use of org.apache.cxf.systest.jaxrs.jaxws.BookStoreJaxrsJaxws in project cxf by apache.
the class JAXRSSoapBookTest method testGetBookSubresourceClientNoProduces.
@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());
}
Aggregations