cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From egl...@apache.org
Subject svn commit: r774760 - in /cxf/trunk: rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java systests/src/test/java/org/apache/cxf/systest/ws/util/MessageRecorder.java
Date Thu, 14 May 2009 13:29:56 GMT
Author: eglynn
Date: Thu May 14 13:29:56 2009
New Revision: 774760

URL: http://svn.apache.org/viewvc?rev=774760&view=rev
Log:
Removed minor race conditions in RM tests and improved test diagnostics

Modified:
    cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/DestinationSequenceTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/MessageRecorder.java

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=774760&r1=774759&r2=774760&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 Thu
May 14 13:29:56 2009
@@ -340,18 +340,18 @@
         for (int i = 0; i < 10; i++) {
             seq.acknowledge(messages[i]);
             try {
-                Thread.sleep(50);
+                Thread.sleep(55);
             } catch (InterruptedException ex) {
                 // ignore
             }
         }
         int mpm1 = monitor.getMPM();
-        assertTrue(mpm1 > 0);
+        assertTrue("unexpected MPM: " + mpm1, mpm1 > 0);
         
         for (int i = 10; i < messages.length; i++) {
             seq.acknowledge(messages[i]);
             try {
-                Thread.sleep(100);
+                Thread.sleep(110);
             } catch (InterruptedException ex) {
                 // ignore
             }

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/MessageRecorder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/MessageRecorder.java?rev=774760&r1=774759&r2=774760&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/MessageRecorder.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/util/MessageRecorder.java Thu
May 14 13:29:56 2009
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.systest.ws.util;
 
+import java.util.List;
+
 import junit.framework.Assert;
 
 public class MessageRecorder extends Assert {
@@ -52,7 +54,34 @@
             }
             waited += 100;
         }
-        assertEquals("Did not receive expected number of inbound messages", nExpectedIn,
nIn);
-        assertEquals("Did not send expected number of outbound messages", nExpectedOut, nOut);
       
+        if (nExpectedIn != nIn) {
+            System.out.println((nExpectedIn < nIn ? "excess" : "shortfall")
+                               + " of " + Math.abs(nExpectedIn - nIn)
+                               + " incoming messages");
+            System.out.println("\nMessages actually received:\n");
+            List<byte[]> inbound = inRecorder.getInboundMessages();
+            for (byte[] b : inbound) {
+                System.out.println(new String(b) + "\n");
+                System.out.println("----------------\n");
+            }
+        }
+        if (nExpectedOut != nOut) {
+            System.out.println((nExpectedOut < nOut ? "excess" : "shortfall")
+                               + " of " + Math.abs(nExpectedOut - nOut)
+                               + " outgoing messages");
+            System.out.println("\nMessages actually sent:\n");
+            List<byte[]> outbound = outRecorder.getOutboundMessages();
+            for (byte[] b : outbound) {
+                System.out.println(new String(b) + "\n");
+                System.out.println("----------------\n");
+            }
+        }
+        
+        if (nExpectedIn > nIn) {
+            assertEquals("Did not receive expected number of inbound messages", nExpectedIn,
nIn);
+        }
+        if (nExpectedOut > nOut) {
+            assertEquals("Did not send expected number of outbound messages", nExpectedOut,
nOut);
+        }        
     }    
 }



Mime
View raw message