use the BrokerFactory to create BrokerService objects

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@365746 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2006-01-03 21:01:10 +00:00
parent 6027d2aee9
commit 050637cdf6
4 changed files with 20 additions and 20 deletions

View File

@ -88,6 +88,7 @@ public class SpringTest extends TestCase {
* @throws Exception
*/
protected void assertSenderConfig(String config) throws Exception {
Thread.currentThread().setContextClassLoader(SpringTest.class.getClassLoader());
context = new ClassPathXmlApplicationContext(config);
consumer = (SpringConsumer) context.getBean("consumer");

View File

@ -16,12 +16,8 @@
*/
package org.apache.activemq.test.retroactive;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.EmbeddedBrokerTestSupport;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.util.MessageIdList;
import org.apache.activemq.xbean.BrokerFactoryBean;
import org.springframework.core.io.ClassPathResource;
import java.net.URI;
import java.util.Date;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@ -30,7 +26,11 @@ import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import java.util.Date;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.EmbeddedBrokerTestSupport;
import org.apache.activemq.broker.BrokerFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.util.MessageIdList;
/**
*
@ -93,9 +93,7 @@ public class RetroactiveConsumerTestWithSimpleMessageListTest extends EmbeddedBr
protected BrokerService createBroker() throws Exception {
String uri = getBrokerXml();
System.out.println("Loading broker configuration from the classpath with URI: " + uri);
BrokerFactoryBean factory = new BrokerFactoryBean(new ClassPathResource(uri));
factory.afterPropertiesSet();
return factory.getBroker();
return BrokerFactory.createBroker(new URI("xbean:"+uri));
}
protected void startBroker() throws Exception {

View File

@ -18,6 +18,7 @@ package org.apache.activemq.test.retroactive;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.EmbeddedBrokerTestSupport;
import org.apache.activemq.broker.BrokerFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.util.MessageIdList;
import org.apache.activemq.xbean.BrokerFactoryBean;
@ -30,6 +31,7 @@ import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import java.net.URI;
import java.util.Date;
/**
@ -91,9 +93,7 @@ public class RetroactiveConsumerWithMessageQueryTest extends EmbeddedBrokerTestS
protected BrokerService createBroker() throws Exception {
String uri = getBrokerXml();
System.out.println("Loading broker configuration from the classpath with URI: " + uri);
BrokerFactoryBean factory = new BrokerFactoryBean(new ClassPathResource(uri));
factory.afterPropertiesSet();
return factory.getBroker();
return BrokerFactory.createBroker(new URI("xbean:"+uri));
}
protected void startBroker() throws Exception {

View File

@ -16,7 +16,12 @@
*/
package org.apache.activemq.xbean;
import java.net.URI;
import junit.framework.TestCase;
import org.apache.activemq.broker.Broker;
import org.apache.activemq.broker.BrokerFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.ConnectionContext;
import org.apache.activemq.broker.region.Topic;
@ -29,10 +34,6 @@ import org.apache.activemq.broker.region.policy.TimedSubscriptionRecoveryPolicy;
import org.apache.activemq.command.ActiveMQTopic;
import org.apache.activemq.command.ConnectionId;
import org.apache.activemq.command.ConnectionInfo;
import org.apache.activemq.xbean.BrokerFactoryBean;
import org.springframework.core.io.ClassPathResource;
import junit.framework.TestCase;
/**
*
@ -107,9 +108,9 @@ public class XBeanConfigTest extends TestCase {
}
protected BrokerService createBroker() throws Exception {
BrokerFactoryBean factory = new BrokerFactoryBean(new ClassPathResource("org/apache/activemq/xbean/activemq-policy.xml"));
factory.afterPropertiesSet();
return factory.getBroker();
String uri = "org/apache/activemq/xbean/activemq-policy.xml";
System.out.println("Loading broker configuration from the classpath with URI: " + uri);
return BrokerFactory.createBroker(new URI("xbean:"+uri));
}
}