activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject [2/8] activemq git commit: more tidy up of derby usage in tests to ensure proper cleanup; ci failures
Date Wed, 20 May 2015 12:43:31 GMT
more tidy up of derby usage in tests to ensure proper cleanup; ci failures


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/17f4f349
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/17f4f349
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/17f4f349

Branch: refs/heads/master
Commit: 17f4f349f3fc8432ee1d39bf354f48d3fcdb9ae2
Parents: 2536c03
Author: gtully <gary.tully@gmail.com>
Authored: Tue May 19 11:44:11 2015 +0100
Committer: gtully <gary.tully@gmail.com>
Committed: Wed May 20 09:57:05 2015 +0100

----------------------------------------------------------------------
 .../org/apache/activemq/broker/LockableServiceSupport.java  | 1 +
 .../activemq/network/DemandForwardingBridgeSupport.java     | 2 +-
 .../activemq/store/jdbc/DataSourceServiceSupport.java       | 5 +++++
 .../test/java/org/apache/activemq/broker/AMQ4351Test.java   | 4 +---
 .../apache/activemq/broker/JdbcXARecoveryBrokerTest.java    | 9 ++-------
 .../activemq/broker/store/RecoverExpiredMessagesTest.java   | 5 ++++-
 6 files changed, 14 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/17f4f349/activemq-broker/src/main/java/org/apache/activemq/broker/LockableServiceSupport.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/LockableServiceSupport.java
b/activemq-broker/src/main/java/org/apache/activemq/broker/LockableServiceSupport.java
index 18199ce..786eefb 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/LockableServiceSupport.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/LockableServiceSupport.java
@@ -112,6 +112,7 @@ public abstract class LockableServiceSupport extends ServiceSupport implements
L
             }
             if (locker != null) {
                 getLocker().stop();
+                locker = null;
             }
         }
         ThreadPoolUtils.shutdown(clockDaemon);

