Search in sources :

Example 1 with GreeterCORBAService

use of org.apache.cxf.hello_world_corba.GreeterCORBAService in project cxf by apache.

the class CorbaTest method testException.

@Test
public void testException() throws Exception {
    System.getProperties().remove("com.sun.CORBA.POA.ORBServerId");
    System.getProperties().remove("com.sun.CORBA.POA.ORBPersistentServerPort");
    URL wsdlUrl = this.getClass().getResource("/wsdl_systest/hello_world_corba.wsdl");
    new SpringBusFactory().createBus("org/apache/cxf/systest/corba/hello_world_client.xml");
    GreeterCORBAService gcs = new GreeterCORBAService(wsdlUrl, SERVICE_NAME);
    Greeter port = gcs.getGreeterCORBAPort();
    try {
        port.pingMe("USER");
    } catch (PingMeFault pe) {
        return;
    } catch (Exception e) {
        e.printStackTrace();
        return;
    }
    fail("Didn't catch an exception");
}
Also used : PingMeFault(org.apache.cxf.hello_world_corba.PingMeFault) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) GreeterCORBAService(org.apache.cxf.hello_world_corba.GreeterCORBAService) Greeter(org.apache.cxf.hello_world_corba.Greeter) URL(java.net.URL) Test(org.junit.Test)

Example 2 with GreeterCORBAService

use of org.apache.cxf.hello_world_corba.GreeterCORBAService in project cxf by apache.

the class CorbaTest method testClientServer.

@Test
public void testClientServer() throws Exception {
    System.getProperties().remove("com.sun.CORBA.POA.ORBServerId");
    System.getProperties().remove("com.sun.CORBA.POA.ORBPersistentServerPort");
    URL wsdlUrl = this.getClass().getResource("/wsdl_systest/hello_world_corba.wsdl");
    new SpringBusFactory().createBus("org/apache/cxf/systest/corba/hello_world_client.xml");
    GreeterCORBAService gcs = new GreeterCORBAService(wsdlUrl, SERVICE_NAME);
    Greeter port = gcs.getGreeterCORBAPort();
    String output = port.greetMe("Betty");
    assertEquals("Unexpected returned string: " + output, "Hello Betty", output);
}
Also used : SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) GreeterCORBAService(org.apache.cxf.hello_world_corba.GreeterCORBAService) Greeter(org.apache.cxf.hello_world_corba.Greeter) URL(java.net.URL) Test(org.junit.Test)

Example 3 with GreeterCORBAService

use of org.apache.cxf.hello_world_corba.GreeterCORBAService in project cxf by apache.

the class CorbaTimeoutTest method testTimeout.

@Test
public void testTimeout() throws Exception {
    System.getProperties().remove("com.sun.CORBA.POA.ORBServerId");
    System.getProperties().remove("com.sun.CORBA.POA.ORBPersistentServerPort");
    String orbClass = System.getProperty("org.omg.CORBA.ORBClass");
    System.setProperty("org.omg.CORBA.ORBClass", "org.jacorb.orb.ORB");
    System.setProperty("org.omg.CORBA.ORBSingletonClass", "org.jacorb.orb.ORBSingleton");
    System.setProperty("jacorb.connection.client.pending_reply_timeout", "1000");
    URL wsdlUrl = this.getClass().getResource("/wsdl_systest/hello_world_corba_timeout.wsdl");
    new SpringBusFactory().createBus("org/apache/cxf/systest/corba/hello_world_client.xml");
    GreeterCORBAService gcs = new GreeterCORBAService(wsdlUrl, SERVICE_NAME);
    Greeter port = gcs.getPort(new QName("http://cxf.apache.org/hello_world_corba", "GreeterTimeoutCORBAPort"), GreeterCORBAService.GreeterProxy.class);
    try {
        port.greetMe("Betty");
        fail("Should throw org.omg.CORBA.TIMEOUT exception");
    } catch (WebServiceException e) {
        assertTrue(e.getCause() instanceof TIMEOUT);
    } finally {
        System.getProperties().remove("org.omg.CORBA.ORBClass");
        System.getProperties().remove("org.omg.CORBA.ORBSingletonClass");
        if (orbClass != null) {
            System.setProperty("org.omg.CORBA.ORBClass", orbClass);
        }
    }
}
Also used : SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) WebServiceException(javax.xml.ws.WebServiceException) GreeterCORBAService(org.apache.cxf.hello_world_corba.GreeterCORBAService) QName(javax.xml.namespace.QName) Greeter(org.apache.cxf.hello_world_corba.Greeter) TIMEOUT(org.omg.CORBA.TIMEOUT) URL(java.net.URL) Test(org.junit.Test)

Aggregations

URL (java.net.URL)3 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)3 Greeter (org.apache.cxf.hello_world_corba.Greeter)3 GreeterCORBAService (org.apache.cxf.hello_world_corba.GreeterCORBAService)3 Test (org.junit.Test)3 QName (javax.xml.namespace.QName)1 WebServiceException (javax.xml.ws.WebServiceException)1 PingMeFault (org.apache.cxf.hello_world_corba.PingMeFault)1 TIMEOUT (org.omg.CORBA.TIMEOUT)1