Queue queue1 = new Queue(1, ms, pm, true, true, 100, 20, 10, new QueuedExecutor(), null);  Queue queue2 = new Queue(2, ms, pm, true, true, 50, 10, 5, new QueuedExecutor(), null);
Queue queue1 = new Queue(1, ms, pm, true, true, 100, 20, 10, new QueuedExecutor());  Queue queue2 = new Queue(2, ms, pm, true, true, 50, 10, 5, new QueuedExecutor());
   public void test1() throws Throwable   {      Queue queue1 = new Queue(1, ms, pm, true, true, 100, 20, 10, new QueuedExecutor(), null);            Queue queue2 = new Queue(2, ms, pm, true, true, 50, 10, 5, new QueuedExecutor(), null);                                      Message[] msgs = new Message[150];            MessageReference[] refs1 = new MessageReference[150];            MessageReference[] refs2 = new MessageReference[150];            //Send 50 refs to both channels        for (int i = 0; i < 50; i++)      {         msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);                  refs1[i] = ms.reference(msgs[i]);                         queue1.handle(null, refs1[i], null);                   refs1[i].releaseMemoryReference();                  refs2[i] = ms.reference(msgs[i]);                  queue2.handle(null, refs2[i], null);                   refs2[i].releaseMemoryReference();      }            //Queue1      List refIds = getPagedReferenceIds(queue1.getChannelID());      assertEquals(0, refIds.size());            refIds = getReferenceIdsOrderedByOrd(queue1.getChannelID());      assertEquals(50, refIds.size());                                          assertEquals(50, queue1.memoryRefCount());            assertEquals(0, queue1.downCacheCount());            assertFalse(queue1.isPaging());                  assertEquals(0, queue1.memoryDeliveryCount());            //Queue2            refIds = getPagedReferenceIds(queue2.getChannelID());      assertEquals(0, refIds.size());            refIds = getReferenceIdsOrderedByOrd(queue2.getChannelID());      assertEquals(50, refIds.size());                                    assertEquals(50, queue2.memoryRefCount());            assertEquals(0, queue2.downCacheCount());            assertTrue(queue2.isPaging());                  assertEquals(0, queue2.memoryDeliveryCount());                  //Msgs            assertEquals(50, ms.size());            List msgIds = getMessageIds();      assertEquals(50, msgIds.size());             //Add 25 more            for (int i = 50; i < 75; i++)      {         msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);                  refs1[i] = ms.reference(msgs[i]);                         queue1.handle(null, refs1[i], null);                   refs1[i].releaseMemoryReference();                  refs2[i] = ms.reference(msgs[i]);                  queue2.handle(null, refs2[i], null);                   refs2[i].releaseMemoryReference();      }            //Queue1      refIds = getPagedReferenceIds(queue1.getChannelID());                    assertEquals(0, refIds.size());            refIds = getReferenceIdsOrderedByOrd(queue1.getChannelID());      assertEquals(75, refIds.size());                                          assertEquals(75, queue1.memoryRefCount());            assertEquals(0, queue1.downCacheCount());            assertFalse(queue1.isPaging());                  assertEquals(0, queue1.memoryDeliveryCount());            //Queue2            refIds = getPagedReferenceIds(queue2.getChannelID());      assertEquals(25, refIds.size());            refIds = getReferenceIdsOrderedByOrd(queue2.getChannelID());      assertEquals(75, refIds.size());                                    assertEquals(50, queue2.memoryRefCount());            assertEquals(0, queue2.downCacheCount());            assertTrue(queue2.isPaging());                  assertEquals(0, queue2.memoryDeliveryCount());                  //Msgs            assertEquals(75, ms.size());            msgIds = getMessageIds();      assertEquals(75, msgIds.size());                        // Add 25 more            for (int i = 75; i < 100; i++)      {         msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);                  refs1[i] = ms.reference(msgs[i]);                         queue1.handle(null, refs1[i], null);                   refs1[i].releaseMemoryReference();                  refs2[i] = ms.reference(msgs[i]);                  queue2.handle(null, refs2[i], null);                   refs2[i].releaseMemoryReference();      }            //Queue1      refIds = getPagedReferenceIds(queue1.getChannelID());                      assertEquals(0, refIds.size());            refIds = getReferenceIdsOrderedByOrd(queue1.getChannelID());      assertEquals(100, refIds.size());                                          assertEquals(100, queue1.memoryRefCount());            assertEquals(0, queue1.downCacheCount());            assertTrue(queue1.isPaging());                  assertEquals(0, queue1.memoryDeliveryCount());            //Queue2            refIds = getPagedReferenceIds(queue2.getChannelID());      assertEquals(50, refIds.size());            refIds = getReferenceIdsOrderedByOrd(queue2.getChannelID());      assertEquals(100, refIds.size());                                    assertEquals(50, queue2.memoryRefCount());            assertEquals(0, queue2.downCacheCount());            assertTrue(queue2.isPaging());                  assertEquals(0, queue2.memoryDeliveryCount());                  //Msgs            assertEquals(100, ms.size());            msgIds = getMessageIds();      assertEquals(100, msgIds.size());                  // Add 50 more            for (int i = 100; i < 150; i++)      {         msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);                  refs1[i] = ms.reference(msgs[i]);                         queue1.handle(null, refs1[i], null);                   refs1[i].releaseMemoryReference();                  refs2[i] = ms.reference(msgs[i]);                  queue2.handle(null, refs2[i], null);                   refs2[i].releaseMemoryReference();      }            //Queue1      refIds = getPagedReferenceIds(queue1.getChannelID());                      assertEquals(50, refIds.size());            refIds = getReferenceIdsOrderedByOrd(queue1.getChannelID());      assertEquals(150, refIds.size());                                          assertEquals(100, queue1.memoryRefCount());            assertEquals(0, queue1.downCacheCount());            assertTrue(queue1.isPaging());                  assertEquals(0, queue1.memoryDeliveryCount());            //Queue2            refIds = getPagedReferenceIds(queue2.getChannelID());      assertEquals(100, refIds.size());            refIds = getReferenceIdsOrderedByOrd(queue2.getChannelID());      assertEquals(150, refIds.size());                                    assertEquals(50, queue2.memoryRefCount());            assertEquals(0, queue2.downCacheCount());            assertTrue(queue2.isPaging());                  assertEquals(0, queue2.memoryDeliveryCount());                  //Msgs            assertEquals(100, ms.size());            msgIds = getMessageIds();      assertEquals(150, msgIds.size());            //    Remove 100 then cancel      this.cancelDeliveries(queue1, 100);            this.cancelDeliveries(queue2, 100);            //Now consume them all            this.consume(queue1, 0, refs1, 150);             this.consume(queue2, 0, refs2, 150);            //    Queue1      refIds = getReferenceIdsOrderedByOrd(queue1.getChannelID());                      assertEquals(0, refIds.size());                                          assertEquals(0, queue1.memoryRefCount());            assertEquals(0, queue1.downCacheCount());            assertFalse(queue1.isPaging());                  assertEquals(0, queue1.memoryDeliveryCount());            //Queue2            refIds = getReferenceIdsOrderedByOrd(queue2.getChannelID());      assertEquals(0, refIds.size());                                    assertEquals(0, queue2.memoryRefCount());            assertEquals(0, queue2.downCacheCount());            assertFalse(queue2.isPaging());                  assertEquals(0, queue2.memoryDeliveryCount());                  //Msgs            assertEquals(0, ms.size());            msgIds = getMessageIds();      assertEquals(0, msgIds.size());            //Should be none left            assertEquals(0, queue1.messageCount());            assertEquals(0, queue2.messageCount());            assertEquals(0, LockMap.instance.getSize());         }