[jboss-cvs] JBoss Messaging SVN: r4649 - in trunk: tests/src/org/jboss/messaging/tests and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jul 7 11:45:41 EDT 2008


Author: clebert.suconic at jboss.com
Date: 2008-07-07 11:45:38 -0400 (Mon, 07 Jul 2008)
New Revision: 4649

Added:
   trunk/tests/src/org/jboss/messaging/tests/concurrent/
   trunk/tests/src/org/jboss/messaging/tests/concurrent/server/
   trunk/tests/src/org/jboss/messaging/tests/concurrent/server/impl/
   trunk/tests/src/org/jboss/messaging/tests/concurrent/server/impl/QueueTest.java
Removed:
   trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/concurrent/QueueTest.java
Modified:
   trunk/build-messaging.xml
   trunk/build.xml
Log:
Moving concurrent tests to its own tree

Modified: trunk/build-messaging.xml
===================================================================
--- trunk/build-messaging.xml	2008-07-07 15:31:06 UTC (rev 4648)
+++ trunk/build-messaging.xml	2008-07-07 15:45:38 UTC (rev 4649)
@@ -636,7 +636,14 @@
          <param name="tests.param" value="**/org/jboss/messaging/tests/integration/**/*${test-mask}.class"/>
       </antcall>
    </target>
+   
+   <target name="concurrent-tests" depends="jar, compile-unit-tests">
+	   <antcall inheritall="true" inheritrefs="true" target="tests">
+	      <param name="tests.param" value="**/org/jboss/messaging/tests/concurrent/**/*${test-mask}.class"/>
+	   </antcall>
+   </target>
 
+
    <target name="unit-tests" depends="jar, compile-unit-tests">
       <antcall inheritall="true" inheritrefs="true" target="tests">
          <param name="tests.param" value="**/org/jboss/messaging/tests/unit/**/*${test-mask}.class"/>
@@ -761,7 +768,7 @@
       <antcall target="compile-reports"/>
    </target>
 
-   <target name="all-tests" depends="unit-tests, integration-tests, timing-tests, performance-tests, jms-tests"/>
+   <target name="all-tests" depends="unit-tests, integration-tests, timing-tests, performance-tests, concurrent-tests, jms-tests"/>
 
    <target name="compile-reports">
       <mkdir dir="${test.stylesheets.dir}"/>

Modified: trunk/build.xml
===================================================================
--- trunk/build.xml	2008-07-07 15:31:06 UTC (rev 4648)
+++ trunk/build.xml	2008-07-07 15:45:38 UTC (rev 4649)
@@ -117,14 +117,18 @@
       <ant antfile="build-messaging.xml" target="unit-tests"/>
    </target>
 
-    <target name="timing-tests" depends="createthirdparty">
+   <target name="timing-tests" depends="createthirdparty">
       <ant antfile="build-messaging.xml" target="timing-tests"/>
    </target>
 
-    <target name="integration-tests" depends="createthirdparty">
+   <target name="integration-tests" depends="createthirdparty">
       <ant antfile="build-messaging.xml" target="integration-tests"/>
    </target>
 
+    <target name="concurrent-tests" depends="createthirdparty">
+      <ant antfile="build-messaging.xml" target="concurrent-tests"/>
+   </target>
+
     <target name="performance-tests" depends="createthirdparty">
       <ant antfile="build-messaging.xml" target="performance-tests"/>
    </target>
@@ -208,4 +212,4 @@
    <target name="SimpleExample" depends="createthirdparty">
       <ant antfile="build-messaging.xml" target="SimpleExample"/>
    </target>
-</project>
\ No newline at end of file
+</project>

