cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [2/2] git commit: Shorten a few more RM tests to poll for result instead of a long wait and then check
Date Mon, 07 Jul 2014 20:20:47 GMT
Shorten a few more RM tests to poll for result instead of a long wait and then check


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/1075d1f4
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/1075d1f4
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/1075d1f4

Branch: refs/heads/master
Commit: 1075d1f4775b02fe7305d9b71379a857dd358fca
Parents: f372fff
Author: Daniel Kulp <dkulp@apache.org>
Authored: Mon Jul 7 15:33:39 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Mon Jul 7 15:33:39 2014 -0400

----------------------------------------------------------------------
 .../ws/rm/DeliveryAssuranceOnewayTest.java      | 29 ++++++++-----
 .../cxf/systest/ws/rm/ManagedEndpointsTest.java | 43 +++++++++++++++-----
 .../apache/cxf/systest/ws/rm/managed-client.xml |  2 +-
 3 files changed, 52 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/1075d1f4/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/DeliveryAssuranceOnewayTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/DeliveryAssuranceOnewayTest.java
b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/DeliveryAssuranceOnewayTest.java
index e21ec71..ee9b45f 100644
--- a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/DeliveryAssuranceOnewayTest.java
+++ b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/DeliveryAssuranceOnewayTest.java
@@ -101,15 +101,17 @@ public class DeliveryAssuranceOnewayTest extends AbstractBusClientServerTestBase
         
         greeterBus.getOutInterceptors().add(new MessageLossSimulator());
         RMManager manager = greeterBus.getExtension(RMManager.class);
-        manager.getConfiguration().setBaseRetransmissionInterval(new Long(2000));
-        String[] callArgs = new String[] {"one", "two", "three", "four"};
+        manager.getConfiguration().setBaseRetransmissionInterval(new Long(1000));
+        String[] callArgs = new String[] {"one", "two", "three", "four", "five", "six",
+                                          "seven", "eight", "nine"};
         for (int i = 0; i < callArgs.length; i++) {
             greeter.greetMeOneWay(callArgs[i]);
         }
         
-        awaitMessages(callArgs.length + 2, 3000, 60000);
+        awaitMessages(callArgs.length, 1, 3000);
+        
         List<String> actualArgs = GreeterProvider.CALL_ARGS;
-        assertTrue("Too few messages", callArgs.length <= actualArgs.size());
+        int checkCount = 0;
         for (int i = 0; i < callArgs.length; i++) {
             boolean match = false;
             for (int j = 0; j < actualArgs.size(); j++) {
@@ -119,10 +121,15 @@ public class DeliveryAssuranceOnewayTest extends AbstractBusClientServerTestBase
                 }
             }
             if (!match) {
-                fail("No match for request " + callArgs[i]);
+                if (checkCount > 20) {
+                    fail("No match for request " + callArgs[i]);
+                }
+                checkCount++;
+                awaitMessages(callArgs.length, 1, 250);
+                i--;
             }
         }
-        
+        assertTrue("Too few messages " + actualArgs.size(), callArgs.length <= actualArgs.size());
     }
 
     @Test    
@@ -146,7 +153,7 @@ public class DeliveryAssuranceOnewayTest extends AbstractBusClientServerTestBase
             greeter.greetMeOneWay(callArgs[i]);
         }
         
-        awaitMessages(callArgs.length, 3000, 60000);
+        awaitMessages(callArgs.length, 1000, 60000);
         List<String> actualArgs = GreeterProvider.CALL_ARGS;
         assertTrue("Too many messages", callArgs.length >= actualArgs.size());
         for (int i = 0; i < actualArgs.size() - 1; i++) {
@@ -180,7 +187,7 @@ public class DeliveryAssuranceOnewayTest extends AbstractBusClientServerTestBase
             greeter.greetMeOneWay(callArgs[i]);
         }
         
-        awaitMessages(callArgs.length, 3000, 60000);
+        awaitMessages(callArgs.length, 1000, 60000);
         List<String> actualArgs = GreeterProvider.CALL_ARGS;
         assertEquals("Wrong message count", callArgs.length, actualArgs.size());
         for (int i = 0; i < callArgs.length; i++) {
@@ -219,7 +226,7 @@ public class DeliveryAssuranceOnewayTest extends AbstractBusClientServerTestBase
             greeter.greetMeOneWay(callArgs[i]);
         }
         
-        awaitMessages(callArgs.length - 2, 3000, 60000);
+        awaitMessages(callArgs.length - 2, 1000, 60000);
         List<String> actualArgs = GreeterProvider.CALL_ARGS;
         int argNum = 0;
         for (String actual : actualArgs) {
@@ -251,7 +258,7 @@ public class DeliveryAssuranceOnewayTest extends AbstractBusClientServerTestBase
             greeter.greetMeOneWay(callArgs[i]);
         }
         
-        awaitMessages(callArgs.length - 2, 3000, 60000);
+        awaitMessages(callArgs.length - 2, 1000, 60000);
         List<String> actualArgs = GreeterProvider.CALL_ARGS;
         assertTrue("Too many messages", callArgs.length >= actualArgs.size());
         int argNum = 0;
