mirror of https://github.com/apache/activemq.git
Fixed a few of the broken durable subscription tests.
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@377937 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0f502fae3d
commit
7b945f9d92
|
@ -28,6 +28,7 @@ import javax.jms.TextMessage;
|
||||||
import javax.jms.Topic;
|
import javax.jms.Topic;
|
||||||
import javax.jms.TopicSubscriber;
|
import javax.jms.TopicSubscriber;
|
||||||
|
|
||||||
|
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||||
import org.apache.activemq.TestSupport;
|
import org.apache.activemq.TestSupport;
|
||||||
import org.apache.activemq.broker.BrokerService;
|
import org.apache.activemq.broker.BrokerService;
|
||||||
import org.apache.activemq.store.PersistenceAdapter;
|
import org.apache.activemq.store.PersistenceAdapter;
|
||||||
|
@ -42,7 +43,10 @@ abstract public class DurableSubscriptionTestSupport extends TestSupport {
|
||||||
private TopicSubscriber consumer;
|
private TopicSubscriber consumer;
|
||||||
private MessageProducer producer;
|
private MessageProducer producer;
|
||||||
private BrokerService broker;
|
private BrokerService broker;
|
||||||
private boolean init;
|
|
||||||
|
protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
|
||||||
|
return new ActiveMQConnectionFactory("vm://durable-broker");
|
||||||
|
}
|
||||||
|
|
||||||
protected Connection createConnection() throws Exception {
|
protected Connection createConnection() throws Exception {
|
||||||
Connection rc = super.createConnection();
|
Connection rc = super.createConnection();
|
||||||
|
@ -55,8 +59,8 @@ abstract public class DurableSubscriptionTestSupport extends TestSupport {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
}
|
}
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
destroyBroker();
|
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
|
destroyBroker();
|
||||||
}
|
}
|
||||||
protected void restartBroker() throws Exception {
|
protected void restartBroker() throws Exception {
|
||||||
destroyBroker();
|
destroyBroker();
|
||||||
|
@ -65,13 +69,10 @@ abstract public class DurableSubscriptionTestSupport extends TestSupport {
|
||||||
private void createBroker() throws Exception {
|
private void createBroker() throws Exception {
|
||||||
try {
|
try {
|
||||||
broker = new BrokerService();
|
broker = new BrokerService();
|
||||||
broker.setBrokerName("durable_broker");
|
broker.setBrokerName("durable-broker");
|
||||||
broker.setDeleteAllMessagesOnStartup(true);
|
broker.setDeleteAllMessagesOnStartup(true);
|
||||||
broker.setPersistenceAdapter(createPersistenceAdapter());
|
broker.setPersistenceAdapter(createPersistenceAdapter());
|
||||||
broker.setPersistent(true);
|
broker.setPersistent(true);
|
||||||
broker.addConnector("vm://localhost");
|
|
||||||
init = true;
|
|
||||||
|
|
||||||
broker.start();
|
broker.start();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -83,11 +84,10 @@ abstract public class DurableSubscriptionTestSupport extends TestSupport {
|
||||||
private void createRestartedBroker() throws Exception {
|
private void createRestartedBroker() throws Exception {
|
||||||
try {
|
try {
|
||||||
broker = new BrokerService();
|
broker = new BrokerService();
|
||||||
broker.setBrokerName("durable_broker");
|
broker.setBrokerName("durable-broker");
|
||||||
broker.setDeleteAllMessagesOnStartup(false);
|
broker.setDeleteAllMessagesOnStartup(false);
|
||||||
broker.setPersistenceAdapter(createPersistenceAdapter());
|
broker.setPersistenceAdapter(createPersistenceAdapter());
|
||||||
broker.setPersistent(true);
|
broker.setPersistent(true);
|
||||||
broker.addConnector("vm://localhost");
|
|
||||||
broker.start();
|
broker.start();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in New Issue