Package org.apache.qpid.management.common.mbeans

Examples of org.apache.qpid.management.common.mbeans.ManagedExchange


    public void testDirectExchangeMBean() throws Exception
    {
        DirectExchange exchange = new DirectExchange();
        exchange.initialise(_virtualHost, ExchangeDefaults.DIRECT_EXCHANGE_NAME, false, 0, true);
        ManagedObject managedObj = exchange.getManagedObject();
        ManagedExchange mbean = (ManagedExchange)managedObj;

        mbean.createNewBinding(_queue.getNameShortString().toString(), "binding1");
        mbean.createNewBinding(_queue.getNameShortString().toString(), "binding2");

        TabularData data = mbean.bindings();
        ArrayList<Object> list = new ArrayList<Object>(data.values());
        assertTrue(list.size() == 2);

        // test general exchange properties
        assertEquals(mbean.getName(), "amq.direct");
        assertEquals(mbean.getExchangeType(), "direct");
        assertTrue(mbean.getTicketNo() == 0);
        assertTrue(!mbean.isDurable());
        assertTrue(mbean.isAutoDelete());
    }
View Full Code Here


    public void testTopicExchangeMBean() throws Exception
    {
        TopicExchange exchange = new TopicExchange();
        exchange.initialise(_virtualHost,ExchangeDefaults.TOPIC_EXCHANGE_NAME, false, 0, true);
        ManagedObject managedObj = exchange.getManagedObject();
        ManagedExchange mbean = (ManagedExchange)managedObj;

        mbean.createNewBinding(_queue.getNameShortString().toString(), "binding1");
        mbean.createNewBinding(_queue.getNameShortString().toString(), "binding2");

        TabularData data = mbean.bindings();
        ArrayList<Object> list = new ArrayList<Object>(data.values());
        assertTrue(list.size() == 2);

        // test general exchange properties
        assertEquals(mbean.getName(), "amq.topic");
        assertEquals(mbean.getExchangeType(), "topic");
        assertTrue(mbean.getTicketNo() == 0);
        assertTrue(!mbean.isDurable());
        assertTrue(mbean.isAutoDelete());
    }
View Full Code Here

    public void testHeadersExchangeMBean() throws Exception
    {
        HeadersExchange exchange = new HeadersExchange();
        exchange.initialise(_virtualHost,ExchangeDefaults.HEADERS_EXCHANGE_NAME, false, 0, true);
        ManagedObject managedObj = exchange.getManagedObject();
        ManagedExchange mbean = (ManagedExchange)managedObj;

        mbean.createNewBinding(_queue.getNameShortString().toString(), "key1=binding1,key2=binding2");
        mbean.createNewBinding(_queue.getNameShortString().toString(), "key3=binding3");

        TabularData data = mbean.bindings();
        ArrayList<Object> list = new ArrayList<Object>(data.values());
        assertTrue(list.size() == 2);

        // test general exchange properties
        assertEquals(mbean.getName(), "amq.match");
        assertEquals(mbean.getExchangeType(), "headers");
        assertTrue(mbean.getTicketNo() == 0);
        assertTrue(!mbean.isDurable());
        assertTrue(mbean.isAutoDelete());
    }
View Full Code Here

    public void testDefaultBindings() throws Exception
    {
        int bindings = _queue.getBindingCount();
       
        Exchange exchange = _queue.getVirtualHost().getExchangeRegistry().getDefaultExchange();
        ManagedExchange mbean = (ManagedExchange) ((AbstractExchange) exchange).getManagedObject();
       
        mbean.createNewBinding(_queue.getName(), "robot");
        mbean.createNewBinding(_queue.getName(), "kitten");

        assertEquals("Should have added two bindings", bindings + 2, _queue.getBindingCount());
       
        mbean.removeBinding(_queue.getName(), "robot");

        assertEquals("Should have one extra binding", bindings + 1, _queue.getBindingCount());
       
        mbean.removeBinding(_queue.getName(), "kitten");

        assertEquals("Should have original number of binding", bindings, _queue.getBindingCount());
    }
View Full Code Here

    public void testTopicBindings() throws Exception
    {
        int bindings = _queue.getBindingCount();
       
        Exchange exchange = _queue.getVirtualHost().getExchangeRegistry().getExchange(new AMQShortString("amq.topic"));
        ManagedExchange mbean = (ManagedExchange) ((AbstractExchange) exchange).getManagedObject();
       
        mbean.createNewBinding(_queue.getName(), "robot.#");
        mbean.createNewBinding(_queue.getName(), "#.kitten");

        assertEquals("Should have added two bindings", bindings + 2, _queue.getBindingCount());
       
        mbean.removeBinding(_queue.getName(), "robot.#");

        assertEquals("Should have one extra binding", bindings + 1, _queue.getBindingCount());
       
        mbean.removeBinding(_queue.getName(), "#.kitten");

        assertEquals("Should have original number of binding", bindings, _queue.getBindingCount());
    }
