You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2008/07/30 10:47:51 UTC

svn commit: r680941 - /incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/basic/SelectorTest.java

Author: ritchiem
Date: Wed Jul 30 01:47:49 2008
New Revision: 680941

URL: http://svn.apache.org/viewvc?rev=680941&view=rev
Log:
QPID-1000 : Made both changes as per JIRA notes

Modified:
    incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/basic/SelectorTest.java

Modified: incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/basic/SelectorTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/basic/SelectorTest.java?rev=680941&r1=680940&r2=680941&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/basic/SelectorTest.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/basic/SelectorTest.java Wed Jul 30 01:47:49 2008
@@ -27,6 +27,7 @@
 import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.client.BasicMessageProducer;
+import org.apache.qpid.client.state.StateWaiter;
 import org.apache.qpid.url.URLSyntaxException;
 
 import org.slf4j.Logger;
@@ -38,6 +39,7 @@
 import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.MessageListener;
+import java.util.concurrent.CountDownLatch;
 
 public class SelectorTest extends QpidTestCase implements MessageListener
 {
@@ -49,6 +51,7 @@
     private int count;
     public String _connectionString = "vm://:1";
     private static final String INVALID_SELECTOR = "Cost LIKE 5";
+    CountDownLatch _responseLatch = new CountDownLatch(1);
 
     protected void setUp() throws Exception
     {
@@ -81,7 +84,7 @@
         _session.createConsumer(destination, selector).setMessageListener(this);
     }
 
-    public synchronized void test() throws Exception
+    public void test() throws Exception
     {
         try
         {
@@ -98,7 +101,8 @@
 
             ((BasicMessageProducer) _session.createProducer(_destination)).send(msg, DeliveryMode.NON_PERSISTENT);
             _logger.info("Message sent, waiting for response...");
-            wait(1000);
+
+            _responseLatch.await();
 
             if (count > 0)
             {
@@ -255,11 +259,11 @@
         }
     }
 
-    public synchronized void onMessage(Message message)
+    public void onMessage(Message message)
     {
         count++;
         _logger.info("Got Message:" + message);
-        notify();
+        _responseLatch.countDown();
     }
 
     private static String randomize(String in)