use of org.apache.activemq.broker.region.DurableTopicSubscription in project activemq-artemis by apache.
the class DurableSubscriptionUnsubscribeTest method assertCount.
private void assertCount(int all, int active) throws Exception {
int inactive = all - active;
// broker check
Destination destination = broker.getDestination(topic);
List<Subscription> subs = destination.getConsumers();
int cActive = 0, cInactive = 0;
for (Subscription sub : subs) {
if (sub instanceof DurableTopicSubscription) {
DurableTopicSubscription durable = (DurableTopicSubscription) sub;
if (durable.isActive())
cActive++;
else
cInactive++;
}
}
assertEquals(active, cActive);
assertEquals(inactive, cInactive);
// admin view
ObjectName[] subscriptions = broker.getAdminView().getDurableTopicSubscribers();
assertEquals(active, subscriptions.length);
subscriptions = broker.getAdminView().getInactiveDurableTopicSubscribers();
assertEquals(inactive, subscriptions.length);
// check the strange false MBean
if (all == 0)
assertEquals(0, countMBean());
// check if we got all advisories
assertEquals(100, all + advisories.get());
}
Aggregations