Author: ay Date: Tue Jan 15 11:14:56 2013 New Revision: 1433357 URL: http://svn.apache.org/viewvc?rev=1433357&view=rev Log: Merged revisions 1433349 via svn merge from https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes
........ r1433349 | ay | 2013-01-15 11:53:03 +0100 (Tue, 15 Jan 2013) | 9 lines Merged revisions 1433347 via svn merge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1433347 | ay | 2013-01-15 11:48:50 +0100 (Tue, 15 Jan 2013) | 1 line an adjustment to the change made with CXF-4511 ........ ........ Modified: cxf/branches/2.6.x-fixes/ (props changed) cxf/branches/2.6.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ProtocolVariationsTest.java Propchange: cxf/branches/2.6.x-fixes/ ('svn:mergeinfo' removed) Propchange: cxf/branches/2.6.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.6.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ProtocolVariationsTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ProtocolVariationsTest.java?rev=1433357&r1=1433356&r2=1433357&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ProtocolVariationsTest.java (original) +++ cxf/branches/2.6.x-fixes/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ProtocolVariationsTest.java Tue Jan 15 11:14:56 2013 @@ -267,7 +267,7 @@ public class ProtocolVariationsTest exte } @Test - public void testInvalidWRMOnReceive() throws Exception { + public void testInvalidWSRMMustUnderstandOnReceive() throws Exception { init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", false); // WS-RM 1.0 using the WS-A 1.0 namespace @@ -288,15 +288,45 @@ public class ProtocolVariationsTest exte } catch (Exception e) { assertTrue(e.getCause() instanceof SoapFault); // verify a partial error text match to exclude an unexpected exception - // (see WSRM_REQUIRED_EXC in Messages.properties) - //because the ws-rm namespace isn't correct, can't detect it's a ws-rm message - //so can't understand ws-rm header + // because there is a mustUnderstand header that is not understood, + // the corresponding error is returned. final String text = "MustUnderstand headers: " + "[{http://cxf.apache.org/invalid}Sequence] are not understood."; assertTrue(e.getCause().getMessage() != null && e.getCause().getMessage().indexOf(text) >= 0); } } + + @Test + public void testInvalidWSRMOnReceive() throws Exception { + init("org/apache/cxf/systest/ws/rm/rminterceptors.xml", false); + + // WS-RM 1.0 using the WS-A 1.0 namespace + Client client = ClientProxy.getClient(greeter); + client.getRequestContext().put(RMManager.WSRM_VERSION_PROPERTY, RM10Constants.NAMESPACE_URI); + client.getRequestContext().put(RMManager.WSRM_WSA_VERSION_PROPERTY, Names200408.WSA_NAMESPACE_NAME); + + // remove the outgoing message's WS-RM header + TransformOutInterceptor trans = new TransformOutInterceptor(); + Map<String, String> outElements = new HashMap<String, String>(); + outElements.put("{" + RM10Constants.NAMESPACE_URI + "}Sequence", ""); + trans.setOutTransformElements(outElements); + + client.getOutInterceptors().add(trans); + try { + greeter.greetMe("one"); + fail("invalid wsrm header"); + } catch (Exception e) { + assertTrue(e.getCause() instanceof SoapFault); + // verify a partial error text match to exclude an unexpected exception + // (see WSRM_REQUIRED_EXC in Messages.properties) + final String text = "WS-ReliableMessaging is required"; + assertTrue(e.getCause().getMessage() != null + && e.getCause().getMessage().indexOf(text) >= 0); + } + } + + @Test public void testDefaultDecoupled() throws Exception {
