Package org.apache.qpid.jms

Examples of org.apache.qpid.jms.ConnectionURL


    public void testSingleTransportDefaultedBrokerWithIP() throws URLSyntaxException
    {
        String url = "amqp://guest:guest@/test?brokerlist='127.0.0.1'";

        ConnectionURL connectionurl = new AMQConnectionURL(url);

        assertTrue(connectionurl.getFailoverMethod() == null);
        assertTrue(connectionurl.getUsername().equals("guest"));
        assertTrue(connectionurl.getPassword().equals("guest"));
        assertTrue(connectionurl.getVirtualHost().equals("/test"));


        assertTrue(connectionurl.getBrokerCount() == 1);

        BrokerDetails service = connectionurl.getBrokerDetails(0);

        assertTrue(service.getTransport().equals("tcp"));

        assertTrue(service.getHost().equals("127.0.0.1"));
        assertTrue(service.getPort() == 5672);
View Full Code Here


    }

    public void testConnectionURLOptionToStringMasksPassword() throws URLSyntaxException
    {
        String url = "amqp://guest:guest@client/localhost?brokerlist='tcp://localhost:1234'";
        ConnectionURL connectionurl = new AMQConnectionURL(url);

        String expectedToString = "amqp://guest:********@client/localhost?brokerlist='tcp://localhost:1234'";
        String actualToString = connectionurl.toString();
        assertEquals("Unexpected toString form", expectedToString, actualToString);
    }
View Full Code Here

    }

    public void testConnectionURLOptionToStringMasksSslTrustStorePassword() throws URLSyntaxException
    {
        String url = "amqp://guest:guest@client/vhost?brokerlist='tcp://host:1234?trust_store_password='truststorepassword''";
        ConnectionURL connectionurl = new AMQConnectionURL(url);

        String expectedToString = "amqp://guest:********@client/vhost?brokerlist='tcp://host:1234?trust_store_password='********''";
        String actualToString = connectionurl.toString();
        assertEquals("Unexpected toString form", expectedToString, actualToString);
    }
View Full Code Here

    }

    public void testConnectionURLOptionToStringMasksSslKeyStorePassword() throws URLSyntaxException
    {
        String url = "amqp://guest:guest@client/vhost?brokerlist='tcp://host:1234?key_store_password='keystorepassword1';tcp://host:1235?key_store_password='keystorepassword2''";
        ConnectionURL connectionurl = new AMQConnectionURL(url);

        String expectedToString = "amqp://guest:********@client/vhost?brokerlist='tcp://host:1234?key_store_password='********';tcp://host:1235?key_store_password='********''";
        String actualToString = connectionurl.toString();
        assertEquals("Unexpected toString form", expectedToString, actualToString);
    }
View Full Code Here

     * Test for QPID-3662 to ensure the {@code toString()} representation is correct.
     */
    public void testConnectionURLOptionToStringWithMaxPreftech() throws URLSyntaxException
    {
        String url = "amqp://guest:guest@client/localhost?maxprefetch='1'&brokerlist='tcp://localhost:1234?tcp_nodelay='true''";
        ConnectionURL connectionurl = new AMQConnectionURL(url);

        String expectedToString = "amqp://guest:********@client/localhost?maxprefetch='1'&brokerlist='tcp://localhost:1234?tcp_nodelay='true''";
        String actualToString = connectionurl.toString();
        assertEquals("Unexpected toString form", expectedToString, actualToString);
    }
View Full Code Here

    public void testSingleTransportMultiOptionURL() throws URLSyntaxException
    {
        String url = "amqp://guest:guest@/test?brokerlist='tcp://localhost:5672?foo='jim'&bar='bob'&fred='jimmy'',routingkey='jim',timeout='200',immediatedelivery='true'";

        ConnectionURL connectionurl = new AMQConnectionURL(url);

        assertTrue(connectionurl.getFailoverMethod() == null);
        assertTrue(connectionurl.getUsername().equals("guest"));
        assertTrue(connectionurl.getPassword().equals("guest"));
        assertTrue(connectionurl.getVirtualHost().equals("/test"));

        assertTrue(connectionurl.getBrokerCount() == 1);

        BrokerDetails service = connectionurl.getBrokerDetails(0);

        assertTrue(service.getTransport().equals("tcp"));

        assertTrue(service.getHost().equals("localhost"));
        assertTrue(service.getPort() == 5672);

        assertTrue(connectionurl.getOption("routingkey").equals("jim"));
        assertTrue(connectionurl.getOption("timeout").equals("200"));
        assertTrue(connectionurl.getOption("immediatedelivery").equals("true"));
    }
View Full Code Here

    public void testNoClientID() throws URLSyntaxException
    {
        String url = "amqp://user:@/test?brokerlist='tcp://localhost:5672'";

        ConnectionURL connectionurl = new AMQConnectionURL(url);

        assertTrue(connectionurl.getUsername().equals("user"));
        assertTrue(connectionurl.getPassword().equals(""));
        assertTrue(connectionurl.getVirtualHost().equals("/test"));

        assertTrue(connectionurl.getBrokerCount() == 1);
    }
View Full Code Here

    public void testClientIDWithUnderscore() throws URLSyntaxException
    {
        String url = "amqp://user:pass@client_id/test?brokerlist='tcp://localhost:5672'";

        ConnectionURL connectionurl = new AMQConnectionURL(url);

        assertTrue(connectionurl.getUsername().equals("user"));
        assertTrue(connectionurl.getPassword().equals("pass"));
        assertTrue(connectionurl.getVirtualHost().equals("/test"));
        assertTrue(connectionurl.getClientName().equals("client_id"));

        assertTrue(connectionurl.getBrokerCount() == 1);
    }
View Full Code Here

    public void testSingleTransportMultiOptionOnBrokerURL() throws URLSyntaxException
    {
        String url = "amqp://guest:guest@/test?brokerlist='tcp://localhost:5672?foo='jim'&bar='bob'&fred='jimmy'',routingkey='jim',timeout='200',immediatedelivery='true'";

        ConnectionURL connectionurl = new AMQConnectionURL(url);

        assertTrue(connectionurl.getFailoverMethod() == null);
        assertTrue(connectionurl.getUsername().equals("guest"));
        assertTrue(connectionurl.getPassword().equals("guest"));
        assertTrue(connectionurl.getVirtualHost().equals("/test"));

        assertTrue(connectionurl.getBrokerCount() == 1);

        BrokerDetails service = connectionurl.getBrokerDetails(0);

        assertTrue(service.getTransport().equals("tcp"));

        assertTrue(service.getHost().equals("localhost"));
        assertTrue(service.getPort() == 5672);
        assertEquals("jim",service.getProperty("foo"));
        assertEquals("bob",service.getProperty("bar"));
        assertEquals("jimmy",service.getProperty("fred"));

        assertTrue(connectionurl.getOption("routingkey").equals("jim"));
        assertTrue(connectionurl.getOption("timeout").equals("200"));
        assertTrue(connectionurl.getOption("immediatedelivery").equals("true"));
    }
View Full Code Here

     * <p>
     * QPID-2697
     */
    public void testOptionToString() throws Exception
    {
        ConnectionURL url = new AMQConnectionURL("amqp://user:pass@temp/test?maxprefetch='12345'&brokerlist='tcp://localhost:5672'");

        assertTrue("String representation should contain options and values", url.toString().contains("maxprefetch='12345'"));
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.jms.ConnectionURL

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.