// the channel has no receivers
assertFalse(queue.iterator().hasNext());
SimpleDeliveryObserver observer = new SimpleDeliveryObserver();
Transaction tx = tr.createTransaction();
MessageReference[] refs = new MessageReference[NUMBER_OF_MESSAGES * 2];
for(int i = 0; i < NUMBER_OF_MESSAGES; i++)
{
// send a mixture of reliable and non-reliable messages
refs[i] = createReference(i, false, "payload" + i);
// transacted send, reliable/non-reliable messages, multiple messages
// for a transactional send, handle() return value is unspecified
queue.handle(observer, refs[i], tx);
}
for(int i = 0; i < NUMBER_OF_MESSAGES; i++)
{
// send a mixture of reliable and non-reliable messages
refs[i + NUMBER_OF_MESSAGES] = createReference(i + NUMBER_OF_MESSAGES , true, "payload" + i);
// transacted send, reliable/non-reliable messages, multiple messages
// for a transactional send, handle() return value is unspecified
queue.handle(observer, refs[i + NUMBER_OF_MESSAGES], tx);
}
// no messages in the channel yet
assertEquals(0, queue.browse().size());
try
{
tx.commit();
fail("this should throw exception");
}
catch(Exception e)
{
// OK