Package org.apache.qpid.server.binding

Examples of org.apache.qpid.server.binding.Binding


     */
    private void validateBindingProperties(List<Binding> bindings, boolean useSelectors)
    {
        assertEquals("Each queue should only be bound once.", 1, bindings.size());

        Binding binding = bindings.get(0);

        if (useSelectors)
        {
            assertTrue("Binding does not contain a Selector argument.",
                    binding.getArguments().containsKey(AMQPFilterTypes.JMS_SELECTOR.toString()));
            assertEquals("The binding selector argument is incorrect", SELECTOR_VALUE,
                    binding.getArguments().get(AMQPFilterTypes.JMS_SELECTOR.toString()).toString());
        }
    }
View Full Code Here


            if (!exch.isBound(bindingKey, arguments, queue))
            {

                if(!exch.addBinding(bindingKey, queue, arguments) && TopicExchange.TYPE.equals(exch.getType()))
                {
                    Binding oldBinding = exch.getBinding(bindingKey, queue, arguments);

                    Map<String, Object> oldArgs = oldBinding.getArguments();
                    if((oldArgs == null && !arguments.isEmpty()) || (oldArgs != null && !oldArgs.equals(arguments)))
                    {
                        exch.replaceBinding(oldBinding.getId(), bindingKey, queue, arguments);
                    }
                }
            }
        }
        catch (AMQException e)
View Full Code Here

    }

    public void testBindQueue() throws Exception
    {
        AMQQueue queue = createTestQueue(QUEUE_NAME, "queueOwner", false, null);
        Binding binding = new Binding(UUIDGenerator.generateRandomUUID(), ROUTING_KEY, queue,
                _exchange, _bindingArgs);
        DurableConfigurationStoreHelper.createBinding(_configStore, binding);

        reopenStore();

        Map<String,Object> map = new HashMap<String, Object>();
        map.put(org.apache.qpid.server.model.Binding.EXCHANGE, _exchange.getId().toString());
        map.put(org.apache.qpid.server.model.Binding.QUEUE, queue.getId().toString());
        map.put(org.apache.qpid.server.model.Binding.NAME, ROUTING_KEY);
        map.put(org.apache.qpid.server.model.Binding.ARGUMENTS,_bindingArgs);

        verify(_recoveryHandler).configuredObject(eq(binding.getId()), eq(BINDING),
                eq(map));
    }
View Full Code Here

    }

    public void testUnbindQueue() throws Exception
    {
        AMQQueue queue = createTestQueue(QUEUE_NAME, "queueOwner", false, null);
        Binding binding = new Binding(UUIDGenerator.generateRandomUUID(), ROUTING_KEY, queue,
                _exchange, _bindingArgs);
        DurableConfigurationStoreHelper.createBinding(_configStore, binding);

        DurableConfigurationStoreHelper.removeBinding(_configStore, binding);
        reopenStore();
View Full Code Here

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


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

        Assert.assertEquals(0, queue.getMessageCount());
View Full Code Here

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


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

        Assert.assertEquals(1, queue.getMessageCount());
View Full Code Here


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


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

        Assert.assertEquals(1, queue.getMessageCount());
View Full Code Here

    }

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


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

        Assert.assertEquals(1, queue.getMessageCount());
View Full Code Here

    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());

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);

View Full Code Here

TOP

Related Classes of org.apache.qpid.server.binding.Binding

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.