pm.removeReferences(channel1.getChannelID(), refs);
pm.removeDepagedReferences(channel1.getChannelID(), refs);
   protected void addRemoveGetReferences(boolean batch) throws Throwable   {      doSetup(false, 100);            Channel channel1 = new SimpleChannel(0, ms);            Channel channel2 = new SimpleChannel(1, 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]);            MessageReference ref11 = ms.reference(m[0]);      MessageReference ref12 = ms.reference(m[1]);      MessageReference ref13 = ms.reference(m[2]);      MessageReference ref14 = ms.reference(m[3]);      MessageReference ref15 = ms.reference(m[4]);            List refs = new ArrayList();      refs.add(ref1);      refs.add(ref2);      refs.add(ref3);      refs.add(ref4);      refs.add(ref5);      refs.add(ref6);      refs.add(ref7);      refs.add(ref8);      refs.add(ref9);      refs.add(ref10);            pm.addReferences(channel1.getChannelID(), refs, false);            refs = new ArrayList();      refs.add(ref11);      refs.add(ref12);      refs.add(ref13);      refs.add(ref14);      refs.add(ref15);          pm.addReferences(channel2.getChannelID(), refs, false);                        List refIds = getReferenceIds(channel1.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())));            refIds = getReferenceIds(channel2.getChannelID());      assertNotNull(refIds);      assertEquals(5, refIds.size());      assertTrue(refIds.contains(new Long(ref11.getMessageID())));      assertTrue(refIds.contains(new Long(ref12.getMessageID())));      assertTrue(refIds.contains(new Long(ref13.getMessageID())));      assertTrue(refIds.contains(new Long(ref14.getMessageID())));      assertTrue(refIds.contains(new Long(ref15.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())));            List msgIds = new ArrayList();      msgIds.add(new Long(ref3.getMessageID()));      msgIds.add(new Long(ref4.getMessageID()));      msgIds.add(new Long(ref7.getMessageID()));      msgIds.add(new Long(ref9.getMessageID()));      msgIds.add(new Long(ref1.getMessageID()));            List ms = pm.getMessages(msgIds);      assertNotNull(ms);      assertEquals(5, ms.size());      assertTrue(containsMessage(ms, ref3.getMessageID()));      assertTrue(containsMessage(ms, ref4.getMessageID()));      assertTrue(containsMessage(ms, ref7.getMessageID()));      assertTrue(containsMessage(ms, ref9.getMessageID()));      assertTrue(containsMessage(ms, ref1.getMessageID()));            refs = new ArrayList();      refs.add(ref12);      refs.add(ref13);      refs.add(ref14);      refs.add(ref15);      pm.removeReferences(channel2.getChannelID(), refs);            refIds = getReferenceIds(channel2.getChannelID());      assertNotNull(refIds);      assertEquals(1, refIds.size());      assertTrue(refIds.contains(new Long(ref11.getMessageID())));            ms = getMessageIds();      assertNotNull(ms);      assertEquals(10, ms.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())));                 refs = new ArrayList();      refs.add(ref1);      refs.add(ref2);      refs.add(ref3);      pm.removeReferences(channel1.getChannelID(), refs);            refIds = getReferenceIds(channel1.getChannelID());      assertNotNull(refIds);      assertEquals(7, refIds.size());      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())));                 ms = getMessageIds();              assertNotNull(ms);      assertEquals(8, ms.size());            assertTrue(msgs.contains(new Long(ref1.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())));            refs = new ArrayList();      refs.add(ref11);      pm.removeReferences(channel2.getChannelID(), refs);            refs = new ArrayList();      refs.add(ref4);      refs.add(ref5);      refs.add(ref6);      refs.add(ref7);      refs.add(ref8);      refs.add(ref9);      refs.add(ref10);      pm.removeReferences(channel1.getChannelID(), refs);            ms = getMessageIds();      assertNotNull(ms);      assertEquals(0, ms.size());   }