cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1080444 - in /cxf/branches/2.3.x-fixes: ./ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java
Date Fri, 11 Mar 2011 04:34:28 GMT
Author: dkulp
Date: Fri Mar 11 04:34:27 2011
New Revision: 1080444

URL: http://svn.apache.org/viewvc?rev=1080444&view=rev
Log:
Merged revisions 1079574 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1079574 | dkulp | 2011-03-08 17:15:32 -0500 (Tue, 08 Mar 2011) | 1 line
  
  Fix stack trace in tests by setting up more mock behavior
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java
    cxf/branches/2.3.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java

Propchange: cxf/branches/2.3.x-fixes/
            ('svn:mergeinfo' removed)

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java?rev=1080444&r1=1080443&r2=1080444&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java
Fri Mar 11 04:34:27 2011
@@ -356,6 +356,7 @@ public class DestinationSequence extends
         } else {
             LOG.fine("Schedule immediate acknowledgment");
             scheduleImmediateAcknowledgement();
+            
             destination.getManager().getTimer().schedule(
                 new ImmediateFallbackAcknowledgment(), ap.getImmediaAcksTimeout().longValue());
            
@@ -438,7 +439,6 @@ public class DestinationSequence extends
     }
     
     final class ImmediateFallbackAcknowledgment extends TimerTask {
-       
         public void run() {
             LOG.fine("timer task: send acknowledgment.");
             if (!sendAcknowledgement()) {
@@ -447,13 +447,10 @@ public class DestinationSequence extends
             }
 
             try {                
-                RMEndpoint rme = destination.getReliableEndpoint();
-                Proxy proxy = rme.getProxy();
-                proxy.acknowledge(DestinationSequence.this);
+                destination.getReliableEndpoint().getProxy().acknowledge(DestinationSequence.this);
             } catch (RMException ex) {
                 // already logged
             } 
-
         }
     }
     

