use of org.apache.cxf.binding.corba.runtime.CorbaStreamableImpl in project cxf by apache.
the class CorbaServerConduitTest method testBuildRequestResultArgumentReturn.
@Test
public void testBuildRequestResultArgumentReturn() {
CorbaStreamable[] arguments = new CorbaStreamable[1];
QName objName = new QName("object");
QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "short", CorbaConstants.NP_WSDL_CORBA);
TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_short);
CorbaPrimitiveHandler obj = new CorbaPrimitiveHandler(objName, objIdlType, objTypeCode, null);
CorbaStreamable arg = new CorbaStreamableImpl(obj, objName);
arguments[0] = arg;
arguments[0].setMode(org.omg.CORBA.ARG_OUT.value);
NVList nvlist = orb.create_list(2);
Any value = orb.create_any();
value.insert_Streamable(arguments[0]);
nvlist.add_value(arguments[0].getName(), value, arguments[0].getMode());
CorbaServerConduit conduit = setupCorbaServerConduit(false);
CorbaMessage msg = control.createMock(CorbaMessage.class);
Exchange exchange = control.createMock(Exchange.class);
ServerRequest request = control.createMock(ServerRequest.class);
EasyMock.expect(msg.getExchange()).andReturn(exchange);
EasyMock.expect(exchange.get(ServerRequest.class)).andReturn(request);
EasyMock.expect(exchange.isOneWay()).andReturn(false);
EasyMock.expect(msg.getExchange()).andReturn(exchange);
Message message = new MessageImpl();
CorbaMessage corbaMessage = new CorbaMessage(message);
corbaMessage.setList(nvlist);
EasyMock.expect(exchange.getInMessage()).andReturn(corbaMessage);
EasyMock.expect(msg.getStreamableException()).andReturn(null);
EasyMock.expect(msg.getStreamableArguments()).andReturn(arguments);
EasyMock.expect(msg.getStreamableReturn()).andReturn(arg);
control.replay();
conduit.buildRequestResult(msg);
control.verify();
}
use of org.apache.cxf.binding.corba.runtime.CorbaStreamableImpl in project cxf by apache.
the class CorbaServerConduitTest method testBuildRequestResultException.
@Test
public void testBuildRequestResultException() {
NVList list = orb.create_list(0);
CorbaServerConduit conduit = setupCorbaServerConduit(false);
CorbaMessage msg = control.createMock(CorbaMessage.class);
Exchange exchange = control.createMock(Exchange.class);
ServerRequest request = control.createMock(ServerRequest.class);
EasyMock.expect(msg.getExchange()).andReturn(exchange);
EasyMock.expect(exchange.get(ServerRequest.class)).andReturn(request);
EasyMock.expect(exchange.isOneWay()).andReturn(false);
CorbaMessage inMsg = EasyMock.createMock(CorbaMessage.class);
EasyMock.expect(msg.getExchange()).andReturn(exchange);
EasyMock.expect(exchange.getInMessage()).andReturn(inMsg);
EasyMock.expect(inMsg.getList()).andReturn(list);
QName objName = new QName("object");
QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "short", CorbaConstants.NP_WSDL_CORBA);
TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_short);
CorbaPrimitiveHandler obj = new CorbaPrimitiveHandler(objName, objIdlType, objTypeCode, null);
CorbaStreamable exception = new CorbaStreamableImpl(obj, objName);
EasyMock.expect(msg.getStreamableException()).andReturn(exception);
EasyMock.expect(msg.getStreamableException()).andReturn(exception);
control.replay();
conduit.buildRequestResult(msg);
control.verify();
}
Aggregations