Search in sources :

Example 11 with NVList

use of org.omg.CORBA.NVList 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(exchange.getBus()).andReturn(bus);
    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)

Example 12 with NVList

use of org.omg.CORBA.NVList 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(exchange.getBus()).andReturn(bus);
    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)

Aggregations

NVList (org.omg.CORBA.NVList)12 QName (javax.xml.namespace.QName)7 Any (org.omg.CORBA.Any)7 Exchange (org.apache.cxf.message.Exchange)6 Test (org.junit.Test)6 ServerRequest (org.omg.CORBA.ServerRequest)5 TypeCode (org.omg.CORBA.TypeCode)5 CorbaPrimitiveHandler (org.apache.cxf.binding.corba.types.CorbaPrimitiveHandler)4 CorbaStreamableImpl (org.apache.cxf.binding.corba.runtime.CorbaStreamableImpl)2 CorbaObjectHandler (org.apache.cxf.binding.corba.types.CorbaObjectHandler)2 Message (org.apache.cxf.message.Message)2 MessageImpl (org.apache.cxf.message.MessageImpl)2 BindingMessageInfo (org.apache.cxf.service.model.BindingMessageInfo)2 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)2 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)2 ExceptionList (org.omg.CORBA.ExceptionList)2 NamedValue (org.omg.CORBA.NamedValue)2 Request (org.omg.CORBA.Request)2 IOException (java.io.IOException)1 CorbaDestination (org.apache.cxf.binding.corba.CorbaDestination)1