use of org.apache.cxf.ext.logging.LoggingInInterceptor in project cxf by apache.
the class JAXRSSoapBookTest method testAddOrderFormBean.
@Test
public void testAddOrderFormBean() throws Exception {
String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress, BookStoreJaxrsJaxws.class);
WebClient.getConfig(proxy).getOutInterceptors().add(new LoggingOutInterceptor());
WebClient.getConfig(proxy).getInInterceptors().add(new LoggingInInterceptor());
BookSubresource bs = proxy.getBookSubresource("139");
OrderBean order = new OrderBean();
order.setId(123L);
order.setWeight(100);
order.setCustomerTitle(OrderBean.Title.MS);
OrderBean order2 = bs.addOrder(order);
assertEquals(Long.valueOf(123L), Long.valueOf(order2.getId()));
assertEquals(OrderBean.Title.MS, order2.getCustomerTitle());
}
use of org.apache.cxf.ext.logging.LoggingInInterceptor in project cxf by apache.
the class JAXRSClientServerBookTest method testGetBookDescriptionHttpResponse.
@Test
public void testGetBookDescriptionHttpResponse() throws Exception {
String address = "http://localhost:" + PORT + "/bookstore/httpresponse";
WebClient wc = WebClient.create(address);
WebClient.getConfig(wc).getInInterceptors().add(new LoggingInInterceptor());
Response r = wc.get();
assertEquals("text/plain", r.getMediaType().toString());
assertEquals("Good Book", r.readEntity(String.class));
}
use of org.apache.cxf.ext.logging.LoggingInInterceptor in project cxf by apache.
the class JAXRSClientServerResourceCreatedSpringProviderTest method testPostPetStatusType.
@Test
public void testPostPetStatusType() throws Exception {
JAXBElementProvider<Object> p = new JAXBElementProvider<Object>();
p.setUnmarshallAsJaxbElement(true);
WebClient wc = WebClient.create("http://localhost:" + PORT + "/webapp/pets/petstore/jaxb/statusType/", Collections.singletonList(p));
WebClient.getConfig(wc).getInInterceptors().add(new LoggingInInterceptor());
wc.accept("text/xml");
PetStore.PetStoreStatusType type = wc.get(PetStore.PetStoreStatusType.class);
assertEquals(PetStore.CLOSED, type.getStatus());
}
use of org.apache.cxf.ext.logging.LoggingInInterceptor in project cxf by apache.
the class AegisClientServerTest method testComplexMapResult.
@Test
public void testComplexMapResult() throws Exception {
AegisDatabinding aegisBinding = new AegisDatabinding();
JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
proxyFactory.setDataBinding(aegisBinding);
proxyFactory.setServiceClass(SportsService.class);
proxyFactory.setAddress("http://localhost:" + PORT + "/jaxwsAndAegisSports");
proxyFactory.getInInterceptors().add(new LoggingInInterceptor());
proxyFactory.getOutInterceptors().add(new LoggingOutInterceptor());
SportsService service = (SportsService) proxyFactory.create();
Map<String, Map<Integer, Integer>> result = service.testComplexMapResult();
assertEquals(result.size(), 1);
assertTrue(result.containsKey("key1"));
assertNotNull(result.get("key1"));
assertEquals(result.toString(), "{key1={1=3}}");
}
use of org.apache.cxf.ext.logging.LoggingInInterceptor in project cxf by apache.
the class AegisClientServerTest method testReturnQualifiedPair.
@Test
public void testReturnQualifiedPair() throws Exception {
AegisDatabinding aegisBinding = new AegisDatabinding();
JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
proxyFactory.setDataBinding(aegisBinding);
proxyFactory.setServiceClass(SportsService.class);
proxyFactory.setAddress("http://localhost:" + PORT + "/jaxwsAndAegisSports");
proxyFactory.getInInterceptors().add(new LoggingInInterceptor());
proxyFactory.getOutInterceptors().add(new LoggingOutInterceptor());
SportsService service = (SportsService) proxyFactory.create();
Pair<Integer, String> ret = service.getReturnQualifiedPair(111, "ffang");
assertEquals(new Integer(111), ret.getFirst());
assertEquals("ffang", ret.getSecond());
}
Aggregations