diff --git a/activemq-core/src/test/java/org/apache/activemq/broker/store/DefaultStoreBrokerTest.java b/activemq-core/src/test/java/org/apache/activemq/broker/store/DefaultStoreBrokerTest.java index 02c6bd0d8e..2220475fc4 100755 --- a/activemq-core/src/test/java/org/apache/activemq/broker/store/DefaultStoreBrokerTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/broker/store/DefaultStoreBrokerTest.java @@ -16,24 +16,13 @@ */ package org.apache.activemq.broker.store; -import java.io.File; -import java.io.IOException; import java.net.URI; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; - -import javax.sql.DataSource; import junit.framework.Test; import org.apache.activemq.broker.BrokerFactory; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.BrokerTest; -import org.apache.activemq.store.DefaultPersistenceAdapterFactory; -import org.apache.activemq.store.PersistenceAdapter; -import org.apache.activemq.store.jdbc.JDBCPersistenceAdapter; -import org.apache.activemq.store.journal.JournalPersistenceAdapter; /** * Once the wire format is completed we can test against real persistence storage. @@ -45,29 +34,9 @@ public class DefaultStoreBrokerTest extends BrokerTest { protected BrokerService createBroker() throws Exception { return BrokerFactory.createBroker(new URI("broker://()/localhost?deleteAllMessagesOnStartup=true")); } - - protected PersistenceAdapter createPersistenceAdapter(boolean clean) throws IOException { - File dataDir = new File("test-data"); - if( clean ) { - recursiveDelete(new File(dataDir, "journal")); - } - DefaultPersistenceAdapterFactory factory = new DefaultPersistenceAdapterFactory(); - factory.setDataDirectory(dataDir); - // Use a smaller journal so that tests are quicker. - factory.setJournalLogFileSize(1024*64); - PersistenceAdapter adapter = factory.createPersistenceAdapter(); - if( clean ) { - DataSource ds = ((JDBCPersistenceAdapter)((JournalPersistenceAdapter)adapter).getLongTermPersistence()).getDataSource(); - try { - Connection c = ds.getConnection(); - Statement s = c.createStatement(); - try { s.executeUpdate("DROP TABLE ACTIVEMQ_MSGS");} catch (SQLException e) {} - try { s.executeUpdate("DROP TABLE ACTIVEMQ_TXS");} catch (SQLException e) {} - try { s.executeUpdate("DROP TABLE ACTIVEMQ_ACKS");} catch (SQLException e) {} - } catch (SQLException e) { - } - } - return adapter; + + protected BrokerService createRestartedBroker() throws Exception { + return BrokerFactory.createBroker(new URI("broker://()/localhost")); } public static Test suite() {