[jboss-cvs] JBoss Messaging SVN: r2912 - in trunk/tests/src/org/jboss/test/messaging/jms: message and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 19 13:03:14 EDT 2007


Author: timfox
Date: 2007-07-19 13:03:14 -0400 (Thu, 19 Jul 2007)
New Revision: 2912

Removed:
   trunk/tests/src/org/jboss/test/messaging/jms/JMSTestBase.java
Modified:
   trunk/tests/src/org/jboss/test/messaging/jms/message/ExpiredMessageTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/message/JMSExpirationHeaderTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/message/MessageTestBase.java
Log:
Speeded up message tests a little


Deleted: trunk/tests/src/org/jboss/test/messaging/jms/JMSTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/JMSTestBase.java	2007-07-19 16:35:28 UTC (rev 2911)
+++ trunk/tests/src/org/jboss/test/messaging/jms/JMSTestBase.java	2007-07-19 17:03:14 UTC (rev 2912)
@@ -1,118 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt in the distribution for a
-  * full listing of individual contributors.
-  *
-  * This is free software; you can redistribute it and/or modify it
-  * under the terms of the GNU Lesser General Public License as
-  * published by the Free Software Foundation; either version 2.1 of
-  * the License, or (at your option) any later version.
-  *
-  * This software is distributed in the hope that it will be useful,
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  * Lesser General Public License for more details.
-  *
-  * You should have received a copy of the GNU Lesser General Public
-  * License along with this software; if not, write to the Free
-  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-  */
-package org.jboss.test.messaging.jms;
-
-import org.jboss.test.messaging.MessagingTestCase;
-import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.jms.client.JBossConnectionFactory;
-
-import javax.jms.Queue;
-import javax.jms.Topic;
-import javax.jms.ConnectionFactory;
-import javax.jms.Connection;
-import javax.jms.Session;
-import javax.jms.MessageProducer;
-import javax.jms.MessageConsumer;
-import javax.naming.InitialContext;
-
-/**
- * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
- * @version <tt>$Revision$</tt>
- *
- * $Id$
- */
-public class JMSTestBase extends MessagingTestCase
-{
-   // Constants -----------------------------------------------------
-
-   // Static --------------------------------------------------------
-   
-   // Attributes ----------------------------------------------------
-
-   protected ConnectionFactory connFactory;
-   protected Connection conn;
-   protected Session session;
-   protected MessageProducer queueProd;
-   protected MessageConsumer queueCons;
-
-   protected Queue queue;
-   protected Topic topic;
-
-
-   // Constructors --------------------------------------------------
-
-   public JMSTestBase(String name)
-   {
-      super(name);
-   }
-
-   // Public --------------------------------------------------------
-
-   public void setUp() throws Exception
-   {
-      super.setUp();
-
-      ServerManagement.start("all");
-      
-      
-
-      InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment());
-      connFactory = (JBossConnectionFactory)ic.lookup("/ConnectionFactory");
-
-      conn = connFactory.createConnection();
-      session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-      ServerManagement.undeployQueue("Queue");
-      ServerManagement.deployQueue("Queue");
-      queue = (Queue)ic.lookup("/queue/Queue");
-      
-      this.drainDestination(connFactory, queue);
-
-      ServerManagement.undeployTopic("Topic");
-      ServerManagement.deployTopic("Topic");
-      topic = (Topic)ic.lookup("/topic/Topic");
-
-      queueProd = session.createProducer(queue);
-      queueCons = session.createConsumer(queue);
-
-      conn.start();
-
-      ic.close();
-   }
-
-   public void tearDown() throws Exception
-   {
-      conn.close();
-      ServerManagement.undeployQueue("Queue");
-      ServerManagement.undeployTopic("Topic");
-      
-      super.tearDown();
-   }
-
-   // Package protected ---------------------------------------------
-   
-   // Protected -----------------------------------------------------
-   
-   // Private -------------------------------------------------------
-   
-   // Inner classes -------------------------------------------------   
-}

Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/ExpiredMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/ExpiredMessageTest.java	2007-07-19 16:35:28 UTC (rev 2911)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/ExpiredMessageTest.java	2007-07-19 17:03:14 UTC (rev 2912)
@@ -62,7 +62,7 @@
 
       // wait for the message to die
 
-      Thread.sleep(1000);
+      Thread.sleep(250);
 
       MessageConsumer cons = session.createConsumer(queue);
 
@@ -84,33 +84,20 @@
       
       Message m = session.createTextMessage("This message will die");
       
