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

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


            assertEquals("Incorrect connection total", 0,  mc.getTotalMessagesReceived());
            assertEquals("Incorrect connection data", 0, mc.getTotalDataReceived());
          assertFalse("Connection statistics should not be enabled", mc.isStatisticsEnabled());
        }
       
        ManagedBroker vhost = _jmxUtils.getManagedBroker("test");
        assertEquals("Incorrect vhost data", 5, vhost.getTotalMessagesReceived());
        assertEquals("Incorrect vhost data", 1000, vhost.getTotalDataReceived());
        assertTrue("Vhost statistics should be enabled", vhost.isStatisticsEnabled());

        assertEquals("Incorrect server total messages", 5, _jmxUtils.getServerInformation().getTotalMessagesReceived());
        assertEquals("Incorrect server total data", 1000, _jmxUtils.getServerInformation().getTotalDataReceived());
        assertTrue("Server statistics should be enabled", _jmxUtils.getServerInformation().isStatisticsEnabled());
    }
View Full Code Here


            assertEquals("Incorrect connection total", 5,  mc.getTotalMessagesReceived());
            assertEquals("Incorrect connection data", 1000, mc.getTotalDataReceived());
          assertTrue("Connection statistics should be enabled", mc.isStatisticsEnabled());
        }
       
        ManagedBroker vhost = _jmxUtils.getManagedBroker("test");
        assertEquals("Incorrect vhost data", 5, vhost.getTotalMessagesReceived());
        assertEquals("Incorrect vhost data", 1000, vhost.getTotalDataReceived());
        assertTrue("Vhost statistics should be enabled", vhost.isStatisticsEnabled());

        assertEquals("Incorrect server total messages", 5, _jmxUtils.getServerInformation().getTotalMessagesReceived());
        assertEquals("Incorrect server total data", 1000, _jmxUtils.getServerInformation().getTotalDataReceived());
        assertTrue("Server statistics should be enabled", _jmxUtils.getServerInformation().isStatisticsEnabled());
    }
View Full Code Here

    /**
     * Test statistics on a single connection
     */
    public void testEnablingStatisticsPerConnection() throws Exception
    {
        ManagedBroker vhost = _jmxUtils.getManagedBroker("test");
       
        sendUsing(_test, 5, 200);
        Thread.sleep(1000);
       
        List<String> addresses = new ArrayList<String>();
        for (ManagedConnection mc : _jmxUtils.getManagedConnections("test"))
        {
          assertEquals("Incorrect connection total", 0,  mc.getTotalMessagesReceived());
          assertEquals("Incorrect connection data", 0, mc.getTotalDataReceived());
          assertFalse("Connection statistics should not be enabled", mc.isStatisticsEnabled());
           
            addresses.add(mc.getRemoteAddress());
        }
        assertEquals("Incorrect vhost total", 0, vhost.getTotalMessagesReceived());
        assertEquals("Incorrect vhost data", 0, vhost.getTotalDataReceived());
       
        Connection test = new AMQConnection(_brokerUrl, USER, USER, "clientid", "test");
        test.start();
        for (ManagedConnection mc : _jmxUtils.getManagedConnections("test"))
        {
            if (addresses.contains(mc.getRemoteAddress()))
            {
                continue;
            }
            mc.setStatisticsEnabled(true);
          assertEquals("Incorrect connection total", 0,  mc.getTotalMessagesReceived());
          assertEquals("Incorrect connection data", 0, mc.getTotalDataReceived());
        }
       
        sendUsing(test, 5, 200);
        sendUsing(_test, 5, 200);
        Thread.sleep(1000);
       
        for (ManagedConnection mc : _jmxUtils.getManagedConnections("test"))
        {
            if (addresses.contains(mc.getRemoteAddress()))
            {
            assertEquals("Incorrect connection total", 0,  mc.getTotalMessagesReceived());
            assertEquals("Incorrect connection data", 0, mc.getTotalDataReceived());
            assertFalse("Connection statistics should not be enabled", mc.isStatisticsEnabled());
            }
            else
            {
            assertEquals("Incorrect connection total", 5,  mc.getTotalMessagesReceived());
            assertEquals("Incorrect connection data", 1000, mc.getTotalDataReceived());
            assertTrue("Connection statistics should be enabled", mc.isStatisticsEnabled());
            }
        }
        assertEquals("Incorrect vhost total", 0, vhost.getTotalMessagesReceived());
        assertEquals("Incorrect vhost data", 0, vhost.getTotalDataReceived());
        assertFalse("Vhost statistics should not be enabled", vhost.isStatisticsEnabled());
       
        test.close();
    }
