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 testConnectionURLString()
{
AMQConnectionFactory factory = new AMQConnectionFactory();
assertNull("ConnectionURL should have no value at start",
factory.getConnectionURL());
try
{
factory.setConnectionURLString(URL);
}
catch (URLSyntaxException e)
{
fail(e.getMessage());
}
//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());