Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9A24BDB63 for ; Sun, 23 Dec 2012 18:03:51 +0000 (UTC) Received: (qmail 8583 invoked by uid 500); 23 Dec 2012 18:03:51 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 8510 invoked by uid 500); 23 Dec 2012 18:03:51 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 8500 invoked by uid 99); 23 Dec 2012 18:03:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Dec 2012 18:03:51 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Dec 2012 18:03:48 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 26EFE238890D; Sun, 23 Dec 2012 18:03:27 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1425497 - in /cxf/branches/2.6.x-fixes: ./ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java Date: Sun, 23 Dec 2012 18:03:27 -0000 To: commits@cxf.apache.org From: ay@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121223180327.26EFE238890D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ay Date: Sun Dec 23 18:03:26 2012 New Revision: 1425497 URL: http://svn.apache.org/viewvc?rev=1425497&view=rev Log: Merged revisions 1425493 via svn merge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1425493 | ay | 2012-12-23 18:34:22 +0100 (Sun, 23 Dec 2012) | 1 line fix the robust-mode case for CXF-4694 and add tests ........ Modified: cxf/branches/2.6.x-fixes/ (props changed) cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java cxf/branches/2.6.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.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/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java?rev=1425497&r1=1425496&r2=1425497&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java (original) +++ cxf/branches/2.6.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java Sun Dec 23 18:03:26 2012 @@ -59,7 +59,8 @@ public class RMInInterceptor extends Abs } catch (RMException e) { LOG.log(Level.WARNING, "Failed to revert the delivering status"); } - } else if (!ContextUtils.isRequestor(message)) { + } + if (!ContextUtils.isRequestor(message)) { // force the fault to be returned. Exchange exchange = message.getExchange(); exchange.setOneWay(false); Modified: cxf/branches/2.6.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java?rev=1425497&r1=1425496&r2=1425497&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java (original) +++ cxf/branches/2.6.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java Sun Dec 23 18:03:26 2012 @@ -26,12 +26,14 @@ import java.util.Iterator; import java.util.SortedSet; import java.util.TreeSet; +import org.apache.cxf.endpoint.Endpoint; import org.apache.cxf.interceptor.Interceptor; import org.apache.cxf.interceptor.InterceptorChain; import org.apache.cxf.message.Exchange; import org.apache.cxf.message.Message; import org.apache.cxf.phase.Phase; import org.apache.cxf.phase.PhaseInterceptorChain; +import org.apache.cxf.service.model.EndpointInfo; import org.apache.cxf.ws.addressing.AttributedURIType; import org.apache.cxf.ws.addressing.JAXWSAConstants; import org.apache.cxf.ws.addressing.MAPAggregator; @@ -344,8 +346,68 @@ public class RMInInterceptorTest extends Message message = control.createMock(Message.class); Exchange exchange = control.createMock(Exchange.class); EasyMock.expect(message.getExchange()).andReturn(exchange).anyTimes(); + control.replay(); + + try { + interceptor.handleFault(message); + } catch (Exception e) { + fail("unexpected exception thrown from handleFault: " + e); + } + + control.reset(); + EasyMock.expect(message.getExchange()).andReturn(exchange).anyTimes(); + EasyMock.expect(message.get(RMMessageConstants.DELIVERING_ROBUST_ONEWAY)).andReturn(true).anyTimes(); + control.replay(); + + try { + interceptor.handleFault(message); + } catch (Exception e) { + fail("unexpected exception thrown from handleFault: " + e); + } + } + + @Test + public void testProcessValidMessageOnFault() throws SequenceFault, RMException { + interceptor = new RMInInterceptor(); + manager = control.createMock(RMManager.class); + Message message = control.createMock(Message.class); + Exchange exchange = control.createMock(Exchange.class); + AddressingPropertiesImpl maps = control.createMock(AddressingPropertiesImpl.class); + + interceptor.setManager(manager); + + EasyMock.expect(message.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND)).andReturn(maps); + EasyMock.expect(message.getExchange()).andReturn(exchange).anyTimes(); + EasyMock.expect(message.get(RMMessageConstants.RM_PROTOCOL_VARIATION)) + .andReturn(ProtocolVariation.RM10WSA200408).anyTimes(); + exchange.setOneWay(false); + EasyMock.expectLastCall(); + control.replay(); + + try { + interceptor.handleFault(message); + } catch (Exception e) { + fail("unexpected exception thrown from handleFault: " + e); + } + + control.verify(); + + control.reset(); + Destination d = control.createMock(Destination.class); + Endpoint ep = control.createMock(Endpoint.class); + EndpointInfo epi = control.createMock(EndpointInfo.class); + EasyMock.expect(ep.getEndpointInfo()).andReturn(epi).anyTimes(); + EasyMock.expect(exchange.get(Endpoint.class)).andReturn(ep).anyTimes(); + EasyMock.expect(maps.getFaultTo()) + .andReturn(RMUtils.createReference("http://localhost:9999/decoupled")).anyTimes(); + EasyMock.expect(message.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND)).andReturn(maps); + EasyMock.expect(message.getExchange()).andReturn(exchange).anyTimes(); + EasyMock.expect(message.get(RMMessageConstants.RM_PROTOCOL_VARIATION)) + .andReturn(ProtocolVariation.RM10WSA200408).anyTimes(); exchange.setOneWay(false); EasyMock.expectLastCall(); + exchange.setDestination(EasyMock.anyObject(org.apache.cxf.transport.Destination.class)); + EasyMock.expectLastCall(); control.replay(); try { @@ -353,10 +415,19 @@ public class RMInInterceptorTest extends } catch (Exception e) { fail("unexpected exception thrown from handleFault: " + e); } + control.verify(); control.reset(); + EasyMock.expect(maps.getFaultTo()) + .andReturn(RMUtils.createAnonymousReference()).anyTimes(); + EasyMock.expect(message.get(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND)).andReturn(maps); + EasyMock.expect(manager.getDestination(message)).andReturn(d); EasyMock.expect(message.getExchange()).andReturn(exchange).anyTimes(); EasyMock.expect(message.get(RMMessageConstants.DELIVERING_ROBUST_ONEWAY)).andReturn(true).anyTimes(); + EasyMock.expect(message.get(RMMessageConstants.RM_PROTOCOL_VARIATION)) + .andReturn(ProtocolVariation.RM10WSA200408).anyTimes(); + exchange.setOneWay(false); + EasyMock.expectLastCall(); control.replay(); try { @@ -364,6 +435,7 @@ public class RMInInterceptorTest extends } catch (Exception e) { fail("unexpected exception thrown from handleFault: " + e); } + // verified in tearDown } private Message setupInboundMessage(String action, boolean serverSide) throws RMException {