Package org.apache.qpid.client

Examples of org.apache.qpid.client.AMQConnectionFactory


    public void testCreateConnectionWithUsernamePassword() throws Exception
    {
       
        String brokerUrl = getBroker().toString();
        String URL = "amqp://guest:guest@clientID/test?brokerlist='" + brokerUrl + "'";
        AMQConnectionFactory factory = new AMQConnectionFactory(URL);
       
        AMQConnection con = (AMQConnection)factory.createConnection();
        assertEquals("Usernames used is different from the one in URL","guest",con.getConnectionURL().getUsername());
        assertEquals("Password used is different from the one in URL","guest",con.getConnectionURL().getPassword());
    
        try
        {
            AMQConnection con2 = (AMQConnection)factory.createConnection("user","pass");
            assertEquals("Usernames used is different from the one in URL","user",con2.getConnectionURL().getUsername());
            assertEquals("Password used is different from the one in URL","pass",con2.getConnectionURL().getPassword());
        }
        catch(Exception e)
        {
            // ignore
        }
       
        AMQConnection con3 = (AMQConnection)factory.createConnection();
        assertEquals("Usernames used is different from the one in URL","guest",con3.getConnectionURL().getUsername());
        assertEquals("Password used is different from the one in URL","guest",con3.getConnectionURL().getPassword());
    }
View Full Code Here


    public void testCreatingConnectionWithInstanceMadeUsingDefaultConstructor() throws Exception
    {
        String broker = getBroker().toString();
        String url = "amqp://guest:guest@clientID/test?brokerlist='" + broker + "'";

        AMQConnectionFactory factory = new AMQConnectionFactory();
        factory.setConnectionURLString(url);

        Connection con = factory.createConnection();
        con.close();
    }
View Full Code Here

    /**
     * Create a BDBStoreUpgradeTestPreparer instance
     */
    public BDBStoreUpgradeTestPreparer () throws URLSyntaxException
    {
        _connFac = new AMQConnectionFactory(CONN_URL);
    }
View Full Code Here

    @Override
    public Reference getReference() throws NamingException
    {
        try
        {
            _delegate = new AMQConnectionFactory(getConnectionURL());
            return ((Referenceable) _delegate).getReference();
        }
        catch(Exception e)
        {
            throw new NamingException(e.getMessage());
View Full Code Here

                            "'tcp://%s:%s?retries='%s'&connectdelay='%s''&failover='singlebroker?cyclecount='%s''";

        String newUrl = String.format(newUrlFormat, origBrokerDetails.getHost(), origBrokerDetails.getPort(),
                                                    retries, connectdelay, cycleCount);

        ConnectionFactory connectionFactory = new AMQConnectionFactory(newUrl);
        AMQConnection connection = (AMQConnection) connectionFactory.createConnection("admin", "admin");
        connection.setConnectionListener(this);
        return connection;
    }
View Full Code Here


    public Connection getConnection(ConnectionURL url) throws JMSException
    {
        _logger.debug("get connection for " + url.getURL());
        Connection connection = new AMQConnectionFactory(url).createConnection(url.getUsername(), url.getPassword());

        _connections.add(connection);

        return connection;
    }
View Full Code Here

     */
    protected ConnectionFactory createFactory(String url)
    {
        try
        {
            return new AMQConnectionFactory(url);
        }
        catch (URLSyntaxException urlse)
        {
            _logger.warn("Unable to createFactories:" + urlse);
        }
View Full Code Here

    public AMQPComponent(AMQConnectionFactory connectionFactory) {
        setConnectionFactory(connectionFactory);
    }

    public static Component amqpComponent(String uri) throws URLSyntaxException {
        AMQConnectionFactory connectionFactory = new AMQConnectionFactory(uri);
        return new AMQPComponent(connectionFactory);
    }
View Full Code Here

    public AMQPComponent(AMQConnectionFactory connectionFactory) {
        setConnectionFactory(connectionFactory);
    }

    public static Component amqpComponent(String uri) throws URLSyntaxException {
        AMQConnectionFactory connectionFactory = new AMQConnectionFactory(uri);
        return new AMQPComponent(connectionFactory);
    }
View Full Code Here

    /**
     * Lets install the default connection factory
     */
    private void init() {
        AMQConnectionFactory connectionFactory = new AMQConnectionFactory();
        setConnectionFactory(connectionFactory);
    }
View Full Code Here

TOP

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

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.