activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject activemq git commit: more levedb test cleaning and turning on debug logging to try to figure CI failures
Date Thu, 25 Dec 2014 13:09:08 GMT
Repository: activemq
Updated Branches:
  refs/heads/trunk 531538908 -> 9752e1dc9


more levedb test cleaning and turning on debug logging to try to figure CI failures


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

Branch: refs/heads/trunk
Commit: 9752e1dc9365ff23448f6933c978e7f71f857518
Parents: 5315389
Author: Dejan Bosanac <dejan@nighttale.net>
Authored: Thu Dec 25 14:08:54 2014 +0100
Committer: Dejan Bosanac <dejan@nighttale.net>
Committed: Thu Dec 25 14:08:54 2014 +0100

----------------------------------------------------------------------
 .../leveldb/test/ElectingLevelDBStoreTest.java  | 26 +++++++++++++------
 .../leveldb/test/MasterLevelDBStoreTest.java    | 14 +++++++++-
 .../test/ReplicatedLevelDBStoreTest.java        | 27 ++++++++++++++++++++
 .../src/test/resources/log4j.properties         |  6 ++---
 .../leveldb/test/LevelDBFastEnqueueTest.scala   |  2 ++
 .../apache/activemq/leveldb/test/PListTest.java |  2 ++
 6 files changed, 65 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/9752e1dc/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java
----------------------------------------------------------------------
diff --git a/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java
b/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java
index e8baf40..f93365c 100644
--- a/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java
+++ b/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java
@@ -22,6 +22,8 @@ import org.apache.activemq.leveldb.CountDownFuture;
 import org.apache.activemq.leveldb.LevelDBStore;
 import org.apache.activemq.leveldb.replicated.ElectingLevelDBStore;
 import org.apache.activemq.store.MessageStore;
