cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1130136 - in /cxf/branches/2.3.x-fixes: ./ systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/RetransmissionQueueTest.java
Date Wed, 01 Jun 2011 13:04:20 GMT
Author: ay
Date: Wed Jun  1 13:04:20 2011
New Revision: 1130136

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

........
  r1130068 | ay | 2011-06-01 11:17:27 +0200 (Wed, 01 Jun 2011) | 1 line
  
  [CXF-3563] WS-RM RetransmissionQueueTest to correctly simulate the testing condition
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/RetransmissionQueueTest.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun  1 13:04:20 2011
@@ -1 +1 @@
-/cxf/trunk:1128092,1128202-1128206
+/cxf/trunk:1128092,1128202-1128206,1130068

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

Modified: cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/RetransmissionQueueTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/RetransmissionQueueTest.java?rev=1130136&r1=1130135&r2=1130136&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/RetransmissionQueueTest.java
(original)
+++ cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/rm/RetransmissionQueueTest.java
Wed Jun  1 13:04:20 2011
@@ -18,7 +18,8 @@
  */
 package org.apache.cxf.systest.ws.rm;
 
-import java.io.IOException;
+import java.io.OutputStream;
+import java.math.BigInteger;
 import java.util.logging.Logger;
 
 import javax.xml.ws.Endpoint;
@@ -32,6 +33,7 @@ import org.apache.cxf.greeter_control.Gr
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.interceptor.MessageSenderInterceptor;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.phase.Phase;
@@ -113,22 +115,30 @@ public class RetransmissionQueueTest ext
         
         bus.getOutFaultInterceptors().add(out);
         
+        bus.getExtension(RMManager.class).getRMAssertion().getBaseRetransmissionInterval()
+        .setMilliseconds(new BigInteger("5000"));
+        
         GreeterService gs = new GreeterService();
         final Greeter greeter = gs.getGreeterPort();
         updateAddressPort(greeter, DecoupledClientServerTest.PORT);
         LOG.fine("Created greeter client.");
        
         ConnectionHelper.setKeepAliveConnection(greeter, true);
+        RMManager manager = bus.getExtension(RMManager.class);
         
         try {
             greeter.greetMeOneWay("oneway");            
         } catch (Exception e) {
-            fail("fault thrown after queued for retransmission");
+            // no exception shall be thrown when the message is queued for retransmission
+            fail("fault thrown after queued for retransmission: " + e);
         }
         
+        // the message shall be in the queue
+        assertFalse("RetransmissionQueue empty", manager.getRetransmissionQueue().isEmpty());
+        
         tes.setWorking(true);
 
-        long wait = 3000;
+        long wait = 10000;
         while (wait > 0) {
             long start = System.currentTimeMillis();
             try {
@@ -138,14 +148,14 @@ public class RetransmissionQueueTest ext
             }
             wait -= System.currentTimeMillis() - start;
         }
-        
-        RMManager manager = bus.getExtension(RMManager.class);
-        boolean empty = manager.getRetransmissionQueue().isEmpty();
-        
-        assertTrue("RetransmissionQueue not cleared", empty);
+
+        // the message shall no longer be in the queue
+        assertTrue("RetransmissionQueue not empty", manager.getRetransmissionQueue().isEmpty());
     }
 
-    
+    /*
+     * an interceptor to trigger an error occuring at the sending phase.
+     */
     static class TransmissionErrorSimulator extends AbstractPhaseInterceptor<Message>
{
         private boolean working;
         
@@ -153,7 +163,8 @@ public class RetransmissionQueueTest ext
          * @param phase
          */
         public TransmissionErrorSimulator() {
-            super(Phase.WRITE);
+            super(Phase.PREPARE_SEND);
+            addAfter(MessageSenderInterceptor.class.getName());
         }
 
         /* (non-Javadoc)
@@ -169,10 +180,14 @@ public class RetransmissionQueueTest ext
                 // spare the message
             } else if (!working) {
                 // triggers a simulated error
-                throw new Fault(new IOException("simulated transmission error"));
+                try {
+                    message.getContent(OutputStream.class).close();
+                } catch (Exception e) {
+                    //
+                }
             }
         }
-
+        
         /**
          * @return the working
          */



Mime
View raw message