Search in sources :

Example 31 with BindingFaultInfo

use of org.apache.cxf.service.model.BindingFaultInfo in project cxf by apache.

the class PolicyInterceptorsTest method testServerPolicyOutFaultInterceptorGetBindingFaultInfo.

@Test
public void testServerPolicyOutFaultInterceptorGetBindingFaultInfo() {
    ServerPolicyOutFaultInterceptor interceptor = new ServerPolicyOutFaultInterceptor();
    message = control.createMock(Message.class);
    Exception ex = new UnsupportedOperationException(new RuntimeException());
    boi = control.createMock(BindingOperationInfo.class);
    EasyMock.expect(message.get(BindingFaultInfo.class)).andReturn(null);
    BindingFaultInfo bfi = control.createMock(BindingFaultInfo.class);
    Collection<BindingFaultInfo> bfis = CastUtils.cast(Collections.EMPTY_LIST);
    EasyMock.expect(boi.getFaults()).andReturn(bfis);
    BindingOperationInfo wrappedBoi = control.createMock(BindingOperationInfo.class);
    EasyMock.expect(boi.getWrappedOperation()).andReturn(wrappedBoi).times(2);
    Collection<BindingFaultInfo> wrappedBfis = CastUtils.cast(Collections.singletonList(bfi));
    EasyMock.expect(wrappedBoi.getFaults()).andReturn(wrappedBfis);
    FaultInfo fi = control.createMock(FaultInfo.class);
    EasyMock.expect(bfi.getFaultInfo()).andReturn(fi);
    EasyMock.expect(fi.getProperty(Class.class.getName(), Class.class)).andReturn(RuntimeException.class);
    message.put(BindingFaultInfo.class, bfi);
    EasyMock.expectLastCall();
    control.replay();
    assertSame(bfi, interceptor.getBindingFaultInfo(message, ex, boi));
    control.verify();
}
Also used : BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) BindingFaultInfo(org.apache.cxf.service.model.BindingFaultInfo) FaultInfo(org.apache.cxf.service.model.FaultInfo) Message(org.apache.cxf.message.Message) BindingFaultInfo(org.apache.cxf.service.model.BindingFaultInfo) Test(org.junit.Test)

Aggregations

BindingFaultInfo (org.apache.cxf.service.model.BindingFaultInfo)31 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)15 Test (org.junit.Test)13 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)9 QName (javax.xml.namespace.QName)6 BindingInfo (org.apache.cxf.service.model.BindingInfo)5 BindingMessageInfo (org.apache.cxf.service.model.BindingMessageInfo)5 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)5 Method (java.lang.reflect.Method)4 Bus (org.apache.cxf.Bus)4 Message (org.apache.cxf.message.Message)4 FaultInfo (org.apache.cxf.service.model.FaultInfo)4 Policy (org.apache.neethi.Policy)4 SoapOperationInfo (org.apache.cxf.binding.soap.model.SoapOperationInfo)3 MessagePartInfo (org.apache.cxf.service.model.MessagePartInfo)3 ArrayList (java.util.ArrayList)2 BindingFault (javax.wsdl.BindingFault)2 UnknownExtensibilityElement (javax.wsdl.extensions.UnknownExtensibilityElement)2 Endpoint (org.apache.cxf.endpoint.Endpoint)2 Interceptor (org.apache.cxf.interceptor.Interceptor)2