Repository: activemq Updated Branches: refs/heads/master 604f707d4 -> d3ea5c4f9
https://issues.apache.org/jira/browse/AMQ-5621 Fixing LinkStealingTest by adding a wait because removeConnection may not have been called yet when checking if the removeException exists the first time Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/d3ea5c4f Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/d3ea5c4f Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/d3ea5c4f Branch: refs/heads/master Commit: d3ea5c4f9fbdbd69819a9a3977a844ea09b386f9 Parents: 604f707 Author: Christopher L. Shannon (cshannon) <[email protected]> Authored: Tue May 10 11:41:30 2016 +0000 Committer: Christopher L. Shannon (cshannon) <[email protected]> Committed: Tue May 10 11:44:17 2016 +0000 ---------------------------------------------------------------------- .../org/apache/activemq/broker/LinkStealingTest.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/d3ea5c4f/activemq-broker/src/test/java/org/apache/activemq/broker/LinkStealingTest.java ---------------------------------------------------------------------- diff --git a/activemq-broker/src/test/java/org/apache/activemq/broker/LinkStealingTest.java b/activemq-broker/src/test/java/org/apache/activemq/broker/LinkStealingTest.java index 2a2fb90..1e53f60 100644 --- a/activemq-broker/src/test/java/org/apache/activemq/broker/LinkStealingTest.java +++ b/activemq-broker/src/test/java/org/apache/activemq/broker/LinkStealingTest.java @@ -16,7 +16,7 @@ */ package org.apache.activemq.broker; -import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.util.concurrent.atomic.AtomicReference; @@ -26,6 +26,8 @@ import javax.jms.InvalidClientIDException; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.command.ConnectionInfo; +import org.apache.activemq.util.Wait; +import org.apache.activemq.util.Wait.Condition; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -110,7 +112,14 @@ public class LinkStealingTest { fail("Unexcpected exception causes test failure"); } - assertNotNull(removeException.get()); + //Need to wait because removeConnection might not be called yet + assertTrue(Wait.waitFor(new Condition() { + @Override + public boolean isSatisified() throws Exception { + return removeException.get() != null; + } + }, 5000, 100)); + LOG.info("removeException: {}", removeException.get().getMessage()); } }
