### Question:
HCatAccessorService implements Service { public JMSConnectionInfo getJMSConnectionInfo(URI publisherURI) { String publisherAuthority = publisherURI.getAuthority(); JMSConnectionInfo connInfo = null; if (publisherJMSConnInfoMap.containsKey(publisherAuthority)) { connInfo = publisherJMSConnInfoMap.get(publisherAuthority); } else { String schemeWithAuthority = publisherURI.getScheme() + ": for (MappingRule mr : mappingRules) { String jndiPropertiesString = mr.applyRule(schemeWithAuthority); if (jndiPropertiesString != null) { connInfo = new JMSConnectionInfo(jndiPropertiesString); publisherJMSConnInfoMap.put(publisherAuthority, connInfo); LOG.info("Adding hcat server [{0}] to the list of JMS publishers", schemeWithAuthority); break; } } if (connInfo == null && defaultJMSConnInfo != null) { connInfo = defaultJMSConnInfo; publisherJMSConnInfoMap.put(publisherAuthority, defaultJMSConnInfo); LOG.info("Adding hcat server [{0}] to the list of JMS publishers", schemeWithAuthority); } else { nonJMSPublishers.add(publisherAuthority); LOG.info("Adding hcat server [{0}] to the list of non JMS publishers", schemeWithAuthority); } } return connInfo; }  @Override void init(Services services); Configuration getHCatConf(); boolean isKnownPublisher(URI sourceURI); JMSConnectionInfo getJMSConnectionInfo(URI publisherURI); boolean isRegisteredForNotification(HCatURI hcatURI); void registerForNotification(HCatURI hcatURI, String topic, HCatMessageHandler msgHandler); void unregisterFromNotification(HCatURI hcatURI); void unregisterFromNotification(String server, String database, String table); @Override void destroy(); @Override Class<? extends Service> getInterface(); static final String CONF_PREFIX; static final String JMS_CONNECTIONS_PROPERTIES; static final String HCAT_CONFIGURATION; }### Answer:
@Test public void testGetJMSConnectionInfo() throws Exception { services.destroy(); services = super.setupServicesForHCatalog(); Configuration conf = services.getConf(); String server1 = "default=java.naming.factory.initial#org.apache.activemq.jndi.ActiveMQInitialContextFactory;" + "java.naming.provider.url#vm: String server2 = "hcat: "java.naming.provider.url#tcp: String server3 = "hcat: "java.naming.provider.url#tcp:localhost:61616"; String jmsConnectionURL = server1 + "," + server2 + "," + server3; conf.set(HCatAccessorService.JMS_CONNECTIONS_PROPERTIES, jmsConnectionURL); services.init(); HCatAccessorService hcatService = services.get(HCatAccessorService.class); JMSConnectionInfo connInfo = hcatService.getJMSConnectionInfo(new URI("hcat: assertEquals("java.naming.factory.initial#Dummy.Factory;java.naming.provider.url#tcp: connInfo.getJNDIPropertiesString()); connInfo = hcatService.getJMSConnectionInfo(new URI("http: assertEquals( "java.naming.factory.initial#org.apache.activemq.jndi.ActiveMQInitialContextFactory;" + "java.naming.provider.url#vm: connInfo.getJNDIPropertiesString()); connInfo = hcatService.getJMSConnectionInfo(new URI("hcat: assertEquals("java.naming.factory.initial#Dummy.Factory;java.naming.provider.url#tcp:localhost:61616", connInfo.getJNDIPropertiesString()); }