View Full Code Here

        sendUsing(_local, 5, 100);
        sendUsing(_local, 5, 100);
        sendUsing(_local, 5, 100);
        Thread.sleep(2000);
       
        ManagedBroker test = _jmxUtils.getManagedBroker("test");
        ManagedBroker dev = _jmxUtils.getManagedBroker("development");
        ManagedBroker local = _jmxUtils.getManagedBroker("localhost");

        if (!isBroker010())
        {
            long total = 0;
            long data = 0;
            for (ManagedConnection mc : _jmxUtils.getAllManagedConnections())
            {
                total += mc.getTotalMessagesReceived();
                data += mc.getTotalDataReceived();
            }
            assertEquals("Incorrect connection total", 45, total);
            assertEquals("Incorrect connection data", 4500, data);
        }
        assertEquals("Incorrect server total", 45, _jmxUtils.getServerInformation().getTotalMessagesReceived());
        assertEquals("Incorrect server data", 4500, _jmxUtils.getServerInformation().getTotalDataReceived());
       
        if (!isBroker010())
        {
            long testTotal = 0;
            long testData = 0;
            for (ManagedConnection mc : _jmxUtils.getManagedConnections("test"))
            {
                testTotal += mc.getTotalMessagesReceived();
                testData += mc.getTotalDataReceived();
            }
            assertEquals("Incorrect test connection total", 10, testTotal);
            assertEquals("Incorrect test connection data", 1000, testData);
        }
        assertEquals("Incorrect test vhost total", 10, test.getTotalMessagesReceived());
        assertEquals("Incorrect test vhost data", 1000, test.getTotalDataReceived());
       
        if (!isBroker010())
        {
            long devTotal = 0;
            long devData = 0;
            for (ManagedConnection mc : _jmxUtils.getManagedConnections("development"))
            {
                devTotal += mc.getTotalMessagesReceived();
                devData += mc.getTotalDataReceived();
            }
            assertEquals("Incorrect test connection total", 20, devTotal);
            assertEquals("Incorrect test connection data", 2000, devData);
        }
        assertEquals("Incorrect development total", 20, dev.getTotalMessagesReceived());
        assertEquals("Incorrect development data", 2000, dev.getTotalDataReceived());
       
        if (!isBroker010())
        {
            long localTotal = 0;
            long localData = 0;
            for (ManagedConnection mc : _jmxUtils.getManagedConnections("localhost"))
            {
                localTotal += mc.getTotalMessagesReceived();
                localData += mc.getTotalDataReceived();
            }
            assertEquals("Incorrect test connection total", 15, localTotal);
            assertEquals("Incorrect test connection data", 1500, localData);
        }
        assertEquals("Incorrect localhost total", 15, local.getTotalMessagesReceived());
        assertEquals("Incorrect localhost data", 1500, local.getTotalDataReceived());
    }
View Full Code Here

        sendUsing(_test, 10, 100);
        Thread.sleep(2000);
       
        temp.close();
       
        ManagedBroker test = _jmxUtils.getManagedBroker("test");

        if (!isBroker010())
        {
            long total = 0;
            long data = 0;
            for (ManagedConnection mc : _jmxUtils.getAllManagedConnections())
            {
                total += mc.getTotalMessagesReceived();
                data += mc.getTotalDataReceived();
            }
            assertEquals("Incorrect active connection total", 20, total);
            assertEquals("Incorrect active connection data", 2000, data);
        }
        assertEquals("Incorrect server total", 30, _jmxUtils.getServerInformation().getTotalMessagesReceived());
        assertEquals("Incorrect server data", 3000, _jmxUtils.getServerInformation().getTotalDataReceived());
       
        if (!isBroker010())
        {
            long testTotal = 0;
            long testData = 0;
            for (ManagedConnection mc : _jmxUtils.getManagedConnections("test"))
            {
                testTotal += mc.getTotalMessagesReceived();
                testData += mc.getTotalDataReceived();
            }
            assertEquals("Incorrect test active connection total", 20, testTotal);
            assertEquals("Incorrect test active connection data", 20 * 100, testData);
        }
        assertEquals("Incorrect test vhost total", 30, test.getTotalMessagesReceived());
        assertEquals("Incorrect test vhost data", 30 * 100, test.getTotalDataReceived());
    }
