Package org.apache.qpid.test.utils

Examples of org.apache.qpid.test.utils.JMXTestUtils


     * detected and set as being exclusive during the upgrade process, and that the
     * regular queue was not.
     */
    public void testQueueExclusivity() throws Exception
    {
        JMXTestUtils jmxUtils = null;
        try
        {
            jmxUtils = new JMXTestUtils(this, "guest", "guest");
            jmxUtils.open();
        }
        catch (Exception e)
        {
            fail("Unable to establish JMX connection, test cannot proceed");
        }

        try
        {
            ManagedQueue queue = jmxUtils.getManagedQueue(QUEUE_NAME);
            assertFalse("Queue should not have been marked as Exclusive during upgrade", queue.isExclusive());

            ManagedQueue dursubQueue = jmxUtils.getManagedQueue("clientid" + ":" + SUB_NAME);
            assertTrue("DurableSubscription backing queue should have been marked as Exclusive during upgrade", dursubQueue.isExclusive());
        }
        finally
        {
            jmxUtils.close();
        }
    }
View Full Code Here


     * DLQs are NOT enabled at the virtualhost level, we are testing recovery of the arguments
     * that turned it on for this specific queue.
     */
    public void testRecoveryOfQueueWithDLQ() throws Exception
    {
        JMXTestUtils jmxUtils = null;
        try
        {
            jmxUtils = new JMXTestUtils(this, "guest", "guest");
            jmxUtils.open();
        }
        catch (Exception e)
        {
            fail("Unable to establish JMX connection, test cannot proceed");
        }

        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;

                String bindingKey = (String) binding.get(ManagedExchange.BINDING_KEY);
                String[] queueNames = (String[]) binding.get(ManagedExchange.QUEUE_NAMES);

                //Because its a fanout exchange, we just return a single '*' key with all bound queues
                assertEquals("unexpected binding key", "*", bindingKey);
                assertEquals("unexpected number of queues bound", 1, queueNames.length);
                assertEquals("unexpected queue name", QUEUE_WITH_DLQ_NAME + "_DLQ", queueNames[0]);
            }

            //verify the queue exists, has the expected alternate exchange and max delivery count
            ManagedQueue queue = jmxUtils.getManagedQueue(QUEUE_WITH_DLQ_NAME);
            assertEquals("Queue does not have the expected AlternateExchange", QUEUE_WITH_DLQ_NAME + "_DLE", queue.getAlternateExchange());
            assertEquals("Unexpected maximum delivery count", Integer.valueOf(2), queue.getMaximumDeliveryCount());

            ManagedQueue dlQqueue = jmxUtils.getManagedQueue(QUEUE_WITH_DLQ_NAME + "_DLQ");
            assertNull("Queue should not have an AlternateExchange", dlQqueue.getAlternateExchange());
            assertEquals("Unexpected maximum delivery count", Integer.valueOf(0), dlQqueue.getMaximumDeliveryCount());

            String dlqDlqObjectNameString = jmxUtils.getQueueObjectNameString("test", QUEUE_WITH_DLQ_NAME + "_DLQ" + "_DLQ");
            assertFalse("a DLQ should not exist for the DLQ itself", jmxUtils.doesManagedObjectExist(dlqDlqObjectNameString));
        }
        finally
        {
            jmxUtils.close();
        }
    }
View Full Code Here

    @Override
    public void setUp() throws Exception
    {
        getBrokerConfiguration().addJmxManagementConfiguration();

        _jmxUtils = new JMXTestUtils(this);

        super.setUp();
        _jmxUtils.open();
    }
