Author: ay Date: Sun Dec 23 18:36:17 2012 New Revision: 1425509 URL: http://svn.apache.org/viewvc?rev=1425509&view=rev Log: Merged revisions 1425497 via svn merge from https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes
........ r1425497 | ay | 2012-12-23 19:03:26 +0100 (Sun, 23 Dec 2012) | 9 lines 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.5.x-fixes/ (props changed) cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java cxf/branches/2.5.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java?rev=1425509&r1=1425508&r2=1425509&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java (original) +++ cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMInInterceptor.java Sun Dec 23 18:36:17 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.5.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java?rev=1425509&r1=1425508&r2=1425509&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java (original) +++ cxf/branches/2.5.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMInInterceptorTest.java Sun Dec 23 18:36:17 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.AddressingPropertiesImpl; import org.apache.cxf.ws.addressing.AttributedURIType; import org.apache.cxf.ws.addressing.JAXWSAConstants; @@ -345,8 +347,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 { @@ -354,10 +416,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 { @@ -365,6 +436,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 {
