23132314231523162317231823192320232123222323
assertEquals(1, acknowledging.size()); Message ackm = (Message)acknowledging.get(0); assertEquals(0, ackm.getMessageID()); // non-transacted acknowledgment r.acknowledge(ackm, null); assertTrue(queue.browse().isEmpty()); } /**
23552356235723582359236023612362236323642365
assertEquals(1, messages.size()); Message ackm = (Message)messages.get(0); assertEquals(0, ackm.getMessageID()); // an extra acknowledgment should be discarded r.acknowledge(ackm, null); assertTrue(queue.browse().isEmpty()); }
23962397239823992400240124022403240424052406
assertEquals(0, ackm.getMessageID()); Transaction tx = tr.createTransaction(); // transacted acknowledgment r.acknowledge(ackm, tx); deliveringCount = queue.getDeliveringCount(); assertEquals(1, deliveringCount); tx.commit();
24452446244724482449245024512452245324542455
assertEquals(0, ackm.getMessageID()); Transaction tx = tr.createTransaction(); // transacted acknowledgment r.acknowledge(ackm, tx); deliveringCount = queue.getDeliveringCount(); assertEquals(1, deliveringCount); tx.rollback();
24562457245824592460246124622463246424652466
deliveringCount = queue.getDeliveringCount(); assertEquals(1, deliveringCount); // acknowledge non-transactionally r.acknowledge(ackm, null); assertTrue(queue.browse().isEmpty()); }
25012502250325042505250625072508250925102511
for(Iterator i = r.getMessages().iterator(); i.hasNext();) { Message ackm = (Message)i.next(); // non-transacted acknowledgment r.acknowledge(ackm, null); } assertTrue(queue.browse().isEmpty()); }
25452546254725482549255025512552255325542555
for(Iterator i = r.getMessages().iterator(); i.hasNext();) { Message ackm = (Message)i.next(); // transacted acknowledgment r.acknowledge(ackm, tx); } tx.commit(); assertTrue(queue.browse().isEmpty());
25912592259325942595259625972598259926002601
for(Iterator i = r.getMessages().iterator(); i.hasNext();) { Message ackm = (Message)i.next(); // transacted acknowledgment r.acknowledge(ackm, tx); } tx.rollback(); // acknowledge non-transactionally
26012602260326042605260626072608260926102611
// acknowledge non-transactionally for(Iterator i = r.getMessages().iterator(); i.hasNext();) { Message ackm = (Message)i.next(); // non-transacted acknowledgment r.acknowledge(ackm, null); } assertTrue(queue.browse().isEmpty()); }
26932694269526962697269826992700270127022703
assertEquals(1, received.size()); Message rm = (Message)received.iterator().next(); assertTrue(rm.isReliable()); assertEquals(0, rm.getMessageID()); r.acknowledge(rm, null); assertTrue(queue.browse().isEmpty()); }