mirror of https://github.com/apache/activemq.git
Convert some tests to junit 4 style and add test timeouts.
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1484496 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4ca6f230d5
commit
49a2d9656e
|
@ -27,6 +27,9 @@ import org.apache.activemq.store.MessageStore;
|
|||
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 extends TestCase {
|
|||
}
|
||||
|
||||
|
||||
@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 extends TestCase {
|
|||
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>();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.replicated.MasterLevelDBStore;
|
|||
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 extends TestCase {
|
|||
}
|
||||
|
||||
|
||||
@Test(timeout = 1000*60*60)
|
||||
public void testReplication() throws Exception {
|
||||
|
||||
LinkedList<File> directories = new LinkedList<File>();
|
||||
|
|
Loading…
Reference in New Issue