[jboss-cvs] JBoss Messaging SVN: r7068 - in trunk/tests/src/org/jboss/messaging/tests/unit/core: server/impl and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed May 27 08:43:12 EDT 2009
Author: timfox
Date: 2009-05-27 08:43:11 -0400 (Wed, 27 May 2009)
New Revision: 7068
Removed:
trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/PostOfficeImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/PostOfficeImplWildcardManagerTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/SimpleAddressManagerTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/WildcardAddressManagerTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/MessageReferenceImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/QueueFactoryImplTest.java
Modified:
trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/QueueImplTest.java
Log:
removed dead tests and cleaned up a bit
Deleted: trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/PostOfficeImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/PostOfficeImplTest.java 2009-05-27 12:05:59 UTC (rev 7067)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/PostOfficeImplTest.java 2009-05-27 12:43:11 UTC (rev 7068)
@@ -1,1649 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2005-2008, Red Hat
- * Middleware LLC, and individual contributors by the @authors tag. See the
- * copyright.txt in the distribution for a full listing of individual
- * contributors.
- *
- * This is free software; you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This software is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this software; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
- * site: http://www.fsf.org.
- */
-
-package org.jboss.messaging.tests.unit.core.postoffice.impl;
-
-import java.util.List;
-
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
-import org.jboss.messaging.core.postoffice.Binding;
-import org.jboss.messaging.core.server.QueueFactory;
-import org.jboss.messaging.tests.unit.core.server.impl.fakes.FakeQueueFactory;
-import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.utils.SimpleString;
-
-/*
- * A PostOfficeTest
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
- */
-public class PostOfficeImplTest extends UnitTestCase
-{
- private final QueueFactory queueFactory = new FakeQueueFactory();
-
- protected boolean wildCardRoutingEnabled;
-//
-// public void testPostOfficeStart() throws Exception
-// {
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// EasyMock.replay(pm, qf);
-// postOffice.start();
-// EasyMock.verify(pm, qf);
-// assertTrue(postOffice.isStarted());
-// }
-//
-// public void testPostOfficeStartAndStop() throws Exception
-// {
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// EasyMock.replay(pm, qf);
-// postOffice.start();
-// postOffice.stop();
-// EasyMock.verify(pm, qf);
-// assertFalse(postOffice.isStarted());
-// }
-//
-// public void testPostOfficeStartedAndBindingLoaded() throws Exception
-// {
-// Binding binding = EasyMock.createStrictMock(Binding.class);
-// ArrayList<Binding> bindingArrayList = new ArrayList<Binding>();
-// bindingArrayList.add(binding);
-//
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-//
-// SimpleString address1 = new SimpleString("testAddress1");
-// EasyMock.expect(binding.getAddress()).andStubReturn(address1);
-// EasyMock.expect(binding.getQueue()).andStubReturn(queue);
-// SimpleString queueName = new SimpleString("testQueueName1");
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(queue.getPersistenceID()).andStubReturn(1);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-//
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-// EasyMock.expect(pgm.isGlobalPageMode()).andStubReturn(true);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// EasyMock.expectLastCall().andAnswer(new LoadBindingsIAnswer(bindingArrayList, null));
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-//
-// EasyMock.replay(pm, pgm, qf, binding, queue);
-//
-// postOffice.start();
-//
-// EasyMock.verify(pm, pgm, qf, binding, queue);
-//
-// assertTrue(postOffice.isStarted());
-// assertEquals(postOffice.getBinding(queueName), binding);
-// assertEquals(postOffice.getBindingsForAddress(address1).size(), 1);
-// }
-//
-// public void testPostOfficeStartedAndBindingsLoadedDifferentAddress() throws Exception
-// {
-// ArrayList<Binding> bindingArrayList = new ArrayList<Binding>();
-//
-// Binding[] bindings = new Binding[100];
-// Queue[] queues = new Queue[100];
-// SimpleString[] addresses = new SimpleString[100];
-// SimpleString[] queueNames = new SimpleString[100];
-// for (int i = 0; i < 100; i++)
-// {
-// bindings[i] = EasyMock.createStrictMock(Binding.class);
-// bindingArrayList.add(bindings[i]);
-// queues[i] = EasyMock.createStrictMock(Queue.class);
-// addresses[i] = new SimpleString("testAddress" + i);
-// queueNames[i] = new SimpleString("testQueueName" + i);
-// EasyMock.expect(bindings[i].getAddress()).andStubReturn(addresses[i]);
-// EasyMock.expect(bindings[i].getQueue()).andStubReturn(queues[i]);
-// EasyMock.expect(queues[i].getName()).andStubReturn(queueNames[i]);
-// EasyMock.expect(queues[i].getPersistenceID()).andStubReturn(i + 1);
-// EasyMock.replay(bindings[i], queues[i]);
-// }
-//
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-// EasyMock.expect(pgm.isGlobalPageMode()).andStubReturn(true);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// EasyMock.expectLastCall().andAnswer(new LoadBindingsIAnswer(bindingArrayList, null));
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-//
-// EasyMock.replay(pm, pgm, qf);
-//
-// postOffice.start();
-//
-// EasyMock.verify(pm, pgm, qf);
-//
-// assertTrue(postOffice.isStarted());
-// for (int i = 0; i < 100; i++)
-// {
-// assertEquals(postOffice.getBinding(queueNames[i]), bindings[i]);
-// assertEquals(postOffice.getBindingsForAddress(addresses[i]).size(), 1);
-// }
-// }
-//
-// public void testPostOfficeStartedAndTwoBindingSameLoadedThrowsException() throws Exception
-// {
-// Binding binding = EasyMock.createStrictMock(Binding.class);
-// Binding binding2 = EasyMock.createStrictMock(Binding.class);
-// ArrayList<Binding> bindingArrayList = new ArrayList<Binding>();
-// bindingArrayList.add(binding);
-// bindingArrayList.add(binding2);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-//
-// SimpleString address1 = new SimpleString("testAddress1");
-// EasyMock.expect(binding.getAddress()).andStubReturn(address1);
-// EasyMock.expect(binding.getQueue()).andStubReturn(queue);
-// EasyMock.expect(binding2.getAddress()).andStubReturn(address1);
-// EasyMock.expect(binding2.getQueue()).andStubReturn(queue);
-// SimpleString queueName = new SimpleString("testQueueName1");
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(queue.getPersistenceID()).andStubReturn(1);
-//
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// EasyMock.expectLastCall().andAnswer(new LoadBindingsIAnswer(bindingArrayList, null));
-//
-// EasyMock.replay(pm, pgm, qf, binding, binding2, queue);
-//
-// try
-// {
-// postOffice.start();
-// fail("IllegalStateException");
-// }
-// catch (IllegalStateException e)
-// {
-// }
-//
-// EasyMock.verify(pm, pgm, qf, binding, binding2, queue);
-//
-// assertFalse(postOffice.isStarted());
-// }
-//
-// public void testPostOfficeStartedAndBindingsLoadedSameAddress() throws Exception
-// {
-// ArrayList<Binding> bindingArrayList = new ArrayList<Binding>();
-//
-// Binding[] bindings = new Binding[1000];
-// Queue[] queues = new Queue[1000];
-// SimpleString address = new SimpleString("testAddress");
-// SimpleString[] queueNames = new SimpleString[1000];
-// for (int i = 0; i < 1000; i++)
-// {
-// bindings[i] = EasyMock.createStrictMock(Binding.class);
-// bindingArrayList.add(bindings[i]);
-// queues[i] = EasyMock.createStrictMock(Queue.class);
-// queueNames[i] = new SimpleString("testQueueName" + i);
-// EasyMock.expect(bindings[i].getAddress()).andStubReturn(address);
-// EasyMock.expect(bindings[i].getQueue()).andStubReturn(queues[i]);
-// EasyMock.expect(queues[i].getName()).andStubReturn(queueNames[i]);
-// EasyMock.expect(queues[i].getPersistenceID()).andStubReturn(i + 1);
-// EasyMock.replay(bindings[i], queues[i]);
-// }
-//
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-//
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-// EasyMock.expect(pgm.isGlobalPageMode()).andStubReturn(true);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// EasyMock.expectLastCall().andAnswer(new LoadBindingsIAnswer(bindingArrayList, null));
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-//
-// EasyMock.replay(pm, pgm, qf);
-//
-// postOffice.start();
-//
-// EasyMock.verify(pm, pgm, qf);
-//
-// assertTrue(postOffice.isStarted());
-// for (int i = 0; i < 1000; i++)
-// {
-// assertEquals(postOffice.getBinding(queueNames[i]), bindings[i]);
-// assertEquals(postOffice.getBindingsForAddress(address).size(), 1000);
-// }
-// }
-//
-// public void testPostOfficeStartedAndBindingLoadedAndDestination() throws Exception
-// {
-// Binding binding = EasyMock.createStrictMock(Binding.class);
-// ArrayList<Binding> bindingArrayList = new ArrayList<Binding>();
-// bindingArrayList.add(binding);
-// List<SimpleString> dests = new ArrayList<SimpleString>();
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-//
-// SimpleString address1 = new SimpleString("testAddress1");
-// dests.add(address1);
-// EasyMock.expect(binding.getAddress()).andStubReturn(address1);
-// EasyMock.expect(binding.getQueue()).andStubReturn(queue);
-// SimpleString queueName = new SimpleString("testQueueName1");
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(queue.getPersistenceID()).andStubReturn(1);
-//
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-// PagingStore store = EasyMock.createNiceMock(PagingStore.class);
-// EasyMock.expect(pgm.getPageStore(address1)).andStubReturn(store);
-// EasyMock.expect(pgm.createPageStore(address1)).andStubReturn(store);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// EasyMock.expectLastCall().andAnswer(new LoadBindingsIAnswer(bindingArrayList, dests));
-// EasyMock.expect(pm.addDestination(address1)).andReturn(true);
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-//
-// EasyMock.expect(pgm.isGlobalPageMode()).andStubReturn(false);
-//
-// EasyMock.replay(pm, qf, binding, queue, pgm, store);
-//
-// postOffice.start();
-//
-// EasyMock.verify(pm, qf, binding, queue, pgm, store);
-//
-// assertTrue(postOffice.isStarted());
-// assertEquals(postOffice.getBinding(queueName), binding);
-// assertEquals(postOffice.getBindingsForAddress(address1).size(), 1);
-// assertTrue(postOffice.containsDestination(address1));
-// }
-//
-// public void testPostOfficeStartedAndBindingLoadedAndDestinations() throws Exception
-// {
-//
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-//
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PagingStore pgstore = EasyMock.createNiceMock(PagingStore.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// ArrayList<Binding> bindingArrayList = new ArrayList<Binding>();
-// List<SimpleString> dests = new ArrayList<SimpleString>();
-// Binding[] bindings = new Binding[100];
-// Queue[] queues = new Queue[100];
-// SimpleString[] addresses = new SimpleString[100];
-// SimpleString[] queueNames = new SimpleString[100];
-// for (int i = 0; i < 100; i++)
-// {
-// bindings[i] = EasyMock.createStrictMock(Binding.class);
-// bindingArrayList.add(bindings[i]);
-// queues[i] = EasyMock.createStrictMock(Queue.class);
-// addresses[i] = new SimpleString("testAddress" + i);
-// queueNames[i] = new SimpleString("testQueueName" + i);
-//
-// EasyMock.expect(pgm.getPageStore(addresses[i])).andStubReturn(pgstore);
-//
-// EasyMock.expect(pgm.createPageStore(addresses[i])).andStubReturn(pgstore);
-//
-// EasyMock.expect(bindings[i].getAddress()).andStubReturn(addresses[i]);
-// EasyMock.expect(bindings[i].getQueue()).andStubReturn(queues[i]);
-// EasyMock.expect(queues[i].getName()).andStubReturn(queueNames[i]);
-// EasyMock.expect(queues[i].getPersistenceID()).andStubReturn(i + 1);
-// EasyMock.replay(bindings[i], queues[i]);
-// dests.add(addresses[i]);
-// }
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// EasyMock.expectLastCall().andAnswer(new LoadBindingsIAnswer(bindingArrayList, dests));
-// for (int i = 0; i < 100; i++)
-// {
-// EasyMock.expect(pm.addDestination(addresses[i])).andReturn(true);
-// }
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-//
-// EasyMock.replay(pm, qf, pgm, pgstore);
-//
-// postOffice.start();
-//
-// EasyMock.verify(pm, qf, pgm, pgstore);
-//
-// assertTrue(postOffice.isStarted());
-// for (int i = 0; i < 100; i++)
-// {
-// assertEquals(postOffice.getBinding(queueNames[i]), bindings[i]);
-// assertEquals(postOffice.getBindingsForAddress(addresses[i]).size(), 1);
-// assertTrue(postOffice.containsDestination(addresses[i]));
-// }
-// }
-//
-// public void testPostOfficeStartedAndStoppedAndBindingLoadedAndDestinations() throws Exception
-// {
-//
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-// PagingStore pgstore = EasyMock.createNiceMock(PagingStore.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// ArrayList<Binding> bindingArrayList = new ArrayList<Binding>();
-// List<SimpleString> dests = new ArrayList<SimpleString>();
-// Binding[] bindings = new Binding[100];
-// Queue[] queues = new Queue[100];
-// SimpleString[] addresses = new SimpleString[100];
-// SimpleString[] queueNames = new SimpleString[100];
-// for (int i = 0; i < 100; i++)
-// {
-// bindings[i] = EasyMock.createStrictMock(Binding.class);
-// bindingArrayList.add(bindings[i]);
-// queues[i] = EasyMock.createStrictMock(Queue.class);
-// addresses[i] = new SimpleString("testAddress" + i);
-// queueNames[i] = new SimpleString("testQueueName" + i);
-// EasyMock.expect(pgm.createPageStore(addresses[i])).andStubReturn(pgstore);
-// EasyMock.expect(pgm.getPageStore(addresses[i])).andStubReturn(pgstore);
-// EasyMock.expect(bindings[i].getAddress()).andStubReturn(addresses[i]);
-// EasyMock.expect(bindings[i].getQueue()).andStubReturn(queues[i]);
-// EasyMock.expect(queues[i].getName()).andStubReturn(queueNames[i]);
-// EasyMock.expect(queues[i].getPersistenceID()).andStubReturn(i + 1);
-// EasyMock.replay(bindings[i], queues[i]);
-// dests.add(addresses[i]);
-// }
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// EasyMock.expectLastCall().andAnswer(new LoadBindingsIAnswer(bindingArrayList, dests));
-// for (int i = 0; i < 100; i++)
-// {
-// EasyMock.expect(pm.addDestination(addresses[i])).andReturn(true);
-// }
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-//
-// EasyMock.replay(pm, qf, pgm, pgstore);
-//
-// postOffice.start();
-// postOffice.stop();
-// EasyMock.verify(pm, qf, pgm, pgstore);
-//
-// assertFalse(postOffice.isStarted());
-// for (int i = 0; i < 100; i++)
-// {
-// assertNull(postOffice.getBinding(queueNames[i]));
-// assertEquals(postOffice.getBindingsForAddress(addresses[i]).size(), 0);
-// assertFalse(postOffice.containsDestination(addresses[i]));
-// }
-// }
-//
-// public void testPostOfficeFlowControllersCreateds() throws Exception
-// {
-//
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-// PagingStore pgstore = EasyMock.createNiceMock(PagingStore.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// ArrayList<Binding> bindingArrayList = new ArrayList<Binding>();
-// List<SimpleString> dests = new ArrayList<SimpleString>();
-// Binding[] bindings = new Binding[100];
-// Queue[] queues = new Queue[100];
-// SimpleString[] addresses = new SimpleString[100];
-// SimpleString[] queueNames = new SimpleString[100];
-// for (int i = 0; i < 100; i++)
-// {
-// bindings[i] = EasyMock.createStrictMock(Binding.class);
-// bindingArrayList.add(bindings[i]);
-// queues[i] = EasyMock.createStrictMock(Queue.class);
-// addresses[i] = new SimpleString("testAddress" + i);
-// queueNames[i] = new SimpleString("testQueueName" + i);
-//
-// EasyMock.expect(pgm.getPageStore(addresses[i])).andStubReturn(pgstore);
-// EasyMock.expect(pgm.createPageStore(addresses[i])).andStubReturn(pgstore);
-//
-// EasyMock.expect(bindings[i].getAddress()).andStubReturn(addresses[i]);
-// EasyMock.expect(bindings[i].getQueue()).andStubReturn(queues[i]);
-// EasyMock.expect(queues[i].getName()).andStubReturn(queueNames[i]);
-// EasyMock.expect(queues[i].getPersistenceID()).andStubReturn(i + 1);
-// EasyMock.replay(bindings[i], queues[i]);
-// dests.add(addresses[i]);
-// }
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// EasyMock.expectLastCall().andAnswer(new LoadBindingsIAnswer(bindingArrayList, dests));
-// for (int i = 0; i < 100; i++)
-// {
-// EasyMock.expect(pm.addDestination(addresses[i])).andReturn(true);
-// }
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-//
-// EasyMock.replay(pm, qf, pgm, pgstore);
-//
-// postOffice.start();
-//
-// EasyMock.verify(pm, qf, pgm, pgstore);
-//
-// assertTrue(postOffice.isStarted());
-// }
-//
-// public void testListDestinations() throws Exception
-// {
-//
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-// PagingStore pgstore = EasyMock.createNiceMock(PagingStore.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// ArrayList<Binding> bindingArrayList = new ArrayList<Binding>();
-// List<SimpleString> dests = new ArrayList<SimpleString>();
-// Binding[] bindings = new Binding[100];
-// Queue[] queues = new Queue[100];
-// SimpleString[] addresses = new SimpleString[100];
-// SimpleString[] queueNames = new SimpleString[100];
-// for (int i = 0; i < 100; i++)
-// {
-// bindings[i] = EasyMock.createStrictMock(Binding.class);
-// bindingArrayList.add(bindings[i]);
-// queues[i] = EasyMock.createStrictMock(Queue.class);
-// addresses[i] = new SimpleString("testAddress" + i);
-// queueNames[i] = new SimpleString("testQueueName" + i);
-//
-// EasyMock.expect(pgm.createPageStore(addresses[i])).andStubReturn(pgstore);
-// EasyMock.expect(pgm.getPageStore(addresses[i])).andStubReturn(pgstore);
-//
-// EasyMock.expect(bindings[i].getAddress()).andStubReturn(addresses[i]);
-// EasyMock.expect(bindings[i].getQueue()).andStubReturn(queues[i]);
-// EasyMock.expect(queues[i].getName()).andStubReturn(queueNames[i]);
-// EasyMock.expect(queues[i].getPersistenceID()).andStubReturn(i + 1);
-// EasyMock.replay(bindings[i], queues[i]);
-// dests.add(addresses[i]);
-// }
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// EasyMock.expectLastCall().andAnswer(new LoadBindingsIAnswer(bindingArrayList, dests));
-// for (int i = 0; i < 100; i++)
-// {
-// EasyMock.expect(pm.addDestination(addresses[i])).andReturn(true);
-// }
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-//
-// EasyMock.replay(pm, qf, pgm, pgstore);
-//
-// postOffice.start();
-// Set<SimpleString> allDests = postOffice.listAllDestinations();
-// EasyMock.verify(pm, qf, pgm, pgstore);
-//
-// for (SimpleString dest : allDests)
-// {
-// assertTrue(dests.remove(dest));
-// }
-// assertTrue(dests.size() == 0);
-// }
-//
-// public void testAddQueue() throws Exception
-// {
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice po = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, false, null, wildCardRoutingEnabled, false, 0);
-//
-// final long id = 324;
-// final SimpleString name = new SimpleString("wibb22");
-// final Filter filter = EasyMock.createMock(Filter.class);
-// final boolean durable = true;
-//
-// Queue queue = queueFactory.createQueue(id, name, filter, durable, false);
-//
-// EasyMock.expect(qf.createQueue(-1, name, filter, durable, false)).andReturn(queue);
-//
-// final SimpleString condition = new SimpleString("queue.wibble");
-//
-// Binding expected = new BindingImpl(condition, queue, true);
-//
-// pm.addBinding(EasyMock.eq(expected));
-//
-// EasyMock.replay(qf, pm, filter);
-//
-// po.addBinding(condition, name, filter, durable, false, true);
-//
-// EasyMock.verify(qf, pm, filter);
-//
-// EasyMock.reset(qf, pm, filter);
-//
-// final boolean durable2 = false;
-//
-// queue = queueFactory.createQueue(id, name, filter, durable2, false);
-//
-// EasyMock.expect(qf.createQueue(-1, name, filter, durable2, false)).andReturn(queue);
-//
-// EasyMock.replay(qf, pm, filter);
-//
-// }
-//
-// public void testRemoveQueue() throws Exception
-// {
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice po = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, false, null, wildCardRoutingEnabled, false, 0);
-//
-// final long id = 324;
-// final SimpleString name = new SimpleString("wibb22");
-// final Filter filter = EasyMock.createMock(Filter.class);
-// final boolean durable = true;
-//
-// Queue queue = queueFactory.createQueue(id, name, filter, durable, false);
-//
-// EasyMock.expect(qf.createQueue(-1, name, filter, durable, false)).andReturn(queue);
-//
-// final SimpleString condition = new SimpleString("queue.wibble");
-//
-// Binding expected = new BindingImpl(condition, queue, true);
-//
-// pm.addBinding(EasyMock.eq(expected));
-//
-// pm.deleteBinding(EasyMock.eq(expected));
-//
-// EasyMock.replay(qf, pm, filter);
-//
-// po.addBinding(condition, name, filter, durable, false, true);
-//
-// po.removeBinding(name);
-//
-// EasyMock.verify(qf, pm, filter);
-//
-// EasyMock.reset(qf, pm, filter, pgm);
-//
-// final boolean durable2 = false;
-//
-// queue = queueFactory.createQueue(id, name, filter, durable2, false);
-//
-// EasyMock.expect(qf.createQueue(-1, name, filter, durable2, false)).andReturn(queue);
-//
-// EasyMock.expect(pgm.createPageStore((SimpleString)EasyMock.anyObject())).andStubReturn(null);
-//
-// EasyMock.replay(qf, pm, pgm, filter);
-//
-// po.addBinding(condition, name, filter, durable2, false, true);
-//
-// po.removeBinding(name);
-//
-// EasyMock.verify(qf, pm, pgm, filter);
-// }
-//
-// public void testAddRemoveMultipleWithDifferentConditions() throws Exception
-// {
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = new FakeQueueFactory();
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// EasyMock.expect(pgm.createPageStore(EasyMock.isA(SimpleString.class))).andStubReturn(null);
-// EasyMock.replay(pgm);
-//
-// PostOffice po = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, false, null, wildCardRoutingEnabled, false, 0);
-//
-// final SimpleString condition1 = new SimpleString("queue.wibble");
-//
-// SimpleString squeue1 = new SimpleString("queue1");
-// SimpleString squeue2 = new SimpleString("queue2");
-// SimpleString squeue3 = new SimpleString("queue3");
-// SimpleString squeue4 = new SimpleString("queue4");
-// SimpleString squeue5 = new SimpleString("queue5");
-// SimpleString squeue6 = new SimpleString("queue6");
-//
-// po.addBinding(condition1, squeue1, null, false, false, true);
-// Map<SimpleString, List<Binding>> mappings = po.getMappings();
-// assertEquals(1, mappings.size());
-//
-// po.addBinding(condition1, squeue2, null, false, false, true);
-// mappings = po.getMappings();
-// assertEquals(1, mappings.size());
-//
-// po.addBinding(condition1, squeue3, null, false, false, true);
-// mappings = po.getMappings();
-// assertEquals(1, mappings.size());
-//
-// List<Binding> bindings = mappings.get(condition1);
-// assertNotNull(bindings);
-// assertEquals(3, bindings.size());
-//
-// Binding binding1 = bindings.get(0);
-// Queue queue1 = binding1.getQueue();
-// assertEquals(squeue1, queue1.getName());
-//
-// Binding binding2 = bindings.get(1);
-// Queue queue2 = binding2.getQueue();
-// assertEquals(squeue2, queue2.getName());
-//
-// Binding binding3 = bindings.get(2);
-// Queue queue3 = binding3.getQueue();
-// assertEquals(squeue3, queue3.getName());
-//
-// final SimpleString condition2 = new SimpleString("queue.wibble2");
-//
-// po.addBinding(condition2, squeue4, null, false, false, true);
-// mappings = po.getMappings();
-// assertEquals(2, mappings.size());
-//
-// po.addBinding(condition2, squeue5, null, false, false, true);
-// mappings = po.getMappings();
-// assertEquals(2, mappings.size());
-//
-// final SimpleString condition3 = new SimpleString("topic.wibblexyz");
-//
-// po.addBinding(condition3, squeue6, null, false, false, true);
-// mappings = po.getMappings();
-// assertEquals(3, mappings.size());
-//
-// po.removeBinding(squeue6);
-// mappings = po.getMappings();
-// assertEquals(2, mappings.size());
-//
-// po.removeBinding(squeue4);
-// mappings = po.getMappings();
-// assertEquals(2, mappings.size());
-//
-// po.removeBinding(squeue5);
-// mappings = po.getMappings();
-// assertEquals(1, mappings.size());
-//
-// po.removeBinding(squeue1);
-// mappings = po.getMappings();
-// assertEquals(1, mappings.size());
-//
-// po.removeBinding(squeue2);
-// mappings = po.getMappings();
-// assertEquals(1, mappings.size());
-//
-// po.removeBinding(squeue3);
-// mappings = po.getMappings();
-// assertEquals(0, mappings.size());
-// }
-//
-// public void testPostOfficeAddDestination() throws Exception
-// {
-// SimpleString address = new SimpleString("testAddress");
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// EasyMock.expect(pm.addDestination(address)).andReturn(true);
-// EasyMock.replay(pm, qf);
-// postOffice.start();
-// assertTrue(postOffice.addDestination(address, true));
-// assertTrue(postOffice.containsDestination(address));
-// EasyMock.verify(pm, qf);
-// }
-//
-// public void testPostOfficeAddDestinations() throws Exception
-// {
-//
-// SimpleString address = new SimpleString("testAddress");
-// SimpleString address2 = new SimpleString("testAddress2");
-// SimpleString address3 = new SimpleString("testAddress3");
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-// EasyMock.expect(pgm.createPageStore(EasyMock.isA(SimpleString.class))).andStubReturn(null);
-// EasyMock.replay(pgm);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// EasyMock.expect(pm.addDestination(address)).andReturn(true);
-// EasyMock.expect(pm.addDestination(address2)).andReturn(true);
-// EasyMock.expect(pm.addDestination(address3)).andReturn(true);
-// EasyMock.replay(pm, qf);
-// postOffice.start();
-// assertTrue(postOffice.addDestination(address, true));
-// assertTrue(postOffice.addDestination(address2, true));
-// assertTrue(postOffice.addDestination(address3, true));
-// assertTrue(postOffice.containsDestination(address));
-// assertTrue(postOffice.containsDestination(address2));
-// assertTrue(postOffice.containsDestination(address3));
-// EasyMock.verify(pm, qf);
-// }
-//
-// public void testPostOfficeAddAndRemoveDestination() throws Exception
-// {
-//
-// SimpleString address = new SimpleString("testAddress");
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// EasyMock.expect(pm.addDestination(address)).andReturn(true);
-// EasyMock.expect(pm.deleteDestination(address)).andReturn(true);
-// EasyMock.replay(pm, qf);
-// postOffice.start();
-// assertTrue(postOffice.addDestination(address, true));
-// assertTrue(postOffice.containsDestination(address));
-// postOffice.removeDestination(address, true);
-// assertFalse(postOffice.containsDestination(address));
-// EasyMock.verify(pm, qf);
-// }
-//
-// public void testPostOfficeAddAndRemoveDestinations() throws Exception
-// {
-//
-// SimpleString address = new SimpleString("testAddress");
-// SimpleString address2 = new SimpleString("testAddress2");
-// SimpleString address3 = new SimpleString("testAddress3");
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// EasyMock.expect(pgm.createPageStore(EasyMock.isA(SimpleString.class))).andStubReturn(null);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// EasyMock.expect(pm.addDestination(address)).andReturn(true);
-// EasyMock.expect(pm.addDestination(address2)).andReturn(true);
-// EasyMock.expect(pm.addDestination(address3)).andReturn(true);
-// EasyMock.expect(pm.deleteDestination(address)).andReturn(true);
-// EasyMock.expect(pm.deleteDestination(address3)).andReturn(true);
-// EasyMock.replay(pm, pgm, qf);
-// postOffice.start();
-// assertTrue(postOffice.addDestination(address, true));
-// assertTrue(postOffice.addDestination(address2, true));
-// assertTrue(postOffice.addDestination(address3, true));
-// assertTrue(postOffice.containsDestination(address));
-// assertTrue(postOffice.containsDestination(address2));
-// assertTrue(postOffice.containsDestination(address3));
-// postOffice.removeDestination(address, true);
-// postOffice.removeDestination(address3, true);
-// assertFalse(postOffice.containsDestination(address));
-// assertTrue(postOffice.containsDestination(address2));
-// assertFalse(postOffice.containsDestination(address3));
-// EasyMock.verify(pm, qf);
-// }
-//
-// public void testAddDurableBinding() throws Exception
-// {
-// SimpleString queueName = new SimpleString("testQueueName");
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createMock(BindableFactory.class);
-// Filter filter = EasyMock.createStrictMock(Filter.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// EasyMock.expect(qf.createQueue(-1, queueName, filter, true, false)).andReturn(queue);
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// pm.addBinding((Binding)EasyMock.anyObject());
-// EasyMock.replay(pm, qf, queue);
-// postOffice.start();
-//
-// postOffice.addBinding(new SimpleString("testAddress"), queueName, filter, true, false, true);
-// assertNotNull(postOffice.getBinding(queueName));
-// EasyMock.verify(pm, qf, queue);
-// }
-//
-// public void testAddDurableBindings() throws Exception
-// {
-// SimpleString queueName = new SimpleString("testQueueName");
-// SimpleString queueName2 = new SimpleString("testQueueName2");
-// SimpleString queueName3 = new SimpleString("testQueueName3");
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// Filter filter = EasyMock.createStrictMock(Filter.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// Queue queue2 = EasyMock.createStrictMock(Queue.class);
-// Queue queue3 = EasyMock.createStrictMock(Queue.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// EasyMock.expect(qf.createQueue(-1, queueName, filter, true, false)).andReturn(queue);
-// EasyMock.expect(qf.createQueue(-1, queueName2, filter, true, false)).andReturn(queue2);
-// EasyMock.expect(qf.createQueue(-1, queueName3, filter, true, false)).andReturn(queue3);
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(queue2.getName()).andStubReturn(queueName2);
-// EasyMock.expect(queue3.getName()).andStubReturn(queueName3);
-// pm.addBinding((Binding)EasyMock.anyObject());
-// pm.addBinding((Binding)EasyMock.anyObject());
-// pm.addBinding((Binding)EasyMock.anyObject());
-//
-// EasyMock.expect(pgm.createPageStore((SimpleString)EasyMock.anyObject())).andStubReturn(null);
-//
-// EasyMock.replay(pgm, pm, qf, queue, queue2, queue3);
-// postOffice.start();
-//
-// postOffice.addBinding(new SimpleString("testAddress"), queueName, filter, true, false, true);
-// postOffice.addBinding(new SimpleString("testAddress2"), queueName2, filter, true, false, true);
-// postOffice.addBinding(new SimpleString("testAddress3"), queueName3, filter, true, false, true);
-// assertNotNull(postOffice.getBinding(queueName));
-// assertNotNull(postOffice.getBinding(queueName2));
-// assertNotNull(postOffice.getBinding(queueName3));
-// EasyMock.verify(pm, qf, queue, queue2, queue3);
-// }
-//
-// public void testAddNonDurableBinding() throws Exception
-// {
-// SimpleString queueName = new SimpleString("testQueueName");
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// Filter filter = EasyMock.createStrictMock(Filter.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// EasyMock.expect(qf.createQueue(-1, queueName, filter, false, false)).andReturn(queue);
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.replay(pm, qf, queue);
-// postOffice.start();
-//
-// postOffice.addBinding(new SimpleString("testAddress"), queueName, filter, false, false, true);
-// assertNotNull(postOffice.getBinding(queueName));
-// EasyMock.verify(pm, qf, queue);
-// }
-//
-// public void testAddNonDurableBindings() throws Exception
-// {
-// SimpleString queueName = new SimpleString("testQueueName");
-// SimpleString queueName2 = new SimpleString("testQueueName2");
-// SimpleString queueName3 = new SimpleString("testQueueName3");
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// Filter filter = EasyMock.createStrictMock(Filter.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// Queue queue2 = EasyMock.createStrictMock(Queue.class);
-// Queue queue3 = EasyMock.createStrictMock(Queue.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// EasyMock.expect(qf.createQueue(-1, queueName, filter, false, false)).andReturn(queue);
-// EasyMock.expect(qf.createQueue(-1, queueName2, filter, false, false)).andReturn(queue2);
-// EasyMock.expect(qf.createQueue(-1, queueName3, filter, false, false)).andReturn(queue3);
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(queue2.getName()).andStubReturn(queueName2);
-// EasyMock.expect(queue3.getName()).andStubReturn(queueName3);
-//
-// EasyMock.expect(pgm.createPageStore((SimpleString)EasyMock.anyObject())).andStubReturn(null);
-//
-// EasyMock.replay(pgm, pm, qf, queue, queue2, queue3);
-// postOffice.start();
-//
-// postOffice.addBinding(new SimpleString("testAddress"), queueName, filter, false, false, true);
-// postOffice.addBinding(new SimpleString("testAddress2"), queueName2, filter, false, false, true);
-// postOffice.addBinding(new SimpleString("testAddress3"), queueName3, filter, false, false, true);
-// assertNotNull(postOffice.getBinding(queueName));
-// assertNotNull(postOffice.getBinding(queueName2));
-// assertNotNull(postOffice.getBinding(queueName3));
-// EasyMock.verify(pm, qf, queue, queue2, queue3);
-// }
-//
-// public void testAddSameBindingThrowsException() throws Exception
-// {
-// SimpleString queueName = new SimpleString("testQueueName");
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// Filter filter = EasyMock.createStrictMock(Filter.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// EasyMock.expect(qf.createQueue(-1, queueName, filter, true, false)).andReturn(queue);
-// EasyMock.expect(qf.createQueue(-1, queueName, filter, true, false)).andReturn(queue);
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// pm.addBinding((Binding)EasyMock.anyObject());
-// EasyMock.replay(pm, qf, queue);
-// postOffice.start();
-//
-// postOffice.addBinding(new SimpleString("testAddress"), queueName, filter, true, false, true);
-// try
-// {
-// postOffice.addBinding(new SimpleString("testAddress"), queueName, filter, true, false, true);
-// fail("should throw exception");
-// }
-// catch (IllegalStateException e)
-// {
-// // pass
-// }
-// assertNotNull(postOffice.getBinding(queueName));
-// EasyMock.verify(pm, qf, queue);
-// }
-//
-// public void testAddAndRemoveDurableBinding() throws Exception
-// {
-// SimpleString queueName = new SimpleString("testQueueName");
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// Filter filter = EasyMock.createStrictMock(Filter.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// EasyMock.expect(qf.createQueue(-1, queueName, filter, true, false)).andReturn(queue);
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// pm.addBinding((Binding)EasyMock.anyObject());
-// EasyMock.expect(queue.isDurable()).andStubReturn(true);
-// pm.deleteBinding((Binding)EasyMock.anyObject());
-// EasyMock.replay(pm, qf, queue);
-// postOffice.start();
-//
-// postOffice.addBinding(new SimpleString("testAddress"), queueName, filter, true, false, true);
-// postOffice.removeBinding(queueName);
-// assertNull(postOffice.getBinding(queueName));
-// EasyMock.verify(pm, qf, queue);
-// }
-//
-// public void testAddAndRemoveDurableBindings() throws Exception
-// {
-// SimpleString queueName = new SimpleString("testQueueName");
-// SimpleString queueName2 = new SimpleString("testQueueName2");
-// SimpleString queueName3 = new SimpleString("testQueueName3");
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// Filter filter = EasyMock.createStrictMock(Filter.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// Queue queue2 = EasyMock.createStrictMock(Queue.class);
-// Queue queue3 = EasyMock.createStrictMock(Queue.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// EasyMock.expect(qf.createQueue(-1, queueName, filter, true, false)).andReturn(queue);
-// EasyMock.expect(qf.createQueue(-1, queueName2, filter, true, false)).andReturn(queue2);
-// EasyMock.expect(qf.createQueue(-1, queueName3, filter, true, false)).andReturn(queue3);
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(queue2.getName()).andStubReturn(queueName2);
-// EasyMock.expect(queue3.getName()).andStubReturn(queueName3);
-// pm.addBinding((Binding)EasyMock.anyObject());
-// pm.addBinding((Binding)EasyMock.anyObject());
-// pm.addBinding((Binding)EasyMock.anyObject());
-// pm.deleteBinding((Binding)EasyMock.anyObject());
-// pm.deleteBinding((Binding)EasyMock.anyObject());
-// EasyMock.expect(queue.isDurable()).andStubReturn(true);
-// EasyMock.expect(queue3.isDurable()).andStubReturn(true);
-//
-//
-// EasyMock.expect(pgm.createPageStore((SimpleString)EasyMock.anyObject())).andStubReturn(null);
-//
-// EasyMock.replay(pgm, pm, qf, queue, queue2, queue3);
-// postOffice.start();
-//
-// postOffice.addBinding(new SimpleString("testAddress"), queueName, filter, true, false, true);
-// postOffice.addBinding(new SimpleString("testAddress2"), queueName2, filter, true, false, true);
-// postOffice.addBinding(new SimpleString("testAddress3"), queueName3, filter, true, false, true);
-// postOffice.removeBinding(queueName);
-// postOffice.removeBinding(queueName3);
-// assertNull(postOffice.getBinding(queueName));
-// assertNotNull(postOffice.getBinding(queueName2));
-// assertNull(postOffice.getBinding(queueName3));
-// EasyMock.verify(pm, qf, queue, queue2, queue3);
-// }
-//
-// public void testAddAndRemoveNonDurableBinding() throws Exception
-// {
-// SimpleString queueName = new SimpleString("testQueueName");
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// Filter filter = EasyMock.createStrictMock(Filter.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// EasyMock.expect(qf.createQueue(-1, queueName, filter, false, false)).andReturn(queue);
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(queue.isDurable()).andStubReturn(false);
-// EasyMock.replay(pm, qf, queue);
-// postOffice.start();
-//
-// postOffice.addBinding(new SimpleString("testAddress"), queueName, filter, false, false, true);
-// postOffice.removeBinding(queueName);
-// assertNull(postOffice.getBinding(queueName));
-// EasyMock.verify(pm, qf, queue);
-// }
-//
-// public void testAddAndRemoveNonDurableBindings() throws Exception
-// {
-// SimpleString queueName = new SimpleString("testQueueName");
-// SimpleString queueName2 = new SimpleString("testQueueName2");
-// SimpleString queueName3 = new SimpleString("testQueueName3");
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// Filter filter = EasyMock.createStrictMock(Filter.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// Queue queue2 = EasyMock.createStrictMock(Queue.class);
-// Queue queue3 = EasyMock.createStrictMock(Queue.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// EasyMock.expect(qf.createQueue(-1, queueName, filter, false, false)).andReturn(queue);
-// EasyMock.expect(qf.createQueue(-1, queueName2, filter, false, false)).andReturn(queue2);
-// EasyMock.expect(qf.createQueue(-1, queueName3, filter, false, false)).andReturn(queue3);
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(queue2.getName()).andStubReturn(queueName2);
-// EasyMock.expect(queue3.getName()).andStubReturn(queueName3);
-//
-// EasyMock.expect(queue.isDurable()).andStubReturn(false);
-// EasyMock.expect(queue3.isDurable()).andStubReturn(false);
-//
-// EasyMock.expect(pgm.createPageStore((SimpleString)EasyMock.anyObject())).andStubReturn(null);
-//
-// EasyMock.replay(pgm, pm, qf, queue, queue2, queue3);
-//
-// postOffice.start();
-//
-// postOffice.addBinding(new SimpleString("testAddress"), queueName, filter, false, false, true);
-// postOffice.addBinding(new SimpleString("testAddress2"), queueName2, filter, false, false, true);
-// postOffice.addBinding(new SimpleString("testAddress3"), queueName3, filter, false, false, true);
-// postOffice.removeBinding(queueName);
-// postOffice.removeBinding(queueName3);
-// assertNull(postOffice.getBinding(queueName));
-// assertNotNull(postOffice.getBinding(queueName2));
-// assertNull(postOffice.getBinding(queueName3));
-// EasyMock.verify(pm, qf, queue, queue2, queue3);
-// }
-//
-// public void testRemoveNonExistingBindingThrowsException() throws Exception
-// {
-// SimpleString queueName = new SimpleString("testQueueName");
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(queue.isDurable()).andStubReturn(false);
-// EasyMock.replay(pm, qf, queue);
-// postOffice.start();
-//
-// try
-// {
-// postOffice.removeBinding(queueName);
-// fail("should throw exception");
-// }
-// catch (IllegalStateException e)
-// {
-// // pass
-// }
-// assertNull(postOffice.getBinding(queueName));
-// EasyMock.verify(pm, qf, queue);
-// }
-//
-// public void testPostOfficeCannotRouteThrowsException() throws Exception
-// {
-// ServerMessage message = EasyMock.createStrictMock(ServerMessage.class);
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, true, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// EasyMock.expect(message.getDestination()).andStubReturn(new SimpleString("testtDestination"));
-// EasyMock.replay(pm, qf, message);
-// postOffice.start();
-// try
-// {
-// postOffice.route(message);
-// fail("should throw exception");
-// }
-// catch (Exception e)
-// {
-// MessagingException messagingException = (MessagingException)e;
-// assertEquals(MessagingException.ADDRESS_DOES_NOT_EXIST, messagingException.getCode());
-// }
-// EasyMock.verify(pm, qf, message);
-// assertTrue(postOffice.isStarted());
-// }
-//
-// public void testPostOfficeCannotRouteDoesntThrowsException() throws Exception
-// {
-// ServerMessage message = EasyMock.createStrictMock(ServerMessage.class);
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, false, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// EasyMock.expect(message.getDestination()).andStubReturn(new SimpleString("testtDestination"));
-// EasyMock.replay(pm, qf, message);
-//
-// postOffice.start();
-// postOffice.route(message);
-//
-// EasyMock.verify(pm, qf, message);
-// assertTrue(postOffice.isStarted());
-// }
-//
-// public void testPostOfficeRouteToSingleQueueNullFilter() throws Exception
-// {
-// SimpleString queueName = new SimpleString("testQueueName");
-// ServerMessage message = EasyMock.createStrictMock(ServerMessage.class);
-// MessageReference messageReference = EasyMock.createStrictMock(MessageReference.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, false, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// SimpleString address = new SimpleString("testtDestination");
-// EasyMock.expect(message.getDestination()).andStubReturn(address);
-// EasyMock.expect(qf.createQueue(-1, queueName, null, false, false)).andReturn(queue);
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(queue.getFilter()).andStubReturn(null);
-//
-// EasyMock.expect(message.createReference(queue)).andReturn(messageReference);
-//
-// EasyMock.expect(pgm.createPageStore((SimpleString)EasyMock.anyObject())).andStubReturn(null);
-//
-// EasyMock.replay(pgm, pm, qf, message, queue, messageReference);
-//
-// postOffice.start();
-// postOffice.addBinding(address, queueName, null, false, false, true);
-//
-// List<MessageReference> references = postOffice.route(message);
-//
-// EasyMock.verify(pm, qf, message, queue, messageReference);
-// assertTrue(postOffice.isStarted());
-// assertEquals(1, references.size());
-// assertEquals(messageReference, references.get(0));
-// }
-//
-// public void testRouteAddressFull() throws Exception
-// {
-// SimpleString queueName = new SimpleString("testQueueName");
-//
-// ServerMessage message = EasyMock.createStrictMock(ServerMessage.class);
-//
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-//
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-//
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-// pgm.setPostOffice(EasyMock.isA(PostOffice.class));
-// pgm.start();
-// pgm.startGlobalDepage();
-//
-// EasyMock.expect(pgm.addSize(EasyMock.isA(ServerMessage.class))).andReturn(-1l);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, false, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-//
-// SimpleString address = new SimpleString("testtDestination");
-// EasyMock.expect(message.getDestination()).andStubReturn(address);
-// EasyMock.expect(qf.createQueue(-1, queueName, null, false, false)).andReturn(queue);
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(queue.getFilter()).andStubReturn(null);
-//
-// EasyMock.expect(pgm.createPageStore((SimpleString)EasyMock.anyObject())).andStubReturn(null);
-//
-// EasyMock.replay(pm, pgm, qf, message, queue);
-//
-// postOffice.start();
-// postOffice.addBinding(address, queueName, null, false, false, true);
-//
-// List<MessageReference> references = postOffice.route(message);
-//
-// EasyMock.verify(pm, pgm, qf, message, queue);
-// assertTrue(postOffice.isStarted());
-// assertEquals(0, references.size());
-// }
-//
-// public void testPostOfficeRouteToSingleQueueValidFilter() throws Exception
-// {
-// SimpleString queueName = new SimpleString("testQueueName");
-// Filter filter = EasyMock.createStrictMock(Filter.class);
-// ServerMessage message = EasyMock.createStrictMock(ServerMessage.class);
-// MessageReference messageReference = EasyMock.createStrictMock(MessageReference.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, false, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// SimpleString address = new SimpleString("testtDestination");
-// EasyMock.expect(message.getDestination()).andStubReturn(address);
-// EasyMock.expect(qf.createQueue(-1, queueName, filter, false, false)).andReturn(queue);
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(queue.getFilter()).andStubReturn(filter);
-// EasyMock.expect(filter.match(message)).andReturn(true);
-// EasyMock.expect(message.createReference(queue)).andReturn(messageReference);
-//
-// EasyMock.expect(pgm.createPageStore((SimpleString)EasyMock.anyObject())).andStubReturn(null);
-//
-// EasyMock.replay(pgm, pm, qf, message, queue, messageReference, filter);
-// postOffice.start();
-// postOffice.addBinding(address, queueName, filter, false, false, true);
-//
-// List<MessageReference> references = postOffice.route(message);
-// EasyMock.verify(pm, qf, message, queue, messageReference, filter);
-// assertTrue(postOffice.isStarted());
-// assertEquals(1, references.size());
-// assertEquals(messageReference, references.get(0));
-// }
-//
-// public void testPostOfficeRouteToSingleQueueInValidFilter() throws Exception
-// {
-// SimpleString queueName = new SimpleString("testQueueName");
-// Filter filter = EasyMock.createStrictMock(Filter.class);
-// ServerMessage message = EasyMock.createStrictMock(ServerMessage.class);
-// MessageReference messageReference = EasyMock.createStrictMock(MessageReference.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, false, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// SimpleString address = new SimpleString("testtDestination");
-// EasyMock.expect(message.getDestination()).andStubReturn(address);
-// EasyMock.expect(qf.createQueue(-1, queueName, filter, false, false)).andReturn(queue);
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(queue.getFilter()).andStubReturn(filter);
-// EasyMock.expect(filter.match(message)).andReturn(false);
-//
-// EasyMock.expect(pgm.createPageStore((SimpleString)EasyMock.anyObject())).andStubReturn(null);
-//
-// EasyMock.replay(pgm, pm, qf, message, queue, messageReference, filter);
-// postOffice.start();
-// postOffice.addBinding(address, queueName, filter, false, false, true);
-//
-// List<MessageReference> references = postOffice.route(message);
-// EasyMock.verify(pgm, pm, qf, message, queue, messageReference, filter);
-// assertTrue(postOffice.isStarted());
-// assertEquals(0, references.size());
-// }
-//
-// public void testPostOfficeRouteToMultipleQueuesNullFilter() throws Exception
-// {
-// SimpleString queueName = new SimpleString("testQueueName");
-// SimpleString queueName2 = new SimpleString("testQueueName2");
-// SimpleString queueName3 = new SimpleString("testQueueName3");
-// ServerMessage message = EasyMock.createStrictMock(ServerMessage.class);
-// MessageReference messageReference = EasyMock.createStrictMock(MessageReference.class);
-// MessageReference messageReference2 = EasyMock.createStrictMock(MessageReference.class);
-// MessageReference messageReference3 = EasyMock.createStrictMock(MessageReference.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// Queue queue2 = EasyMock.createStrictMock(Queue.class);
-// Queue queue3 = EasyMock.createStrictMock(Queue.class);
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, false, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// SimpleString address = new SimpleString("testtDestination");
-// EasyMock.expect(message.getDestination()).andStubReturn(address);
-// EasyMock.expect(qf.createQueue(-1, queueName, null, false, false)).andReturn(queue);
-// EasyMock.expect(qf.createQueue(-1, queueName2, null, false, false)).andReturn(queue2);
-// EasyMock.expect(qf.createQueue(-1, queueName3, null, false, false)).andReturn(queue3);
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(queue.getFilter()).andStubReturn(null);
-// EasyMock.expect(queue2.getName()).andStubReturn(queueName2);
-// EasyMock.expect(queue2.getFilter()).andStubReturn(null);
-// EasyMock.expect(queue3.getName()).andStubReturn(queueName3);
-// EasyMock.expect(queue3.getFilter()).andStubReturn(null);
-// EasyMock.expect(message.createReference(queue)).andReturn(messageReference);
-// EasyMock.expect(message.createReference(queue2)).andReturn(messageReference2);
-// EasyMock.expect(message.createReference(queue3)).andReturn(messageReference3);
-//
-// EasyMock.expect(pgm.createPageStore((SimpleString)EasyMock.anyObject())).andStubReturn(null);
-//
-// EasyMock.replay(pgm, pm, qf, message, queue, queue2, queue3, messageReference);
-// postOffice.start();
-// postOffice.addBinding(address, queueName, null, false, false, true);
-// postOffice.addBinding(address, queueName2, null, false, false, true);
-// postOffice.addBinding(address, queueName3, null, false, false, true);
-// List<MessageReference> references = postOffice.route(message);
-// EasyMock.verify(pm, qf, message, queue, queue2, queue3, messageReference);
-// assertTrue(postOffice.isStarted());
-// assertEquals(3, references.size());
-// assertEquals(messageReference, references.get(0));
-// assertEquals(messageReference2, references.get(1));
-// assertEquals(messageReference3, references.get(2));
-// }
-//
-// public void testPostOfficeRouteToMultipleQueuesMixedFilters() throws Exception
-// {
-// SimpleString queueName = new SimpleString("testQueueName");
-// SimpleString queueName2 = new SimpleString("testQueueName2");
-// SimpleString queueName3 = new SimpleString("testQueueName3");
-// Filter filter = EasyMock.createStrictMock(Filter.class);
-// Filter filter2 = EasyMock.createStrictMock(Filter.class);
-// ServerMessage message = EasyMock.createStrictMock(ServerMessage.class);
-// MessageReference messageReference = EasyMock.createStrictMock(MessageReference.class);
-// MessageReference messageReference2 = EasyMock.createStrictMock(MessageReference.class);
-// MessageReference messageReference3 = EasyMock.createStrictMock(MessageReference.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// Queue queue2 = EasyMock.createStrictMock(Queue.class);
-// Queue queue3 = EasyMock.createStrictMock(Queue.class);
-// StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
-// BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
-// ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
-// PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-//
-// PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, null, -1, -1, false, null, wildCardRoutingEnabled, false, 0);
-//
-// qf.setPostOffice(postOffice);
-//
-// pm.loadBindings(EasyMock.eq(qf), (List<Binding>)EasyMock.anyObject(), (List<SimpleString>)EasyMock.anyObject());
-// pm.loadMessages(EasyMock.eq(postOffice),
-// (Map<Long, Queue>)EasyMock.anyObject(),
-// (ResourceManager)EasyMock.anyObject());
-// SimpleString address = new SimpleString("testtDestination");
-// EasyMock.expect(message.getDestination()).andStubReturn(address);
-// EasyMock.expect(qf.createQueue(-1, queueName, null, false, false)).andReturn(queue);
-// EasyMock.expect(qf.createQueue(-1, queueName2, null, false, false)).andReturn(queue2);
-// EasyMock.expect(qf.createQueue(-1, queueName3, null, false, false)).andReturn(queue3);
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(queue.getFilter()).andStubReturn(filter);
-// EasyMock.expect(queue2.getName()).andStubReturn(queueName2);
-// EasyMock.expect(queue2.getFilter()).andStubReturn(null);
-// EasyMock.expect(queue3.getName()).andStubReturn(queueName3);
-// EasyMock.expect(queue3.getFilter()).andStubReturn(filter2);
-// EasyMock.expect(filter.match(message)).andReturn(false);
-// EasyMock.expect(filter2.match(message)).andReturn(true);
-// EasyMock.expect(message.createReference(queue2)).andReturn(messageReference2);
-// EasyMock.expect(message.createReference(queue3)).andReturn(messageReference3);
-//
-// EasyMock.expect(pgm.createPageStore((SimpleString)EasyMock.anyObject())).andStubReturn(null);
-//
-// EasyMock.replay(pgm, pm, qf, message, queue, queue2, queue3, messageReference, filter, filter2);
-// postOffice.start();
-// postOffice.addBinding(address, queueName, null, false, false, true);
-// postOffice.addBinding(address, queueName2, null, false, false, true);
-// postOffice.addBinding(address, queueName3, null, false, false, true);
-// List<MessageReference> references = postOffice.route(message);
-// EasyMock.verify(pm, qf, message, queue, queue2, queue3, messageReference, filter, filter2);
-// assertTrue(postOffice.isStarted());
-// assertEquals(2, references.size());
-// assertEquals(messageReference2, references.get(0));
-// assertEquals(messageReference3, references.get(1));
-// }
-
- public void testFoo()
- {
- }
-
- class LoadBindingsIAnswer implements IAnswer
- {
- List<Binding> bindings;
-
- List<SimpleString> dests;
-
- public LoadBindingsIAnswer(final List<Binding> bindings, final List<SimpleString> dests)
- {
- this.bindings = bindings;
- this.dests = dests;
- }
-
- public Object answer() throws Throwable
- {
- if (bindings != null)
- {
- List<Binding> bindings = (List<Binding>)EasyMock.getCurrentArguments()[1];
- bindings.addAll(this.bindings);
- }
- if (dests != null)
- {
- List<SimpleString> dests = (List<SimpleString>)EasyMock.getCurrentArguments()[2];
- dests.addAll(this.dests);
- }
- return null;
- }
- }
-}
Deleted: trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/PostOfficeImplWildcardManagerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/PostOfficeImplWildcardManagerTest.java 2009-05-27 12:05:59 UTC (rev 7067)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/PostOfficeImplWildcardManagerTest.java 2009-05-27 12:43:11 UTC (rev 7068)
@@ -1,153 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.tests.unit.core.postoffice.impl;
-
-
-/**
- * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
- */
-public class PostOfficeImplWildcardManagerTest extends PostOfficeImplTest
-{
- protected void setUp() throws Exception
- {
- super.setUp();
- wildCardRoutingEnabled = true;
- }
-
- /*public void testPostOfficeRouteToWildcardBinding() throws Exception
- {
- SimpleString queueName = new SimpleString("testQ");
- ServerMessage message = EasyMock.createStrictMock(ServerMessage.class);
- ServerMessage message2 = EasyMock.createStrictMock(ServerMessage.class);
- ServerMessage message3 = EasyMock.createStrictMock(ServerMessage.class);
- MessageReference messageReference = EasyMock.createStrictMock(MessageReference.class);
- MessageReference messageReference2 = EasyMock.createStrictMock(MessageReference.class);
- MessageReference messageReference3 = EasyMock.createStrictMock(MessageReference.class);
- SimpleString address = new SimpleString("test.testAddress");
- SimpleString address2 = new SimpleString("test.testAddress2");
- SimpleString address3 = new SimpleString("test.testAddress3");
- Queue queue = EasyMock.createStrictMock(Queue.class);
- StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
- BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
- ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
- PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
- EasyMock.expect(pgm.isGlobalPageMode()).andStubReturn(true);
-
- PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, true, null, wildCardRoutingEnabled, false);
-
- qf.setPostOffice(postOffice);
-
- pm.loadBindings(EasyMock.eq(qf), (List<Binding>) EasyMock.anyObject(), (List<SimpleString>) EasyMock.anyObject());
- pm.loadMessages(EasyMock.eq(postOffice), (Map<Long, Queue>) EasyMock.anyObject(), (ResourceManager) EasyMock.anyObject());
- EasyMock.expect(pm.addDestination(address)).andReturn(true);
- EasyMock.expect(pm.addDestination(address2)).andReturn(true);
- EasyMock.expect(pm.addDestination(address3)).andReturn(true);
- EasyMock.expect(message.getDestination()).andStubReturn(address);
- EasyMock.expect(message2.getDestination()).andStubReturn(address2);
- EasyMock.expect(message3.getDestination()).andStubReturn(address3);
- EasyMock.expect(qf.createQueue(-1, queueName, null, false, false)).andReturn(queue);
- EasyMock.expect(queue.getName()).andStubReturn(queueName);
- EasyMock.expect(queue.getFilter()).andStubReturn(null);
- EasyMock.expect(pgm.addSize(message)).andStubReturn(1000l);
- //this bit is the test itself, if the reference is created for each queue thenwe know that they have been routed via all 3 queues
- EasyMock.expect(message.createReference(queue)).andReturn(messageReference);
- EasyMock.expect(message2.createReference(queue)).andReturn(messageReference2);
- EasyMock.expect(message3.createReference(queue)).andReturn(messageReference3);
- EasyMock.replay(pgm,pm, qf, message, message2, message3, queue);
- postOffice.start();
- assertTrue(postOffice.addDestination(address, true));
- assertTrue(postOffice.addDestination(address2, true));
- assertTrue(postOffice.addDestination(address3, true));
- assertTrue(postOffice.containsDestination(address));
- assertTrue(postOffice.containsDestination(address2));
- assertTrue(postOffice.containsDestination(address3));
- postOffice.addBinding(new SimpleString("test.*"), queueName, null, false, false, true);
- postOffice.route(message);
- postOffice.route(message2);
- postOffice.route(message3);
- EasyMock.verify(pgm, pm, qf, message, message2, message3, queue);
- }*/
-
- /*public void testPostOfficeRouteToMultipleWildcardBinding() throws Exception
- {
- SimpleString queueName = new SimpleString("testQ");
- SimpleString queueName2 = new SimpleString("testQ2");
- ServerMessage message = EasyMock.createStrictMock(ServerMessage.class);
- ServerMessage message2 = EasyMock.createStrictMock(ServerMessage.class);
- ServerMessage message3 = EasyMock.createStrictMock(ServerMessage.class);
- ServerMessage message4 = EasyMock.createStrictMock(ServerMessage.class);
- MessageReference messageReference = EasyMock.createStrictMock(MessageReference.class);
- MessageReference messageReference2 = EasyMock.createStrictMock(MessageReference.class);
- MessageReference messageReference3 = EasyMock.createStrictMock(MessageReference.class);
- MessageReference messageReference4 = EasyMock.createStrictMock(MessageReference.class);
- SimpleString address = new SimpleString("test.testAddress");
- SimpleString address2 = new SimpleString("test2.testAddress2");
- SimpleString address3 = new SimpleString("test.testAddress3");
- SimpleString address4 = new SimpleString("test2.testAddress3");
- Queue queue = EasyMock.createStrictMock(Queue.class);
- Queue queue2 = EasyMock.createStrictMock(Queue.class);
- StorageManager pm = EasyMock.createStrictMock(StorageManager.class);
- BindableFactory qf = EasyMock.createStrictMock(BindableFactory.class);
- ManagementService ms = EasyMock.createNiceMock(ManagementService.class);
- PagingManager pgm = EasyMock.createNiceMock(PagingManager.class);
-
- PostOffice postOffice = new PostOfficeImpl(pm, pgm, qf, ms, true, null, wildCardRoutingEnabled, false);
-
- qf.setPostOffice(postOffice);
-
- pm.loadBindings(EasyMock.eq(qf), (List<Binding>) EasyMock.anyObject(), (List<SimpleString>) EasyMock.anyObject());
- pm.loadMessages(EasyMock.eq(postOffice), (Map<Long, Queue>) EasyMock.anyObject(), (ResourceManager) EasyMock.anyObject());
- EasyMock.expect(pm.addDestination(address)).andReturn(true);
- EasyMock.expect(pm.addDestination(address2)).andReturn(true);
- EasyMock.expect(pm.addDestination(address3)).andReturn(true);
- EasyMock.expect(pm.addDestination(address4)).andReturn(true);
- EasyMock.expect(message.getDestination()).andStubReturn(address);
- EasyMock.expect(message2.getDestination()).andStubReturn(address2);
- EasyMock.expect(message3.getDestination()).andStubReturn(address3);
- EasyMock.expect(message4.getDestination()).andStubReturn(address4);
- EasyMock.expect(qf.createQueue(-1, queueName, null, false, false)).andReturn(queue);
- EasyMock.expect(qf.createQueue(-1, queueName2, null, false, false)).andReturn(queue2);
- EasyMock.expect(queue.getName()).andStubReturn(queueName);
- EasyMock.expect(queue2.getName()).andStubReturn(queueName2);
- EasyMock.expect(queue.getFilter()).andStubReturn(null);
- EasyMock.expect(queue2.getFilter()).andStubReturn(null);
- EasyMock.expect(pgm.addSize(message)).andStubReturn(1000l);
- //this bit is the test itself, if the reference is created for each queue then we know that they have been routed via all 3 queues
- EasyMock.expect(message.createReference(queue)).andReturn(messageReference);
- EasyMock.expect(message2.createReference(queue2)).andReturn(messageReference2);
- EasyMock.expect(message3.createReference(queue)).andReturn(messageReference3);
- EasyMock.expect(message4.createReference(queue2)).andReturn(messageReference4);
- EasyMock.replay(pgm,pm, qf, message, message2, message3, message4, queue, queue2);
- postOffice.start();
- postOffice.addDestination(address, true);
- postOffice.addDestination(address2, true);
- postOffice.addDestination(address3, true);
- postOffice.addDestination(address4, true);
- postOffice.addBinding(new SimpleString("test.*"), queueName, null, false, false, true);
- postOffice.addBinding(new SimpleString("test2.*"), queueName2, null, false, false, true);
- postOffice.route(message);
- postOffice.route(message2);
- postOffice.route(message3);
- postOffice.route(message4);
- EasyMock.verify(pgm, pm, qf, message, message2, message3, message4,queue, queue2);
- }*/
-}
Deleted: trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/SimpleAddressManagerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/SimpleAddressManagerTest.java 2009-05-27 12:05:59 UTC (rev 7067)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/SimpleAddressManagerTest.java 2009-05-27 12:43:11 UTC (rev 7068)
@@ -1,634 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.tests.unit.core.postoffice.impl;
-
-import org.jboss.messaging.core.postoffice.AddressManager;
-import org.jboss.messaging.core.postoffice.impl.SimpleAddressManager;
-import org.jboss.messaging.tests.unit.core.server.impl.fakes.FakeQueueFactory;
-import org.jboss.messaging.tests.util.UnitTestCase;
-
-/**
- * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
- */
-public class SimpleAddressManagerTest extends UnitTestCase
-{
- AddressManager sam;
- FakeQueueFactory fqf = new FakeQueueFactory();
-
- protected void setUp() throws Exception
- {
- super.setUp();
-
- sam = new SimpleAddressManager();
- }
-//
-// public void testAddDestinations()
-// {
-// SimpleString address = new SimpleString("add1");
-// SimpleString address2 = new SimpleString("add2");
-// SimpleString address3 = new SimpleString("add3");
-// SimpleString address4 = new SimpleString("add4");
-// SimpleString address5 = new SimpleString("add5");
-// sam.addDestination(address);
-// sam.addDestination(address2);
-// sam.addDestination(address3);
-// sam.addDestination(address4);
-// sam.addDestination(address5);
-// assertTrue(sam.containsDestination(address));
-// assertTrue(sam.containsDestination(address2));
-// assertTrue(sam.containsDestination(address3));
-// assertTrue(sam.containsDestination(address4));
-// assertTrue(sam.containsDestination(address5));
-// assertEquals(sam.getDestinations().size(), 5);
-// }
-//
-// public void testAddSameDestination()
-// {
-// SimpleString address = new SimpleString("add1");
-// SimpleString address2 = new SimpleString("add2");
-// SimpleString address3 = new SimpleString("add3");
-// SimpleString address4 = new SimpleString("add4");
-// SimpleString address5 = new SimpleString("add4");
-// sam.addDestination(address);
-// sam.addDestination(address2);
-// sam.addDestination(address3);
-// sam.addDestination(address4);
-// sam.addDestination(address5);
-// assertTrue(sam.containsDestination(address));
-// assertTrue(sam.containsDestination(address2));
-// assertTrue(sam.containsDestination(address3));
-// assertTrue(sam.containsDestination(address4));
-// assertTrue(sam.containsDestination(address5));
-// assertEquals(sam.getDestinations().size(), 4);
-// }
-//
-// public void testRemoveDestinations()
-// {
-// SimpleString address = new SimpleString("add1");
-// SimpleString address2 = new SimpleString("add2");
-// SimpleString address3 = new SimpleString("add3");
-// SimpleString address4 = new SimpleString("add4");
-// SimpleString address5 = new SimpleString("add5");
-// sam.addDestination(address);
-// sam.addDestination(address2);
-// sam.addDestination(address3);
-// sam.addDestination(address4);
-// sam.addDestination(address5);
-// assertTrue(sam.containsDestination(address));
-// assertTrue(sam.containsDestination(address2));
-// assertTrue(sam.containsDestination(address3));
-// assertTrue(sam.containsDestination(address4));
-// assertTrue(sam.containsDestination(address5));
-// assertEquals(sam.getDestinations().size(), 5);
-// sam.removeDestination(address2);
-// sam.removeDestination(address4);
-// assertTrue(sam.containsDestination(address));
-// assertFalse(sam.containsDestination(address2));
-// assertTrue(sam.containsDestination(address3));
-// assertFalse(sam.containsDestination(address4));
-// assertTrue(sam.containsDestination(address5));
-// assertEquals(sam.getDestinations().size(), 3);
-// }
-//
-// public void testAddBinding()
-// {
-// SimpleString qName = new SimpleString("q1");
-// SimpleString qName2 = new SimpleString("q2");
-// SimpleString qName3 = new SimpleString("q3");
-// SimpleString qName4 = new SimpleString("q4");
-// SimpleString qName5 = new SimpleString("q5");
-// SimpleString address = new SimpleString("add1");
-// SimpleString address2 = new SimpleString("add2");
-// SimpleString address3 = new SimpleString("add3");
-// SimpleString address4 = new SimpleString("add4");
-// SimpleString address5 = new SimpleString("add5");
-// Queue q = EasyMock.createStrictMock(Queue.class);
-// Queue q2 = EasyMock.createStrictMock(Queue.class);
-// Queue q3 = EasyMock.createStrictMock(Queue.class);
-// Queue q4 = EasyMock.createStrictMock(Queue.class);
-// Queue q5 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q.getName()).andStubReturn(qName);
-// EasyMock.expect(q2.getName()).andStubReturn(qName2);
-// EasyMock.expect(q3.getName()).andStubReturn(qName3);
-// EasyMock.expect(q4.getName()).andStubReturn(qName4);
-// EasyMock.expect(q5.getName()).andStubReturn(qName5);
-// EasyMock.replay(q, q2, q3, q4, q5);
-// Binding b1 = new QueueBindingImpl(address, q);
-// sam.addBinding(b1);
-// QueueBindingImpl b2 = new QueueBindingImpl(address2, q2);
-// sam.addBinding(b2);
-// QueueBindingImpl b3 = new QueueBindingImpl(address3, q3);
-// sam.addBinding(b3);
-// QueueBindingImpl b4 = new QueueBindingImpl(address4, q4);
-// sam.addBinding(b4);
-// QueueBindingImpl b5 = new QueueBindingImpl(address5, q5);
-// sam.addBinding(b5);
-// assertEquals(sam.getBinding(qName), b1);
-// assertEquals(sam.getBinding(qName2), b2);
-// assertEquals(sam.getBinding(qName3), b3);
-// assertEquals(sam.getBinding(qName4), b4);
-// assertEquals(sam.getBinding(qName5), b5);
-// assertEquals(sam.getBindings().size(), 5);
-// EasyMock.verify(q, q2, q3, q4, q5);
-// }
-//
-// public void testRemoveBinding()
-// {
-// SimpleString qName = new SimpleString("q1");
-// SimpleString qName2 = new SimpleString("q2");
-// SimpleString qName3 = new SimpleString("q3");
-// SimpleString qName4 = new SimpleString("q4");
-// SimpleString qName5 = new SimpleString("q5");
-// SimpleString address = new SimpleString("add1");
-// SimpleString address2 = new SimpleString("add2");
-// SimpleString address3 = new SimpleString("add3");
-// SimpleString address4 = new SimpleString("add4");
-// SimpleString address5 = new SimpleString("add5");
-// Queue q = EasyMock.createStrictMock(Queue.class);
-// Queue q2 = EasyMock.createStrictMock(Queue.class);
-// Queue q3 = EasyMock.createStrictMock(Queue.class);
-// Queue q4 = EasyMock.createStrictMock(Queue.class);
-// Queue q5 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q.getName()).andStubReturn(qName);
-// EasyMock.expect(q2.getName()).andStubReturn(qName2);
-// EasyMock.expect(q3.getName()).andStubReturn(qName3);
-// EasyMock.expect(q4.getName()).andStubReturn(qName4);
-// EasyMock.expect(q5.getName()).andStubReturn(qName5);
-// EasyMock.replay(q, q2, q3, q4, q5);
-// QueueBindingImpl b1 = new QueueBindingImpl(address, q);
-// sam.addBinding(b1);
-// QueueBindingImpl b2 = new QueueBindingImpl(address2, q2);
-// sam.addBinding(b2);
-// QueueBindingImpl b3 = new QueueBindingImpl(address3, q3);
-// sam.addBinding(b3);
-// QueueBindingImpl b4 = new QueueBindingImpl(address4, q4);
-// sam.addBinding(b4);
-// QueueBindingImpl b5 = new QueueBindingImpl(address5, q5);
-// sam.addBinding(b5);
-// assertEquals(sam.getBinding(qName), b1);
-// assertEquals(sam.getBinding(qName2), b2);
-// assertEquals(sam.getBinding(qName3), b3);
-// assertEquals(sam.getBinding(qName4), b4);
-// assertEquals(sam.getBinding(qName5), b5);
-// assertEquals(sam.getBindings().size(), 5);
-// sam.removeBinding(qName2);
-// sam.removeBinding(qName4);
-// assertEquals(sam.getBinding(qName), b1);
-// assertNull(sam.getBinding(qName2));
-// assertEquals(sam.getBinding(qName3), b3);
-// assertNull(sam.getBinding(qName4));
-// assertEquals(sam.getBinding(qName5), b5);
-// assertEquals(sam.getBindings().size(), 3);
-// EasyMock.verify(q, q2, q3, q4, q5);
-// }
-//
-// public void testAddBindingAlreadyExists()
-// {
-// SimpleString qName = new SimpleString("q1");
-// SimpleString address = new SimpleString("add1");
-// Queue q = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q.getName()).andStubReturn(qName);
-// EasyMock.replay(q);
-// QueueBindingImpl b1 = new QueueBindingImpl(address, q);
-// sam.addBinding(b1);
-// try
-// {
-// sam.addBinding(b1);
-// fail("should throw IllegalStateException");
-// }
-// catch (IllegalStateException e)
-// {
-// //pass
-// }
-// assertEquals(sam.getBinding(qName), b1);
-// EasyMock.verify(q);
-// }
-//
-// public void testAddMapping()
-// {
-// SimpleString address = new SimpleString("add1");
-// SimpleString qName = new SimpleString("q1");
-// Queue q = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q.getName()).andStubReturn(qName);
-// QueueBindingImpl b1 = new QueueBindingImpl(address, q);
-// EasyMock.replay(q);
-// sam.addBinding(address, b1);
-// assertNotNull(sam.getBindings(address));
-// assertEquals(sam.getBindings(address).getBindings().size(), 1);
-// assertEquals(sam.getBindings(address).getBindings().get(0), b1);
-// EasyMock.verify(q);
-// }
-//
-// public void testRemoveMapping()
-// {
-// SimpleString address = new SimpleString("add1");
-// SimpleString qName = new SimpleString("q1");
-// Queue q = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q.getName()).andStubReturn(qName);
-// QueueBindingImpl b1 = new QueueBindingImpl(address, q);
-// EasyMock.replay(q);
-// sam.addBinding(address, b1);
-// assertNotNull(sam.getBindings(address));
-// assertEquals(sam.getBindings(address).getBindings().size(), 1);
-// assertEquals(sam.getBindings(address).getBindings().get(0), b1);
-// sam.removeMapping(address, qName);
-// assertNull(sam.getBindings(address));
-// EasyMock.verify(q);
-// }
-//
-// public void testAddMultipleBindingsToMapping()
-// {
-// SimpleString address = new SimpleString("add1");
-// SimpleString qName = new SimpleString("q1");
-// SimpleString qName2 = new SimpleString("q2");
-// SimpleString qName3 = new SimpleString("q3");
-// SimpleString qName4 = new SimpleString("q4");
-// SimpleString qName5 = new SimpleString("q5");
-// Queue q = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q.getName()).andStubReturn(qName);
-// Queue q2 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q2.getName()).andStubReturn(qName2);
-// Queue q3 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q3.getName()).andStubReturn(qName3);
-// Queue q4 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q4.getName()).andStubReturn(qName4);
-// Queue q5 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q5.getName()).andStubReturn(qName5);
-// QueueBindingImpl b1 = new QueueBindingImpl(address, q);
-// QueueBindingImpl b2 = new QueueBindingImpl(address, q2);
-// QueueBindingImpl b3 = new QueueBindingImpl(address, q3);
-// QueueBindingImpl b4 = new QueueBindingImpl(address, q4);
-// QueueBindingImpl b5 = new QueueBindingImpl(address, q5);
-// EasyMock.replay(q, q2, q3, q4, q5);
-// sam.addBinding(address, b1);
-// sam.addBinding(address, b2);
-// sam.addBinding(address, b3);
-// sam.addBinding(address, b4);
-// sam.addBinding(address, b5);
-// assertNotNull(sam.getBindings(address));
-// assertEquals(sam.getBindings(address).getBindings().size(), 5);
-// assertEquals(sam.getBindings(address).getBindings().get(0), b1);
-// assertEquals(sam.getBindings(address).getBindings().get(1), b2);
-// assertEquals(sam.getBindings(address).getBindings().get(2), b3);
-// assertEquals(sam.getBindings(address).getBindings().get(3), b4);
-// assertEquals(sam.getBindings(address).getBindings().get(4), b5);
-// EasyMock.verify(q, q2, q3, q4, q5);
-// }
-//
-// public void testRemoveMultipleBindingsFromMapping()
-// {
-// SimpleString address = new SimpleString("add1");
-// SimpleString qName = new SimpleString("q1");
-// SimpleString qName2 = new SimpleString("q2");
-// SimpleString qName3 = new SimpleString("q3");
-// SimpleString qName4 = new SimpleString("q4");
-// SimpleString qName5 = new SimpleString("q5");
-// Queue q = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q.getName()).andStubReturn(qName);
-// Queue q2 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q2.getName()).andStubReturn(qName2);
-// Queue q3 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q3.getName()).andStubReturn(qName3);
-// Queue q4 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q4.getName()).andStubReturn(qName4);
-// Queue q5 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q5.getName()).andStubReturn(qName5);
-// QueueBindingImpl b1 = new QueueBindingImpl(address, q);
-// QueueBindingImpl b2 = new QueueBindingImpl(address, q2);
-// QueueBindingImpl b3 = new QueueBindingImpl(address, q3);
-// QueueBindingImpl b4 = new QueueBindingImpl(address, q4);
-// QueueBindingImpl b5 = new QueueBindingImpl(address, q5);
-// EasyMock.replay(q, q2, q3, q4, q5);
-// sam.addBinding(address, b1);
-// sam.addBinding(address, b2);
-// sam.addBinding(address, b3);
-// sam.addBinding(address, b4);
-// sam.addBinding(address, b5);
-// assertNotNull(sam.getBindings(address));
-// assertEquals(sam.getBindings(address).getBindings().size(), 5);
-// assertEquals(sam.getBindings(address).getBindings().get(0), b1);
-// assertEquals(sam.getBindings(address).getBindings().get(1), b2);
-// assertEquals(sam.getBindings(address).getBindings().get(2), b3);
-// assertEquals(sam.getBindings(address).getBindings().get(3), b4);
-// assertEquals(sam.getBindings(address).getBindings().get(4), b5);
-// sam.removeMapping(address, qName2);
-// sam.removeMapping(address, qName4);
-// assertNotNull(sam.getBindings(address));
-// assertEquals(sam.getBindings(address).getBindings().size(), 3);
-// assertEquals(sam.getBindings(address).getBindings().get(0), b1);
-// assertEquals(sam.getBindings(address).getBindings().get(1), b3);
-// assertEquals(sam.getBindings(address).getBindings().get(2), b5);
-// EasyMock.verify(q, q2, q3, q4, q5);
-// }
-//
-// public void testAddBindingsToMultipleMappings()
-// {
-// SimpleString address = new SimpleString("add1");
-// SimpleString address2 = new SimpleString("add2");
-// SimpleString address3 = new SimpleString("add3");
-// SimpleString address4 = new SimpleString("add4");
-// SimpleString address5 = new SimpleString("add5");
-// SimpleString qName = new SimpleString("q1");
-// SimpleString qName2 = new SimpleString("q2");
-// SimpleString qName3 = new SimpleString("q3");
-// SimpleString qName4 = new SimpleString("q4");
-// SimpleString qName5 = new SimpleString("q5");
-// Queue q = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q.getName()).andStubReturn(qName);
-// Queue q2 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q2.getName()).andStubReturn(qName2);
-// Queue q3 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q3.getName()).andStubReturn(qName3);
-// Queue q4 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q4.getName()).andStubReturn(qName4);
-// Queue q5 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q5.getName()).andStubReturn(qName5);
-// QueueBindingImpl b1 = new QueueBindingImpl(address, q);
-// QueueBindingImpl b2 = new QueueBindingImpl(address2, q2);
-// QueueBindingImpl b3 = new QueueBindingImpl(address3, q3);
-// QueueBindingImpl b4 = new QueueBindingImpl(address4, q4);
-// QueueBindingImpl b5 = new QueueBindingImpl(address5, q5);
-// EasyMock.replay(q, q2, q3, q4, q5);
-// sam.addBinding(address, b1);
-// sam.addBinding(address2, b2);
-// sam.addBinding(address3, b3);
-// sam.addBinding(address4, b4);
-// sam.addBinding(address5, b5);
-// assertNotNull(sam.getBindings(address));
-// assertEquals(sam.getBindings(address).getBindings().size(), 1);
-// assertEquals(sam.getBindings(address).getBindings().get(0), b1);
-// assertNotNull(sam.getBindings(address2));
-// assertEquals(sam.getBindings(address2).getBindings().size(), 1);
-// assertEquals(sam.getBindings(address2).getBindings().get(0), b2);
-// assertNotNull(sam.getBindings(address3));
-// assertEquals(sam.getBindings(address3).getBindings().size(), 1);
-// assertEquals(sam.getBindings(address3).getBindings().get(0), b3);
-// assertNotNull(sam.getBindings(address4));
-// assertEquals(sam.getBindings(address4).getBindings().size(), 1);
-// assertEquals(sam.getBindings(address4).getBindings().get(0), b4);
-// assertNotNull(sam.getBindings(address5));
-// assertEquals(sam.getBindings(address5).getBindings().size(), 1);
-// assertEquals(sam.getBindings(address5).getBindings().get(0), b5);
-// EasyMock.verify(q, q2, q3, q4, q5);
-// }
-//
-// public void testRemoveBindingsFromMultipleMappings()
-// {
-// SimpleString address = new SimpleString("add1");
-// SimpleString address2 = new SimpleString("add2");
-// SimpleString address3 = new SimpleString("add3");
-// SimpleString address4 = new SimpleString("add4");
-// SimpleString address5 = new SimpleString("add5");
-// SimpleString qName = new SimpleString("q1");
-// SimpleString qName2 = new SimpleString("q2");
-// SimpleString qName3 = new SimpleString("q3");
-// SimpleString qName4 = new SimpleString("q4");
-// SimpleString qName5 = new SimpleString("q5");
-// Queue q = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q.getName()).andStubReturn(qName);
-// Queue q2 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q2.getName()).andStubReturn(qName2);
-// Queue q3 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q3.getName()).andStubReturn(qName3);
-// Queue q4 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q4.getName()).andStubReturn(qName4);
-// Queue q5 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q5.getName()).andStubReturn(qName5);
-// QueueBindingImpl b1 = new QueueBindingImpl(address, q);
-// QueueBindingImpl b2 = new QueueBindingImpl(address2, q2);
-// QueueBindingImpl b3 = new QueueBindingImpl(address3, q3);
-// QueueBindingImpl b4 = new QueueBindingImpl(address4, q4);
-// QueueBindingImpl b5 = new QueueBindingImpl(address5, q5);
-// EasyMock.replay(q, q2, q3, q4, q5);
-// sam.addBinding(address, b1);
-// sam.addBinding(address2, b2);
-// sam.addBinding(address3, b3);
-// sam.addBinding(address4, b4);
-// sam.addBinding(address5, b5);
-// assertNotNull(sam.getBindings(address));
-// assertEquals(sam.getBindings(address).getBindings().size(), 1);
-// assertEquals(sam.getBindings(address).getBindings().get(0), b1);
-// assertNotNull(sam.getBindings(address2));
-// assertEquals(sam.getBindings(address2).getBindings().size(), 1);
-// assertEquals(sam.getBindings(address2).getBindings().get(0), b2);
-// assertNotNull(sam.getBindings(address3));
-// assertEquals(sam.getBindings(address3).getBindings().size(), 1);
-// assertEquals(sam.getBindings(address3).getBindings().get(0), b3);
-// assertNotNull(sam.getBindings(address4));
-// assertEquals(sam.getBindings(address4).getBindings().size(), 1);
-// assertEquals(sam.getBindings(address4).getBindings().get(0), b4);
-// assertNotNull(sam.getBindings(address5));
-// assertEquals(sam.getBindings(address5).getBindings().size(), 1);
-// assertEquals(sam.getBindings(address5).getBindings().get(0), b5);
-// sam.removeMapping(address2, qName2);
-// sam.removeMapping(address4, qName4);
-// assertNotNull(sam.getBindings(address));
-// assertEquals(sam.getBindings(address).getBindings().size(), 1);
-// assertEquals(sam.getBindings(address).getBindings().get(0), b1);
-// assertNull(sam.getBindings(address2));
-// assertEquals(sam.getBindings(address3).getBindings().size(), 1);
-// assertEquals(sam.getBindings(address3).getBindings().get(0), b3);
-// assertNull(sam.getBindings(address4));
-// assertEquals(sam.getBindings(address5).getBindings().size(), 1);
-// assertEquals(sam.getBindings(address5).getBindings().get(0), b5);
-// EasyMock.verify(q, q2, q3, q4, q5);
-// }
-//
-// public void testAddMultipleBindingsToMultipleMappings()
-// {
-// SimpleString address = new SimpleString("add1");
-// SimpleString address2 = new SimpleString("add2");
-// SimpleString address3 = new SimpleString("add3");
-// SimpleString address4 = new SimpleString("add4");
-// SimpleString address5 = new SimpleString("add5");
-// SimpleString address6 = new SimpleString("add6");
-// SimpleString address7 = new SimpleString("add7");
-// SimpleString address8 = new SimpleString("add8");
-// SimpleString address9 = new SimpleString("add9");
-// SimpleString address10 = new SimpleString("add105");
-// SimpleString qName = new SimpleString("q1");
-// SimpleString qName2 = new SimpleString("q2");
-// SimpleString qName3 = new SimpleString("q3");
-// SimpleString qName4 = new SimpleString("q4");
-// SimpleString qName5 = new SimpleString("q5");
-// SimpleString qName6 = new SimpleString("q6");
-// SimpleString qName7 = new SimpleString("q7");
-// SimpleString qName8 = new SimpleString("q8");
-// SimpleString qName9 = new SimpleString("q9");
-// SimpleString qName10 = new SimpleString("q10");
-// Queue q = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q.getName()).andStubReturn(qName);
-// Queue q2 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q2.getName()).andStubReturn(qName2);
-// Queue q3 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q3.getName()).andStubReturn(qName3);
-// Queue q4 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q4.getName()).andStubReturn(qName4);
-// Queue q5 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q5.getName()).andStubReturn(qName5);
-// Queue q6 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q6.getName()).andStubReturn(qName6);
-// Queue q7 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q7.getName()).andStubReturn(qName7);
-// Queue q8 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q8.getName()).andStubReturn(qName8);
-// Queue q9 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q9.getName()).andStubReturn(qName9);
-// Queue q10 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q10.getName()).andStubReturn(qName10);
-// QueueBindingImpl b1 = new QueueBindingImpl(address, q);
-// QueueBindingImpl b2 = new QueueBindingImpl(address2, q2);
-// QueueBindingImpl b3 = new QueueBindingImpl(address3, q3);
-// QueueBindingImpl b4 = new QueueBindingImpl(address4, q4);
-// QueueBindingImpl b5 = new QueueBindingImpl(address5, q5);
-// QueueBindingImpl b6 = new QueueBindingImpl(address6, q6);
-// QueueBindingImpl b7 = new QueueBindingImpl(address7, q7);
-// QueueBindingImpl b8 = new QueueBindingImpl(address8, q8);
-// QueueBindingImpl b9 = new QueueBindingImpl(address9, q9);
-// QueueBindingImpl b10 = new QueueBindingImpl(address10, q10);
-// EasyMock.replay(q);
-// sam.addBinding(address, b1);
-// sam.addBinding(address2, b2);
-// sam.addBinding(address, b3);
-// sam.addBinding(address2, b4);
-// sam.addBinding(address, b5);
-// sam.addBinding(address2, b6);
-// sam.addBinding(address, b7);
-// sam.addBinding(address2, b8);
-// sam.addBinding(address, b9);
-// sam.addBinding(address2, b10);
-// assertNotNull(sam.getBindings(address));
-// assertEquals(sam.getBindings(address).getBindings().size(), 5);
-// assertEquals(sam.getBindings(address).getBindings().get(0), b1);
-// assertEquals(sam.getBindings(address).getBindings().get(1), b3);
-// assertEquals(sam.getBindings(address).getBindings().get(2), b5);
-// assertEquals(sam.getBindings(address).getBindings().get(3), b7);
-// assertEquals(sam.getBindings(address).getBindings().get(4), b9);
-// assertNotNull(sam.getBindings(address2));
-// assertEquals(sam.getBindings(address2).getBindings().size(), 5);
-// assertEquals(sam.getBindings(address2).getBindings().get(0), b2);
-// assertEquals(sam.getBindings(address2).getBindings().get(1), b4);
-// assertEquals(sam.getBindings(address2).getBindings().get(2), b6);
-// assertEquals(sam.getBindings(address2).getBindings().get(3), b8);
-// assertEquals(sam.getBindings(address2).getBindings().get(4), b10);
-// EasyMock.verify(q);
-// }
-//
-// public void testRemoveMultipleBindingsTFromMultipleMappings()
-// {
-// SimpleString address = new SimpleString("add1");
-// SimpleString address2 = new SimpleString("add2");
-// SimpleString address3 = new SimpleString("add3");
-// SimpleString address4 = new SimpleString("add4");
-// SimpleString address5 = new SimpleString("add5");
-// SimpleString address6 = new SimpleString("add6");
-// SimpleString address7 = new SimpleString("add7");
-// SimpleString address8 = new SimpleString("add8");
-// SimpleString address9 = new SimpleString("add9");
-// SimpleString address10 = new SimpleString("add105");
-// SimpleString qName = new SimpleString("q1");
-// SimpleString qName2 = new SimpleString("q2");
-// SimpleString qName3 = new SimpleString("q3");
-// SimpleString qName4 = new SimpleString("q4");
-// SimpleString qName5 = new SimpleString("q5");
-// SimpleString qName6 = new SimpleString("q6");
-// SimpleString qName7 = new SimpleString("q7");
-// SimpleString qName8 = new SimpleString("q8");
-// SimpleString qName9 = new SimpleString("q9");
-// SimpleString qName10 = new SimpleString("q10");
-// Queue q = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q.getName()).andStubReturn(qName);
-// Queue q2 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q2.getName()).andStubReturn(qName2);
-// Queue q3 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q3.getName()).andStubReturn(qName3);
-// Queue q4 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q4.getName()).andStubReturn(qName4);
-// Queue q5 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q5.getName()).andStubReturn(qName5);
-// Queue q6 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q6.getName()).andStubReturn(qName6);
-// Queue q7 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q7.getName()).andStubReturn(qName7);
-// Queue q8 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q8.getName()).andStubReturn(qName8);
-// Queue q9 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q9.getName()).andStubReturn(qName9);
-// Queue q10 = EasyMock.createStrictMock(Queue.class);
-// EasyMock.expect(q10.getName()).andStubReturn(qName10);
-// QueueBindingImpl b1 = new QueueBindingImpl(address, q);
-// QueueBindingImpl b2 = new QueueBindingImpl(address2, q2);
-// QueueBindingImpl b3 = new QueueBindingImpl(address3, q3);
-// QueueBindingImpl b4 = new QueueBindingImpl(address4, q4);
-// QueueBindingImpl b5 = new QueueBindingImpl(address5, q5);
-// QueueBindingImpl b6 = new QueueBindingImpl(address6, q6);
-// QueueBindingImpl b7 = new QueueBindingImpl(address7, q7);
-// QueueBindingImpl b8 = new QueueBindingImpl(address8, q8);
-// QueueBindingImpl b9 = new QueueBindingImpl(address9, q9);
-// QueueBindingImpl b10 = new QueueBindingImpl(address10, q10);
-// EasyMock.replay(q, q2, q3, q4, q5);
-// sam.addBinding(address, b1);
-// sam.addBinding(address2, b2);
-// sam.addBinding(address, b3);
-// sam.addBinding(address2, b4);
-// sam.addBinding(address, b5);
-// sam.addBinding(address2, b6);
-// sam.addBinding(address, b7);
-// sam.addBinding(address2, b8);
-// sam.addBinding(address, b9);
-// sam.addBinding(address2, b10);
-// assertNotNull(sam.getBindings(address));
-// assertEquals(sam.getBindings(address).getBindings().size(), 5);
-// assertEquals(sam.getBindings(address).getBindings().get(0), b1);
-// assertEquals(sam.getBindings(address).getBindings().get(1), b3);
-// assertEquals(sam.getBindings(address).getBindings().get(2), b5);
-// assertEquals(sam.getBindings(address).getBindings().get(3), b7);
-// assertEquals(sam.getBindings(address).getBindings().get(4), b9);
-// assertNotNull(sam.getBindings(address2));
-// assertEquals(sam.getBindings(address2).getBindings().size(), 5);
-// assertEquals(sam.getBindings(address2).getBindings().get(0), b2);
-// assertEquals(sam.getBindings(address2).getBindings().get(1), b4);
-// assertEquals(sam.getBindings(address2).getBindings().get(2), b6);
-// assertEquals(sam.getBindings(address2).getBindings().get(3), b8);
-// assertEquals(sam.getBindings(address2).getBindings().get(4), b10);
-//
-// sam.removeMapping(address, qName3);
-// sam.removeMapping(address, qName5);
-// sam.removeMapping(address2, qName2);
-// sam.removeMapping(address2, qName4);
-// assertNotNull(sam.getBindings(address));
-// assertEquals(sam.getBindings(address).getBindings().size(), 3);
-// assertEquals(sam.getBindings(address).getBindings().get(0), b1);
-// assertEquals(sam.getBindings(address).getBindings().get(1), b7);
-// assertEquals(sam.getBindings(address).getBindings().get(2), b9);
-// assertNotNull(sam.getBindings(address2));
-// assertEquals(sam.getBindings(address2).getBindings().size(), 3);
-// assertEquals(sam.getBindings(address2).getBindings().get(0), b6);
-// assertEquals(sam.getBindings(address2).getBindings().get(1), b8);
-// assertEquals(sam.getBindings(address2).getBindings().get(2), b10);
-// EasyMock.verify(q, q2, q3, q4, q5);
-// }
-
- public void testFoo()
- {
- }
-}
Deleted: trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/WildcardAddressManagerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/WildcardAddressManagerTest.java 2009-05-27 12:05:59 UTC (rev 7067)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/postoffice/impl/WildcardAddressManagerTest.java 2009-05-27 12:43:11 UTC (rev 7068)
@@ -1,135 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.tests.unit.core.postoffice.impl;
-
-import org.jboss.messaging.core.postoffice.impl.WildcardAddressManager;
-
-/**
- * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
- */
-public class WildcardAddressManagerTest extends SimpleAddressManagerTest
-{
- protected void setUp() throws Exception
- {
- super.setUp();
-
- sam = new WildcardAddressManager();
- }
-
-
-
- public void testAddDestinations()
- {
- /*SimpleString address = new SimpleString("test.add1");
- SimpleString address2 = new SimpleString("test.add2");
- SimpleString address3 = new SimpleString("test.add3");
- SimpleString address4 = new SimpleString("test.add4");
- SimpleString address5 = new SimpleString("test.add5");
- sam.addDestination(address);
- sam.addDestination(address2);
- sam.addDestination(address3);
- sam.addDestination(address4);
- sam.addDestination(address5);
- assertTrue(sam.containsDestination(address));
- assertTrue(sam.containsDestination(address2));
- assertTrue(sam.containsDestination(address3));
- assertTrue(sam.containsDestination(address4));
- assertTrue(sam.containsDestination(address5));
- assertTrue(sam.containsDestination(new SimpleString("test.*")));
- assertTrue(sam.containsDestination(new SimpleString("*.*")));
- assertTrue(sam.containsDestination(new SimpleString("*.add1")));
- assertTrue(sam.containsDestination(new SimpleString("*.add2")));
- assertTrue(sam.containsDestination(new SimpleString("*.add3")));
- assertTrue(sam.containsDestination(new SimpleString("*.add4")));
- assertTrue(sam.containsDestination(new SimpleString("*.add5")));
- assertTrue(sam.containsDestination(new SimpleString("test.#")));
- assertTrue(sam.containsDestination(new SimpleString("#.add1")));
- assertTrue(sam.containsDestination(new SimpleString("#.add2")));
- assertTrue(sam.containsDestination(new SimpleString("#.add3")));
- assertTrue(sam.containsDestination(new SimpleString("#.add4")));
- assertTrue(sam.containsDestination(new SimpleString("#.add5")));
- assertTrue(sam.containsDestination(new SimpleString("#")));
- assertEquals(sam.getDestinations().size(), 5);*/
- }
-
- /* public void testRemoveDestinations()
- {
- SimpleString address = new SimpleString("test.add1");
- SimpleString address2 = new SimpleString("test2.add2");
- SimpleString address3 = new SimpleString("test.add3");
- SimpleString address4 = new SimpleString("test2.add4");
- SimpleString address5 = new SimpleString("test.add5");
- sam.addDestination(address);
- sam.addDestination(address2);
- sam.addDestination(address3);
- sam.addDestination(address4);
- sam.addDestination(address5);
- assertTrue(sam.containsDestination(address));
- assertTrue(sam.containsDestination(address2));
- assertTrue(sam.containsDestination(address3));
- assertTrue(sam.containsDestination(address4));
- assertTrue(sam.containsDestination(address5));
- assertTrue(sam.containsDestination(new SimpleString("test.*")));
- assertTrue(sam.containsDestination(new SimpleString("test2.*")));
- assertTrue(sam.containsDestination(new SimpleString("*.*")));
- assertTrue(sam.containsDestination(new SimpleString("*.add1")));
- assertTrue(sam.containsDestination(new SimpleString("*.add2")));
- assertTrue(sam.containsDestination(new SimpleString("*.add3")));
- assertTrue(sam.containsDestination(new SimpleString("*.add4")));
- assertTrue(sam.containsDestination(new SimpleString("*.add5")));
- assertTrue(sam.containsDestination(new SimpleString("*.add5")));
- assertTrue(sam.containsDestination(new SimpleString("test.#")));
- assertTrue(sam.containsDestination(new SimpleString("#.add1")));
- assertTrue(sam.containsDestination(new SimpleString("#.add2")));
- assertTrue(sam.containsDestination(new SimpleString("#.add3")));
- assertTrue(sam.containsDestination(new SimpleString("#.add4")));
- assertTrue(sam.containsDestination(new SimpleString("#.add5")));
- assertTrue(sam.containsDestination(new SimpleString("#")));
- assertEquals(sam.getDestinations().size(), 5);
-
- sam.removeDestination(address2);
- sam.removeDestination(address4);
-
- assertTrue(sam.containsDestination(address));
- assertFalse(sam.containsDestination(address2));
- assertTrue(sam.containsDestination(address3));
- assertFalse(sam.containsDestination(address4));
- assertTrue(sam.containsDestination(address5));
- assertTrue(sam.containsDestination(new SimpleString("test.*")));
- assertFalse(sam.containsDestination(new SimpleString("test2.*")));
- assertTrue(sam.containsDestination(new SimpleString("*.*")));
- assertTrue(sam.containsDestination(new SimpleString("*.add1")));
- assertFalse(sam.containsDestination(new SimpleString("*.add2")));
- assertTrue(sam.containsDestination(new SimpleString("*.add3")));
- assertFalse(sam.containsDestination(new SimpleString("*.add4")));
- assertTrue(sam.containsDestination(new SimpleString("*.add5")));
- assertTrue(sam.containsDestination(new SimpleString("*.add5")));
- assertTrue(sam.containsDestination(new SimpleString("test.#")));
- assertTrue(sam.containsDestination(new SimpleString("#.add1")));
- assertFalse(sam.containsDestination(new SimpleString("#.add2")));
- assertTrue(sam.containsDestination(new SimpleString("#.add3")));
- assertFalse(sam.containsDestination(new SimpleString("#.add4")));
- assertTrue(sam.containsDestination(new SimpleString("#.add5")));
- assertTrue(sam.containsDestination(new SimpleString("#")));
- assertEquals(sam.getDestinations().size(), 3);
- }*/
-}
Deleted: trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/MessageReferenceImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/MessageReferenceImplTest.java 2009-05-27 12:05:59 UTC (rev 7067)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/MessageReferenceImplTest.java 2009-05-27 12:43:11 UTC (rev 7068)
@@ -1,341 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.tests.unit.core.server.impl;
-
-import org.jboss.messaging.tests.util.UnitTestCase;
-
-/**
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
- */
-public class MessageReferenceImplTest extends UnitTestCase
-{
-
-// public void testDeliveryCount()
-// {
-// ServerMessage serverMessage = EasyMock.createStrictMock(ServerMessage.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// MessageReferenceImpl messageReference = new DummyMessageReference(serverMessage, queue);
-// assertEquals(messageReference.getDeliveryCount(), 0);
-// messageReference.incrementDeliveryCount();
-// messageReference.incrementDeliveryCount();
-// messageReference.incrementDeliveryCount();
-// messageReference.incrementDeliveryCount();
-// messageReference.incrementDeliveryCount();
-// assertEquals(messageReference.getDeliveryCount(), 5);
-// messageReference.setDeliveryCount(0);
-// assertEquals(messageReference.getDeliveryCount(), 0);
-// }
-//
-// public void testCopy()
-// {
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// ServerMessage serverMessage = EasyMock.createStrictMock(ServerMessage.class);
-// Queue queue2 = EasyMock.createStrictMock(Queue.class);
-// MessageReferenceImpl messageReference = new DummyMessageReference(serverMessage, queue);
-// messageReference.setDeliveryCount(999);
-// messageReference.setScheduledDeliveryTime(System.currentTimeMillis());
-// MessageReference messageReferenceCopy = messageReference.copy(queue2);
-// assertEquals(messageReferenceCopy.getDeliveryCount(), messageReference.getDeliveryCount());
-// assertEquals(messageReferenceCopy.getScheduledDeliveryTime(), messageReference.getScheduledDeliveryTime());
-// assertEquals(messageReferenceCopy.getMessage(), messageReference.getMessage());
-// assertEquals(messageReferenceCopy.getQueue(), queue2);
-// }
-//
-// public void testCancelDurable() throws Exception
-// {
-// AddressSettings addressSettings = new AddressSettings();
-// StorageManager sm = EasyMock.createStrictMock(StorageManager.class);
-// PostOffice po = EasyMock.createStrictMock(PostOffice.class);
-// HierarchicalRepository<AddressSettings> repos = EasyMock.createStrictMock(HierarchicalRepository.class);
-// ServerMessage serverMessage = EasyMock.createStrictMock(ServerMessage.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// MessageReferenceImpl messageReference = new DummyMessageReference(serverMessage, queue);
-// SimpleString queueName = new SimpleString("queueName");
-// queue.referenceCancelled();
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(repos.getMatch(queueName.toString())).andStubReturn(addressSettings);
-// EasyMock.expect(serverMessage.isDurable()).andStubReturn(true);
-// EasyMock.expect(serverMessage.getMessageID()).andStubReturn(999l);
-// EasyMock.expect(queue.isDurable()).andStubReturn(true);
-// sm.updateDeliveryCount(messageReference);
-// EasyMock.replay(sm, po, repos, serverMessage, queue);
-// assertTrue(messageReference.cancel(sm, po, repos));
-// EasyMock.verify(sm, po, repos, serverMessage, queue);
-// }
-//
-// public void testCancelNonDurable() throws Exception
-// {
-// AddressSettings addressSettings = new AddressSettings();
-// StorageManager sm = EasyMock.createStrictMock(StorageManager.class);
-// PostOffice po = EasyMock.createStrictMock(PostOffice.class);
-// HierarchicalRepository<AddressSettings> repos = EasyMock.createStrictMock(HierarchicalRepository.class);
-// ServerMessage serverMessage = EasyMock.createStrictMock(ServerMessage.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// MessageReferenceImpl messageReference = new DummyMessageReference(serverMessage, queue);
-// SimpleString queueName = new SimpleString("queueName");
-// queue.referenceCancelled();
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(repos.getMatch(queueName.toString())).andStubReturn(addressSettings);
-// EasyMock.expect(serverMessage.isDurable()).andStubReturn(false);
-// EasyMock.expect(serverMessage.getMessageID()).andStubReturn(999l);
-// EasyMock.expect(queue.isDurable()).andStubReturn(false);
-// EasyMock.replay(sm, po, repos, serverMessage, queue);
-// assertTrue(messageReference.cancel(sm, po, repos));
-// EasyMock.verify(sm, po, repos, serverMessage, queue);
-// }
-//
-// public void testCancelToDLQExists() throws Exception
-// {
-// AddressSettings addressSettings = new AddressSettings();
-// addressSettings.setMaxDeliveryAttempts(1);
-// SimpleString dlqName = new SimpleString("testDLQ");
-// addressSettings.setDeadLetterAddress(dlqName);
-//
-// Binding dlqBinding = EasyMock.createStrictMock(Binding.class);
-// //EasyMock.expect(dlqBinding.getAddress()).andReturn(dlqName);
-//
-// StorageManager sm = EasyMock.createNiceMock(StorageManager.class);
-//
-// PostOffice po = EasyMock.createStrictMock(PostOffice.class);
-// PagingManager pm = EasyMock.createNiceMock(PagingManager.class);
-// EasyMock.expect(pm.page(EasyMock.isA(ServerMessage.class))).andStubReturn(false);
-// EasyMock.expect(po.getPagingManager()).andStubReturn(pm);
-//
-//
-// HierarchicalRepository<AddressSettings> repos = EasyMock.createStrictMock(HierarchicalRepository.class);
-//
-// ServerMessage serverMessage = EasyMock.createNiceMock(ServerMessage.class);
-//
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-//
-// EasyMock.expect(queue.getPersistenceID()).andStubReturn(1);
-//
-// MessageReferenceImpl messageReference = new DummyMessageReference(serverMessage, queue);
-// messageReference.setDeliveryCount(1);
-//
-// SimpleString queueName = new SimpleString("queueName");
-//
-// queue.referenceAcknowledged(messageReference);
-//
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-//
-// EasyMock.expect(repos.getMatch(queueName.toString())).andStubReturn(addressSettings);
-//
-// EasyMock.expect(serverMessage.isDurable()).andStubReturn(true);
-//
-// EasyMock.expect(serverMessage.getMessageID()).andStubReturn(999l);
-//
-// EasyMock.expect(queue.isDurable()).andStubReturn(true);
-//
-// sm.updateDeliveryCount(messageReference);
-// List<Binding> bindings = new ArrayList<Binding>();
-// bindings.add(dlqBinding);
-// EasyMock.expect(po.getBindingsForAddress(dlqName)).andReturn(bindings);
-//
-// EasyMock.expect(serverMessage.copy()).andReturn(serverMessage);
-//
-// EasyMock.expect(sm.generateUniqueID()).andReturn(2l);
-//
-// //serverMessage.setMessageID(2);
-//
-// EasyMock.expect(serverMessage.getDestination()).andReturn(queueName);
-//
-// serverMessage.putStringProperty(MessageImpl.HDR_ORIGINAL_DESTINATION, queueName);
-// serverMessage.setExpiration(0);
-// serverMessage.setDestination(dlqName);
-//
-// EasyMock.expect(po.route(serverMessage)).andReturn(new ArrayList<MessageReference>());
-//
-// EasyMock.expect(serverMessage.getDurableRefCount()).andReturn(0);
-// EasyMock.expect(serverMessage.decrementDurableRefCount()).andReturn(0);
-//
-// EasyMock.expect(sm.generateUniqueID()).andReturn(1l);
-//
-// EasyMock.replay(sm, po, repos, serverMessage, queue, dlqBinding, pm);
-//
-//
-// assertFalse(messageReference.cancel(sm, po, repos));
-// EasyMock.verify(sm, po, repos, serverMessage, queue, dlqBinding, pm);
-// }
-//
-//
-// public void testExpire() throws Exception
-// {
-// AddressSettings addressSettings = new AddressSettings();
-// addressSettings.setMaxDeliveryAttempts(1);
-// SimpleString dlqName = new SimpleString("testDLQ");
-// addressSettings.setDeadLetterAddress(dlqName);
-// StorageManager sm = EasyMock.createNiceMock(StorageManager.class);
-//
-// PostOffice po = EasyMock.createStrictMock(PostOffice.class);
-// PagingManager pm = EasyMock.createNiceMock(PagingManager.class);
-// EasyMock.expect(pm.page(EasyMock.isA(ServerMessage.class))).andStubReturn(false);
-// EasyMock.expect(po.getPagingManager()).andStubReturn(pm);
-// EasyMock.expect(pm.isPaging(EasyMock.isA(SimpleString.class))).andStubReturn(false);
-// pm.messageDone(EasyMock.isA(ServerMessage.class));
-// EasyMock.expectLastCall().anyTimes();
-//
-// HierarchicalRepository<AddressSettings> repos = EasyMock.createStrictMock(HierarchicalRepository.class);
-// ServerMessage serverMessage = EasyMock.createStrictMock(ServerMessage.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-//
-// EasyMock.expect(queue.getPersistenceID()).andStubReturn(1);
-//
-// MessageReferenceImpl messageReference = new DummyMessageReference(serverMessage, queue);
-// messageReference.setDeliveryCount(1);
-// SimpleString queueName = new SimpleString("queueName");
-// queue.referenceAcknowledged(messageReference);
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(repos.getMatch(queueName.toString())).andStubReturn(addressSettings);
-// EasyMock.expect(serverMessage.isDurable()).andStubReturn(true);
-// EasyMock.expect(serverMessage.getMessageID()).andStubReturn(999l);
-// EasyMock.expect(queue.isDurable()).andStubReturn(true);
-// EasyMock.expect(serverMessage.decrementDurableRefCount()).andReturn(0);
-// EasyMock.expect(sm.generateUniqueID()).andReturn(1l);
-//
-// EasyMock.replay(sm, po, repos, serverMessage, queue, pm);
-// messageReference.expire(sm, po, repos);
-// EasyMock.verify(sm, po, repos, serverMessage, queue, pm);
-// }
-//
-// public void testExpireToQExists() throws Exception
-// {
-// AddressSettings addressSettings = new AddressSettings();
-// addressSettings.setMaxDeliveryAttempts(1);
-// SimpleString expQName = new SimpleString("testexpQ");
-// Binding expQBinding = EasyMock.createStrictMock(Binding.class);
-// addressSettings.setExpiryAddress(expQName);
-// StorageManager sm = EasyMock.createNiceMock(StorageManager.class);
-//
-// PostOffice po = EasyMock.createStrictMock(PostOffice.class);
-// PagingManager pm = EasyMock.createNiceMock(PagingManager.class);
-// EasyMock.expect(pm.page(EasyMock.isA(ServerMessage.class))).andStubReturn(false);
-// EasyMock.expect(po.getPagingManager()).andStubReturn(pm);
-// EasyMock.expect(pm.isPaging(EasyMock.isA(SimpleString.class))).andStubReturn(false);
-// pm.messageDone(EasyMock.isA(ServerMessage.class));
-// EasyMock.expectLastCall().anyTimes();
-//
-// HierarchicalRepository<AddressSettings> repos = EasyMock.createStrictMock(HierarchicalRepository.class);
-//
-// ServerMessage serverMessage = EasyMock.createNiceMock(ServerMessage.class);
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-//
-// EasyMock.expect(queue.getPersistenceID()).andStubReturn(1);
-//
-// MessageReferenceImpl messageReference = new DummyMessageReference(serverMessage, queue);
-// messageReference.setDeliveryCount(1);
-// SimpleString queueName = new SimpleString("queueName");
-// queue.referenceAcknowledged(messageReference);
-// EasyMock.expect(queue.getName()).andStubReturn(queueName);
-// EasyMock.expect(repos.getMatch(queueName.toString())).andStubReturn(addressSettings);
-// EasyMock.expect(serverMessage.isDurable()).andStubReturn(true);
-// EasyMock.expect(serverMessage.getMessageID()).andStubReturn(999l);
-// EasyMock.expect(queue.isDurable()).andStubReturn(true);
-// EasyMock.expect(sm.generateUniqueID()).andReturn(2l);
-// EasyMock.expect(sm.generateUniqueID()).andReturn(1l);
-// List<Binding> bindings = new ArrayList<Binding>();
-// bindings.add(expQBinding);
-// EasyMock.expect(po.getBindingsForAddress(expQName)).andReturn(bindings);
-// EasyMock.expect(serverMessage.copy()).andReturn(serverMessage);
-// //serverMessage.setMessageID(2);
-// EasyMock.expect(serverMessage.getDestination()).andReturn(queueName);
-// serverMessage.putStringProperty(MessageImpl.HDR_ORIGINAL_DESTINATION, queueName);
-// serverMessage.setExpiration(0);
-// serverMessage.putLongProperty(EasyMock.eq(MessageImpl.HDR_ACTUAL_EXPIRY_TIME), EasyMock.anyLong());
-// EasyMock.expect(expQBinding.getAddress()).andStubReturn(expQName);
-// serverMessage.setDestination(expQName);
-// EasyMock.expect(po.route(serverMessage)).andReturn(new ArrayList<MessageReference>());
-// EasyMock.expect(serverMessage.getDurableRefCount()).andReturn(0);
-// EasyMock.expect(serverMessage.decrementDurableRefCount()).andReturn(0);
-//
-// EasyMock.replay(sm, po, repos, serverMessage, queue, expQBinding, pm);
-//
-// messageReference.expire(sm, po, repos);
-//
-// EasyMock.verify(sm, po, repos, serverMessage, queue, expQBinding, pm);
-// }
-//
-//
-//
-// public void testMove() throws Exception
-// {
-// SimpleString fromAddress = RandomUtil.randomSimpleString();
-// SimpleString toAddress = RandomUtil.randomSimpleString();
-// long tid = RandomUtil.randomLong();
-// long messageID = RandomUtil.randomLong();
-// long newMessageID = RandomUtil.randomLong();
-//
-// Queue queue = EasyMock.createStrictMock(Queue.class);
-// Binding toBinding = EasyMock.createStrictMock(Binding.class);
-// Queue toQueue = EasyMock.createStrictMock(Queue.class);
-// PostOffice postOffice = EasyMock.createMock(PostOffice.class);
-//
-//
-// PagingManager pm = EasyMock.createNiceMock(PagingManager.class);
-// EasyMock.expect(pm.page(EasyMock.isA(ServerMessage.class))).andStubReturn(false);
-// EasyMock.expect(postOffice.getPagingManager()).andStubReturn(pm);
-// EasyMock.expect(pm.isPaging(EasyMock.isA(SimpleString.class))).andStubReturn(false);
-// pm.messageDone(EasyMock.isA(ServerMessage.class));
-// EasyMock.expectLastCall().anyTimes();
-//
-// StorageManager persistenceManager = EasyMock.createMock(StorageManager.class);
-// ServerMessage serverMessage = EasyMock.createNiceMock(ServerMessage.class);
-// EasyMock.expect(serverMessage.getMessageID()).andStubReturn(1l);
-// MessageReferenceImpl messageReference = new DummyMessageReference(serverMessage, queue);
-// ServerMessage copyMessage = EasyMock.createNiceMock(ServerMessage.class);
-// EasyMock.expect(copyMessage.getMessageID()).andStubReturn(1l);
-//
-// EasyMock.expect(persistenceManager.generateUniqueID()).andReturn(tid);
-// EasyMock.expect(serverMessage.copy()).andReturn(copyMessage);
-// EasyMock.expect(persistenceManager.generateUniqueID()).andReturn(newMessageID);
-// copyMessage.setMessageID(newMessageID);
-// EasyMock.expect(copyMessage.getDestination()).andReturn(fromAddress);
-// copyMessage.putStringProperty(MessageImpl.HDR_ORIGINAL_DESTINATION, fromAddress);
-// copyMessage.setExpiration(0);
-// EasyMock.expect(toBinding.getAddress()).andStubReturn(toAddress);
-// copyMessage.setDestination(toAddress);
-// EasyMock.expect(postOffice.route(copyMessage)).andReturn(new ArrayList<MessageReference>());
-// EasyMock.expect(copyMessage.getDurableRefCount()).andReturn(0);
-// EasyMock.expect(serverMessage.isDurable()).andStubReturn(false);
-// EasyMock.expect(serverMessage.getMessageID()).andReturn(messageID);
-// queue.referenceAcknowledged(messageReference);
-//
-// EasyMock.replay(queue, toBinding, toQueue, postOffice, persistenceManager, serverMessage, copyMessage, pm);
-//
-// messageReference.move(toAddress, persistenceManager, postOffice);
-//
-// EasyMock.verify(queue, toBinding, toQueue, postOffice, persistenceManager, serverMessage, copyMessage, pm);
-// }
-//
-// //we need to override the constructor for creation
-// class DummyMessageReference extends MessageReferenceImpl
-// {
-// protected DummyMessageReference(ServerMessage message, Queue queue)
-// {
-// super(message, queue);
-// }
-// }
-
- public void testFoo()
- {
- }
-}
Deleted: trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/QueueFactoryImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/QueueFactoryImplTest.java 2009-05-27 12:05:59 UTC (rev 7067)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/QueueFactoryImplTest.java 2009-05-27 12:43:11 UTC (rev 7068)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.tests.unit.core.server.impl;
-
-import java.util.concurrent.ScheduledExecutorService;
-
-import org.easymock.EasyMock;
-import org.jboss.messaging.core.filter.Filter;
-import org.jboss.messaging.core.persistence.StorageManager;
-import org.jboss.messaging.core.server.Queue;
-import org.jboss.messaging.core.server.impl.QueueFactoryImpl;
-import org.jboss.messaging.core.server.impl.RoundRobinDistributor;
-import org.jboss.messaging.core.settings.HierarchicalRepository;
-import org.jboss.messaging.core.settings.impl.AddressSettings;
-import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.utils.SimpleString;
-
-/**
- * @author <a href="ataylor at redhat.com">Andy Taylor</a>
- */
-public class QueueFactoryImplTest extends UnitTestCase
-{
- public void testCreateQueue()
- {
- ScheduledExecutorService scheduledExecutor = EasyMock.createStrictMock(ScheduledExecutorService.class);
- HierarchicalRepository<AddressSettings> addressSettingsRepository = EasyMock.createStrictMock(HierarchicalRepository.class);
- StorageManager sm = EasyMock.createStrictMock(StorageManager.class);
- Filter filter = EasyMock.createStrictMock(Filter.class);
- AddressSettings addressSettings = new AddressSettings();
- addressSettings.setMaxSizeBytes(9999);
- addressSettings.setDistributionPolicyClass("org.jboss.messaging.core.server.impl.RoundRobinDistributor");
- EasyMock.expect(addressSettingsRepository.getMatch("testQ")).andReturn(addressSettings);
- EasyMock.replay(scheduledExecutor, addressSettingsRepository);
- QueueFactoryImpl queueFactory = new QueueFactoryImpl(scheduledExecutor, addressSettingsRepository, sm);
- SimpleString qName = new SimpleString("testQ");
- Queue queue = queueFactory.createQueue(123, qName, qName, filter, true, false);
- EasyMock.verify(scheduledExecutor, addressSettingsRepository);
- assertEquals(queue.getDistributionPolicy().getClass(), RoundRobinDistributor.class);
- assertEquals(queue.getName(), qName);
- assertEquals(queue.getPersistenceID(), 123);
- assertEquals(queue.getFilter(), filter);
- assertEquals(queue.isDurable(), true);
- assertEquals(queue.isDurable(), true);
- }
-
- public void testCreateQueue2()
- {
- ScheduledExecutorService scheduledExecutor = EasyMock.createStrictMock(ScheduledExecutorService.class);
- HierarchicalRepository<AddressSettings> addressSettingsRepository = EasyMock.createStrictMock(HierarchicalRepository.class);
- StorageManager sm = EasyMock.createStrictMock(StorageManager.class);
- AddressSettings addressSettings = new AddressSettings();
- addressSettings.setMaxSizeBytes(8888);
- addressSettings.setDistributionPolicyClass(null);
- EasyMock.expect(addressSettingsRepository.getMatch("testQ2")).andReturn(addressSettings);
- EasyMock.replay(scheduledExecutor, addressSettingsRepository);
- QueueFactoryImpl queueFactory = new QueueFactoryImpl(scheduledExecutor, addressSettingsRepository, sm);
- SimpleString qName = new SimpleString("testQ2");
- Queue queue = queueFactory.createQueue(456, qName, qName, null, false, false);
- EasyMock.verify(scheduledExecutor, addressSettingsRepository);
- assertEquals(queue.getDistributionPolicy().getClass(), RoundRobinDistributor.class);
- assertEquals(queue.getName(), qName);
- assertEquals(queue.getPersistenceID(), 456);
- assertEquals(queue.getFilter(), null);
- assertEquals(queue.isDurable(), false);
- assertEquals(queue.isDurable(), false);
- }
-}
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/QueueImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/QueueImplTest.java 2009-05-27 12:05:59 UTC (rev 7067)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/server/impl/QueueImplTest.java 2009-05-27 12:43:11 UTC (rev 7068)
@@ -712,90 +712,6 @@
}
}
-// public void testDeleteAllReferences() throws Exception
-// {
-// Queue queue = new QueueImpl(1, address1, queue1, null, false, true, scheduledExecutor, createMockPostOffice(), null);
-//
-// StorageManager storageManager = EasyMock.createStrictMock(StorageManager.class);
-//
-// final int numMessages = 10;
-//
-// List<MessageReference> refs = new ArrayList<MessageReference>();
-//
-// for (int i = 0; i < numMessages; i++)
-// {
-// MessageReference ref = generateReference(queue, i);
-//
-// ref.getMessage().setDurable(i % 2 == 0);
-//
-// refs.add(ref);
-//
-// queue.addLast(ref);
-// }
-//
-// //Add some scheduled too
-//
-// final int numScheduled = 10;
-//
-// for (int i = numMessages; i < numMessages + numScheduled; i++)
-// {
-// MessageReference ref = generateReference(queue, i);
-//
-// ref.setScheduledDeliveryTime(System.currentTimeMillis() + 1000000000);
-//
-// ref.getMessage().setDurable(i % 2 == 0);
-//
-// refs.add(ref);
-//
-// queue.addLast(ref);
-// }
-//
-//
-// assertEquals(numMessages + numScheduled, queue.getMessageCount());
-// assertEquals(numScheduled, queue.getScheduledCount());
-// assertEquals(0, queue.getDeliveringCount());
-//
-// //What I expect to get
-//
-// EasyMock.expect(storageManager.generateUniqueID()).andReturn(1L);
-//
-// for (int i = 0; i < numMessages; i++)
-// {
-// if (i % 2 == 0)
-// {
-// storageManager.deleteMessageTransactional(1, queue.getPersistenceID(), i);
-// }
-// }
-//
-// for (int i = numMessages; i < numMessages + numScheduled; i++)
-// {
-// if (i % 2 == 0)
-// {
-// storageManager.deleteMessageTransactional(1, queue.getPersistenceID(), i);
-// }
-// }
-//
-// storageManager.commit(1);
-//
-// EasyMock.replay(storageManager);
-//
-// queue.deleteAllReferences(storageManager, postOffice, repository);
-//
-// EasyMock.verify(storageManager);
-//
-// assertEquals(0, queue.getMessageCount());
-// assertEquals(0, queue.getScheduledCount());
-// assertEquals(0, queue.getDeliveringCount());
-//
-// FakeConsumer consumer = new FakeConsumer();
-//
-// queue.addConsumer(consumer);
-//
-// queue.deliverNow();
-//
-// assertTrue(consumer.getReferences().isEmpty());
-// }
-
public void testWithPriorities() throws Exception
{
Queue queue = new QueueImpl(1, address1, queue1, null, false, true, scheduledExecutor, null, null, null);
@@ -1151,216 +1067,6 @@
}
-// public void testConsumerRemovedAfterException() throws Exception
-// {
-// Consumer consumer = EasyMock.createStrictMock(Consumer.class);
-// Queue queue = new QueueImpl(1, address1, queue1, null, false, true, scheduledExecutor, null, null, null);
-// MessageReference messageReference = generateReference(queue, 1);
-// MessageReference messageReference2 = generateReference(queue, 2);
-// MessageReference messageReference3 = generateReference(queue, 3);
-// LinkedList<MessageReference> messageReferences = new LinkedList<MessageReference>();
-// messageReferences.add(messageReference);
-// messageReferences.add(messageReference2);
-// messageReferences.add(messageReference3);
-// EasyMock.expect(consumer.handle(messageReference)).andReturn(HandleStatus.HANDLED);
-// EasyMock.expect(consumer.handle(messageReference2)).andThrow(new RuntimeException());
-// EasyMock.replay(consumer);
-// queue.addConsumer(consumer);
-// queue.addListFirst(messageReferences);
-// EasyMock.verify(consumer);
-//
-// }
-//
-// public void testDeliveryAsync() throws Exception
-// {
-// Consumer consumer = EasyMock.createStrictMock(Consumer.class);
-// Queue queue = new QueueImpl(1, address1, queue1, null, false, true, scheduledExecutor, null, null, null);
-// MessageReference messageReference = generateReference(queue, 1);
-// MessageReference messageReference2 = generateReference(queue, 2);
-// MessageReference messageReference3 = generateReference(queue, 3);
-// LinkedList<MessageReference> messageReferences = new LinkedList<MessageReference>();
-// messageReferences.add(messageReference);
-// messageReferences.add(messageReference2);
-// messageReferences.add(messageReference3);
-// EasyMock.expect(consumer.handle(messageReference)).andReturn(HandleStatus.HANDLED);
-// EasyMock.expect(consumer.handle(messageReference2)).andReturn(HandleStatus.HANDLED);
-// EasyMock.expect(consumer.handle(messageReference3)).andReturn(HandleStatus.HANDLED);
-// EasyMock.replay(consumer);
-// queue.addListFirst(messageReferences);
-// queue.addConsumer(consumer);
-// queue.deliverAsync(new Executor()
-// {
-// public void execute(Runnable command)
-// {
-// command.run();
-// }
-// });
-// EasyMock.verify(consumer);
-//
-// }
-
-// public void testExpireMessage() throws Exception
-// {
-// long messageID = randomLong();
-// final SimpleString expiryQueue = new SimpleString("expiryQueue");
-// Queue queue = new QueueImpl(1, address1, queue1, null, false, true, scheduledExecutor, createMockPostOffice());
-// MessageReference messageReference = generateReference(queue, messageID);
-// StorageManager storageManager = EasyMock.createMock(StorageManager.class);
-// EasyMock.expect(storageManager.generateUniqueID()).andReturn(randomLong());
-// EasyMock.expect(storageManager.generateUniqueID()).andReturn(randomLong());
-// storageManager.deleteMessageTransactional(EasyMock.anyLong(), EasyMock.eq(queue.getPersistenceID()), EasyMock.eq(messageID));
-// storageManager.commit(EasyMock.anyLong());
-//
-// PostOffice postOffice = EasyMock.createNiceMock(PostOffice.class);
-// PagingManager pm = EasyMock.createNiceMock(PagingManager.class);
-// EasyMock.expect(pm.page(EasyMock.isA(ServerMessage.class))).andStubReturn(false);
-// EasyMock.expect(postOffice.getPagingManager()).andStubReturn(pm);
-// EasyMock.expect(pm.isPaging(EasyMock.isA(SimpleString.class))).andStubReturn(false);
-// pm.messageDone(EasyMock.isA(ServerMessage.class));
-// EasyMock.expectLastCall().anyTimes();
-//
-//
-//
-// Binding expiryBinding = createMock(Binding.class);
-// EasyMock.expect(expiryBinding.getAddress()).andStubReturn(expiryQueue);
-// Bindings bindings = new BindingsImpl();
-// bindings.addBinding(expiryBinding);
-// EasyMock.expect(postOffice.getBindingsForAddress(expiryQueue)).andReturn(bindings);
-// EasyMock.expect(postOffice.route(EasyMock.isA(ServerMessage.class))).andReturn(new ArrayList<MessageReference>());
-// HierarchicalRepository<QueueSettings> addressSettingsRepository = createMock(HierarchicalRepository.class);
-// QueueSettings QueueSettings = new QueueSettings()
-// {
-// @Override
-// public SimpleString getExpiryAddress()
-// {
-// return expiryQueue;
-// }
-// };
-// EasyMock.expect(addressSettingsRepository.getMatch(queue1.toString())).andStubReturn(QueueSettings);
-//
-// EasyMock.replay(storageManager, postOffice, addressSettingsRepository, expiryBinding, pm);
-//
-// assertEquals(0, queue.getMessageCount());
-// assertEquals(0, queue.getDeliveringCount());
-//
-// queue.addLast(messageReference);
-//
-// assertEquals(1, queue.getMessageCount());
-// assertEquals(0, queue.getDeliveringCount());
-//
-// queue.expireMessage(messageID, storageManager , postOffice, addressSettingsRepository);
-//
-// assertEquals(0, queue.getMessageCount());
-// assertEquals(0, queue.getDeliveringCount());
-//
-// EasyMock.verify(storageManager, postOffice, addressSettingsRepository, expiryBinding, pm);
-// }
-//
-// public void testSendMessageToDLQ() throws Exception
-// {
-// long messageID = randomLong();
-// final SimpleString dlqName = new SimpleString("dlq");
-// Queue queue = new QueueImpl(1, address1, queue1, null, false, true, scheduledExecutor, createMockPostOffice());
-// MessageReference messageReference = generateReference(queue, messageID);
-// StorageManager storageManager = createMock(StorageManager.class);
-// expect(storageManager.generateUniqueID()).andReturn(randomLong());
-// expect(storageManager.generateUniqueID()).andReturn(randomLong());
-// storageManager.deleteMessageTransactional(anyLong(), eq(queue.getPersistenceID()), eq(messageID));
-// storageManager.commit(anyLong());
-//
-// PostOffice postOffice = EasyMock.createNiceMock(PostOffice.class);
-// PagingManager pm = EasyMock.createNiceMock(PagingManager.class);
-// EasyMock.expect(pm.page(EasyMock.isA(ServerMessage.class))).andStubReturn(false);
-// EasyMock.expect(postOffice.getPagingManager()).andStubReturn(pm);
-// EasyMock.expect(pm.isPaging(EasyMock.isA(SimpleString.class))).andStubReturn(false);
-// pm.messageDone(EasyMock.isA(ServerMessage.class));
-// EasyMock.expectLastCall().anyTimes();
-//
-//
-// Binding dlqBinding = createMock(Binding.class);
-// expect(dlqBinding.getAddress()).andStubReturn(dlqName);
-// Bindings bindings = new BindingsImpl();
-// bindings.addBinding(dlqBinding);
-// expect(postOffice.getBindingsForAddress(dlqName)).andReturn(bindings);
-// expect(postOffice.route(isA(ServerMessage.class))).andReturn(new ArrayList<MessageReference>());
-// HierarchicalRepository<QueueSettings> addressSettingsRepository = createMock(HierarchicalRepository.class);
-// QueueSettings QueueSettings = new QueueSettings()
-// {
-// @Override
-// public SimpleString getDeadLetterAddress()
-// {
-// return dlqName;
-// }
-// };
-// EasyMock.expect(addressSettingsRepository.getMatch(queue1.toString())).andStubReturn(QueueSettings);
-//
-// EasyMock.replay(storageManager, postOffice, addressSettingsRepository, dlqBinding, pm);
-//
-// assertEquals(0, queue.getMessageCount());
-// assertEquals(0, queue.getDeliveringCount());
-//
-// queue.addLast(messageReference);
-//
-// assertEquals(1, queue.getMessageCount());
-// assertEquals(0, queue.getDeliveringCount());
-//
-// queue.sendMessageToDeadLetterAddress(messageID, storageManager , postOffice, addressSettingsRepository);
-//
-// assertEquals(0, queue.getMessageCount());
-// assertEquals(0, queue.getDeliveringCount());
-//
-// EasyMock.verify(storageManager, postOffice, addressSettingsRepository, dlqBinding, pm);
-// }
-
-// public void testMoveMessage() throws Exception
-// {
-// long messageID = randomLong();
-// long newMessageID = randomLong();
-// long tid = randomLong();
-// final SimpleString toQueueName = new SimpleString("toQueueName");
-// Queue queue = new QueueImpl(1, address1, queue1, null, false, true, scheduledExecutor, createMockPostOffice(), null);
-// Queue toQueue = createMock(Queue.class);
-//
-// MessageReference messageReference = generateReference(queue, messageID);
-// StorageManager storageManager = EasyMock.createMock(StorageManager.class);
-// EasyMock.expect(storageManager.generateUniqueID()).andReturn(newMessageID);
-// EasyMock.expect(storageManager.generateUniqueID()).andReturn(tid);
-// storageManager.deleteMessageTransactional(EasyMock.anyLong(), EasyMock.eq(queue.getPersistenceID()), EasyMock.eq(messageID));
-// storageManager.commit(EasyMock.anyLong());
-//
-// PostOffice postOffice = EasyMock.createNiceMock(PostOffice.class);
-//
-// PagingManager pm = EasyMock.createNiceMock(PagingManager.class);
-// EasyMock.expect(pm.page(EasyMock.isA(ServerMessage.class), EasyMock.eq(true))).andStubReturn(false);
-// EasyMock.expect(postOffice.getPagingManager()).andStubReturn(pm);
-// EasyMock.expect(pm.isPaging(EasyMock.isA(SimpleString.class))).andStubReturn(false);
-// pm.messageDone(EasyMock.isA(ServerMessage.class));
-// EasyMock.expectLastCall().anyTimes();
-//
-//
-// Binding toBinding = EasyMock.createMock(Binding.class);
-// EasyMock.expect(toBinding.getAddress()).andStubReturn(toQueueName);
-// EasyMock.expect(toBinding.getBindable()).andStubReturn(toQueue);
-// postOffice.route(EasyMock.isA(ServerMessage.class), EasyMock.isA(Transaction.class));
-// HierarchicalRepository<QueueSettings> addressSettingsRepository = EasyMock.createMock(HierarchicalRepository.class);
-//
-// EasyMock.replay(storageManager, postOffice, addressSettingsRepository, toBinding, pm);
-//
-// assertEquals(0, queue.getMessageCount());
-// assertEquals(0, queue.getDeliveringCount());
-//
-// queue.addLast(messageReference);
-//
-// assertEquals(1, queue.getMessageCount());
-// assertEquals(0, queue.getDeliveringCount());
-//
-// queue.moveMessage(messageID, toQueueName, storageManager, postOffice);
-//
-// assertEquals(0, queue.getMessageCount());
-// assertEquals(0, queue.getDeliveringCount());
-//
-// EasyMock.verify(storageManager, postOffice, addressSettingsRepository, toBinding, pm);
-// }
/**
* @return
More information about the jboss-cvs-commits
mailing list