Package org.apache.qpid.client

Examples of org.apache.qpid.client.AMQConnection


        }
    }

    public void testClientIdIsPopulatedAutomatically() throws Exception
    {
        Connection connection = new AMQConnection(getBroker().toString(), "guest", "guest",
                                                  null, "test");
        try
        {
            assertNotNull(connection.getClientID());
        }
        finally
        {
            connection.close();
        }
        connection.close();
    }
View Full Code Here


        BrokerDetails broker = getBroker();
        broker.setProperty(BrokerDetails.OPTIONS_SASL_MECHS, "MY_MECH");

        try
        {
            Connection connection = new AMQConnection(broker.toString(), "guest", "guest",
                    null, "test");
            connection.close();
            fail("The client should throw a ConnectionException stating the" +
                " broker does not support the SASL mech specified by the client");
        }
        catch (Exception e)
        {
View Full Code Here

        setTestSystemProperty(ClientProperties.QPID_VERIFY_CLIENT_ID, "true");

        BrokerDetails broker = getBroker();
        try
        {
            Connection con = new AMQConnection(broker.toString(), "guest", "guest",
                                        "client_id", "test");

            Connection con2 = new AMQConnection(broker.toString(), "guest", "guest",
                                        "client_id", "test");

            fail("The client should throw a ConnectionException stating the" +
                    " client ID is not unique");
        }
View Full Code Here

        setTestSystemProperty(ClientProperties.QPID_VERIFY_CLIENT_ID, "true");

        BrokerDetails broker = getBroker();
        try
        {
            Connection con = new AMQConnection(broker.toString(), "guest", "guest",
                                        "client_id", "test");

            Connection con2 = new AMQConnection(broker.toString(), "admin", "admin",
                                        "client_id", "test");
        }
        catch (Exception e)
        {
            fail("Unexpected exception thrown, client id was not unique but usernames were different! " + e.getMessage());
View Full Code Here

        super.setUp();

        //Verify requesting a 0-10 connection works
        setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-10");
        AMQConnection connection = (AMQConnection) getConnection();
        assertEquals("Unexpected protocol version in use", ProtocolVersion.v0_10, connection.getProtocolVersion());
        connection.close();

        //Verify requesting a 0-91 connection works
        setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-9-1");
        connection = (AMQConnection) getConnection();
        assertEquals("Unexpected protocol version in use", ProtocolVersion.v0_91, connection.getProtocolVersion());
        connection.close();

        //Verify requesting a 0-9 connection works
        setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-9");
        connection = (AMQConnection) getConnection();
        assertEquals("Unexpected protocol version in use", ProtocolVersion.v0_9, connection.getProtocolVersion());
        connection.close();

        //Verify requesting a 0-8 connection works
        setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-8");
        connection = (AMQConnection) getConnection();
        assertEquals("Unexpected protocol version in use", ProtocolVersion.v8_0, connection.getProtocolVersion());
        connection.close();
    }
View Full Code Here

        super.setUp();

        //Verify initially requesting a 0-10 connection now negotiates a 0-91
        //connection as the broker should reply with its highest supported protocol
        setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-10");
        AMQConnection connection = (AMQConnection) getConnection();
        assertEquals("Unexpected protocol version in use", ProtocolVersion.v0_91, connection.getProtocolVersion());
        connection.close();
    }
View Full Code Here

        super.setUp();

        //Verify initially requesting a 0-10 connection now negotiates a 0-9
        //connection as the broker should reply with its highest supported protocol
        setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-10");
        AMQConnection connection = (AMQConnection) getConnection();
        assertEquals("Unexpected protocol version in use", ProtocolVersion.v0_9, connection.getProtocolVersion());
        connection.close();
    }
View Full Code Here

        super.setUp();

        //Verify initially requesting a 0-10 connection now negotiates a 0-8
        //connection as the broker should reply with its highest supported protocol
        setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-10");
        AMQConnection connection = (AMQConnection) getConnection();
        assertEquals("Unexpected protocol version in use", ProtocolVersion.v8_0, connection.getProtocolVersion());
        connection.close();
    }
View Full Code Here

        //Verify initially requesting a 0-10 connection now negotiates a 0-9 connection as the
        //broker should reply with its 'default unsupported protocol initiation reply' as opposed
        //to the previous behaviour of the highest supported protocol version.
        setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-10");
        AMQConnection connection = (AMQConnection) getConnection();
        assertEquals("Unexpected protocol version in use", ProtocolVersion.v0_9, connection.getProtocolVersion());
        connection.close();

        //Verify requesting a 0-91 connection directly still works, as its support is still enabled
        setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-9-1");
        connection = (AMQConnection) getConnection();
        assertEquals("Unexpected protocol version in use", ProtocolVersion.v0_91, connection.getProtocolVersion());
        connection.close();
    }
View Full Code Here

        super.setUp();

        //Verify initially requesting a 0-10 connection negotiates a 0-9-1 connection
        setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-10");
        AMQConnection connection = (AMQConnection) getConnection();
        assertEquals("Unexpected protocol version in use", ProtocolVersion.v0_91, connection.getProtocolVersion());
        connection.close();

        stopBroker();

        if(useConfig)
        {
            //selectively include 0-10 support again on the test port through config
            setConfigurationProperty(ServerConfiguration.CONNECTOR_INCLUDE_010, String.valueOf(getPort()));
        }
        else
        {
            //selectively include 0-10 support again on the test port through QBTC sys props
            setTestSystemProperty(QpidBrokerTestCase.BROKER_PROTOCOL_INCLUDES,"--include-0-10 @PORT");
        }

        startBroker();

        //Verify requesting a 0-10 connection now returns one
        setTestClientSystemProperty(ClientProperties.AMQP_VERSION, "0-10");
        connection = (AMQConnection) getConnection();
        assertEquals("Unexpected protocol version in use", ProtocolVersion.v0_10, connection.getProtocolVersion());
        connection.close();
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.client.AMQConnection

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.