use of org.apache.cxf.jaxws.handler.logical.LogicalMessageImpl in project cxf by apache.
the class LogicalMessageImplTest method testGetPayloadOfJAXB.
@Test
public void testGetPayloadOfJAXB() throws Exception {
// using Dispatch
JAXBContext ctx = JAXBContext.newInstance(ObjectFactory.class);
Message message = new MessageImpl();
Exchange e = new ExchangeImpl();
message.setExchange(e);
LogicalMessageContextImpl lmci = new LogicalMessageContextImpl(message);
JAXBElement<AddNumbers> el = new ObjectFactory().createAddNumbers(req);
LogicalMessageImpl lmi = new LogicalMessageImpl(lmci);
lmi.setPayload(el, ctx);
Object obj = lmi.getPayload(ctx);
assertTrue(obj instanceof JAXBElement);
JAXBElement<?> el2 = (JAXBElement<?>) obj;
assertTrue(el2.getValue() instanceof AddNumbers);
AddNumbers resp = (AddNumbers) el2.getValue();
assertEquals(req.getArg0(), resp.getArg0());
assertEquals(req.getArg1(), resp.getArg1());
}
Aggregations