@@ -284,7 +291,7 @@ public class DeliveryAssuranceOnewayTest extends AbstractBusClientServerTestBase
             greeter.greetMeOneWay(callArgs[i]);
         }
         
-        awaitMessages(callArgs.length, 3000, 60000);
+        awaitMessages(callArgs.length, 1000, 60000);
         List<String> actualArgs = GreeterProvider.CALL_ARGS;
         assertEquals("Wrong number of messages", callArgs.length, actualArgs.size());
         int argNum = 0;

http://git-wip-us.apache.org/repos/asf/cxf/blob/1075d1f4/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ManagedEndpointsTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ManagedEndpointsTest.java
b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ManagedEndpointsTest.java
index 00aada4..6b7397b 100755
--- a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ManagedEndpointsTest.java
+++ b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/ManagedEndpointsTest.java
@@ -299,13 +299,25 @@ public class ManagedEndpointsTest extends AbstractClientServerTestBase
{
                        new Object[]{sseqId}, ONESTRING_SIGNATURE);
         verifyArray("Expected range", o, new Long[]{1L, 1L, 3L, 3L}, true);
 
-        // 7 sec retry interval + 5 sec
-        LOG.info("waiting for 12 secs for the retry to complete ...");
-        Thread.sleep(12000);
+        // 3 sec retry interval
+        LOG.info("waiting for 3 secs for the retry to complete ...");
+        Thread.sleep(3000);
 
         o = mbs.invoke(clientEndpointName, "getQueuedMessageTotalCount", 
                        new Object[]{true}, ONEBOOLEAN_SIGNATURE);
-        assertTrue("No queued message", o instanceof Integer && 0 == ((Integer)o).intValue());
+        assertTrue(o instanceof Integer);
+        int count = 0;
+        while (((Integer)o).intValue() > 0) {
+            Thread.sleep(200);
+            count++;
+            if (count > 20) {
+                fail("Failed to empty the resend queue");
+            }
+            o = mbs.invoke(clientEndpointName, "getQueuedMessageTotalCount", 
+                           new Object[]{true}, ONEBOOLEAN_SIGNATURE);
+            assertTrue(o instanceof Integer);
+        }
+        assertTrue("No queued message " + o, o instanceof Integer && 0 == ((Integer)o).intValue());
         assertEquals(2L, listener.lastAcknowledgement);
 
         o = mbs.invoke(clientEndpointName, "getSourceSequenceAcknowledgedRange", 
@@ -380,9 +392,9 @@ public class ManagedEndpointsTest extends AbstractClientServerTestBase
{
         LOG.info("suspended the source queue: " + sseqId);
         
 
-        // 7 sec retry interval + 3 sec
-        LOG.info("waiting for 10 secs for the retry (suspended)...");
-        Thread.sleep(10000);
+        // 3 sec retry interval + 1 sec
+        LOG.info("waiting for 4 secs for the retry (suspended)...");
+        Thread.sleep(4000);
 
         o = mbs.invoke(clientEndpointName, "getQueuedMessageTotalCount", 
                        new Object[]{true}, ONEBOOLEAN_SIGNATURE);
@@ -392,11 +404,22 @@ public class ManagedEndpointsTest extends AbstractClientServerTestBase
{
                    new Object[]{sseqId}, ONESTRING_SIGNATURE);
         LOG.info("resumed the source queue: " + sseqId);
         
-        LOG.info("waiting for 15 secs for the retry (resumed)...");
-        Thread.sleep(15000);
-
         o = mbs.invoke(clientEndpointName, "getQueuedMessageTotalCount", 
                        new Object[]{true}, ONEBOOLEAN_SIGNATURE);
+        int count = 0;
+        assertTrue(o instanceof Integer);
+        while (((Integer)o).intValue() > 0) {
+            Thread.sleep(200);
+            count++;
+            if (count > 100) {
+                //up to 20 seconds to do the resend, should be within 3 or 4 
+                fail("Failed to empty the resend queue");
+            }
+            o = mbs.invoke(clientEndpointName, "getQueuedMessageTotalCount", 
+                           new Object[]{true}, ONEBOOLEAN_SIGNATURE);
+            assertTrue(o instanceof Integer);
+        }
+        
         assertTrue("No queued messages", o instanceof Integer && 0 == ((Integer)o).intValue());
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/1075d1f4/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/managed-client.xml
----------------------------------------------------------------------
diff --git a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/managed-client.xml
b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/managed-client.xml
index dcf0c29..dc28501 100644
--- a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/managed-client.xml
+++ b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/managed-client.xml
@@ -24,7 +24,7 @@
             <wsa:addressing/>
             <wsrm-mgr:reliableMessaging>
                 <wsrm-policy:RMAssertion>
-                    <wsrm-policy:BaseRetransmissionInterval Milliseconds="7000"/>
+                    <wsrm-policy:BaseRetransmissionInterval Milliseconds="3000"/>
                     <wsrm-policy:AcknowledgementInterval Milliseconds="0"/>
                 </wsrm-policy:RMAssertion>
                 <wsrm-mgr:destinationPolicy>


Mime
View raw message