mirror of https://github.com/apache/activemq.git
Add a test for the unsettled sate as well, and some logs.
This commit is contained in:
parent
b3bf8e74f2
commit
cb370d06e9
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue