1 18 package org.apache.activemq.config; 19 20 import org.apache.activemq.ActiveMQConnectionFactory; 21 import org.apache.activemq.test.JmsTopicSendReceiveWithTwoConnectionsTest; 22 23 import javax.naming.InitialContext ; 24 import javax.naming.Context ; 25 26 import java.io.File ; 27 import java.util.Hashtable ; 28 29 32 public class BrokerXmlConfigFromJNDITest extends JmsTopicSendReceiveWithTwoConnectionsTest { 33 protected ActiveMQConnectionFactory createConnectionFactory() throws Exception { 34 36 37 39 Hashtable properties = new Hashtable (); 42 properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); 43 44 47 File f = new File (System.getProperty("basedir", "."), "/src/test/resources/activemq.xml"); 48 properties.put(Context.PROVIDER_URL, "vm://localhost?brokerConfig=xbean:" + f.toURI()); 49 50 InitialContext context = new InitialContext (properties); 51 ActiveMQConnectionFactory connectionFactory = (ActiveMQConnectionFactory) context.lookup("ConnectionFactory"); 52 53 return connectionFactory; 55 } 56 57 } 58 | Popular Tags |