Modified: cxf/branches/2.3.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java?rev=1080444&r1=1080443&r2=1080444&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java
Fri Mar 11 04:34:27 2011
@@ -141,7 +141,7 @@ public class DestinationSequenceTest ext
     @Test
     public void testAcknowledgeBasic() throws SequenceFault {
         Timer timer = control.createMock(Timer.class);
-        setUpDestination(timer);
+        setUpDestination(timer, null);
         Message message1 = setUpMessage("1");
         Message message2 = setUpMessage("2");
         control.replay();
@@ -168,7 +168,7 @@ public class DestinationSequenceTest ext
     @Test
     public void testAcknowledgeLastMessageNumberExceeded() throws SequenceFault {  
         Timer timer = control.createMock(Timer.class);
-        setUpDestination(timer);
+        setUpDestination(timer, null);
         Message message1 = setUpMessage("1");
         Message message2 = setUpMessage("2");
         control.replay();
@@ -190,7 +190,7 @@ public class DestinationSequenceTest ext
     @Test
     public void testAcknowledgeAppendRange() throws SequenceFault {
         Timer timer = control.createMock(Timer.class);
-        setUpDestination(timer);
+        setUpDestination(timer, null);
         Message[] messages = new Message [] {
             setUpMessage("1"),
             setUpMessage("2"),
@@ -220,7 +220,7 @@ public class DestinationSequenceTest ext
     @Test
     public void testAcknowledgeInsertRange() throws SequenceFault {
         Timer timer = control.createMock(Timer.class);
-        setUpDestination(timer);
+        setUpDestination(timer, null);
         Message[] messages = new Message [] {
             setUpMessage("1"),
             setUpMessage("2"),
@@ -255,7 +255,7 @@ public class DestinationSequenceTest ext
     @Test
     public void testAcknowledgePrependRange() throws SequenceFault { 
         Timer timer = control.createMock(Timer.class);
-        setUpDestination(timer);
+        setUpDestination(timer, null);
         Message[] messages = new Message [] {
             setUpMessage("4"),
             setUpMessage("5"),
@@ -329,7 +329,7 @@ public class DestinationSequenceTest ext
     @Test
     public void testMonitor() throws SequenceFault {
         Timer timer = control.createMock(Timer.class);
-        setUpDestination(timer);
+        setUpDestination(timer, null);
         Message[] messages = new Message[15];
         for (int i = 0; i < messages.length; i++) {
             messages[i] = setUpMessage(Integer.toString(i + 1));
@@ -372,7 +372,7 @@ public class DestinationSequenceTest ext
     @Test
     public void testAcknowledgeImmediate() throws SequenceFault {
         Timer timer = control.createMock(Timer.class);
-        setUpDestination(timer);
+        setUpDestination(timer, null);
         Message message = setUpMessage("1");
         control.replay();
         
@@ -391,11 +391,10 @@ public class DestinationSequenceTest ext
     @Test
     public void testAcknowledgeDeferred() throws SequenceFault, RMException {
         Timer timer = new Timer();
-        setUpDestination(timer);
+        RMEndpoint rme = control.createMock(RMEndpoint.class);
+        setUpDestination(timer, rme);
         
         DestinationSequence seq = new DestinationSequence(id, ref, destination);
-        RMEndpoint rme = control.createMock(RMEndpoint.class);
-        EasyMock.expect(destination.getReliableEndpoint()).andReturn(rme).anyTimes();
         Proxy proxy = control.createMock(Proxy.class);
         EasyMock.expect(rme.getProxy()).andReturn(proxy).anyTimes();        
         proxy.acknowledge(seq);
@@ -552,12 +551,17 @@ public class DestinationSequenceTest ext
         assertTrue("timed out waiting for messages to be processed in order", !timedOut);
         
         control.verify();
+        
+
+
     }
     
     @Test
     public void testScheduleSequenceTermination() throws SequenceFault {
         Timer timer = new Timer();
-        setUpDestination(timer);
+        RMEndpoint rme = control.createMock(RMEndpoint.class);
+        EasyMock.expect(rme.getProxy()).andReturn(control.createMock(Proxy.class)).anyTimes();
+        setUpDestination(timer, rme);
         
         DestinationSequence seq = new DestinationSequence(id, ref, destination);
         destination.removeSequence(seq);
@@ -565,8 +569,6 @@ public class DestinationSequenceTest ext
         
         Message message = setUpMessage("1");
         
-        RMEndpoint rme = control.createMock(RMEndpoint.class);
-        EasyMock.expect(destination.getReliableEndpoint()).andReturn(rme);
         long arrival = System.currentTimeMillis();
         EasyMock.expect(rme.getLastApplicationMessage()).andReturn(arrival);
 
@@ -622,7 +624,7 @@ public class DestinationSequenceTest ext
         EasyMock.expectLastCall();
         control.replay();
         st.run();
-        control.verify();
+        control.verify();        
     }
     
     @Test
@@ -673,6 +675,7 @@ public class DestinationSequenceTest ext
         seq.cancelDeferredAcknowledgments();
         t.cancel();
         control.verify();
+
     }
     
     @Test
@@ -691,10 +694,10 @@ public class DestinationSequenceTest ext
     }
     
     private void setUpDestination() {
-        setUpDestination(null);
+        setUpDestination(null, null);
     }
     
-    private void setUpDestination(Timer timer) {
+    private void setUpDestination(Timer timer, RMEndpoint endpoint) {
         
         manager = control.createMock(RMManager.class);
 
@@ -718,6 +721,10 @@ public class DestinationSequenceTest ext
         
         destination = control.createMock(Destination.class);
         EasyMock.expect(destination.getManager()).andReturn(manager).anyTimes();
+        if (endpoint == null) {
+            endpoint = EasyMock.createMock(RMEndpoint.class);
+        }
+        EasyMock.expect(destination.getReliableEndpoint()).andReturn(endpoint).anyTimes();
         
         if (null != timer) {
             EasyMock.expect(manager.getTimer()).andReturn(timer).anyTimes();



Mime
View raw message