Search in sources :

Example 1 with Context

use of org.omg.CORBA.Context in project cxf by apache.

the class CorbaConduit method getRequest.

public Request getRequest(CorbaMessage message, String opName, org.omg.CORBA.NVList nvlist, org.omg.CORBA.NamedValue ret, org.omg.CORBA.ExceptionList exList) throws Exception {
    Request request = null;
    if (orb == null) {
        prepareOrb();
    }
    ContextList ctxList = orb.create_context_list();
    Context ctx = null;
    try {
        ctx = orb.get_default_context();
    } catch (Exception ex) {
    // ignore?
    }
    org.omg.CORBA.Object targetObj = (org.omg.CORBA.Object) message.get(CorbaConstants.CORBA_ENDPOINT_OBJECT);
    if (targetObj != null) {
        request = targetObj._create_request(ctx, opName, nvlist, ret, exList, ctxList);
    }
    return request;
}
Also used : Context(org.omg.CORBA.Context) Request(org.omg.CORBA.Request) ContextList(org.omg.CORBA.ContextList) SystemException(org.omg.CORBA.SystemException) IOException(java.io.IOException) UnknownUserException(org.omg.CORBA.UnknownUserException)

Example 2 with Context

use of org.omg.CORBA.Context in project cxf by apache.

the class CorbaConduitTest method testInvoke.

@Test
public void testInvoke() throws Exception {
    CorbaConduit conduit = setupCorbaConduit(false);
    // CorbaMessage message = new CorbaMessage(msg);
    CorbaMessage message = control.createMock(CorbaMessage.class);
    /*String opName = "GreetMe";
        NVList nvlist = (NVList)orb.create_list(0);

        Request request = conduit.getRequest(message, "GreetMe", nvlist, null, null);
        request.invoke();
        */
    org.omg.CORBA.Object obj = control.createMock(org.omg.CORBA.Object.class);
    EasyMock.expect(message.get(CorbaConstants.CORBA_ENDPOINT_OBJECT)).andReturn(obj);
    // msg.put(CorbaConstants.CORBA_ENDPOINT_OBJECT, obj);
    Request r = control.createMock(Request.class);
    NVList nvList = orb.create_list(0);
    NamedValue ret = control.createMock(NamedValue.class);
    ExceptionList exList = control.createMock(ExceptionList.class);
    EasyMock.expect(obj._create_request((Context) EasyMock.anyObject(), EasyMock.eq("greetMe"), EasyMock.isA(NVList.class), EasyMock.isA(NamedValue.class), EasyMock.isA(ExceptionList.class), EasyMock.isA(ContextList.class)));
    EasyMock.expectLastCall().andReturn(r);
    r.invoke();
    EasyMock.expectLastCall();
    control.replay();
    Request request = conduit.getRequest(message, "greetMe", nvList, ret, exList);
    request.invoke();
    control.verify();
/* try {
                ContextList ctxList = orb.create_context_list();
                Context ctx = orb.get_default_context();
                org.omg.CORBA.Object targetObj = (org.omg.CORBA.Object)message
                    .get(CorbaConstants.CORBA_ENDPOINT_OBJECT);
                Request request = targetObj._create_request(ctx, opName, list, ret, exList, ctxList);
                request.invoke();

            } catch (java.lang.Exception ex) {
                ex.printStackTrace();
            }*/
}
Also used : Context(org.omg.CORBA.Context) Request(org.omg.CORBA.Request) ExceptionList(org.omg.CORBA.ExceptionList) NamedValue(org.omg.CORBA.NamedValue) NVList(org.omg.CORBA.NVList) Test(org.junit.Test)

Aggregations

Context (org.omg.CORBA.Context)2 Request (org.omg.CORBA.Request)2 IOException (java.io.IOException)1 Test (org.junit.Test)1 ContextList (org.omg.CORBA.ContextList)1 ExceptionList (org.omg.CORBA.ExceptionList)1 NVList (org.omg.CORBA.NVList)1 NamedValue (org.omg.CORBA.NamedValue)1 SystemException (org.omg.CORBA.SystemException)1 UnknownUserException (org.omg.CORBA.UnknownUserException)1