setConfigurationProperty("statistics.generation.connections", "true");
}
public void testDeliveryAndReceiptStatistics() throws Exception
{
ManagedBroker vhost = _jmxUtils.getManagedBroker("test");
sendUsing(_test, 5, 200);
Thread.sleep(1000);
List<String> addresses = new ArrayList<String>();
for (ManagedConnection mc : _jmxUtils.getManagedConnections("test"))
{
assertEquals("Incorrect connection delivery total", 0, mc.getTotalMessagesDelivered());
assertEquals("Incorrect connection delivery data", 0, mc.getTotalDataDelivered());
assertEquals("Incorrect connection receipt total", 5, mc.getTotalMessagesReceived());
assertEquals("Incorrect connection receipt data", 1000, mc.getTotalDataReceived());
addresses.add(mc.getRemoteAddress());
}
assertEquals("Incorrect vhost delivery total", 0, vhost.getTotalMessagesDelivered());
assertEquals("Incorrect vhost delivery data", 0, vhost.getTotalDataDelivered());
assertEquals("Incorrect vhost receipt total", 5, vhost.getTotalMessagesReceived());
assertEquals("Incorrect vhost receipt data", 1000, vhost.getTotalDataReceived());
Connection test = new AMQConnection(_brokerUrl, USER, USER, "clientid", "test");
test.start();
receiveUsing(test, 5);
for (ManagedConnection mc : _jmxUtils.getManagedConnections("test"))
{
if (addresses.contains(mc.getRemoteAddress()))
{
assertEquals("Incorrect connection delivery total", 0, mc.getTotalMessagesDelivered());
assertEquals("Incorrect connection delivery data", 0, mc.getTotalDataDelivered());
assertEquals("Incorrect connection receipt total", 5, mc.getTotalMessagesReceived());
assertEquals("Incorrect connection receipt data", 1000, mc.getTotalDataReceived());
}
else
{
assertEquals("Incorrect connection delivery total", 5, mc.getTotalMessagesDelivered());
assertEquals("Incorrect connection delivery data", 1000, mc.getTotalDataDelivered());
assertEquals("Incorrect connection receipt total", 0, mc.getTotalMessagesReceived());
assertEquals("Incorrect connection receipt data", 0, mc.getTotalDataReceived());
}
}
assertEquals("Incorrect vhost delivery total", 5, vhost.getTotalMessagesDelivered());
assertEquals("Incorrect vhost delivery data", 1000, vhost.getTotalDataDelivered());
assertEquals("Incorrect vhost receipt total", 5, vhost.getTotalMessagesReceived());
assertEquals("Incorrect vhost receipt data", 1000, vhost.getTotalDataReceived());
test.close();
}