try
{
for(int i = 0; i < 10; i++)
pub.send(session.createTextMessage("Message nr " + i));
SimpleValue nondurable = (SimpleValue)component.getProperty("nonDurableSubscriptionsCount").getValue();
SimpleValue durable = (SimpleValue)component.getProperty("durableSubscriptionsCount").getValue();
SimpleValue all = (SimpleValue)component.getProperty("allSubscriptionsCount").getValue();
SimpleValue allMessageCount = (SimpleValue)component.getProperty("allMessageCount").getValue();
CollectionValue messageCounters = (CollectionValue) component.getProperty("messageCounters").getValue();
assertNotNull(messageCounters);
assertEquals(1, nondurable.getValue());
assertEquals(0, durable.getValue());
assertEquals(1, all.getValue());
assertEquals(10, allMessageCount.getValue());
CompositeValue messageCounter = (CompositeValue) messageCounters.iterator().next();
assertNotNull(messageCounter);
SimpleValue count = (SimpleValue) messageCounter.get("messageCount");
assertEquals(count, allMessageCount);
}
finally
{
pub.close();