Search in sources :

Example 1 with TestUtils

use of org.apache.cxf.binding.corba.TestUtils in project cxf by apache.

the class CorbaDSIServantTest method testInvoke.

/*public void testCorbaDSIServant() throws Exception {

        CorbaDestination destination = testUtils.getSimpleTypesTestDestination();
        Service service = new ServiceImpl();
        Endpoint endpoint = new EndpointImpl(bus, service, destination.getEndPointInfo());
        MessageObserver observer = new ChainInitiationObserver(endpoint, bus);
        destination.setMessageObserver(observer);
        POA rootPOA = null;
        CorbaDSIServant dsiServant = new CorbaDSIServant();
        dsiServant.init(orb,
                        rootPOA,
                        destination,
                        observer);

        assertNotNull("DSIServant should not be null", dsiServant != null);
        assertNotNull("POA should not be null", dsiServant._default_POA() != null);
        assertNotNull("Destination should not be null", dsiServant.getDestination() != null);
        assertNotNull("ORB should not be null", dsiServant.getOrb() != null);
        assertNotNull("MessageObserver should not be null", dsiServant.getObserver() != null);

        byte[] objectId = new byte[10];
        String[] interfaces = dsiServant._all_interfaces(rootPOA, objectId);
        assertNotNull("Interfaces should not be null", interfaces != null);
        assertEquals("Interface ID should be equal", interfaces[0], "IDL:Simple:1.0");

    }*/
@Test
public void testInvoke() throws Exception {
    CorbaDestination dest = new TestUtils().getComplexTypesTestDestination();
    CorbaDSIServant dsiServant = new CorbaDSIServant();
    dsiServant.init(orb, null, dest, null);
    ServerRequest request = new ServerRequest() {

        public String operation() {
            return "greetMe";
        }

        public Context ctx() {
            return null;
        }
    };
    MessageObserver incomingObserver = new TestObserver();
    dsiServant.setObserver(incomingObserver);
    Map<String, QName> map = new HashMap<>(2);
    map.put("greetMe", new QName("greetMe"));
    dsiServant.setOperationMapping(map);
    dsiServant.invoke(request);
}
Also used : TestUtils(org.apache.cxf.binding.corba.TestUtils) CorbaDestination(org.apache.cxf.binding.corba.CorbaDestination) MessageObserver(org.apache.cxf.transport.MessageObserver) HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) ServerRequest(org.omg.CORBA.ServerRequest) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)1 QName (javax.xml.namespace.QName)1 CorbaDestination (org.apache.cxf.binding.corba.CorbaDestination)1 TestUtils (org.apache.cxf.binding.corba.TestUtils)1 MessageObserver (org.apache.cxf.transport.MessageObserver)1 Test (org.junit.Test)1 ServerRequest (org.omg.CORBA.ServerRequest)1