activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject git commit: Improve the Paho over NIO tests, allow scaling the test using a -DPahoMQTNioTTest.CLIENTS=xxxx mvn build arg.
Date Tue, 12 Nov 2013 15:55:56 GMT
Updated Branches:
  refs/heads/trunk 0ed2ddb3d -> 02a821def


Improve the Paho over NIO tests, allow scaling the test using a -DPahoMQTNioTTest.CLIENTS=xxxx
mvn build arg.


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/02a821de
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/02a821de
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/02a821de

Branch: refs/heads/trunk
Commit: 02a821defec2da85396fe737b4d0603be09b5fc1
Parents: 0ed2ddb
Author: Hiram Chirino <hiram@hiramchirino.com>
Authored: Tue Nov 12 10:55:41 2013 -0500
Committer: Hiram Chirino <hiram@hiramchirino.com>
Committed: Tue Nov 12 10:55:51 2013 -0500

----------------------------------------------------------------------
 .../activemq/transport/mqtt/PahoMQTNioTTest.java   | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/02a821de/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/PahoMQTNioTTest.java
----------------------------------------------------------------------
diff --git a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/PahoMQTNioTTest.java
b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/PahoMQTNioTTest.java
index b657c0a..3c9ab18 100644
--- a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/PahoMQTNioTTest.java
+++ b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/PahoMQTNioTTest.java
@@ -46,7 +46,8 @@ public class PahoMQTNioTTest extends PahoMQTTTest {
     @Test(timeout=300000)
     public void testLotsOfClients() throws Exception {
 
-        final int CLIENTS = 100;
+        final int CLIENTS = Integer.getInteger("PahoMQTNioTTest.CLIENTS", 100);
+        LOG.info("Using: "+CLIENTS+" clients");
         addMQTTConnector();
         TransportConnector openwireTransport = brokerService.addConnector("tcp://localhost:0");
         brokerService.start();
@@ -78,7 +79,10 @@ public class PahoMQTNioTTest extends PahoMQTTTest {
                         client.connect();
                         connectedDoneLatch.countDown();
                         sendBarrier.await();
-                        client.publish("test", "hello".getBytes(), 1, false);
+                        for( int i=0; i < 10; i++) {
+                           Thread.sleep(1000);
+                           client.publish("test", "hello".getBytes(), 1, false);
+                        }
                         client.disconnect();
                         client.close();
                     } catch (Throwable e) {
@@ -93,21 +97,24 @@ public class PahoMQTNioTTest extends PahoMQTTTest {
 
         connectedDoneLatch.await();
         assertNull("Async error: "+asyncError.get(),asyncError.get());
-        System.out.println("All clients connected...");
         sendBarrier.countDown();
 
+        LOG.info("All clients connected... waiting to receive sent messages...");
+
         // We should eventually get all the messages.
         within(30, TimeUnit.SECONDS, new Task() {
             @Override
             public void run() throws Exception {
-                assertTrue(receiveCounter.get() == CLIENTS);
+                assertTrue(receiveCounter.get() == CLIENTS*10);
             }
         });
 
+        LOG.info("All messages received.");
+
         disconnectDoneLatch.await();
         assertNull("Async error: "+asyncError.get(),asyncError.get());
 
     }
 
 
-}
\ No newline at end of file
+}


Mime
View raw message