remove data store at end of the junit run

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@515627 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2007-03-07 16:12:35 +00:00
parent f7db42a835
commit c12d7bfa22
1 changed files with 14 additions and 7 deletions

View File

@ -28,6 +28,7 @@ import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;
/**
@ -41,14 +42,15 @@ public class DurableConsumerCloseAndReconnectTest extends TestSupport {
private MessageConsumer consumer;
private MessageProducer producer;
private Destination destination;
private int messageCount=0;
protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
return new ActiveMQConnectionFactory("vm://localhost?broker.persistent=true");
return new ActiveMQConnectionFactory("vm://localhost?broker.deleteAllMessagesOnStartup=false");
}
public void testCreateDurableConsumerCloseThenReconnect() throws Exception {
// force the server to stay up across both connection tests
Connection dummyConnection = createConnection();
dummyConnection.start();
consumeMessagesDeliveredWhileConsumerClosed();
@ -56,6 +58,11 @@ public class DurableConsumerCloseAndReconnectTest extends TestSupport {
// now lets try again without one connection open
consumeMessagesDeliveredWhileConsumerClosed();
//now delete the db
ActiveMQConnectionFactory fac = new ActiveMQConnectionFactory("vm://localhost?broker.deleteAllMessagesOnStartup=true");
dummyConnection = fac.createConnection();
dummyConnection.start();
dummyConnection.close();
}
protected void consumeMessagesDeliveredWhileConsumerClosed() throws Exception {
@ -111,8 +118,8 @@ public class DurableConsumerCloseAndReconnectTest extends TestSupport {
producer = session.createProducer(destination);
producer.setDeliveryMode(DeliveryMode.PERSISTENT);
producer.send(session.createTextMessage("This is a test"));
TextMessage msg = session.createTextMessage("This is a test: " + messageCount++);
producer.send(msg);
producer.close();
producer = null;