Search in sources :

Example 1 with FaultDetailT

use of org.apache.headers.coloc.types.FaultDetailT in project cxf by apache.

the class AbstractHeaderServiceRpcLitTest method verifyFaults.

public void verifyFaults(HeaderTester ht) {
    getLogger().debug("Client: calling pingMe user fault");
    PingMeT in = new PingMeT();
    try {
        in.setFaultType("USER");
        ht.pingMe(in);
        fail("Should throw a PingeMeFault exception");
    } catch (PingMeFault pmf) {
        FaultDetailT detail = pmf.getFaultInfo();
        assertNotNull(detail);
        assertEquals("Major Version should be 1", (short) 1, detail.getMajor());
        assertEquals("Minor Version should be 2", (short) 2, detail.getMinor());
        if (isFaultCodeCheckEnabled()) {
            verifyFaultCode(port);
        }
    }
    getLogger().debug("Client: calling pingMe Cxf System Fault");
    try {
        in.setFaultType("SYSTEM");
        ht.pingMe(in);
        fail("Should throw a CXF Fault exception");
    } catch (WebServiceException fault) {
        assertFalse("Wrong message: " + fault.getMessage(), -1 == fault.getMessage().lastIndexOf(HeaderTesterUtil.EX_STRING));
        if (isFaultCodeCheckEnabled()) {
            verifyFaultCode(port);
        }
    } catch (PingMeFault pmf) {
        fail("Should not receive PingMefault");
    }
    getLogger().debug("Client: calling pingMe java runtime exception");
    try {
        in.setFaultType("RUNTIME");
        ht.pingMe(in);
        fail("Should throw a CXF Fault exception");
    } catch (WebServiceException fault) {
        assertFalse(-1 == fault.getMessage().lastIndexOf(HeaderTesterUtil.EX_STRING));
        if (isFaultCodeCheckEnabled()) {
            verifyFaultCode(port);
        }
    } catch (PingMeFault pmf) {
        fail("Should not receive PingMefault");
    }
}
Also used : PingMeFault(org.apache.headers.rpc_lit.PingMeFault) WebServiceException(javax.xml.ws.WebServiceException) FaultDetailT(org.apache.headers.coloc.types.FaultDetailT) PingMeT(org.apache.headers.coloc.types.PingMeT)

Example 2 with FaultDetailT

use of org.apache.headers.coloc.types.FaultDetailT in project cxf by apache.

the class BaseHeaderTesterDocLitImpl method pingMe.

public void pingMe(String msgType) throws PingMeFault {
    getLogger().debug("Server: in pingMe:" + msgType);
    if ("USER".equals(msgType)) {
        FaultDetailT detail = new FaultDetailT();
        detail.setMajor((short) 1);
        detail.setMinor((short) 2);
        throw new PingMeFault("USER FAULT TEST", detail);
    } else if ("SYSTEM".equals(msgType)) {
        throw new Fault(new Message(HeaderTesterUtil.EX_STRING, (ResourceBundle) null, new Object[] { "FAULT TEST" }));
    } else if ("RUNTIME".equals(msgType)) {
        throw new IllegalArgumentException(HeaderTesterUtil.EX_STRING);
    }
}
Also used : PingMeFault(org.apache.headers.doc_lit.PingMeFault) Message(org.apache.cxf.common.i18n.Message) FaultDetailT(org.apache.headers.coloc.types.FaultDetailT) PingMeFault(org.apache.headers.doc_lit.PingMeFault) Fault(org.apache.cxf.interceptor.Fault)

Example 3 with FaultDetailT

use of org.apache.headers.coloc.types.FaultDetailT in project cxf by apache.

the class BaseHeaderTesterRpcLitImpl method pingMe.

public PingMeResponseT pingMe(PingMeT in) throws PingMeFault {
    String msgType = in.getFaultType();
    getLogger().debug("Server: in pingMe:" + msgType);
    if ("USER".equals(msgType)) {
        FaultDetailT detail = new FaultDetailT();
        detail.setMajor((short) 1);
        detail.setMinor((short) 2);
        throw new PingMeFault("USER FAULT TEST", detail);
    } else if ("SYSTEM".equals(msgType)) {
        throw new Fault(new Message(HeaderTesterUtil.EX_STRING, (ResourceBundle) null, new Object[] { "FAULT TEST" }));
    } else if ("RUNTIME".equals(msgType)) {
        throw new IllegalArgumentException(HeaderTesterUtil.EX_STRING);
    }
    return new PingMeResponseT();
}
Also used : PingMeFault(org.apache.headers.rpc_lit.PingMeFault) Message(org.apache.cxf.common.i18n.Message) FaultDetailT(org.apache.headers.coloc.types.FaultDetailT) PingMeResponseT(org.apache.headers.coloc.types.PingMeResponseT) Fault(org.apache.cxf.interceptor.Fault) PingMeFault(org.apache.headers.rpc_lit.PingMeFault)

Aggregations

FaultDetailT (org.apache.headers.coloc.types.FaultDetailT)3 Message (org.apache.cxf.common.i18n.Message)2 Fault (org.apache.cxf.interceptor.Fault)2 PingMeFault (org.apache.headers.rpc_lit.PingMeFault)2 WebServiceException (javax.xml.ws.WebServiceException)1 PingMeResponseT (org.apache.headers.coloc.types.PingMeResponseT)1 PingMeT (org.apache.headers.coloc.types.PingMeT)1 PingMeFault (org.apache.headers.doc_lit.PingMeFault)1