Package org.apache.qpid.server.queue

Examples of org.apache.qpid.server.queue.AMQQueue


    }


    public void testMidHash() throws AMQException
    {
        AMQQueue queue = _vhost.createQueue(UUIDGenerator.generateRandomUUID(), "a", false, null, false, false,
                false, null);
        _exchange.registerQueue(new Binding(null, "a.*.#.b",queue, _exchange, null));

        routeMessage("a.c.d.b",0l);

        Assert.assertEquals(1, queue.getMessageCount());

        Assert.assertEquals("Wrong message received", 0l, queue.getMessagesOnTheQueue().get(0).getMessage().getMessageNumber());

        queue.deleteMessageFromTop();
        Assert.assertEquals(0, queue.getMessageCount());

        routeMessage("a.c.b",1l);

        Assert.assertEquals(1, queue.getMessageCount());

        Assert.assertEquals("Wrong message received", 1l, queue.getMessagesOnTheQueue().get(0).getMessage().getMessageNumber());

        queue.deleteMessageFromTop();
        Assert.assertEquals(0, queue.getMessageCount());

    }
View Full Code Here


    }

    public void testMatchafterHash() throws AMQException
    {
        AMQQueue queue = _vhost.createQueue(UUIDGenerator.generateRandomUUID(), "a#", false, null, false, false,
                false, null);
        _exchange.registerQueue(new Binding(null, "a.*.#.b.c",queue, _exchange, null));


        int queueCount = routeMessage("a.c.b.b",0l);
        Assert.assertEquals("Message should not route to any queues", 0, queueCount);

        Assert.assertEquals(0, queue.getMessageCount());


        routeMessage("a.a.b.c",1l);

        Assert.assertEquals(1, queue.getMessageCount());

        Assert.assertEquals("Wrong message received", 1l, queue.getMessagesOnTheQueue().get(0).getMessage().getMessageNumber());

        queue.deleteMessageFromTop();
        Assert.assertEquals(0, queue.getMessageCount());

        queueCount = routeMessage("a.b.c.b",2l);
        Assert.assertEquals("Message should not route to any queues", 0, queueCount);

        Assert.assertEquals(0, queue.getMessageCount());

        routeMessage("a.b.c.b.c",3l);

        Assert.assertEquals(1, queue.getMessageCount());

        Assert.assertEquals("Wrong message received", 3l, queue.getMessagesOnTheQueue().get(0).getMessage().getMessageNumber());

        queue.deleteMessageFromTop();
        Assert.assertEquals(0, queue.getMessageCount());

    }
View Full Code Here

    }


    public void testHashAfterHash() throws AMQException
    {
        AMQQueue queue = _vhost.createQueue(UUIDGenerator.generateRandomUUID(), "a#", false, null, false, false,
                false, null);
        _exchange.registerQueue(new Binding(null, "a.*.#.b.c.#.d",queue, _exchange, null));

        int queueCount = routeMessage("a.c.b.b.c",0l);
        Assert.assertEquals("Message should not route to any queues", 0, queueCount);

        Assert.assertEquals(0, queue.getMessageCount());

        routeMessage("a.a.b.c.d",1l);

        Assert.assertEquals(1, queue.getMessageCount());

        Assert.assertEquals("Wrong message received", 1l, queue.getMessagesOnTheQueue().get(0).getMessage().getMessageNumber());

        queue.deleteMessageFromTop();
        Assert.assertEquals(0, queue.getMessageCount());

    }
View Full Code Here

    }

    public void testHashHash() throws AMQException
    {
        AMQQueue queue = _vhost.createQueue(UUIDGenerator.generateRandomUUID(), "a#", false, null, false, false,
                false, null);
        _exchange.registerQueue(new Binding(null, "a.#.*.#.d",queue, _exchange, null));

        int queueCount = routeMessage("a.c.b.b.c",0l);
        Assert.assertEquals("Message should not route to any queues", 0, queueCount);

        Assert.assertEquals(0, queue.getMessageCount());

        routeMessage("a.a.b.c.d",1l);

        Assert.assertEquals(1, queue.getMessageCount());

        Assert.assertEquals("Wrong message received", 1l, queue.getMessagesOnTheQueue().get(0).getMessage().getMessageNumber());

        queue.deleteMessageFromTop();
        Assert.assertEquals(0, queue.getMessageCount());

    }
View Full Code Here

    }

    public void testSubMatchFails() throws AMQException
    {
        AMQQueue queue = _vhost.createQueue(UUIDGenerator.generateRandomUUID(), "a", false, null, false, false,
                false, null);
        _exchange.registerQueue(new Binding(null, "a.b.c.d",queue, _exchange, null));

        int queueCount = routeMessage("a.b.c",0l);
        Assert.assertEquals("Message should not route to any queues", 0, queueCount);

        Assert.assertEquals(0, queue.getMessageCount());

    }
View Full Code Here

        return queues.size();
    }

    public void testMoreRouting() throws AMQException
    {
        AMQQueue queue = _vhost.createQueue(UUIDGenerator.generateRandomUUID(), "a", false, null, false, false,
                false, null);
        _exchange.registerQueue(new Binding(null, "a.b",queue, _exchange, null));


        int queueCount = routeMessage("a.b.c",0l);
        Assert.assertEquals("Message should not route to any queues", 0, queueCount);

        Assert.assertEquals(0, queue.getMessageCount());

    }
View Full Code Here

    }

    public void testMoreQueue() throws AMQException
    {
        AMQQueue queue = _vhost.createQueue(UUIDGenerator.generateRandomUUID(), "a", false, null, false, false,
                false, null);
        _exchange.registerQueue(new Binding(null, "a.b",queue, _exchange, null));


        int queueCount = routeMessage("a",0l);
        Assert.assertEquals("Message should not route to any queues", 0, queueCount);

        Assert.assertEquals(0, queue.getMessageCount());

    }
View Full Code Here

    }

    @Override
    public List<AMQQueue> route(InboundMessage message)
    {
        AMQQueue q = _virtualHost.getQueue(message.getRoutingKey());
        if(q == null)
        {
            List<AMQQueue> noQueues = Collections.emptyList();
            return noQueues;
        }
View Full Code Here

    }

    protected void onBind(final Binding binding)
    {
        String bindingKey = binding.getBindingKey();
        AMQQueue queue = binding.getQueue();
        Map<String,Object> args = binding.getArguments();

        assert queue != null;
        assert bindingKey != null;

        CopyOnWriteArraySet<Binding> bindings = _bindingsByKey.get(bindingKey);

        if(bindings == null)
        {
            bindings = new CopyOnWriteArraySet<Binding>();
            CopyOnWriteArraySet<Binding> newBindings;
            if((newBindings = _bindingsByKey.putIfAbsent(bindingKey, bindings)) != null)
            {
                bindings = newBindings;
            }
        }

        if(_logger.isDebugEnabled())
        {
            _logger.debug("Exchange " + getName() + ": Binding " + queue.getName() +
                          " with binding key '" +bindingKey + "' and args: " + args);
        }

        _bindingHeaderMatchers.add(new HeadersBinding(binding));
        bindings.add(binding);
View Full Code Here

    }

    private AMQQueue createAndBind(final String name, Map<String, Object> arguments)
            throws Exception
    {
        AMQQueue q = create(name);
        bind(name, arguments, q);
        return q;
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.queue.AMQQueue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.