Package org.apache.qpid.server.binding

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


    public void testBindQueue() throws Exception
    {
        ExchangeImpl<?> exchange = createTestExchange();
        AMQQueue queue = createTestQueue(QUEUE_NAME, "queueOwner", false, null);
        BindingImpl binding = createBinding(UUIDGenerator.generateRandomUUID(), ROUTING_KEY, queue,
                                            exchange, _bindingArgs);
        _configStore.create(exchange.asObjectRecord());
        _configStore.create(queue.asObjectRecord());
        _configStore.create(binding.asObjectRecord());

        reopenStore();
        _configStore.visitConfiguredObjectRecords(_handler);

        Map<String,Object> map = new HashMap<String, Object>();
        map.put(Binding.NAME, ROUTING_KEY);
        map.put(Binding.ARGUMENTS,_bindingArgs);
        map.put(Binding.DURABLE,true);

        Map<String,UUID> parents = new HashMap<String, UUID>();

        parents.put(Exchange.class.getSimpleName(), exchange.getId());
        parents.put(Queue.class.getSimpleName(), queue.getId());

        verify(_handler).handle(matchesRecord(binding.getId(), BINDING, map, parents));
    }
View Full Code Here


    {
        ExchangeImpl<?> exchange = createTestExchange();
        _configStore.create(exchange.asObjectRecord());

        AMQQueue queue = createTestQueue(QUEUE_NAME, "queueOwner", false, null);
        BindingImpl binding = createBinding(UUIDGenerator.generateRandomUUID(), ROUTING_KEY, queue,
                                            exchange, _bindingArgs);
        _configStore.create(binding.asObjectRecord());

        _configStore.remove(binding.asObjectRecord());
        reopenStore();

        verify(_handler, never()).handle(matchesRecord(ANY_UUID, BINDING,
                                                                         ANY_MAP));
    }
View Full Code Here

        if(arguments != null)
        {
            attributes.put(Binding.ARGUMENTS, arguments);
        }
        attributes.put(Binding.ID, id);
        return new BindingImpl(attributes, queue, exchange);
    }
View Full Code Here

    public void testBindQueue() throws Exception
    {
        ExchangeImpl<?> exchange = createTestExchange();
        AMQQueue queue = createTestQueue(QUEUE_NAME, "queueOwner", false, null);
        BindingImpl binding = createBinding(UUIDGenerator.generateRandomUUID(), ROUTING_KEY, queue,
                                            exchange, _bindingArgs);
        _configStore.create(exchange.asObjectRecord());
        _configStore.create(queue.asObjectRecord());
        _configStore.create(binding.asObjectRecord());

        reopenStore();
        _configStore.visitConfiguredObjectRecords(_handler);

        Map<String,Object> map = new HashMap<String, Object>();
        map.put(Binding.NAME, ROUTING_KEY);
        map.put(Binding.ARGUMENTS,_bindingArgs);
        map.put(Binding.DURABLE,true);
        map.put(Binding.TYPE, Binding.class.getSimpleName());

        Map<String,UUID> parents = new HashMap<String, UUID>();

        parents.put(Exchange.class.getSimpleName(), exchange.getId());
        parents.put(Queue.class.getSimpleName(), queue.getId());

        verify(_handler).handle(matchesRecord(binding.getId(), BINDING, map, parents));
    }
View Full Code Here

    {
        ExchangeImpl<?> exchange = createTestExchange();
        _configStore.create(exchange.asObjectRecord());

        AMQQueue queue = createTestQueue(QUEUE_NAME, "queueOwner", false, null);
        BindingImpl binding = createBinding(UUIDGenerator.generateRandomUUID(), ROUTING_KEY, queue,
                                            exchange, _bindingArgs);
        _configStore.create(binding.asObjectRecord());

        _configStore.remove(binding.asObjectRecord());
        reopenStore();

        verify(_handler, never()).handle(matchesRecord(ANY_UUID, BINDING,
                                                                         ANY_MAP));
    }
View Full Code Here

        if(arguments != null)
        {
            attributes.put(Binding.ARGUMENTS, arguments);
        }
        attributes.put(Binding.ID, id);
        return new BindingImpl(attributes, queue, exchange);
    }
View Full Code Here

    @Override
    public boolean replaceBinding(final String bindingKey,
                                  final AMQQueue queue,
                                  final Map<String, Object> arguments)
    {
        final BindingImpl existingBinding = getBinding(bindingKey, queue);
        return makeBinding(existingBinding == null ? null : existingBinding.getId(),
                           bindingKey,
                           queue,
                           arguments,
                           true);
    }
View Full Code Here

        }

        // Check access
        _virtualHost.getSecurityManager().authoriseUnbind(binding);

        BindingImpl b = _bindingsMap.remove(new BindingIdentifier(bindingKey,queue));

        if (b != null)
        {
            doRemoveBinding(b);
            queue.removeBinding(b);

            if (b.isDurable())
            {
                _virtualHost.getDurableConfigurationStore().remove(b.asObjectRecord());
            }
            b.delete();
        }

    }
View Full Code Here

        if (id == null)
        {
            id = UUID.randomUUID();
        }

        BindingImpl existingMapping;
        synchronized(this)
        {
            BindingIdentifier bindingIdentifier = new BindingIdentifier(bindingKey, queue);
            existingMapping = _bindingsMap.get(bindingIdentifier);

            if (existingMapping == null)
            {

                Map<String,Object> attributes = new HashMap<String, Object>();
                attributes.put(Binding.NAME,bindingKey);
                attributes.put(Binding.ID, id);
                attributes.put(Binding.ARGUMENTS, arguments);

                BindingImpl b = new BindingImpl(attributes, queue, this);
                b.create(); // Must be called before addBinding as it resolves automated attributes.

                addBinding(b);
                return true;
            }
            else if(force)
View Full Code Here

    }

    @Override
    public boolean deleteBinding(final String bindingKey, final AMQQueue queue)
    {
        final BindingImpl binding = getBinding(bindingKey, queue);
        if(binding == null)
        {
            return false;
        }
        else
        {
            binding.delete();
            return true;
        }
    }
View Full Code Here

TOP

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

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.