View Full Code Here

        sendUsing(_test, 2, 10);
        Thread.sleep(10000);
        sendUsing(_dev, 4, 10);
        Thread.sleep(10000);
       
        ManagedBroker test = _jmxUtils.getManagedBroker("test");
        ManagedBroker dev = _jmxUtils.getManagedBroker("development");
       
        assertApprox("Incorrect test vhost peak messages", 0.2d, 1.0d, test.getPeakMessageReceiptRate());
        assertApprox("Incorrect test vhost peak data", 0.2d, 10.0d, test.getPeakDataReceiptRate());
        assertApprox("Incorrect dev vhost peak messages", 0.2d, 2.0d, dev.getPeakMessageReceiptRate());
        assertApprox("Incorrect dev vhost peak data", 0.2d, 20.0d, dev.getPeakDataReceiptRate());

        assertApprox("Incorrect server peak messages", 0.2d, 2.0d, _jmxUtils.getServerInformation().getPeakMessageReceiptRate());
        assertApprox("Incorrect server peak data", 0.2d, 20.0d, _jmxUtils.getServerInformation().getPeakDataReceiptRate());
    }
View Full Code Here

    {
        sendUsing(_test, 10, 10);
        sendUsing(_dev, 10, 10);
        Thread.sleep(2000);
       
        ManagedBroker test = _jmxUtils.getManagedBroker("test");
        ManagedBroker dev = _jmxUtils.getManagedBroker("development");
       
        assertEquals("Incorrect test vhost total messages", 10, test.getTotalMessagesReceived());
        assertEquals("Incorrect test vhost total data", 100, test.getTotalDataReceived());
        assertEquals("Incorrect dev vhost total messages", 10, dev.getTotalMessagesReceived());
        assertEquals("Incorrect dev vhost total data", 100, dev.getTotalDataReceived());

        assertEquals("Incorrect server total messages", 20, _jmxUtils.getServerInformation().getTotalMessagesReceived());
        assertEquals("Incorrect server total data", 200, _jmxUtils.getServerInformation().getTotalDataReceived());
       
        test.resetStatistics();
       
        assertEquals("Incorrect test vhost total messages", 0, test.getTotalMessagesReceived());
        assertEquals("Incorrect test vhost total data", 0, test.getTotalDataReceived());
        assertEquals("Incorrect dev vhost total messages", 10, dev.getTotalMessagesReceived());
        assertEquals("Incorrect dev vhost total data", 100, dev.getTotalDataReceived());

        assertEquals("Incorrect server total messages", 20, _jmxUtils.getServerInformation().getTotalMessagesReceived());
        assertEquals("Incorrect server total data", 200, _jmxUtils.getServerInformation().getTotalDataReceived());
    }
View Full Code Here

        //Remove any previous queue declares
        _monitor.markDiscardPoint();

        _jmxUtils.createQueue("test", getName(), null, false);

        ManagedBroker managedBroker = _jmxUtils.getManagedBroker("test");

        managedBroker.deleteQueue(getName());

        List<String> results = waitAndFindMatches("QUE-1002");

        assertEquals("More than one queue deletion found", 1, results.size());
View Full Code Here

        //Remove any previous queue declares
        _monitor.markDiscardPoint();

        _jmxUtils.createExchange("test", getName(), "direct", false);

        ManagedBroker managedBroker = _jmxUtils.getManagedBroker("test");

        managedBroker.unregisterExchange(getName());

        List<String> results = waitAndFindMatches("EXH-1002");

        assertEquals("More than one exchange deletion found", 1, results.size());
View Full Code Here

                //The vhostManager MBean wasnt found, cant procede
                return false;
            }

            ManagedBroker vhostManager = (ManagedBroker) MBeanServerInvocationHandler.newProxyInstance(
                                              mbsc, (ObjectName) vhostManagers.toArray()[0], ManagedBroker.class, false);
                       
            ObjectName customExchangeObjectName = new ObjectName(
                    "org.apache.qpid:" +
                    "type=VirtualHost.Exchange," +
                    "VirtualHost=" + ObjectName.quote(virHost) + "," +
                    "name=" + ObjectName.quote(exchName) + ",*");

            Set<ObjectName> exchanges = mbsc.queryNames(customExchangeObjectName, null);

            if(exchanges.size() == 0)
            {
                System.out.println("Exchange wasnt found: " + exchName);

                //The exchange doesnt exist, cant procede.
                return false;
            }

            //create the MBean proxy
            ManagedExchange managedExchange = (ManagedExchange) MBeanServerInvocationHandler.newProxyInstance(
                        mbsc, (ObjectName) exchanges.toArray()[0], ManagedExchange.class, false);

            try
            {
                //create the new durable queue and bind it.
                vhostManager.createNewQueue(queueName, null, true);
                System.out.println("Created queue: " + queueName);
                managedExchange.createNewBinding(queueName,queueName);
                System.out.println("Bound queue to exchange: "+ exchName);
            }
            catch (Exception e)
View Full Code Here

TOP

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

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.