Copied: trunk/tests/src/org/jboss/messaging/tests/concurrent/server/impl/QueueTest.java (from rev 4647, trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/concurrent/QueueTest.java)
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/concurrent/server/impl/QueueTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/concurrent/server/impl/QueueTest.java	2008-07-07 15:45:38 UTC (rev 4649)
@@ -0,0 +1,207 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.tests.concurrent.server.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.messaging.core.server.HandleStatus;
+import org.jboss.messaging.core.server.MessageReference;
+import org.jboss.messaging.core.server.Queue;
+import org.jboss.messaging.core.server.QueueFactory;
+import org.jboss.messaging.core.server.ServerMessage;
+import org.jboss.messaging.tests.unit.core.server.impl.fakes.FakeConsumer;
+import org.jboss.messaging.tests.unit.core.server.impl.fakes.FakeQueueFactory;
+import org.jboss.messaging.tests.util.UnitTestCase;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * 
+ * A concurrent QueueTest
+ * 
+ * All the concurrent queue tests go in here 
+ * 
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class QueueTest extends UnitTestCase
+{
+   private QueueFactory queueFactory = new FakeQueueFactory();
+   
+   /*
+    * Concurrent set consumer not busy, busy then, call deliver while messages are being added and consumed
+    */
+   public void testConcurrentAddsDeliver() throws Exception
+   {
+      Queue queue = queueFactory.createQueue(1, new SimpleString("queue1"), null, false, true);
+      
+      FakeConsumer consumer = new FakeConsumer();
+      
+      queue.addConsumer(consumer);
+      
+      final long testTime = 5000;
+      
+      Sender sender = new Sender(queue, testTime);
+      
+      Toggler toggler = new Toggler(queue, consumer, testTime);
+      
+      sender.start();
+      
+      toggler.start();
+      
+      sender.join();
+      
+      toggler.join();
+      
+      consumer.setStatusImmediate(HandleStatus.HANDLED);
+      
+      queue.deliver();
+      
+      if (sender.getException() != null)
+      {
+         throw sender.getException();
+      }
+      
+      if (toggler.getException() != null)
+      {
+         throw toggler.getException();
+      }
+      
+      assertRefListsIdenticalRefs(sender.getReferences(), consumer.getReferences());
+      
+      System.out.println("num refs: " + sender.getReferences().size());
+      
+      System.out.println("num toggles: " + toggler.getNumToggles());
+      
+   }
+   
+   // Inner classes ---------------------------------------------------------------
+   
+   class Sender extends Thread
+   {
+      private volatile Exception e;
+      
+      private Queue queue;
+      
+      private long testTime;
+      
+      private volatile int i;
+      
+      public Exception getException()
+      {
+         return e;
+      }
+      
+      private List<MessageReference> refs = new ArrayList<MessageReference>();
+      
+      public List<MessageReference> getReferences()
+      {
+         return refs;
+      }
+      
+      Sender(Queue queue, long testTime)
+      {
+         this.testTime = testTime;
+         
+         this.queue = queue;
+      }
+      
+      public void run()
+      {
+         long start = System.currentTimeMillis();
+         
+         while (System.currentTimeMillis() - start < testTime)
+         {
+            ServerMessage message = generateMessage(i);
+            
+            MessageReference ref = message.createReference(queue);
+            
+            queue.addLast(ref);
+            
+            refs.add(ref);
+            
+            i++;
+         }
+      }
+   }
+   
+   class Toggler extends Thread
+   {
+      private volatile Exception e;
+      
+      private Queue queue;
+      
+      private FakeConsumer consumer;
+      
+      private long testTime;
+      
+      private boolean toggle;
+      
+      private volatile int numToggles;
+      
+      public int getNumToggles()
+      {
+         return numToggles;
+      }
+      
+      public Exception getException()
+      {
+         return e;
+      }
+      
+      Toggler(Queue queue, FakeConsumer consumer, long testTime)
+      {
+         this.testTime = testTime;
+         
+         this.queue = queue;
+         
+         this.consumer = consumer;
+      }
+      
+      public void run()
+      {
+         long start = System.currentTimeMillis();
+         
+         while (System.currentTimeMillis() - start < testTime)
+         {
+            if (toggle)
+            {
+               consumer.setStatusImmediate(HandleStatus.BUSY);              
+            }
+            else
+            {
+               consumer.setStatusImmediate(HandleStatus.HANDLED);
+               
+               queue.deliver();
+            }
+            toggle = !toggle;
+            
+            numToggles++;
+         }
+      }
+   }
+      
+}
+
+
+

