activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1484496 - in /activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test: ElectingLevelDBStoreTest.java MasterLevelDBStoreTest.java ReplicatedLevelDBStoreTest.java
Date Mon, 20 May 2013 15:02:10 GMT
Author: chirino
Date: Mon May 20 15:02:09 2013
New Revision: 1484496

URL: http://svn.apache.org/r1484496
Log:
Convert some tests to junit 4 style and add test timeouts.

Modified:
    activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java
    activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/MasterLevelDBStoreTest.java
    activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ReplicatedLevelDBStoreTest.java

Modified: activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java?rev=1484496&r1=1484495&r2=1484496&view=diff
==============================================================================
--- activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java
(original)
+++ activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java
Mon May 20 15:02:09 2013
@@ -27,6 +27,9 @@ import org.apache.activemq.store.Message
 import org.apache.zookeeper.server.NIOServerCnxnFactory;
 import org.apache.zookeeper.server.ZooKeeperServer;
 import org.apache.zookeeper.server.persistence.FileTxnSnapLog;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -36,10 +39,11 @@ import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.concurrent.TimeUnit;
 import static org.apache.activemq.leveldb.test.ReplicationTestSupport.*;
+import static org.junit.Assert.*;
 
 /**
  */
-public class ElectingLevelDBStoreTest extends TestCase {
+public class ElectingLevelDBStoreTest {
     protected static final Logger LOG = LoggerFactory.getLogger(ElectingLevelDBStoreTest.class);
 
     NIOServerCnxnFactory connector;
@@ -49,8 +53,8 @@ public class ElectingLevelDBStoreTest ex
     }
 
 
-    @Override
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         FileSupport.toRichFile(data_dir()).recursiveDelete();
 
         System.out.println("Starting ZooKeeper");
@@ -63,14 +67,15 @@ public class ElectingLevelDBStoreTest ex
         System.out.println("ZooKeeper Started");
     }
 
-    @Override
-    protected void tearDown() throws Exception {
+    @After
+    public void tearDown() throws Exception {
         if( connector!=null ) {
           connector.shutdown();
           connector = null;
         }
     }
 
+    @Test(timeout = 1000*60*60)
     public void testElection() throws Exception {
 
         ArrayList<ElectingLevelDBStore> stores = new ArrayList<ElectingLevelDBStore>();

Modified: activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/MasterLevelDBStoreTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/MasterLevelDBStoreTest.java?rev=1484496&r1=1484495&r2=1484496&view=diff
==============================================================================
--- activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/MasterLevelDBStoreTest.java
(original)
+++ activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/MasterLevelDBStoreTest.java
Mon May 20 15:02:09 2013
@@ -16,8 +16,8 @@
  */
 package org.apache.activemq.leveldb.test;
 
-import junit.framework.TestCase;
 import org.apache.activemq.leveldb.replicated.MasterLevelDBStore;
+import org.junit.Test;
 
 import java.net.BindException;
 import java.net.InetSocketAddress;
@@ -26,11 +26,15 @@ import java.net.URI;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
+import static org.junit.Assert.*;
+
+
 /**
  * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
  */
-public class MasterLevelDBStoreTest extends TestCase {
+public class MasterLevelDBStoreTest {
 
+    @Test(timeout = 1000*60*60)
     public void testStoppingStoreStopsTransport() throws Exception {
         final MasterLevelDBStore store = new MasterLevelDBStore();
         store.setReplicas(0);

Modified: activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ReplicatedLevelDBStoreTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ReplicatedLevelDBStoreTest.java?rev=1484496&r1=1484495&r2=1484496&view=diff
==============================================================================
--- activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ReplicatedLevelDBStoreTest.java
(original)
+++ activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ReplicatedLevelDBStoreTest.java
Mon May 20 15:02:09 2013
@@ -16,7 +16,6 @@
  */
 package org.apache.activemq.leveldb.test;
 
-import junit.framework.TestCase;
 import org.apache.activemq.command.ActiveMQQueue;
 import org.apache.activemq.leveldb.CountDownFuture;
 import org.apache.activemq.leveldb.LevelDBStore;
@@ -24,6 +23,7 @@ import org.apache.activemq.leveldb.repli
 import org.apache.activemq.leveldb.replicated.SlaveLevelDBStore;
 import org.apache.activemq.leveldb.util.FileSupport;
 import org.apache.activemq.store.MessageStore;
+import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -31,13 +31,17 @@ import java.io.File;
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.concurrent.TimeUnit;
-import static org.apache.activemq.leveldb.test.ReplicationTestSupport.*;
+
+import static org.apache.activemq.leveldb.test.ReplicationTestSupport.addMessage;
+import static org.apache.activemq.leveldb.test.ReplicationTestSupport.getMessages;
+import static org.junit.Assert.*;
 
 /**
  */
-public class ReplicatedLevelDBStoreTest extends TestCase {
+public class ReplicatedLevelDBStoreTest {
     protected static final Logger LOG = LoggerFactory.getLogger(ReplicatedLevelDBStoreTest.class);
 
+    @Test(timeout = 1000*60*60)
     public void testMinReplicaEnforced() throws Exception {
 
         File masterDir = new File("target/activemq-data/leveldb-node1");
@@ -99,6 +103,7 @@ public class ReplicatedLevelDBStoreTest 
     }
 
 
+    @Test(timeout = 1000*60*60)
     public void testReplication() throws Exception {
 
         LinkedList<File> directories = new LinkedList<File>();



Mime
View raw message