use of org.apache.cxf.message.MessageImpl in project cxf by apache.
the class JAXWSMethodInvokerTest method testSuspendedException.
@Test
public void testSuspendedException() throws Throwable {
Exception originalException = new RuntimeException();
ContinuationService serviceObject = new ContinuationService(originalException);
Method serviceMethod = ContinuationService.class.getMethod("invoke", new Class[] {});
Exchange ex = new ExchangeImpl();
Message inMessage = new MessageImpl();
ex.setInMessage(inMessage);
inMessage.setExchange(ex);
inMessage.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
JAXWSMethodInvoker jaxwsMethodInvoker = prepareJAXWSMethodInvoker(ex, serviceObject, serviceMethod);
try {
jaxwsMethodInvoker.invoke(ex, new MessageContentsList(new Object[] {}));
fail("Suspended invocation swallowed");
} catch (SuspendedInvocationException suspendedEx) {
assertSame(suspendedEx, serviceObject.getSuspendedException());
assertSame(originalException, suspendedEx.getRuntimeException());
}
}
use of org.apache.cxf.message.MessageImpl in project cxf by apache.
the class ColocMessageObserverTest method testObserverOnMessage.
@Test
public void testObserverOnMessage() throws Exception {
msg.setExchange(ex);
Binding binding = control.createMock(Binding.class);
EasyMock.expect(ep.getBinding()).andReturn(binding);
Message inMsg = new MessageImpl();
EasyMock.expect(binding.createMessage()).andReturn(inMsg);
EasyMock.expect(ep.getService()).andReturn(srv).anyTimes();
EasyMock.expect(bus.getExtension(PhaseManager.class)).andReturn(new PhaseManagerImpl()).times(2);
EasyMock.expect(bus.getInInterceptors()).andReturn(new ArrayList<Interceptor<? extends Message>>());
EasyMock.expect(ep.getInInterceptors()).andReturn(new ArrayList<Interceptor<? extends Message>>());
EasyMock.expect(srv.getInInterceptors()).andReturn(new ArrayList<Interceptor<? extends Message>>());
EasyMock.expect(bus.getExtension(ClassLoader.class)).andReturn(this.getClass().getClassLoader());
control.replay();
observer = new TestColocMessageObserver(ep, bus);
observer.onMessage(msg);
control.verify();
Exchange inEx = inMsg.getExchange();
assertNotNull("Should Have a valid Exchange", inEx);
assertFalse("Message.REQUESTOR_ROLE should be false", (Boolean) inMsg.get(Message.REQUESTOR_ROLE));
assertTrue("Message.INBOUND_MESSAGE should be true", (Boolean) inMsg.get(Message.INBOUND_MESSAGE));
assertNotNull("Chain should be set", inMsg.getInterceptorChain());
Exchange ex1 = msg.getExchange();
assertNotNull("Exchange should be set", ex1);
}
use of org.apache.cxf.message.MessageImpl in project cxf by apache.
the class CorbaDSIServant method invoke.
public void invoke(ServerRequest request) throws CorbaBindingException {
String opName = request.operation();
QName requestOperation = operationMap.get(opName);
MessageImpl msgImpl = new MessageImpl();
msgImpl.setDestination(getDestination());
Exchange exg = new ExchangeImpl();
exg.put(String.class, requestOperation.getLocalPart());
exg.put(ORB.class, getOrb());
exg.put(ServerRequest.class, request);
msgImpl.setExchange(exg);
CorbaMessage msg = new CorbaMessage(msgImpl);
msg.setCorbaTypeMap(typeMap);
// If there's no output message part in our operation then it's a oneway op
final BindingOperationInfo bindingOpInfo;
try {
bindingOpInfo = this.destination.getEndPointInfo().getBinding().getOperation(requestOperation);
} catch (Exception ex) {
throw new CorbaBindingException("Invalid Request. Operation unknown: " + opName);
}
if (bindingOpInfo != null) {
BindingMessageInfo bindingMsgOutputInfo = bindingOpInfo.getOutput();
if (bindingMsgOutputInfo == null) {
exg.setOneWay(true);
}
}
// invokes the interceptors
getObserver().onMessage(msg);
}
use of org.apache.cxf.message.MessageImpl in project cxf by apache.
the class ColocOutInterceptorTest method setUp.
@Before
public void setUp() throws Exception {
colocOut = new ColocOutInterceptor();
msg = new MessageImpl();
ex = new ExchangeImpl();
msg.setExchange(ex);
}
use of org.apache.cxf.message.MessageImpl in project cxf by apache.
the class ProviderFactoryTest method testParameterHandlerProviderWithPriority.
@Test
public void testParameterHandlerProviderWithPriority() throws Exception {
ProviderFactory pf = ServerProviderFactory.getInstance();
ParamConverterProvider h = new CustomerParameterHandler();
ParamConverterProvider hp = new PriorityCustomerParameterHandler();
pf.registerUserProvider(h);
pf.registerUserProvider(hp);
ParamConverter<Customer> h2 = pf.createParameterHandler(Customer.class, Customer.class, null, new MessageImpl());
assertSame(h2, hp);
}
Aggregations