You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ay...@apache.org on 2012/12/23 19:03:27 UTC

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

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 {