Merge branch 'CXF-5629' of https://github.com/grgrzybek/cxf This closes #1
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/712c509a Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/712c509a Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/712c509a Branch: refs/heads/master Commit: 712c509a69057d028f2c5368b73740da61beb2f4 Parents: 0a4f85b ec8538e Author: Daniel Kulp <[email protected]> Authored: Thu Mar 20 15:45:59 2014 -0400 Committer: Daniel Kulp <[email protected]> Committed: Thu Mar 20 15:46:37 2014 -0400 ---------------------------------------------------------------------- .../interceptor/InterceptorFaultTest.java | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/712c509a/systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java ---------------------------------------------------------------------- diff --cc systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java index 271bde4,14545c8..5db3a1c --- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java +++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java @@@ -178,35 -178,35 +178,65 @@@ public class InterceptorFaultTest exten public void testRobustWithoutAddressing() throws Exception { testWithoutAddressing(true); } + + @Test + public void testRobustFailWithoutAddressingInUserLogicalPhase() throws Exception { + + setupGreeter("org/apache/cxf/systest/interceptor/no-addr.xml", false); + + control.setRobustInOnlyMode(true); + + // behaviour is identicial for all phases + FaultLocation location = new org.apache.cxf.greeter_control.types.ObjectFactory() + .createFaultLocation(); + location.setPhase("user-logical"); + + control.setFaultLocation(location); + + try { + // writer to grab the content of soap fault. + // robust is not yet used at client's side, but I think it should + StringWriter writer = new StringWriter(); + ((Client)greeter).getInInterceptors().add(new LoggingInInterceptor()); + ((LoggingInInterceptor)greeterBus.getInInterceptors().get(0)).setPrintWriter(new PrintWriter(writer)); + // it should tell CXF to convert one-way robust out faults into real SoapFaultException + ((Client)greeter).getEndpoint().put(Message.ROBUST_ONEWAY, true); + greeter.greetMeOneWay("oneway"); + fail("Oneway operation unexpectedly succeded for phase " + location.getPhase()); + } catch (WebServiceException ex) { + // actually it should be instance of javax.xml.ws.soap.SOAPFaultException + assertEquals(FAULT_MESSAGE, ex.getMessage()); + } ++ } + + @Test + public void testRobustFailWithoutAddressingInUserLogicalPhase() throws Exception { + + setupGreeter("org/apache/cxf/systest/interceptor/no-addr.xml", false); + + control.setRobustInOnlyMode(true); + + // behaviour is identicial for all phases + FaultLocation location = new org.apache.cxf.greeter_control.types.ObjectFactory() + .createFaultLocation(); + location.setPhase("user-logical"); + + control.setFaultLocation(location); + + try { + // writer to grab the content of soap fault. + // robust is not yet used at client's side, but I think it should + StringWriter writer = new StringWriter(); + ((Client)greeter).getInInterceptors().add(new LoggingInInterceptor()); + ((LoggingInInterceptor)greeterBus.getInInterceptors().get(0)).setPrintWriter(new PrintWriter(writer)); + // it should tell CXF to convert one-way robust out faults into real SoapFaultException + ((Client)greeter).getEndpoint().put(Message.ROBUST_ONEWAY, true); + greeter.greetMeOneWay("oneway"); + fail("Oneway operation unexpectedly succeded for phase " + location.getPhase()); + } catch (WebServiceException ex) { + // actually it should be instance of javax.xml.ws.soap.SOAPFaultException + assertEquals(FAULT_MESSAGE, ex.getMessage()); + } } private void testWithoutAddressing(boolean robust) throws Exception {
