Add a test for the unsettled sate as well, and some logs.

This commit is contained in:
Timothy Bish 2015-04-14 12:33:05 -04:00
parent b3bf8e74f2
commit cb370d06e9
1 changed files with 38 additions and 1 deletions

View File

@ -95,6 +95,39 @@ public class AmqpSenderTest extends AmqpClientTestSupport {
connection.close();
}
@Test(timeout = 60000)
public void testUnsettledSender() throws Exception {
final int MSG_COUNT = 1000;
AmqpClient client = createAmqpClient();
AmqpConnection connection = client.connect();
AmqpSession session = connection.createSession();
AmqpSender sender = session.createSender("topic://" + getTestName(), false);
for (int i = 1; i <= MSG_COUNT; ++i) {
AmqpMessage message = new AmqpMessage();
message.setText("Test-Message: " + i);
sender.send(message);
if (i % 1000 == 0) {
LOG.info("Sent message: {}", i);
}
}
final TopicViewMBean topic = getProxyToTopic(getTestName());
assertTrue("All messages should arrive", Wait.waitFor(new Wait.Condition() {
@Override
public boolean isSatisified() throws Exception {
return topic.getEnqueueCount() == MSG_COUNT;
}
}));
sender.close();
connection.close();
}
@Test(timeout = 60000)
public void testPresettledSender() throws Exception {
final int MSG_COUNT = 1000;
@ -105,10 +138,14 @@ public class AmqpSenderTest extends AmqpClientTestSupport {
AmqpSender sender = session.createSender("topic://" + getTestName(), true);
for (int i = 0; i < MSG_COUNT; ++i) {
for (int i = 1; i <= MSG_COUNT; ++i) {
AmqpMessage message = new AmqpMessage();
message.setText("Test-Message: " + i);
sender.send(message);
if (i % 1000 == 0) {
LOG.info("Sent message: {}", i);
}
}
final TopicViewMBean topic = getProxyToTopic(getTestName());