[jboss-cvs] JBoss Messaging SVN: r2864 - trunk/tests/src/org/jboss/test/messaging/jms/manual.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jul 9 20:24:58 EDT 2007


Author: clebert.suconic at jboss.com
Date: 2007-07-09 20:24:57 -0400 (Mon, 09 Jul 2007)
New Revision: 2864

Modified:
   trunk/tests/src/org/jboss/test/messaging/jms/manual/ManualQueueSoakTest.java
Log:
http://jira.jboss.com/jira/browse/JBMESSAGING-265 - few tweaks on test

Modified: trunk/tests/src/org/jboss/test/messaging/jms/manual/ManualQueueSoakTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/manual/ManualQueueSoakTest.java	2007-07-10 00:00:33 UTC (rev 2863)
+++ trunk/tests/src/org/jboss/test/messaging/jms/manual/ManualQueueSoakTest.java	2007-07-10 00:24:57 UTC (rev 2864)
@@ -55,11 +55,11 @@
 
    // Static ---------------------------------------------------------------------------------------
 
-   static long PRODUCER_ALIVE_FOR=10000; // 1 minutes
-   static long CONSUMER_ALIVE_FOR=10000; // 1 minutes
-   static long TEST_ALIVE_FOR=600*1000; // 10 minutes
-   static int NUMBER_OF_PRODUCERS=10;
-   static int NUMBER_OF_CONSUMERS=10;
+   static long PRODUCER_ALIVE_FOR=60000; // 1 minutes
+   static long CONSUMER_ALIVE_FOR=60000; // 1 minutes
+   static long TEST_ALIVE_FOR=20000; // 10 minutes
+   static int NUMBER_OF_PRODUCERS=30;
+   static int NUMBER_OF_CONSUMERS=30;
 
    static SynchronizedInt producedMessages = new SynchronizedInt(0);
    static SynchronizedInt readMessages = new SynchronizedInt(0);
@@ -138,7 +138,7 @@
                   {
                      if (finished.getWorker() instanceof Producer)
                      {
-                        log.info("Scheduling new Producer");
+                        log.info("Scheduling new Producer " + numberOfProducers);
                         Producer producer = new Producer(numberOfProducers++, testChannel);
                         threads.add(producer);
                         producer.start();
@@ -146,7 +146,7 @@
                      else
                      if (finished.getWorker() instanceof Consumer)
                      {
-                        log.info("Scheduling new Consumer");
+                        log.info("Scheduling new Consumer " + numberOfConsumers);
                         Consumer consumer = new Consumer(numberOfConsumers++, testChannel);
                         threads.add(consumer);
                         consumer.start();
@@ -162,10 +162,22 @@
       }
 
 
-      ctx = createContext();
+      clearMessages();
+      
+      assertEquals(producedMessages.get(), readMessages.get());
+   }
+
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   protected void clearMessages() throws Exception
+   {
+      Context ctx = createContext();
       ConnectionFactory cf = (ConnectionFactory) ctx.lookup("/ClusteredConnectionFactory");
       Connection conn = cf.createConnection();
-      Session sess = conn.createSession(true, Session.SESSION_TRANSACTED);
+      Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
       Queue queue = (Queue )ctx.lookup("queue/testQueue");
       MessageConsumer consumer = sess.createConsumer(queue);
 
@@ -174,18 +186,12 @@
       while (consumer.receive(1000)!=null)
       {
          readMessages.increment();
+         log.info("Received JMS message on clearMessages");
       }
 
-
       conn.close();
-
-      assertEquals(producedMessages.get(), readMessages.get());
    }
 
-   // Package protected ----------------------------------------------------------------------------
-
-   // Protected ------------------------------------------------------------------------------------
-
    protected void tearDown() throws Exception
    {
       super.tearDown();
@@ -194,6 +200,7 @@
    protected void setUp() throws Exception
    {
       super.setUp();
+      clearMessages();
       producedMessages = new SynchronizedInt(0);
       readMessages = new SynchronizedInt(0);
 
@@ -297,12 +304,17 @@
 
             try
             {
+               int messageSent=0;
                while(System.currentTimeMillis() < timeToFinish)
                {
                   prod.send(sess.createTextMessage("Message sent at " + System.currentTimeMillis()));
                   producedMessages.increment();
+                  messageSent++;
+                  if (messageSent%50==0)
+                  {
+                     log.info("Sent " + messageSent + " Messages");
+                  }
                   Thread.sleep(100);
-                  log.info("Sending message");
                }
                sendInternalMessage(new WorkedFinishedMessages(this));
             }
@@ -349,7 +361,7 @@
 
             int transactions = 0;
 
-            long timeToFinish = System.currentTimeMillis() + PRODUCER_ALIVE_FOR;
+            long timeToFinish = System.currentTimeMillis() + CONSUMER_ALIVE_FOR;
 
             try
             {
@@ -358,7 +370,6 @@
                   Message msg = consumer.receive(1000);
                   if (msg != null)
                   {
-                     log.info("Received JMS message");
                      msgs ++;
                      if (msgs>=50)
                      {




More information about the jboss-cvs-commits mailing list