}
public void testConnectionFactoryConnectionMatching() throws ResourceException, JMSException {
ActiveMQConnectionRequestInfo ri1 = new ActiveMQConnectionRequestInfo();
ri1.setServerUrl(DEFAULT_HOST);
ri1.setUserName(ActiveMQConnectionFactory.DEFAULT_USER);
ri1.setPassword(ActiveMQConnectionFactory.DEFAULT_PASSWORD);
ActiveMQConnectionRequestInfo ri2 = new ActiveMQConnectionRequestInfo();
ri2.setServerUrl(REMOTE_HOST);
ri2.setUserName(ActiveMQConnectionFactory.DEFAULT_USER);
ri2.setPassword(ActiveMQConnectionFactory.DEFAULT_PASSWORD);
assertNotSame(ri1, ri2);
ManagedConnection connection1 = managedConnectionFactory.createManagedConnection(null, ri1);
ManagedConnection connection2 = managedConnectionFactory.createManagedConnection(null, ri2);
assertTrue(connection1!=connection2);
HashSet set = new HashSet();
set.add(connection1);
set.add(connection2);
// Can we match for the first connection?
ActiveMQConnectionRequestInfo ri3 = ri1.copy();
assertTrue( ri1!=ri3 && ri1.equals(ri3) );
ManagedConnection test = managedConnectionFactory.matchManagedConnections(set,null, ri3);
assertTrue( connection1==test );
// Can we match for the second connection?