View Full Code Here

    public void setUp() throws Exception
    {
        getBrokerConfiguration().addJmxManagementConfiguration();

        _jmxUtils = new JMXTestUtils(this);

        super.setUp();
        _sourceQueueName = getTestQueueName() + "_src";
        _destinationQueueName = getTestQueueName() + "_dest";
View Full Code Here

        newAttributes.put(AuthenticationProvider.TYPE, getAuthenticationManagerType());
        newAttributes.put("path", _passwordFile.getAbsolutePath());
        getBrokerConfiguration().setObjectAttributes(TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER, newAttributes);
        getBrokerConfiguration().addJmxManagementConfiguration();

        _jmxUtils = new JMXTestUtils(this);

        super.setUp();
        _jmxUtils.open();

        _testUserName = getTestName() + System.currentTimeMillis();
View Full Code Here

    public void setUp() throws Exception
    {
        getBrokerConfiguration().addJmxManagementConfiguration();

        _jmxUtils = new JMXTestUtils(this);
        _jmxUtilConnected=false;
        super.setUp();

        _monitor.markDiscardPoint();
View Full Code Here

    public void setUp() throws Exception
    {
        getBrokerConfiguration().addJmxManagementConfiguration();

        // Create a JMX Helper
        _jmxUtils = new JMXTestUtils(this);
        super.setUp();

        // Open the JMX Connection
        _jmxUtils.open();
    }
View Full Code Here

     * Tests the creation of usernames when EXTERNAL authentication is used.
     * The username should be created as CN@DC1.DC2...DCn by default.
     */
    public void testExternalAuthenticationManagerUsernameAsCN() throws Exception
    {
        JMXTestUtils jmxUtils = new JMXTestUtils(this);

        setCommonBrokerSSLProperties(true);
        getBrokerConfiguration().addJmxManagementConfiguration();

        super.setUp();

        setClientKeystoreProperties();
        setClientTrustoreProperties();

        try
        {
            getExternalSSLConnection(false, "&ssl_cert_alias='app2'");
        }
        catch (JMSException e)
        {
            fail("Should be able to create a connection to the SSL port: " + e.getMessage());
        }

        // Getting the used username using JMX
        jmxUtils.open();
        List<ManagedConnection> connections = jmxUtils.getManagedConnections("test");
        assertNotNull("Connections are null", connections);
        assertEquals("Unexpected number of connections", 1, connections.size());
        assertEquals("Wrong authorized ID", "app2@acme.org", connections.get(0).getAuthorizedId());
    }
View Full Code Here

     * Tests the creation of usernames when EXTERNAL authentication is used.
     * The username should be created as full DN when the useFullDN option is used.
     */
    public void testExternalAuthenticationManagerUsernameAsDN() throws Exception
    {
        JMXTestUtils jmxUtils = new JMXTestUtils(this);

        setCommonBrokerSSLProperties(true);
        getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_EXTERNAL_PROVIDER, ExternalAuthenticationManagerFactory.ATTRIBUTE_USE_FULL_DN, "true");
        getBrokerConfiguration().addJmxManagementConfiguration();

        super.setUp();

        setClientKeystoreProperties();
        setClientTrustoreProperties();

        try
        {
            getExternalSSLConnection(false, "&ssl_cert_alias='app2'");
        }
        catch (JMSException e)
        {
            fail("Should be able to create a connection to the SSL port: " + e.getMessage());
        }

        // Getting the used username using JMX
        jmxUtils.open();
        List<ManagedConnection> connections = jmxUtils.getManagedConnections("test");
        assertNotNull("Connections are null", connections);
        assertEquals("Unexpected number of connections", 1, connections.size());
        assertEquals("Wrong authorized ID", "CN=app2@acme.org,OU=art,O=acme,L=Toronto,ST=ON,C=CA", connections.get(0).getAuthorizedId());
    }
View Full Code Here

        createTestVirtualHost(0, TEST_VHOST);
        createTestVirtualHost(0, TEST2_VHOST);

        getBrokerConfiguration().addJmxManagementConfiguration();

        _jmx = new JMXTestUtils(this);
        super.setUp();
        _jmx.open();
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.test.utils.JMXTestUtils

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.