assertEquals(0, counter.get());
}
public void testDeliveringCounterAll() throws Exception
{
DeliveringCounter counter = new DeliveringCounter(DeliveringCounter.LEVEL_ALL);
assertEquals(DeliveringCounter.LEVEL_ALL, counter.getLevel());
Message[] mids = new Message[1000];
Map<Long, Message> msgs = new HashMap<Long, Message>();
for (int i = 0; i < 1000; i++)
{
Message m = CoreMessageFactory.createCoreMessage(i);
msgs.put(m.getMessageID(), m);
counter.increment(m);
mids[i] = m;
}
assertEquals(1000, counter.get());
for (int i = 0; i < 49; i++) {
counter.decrement(mids[i]);
msgs.remove(mids[i].getMessageID());
}
assertEquals(951, counter.get());
assertEquals(951, counter.getMessages().size());
List inProcMsgs = counter.getMessages();
for (Object o : inProcMsgs)
{
Message msg = (Message)o;
msgs.remove(msg.getMessageID());
}
assertEquals(0, msgs.size());
counter.reset();
assertEquals(0, counter.get());
assertEquals(0, counter.getMessages().size());
}