View Full Code Here

        }

        try
        {
            //verify the DLE exchange exists, has the expected type, and a single binding for the DLQ
            ManagedExchange exchange = jmxUtils.getManagedExchange(QUEUE_WITH_DLQ_NAME + "_DLE");
            assertEquals("Wrong exchange type", "fanout", exchange.getExchangeType());
            TabularDataSupport bindings = (TabularDataSupport) exchange.bindings();
            assertEquals(1, bindings.size());
            for(Object o : bindings.values())
            {
                CompositeData binding = (CompositeData) o;
View Full Code Here

        }

        try
        {
            //verify the DLE exchange exists, has the expected type, and a single binding for the DLQ
            ManagedExchange exchange = jmxUtils.getManagedExchange(QUEUE_WITH_DLQ_NAME + "_DLE");
            assertEquals("Wrong exchange type", "fanout", exchange.getExchangeType());
            TabularDataSupport bindings = (TabularDataSupport) exchange.bindings();
            assertEquals(1, bindings.size());
            for(Object o : bindings.values())
            {
                CompositeData binding = (CompositeData) o;
View Full Code Here

    public void testDirectExchangeMBean() throws Exception
    {
        DirectExchange exchange = new DirectExchange();
        exchange.initialise(_virtualHost, ExchangeDefaults.DIRECT_EXCHANGE_NAME, false, 0, true);
        ManagedObject managedObj = exchange.getManagedObject();
        ManagedExchange mbean = (ManagedExchange)managedObj;

        mbean.createNewBinding(_queue.getName().toString(), "binding1");
        mbean.createNewBinding(_queue.getName().toString(), "binding2");

        TabularData data = mbean.bindings();
        ArrayList<Object> list = new ArrayList<Object>(data.values());
        assertTrue(list.size() == 2);

        // test general exchange properties
        assertEquals(mbean.getName(), "amq.direct");
        assertEquals(mbean.getExchangeType(), "direct");
        assertTrue(mbean.getTicketNo() == 0);
        assertTrue(!mbean.isDurable());
        assertTrue(mbean.isAutoDelete());
    }
View Full Code Here

    public void testTopicExchangeMBean() throws Exception
    {
        TopicExchange exchange = new TopicExchange();
        exchange.initialise(_virtualHost,ExchangeDefaults.TOPIC_EXCHANGE_NAME, false, 0, true);
        ManagedObject managedObj = exchange.getManagedObject();
        ManagedExchange mbean = (ManagedExchange)managedObj;

        mbean.createNewBinding(_queue.getName().toString(), "binding1");
        mbean.createNewBinding(_queue.getName().toString(), "binding2");

        TabularData data = mbean.bindings();
        ArrayList<Object> list = new ArrayList<Object>(data.values());
        assertTrue(list.size() == 2);

        // test general exchange properties
        assertEquals(mbean.getName(), "amq.topic");
        assertEquals(mbean.getExchangeType(), "topic");
        assertTrue(mbean.getTicketNo() == 0);
        assertTrue(!mbean.isDurable());
        assertTrue(mbean.isAutoDelete());
    }
View Full Code Here

    public void testHeadersExchangeMBean() throws Exception
    {
        HeadersExchange exchange = new HeadersExchange();
        exchange.initialise(_virtualHost,ExchangeDefaults.HEADERS_EXCHANGE_NAME, false, 0, true);
        ManagedObject managedObj = exchange.getManagedObject();
        ManagedExchange mbean = (ManagedExchange)managedObj;

        mbean.createNewBinding(_queue.getName().toString(), "key1=binding1,key2=binding2");
        mbean.createNewBinding(_queue.getName().toString(), "key3=binding3");

        TabularData data = mbean.bindings();
        ArrayList<Object> list = new ArrayList<Object>(data.values());
        assertTrue(list.size() == 2);

        // test general exchange properties
        assertEquals(mbean.getName(), "amq.match");
        assertEquals(mbean.getExchangeType(), "headers");
        assertTrue(mbean.getTicketNo() == 0);
        assertTrue(!mbean.isDurable());
        assertTrue(mbean.isAutoDelete());
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.management.common.mbeans.ManagedExchange

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.