You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2015/01/27 20:50:36 UTC
qpid-jms git commit: Clean up and enable to non-TX producer recovery
test.
Repository: qpid-jms
Updated Branches:
refs/heads/master 41a99b37c -> cfd603de9
Clean up and enable to non-TX producer recovery test.
Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/cfd603de
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/cfd603de
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/cfd603de
Branch: refs/heads/master
Commit: cfd603de9efd25bb300def4704f53e53d9513c0e
Parents: 41a99b3
Author: Timothy Bish <ta...@gmail.com>
Authored: Tue Jan 27 14:48:43 2015 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Tue Jan 27 14:48:43 2015 -0500
----------------------------------------------------------------------
.../qpid/jms/failover/JmsFailoverTest.java | 28 +++++++++++++-------
1 file changed, 18 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/cfd603de/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/failover/JmsFailoverTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/failover/JmsFailoverTest.java b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/failover/JmsFailoverTest.java
index 783c89a..dc9143e 100644
--- a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/failover/JmsFailoverTest.java
+++ b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/failover/JmsFailoverTest.java
@@ -39,7 +39,6 @@ import org.apache.activemq.broker.jmx.QueueViewMBean;
import org.apache.qpid.jms.JmsConnectionFactory;
import org.apache.qpid.jms.support.AmqpTestSupport;
import org.apache.qpid.jms.support.Wait;
-import org.junit.Ignore;
import org.junit.Test;
/**
@@ -231,21 +230,20 @@ public class JmsFailoverTest extends AmqpTestSupport {
assertFalse(failed.getCount() == 0);
}
- // TODO - FIXME
- @Ignore("Test currently not working")
@Test(timeout=90000)
- public void testProducerBlocksAndRecovers() throws Exception {
+ public void testNonTxProducerRecoversAfterFailover() throws Exception {
URI brokerURI = new URI("failover://("+ getBrokerAmqpConnectionURI() +")?maxReconnectDelay=1000");
- Connection connection = createAmqpConnection(brokerURI);
+ connection = createAmqpConnection(brokerURI);
connection.start();
- final int MSG_COUNT = 10;
+ final int MSG_COUNT = 20;
final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Queue queue = session.createQueue(name.getMethodName());
final MessageProducer producer = session.createProducer(queue);
producer.setDeliveryMode(DeliveryMode.PERSISTENT);
final CountDownLatch failed = new CountDownLatch(1);
+ final CountDownLatch sentSome = new CountDownLatch(3);
assertEquals(1, brokerService.getAdminView().getQueueProducers().length);
@@ -255,18 +253,22 @@ public class JmsFailoverTest extends AmqpTestSupport {
public void run() {
try {
for (int i = 0; i < MSG_COUNT; ++i) {
+ LOG.debug("Producer sening message #{}", i + 1);
producer.send(session.createTextMessage("Message: " + i));
- TimeUnit.SECONDS.sleep(1);
+ sentSome.countDown();
+ TimeUnit.MILLISECONDS.sleep(50);
}
} catch (Exception e) {
+ failed.countDown();
}
}
});
producerThread.start();
- TimeUnit.SECONDS.sleep(3);
+ // Wait until a couple messages get sent on first broker run.
+ assertTrue(sentSome.await(3, TimeUnit.SECONDS));
stopPrimaryBroker();
- TimeUnit.SECONDS.sleep(3);
+ TimeUnit.SECONDS.sleep(3); // Gives FailoverProvider some CPU time
restartPrimaryBroker();
assertTrue("Should have a new connection.", Wait.waitFor(new Wait.Condition() {
@@ -277,7 +279,13 @@ public class JmsFailoverTest extends AmqpTestSupport {
}
}));
- assertEquals(1, brokerService.getAdminView().getQueueProducers().length);
+ assertTrue("Should have a recovered producer.", Wait.waitFor(new Wait.Condition() {
+
+ @Override
+ public boolean isSatisified() throws Exception {
+ return brokerService.getAdminView().getQueueProducers().length == 1;
+ }
+ }));
final QueueViewMBean proxy = getProxyToQueue(name.getMethodName());
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org