MessageReference ref1 = ms.reference(m[0]); MessageReference ref2 = ms.reference(m[1]); MessageReference ref3 = ms.reference(m[2]); MessageReference ref4 = ms.reference(m[3]); MessageReference ref5 = ms.reference(m[4]); MessageReference ref6 = ms.reference(m[5]); MessageReference ref7 = ms.reference(m[6]); MessageReference ref8 = ms.reference(m[7]); MessageReference ref9 = ms.reference(m[8]); MessageReference ref10 = ms.reference(m[9]);
Message m10 = this.createMessage((byte)10, true); Message m11 = this.createMessage((byte)11, true); Message m12 = this.createMessage((byte)12, true); Message m13 = this.createMessage((byte)13, true); Message m14 = this.createMessage((byte)14, true);  MessageReference ref1 = ms.reference(m0); ref1.setOrdering(0); MessageReference ref2 = ms.reference(m1); ref2.setOrdering(1); MessageReference ref3 = ms.reference(m2); ref3.setOrdering(2); MessageReference ref4 = ms.reference(m3); ref4.setOrdering(3); MessageReference ref5 = ms.reference(m4); ref5.setOrdering(4); MessageReference ref6 = ms.reference(m5); ref6.setOrdering(5); MessageReference ref7 = ms.reference(m6); ref7.setOrdering(6); MessageReference ref8 = ms.reference(m7); ref8.setOrdering(7); MessageReference ref9 = ms.reference(m8); ref9.setOrdering(8); MessageReference ref10 = ms.reference(m9); ref10.setOrdering(9);  MessageReference ref11 = ms.reference(m10); ref11.setOrdering(10); MessageReference ref12 = ms.reference(m11); ref12.setOrdering(11); MessageReference ref13 = ms.reference(m12); ref13.setOrdering(12); MessageReference ref14 = ms.reference(m13); ref14.setOrdering(13); MessageReference ref15 = ms.reference(m14); ref15.setOrdering(14);
   public void testGetNumberOfReferences() throws Exception   {      doSetup(false);            Channel channel = new SimpleChannel(0, ms);            Message[] m = createMessages(10);            MessageReference ref1 = ms.reference(m[0]);      MessageReference ref2 = ms.reference(m[1]);      MessageReference ref3 = ms.reference(m[2]);      MessageReference ref4 = ms.reference(m[3]);      MessageReference ref5 = ms.reference(m[4]);      MessageReference ref6 = ms.reference(m[5]);      MessageReference ref7 = ms.reference(m[6]);      MessageReference ref8 = ms.reference(m[7]);      MessageReference ref9 = ms.reference(m[8]);      MessageReference ref10 = ms.reference(m[9]);            pm.addReference(channel.getChannelID(), ref1, null);      pm.addReference(channel.getChannelID(), ref2, null);      pm.addReference(channel.getChannelID(), ref3, null);      pm.addReference(channel.getChannelID(), ref4, null);      pm.addReference(channel.getChannelID(), ref5, null);      pm.addReference(channel.getChannelID(), ref6, null);      pm.addReference(channel.getChannelID(), ref7, null);      pm.addReference(channel.getChannelID(), ref8, null);      pm.addReference(channel.getChannelID(), ref9, null);      pm.addReference(channel.getChannelID(), ref10, null);            List refIds = getReferenceIds(channel.getChannelID());      assertNotNull(refIds);      assertEquals(10, refIds.size());      assertTrue(refIds.contains(new Long(ref1.getMessageID())));      assertTrue(refIds.contains(new Long(ref2.getMessageID())));      assertTrue(refIds.contains(new Long(ref3.getMessageID())));      assertTrue(refIds.contains(new Long(ref4.getMessageID())));      assertTrue(refIds.contains(new Long(ref5.getMessageID())));      assertTrue(refIds.contains(new Long(ref6.getMessageID())));      assertTrue(refIds.contains(new Long(ref7.getMessageID())));      assertTrue(refIds.contains(new Long(ref8.getMessageID())));      assertTrue(refIds.contains(new Long(ref9.getMessageID())));      assertTrue(refIds.contains(new Long(ref10.getMessageID())));            List msgs = getMessageIds();      assertNotNull(msgs);      assertEquals(10, msgs.size());      assertTrue(msgs.contains(new Long(ref1.getMessageID())));      assertTrue(msgs.contains(new Long(ref2.getMessageID())));      assertTrue(msgs.contains(new Long(ref3.getMessageID())));      assertTrue(msgs.contains(new Long(ref4.getMessageID())));      assertTrue(msgs.contains(new Long(ref5.getMessageID())));      assertTrue(msgs.contains(new Long(ref6.getMessageID())));      assertTrue(msgs.contains(new Long(ref7.getMessageID())));      assertTrue(msgs.contains(new Long(ref8.getMessageID())));      assertTrue(msgs.contains(new Long(ref9.getMessageID())));      assertTrue(msgs.contains(new Long(ref10.getMessageID())));            int numberOfReferences = pm.getNumberOfReferences(channel.getChannelID());            assertEquals(10, numberOfReferences);            pm.removeReference(channel.getChannelID(), ref1, null);            numberOfReferences = pm.getNumberOfReferences(channel.getChannelID());            assertEquals(9, numberOfReferences);             pm.removeAllChannelData(channel.getChannelID());        }