http://git-wip-us.apache.org/repos/asf/activemq/blob/17f4f349/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
b/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
index 22ac0d8..1b77e73 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
@@ -1040,7 +1040,7 @@ public abstract class DemandForwardingBridgeSupport implements NetworkBridge,
Br
                 } else if (command.isBrokerInfo()) {
                     futureLocalBrokerInfo.set((BrokerInfo) command);
                 } else if (command.isShutdownInfo()) {
-                    LOG.info("{} Shutting down", configuration.getBrokerName());
+                    LOG.info("{} Shutting down {}", configuration.getBrokerName(), configuration.getName());
                     stop();
                 } else if (command.getClass() == ConnectionError.class) {
                     ConnectionError ce = (ConnectionError) command;

http://git-wip-us.apache.org/repos/asf/activemq/blob/17f4f349/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/DataSourceServiceSupport.java
----------------------------------------------------------------------
diff --git a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/DataSourceServiceSupport.java
b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/DataSourceServiceSupport.java
index db1888d..e36a66b 100644
--- a/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/DataSourceServiceSupport.java
+++ b/activemq-jdbc-store/src/main/java/org/apache/activemq/store/jdbc/DataSourceServiceSupport.java
@@ -98,11 +98,16 @@ abstract public class DataSourceServiceSupport extends LockableServiceSupport
{
         final EmbeddedDataSource ds = new EmbeddedDataSource();
         ds.setDatabaseName("derbydb");
         ds.setCreateDatabase("create");
+        try {
+            ds.getConnection().close();
+        } catch (SQLException ignored) {
+        }
         return ds;
     }
 
     public static void shutdownDefaultDataSource(DataSource dataSource) {
         final EmbeddedDataSource ds =  (EmbeddedDataSource) dataSource;
+        ds.setCreateDatabase("shutdown");
         ds.setShutdownDatabase("shutdown");
         try {
             ds.getConnection();

http://git-wip-us.apache.org/repos/asf/activemq/blob/17f4f349/activemq-unit-tests/src/test/java/org/apache/activemq/broker/AMQ4351Test.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/AMQ4351Test.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/AMQ4351Test.java
index 0b0e5cc..1cf259b 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/AMQ4351Test.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/AMQ4351Test.java
@@ -60,11 +60,9 @@ public class AMQ4351Test extends BrokerTestSupport {
         broker.setOfflineDurableSubscriberTaskSchedule(500);
         broker.setOfflineDurableSubscriberTimeout(2000); // lets delete durable subs much
faster.
 
-        System.setProperty("derby.system.home", new File(IOHelper.getDefaultDataDirectory()).getCanonicalPath());
-
         JDBCPersistenceAdapter jdbc = new JDBCPersistenceAdapter();
-        jdbc.deleteAllMessages();
         broker.setPersistenceAdapter(jdbc);
+        broker.setDeleteAllMessagesOnStartup(true);
         return broker;
     }
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/17f4f349/activemq-unit-tests/src/test/java/org/apache/activemq/broker/JdbcXARecoveryBrokerTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/JdbcXARecoveryBrokerTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/JdbcXARecoveryBrokerTest.java
index 35b944a..4b72538 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/JdbcXARecoveryBrokerTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/JdbcXARecoveryBrokerTest.java
@@ -20,6 +20,7 @@ import java.io.File;
 import junit.framework.Test;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.activemq.store.jdbc.DataSourceServiceSupport;
 import org.apache.activemq.store.jdbc.JDBCPersistenceAdapter;
 import org.apache.activemq.util.IOHelper;
 import org.apache.derby.jdbc.EmbeddedDataSource;
@@ -67,13 +68,7 @@ public class JdbcXARecoveryBrokerTest extends XARecoveryBrokerTest {
 
     private void stopDerby() {
         LOG.info("STOPPING DB!@!!!!");
-        final EmbeddedDataSource ds = dataSource;
-        try {
-            ds.setShutdownDatabase("shutdown");
-            ds.getConnection();
-        } catch (Exception ignored) {
-        }
-
+        DataSourceServiceSupport.shutdownDefaultDataSource(dataSource);
     }
 
     public static Test suite() {

http://git-wip-us.apache.org/repos/asf/activemq/blob/17f4f349/activemq-unit-tests/src/test/java/org/apache/activemq/broker/store/RecoverExpiredMessagesTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/store/RecoverExpiredMessagesTest.java
b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/store/RecoverExpiredMessagesTest.java
index fb0296c..581311d 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/store/RecoverExpiredMessagesTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/store/RecoverExpiredMessagesTest.java
@@ -56,7 +56,7 @@ public class RecoverExpiredMessagesTest extends BrokerRestartTestSupport
{
         addCombinationValues("queuePendingPolicy", new PendingQueueMessageStoragePolicy[]
{new FilePendingQueueMessageStoragePolicy(), new VMPendingQueueMessageStoragePolicy()});
         PersistenceAdapter[] persistenceAdapters = new PersistenceAdapter[] {
                 new KahaDBPersistenceAdapter(),
-                new JDBCPersistenceAdapter(JDBCPersistenceAdapter.createDataSource(IOHelper.getDefaultDataDirectory()),
new OpenWireFormat())
+                new JDBCPersistenceAdapter()
         };
         for (PersistenceAdapter adapter : persistenceAdapters) {
             adapter.setDirectory(new File(IOHelper.getDefaultDataDirectory()));
@@ -134,6 +134,9 @@ public class RecoverExpiredMessagesTest extends BrokerRestartTestSupport
{
     @Override
     protected void configureBroker(BrokerService broker) throws Exception {
         super.configureBroker(broker);
+        if (persistenceAdapter instanceof JDBCPersistenceAdapter) {
+           ((JDBCPersistenceAdapter) persistenceAdapter).setLockDataSource(null);
+        }
         broker.setPersistenceAdapter(persistenceAdapter);
     }
 


Mime
View raw message