cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1079574 - in /cxf/trunk/rt/ws/rm/src: main/java/org/apache/cxf/ws/rm/DestinationSequence.java test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java
Date Tue, 08 Mar 2011 22:15:32 GMT
Author: dkulp
Date: Tue Mar  8 22:15:32 2011
New Revision: 1079574

URL: http://svn.apache.org/viewvc?rev=1079574&view=rev
Log:
Fix stack trace in tests by setting up more mock behavior

Modified:
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java?rev=1079574&r1=1079573&r2=1079574&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/DestinationSequence.java Tue Mar
 8 22:15:32 2011
@@ -353,6 +353,7 @@ public class DestinationSequence extends
         } else {
             LOG.fine("Schedule immediate acknowledgment");
             scheduleImmediateAcknowledgement();
+            
             destination.getManager().getTimer().schedule(
                 new ImmediateFallbackAcknowledgment(), ap.getImmediaAcksTimeout());
            
@@ -435,7 +436,6 @@ public class DestinationSequence extends
     }
     
     final class ImmediateFallbackAcknowledgment extends TimerTask {
-       
         public void run() {
             LOG.fine("timer task: send acknowledgment.");
             if (!sendAcknowledgement()) {
@@ -444,13 +444,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/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java?rev=1079574&r1=1079573&r2=1079574&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java Tue
Mar  8 22:15:32 2011
@@ -140,7 +140,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();
@@ -167,7 +167,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();
@@ -189,7 +189,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"),
@@ -219,7 +219,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"),
@@ -254,7 +254,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"),
@@ -328,7 +328,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));
@@ -371,7 +371,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();
         
@@ -390,11 +390,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);
@@ -551,12 +550,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);
@@ -564,8 +568,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);
 
@@ -621,7 +623,7 @@ public class DestinationSequenceTest ext
         EasyMock.expectLastCall();
         control.replay();
         st.run();
-        control.verify();
+        control.verify();        
     }
     
     @Test
@@ -672,6 +674,7 @@ public class DestinationSequenceTest ext
         seq.cancelDeferredAcknowledgments();
         t.cancel();
         control.verify();
+
     }
     
     @Test
@@ -690,10 +693,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);
 
@@ -717,6 +720,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