Deleted: trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/concurrent/QueueTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/concurrent/QueueTest.java	2008-07-07 15:31:06 UTC (rev 4648)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/concurrent/QueueTest.java	2008-07-07 15:45:38 UTC (rev 4649)
@@ -1,207 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * 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.messaging.tests.unit.core.server.impl.concurrent;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.messaging.core.server.HandleStatus;
-import org.jboss.messaging.core.server.MessageReference;
-import org.jboss.messaging.core.server.Queue;
-import org.jboss.messaging.core.server.QueueFactory;
-import org.jboss.messaging.core.server.ServerMessage;
-import org.jboss.messaging.tests.unit.core.server.impl.fakes.FakeConsumer;
-import org.jboss.messaging.tests.unit.core.server.impl.fakes.FakeQueueFactory;
-import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
-
-/**
- * 
- * A concurrent QueueTest
- * 
- * All the concurrent queue tests go in here 
- * 
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public class QueueTest extends UnitTestCase
-{
-   private QueueFactory queueFactory = new FakeQueueFactory();
-   
-   /*
-    * Concurrent set consumer not busy, busy then, call deliver while messages are being added and consumed
-    */
-   public void testConcurrentAddsDeliver() throws Exception
-   {
-      Queue queue = queueFactory.createQueue(1, new SimpleString("queue1"), null, false, true);
-      
-      FakeConsumer consumer = new FakeConsumer();
-      
-      queue.addConsumer(consumer);
-      
-      final long testTime = 5000;
-      
-      Sender sender = new Sender(queue, testTime);
-      
-      Toggler toggler = new Toggler(queue, consumer, testTime);
-      
-      sender.start();
-      
-      toggler.start();
-      
-      sender.join();
-      
-      toggler.join();
-      
-      consumer.setStatusImmediate(HandleStatus.HANDLED);
-      
-      queue.deliver();
-      
-      if (sender.getException() != null)
-      {
-         throw sender.getException();
-      }
-      
-      if (toggler.getException() != null)
-      {
-         throw toggler.getException();
-      }
-      
-      assertRefListsIdenticalRefs(sender.getReferences(), consumer.getReferences());
-      
-      System.out.println("num refs: " + sender.getReferences().size());
-      
-      System.out.println("num toggles: " + toggler.getNumToggles());
-      
-   }
-   
-   // Inner classes ---------------------------------------------------------------
-   
-   class Sender extends Thread
-   {
-      private volatile Exception e;
-      
-      private Queue queue;
-      
-      private long testTime;
-      
-      private volatile int i;
-      
-      public Exception getException()
-      {
-         return e;
-      }
-      
-      private List<MessageReference> refs = new ArrayList<MessageReference>();
-      
-      public List<MessageReference> getReferences()
-      {
-         return refs;
-      }
-      
-      Sender(Queue queue, long testTime)
-      {
-         this.testTime = testTime;
-         
-         this.queue = queue;
-      }
-      
-      public void run()
-      {
-         long start = System.currentTimeMillis();
-         
-         while (System.currentTimeMillis() - start < testTime)
-         {
-            ServerMessage message = generateMessage(i);
-            
-            MessageReference ref = message.createReference(queue);
-            
-            queue.addLast(ref);
-            
-            refs.add(ref);
-            
-            i++;
-         }
-      }
-   }
-   
-   class Toggler extends Thread
-   {
-      private volatile Exception e;
-      
-      private Queue queue;
-      
-      private FakeConsumer consumer;
-      
-      private long testTime;
-      
-      private boolean toggle;
-      
-      private volatile int numToggles;
-      
-      public int getNumToggles()
-      {
-         return numToggles;
-      }
-      
-      public Exception getException()
-      {
-         return e;
-      }
-      
-      Toggler(Queue queue, FakeConsumer consumer, long testTime)
-      {
-         this.testTime = testTime;
-         
-         this.queue = queue;
-         
-         this.consumer = consumer;
-      }
-      
-      public void run()
-      {
-         long start = System.currentTimeMillis();
-         
-         while (System.currentTimeMillis() - start < testTime)
-         {
-            if (toggle)
-            {
-               consumer.setStatusImmediate(HandleStatus.BUSY);              
-            }
-            else
-            {
-               consumer.setStatusImmediate(HandleStatus.HANDLED);
-               
-               queue.deliver();
-            }
-            toggle = !toggle;
-            
-            numToggles++;
-         }
-      }
-   }
-      
-}
-
-
-




More information about the jboss-cvs-commits mailing list