mirror of https://github.com/apache/activemq.git
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:
parent
6027d2aee9
commit
050637cdf6
|
@ -88,6 +88,7 @@ public class SpringTest extends TestCase {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected void assertSenderConfig(String config) throws Exception {
|
protected void assertSenderConfig(String config) throws Exception {
|
||||||
|
Thread.currentThread().setContextClassLoader(SpringTest.class.getClassLoader());
|
||||||
context = new ClassPathXmlApplicationContext(config);
|
context = new ClassPathXmlApplicationContext(config);
|
||||||
|
|
||||||
consumer = (SpringConsumer) context.getBean("consumer");
|
consumer = (SpringConsumer) context.getBean("consumer");
|
||||||
|
|
|
@ -16,12 +16,8 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.test.retroactive;
|
package org.apache.activemq.test.retroactive;
|
||||||
|
|
||||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
import java.net.URI;
|
||||||
import org.apache.activemq.EmbeddedBrokerTestSupport;
|
import java.util.Date;
|
||||||
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 javax.jms.Connection;
|
import javax.jms.Connection;
|
||||||
import javax.jms.ConnectionFactory;
|
import javax.jms.ConnectionFactory;
|
||||||
|
@ -30,7 +26,11 @@ import javax.jms.MessageProducer;
|
||||||
import javax.jms.Session;
|
import javax.jms.Session;
|
||||||
import javax.jms.TextMessage;
|
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 {
|
protected BrokerService createBroker() throws Exception {
|
||||||
String uri = getBrokerXml();
|
String uri = getBrokerXml();
|
||||||
System.out.println("Loading broker configuration from the classpath with URI: " + uri);
|
System.out.println("Loading broker configuration from the classpath with URI: " + uri);
|
||||||
BrokerFactoryBean factory = new BrokerFactoryBean(new ClassPathResource(uri));
|
return BrokerFactory.createBroker(new URI("xbean:"+uri));
|
||||||
factory.afterPropertiesSet();
|
|
||||||
return factory.getBroker();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void startBroker() throws Exception {
|
protected void startBroker() throws Exception {
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.activemq.test.retroactive;
|
||||||
|
|
||||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||||
import org.apache.activemq.EmbeddedBrokerTestSupport;
|
import org.apache.activemq.EmbeddedBrokerTestSupport;
|
||||||
|
import org.apache.activemq.broker.BrokerFactory;
|
||||||
import org.apache.activemq.broker.BrokerService;
|
import org.apache.activemq.broker.BrokerService;
|
||||||
import org.apache.activemq.util.MessageIdList;
|
import org.apache.activemq.util.MessageIdList;
|
||||||
import org.apache.activemq.xbean.BrokerFactoryBean;
|
import org.apache.activemq.xbean.BrokerFactoryBean;
|
||||||
|
@ -30,6 +31,7 @@ import javax.jms.MessageProducer;
|
||||||
import javax.jms.Session;
|
import javax.jms.Session;
|
||||||
import javax.jms.TextMessage;
|
import javax.jms.TextMessage;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,9 +93,7 @@ public class RetroactiveConsumerWithMessageQueryTest extends EmbeddedBrokerTestS
|
||||||
protected BrokerService createBroker() throws Exception {
|
protected BrokerService createBroker() throws Exception {
|
||||||
String uri = getBrokerXml();
|
String uri = getBrokerXml();
|
||||||
System.out.println("Loading broker configuration from the classpath with URI: " + uri);
|
System.out.println("Loading broker configuration from the classpath with URI: " + uri);
|
||||||
BrokerFactoryBean factory = new BrokerFactoryBean(new ClassPathResource(uri));
|
return BrokerFactory.createBroker(new URI("xbean:"+uri));
|
||||||
factory.afterPropertiesSet();
|
|
||||||
return factory.getBroker();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void startBroker() throws Exception {
|
protected void startBroker() throws Exception {
|
||||||
|
|
|
@ -16,7 +16,12 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.xbean;
|
package org.apache.activemq.xbean;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.apache.activemq.broker.Broker;
|
import org.apache.activemq.broker.Broker;
|
||||||
|
import org.apache.activemq.broker.BrokerFactory;
|
||||||
import org.apache.activemq.broker.BrokerService;
|
import org.apache.activemq.broker.BrokerService;
|
||||||
import org.apache.activemq.broker.ConnectionContext;
|
import org.apache.activemq.broker.ConnectionContext;
|
||||||
import org.apache.activemq.broker.region.Topic;
|
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.ActiveMQTopic;
|
||||||
import org.apache.activemq.command.ConnectionId;
|
import org.apache.activemq.command.ConnectionId;
|
||||||
import org.apache.activemq.command.ConnectionInfo;
|
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 {
|
protected BrokerService createBroker() throws Exception {
|
||||||
BrokerFactoryBean factory = new BrokerFactoryBean(new ClassPathResource("org/apache/activemq/xbean/activemq-policy.xml"));
|
String uri = "org/apache/activemq/xbean/activemq-policy.xml";
|
||||||
factory.afterPropertiesSet();
|
System.out.println("Loading broker configuration from the classpath with URI: " + uri);
|
||||||
return factory.getBroker();
|
return BrokerFactory.createBroker(new URI("xbean:"+uri));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue