You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2012/05/02 12:18:30 UTC
svn commit: r1332977 - in
/activemq/trunk/activemq-core/src/test/java/org/apache/activemq:
bugs/AMQ2571Test.java usecases/DurableSubscriptionOfflineTest.java
Author: gtully
Date: Wed May 2 10:18:29 2012
New Revision: 1332977
URL: http://svn.apache.org/viewvc?rev=1332977&view=rev
Log:
ensure test is more deterministic and does not hang ci build
Modified:
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2571Test.java
activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOfflineTest.java
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2571Test.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2571Test.java?rev=1332977&r1=1332976&r2=1332977&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2571Test.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2571Test.java Wed May 2 10:18:29 2012
@@ -32,6 +32,7 @@ public class AMQ2571Test extends Embedde
public void testTempQueueClosing() {
try {
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(this.bindAddress);
+ connectionFactory.setAlwaysSyncSend(true);
// First create session that will own the TempQueue
Connection connectionA = connectionFactory.createConnection();
@@ -56,13 +57,13 @@ public class AMQ2571Test extends Embedde
Thread sendingThread = new Thread(new Runnable() {
public void run() {
try {
- for (int i = 0; i < 100000; i++) {
+ long end = System.currentTimeMillis() + 5*60*1000;
+ // wait for exception on send
+ while (System.currentTimeMillis() < end) {
producerB.send(message);
}
} catch (JMSException e) {
- // We don't get this exception every time.
- // Not getting it means that we don't know if the
- // creator of the TempQueue has disconnected.
+ e.printStackTrace();
}
}
});
@@ -72,7 +73,7 @@ public class AMQ2571Test extends Embedde
// Now close connection A. This will remove the TempQueue.
connectionA.close();
// Wait for the thread to finish.
- sendingThread.join();
+ sendingThread.join(5*60*1000);
// Sleep for a while to make sure that we should know that the
// TempQueue is gone.
@@ -95,6 +96,7 @@ public class AMQ2571Test extends Embedde
@Override
protected void setUp() throws Exception {
bindAddress = "vm://localhost";
+ setAutoFail(true);
super.setUp();
}
@@ -103,7 +105,6 @@ public class AMQ2571Test extends Embedde
BrokerService answer = new BrokerService();
answer.setPersistent(false);
answer.setUseJmx(false);
- answer.addConnector(bindAddress);
return answer;
}
}
\ No newline at end of file
Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOfflineTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOfflineTest.java?rev=1332977&r1=1332976&r2=1332977&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOfflineTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOfflineTest.java Wed May 2 10:18:29 2012
@@ -1610,7 +1610,7 @@ public class DurableSubscriptionOfflineT
}
executorService.shutdown();
executorService.awaitTermination(10, TimeUnit.MINUTES);
- assertTrue("No exceptions", exceptions.isEmpty());
+ assertTrue("No exceptions " + exceptions.elements(), exceptions.isEmpty());
}
public static class Listener implements MessageListener {
@@ -1649,6 +1649,7 @@ public class DurableSubscriptionOfflineT
}
}
catch (JMSException e) {
+ e.printStackTrace();
exceptions.add(e);
}
}