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.getMessage().getMessageID())));
assertTrue(refIds.contains(new Long(ref2.getMessage().getMessageID())));
assertTrue(refIds.contains(new Long(ref3.getMessage().getMessageID())));
assertTrue(refIds.contains(new Long(ref4.getMessage().getMessageID())));
assertTrue(refIds.contains(new Long(ref5.getMessage().getMessageID())));
assertTrue(refIds.contains(new Long(ref6.getMessage().getMessageID())));
assertTrue(refIds.contains(new Long(ref7.getMessage().getMessageID())));
assertTrue(refIds.contains(new Long(ref8.getMessage().getMessageID())));
assertTrue(refIds.contains(new Long(ref9.getMessage().getMessageID())));
assertTrue(refIds.contains(new Long(ref10.getMessage().getMessageID())));
List msgs = getMessageIds();
assertNotNull(msgs);
assertEquals(10, msgs.size());
assertTrue(msgs.contains(new Long(ref1.getMessage().getMessageID())));
assertTrue(msgs.contains(new Long(ref2.getMessage().getMessageID())));
assertTrue(msgs.contains(new Long(ref3.getMessage().getMessageID())));
assertTrue(msgs.contains(new Long(ref4.getMessage().getMessageID())));
assertTrue(msgs.contains(new Long(ref5.getMessage().getMessageID())));
assertTrue(msgs.contains(new Long(ref6.getMessage().getMessageID())));
assertTrue(msgs.contains(new Long(ref7.getMessage().getMessageID())));
assertTrue(msgs.contains(new Long(ref8.getMessage().getMessageID())));
assertTrue(msgs.contains(new Long(ref9.getMessage().getMessageID())));
assertTrue(msgs.contains(new Long(ref10.getMessage().getMessageID())));
List msgIds = new ArrayList();
msgIds.add(new Long(ref3.getMessage().getMessageID()));
msgIds.add(new Long(ref4.getMessage().getMessageID()));
msgIds.add(new Long(ref7.getMessage().getMessageID()));