Search in sources :

Example 1 with CorbaStreamableImpl

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();
}
Also used : CorbaStreamableImpl(org.apache.cxf.binding.corba.runtime.CorbaStreamableImpl) Message(org.apache.cxf.message.Message) TypeCode(org.omg.CORBA.TypeCode) QName(javax.xml.namespace.QName) Any(org.omg.CORBA.Any) CorbaPrimitiveHandler(org.apache.cxf.binding.corba.types.CorbaPrimitiveHandler) Exchange(org.apache.cxf.message.Exchange) NVList(org.omg.CORBA.NVList) ServerRequest(org.omg.CORBA.ServerRequest) MessageImpl(org.apache.cxf.message.MessageImpl) Test(org.junit.Test)

Example 2 with CorbaStreamableImpl

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();
}
Also used : Exchange(org.apache.cxf.message.Exchange) CorbaPrimitiveHandler(org.apache.cxf.binding.corba.types.CorbaPrimitiveHandler) CorbaStreamableImpl(org.apache.cxf.binding.corba.runtime.CorbaStreamableImpl) TypeCode(org.omg.CORBA.TypeCode) QName(javax.xml.namespace.QName) NVList(org.omg.CORBA.NVList) ServerRequest(org.omg.CORBA.ServerRequest) Test(org.junit.Test)

Aggregations

QName (javax.xml.namespace.QName)2 CorbaStreamableImpl (org.apache.cxf.binding.corba.runtime.CorbaStreamableImpl)2 CorbaPrimitiveHandler (org.apache.cxf.binding.corba.types.CorbaPrimitiveHandler)2 Exchange (org.apache.cxf.message.Exchange)2 Test (org.junit.Test)2 NVList (org.omg.CORBA.NVList)2 ServerRequest (org.omg.CORBA.ServerRequest)2 TypeCode (org.omg.CORBA.TypeCode)2 Message (org.apache.cxf.message.Message)1 MessageImpl (org.apache.cxf.message.MessageImpl)1 Any (org.omg.CORBA.Any)1