cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1399345 - in /cxf/trunk/rt/ws/rm/src: main/java/org/apache/cxf/ws/rm/RMManager.java test/java/org/apache/cxf/ws/rm/RMManagerTest.java
Date Wed, 17 Oct 2012 16:59:26 GMT
Author: ay
Date: Wed Oct 17 16:59:26 2012
New Revision: 1399345

URL: http://svn.apache.org/viewvc?rev=1399345&view=rev
Log:
[CXF-4579] Exchange's out message not set for recovered outbound WS-RM messages

Modified:
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java?rev=1399345&r1=1399344&r2=1399345&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java Wed Oct 17 16:59:26
2012
@@ -552,6 +552,7 @@ public class RMManager {
             Message message = new MessageImpl();
             Exchange exchange = new ExchangeImpl();
             message.setExchange(exchange);
+            exchange.setOutMessage(message);
             if (null != conduit) {
                 exchange.setConduit(conduit);
                 message.put(Message.REQUESTOR_ROLE, Boolean.TRUE);

Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java?rev=1399345&r1=1399344&r2=1399345&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java Wed Oct 17 16:59:26
2012
@@ -60,6 +60,7 @@ import org.apache.cxf.ws.rm.persistence.
 import org.apache.cxf.ws.rm.v200702.CreateSequenceResponseType;
 import org.apache.cxf.ws.rm.v200702.Identifier;
 import org.apache.cxf.ws.rmp.v200502.RMAssertion;
+import org.easymock.Capture;
 import org.easymock.EasyMock;
 import org.easymock.IMocksControl;
 import org.junit.Assert;
@@ -522,7 +523,7 @@ public class RMManagerTest extends Asser
         InterfaceInfo ii = control.createMock(InterfaceInfo.class);
         setUpEndpointForRecovery(endpoint, ei, si, bi, ii);          
         Conduit conduit = control.createMock(Conduit.class);        
-        setUpRecoverReliableEndpoint(endpoint, conduit, null, null, null);
+        setUpRecoverReliableEndpoint(endpoint, conduit, null, null, null, null);
         control.replay();
         manager.recoverReliableEndpoint(endpoint, conduit);
         control.verify();
@@ -531,7 +532,7 @@ public class RMManagerTest extends Asser
         setUpEndpointForRecovery(endpoint, ei, si, bi, ii);
         SourceSequence ss = control.createMock(SourceSequence.class);
         DestinationSequence ds = control.createMock(DestinationSequence.class);
-        setUpRecoverReliableEndpoint(endpoint, conduit, ss, ds, null);
+        setUpRecoverReliableEndpoint(endpoint, conduit, ss, ds, null, null);
         control.replay();
         manager.recoverReliableEndpoint(endpoint, conduit);
         control.verify();
@@ -539,10 +540,16 @@ public class RMManagerTest extends Asser
         control.reset();
         setUpEndpointForRecovery(endpoint, ei, si, bi, ii);  
         RMMessage m = control.createMock(RMMessage.class);
-        setUpRecoverReliableEndpoint(endpoint, conduit, ss, ds, m);        
+        Capture<Message> mc = new Capture<Message>();
+        setUpRecoverReliableEndpoint(endpoint, conduit, ss, ds, m, mc);        
         control.replay();
         manager.recoverReliableEndpoint(endpoint, conduit);
-        control.verify();        
+        control.verify();
+        
+        Message msg = mc.getValue();
+        assertNotNull(msg);
+        assertNotNull(msg.getExchange());
+        assertSame(msg, msg.getExchange().getOutMessage());
     }
     
     Endpoint setUpEndpointForRecovery(Endpoint endpoint, 
@@ -561,7 +568,7 @@ public class RMManagerTest extends Asser
     void setUpRecoverReliableEndpoint(Endpoint endpoint,
                                       Conduit conduit, 
                                       SourceSequence ss, 
-                                      DestinationSequence ds, RMMessage m)  {           
    
+                                      DestinationSequence ds, RMMessage m, Capture<Message>
mc)  {                
         RMStore store = control.createMock(RMStore.class);
         RetransmissionQueue queue = control.createMock(RetransmissionQueue.class);
         manager.setStore(store);
@@ -630,10 +637,14 @@ public class RMManagerTest extends Asser
         }
         EasyMock.expect(m.getCachedOutputStream()).andReturn(cos);
 
-        queue.addUnacknowledged(EasyMock.isA(Message.class));
+        if (mc != null) {
+            queue.addUnacknowledged(EasyMock.capture(mc));
+        } else {
+            queue.addUnacknowledged(EasyMock.isA(Message.class));
+        }
         EasyMock.expectLastCall();
         queue.start();
-        EasyMock.expectLastCall(); 
+        EasyMock.expectLastCall();
     }
     
     @Test



Mime
View raw message