You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2016/04/08 13:15:43 UTC

svn commit: r1738231 - /qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java

Author: kwall
Date: Fri Apr  8 11:15:43 2016
New Revision: 1738231

URL: http://svn.apache.org/viewvc?rev=1738231&view=rev
Log:
QPID-7156: [Java Broker] Fix racey test BrokerClosesClientConnectionTest#testClientCloseOnVirtualHostStop

Modified:
    qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java

Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java?rev=1738231&r1=1738230&r2=1738231&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java (original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/connection/BrokerClosesClientConnectionTest.java Fri Apr  8 11:15:43 2016
@@ -25,7 +25,6 @@ import java.util.Map;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
 
 import javax.jms.Connection;
 import javax.jms.ExceptionListener;
@@ -36,7 +35,8 @@ import javax.jms.MessageListener;
 import javax.jms.MessageProducer;
 import javax.jms.Queue;
 import javax.jms.Session;
-import javax.naming.NamingException;
+
+import com.google.common.util.concurrent.SettableFuture;
 
 import org.apache.qpid.AMQConnectionClosedException;
 import org.apache.qpid.AMQConnectionFailureException;
@@ -46,7 +46,6 @@ import org.apache.qpid.client.AMQSession
 import org.apache.qpid.client.BasicMessageConsumer;
 import org.apache.qpid.client.BasicMessageProducer;
 import org.apache.qpid.server.model.VirtualHost;
-import org.apache.qpid.systest.rest.Asserts;
 import org.apache.qpid.systest.rest.RestTestHelper;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 import org.apache.qpid.test.utils.TestBrokerConfiguration;
@@ -104,7 +103,7 @@ public class BrokerClosesClientConnectio
 
         final CountDownLatch connectionCreatorStarted = new CountDownLatch(1);
         final AtomicBoolean shutdown = new AtomicBoolean(false);
-        final AtomicReference<Exception> clientException = new AtomicReference<>();
+        final SettableFuture<Exception> clientException = SettableFuture.create();
         Thread connectionCreator = new Thread(new Runnable(){
 
             @Override
@@ -124,7 +123,7 @@ public class BrokerClosesClientConnectio
                     connectionCreatorStarted.countDown();
                 }
             }
-        });
+        }, getTestName() + "_ConnectionCreatingThread");
 
         try
         {
@@ -149,7 +148,7 @@ public class BrokerClosesClientConnectio
             }
             assertEquals("unexpected number of connections after virtual host stopped", 0, connectionCount);
 
-            assertConnectionCloseWasReported(clientException.get(), AMQConnectionFailureException.class);
+            assertConnectionCloseWasReported(clientException.get(20, TimeUnit.SECONDS), AMQConnectionFailureException.class);
         }
         finally
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org