Package org.apache.qpid.client

Examples of org.apache.qpid.client.AMQConnectionFactory


            return amqpComponentOld(uri);
        }
        return new AMQPComponent(ConnectionFactoryImpl.createFromURL(uri));
    }
    public static Component amqpComponentOld(String uri) throws URISyntaxException {
        return new AMQPComponent(new AMQConnectionFactory(uri));
    }
View Full Code Here


        }
        return new AMQPComponent(ConnectionFactoryImpl.createFromURL(uri));
    }

    public static Component amqpComponentOld(String uri) throws URISyntaxException {
        return new AMQPComponent(new AMQConnectionFactory(uri));
    }
View Full Code Here

    }

    public Connection getConnection(ConnectionURL url) throws JMSException
    {
        _logger.info(url.getURL());
        Connection connection = new AMQConnectionFactory(url).createConnection(url.getUsername(), url.getPassword());

        _connections.add(connection);

        return connection;
    }
View Full Code Here

        _broker = new Broker();
        try {
            _broker.startup(options);
            Context context = new InitialContext();
            context.bind(JNDI_CONNECTION_FACTORY, new AMQConnectionFactory(_qpidConnectionFactory));
            if (_qpidQueueExchange != null) {
                context.bind(DEFAULT_QUEUE_JNDI_LOCATION, AMQDestination.createDestination(_qpidQueueExchange));
            }
            if (_qpidTopicExchange != null) {
                context.bind(DEFAULT_TOPIC_JNDI_LOCATION, AMQDestination.createDestination(_qpidTopicExchange));
View Full Code Here

        {
            print(key + ":" + object);
        }
        else if (object instanceof AMQConnectionFactory)
        {
            AMQConnectionFactory factory = (AMQConnectionFactory) object;
            print(key + ":Connection");
            print("ConnectionURL:");
            print(factory.getConnectionURL().toString());
            print("FailoverPolicy");
            print(new FailoverPolicy(factory.getConnectionURL(),null).toString());
            print("");
        }
    }
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) throws ConfigurationException
    {
        try
        {
            return new AMQConnectionFactory(url);
        }
        catch (URLSyntaxException urlse)
        {
            _logger.warn("Unable to create factory:" + urlse);

View Full Code Here

    public static final String URL = "amqp://guest:guest@clientID/test?brokerlist='tcp://localhost:5672'";
    public static final String URL_STAR_PWD = "amqp://guest:********@clientID/test?brokerlist='tcp://localhost:5672'";

    public void testConnectionURLStringMasksPassword() throws Exception
    {
        AMQConnectionFactory factory = new AMQConnectionFactory(URL);

        //URL will be returned with the password field swapped for '********'
        assertEquals("Connection URL not correctly set", URL_STAR_PWD, factory.getConnectionURLString());

        // Further test that the processed ConnectionURL is as expected after
        // the set call
        ConnectionURL connectionurl = factory.getConnectionURL();

        assertNull("Failover is set.", connectionurl.getFailoverMethod());
        assertEquals("guest", connectionurl.getUsername());
        assertEquals("guest", connectionurl.getPassword());
        assertEquals("clientID", connectionurl.getClientName());
View Full Code Here

        assertEquals(5672, service.getPort());
    }

    public void testInstanceCreatedWithDefaultConstructorThrowsExceptionOnCallingConnectWithoutSettingURL() throws Exception
    {
        AMQConnectionFactory factory = new AMQConnectionFactory();

        try
        {
            factory.createConnection();
            fail("Expected exception not thrown");
        }
        catch(JMSException e)
        {
            assertEquals("Unexpected exception", AMQConnectionFactory.NO_URL_CONFIGURED, e.getMessage());
View Full Code Here

        }
    }

    public void testSerialization() throws Exception
    {
        AMQConnectionFactory factory = new AMQConnectionFactory();
        assertTrue(factory instanceof Serializable);
        factory.setConnectionURLString("amqp://guest:guest@clientID/test?brokerlist='tcp://localhost:5672'");

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(bos);
        oos.writeObject(factory);
        oos.close();

        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bis);
        Object deserializedObject = ois.readObject();
        ois.close();

        AMQConnectionFactory deserialisedFactory = (AMQConnectionFactory) deserializedObject;
        assertEquals(factory, deserialisedFactory);
        assertEquals(factory.hashCode(), deserialisedFactory.hashCode());
    }
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.