+import org.apache.commons.io.FileUtils;
+import org.junit.After;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -38,11 +40,16 @@ import static org.junit.Assert.*;
 public class ElectingLevelDBStoreTest extends ZooKeeperTestSupport {
 
     protected static final Logger LOG = LoggerFactory.getLogger(ElectingLevelDBStoreTest.class);
+    ArrayList<ElectingLevelDBStore> stores = new ArrayList<ElectingLevelDBStore>();
+    ElectingLevelDBStore master = null;
 
     @Test(timeout = 1000*60*10)
     public void testElection() throws Exception {
+        deleteDirectory("leveldb-node1");
+        deleteDirectory("leveldb-node2");
+        deleteDirectory("leveldb-node3");
+
 
-        ArrayList<ElectingLevelDBStore> stores = new ArrayList<ElectingLevelDBStore>();
         ArrayList<CountDownFuture> pending_starts = new ArrayList<CountDownFuture>();
 
         for(String dir: new String[]{"leveldb-node1", "leveldb-node2", "leveldb-node3"})
{
@@ -65,7 +72,6 @@ public class ElectingLevelDBStoreTest extends ZooKeeperTestSupport {
         }
 
         // Make sure only of the stores is reporting to be the master.
-        ElectingLevelDBStore master = null;
         for(ElectingLevelDBStore store: stores) {
             if( store.isMaster() ) {
                 assertNull(master);
@@ -124,11 +130,6 @@ public class ElectingLevelDBStoreTest extends ZooKeeperTestSupport {
 
         LOG.info("Checking master state");
         assertEquals(expected_list, getMessages(ms));
-
-        master.stop();
-        for(ElectingLevelDBStore store: stores) {
-            store.stop();
-        }
     }
 
     @Test(timeout = 1000 * 60 * 10)
@@ -168,10 +169,19 @@ public class ElectingLevelDBStoreTest extends ZooKeeperTestSupport {
                 }
             }
         });
+    }
 
-        for (ElectingLevelDBStore store : stores) {
+    @After
+    public void stop() throws Exception {
+        if (master != null) {
+            master.stop();
+            FileUtils.deleteDirectory(master.directory());
+        }
+        for(ElectingLevelDBStore store: stores) {
             store.stop();
+            FileUtils.deleteDirectory(store.directory());
         }
+        stores.clear();
     }
 
     private CountDownFuture asyncStart(final Service service) {

http://git-wip-us.apache.org/repos/asf/activemq/blob/9752e1dc/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/MasterLevelDBStoreTest.java
----------------------------------------------------------------------
diff --git a/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/MasterLevelDBStoreTest.java
b/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/MasterLevelDBStoreTest.java
index c53e6f2..b639902 100644
--- a/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/MasterLevelDBStoreTest.java
+++ b/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/MasterLevelDBStoreTest.java
@@ -17,6 +17,8 @@
 package org.apache.activemq.leveldb.test;
 
 import org.apache.activemq.leveldb.replicated.MasterLevelDBStore;
+import org.apache.commons.io.FileUtils;
+import org.junit.After;
 import org.junit.Test;
 
 import java.net.BindException;
@@ -34,9 +36,11 @@ import static org.junit.Assert.*;
  */
 public class MasterLevelDBStoreTest {
 
+    MasterLevelDBStore store;
+
     @Test(timeout = 1000*60*10)
     public void testStoppingStoreStopsTransport() throws Exception {
-        final MasterLevelDBStore store = new MasterLevelDBStore();
+        store = new MasterLevelDBStore();
         store.setReplicas(0);
 
         ExecutorService threads = Executors.newFixedThreadPool(1);
@@ -86,4 +90,12 @@ public class MasterLevelDBStoreTest {
         }
 
     }
+
+    @After
+    public void stop() throws Exception {
+        if (store.isStarted()) {
+            store.stop();
+        }
+        FileUtils.deleteDirectory(store.directory());
+    }
 }

http://git-wip-us.apache.org/repos/asf/activemq/blob/9752e1dc/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ReplicatedLevelDBStoreTest.java
----------------------------------------------------------------------
diff --git a/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ReplicatedLevelDBStoreTest.java
b/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ReplicatedLevelDBStoreTest.java
index b84f030..206914f 100644
--- a/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ReplicatedLevelDBStoreTest.java
+++ b/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ReplicatedLevelDBStoreTest.java
@@ -20,11 +20,14 @@ import org.apache.activemq.Service;
 import org.apache.activemq.command.ActiveMQQueue;
 import org.apache.activemq.leveldb.CountDownFuture;
 import org.apache.activemq.leveldb.LevelDBStore;
+import org.apache.activemq.leveldb.replicated.ElectingLevelDBStore;
 import org.apache.activemq.leveldb.replicated.MasterLevelDBStore;
 import org.apache.activemq.leveldb.replicated.SlaveLevelDBStore;
 import org.apache.activemq.leveldb.util.FileSupport;
 import org.apache.activemq.store.MessageStore;
+import org.apache.commons.io.FileUtils;
 import org.fusesource.hawtdispatch.transport.TcpTransport;
+import org.junit.After;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -44,6 +47,8 @@ import static org.junit.Assert.*;
 public class ReplicatedLevelDBStoreTest {
     protected static final Logger LOG = LoggerFactory.getLogger(ReplicatedLevelDBStoreTest.class);
 
+    ArrayList<LevelDBStore> stores = new ArrayList<LevelDBStore>();
+
     @Test(timeout = 1000*60*10)
     public void testMinReplicaEnforced() throws Exception {
 
@@ -55,6 +60,7 @@ public class ReplicatedLevelDBStoreTest {
         final MasterLevelDBStore master = createMaster(masterDir);
         master.setReplicas(2);
         CountDownFuture masterStartLatch = asyncStart(master);
+        stores.add(master);
 
         // Start the store should not complete since we don't have enough
         // replicas.
@@ -63,6 +69,7 @@ public class ReplicatedLevelDBStoreTest {
         // Adding a slave should allow the master startup to complete.
         SlaveLevelDBStore slave = createSlave(master, slaveDir);
         slave.start();
+        stores.add(slave);
 
         assertTrue(masterStartLatch.await(2, TimeUnit.SECONDS));
 
@@ -142,6 +149,12 @@ public class ReplicatedLevelDBStoreTest {
             asyncStart(slave2);
             masterStart.await();
 
+            if (j == 0) {
+                stores.add(master);
+                stores.add(slave1);
+                stores.add(slave2);
+            }
+
             MessageStore ms = master.createQueueMessageStore(new ActiveMQQueue("TEST"));
 
             LOG.info("Checking: "+master.getDirectory());
@@ -205,6 +218,7 @@ public class ReplicatedLevelDBStoreTest {
         ArrayList<String> expected_list = new ArrayList<String>();
 
         MasterLevelDBStore node1 = createMaster(node1Dir);
+        stores.add(node1);
         CountDownFuture masterStart = asyncStart(node1);
 
         // Lets create a 1 slow slave...
@@ -221,8 +235,10 @@ public class ReplicatedLevelDBStoreTest {
                 return transport;
             }
         };
+        stores.add(node2);
         configureSlave(node2, node1, node2Dir);
         SlaveLevelDBStore node3 = createSlave(node1, node3Dir);
+        stores.add(node3);
 
         asyncStart(node2);
         asyncStart(node3);
@@ -253,6 +269,17 @@ public class ReplicatedLevelDBStoreTest {
         node2.stop();
     }
 
+    @After
+    public void stop() throws Exception {
+        for(LevelDBStore store: stores) {
+            if (store.isStarted()) {
+                store.stop();
+            }
+            FileUtils.deleteDirectory(store.directory());
+        }
+        stores.clear();
+    }
+
 
     private SlaveLevelDBStore createSlave(MasterLevelDBStore master, File directory) {
         SlaveLevelDBStore slave = new SlaveLevelDBStore();

http://git-wip-us.apache.org/repos/asf/activemq/blob/9752e1dc/activemq-leveldb-store/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/activemq-leveldb-store/src/test/resources/log4j.properties b/activemq-leveldb-store/src/test/resources/log4j.properties
index dc1100d..661669a 100755
--- a/activemq-leveldb-store/src/test/resources/log4j.properties
+++ b/activemq-leveldb-store/src/test/resources/log4j.properties
@@ -18,15 +18,15 @@
 #
 # The logging properties used during tests..
 #
-log4j.rootLogger=WARN, console, file
+log4j.rootLogger=INFO, console, file
 log4j.logger.org.apache.activemq=INFO
-log4j.logger.org.apache.activemq.leveldb=INFO
+log4j.logger.org.apache.activemq.leveldb=DEBUG
 
 # Console will only display warnnings
 log4j.appender.console=org.apache.log4j.ConsoleAppender
 log4j.appender.console.layout=org.apache.log4j.PatternLayout
 log4j.appender.console.layout.ConversionPattern=%-5p | %t | %m%n
-log4j.appender.console.threshold=WARN
+log4j.appender.console.threshold=DEBUG
 
 # File appender will contain all info messages
 log4j.appender.file=org.apache.log4j.FileAppender

http://git-wip-us.apache.org/repos/asf/activemq/blob/9752e1dc/activemq-leveldb-store/src/test/scala/org/apache/activemq/leveldb/test/LevelDBFastEnqueueTest.scala
----------------------------------------------------------------------
diff --git a/activemq-leveldb-store/src/test/scala/org/apache/activemq/leveldb/test/LevelDBFastEnqueueTest.scala
b/activemq-leveldb-store/src/test/scala/org/apache/activemq/leveldb/test/LevelDBFastEnqueueTest.scala
index 94bc937..b63b920 100644
--- a/activemq-leveldb-store/src/test/scala/org/apache/activemq/leveldb/test/LevelDBFastEnqueueTest.scala
+++ b/activemq-leveldb-store/src/test/scala/org/apache/activemq/leveldb/test/LevelDBFastEnqueueTest.scala
@@ -188,6 +188,8 @@ class LevelDBFastEnqueueTest extends TestCase {
     connectionFactory = new ActiveMQConnectionFactory(broker.getTransportConnectors.get(0).getConnectUri
+ options)
   }
 
+
+
   protected def createStore: LevelDBStore = {
     var store: LevelDBStore = new LevelDBStore
     store.setDirectory(new File("target/activemq-data/leveldb"))

http://git-wip-us.apache.org/repos/asf/activemq/blob/9752e1dc/activemq-leveldb-store/src/test/scala/org/apache/activemq/leveldb/test/PListTest.java
----------------------------------------------------------------------
diff --git a/activemq-leveldb-store/src/test/scala/org/apache/activemq/leveldb/test/PListTest.java
b/activemq-leveldb-store/src/test/scala/org/apache/activemq/leveldb/test/PListTest.java
index e0c7609..740102c 100644
--- a/activemq-leveldb-store/src/test/scala/org/apache/activemq/leveldb/test/PListTest.java
+++ b/activemq-leveldb-store/src/test/scala/org/apache/activemq/leveldb/test/PListTest.java
@@ -23,6 +23,7 @@ import org.apache.activemq.broker.region.policy.PolicyEntry;
 import org.apache.activemq.broker.region.policy.PolicyMap;
 import org.apache.activemq.leveldb.LevelDBStore;
 import org.apache.activemq.store.PersistenceAdapter;
+import org.apache.tools.ant.util.FileUtils;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -61,6 +62,7 @@ public class PListTest {
         if (brokerService != null && brokerService.isStopped()) {
             brokerService.stop();
         }
+        FileUtils.delete(new File("target/activemq-data/haleveldb"));
     }
 
     @Test


Mime
View raw message