Search in sources :

Example 1 with RemoteQueueBindingImpl

use of org.apache.activemq.artemis.core.server.cluster.impl.RemoteQueueBindingImpl in project activemq-artemis by apache.

the class RemoteQueueBindImplTest method testAddRemoveConsumer.

// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
@Test
public void testAddRemoveConsumer() throws Exception {
    final long id = RandomUtil.randomLong();
    final SimpleString address = RandomUtil.randomSimpleString();
    final SimpleString uniqueName = RandomUtil.randomSimpleString();
    final SimpleString routingName = RandomUtil.randomSimpleString();
    final Long remoteQueueID = RandomUtil.randomLong();
    final SimpleString filterString = new SimpleString("A>B");
    final Queue storeAndForwardQueue = new FakeQueue(null);
    final SimpleString bridgeName = RandomUtil.randomSimpleString();
    final int distance = 0;
    RemoteQueueBindingImpl binding = new RemoteQueueBindingImpl(id, address, uniqueName, routingName, remoteQueueID, filterString, storeAndForwardQueue, bridgeName, distance);
    for (int i = 0; i < 100; i++) {
        binding.addConsumer(new SimpleString("B" + i + "<A"));
    }
    assertEquals(100, binding.getFilters().size());
    for (int i = 0; i < 100; i++) {
        binding.removeConsumer(new SimpleString("B" + i + "<A"));
    }
    assertEquals(0, binding.getFilters().size());
}
Also used : FakeQueue(org.apache.activemq.artemis.tests.unit.core.postoffice.impl.FakeQueue) RemoteQueueBindingImpl(org.apache.activemq.artemis.core.server.cluster.impl.RemoteQueueBindingImpl) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) Queue(org.apache.activemq.artemis.core.server.Queue) FakeQueue(org.apache.activemq.artemis.tests.unit.core.postoffice.impl.FakeQueue) Test(org.junit.Test)

Aggregations

SimpleString (org.apache.activemq.artemis.api.core.SimpleString)1 Queue (org.apache.activemq.artemis.core.server.Queue)1 RemoteQueueBindingImpl (org.apache.activemq.artemis.core.server.cluster.impl.RemoteQueueBindingImpl)1 FakeQueue (org.apache.activemq.artemis.tests.unit.core.postoffice.impl.FakeQueue)1 Test (org.junit.Test)1