-      final int MESSAGE_COUNT = 2000;
-
-      log.info("Going to send " + MESSAGE_COUNT + " messages");
-
+      final int MESSAGE_COUNT = 100;
+   
       for (int i = 0; i < MESSAGE_COUNT; i++)
       {
          prod.send(m);
-         if ((i + 1) % 1000 == 0)
-         {
-            log.info("Sent " + (i + 1) + " messages out of " + MESSAGE_COUNT);
-         }
       }
       
-      Thread.sleep(1000);
-      
-      log.info("Creating consumer");
-
       MessageConsumer cons = session.createConsumer(queue);
       conn.start();
       
-      final int TIMEOUT = 3000;
-      log.info("Trying to receive a message, timeout is " + TIMEOUT + " ms");
+      final int TIMEOUT = 2000;
 
       assertNull(cons.receive(TIMEOUT));
       
-      log.info("Done");
-      
       conn.close();
    }
 

Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/JMSExpirationHeaderTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/JMSExpirationHeaderTest.java	2007-07-19 16:35:28 UTC (rev 2911)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/JMSExpirationHeaderTest.java	2007-07-19 17:03:14 UTC (rev 2912)
@@ -167,7 +167,6 @@
             {
                long t1 = System.currentTimeMillis();
                expectedMessage = queueConsumer.receive(timeToWaitForReceive);
-               //Thread.sleep(10);
                effectiveReceiveTime = System.currentTimeMillis() - t1;
             }
             catch(Exception e)

Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java	2007-07-19 16:35:28 UTC (rev 2911)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/JMSXDeliveryCountTest.java	2007-07-19 17:03:14 UTC (rev 2912)
@@ -172,8 +172,6 @@
          prod.send(tm);
       }
 
-      Thread.sleep(2000);
-
       Session sess2 = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
       
       MessageConsumer cons = sess2.createConsumer(queue);
@@ -192,9 +190,7 @@
          sess2.recover();
       }
       
-      conn.close();
-      
-      
+      conn.close();           
    }
    
 

Modified: trunk/tests/src/org/jboss/test/messaging/jms/message/MessageTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/message/MessageTestBase.java	2007-07-19 16:35:28 UTC (rev 2911)
+++ trunk/tests/src/org/jboss/test/messaging/jms/message/MessageTestBase.java	2007-07-19 17:03:14 UTC (rev 2912)
@@ -21,11 +21,21 @@
   */
 package org.jboss.test.messaging.jms.message;
 
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
 import javax.jms.DeliveryMode;
 import javax.jms.JMSException;
 import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.naming.InitialContext;
 
-import org.jboss.test.messaging.jms.JMSTestBase;
+import org.jboss.jms.client.JBossConnectionFactory;
+import org.jboss.test.messaging.MessagingTestCase;
+import org.jboss.test.messaging.tools.ServerManagement;
 
 /**
  * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
@@ -33,7 +43,7 @@
  *
  * $Id$
  */
-public class MessageTestBase extends JMSTestBase
+public class MessageTestBase extends MessagingTestCase
 {
    // Constants -----------------------------------------------------
 
@@ -42,7 +52,17 @@
    // Attributes ----------------------------------------------------
 
    protected Message message;
+   
+   protected ConnectionFactory connFactory;
+   protected Connection conn;
+   protected Session session;
+   protected MessageProducer queueProd;
+   protected MessageConsumer queueCons;
 
+   protected Queue queue;
+   protected Topic topic;
+
+
    // Constructors --------------------------------------------------
 
    public MessageTestBase(String name)
@@ -55,11 +75,45 @@
    public void setUp() throws Exception
    {
       super.setUp();
+      
+      log.info("** setting up");
+
+      ServerManagement.start("all");
+           
+      InitialContext ic = new InitialContext(ServerManagement.getJNDIEnvironment());
+      connFactory = (JBossConnectionFactory)ic.lookup("/ConnectionFactory");
+
+      conn = connFactory.createConnection();
+      session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      ServerManagement.undeployQueue("Queue");
+      ServerManagement.deployQueue("Queue");
+      queue = (Queue)ic.lookup("/queue/Queue");
+      
+      ServerManagement.undeployTopic("Topic");
+      ServerManagement.deployTopic("Topic");
+      topic = (Topic)ic.lookup("/topic/Topic");
+
+      queueProd = session.createProducer(queue);
+      queueCons = session.createConsumer(queue);
+
+      conn.start();
+
+      ic.close();
+      
+      log.info("** done setup");
    }
 
    public void tearDown() throws Exception
    {
+   	log.info("** tearing down");
+      conn.close();
+      
+      ServerManagement.undeployQueue("Queue");
+      ServerManagement.undeployTopic("Topic");
+      
       super.tearDown();
+      log.info("** done teardown");
    }
 
    public void testNonPersistentSend() throws Exception




More information about the jboss-cvs-commits mailing list