activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r365280 - /incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/DefaultStoreBrokerTest.java
Date Mon, 02 Jan 2006 02:50:03 GMT
Author: chirino
Date: Sun Jan  1 18:50:00 2006
New Revision: 365280

URL: http://svn.apache.org/viewcvs?rev=365280&view=rev
Log:
Better test setup

Modified:
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/DefaultStoreBrokerTest.java

Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/DefaultStoreBrokerTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/DefaultStoreBrokerTest.java?rev=365280&r1=365279&r2=365280&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/DefaultStoreBrokerTest.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/store/DefaultStoreBrokerTest.java
Sun Jan  1 18:50:00 2006
@@ -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 @@
     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() {



Mime
View raw message