Search in sources :

Example 1 with PingMeFault

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

the class BaseGreeterImpl method pingMe.

public void pingMe(String faultType) throws PingMeFault {
    if ("USER".equals(faultType)) {
        FaultDetail detail = new FaultDetail();
        detail.setMajor((short) 1);
        detail.setMinor((short) 2);
        throw new PingMeFault("USER FAULT TEST", detail);
    } else if ("SYSTEM".equals(faultType)) {
        throw new Fault(new Message(EX_STRING, (ResourceBundle) null, new Object[] { "FAULT TEST" }));
    } else {
        throw new IllegalArgumentException(EX_STRING);
    }
}
Also used : PingMeFault(org.apache.cxf.hello_world_corba.PingMeFault) Message(org.apache.cxf.common.i18n.Message) FaultDetail(org.apache.cxf.hello_world_corba.types.FaultDetail) PingMeFault(org.apache.cxf.hello_world_corba.PingMeFault) Fault(org.apache.cxf.interceptor.Fault)

Example 2 with PingMeFault

use of org.apache.cxf.hello_world_corba.PingMeFault 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)

Aggregations

PingMeFault (org.apache.cxf.hello_world_corba.PingMeFault)2 URL (java.net.URL)1 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)1 Message (org.apache.cxf.common.i18n.Message)1 Greeter (org.apache.cxf.hello_world_corba.Greeter)1 GreeterCORBAService (org.apache.cxf.hello_world_corba.GreeterCORBAService)1 FaultDetail (org.apache.cxf.hello_world_corba.types.FaultDetail)1 Fault (org.apache.cxf.interceptor.Fault)1 Test (org.junit.Test)1