geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hiteshkhame...@apache.org
Subject [11/97] [abbrv] [partial] incubator-geode git commit: GEODE-837: update tests from JUnit3 to JUnit4
Date Wed, 15 Jun 2016 16:41:52 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/GlobalTransactionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/GlobalTransactionJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/GlobalTransactionJUnitTest.java
index 1ede356..84d1978 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/GlobalTransactionJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/GlobalTransactionJUnitTest.java
@@ -16,6 +16,25 @@
  */
 package com.gemstone.gemfire.internal.jta;
 
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Properties;
+import javax.naming.Context;
+import javax.transaction.RollbackException;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.distributed.DistributedSystem;
@@ -23,19 +42,9 @@ import com.gemstone.gemfire.internal.datasource.GemFireBasicDataSource;
 import com.gemstone.gemfire.internal.datasource.GemFireTransactionDataSource;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 import com.gemstone.gemfire.util.test.TestUtil;
-import junit.framework.TestCase;
-import org.junit.experimental.categories.Category;
-
-import javax.naming.Context;
-import javax.transaction.*;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
 
 @Category(IntegrationTest.class)
-public class GlobalTransactionJUnitTest extends TestCase {
+public class GlobalTransactionJUnitTest {
 
   private static Properties props = null;
   private static DistributedSystem ds1 = null;
@@ -43,8 +52,8 @@ public class GlobalTransactionJUnitTest extends TestCase {
   private static UserTransaction utx = null;
   private static TransactionManager tm = null;
 
-  @Override
-  protected void setUp() throws Exception {
+  @Before
+  public void setUp() throws Exception {
     props = new Properties();
     props.setProperty(MCAST_PORT, "0");
     String path = TestUtil.getResourcePath(GlobalTransactionJUnitTest.class, "/jta/cachejta.xml");
@@ -55,48 +64,35 @@ public class GlobalTransactionJUnitTest extends TestCase {
     tm = TransactionManagerImpl.getTransactionManager();
   }
 
-  @Override
-  protected void tearDown() throws Exception {
+  @After
+  public void tearDown() throws Exception {
     ds1.disconnect();
   }
 
-  public GlobalTransactionJUnitTest(String name) {
-    super(name);
-  }
-
+  @Test
   public void testGetSimpleDataSource() throws Exception {
-    try {
-      Context ctx = cache.getJNDIContext();
-      GemFireBasicDataSource ds = (GemFireBasicDataSource) ctx
-          .lookup("java:/SimpleDataSource");
-      Connection conn = ds.getConnection();
-      if (conn == null)
-        fail("DataSourceFactoryTest-testGetSimpleDataSource() Error in creating the GemFireBasicDataSource");
-    }
-    catch (Exception e) {
-      fail("Exception occured in testGetSimpleDataSource due to " + e);
-      e.printStackTrace();
-    }
+    Context ctx = cache.getJNDIContext();
+    GemFireBasicDataSource ds = (GemFireBasicDataSource) ctx
+        .lookup("java:/SimpleDataSource");
+    Connection conn = ds.getConnection();
+    if (conn == null)
+      fail("DataSourceFactoryTest-testGetSimpleDataSource() Error in creating the GemFireBasicDataSource");
   }
 
-  public void testSetRollbackOnly() {
-    try {
-      utx.begin();
-      utx.setRollbackOnly();
-      Transaction txn = tm.getTransaction();
-      if (txn.getStatus() != Status.STATUS_MARKED_ROLLBACK) {
-        utx.rollback();
-        fail("testSetRollbackonly failed");
-      }
+  @Test
+  public void testSetRollbackOnly() throws Exception {
+    utx.begin();
+    utx.setRollbackOnly();
+    Transaction txn = tm.getTransaction();
+    if (txn.getStatus() != Status.STATUS_MARKED_ROLLBACK) {
       utx.rollback();
+      fail("testSetRollbackonly failed");
     }
-    catch (Exception e) {
-      fail("exception in testSetRollbackonly due to " + e);
-      e.printStackTrace();
-    }
+    utx.rollback();
   }
 
-  public void testEnlistResource() {
+  @Test
+  public void testEnlistResource() throws Exception {
     try {
       boolean exceptionoccured = false;
       utx.begin();
@@ -125,7 +121,8 @@ public class GlobalTransactionJUnitTest extends TestCase {
     }
   }
 
-  public void testRegisterSynchronization() {
+  @Test
+  public void testRegisterSynchronization() throws Exception {
     try {
       boolean exceptionoccured = false;
       utx.begin();
@@ -153,7 +150,8 @@ public class GlobalTransactionJUnitTest extends TestCase {
     }
   }
 
-  public void testEnlistResourceAfterRollBack() {
+  @Test
+  public void testEnlistResourceAfterRollBack() throws Exception {
     try {
       boolean exceptionoccured = false;
       utx.begin();
@@ -183,7 +181,8 @@ public class GlobalTransactionJUnitTest extends TestCase {
     }
   }
 
-  public void testRegisterSynchronizationAfterRollBack() {
+  @Test
+  public void testRegisterSynchronizationAfterRollBack() throws Exception {
     try {
       boolean exceptionoccured = false;
       utx.begin();
@@ -213,34 +212,23 @@ public class GlobalTransactionJUnitTest extends TestCase {
     }
   }
 
-  public void testSuspend() {
-    try {
-      utx.begin();
-//      Transaction txn = tm.getTransaction();
-      tm.suspend();
-      Transaction txn1 = tm.getTransaction();
-      if (txn1 != null)
-        fail("suspend failed to suspend the transaction");
-    }
-    catch (Exception e) {
-      fail("exception in testSuspend due to " + e);
-      e.printStackTrace();
-    }
+  @Test
+  public void testSuspend() throws Exception {
+    utx.begin();
+    tm.suspend();
+    Transaction txn1 = tm.getTransaction();
+    if (txn1 != null)
+      fail("suspend failed to suspend the transaction");
   }
 
-  public void testResume() {
-    try {
-      utx.begin();
-      Transaction txn = tm.getTransaction();
-      Transaction txn1 = tm.suspend();
-      tm.resume(txn1);
-      if (txn != tm.getTransaction())
-        fail("resume failed ");
-      utx.commit();
-    }
-    catch (Exception e) {
-      fail("exception in testSuspend due to " + e);
-      e.printStackTrace();
-    }
+  @Test
+  public void testResume() throws Exception {
+    utx.begin();
+    Transaction txn = tm.getTransaction();
+    Transaction txn1 = tm.suspend();
+    tm.resume(txn1);
+    if (txn != tm.getTransaction())
+      fail("resume failed ");
+    utx.commit();
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/TransactionTimeOutJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/TransactionTimeOutJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/TransactionTimeOutJUnitTest.java
index 548b9b1..727e1ea 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/TransactionTimeOutJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/TransactionTimeOutJUnitTest.java
@@ -16,296 +16,263 @@
  */
 package com.gemstone.gemfire.internal.jta;
 
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.internal.datasource.GemFireTransactionDataSource;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import com.gemstone.gemfire.util.test.TestUtil;
-import junit.framework.TestCase;
-import org.junit.FixMethodOrder;
-import org.junit.experimental.categories.Category;
-import org.junit.runners.MethodSorters;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
 
-import javax.naming.Context;
-import javax.sql.DataSource;
-import javax.transaction.UserTransaction;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
 import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.Statement;
 import java.util.Properties;
 import java.util.Random;
+import javax.naming.Context;
+import javax.sql.DataSource;
+import javax.transaction.UserTransaction;
 
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.FixMethodOrder;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+import org.junit.runners.MethodSorters;
 
-//import java.sql.SQLException;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.internal.datasource.GemFireTransactionDataSource;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.util.test.TestUtil;
 
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+/**
+ * TODO: this test has no assertions or validations of any sort
+ */
 @Category(IntegrationTest.class)
-public class TransactionTimeOutJUnitTest extends TestCase {
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TransactionTimeOutJUnitTest {
 
-  private static Properties props = null;
   private static DistributedSystem ds1 = null;
   private static Cache cache = null;
 
-  protected void setUp() throws Exception {
-    super.setUp();
-    props = new Properties();
+  @Rule
+  public TestName testName = new TestName();
+
+  @Before
+  public void setUp() throws Exception {
+    Properties props = new Properties();
     props.setProperty(MCAST_PORT, "0");
+
     int pid = new Random().nextInt();
+
     File tmpFile = File.createTempFile("dunit-cachejta_", ".xml");
     tmpFile.deleteOnExit();
+
     String path = tmpFile.getAbsolutePath();
     String file_as_str = readFile(TestUtil.getResourcePath(TransactionTimeOutJUnitTest.class, "/jta/cachejta.xml"));
     String modified_file_str= file_as_str.replaceAll("newDB", "newDB_" + pid);
+
     FileOutputStream fos = new FileOutputStream(path);
     BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(fos));
     wr.write(modified_file_str);
     wr.flush();
     wr.close();
+
     props.setProperty(CACHE_XML_FILE, path);
-    // props.setProperty(cacheXmlFile,"D:\\projects\\JTA\\cachejta.xml");
+
     ds1 = DistributedSystem.connect(props);
     cache = CacheFactory.create(ds1);
-    cache.getLogger().fine("SWAP:running test:"+getName());
+    cache.getLogger().fine("SWAP:running test:" + testName.getMethodName());
   }
 
-  protected void tearDown() throws Exception {
-    super.tearDown();
+  @After
+  public void tearDown() throws Exception {
     ds1.disconnect();
+    // TODO: null out the statics!
   }
 
-  public TransactionTimeOutJUnitTest(String arg0) {
-    super(arg0);
+  @Test
+  public void test1One() throws Exception {
+    UserTransaction utx = new UserTransactionImpl();
+    utx.begin();
+    Thread.sleep(2000);
+    utx.setTransactionTimeout(2);
+    utx.setTransactionTimeout(200);
+    utx.setTransactionTimeout(3);
+    Thread.sleep(5000);
+    //utx.commit();
   }
 
-  public void test1One() {
-    try {
-      UserTransaction utx = new UserTransactionImpl();
-      utx.begin();
-      Thread.sleep(2000);
-      utx.setTransactionTimeout(2);
-      utx.setTransactionTimeout(200);
-      utx.setTransactionTimeout(3);
-      Thread.sleep(5000);
-      //utx.commit();
-    } catch (Exception e) {
-      fail("Exception in TestSetTransactionTimeOut due to " + e);
-    }
+  @Test
+  public void test2SetTransactionTimeOut() throws Exception {
+    UserTransaction utx = new UserTransactionImpl();
+    utx.begin();
+    utx.setTransactionTimeout(2);
+    System.out.println("Going to sleep");
+    Thread.sleep(6000);
+    utx.begin();
+    utx.commit();
   }
 
-  public void test2SetTransactionTimeOut() {
+  @Test
+  public void test3ExceptionOnCommitAfterTimeOut() throws Exception {
+    UserTransaction utx;
+    utx = new UserTransactionImpl();
+    utx.setTransactionTimeout(2);
+    utx.begin();
+    Thread.sleep(4000);
     try {
-      UserTransaction utx = new UserTransactionImpl();
-      utx.begin();
-      utx.setTransactionTimeout(2);
-      System.out.println("Going to sleep");
-      Thread.sleep(6000);
-      utx.begin();
       utx.commit();
-    } catch (Exception e) {
-      fail("Exception in TestSetTransactionTimeOut due to " + e);
+      fail("TimeOut did not rollback the transaction");
+    } catch (Exception expected) {
     }
   }
 
-  public void test3ExceptionOnCommitAfterTimeOut() {
+  @Test
+  public void test4MultipleSetTimeOuts() throws Exception {
     UserTransaction utx;
-    boolean exceptionOccured = true;
+    utx = new UserTransactionImpl();
+    utx.setTransactionTimeout(10);
+    utx.begin();
+    utx.setTransactionTimeout(8);
+    utx.setTransactionTimeout(6);
+    utx.setTransactionTimeout(2);
+    Thread.sleep(6000);
     try {
-      utx = new UserTransactionImpl();
-      utx.setTransactionTimeout(2);
-      utx.begin();
-      Thread.sleep(4000);
-      try {
-        utx.commit();
-      } catch (Exception e) {
-        exceptionOccured = false;
-      }
-      if (exceptionOccured) {
-        fail("TimeOut did not rollback the transaction");
-      }
-    } catch (Exception e) {
-      fail("Exception in testExceptionOnCommitAfterTimeOut() due to " + e);
+      utx.commit();
+      fail("TimeOut did not rollback the transaction");
+    } catch (Exception expected) {
     }
   }
 
-  public void test4MultipleSetTimeOuts() {
-    UserTransaction utx;
-    boolean exceptionOccured = true;
+  @Test
+  public void test5TimeOutBeforeBegin() throws Exception {
+    UserTransaction utx = new UserTransactionImpl();
+    utx.setTransactionTimeout(4);
+    utx.begin();
+    Thread.sleep(6000);
     try {
-      utx = new UserTransactionImpl();
-      utx.setTransactionTimeout(10);
-      utx.begin();
-      utx.setTransactionTimeout(8);
-      utx.setTransactionTimeout(6);
-      utx.setTransactionTimeout(2);
-      Thread.sleep(6000);
-      try {
-        utx.commit();
-      } catch (Exception e) {
-        exceptionOccured = false;
-      }
-      if (exceptionOccured) {
-        fail("TimeOut did not rollback the transaction");
-      }
-    } catch (Exception e) {
-      fail("Exception in testExceptionOnCommitAfterTimeOut() due to " + e);
+      utx.commit();
+      fail("TimeOut did not rollback the transaction");
+    } catch (Exception expected) {
     }
   }
 
-  public void test5TimeOutBeforeBegin() {
-    boolean exceptionOccured = true;
-    try {
-      UserTransaction utx = new UserTransactionImpl();
-      utx.setTransactionTimeout(4);
-      utx.begin();
-      Thread.sleep(6000);
-      try {
-        utx.commit();
-      } catch (Exception e) {
-        exceptionOccured = false;
-      }
-      if (exceptionOccured) {
-        fail("TimeOut did not rollback the transaction");
-      }
-    } catch (Exception e) {
-      fail("Exception in testExceptionOnCommitAfterTimeOut() due to " + e);
-    }
+  @Test
+  public void test6CommitBeforeTimeOut() throws Exception {
+    UserTransaction utx = new UserTransactionImpl();
+    utx.begin();
+    utx.setTransactionTimeout(6);
+    Thread.sleep(2000);
+    utx.commit();
   }
 
-  public void test6CommitBeforeTimeOut() {
-//    boolean exceptionOccured = true;
-    try {
-      UserTransaction utx = new UserTransactionImpl();
-      utx.begin();
-      utx.setTransactionTimeout(6);
-      Thread.sleep(2000);
-      try {
-        utx.commit();
-      } catch (Exception e) {
-        fail("Transaction failed to commit although TimeOut was not exceeded due to "
-            + e);
-      }
-    } catch (Exception e) {
-      fail("Exception in testExceptionOnCommitAfterTimeOut() due to " + e);
+  @Test
+  public void test7Commit() throws Exception {
+    Context ctx = cache.getJNDIContext();
+    DataSource ds2 = (DataSource) ctx.lookup("java:/SimpleDataSource");
+    ds2.getConnection();
+    GemFireTransactionDataSource ds = (GemFireTransactionDataSource) ctx
+        .lookup("java:/XAPooledDataSource");
+    UserTransaction utx = (UserTransaction) ctx
+        .lookup("java:/UserTransaction");
+    utx.begin();
+    Connection conn = ds.getConnection();
+    String sql = "create table newTable1 (id integer)";
+    Statement sm = conn.createStatement();
+    sm.execute(sql);
+    utx.setTransactionTimeout(30);
+    Thread.sleep(5000);
+    utx.setTransactionTimeout(20);
+    utx.setTransactionTimeout(10);
+    sql = "insert into newTable1  values (1)";
+    sm.execute(sql);
+    utx.commit();
+    sql = "select * from newTable1 where id = 1";
+    ResultSet rs = sm.executeQuery(sql);
+    if (!rs.next()) {
+      fail("Transaction not committed");
     }
+    sql = "drop table newTable1";
+    sm.execute(sql);
+    sm.close();
+    conn.close();
   }
 
-  public void test7Commit() {
+  @Test
+  public void test8CommitAfterTimeOut() throws Exception {
+    Context ctx = cache.getJNDIContext();
+    DataSource ds2 = (DataSource) ctx.lookup("java:/SimpleDataSource");
+    ds2.getConnection();
+    GemFireTransactionDataSource ds = (GemFireTransactionDataSource) ctx
+        .lookup("java:/XAPooledDataSource");
+    UserTransaction utx = (UserTransaction) ctx
+        .lookup("java:/UserTransaction");
+    utx.begin();
+    Connection conn = ds.getConnection();
+    String sql = "create table newTable2 (id integer)";
+    Statement sm = conn.createStatement();
+    sm.execute(sql);
+    utx.setTransactionTimeout(30);
+    sql = "insert into newTable2  values (1)";
+    sm.execute(sql);
+    sql = "select * from newTable2 where id = 1";
+    ResultSet rs = sm.executeQuery(sql);
+    if (!rs.next()) {
+      fail("Transaction not committed");
+    }
+    sql = "drop table newTable2";
+    sm.execute(sql);
+    sm.close();
+    conn.close();
+    utx.setTransactionTimeout(1);
+    Thread.sleep(3000);
     try {
-      Context ctx = cache.getJNDIContext();
-      DataSource ds2 = (DataSource) ctx.lookup("java:/SimpleDataSource");
-      ds2.getConnection();
-      GemFireTransactionDataSource ds = (GemFireTransactionDataSource) ctx
-          .lookup("java:/XAPooledDataSource");
-      UserTransaction utx = (UserTransaction) ctx
-          .lookup("java:/UserTransaction");
-      utx.begin();
-      Connection conn = ds.getConnection();
-      String sql = "create table newTable1 (id integer)";
-      Statement sm = conn.createStatement();
-      sm.execute(sql);
-      utx.setTransactionTimeout(30);
-      Thread.sleep(5000);
-      utx.setTransactionTimeout(20);
-      utx.setTransactionTimeout(10);
-      sql = "insert into newTable1  values (1)";
-      sm.execute(sql);
       utx.commit();
-      sql = "select * from newTable1 where id = 1";
-      ResultSet rs = sm.executeQuery(sql);
-      if (!rs.next()) fail("Transaction not committed");
-      sql = "drop table newTable1";
-      sm.execute(sql);
-      sm.close();
-      conn.close();
-    } catch (Exception e) {
-      fail("Exception occured in test Commit due to " + e);
-      e.printStackTrace();
+      fail("exception did not occur on commit although transaction timed out");
+    } catch (Exception expected) {
     }
   }
 
-  public void test8CommitAfterTimeOut() {
-    try {
-      boolean exceptionOccured = false;
-      Context ctx = cache.getJNDIContext();
-      DataSource ds2 = (DataSource) ctx.lookup("java:/SimpleDataSource");
-      ds2.getConnection();
-      GemFireTransactionDataSource ds = (GemFireTransactionDataSource) ctx
-          .lookup("java:/XAPooledDataSource");
-      UserTransaction utx = (UserTransaction) ctx
-          .lookup("java:/UserTransaction");
-      utx.begin();
-      Connection conn = ds.getConnection();
-      String sql = "create table newTable2 (id integer)";
-      Statement sm = conn.createStatement();
-      sm.execute(sql);
-      utx.setTransactionTimeout(30);
-      sql = "insert into newTable2  values (1)";
-      sm.execute(sql);
-      sql = "select * from newTable2 where id = 1";
-      ResultSet rs = sm.executeQuery(sql);
-      if (!rs.next()) fail("Transaction not committed");
-      sql = "drop table newTable2";
-      sm.execute(sql);
-      sm.close();
-      conn.close();
-      utx.setTransactionTimeout(1);
-      Thread.sleep(3000);
-      try {
-        utx.commit();
-      } catch (Exception e) {
-        exceptionOccured = true;
-      }
-      if (!exceptionOccured) {
-        fail("exception did not occur on commit although transaction timed out");
-      }
-    } catch (Exception e) {
-      fail("Exception occured in test Commit due to " + e);
-      e.printStackTrace();
+  @Test
+  public void test9RollbackAfterTimeOut() throws Exception {
+    Context ctx = cache.getJNDIContext();
+    DataSource ds2 = (DataSource) ctx.lookup("java:/SimpleDataSource");
+    Connection conn2 = ds2.getConnection();
+    GemFireTransactionDataSource ds = (GemFireTransactionDataSource) ctx
+        .lookup("java:/XAPooledDataSource");
+    UserTransaction utx = (UserTransaction) ctx
+        .lookup("java:/UserTransaction");
+    utx.begin();
+    Connection conn = ds.getConnection();
+    String sql = "create table newTable3 (id integer)";
+    Statement sm = conn.createStatement();
+    sm.execute(sql);
+    utx.setTransactionTimeout(30);
+    sql = "insert into newTable3  values (1)";
+    sm.execute(sql);
+    sql = "select * from newTable3 where id = 1";
+    ResultSet rs = sm.executeQuery(sql);
+    if (!rs.next()) {
+      fail("Transaction not committed");
     }
-  }
-
-  public void test9RollbackAfterTimeOut() {
+    sql = "drop table newTable3";
+    sm.execute(sql);
+    sm.close();
+    conn.close();
+    conn2.close();
+    utx.setTransactionTimeout(1);
+    Thread.sleep(3000);
     try {
-      boolean exceptionOccured = false;
-      Context ctx = cache.getJNDIContext();
-      DataSource ds2 = (DataSource) ctx.lookup("java:/SimpleDataSource");
-      Connection conn2 = ds2.getConnection();
-      GemFireTransactionDataSource ds = (GemFireTransactionDataSource) ctx
-          .lookup("java:/XAPooledDataSource");
-      UserTransaction utx = (UserTransaction) ctx
-          .lookup("java:/UserTransaction");
-      utx.begin();
-      Connection conn = ds.getConnection();
-      String sql = "create table newTable3 (id integer)";
-      Statement sm = conn.createStatement();
-      sm.execute(sql);
-      utx.setTransactionTimeout(30);
-      sql = "insert into newTable3  values (1)";
-      sm.execute(sql);
-      sql = "select * from newTable3 where id = 1";
-      ResultSet rs = sm.executeQuery(sql);
-      if (!rs.next()) fail("Transaction not committed");
-      sql = "drop table newTable3";
-      sm.execute(sql);
-      sm.close();
-      conn.close();
-      conn2.close();
-      utx.setTransactionTimeout(1);
-      Thread.sleep(3000);
-      try {
-        utx.rollback();
-      } catch (Exception e) {
-        exceptionOccured = true;
-      }
-      if (!exceptionOccured) {
-        fail("exception did not occur on rollback although transaction timed out");
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail("Exception occured in test Commit due to " + e);
+      utx.rollback();
+      fail("exception did not occur on rollback although transaction timed out");
+    } catch (Exception expected) {
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/ExceptionsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/ExceptionsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/ExceptionsDUnitTest.java
index 117f3e3..a7edbd4 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/ExceptionsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/ExceptionsDUnitTest.java
@@ -16,27 +16,38 @@
  */
 package com.gemstone.gemfire.internal.jta.dunit;
 
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.sql.SQLException;
+import java.util.Properties;
+import javax.naming.Context;
+import javax.sql.DataSource;
+import javax.transaction.UserTransaction;
+
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.internal.OSProcess;
 import com.gemstone.gemfire.internal.jta.CacheUtils;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.LogWriterUtils;
 import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 import com.gemstone.gemfire.util.test.TestUtil;
 
-import javax.naming.Context;
-import javax.sql.DataSource;
-import javax.transaction.UserTransaction;
-import java.io.*;
-import java.sql.SQLException;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
-public class ExceptionsDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class ExceptionsDUnitTest extends JUnit4DistributedTestCase {
 
   static DistributedSystem ds;
   static Cache cache;
@@ -59,8 +70,8 @@ public class ExceptionsDUnitTest extends DistributedTestCase {
     return sb.toString();
   }
 
-  public ExceptionsDUnitTest(String name) {
-    super(name);
+  public ExceptionsDUnitTest() {
+    super();
   }
 
   private static String modifyFile(String str) throws IOException {
@@ -131,7 +142,7 @@ public class ExceptionsDUnitTest extends DistributedTestCase {
     //		  props.setProperty(DistributionConfig.DistributedSystemConfigProperties.MCAST_PORT, "10339");
     try {
       //			   ds = DistributedSystem.connect(props);
-      ds = (new ExceptionsDUnitTest("temp")).getSystem(props);
+      ds = (new ExceptionsDUnitTest()).getSystem(props);
       cache = CacheFactory.create(ds);
     }
     catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/IdleTimeOutDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/IdleTimeOutDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/IdleTimeOutDUnitTest.java
index ff97dd2..2440f35 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/IdleTimeOutDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/IdleTimeOutDUnitTest.java
@@ -16,26 +16,44 @@
  */
 package com.gemstone.gemfire.internal.jta.dunit;
 
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.internal.OSProcess;
-import com.gemstone.gemfire.internal.jta.CacheUtils;
-import com.gemstone.gemfire.test.dunit.*;
-import com.gemstone.gemfire.util.test.TestUtil;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.CACHE_XML_FILE;
+import static org.junit.Assert.*;
 
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.sql.DataSource;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Properties;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.internal.OSProcess;
+import com.gemstone.gemfire.internal.jta.CacheUtils;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.util.test.TestUtil;
 
-public class IdleTimeOutDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class IdleTimeOutDUnitTest extends JUnit4DistributedTestCase {
 
   static DistributedSystem ds;
   static Cache cache;
@@ -58,8 +76,8 @@ public class IdleTimeOutDUnitTest extends DistributedTestCase {
     return sb.toString();
   }
 
-  public IdleTimeOutDUnitTest(String name) {
-    super(name);
+  public IdleTimeOutDUnitTest() {
+    super();
   }
 
   private static String modifyFile(String str) throws IOException {
@@ -134,7 +152,7 @@ public class IdleTimeOutDUnitTest extends DistributedTestCase {
     //	        props.setProperty(DistributionConfig.DistributedSystemConfigProperties.MCAST_PORT, "10339");
     try {
       //	  	      ds = DistributedSystem.connect(props);
-      ds = (new IdleTimeOutDUnitTest("temp")).getSystem(props);
+      ds = (new IdleTimeOutDUnitTest()).getSystem(props);
       cache = CacheFactory.create(ds);
       if (className != null && !className.equals("")) {
         String time = new Long(System.currentTimeMillis()).toString();
@@ -248,6 +266,7 @@ public class IdleTimeOutDUnitTest extends DistributedTestCase {
     vm0.invoke(() -> IdleTimeOutDUnitTest.closeCache());
   }
 
+  @Test
   public void testIdleTimeOut() throws Throwable {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/LoginTimeOutDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/LoginTimeOutDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/LoginTimeOutDUnitTest.java
index 5d058d1..85f265c 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/LoginTimeOutDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/LoginTimeOutDUnitTest.java
@@ -16,28 +16,49 @@
  */
 package com.gemstone.gemfire.internal.jta.dunit;
 
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Properties;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+import org.apache.logging.log4j.Logger;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 import com.gemstone.gemfire.internal.OSProcess;
 import com.gemstone.gemfire.internal.jta.CacheUtils;
 import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.RMIException;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 import com.gemstone.gemfire.util.test.TestUtil;
-import org.apache.logging.log4j.Logger;
 
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.sql.DataSource;
-import java.io.*;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
-public class LoginTimeOutDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class LoginTimeOutDUnitTest extends JUnit4DistributedTestCase {
   private static final Logger logger = LogService.getLogger();
 
   protected static volatile boolean runTest1Ready = false;
@@ -46,10 +67,6 @@ public class LoginTimeOutDUnitTest extends DistributedTestCase {
   private static Cache cache;
   private static String tblName;
 
-  public LoginTimeOutDUnitTest(String name) {
-    super(name);
-  }
-
   private static String readFile(String filename) throws IOException {
     BufferedReader br = new BufferedReader(new FileReader(filename));
     String nextLine = "";
@@ -204,8 +221,8 @@ public class LoginTimeOutDUnitTest extends DistributedTestCase {
     }
   }
 
-  public void disabledsetUp() throws Exception {
-    super.setUp();
+  @Override
+  public final void postSetUp() throws Exception {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     Object o[] = new Object[1];
@@ -213,7 +230,8 @@ public class LoginTimeOutDUnitTest extends DistributedTestCase {
     vm0.invoke(LoginTimeOutDUnitTest.class, "init", o);
   }
 
-  public void disabledtearDown2() throws Exception {
+  @Override
+  public final void preTearDown() throws Exception {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     try {
@@ -222,18 +240,16 @@ public class LoginTimeOutDUnitTest extends DistributedTestCase {
       if ( (e instanceof RMIException) || (e instanceof SQLException)) {
         // sometimes we have lock timeout problems destroying the table in
         // this test
-        vm0.invoke(() -> DistributedTestCase.disconnectFromDS());
+        vm0.invoke(() -> disconnectFromDS());
       }
     }
   }
   
-  public void testBug52206() {
-    // reenable setUp and testLoginTimeout to work on bug 52206
-  }
-  
   // this test and the setUp and teardown2 methods are disabled due to frequent
   // failures in CI runs.  See bug #52206
-  public void disabledtestLoginTimeOut() throws Exception {
+  @Ignore("TODO: test is disabled due to #52206")
+  @Test
+  public void testLoginTimeOut() throws Exception {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     AsyncInvocation test1 = vm0.invokeAsync(() -> LoginTimeOutDUnitTest.runTest1());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/MaxPoolSizeDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/MaxPoolSizeDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/MaxPoolSizeDUnitTest.java
index 544463c..c6284d6 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/MaxPoolSizeDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/MaxPoolSizeDUnitTest.java
@@ -16,33 +16,50 @@
  */
 package com.gemstone.gemfire.internal.jta.dunit;
 
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.internal.OSProcess;
-import com.gemstone.gemfire.internal.jta.CacheUtils;
-import com.gemstone.gemfire.test.dunit.*;
-import com.gemstone.gemfire.util.test.TestUtil;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
 
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.sql.DataSource;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Properties;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
 
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
-public class MaxPoolSizeDUnitTest extends DistributedTestCase {
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.internal.OSProcess;
+import com.gemstone.gemfire.internal.jta.CacheUtils;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.util.test.TestUtil;
+
+@Category(DistributedTest.class)
+public class MaxPoolSizeDUnitTest extends JUnit4DistributedTestCase {
 
   static DistributedSystem ds;
   static Cache cache;
   private static String tblName;
 
   private static String readFile(String filename) throws IOException {
-//    String lineSep = System.getProperty("\n");
     BufferedReader br = new BufferedReader(new FileReader(filename));
     String nextLine = "";
     StringBuffer sb = new StringBuffer();
@@ -58,10 +75,6 @@ public class MaxPoolSizeDUnitTest extends DistributedTestCase {
     return sb.toString();
   }
 
-  public MaxPoolSizeDUnitTest(String name) {
-    super(name);
-  }
-
   private static String modifyFile(String str) throws IOException {
     String search = "<jndi-binding type=\"XAPooledDataSource\"";
     String last_search = "</jndi-binding>";
@@ -129,20 +142,12 @@ public class MaxPoolSizeDUnitTest extends DistributedTestCase {
     wr.close();
     props.setProperty(CACHE_XML_FILE, path);
     String tableName = "";
-    //	        props.setProperty(DistributionConfig.DistributedSystemConfigProperties.MCAST_PORT, "10339");
-    try {
-      //	  	      ds = DistributedSystem.connect(props);
-      ds = (new MaxPoolSizeDUnitTest("temp")).getSystem(props);
-      cache = CacheFactory.create(ds);
-      if (className != null && !className.equals("")) {
-        String time = new Long(System.currentTimeMillis()).toString();
-        tableName = className + time;
-        createTable(tableName);
-      }
-    }
-    catch (Exception e) {
-      e.printStackTrace(System.err);
-      throw new Exception("" + e);
+    ds = (new MaxPoolSizeDUnitTest()).getSystem(props);
+    cache = CacheFactory.create(ds);
+    if (className != null && !className.equals("")) {
+      String time = new Long(System.currentTimeMillis()).toString();
+      tableName = className + time;
+      createTable(tableName);
     }
     tblName = tableName;
     return tableName;
@@ -186,10 +191,6 @@ public class MaxPoolSizeDUnitTest extends DistributedTestCase {
       sm.execute(sql);
       conn.close();
     }
-    catch (NamingException ne) {
-      LogWriterUtils.getLogWriter().fine("destroy table naming exception: " + ne);
-      throw ne;
-    }
     catch (SQLException se) {
       if (!se.getMessage().contains("A lock could not be obtained within the time requested")) {
         LogWriterUtils.getLogWriter().fine("destroy table sql exception: " + se);
@@ -213,7 +214,7 @@ public class MaxPoolSizeDUnitTest extends DistributedTestCase {
       }
     }
     catch (Exception e) {
-      e.printStackTrace();
+      fail("startCache failed", e);
     }
   }
 
@@ -224,7 +225,7 @@ public class MaxPoolSizeDUnitTest extends DistributedTestCase {
       }
     }
     catch (Exception e) {
-      e.printStackTrace();
+      fail("closeCache failed", e);
     }
     try {
       ds.disconnect();
@@ -255,7 +256,8 @@ public class MaxPoolSizeDUnitTest extends DistributedTestCase {
     }
   }
 
-  public static void testMaxPoolSize()  throws Throwable{
+  @Test
+  public void testMaxPoolSize() throws Exception {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     AsyncInvocation asyncObj = vm0.invokeAsync(() -> MaxPoolSizeDUnitTest.runTest1());
@@ -275,12 +277,12 @@ public class MaxPoolSizeDUnitTest extends DistributedTestCase {
     }
     catch (NamingException e) {
       LogWriterUtils.getLogWriter().fine("Naming Exception caught in lookup: " + e);
-      fail("failed in naming lookup: " + e);
+      fail("failed in naming lookup: ", e);
       return;
     }
     catch (Exception e) {
       LogWriterUtils.getLogWriter().fine("Exception caught during naming lookup: " + e);
-      fail("failed in naming lookup: " + e);
+      fail("failed in naming lookup: ", e);
       return;
     }
     try {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TransactionTimeOutDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TransactionTimeOutDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TransactionTimeOutDUnitTest.java
index 38745ba..0e7660f 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TransactionTimeOutDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TransactionTimeOutDUnitTest.java
@@ -16,6 +16,27 @@
  */
 package com.gemstone.gemfire.internal.jta.dunit;
 
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.Properties;
+import javax.naming.Context;
+import javax.sql.DataSource;
+import javax.transaction.UserTransaction;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.distributed.DistributedSystem;
@@ -23,33 +44,26 @@ import com.gemstone.gemfire.internal.OSProcess;
 import com.gemstone.gemfire.internal.datasource.GemFireTransactionDataSource;
 import com.gemstone.gemfire.internal.jta.CacheUtils;
 import com.gemstone.gemfire.internal.jta.UserTransactionImpl;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 import com.gemstone.gemfire.util.test.TestUtil;
 
-import javax.naming.Context;
-import javax.sql.DataSource;
-import javax.transaction.UserTransaction;
-import java.io.*;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.Statement;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
 /**
-*This test tests TransactionTimeOut functionality
-*/
-public class TransactionTimeOutDUnitTest extends DistributedTestCase {
+ * This test tests TransactionTimeOut functionality
+ */
+@Category(DistributedTest.class)
+public class TransactionTimeOutDUnitTest extends JUnit4DistributedTestCase {
 
   static DistributedSystem ds;
   static Cache cache = null;
   private static String tblName;
 
-  public TransactionTimeOutDUnitTest(String name) {
-    super(name);
-  }
-
   public static void init() throws Exception {
     Properties props = new Properties();
     int pid = OSProcess.getId();
@@ -63,16 +77,9 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
     wr.close();
 
     props.setProperty(CACHE_XML_FILE, path);
-    //    props.setProperty(DistributionConfig.DistributedSystemConfigProperties.MCAST_PORT, "10321");
-    try {
-//      ds = DistributedSystem.connect(props);
-        ds = (new TransactionTimeOutDUnitTest("temp")).getSystem(props);
-      if (cache == null || cache.isClosed()) cache = CacheFactory.create(ds);
-    }
-    catch (Exception e) {
-      e.printStackTrace(System.err);
-      throw new Exception("" + e);
-    }
+
+    ds = (new TransactionTimeOutDUnitTest()).getSystem(props);
+    if (cache == null || cache.isClosed()) cache = CacheFactory.create(ds);
   }
 
   public static Cache getCache() {
@@ -86,8 +93,7 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
       }
     }
     catch (Exception e) {
-      fail("Exception in cache creation due to "+e);
-	  e.printStackTrace();
+      fail("Exception in cache creation due to ", e);
     }
   }
 
@@ -100,8 +106,7 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
 		   ds.disconnect();
     }
     catch (Exception e) {
-	fail("Exception in closing cache and disconnecting ds due to "+e);
-      e.printStackTrace();
+	    fail("Exception in closing cache and disconnecting ds due to ", e);
     }
   }
 
@@ -127,57 +132,65 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
     
     ThreadUtils.join(async1, 30 * 1000);
     ThreadUtils.join(async2, 30 * 1000);
-    if(async1.exceptionOccurred()){
+    if (async1.exceptionOccurred()){
       Assert.fail("async1 failed", async1.getException());
     }
-    if(async2.exceptionOccurred()){
+    if (async2.exceptionOccurred()){
       Assert.fail("async2 failed", async2.getException());
     }
   }
 
-  public static void test1() {
+  @Test
+  public void test1() {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     vm0.invoke(() -> TransactionTimeOutDUnitTest.runTest3());
   }
 
-  public static void test2() {
+  @Test
+  public void test2() {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     vm0.invoke(() -> TransactionTimeOutDUnitTest.runTest4());
   }
 
-  public static void test3() {
+  @Test
+  public void test3() {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     vm0.invoke(() -> TransactionTimeOutDUnitTest.runTest5());
   }
 
-  public static void test4() {
+  @Test
+  public void test4() {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     vm0.invoke(() -> TransactionTimeOutDUnitTest.runTest6());
   }
 
-  public static void test5() {
+  @Test
+  public void test5() {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     vm0.invoke(() -> TransactionTimeOutDUnitTest.runTest7());
   }
 
-  public static void test6() {
+  @Test
+  public void test6() {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     vm0.invoke(() -> TransactionTimeOutDUnitTest.runTest8());
   }
 
-  public static void test7() {
+  @Test
+  public void test7() {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     vm0.invoke(() -> TransactionTimeOutDUnitTest.runTest9());
   }
 
-  public static void test8() {
+  @Test
+  public void test8() {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     vm0.invoke(() -> TransactionTimeOutDUnitTest.runTest10());
@@ -200,12 +213,9 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
       }
       if (!exceptionOccured)
           fail("Exception did not occur although was supposed to occur");
-      return;
     }
     catch (Exception e) {
-      LogWriterUtils.getLogWriter().fine("Exception caught " + e);
-      fail("failed in naming lookup: " + e);
-      return;
+      fail("failed in naming lookup: ", e);
     }
   }
 
@@ -225,13 +235,10 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
         exceptionOccured = true;
       }
       if (!exceptionOccured)
-          fail("Exception did not occur although was supposed to occur");
-      return;
+        fail("Exception did not occur although was supposed to occur");
     }
     catch (Exception e) {
-      LogWriterUtils.getLogWriter().fine("Exception caught " + e);
-      fail("failed in naming lookup: " + e);
-      return;
+      fail("failed in naming lookup: ", e);
     }
   }
 
@@ -247,7 +254,7 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
       utx.commit();
     }
     catch (Exception e) {
-      fail("Exception in TestSetTransactionTimeOut due to " + e);
+      fail("Exception in TestSetTransactionTimeOut due to ", e);
     }
   }
 
@@ -272,7 +279,7 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
       }
     }
     catch (Exception e) {
-      fail("Exception in testExceptionOnCommitAfterTimeOut() due to " + e);
+      fail("Exception in testExceptionOnCommitAfterTimeOut() due to ", e);
     }
   }
 
@@ -300,7 +307,7 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
       }
     }
     catch (Exception e) {
-      fail("Exception in testExceptionOnCommitAfterTimeOut() due to " + e);
+      fail("Exception in testExceptionOnCommitAfterTimeOut() due to ", e);
     }
   }
 
@@ -324,7 +331,7 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
       }
     }
     catch (Exception e) {
-      fail("Exception in testExceptionOnCommitAfterTimeOut() due to " + e);
+      fail("Exception in testExceptionOnCommitAfterTimeOut() due to ", e);
     }
   }
 
@@ -341,12 +348,11 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
         utx.commit();
       }
       catch (Exception e) {
-        fail("Transaction failed to commit although TimeOut was not exceeded due to "
-            + e);
+        fail("Transaction failed to commit although TimeOut was not exceeded due to ", e);
       }
     }
     catch (Exception e) {
-      fail("Exception in testExceptionOnCommitAfterTimeOut() due to " + e);
+      fail("Exception in testExceptionOnCommitAfterTimeOut() due to ", e);
     }
   }
 
@@ -380,8 +386,7 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
       conn.close();
     }
     catch (Exception e) {
-      fail("Exception occured in test Commit due to " + e);
-      e.printStackTrace();
+      fail("Exception occured in test Commit due to ", e);
     }
   }
 
@@ -423,8 +428,7 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
       }
     }
     catch (Exception e) {
-      fail("Exception occured in test Commit due to " + e);
-      e.printStackTrace();
+      fail("Exception occured in test Commit due to ", e);
     }
   }
 
@@ -466,10 +470,10 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
       }
     }
     catch (Exception e) {
-      e.printStackTrace();
-      fail("Exception occured in test Commit due to " + e);
+      fail("Exception occured in test Commit due to ", e);
     }
   }
+
   private static String readFile(String filename) throws IOException {
     BufferedReader br = new BufferedReader(new FileReader(filename));
     String nextLine = "";

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnManagerMultiThreadDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnManagerMultiThreadDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnManagerMultiThreadDUnitTest.java
index 439c961..86d4d51 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnManagerMultiThreadDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnManagerMultiThreadDUnitTest.java
@@ -16,6 +16,30 @@
  */
 package com.gemstone.gemfire.internal.jta.dunit;
 
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Properties;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+import org.junit.FixMethodOrder;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runners.MethodSorters;
+
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.cache.Region;
@@ -23,54 +47,38 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.internal.OSProcess;
 import com.gemstone.gemfire.internal.jta.CacheUtils;
 import com.gemstone.gemfire.internal.jta.JTAUtils;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 import com.gemstone.gemfire.util.test.TestUtil;
-import org.junit.FixMethodOrder;
-import org.junit.runners.MethodSorters;
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.sql.DataSource;
-import java.io.*;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
 
 /**
  * This test case is to test the following test scenarios: 1) Behaviour of
- * Transaction Manager in multy threaded thransactions. We will have around five
+ * Transaction Manager in multithreaded transactions. We will have around five
  * threads doing different activities. The response to those activities by
  * transaction manager is tested.
- * 
- * 
- *  
  */
+@Category(DistributedTest.class)
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
-
-  /////constructor/////
-  public TxnManagerMultiThreadDUnitTest(String name) {
-    super(name);
-  }
+public class TxnManagerMultiThreadDUnitTest extends JUnit4DistributedTestCase {
 
   public static DistributedSystem ds;
   public static Cache cache;
 
-  /////Methods for initializations/////
   private static String readFile(String filename) throws IOException {
-//    String lineSep = System.getProperty("\n");
     BufferedReader br = new BufferedReader(new FileReader(filename));
     String nextLine = "";
     StringBuffer sb = new StringBuffer();
     while ((nextLine = br.readLine()) != null) {
       sb.append(nextLine);
     }
-    //getLogWriter().fine("***********\n "+ sb);
     return sb.toString();
-  }//end of readFile
+  }
 
   private static String modifyFile(String str) throws IOException {
     String search = "<jndi-binding type=\"XAPooledDataSource\"";
@@ -118,7 +126,7 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
     StringBuffer sbuff = new StringBuffer(str);
     String modified_str = sbuff.replace(n1, n2, new_str).toString();
     return modified_str;
-  }//end of modifyFile
+  }
 
   private static String modifyFile1(String str) throws IOException {
     String search = "<jndi-binding type=\"SimpleDataSource\"";
@@ -166,7 +174,7 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
     StringBuffer sbuff = new StringBuffer(str);
     String modified_str = sbuff.replace(n1, n2, new_str).toString();
     return modified_str;
-  }//end of modifyFile
+  }
 
   public static String init(String className) throws Exception {
     DistributedSystem ds;
@@ -187,27 +195,20 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
     wr.close();
     props.setProperty(CACHE_XML_FILE, path);
     String tableName = "";
-    //    props.setProperty(DistributionConfig.DistributedSystemConfigProperties.MCAST_PORT, "10339");
-    try {
-      //        ds = DistributedSystem.connect(props);
-      ds = (new TxnManagerMultiThreadDUnitTest("temp")).getSystem(props);
-      CacheUtils.ds = ds;
-      cache = CacheFactory.create(ds);
-      if (className != null && !className.equals("")) {
-        String time = new Long(System.currentTimeMillis()).toString();
-        tableName = className + time;
-        createTable(tableName);
-      }
-    }
-    catch (Exception e) {
-      LogWriterUtils.getLogWriter().info("", e);
-      throw new Exception("" + e);
+
+    ds = (new TxnManagerMultiThreadDUnitTest()).getSystem(props);
+    CacheUtils.ds = ds;
+    cache = CacheFactory.create(ds);
+    if (className != null && !className.equals("")) {
+      String time = new Long(System.currentTimeMillis()).toString();
+      tableName = className + time;
+      createTable(tableName);
     }
+
     return tableName;
-  }//end of init method
+  }
 
-  public static void createTable(String tblName) throws NamingException,
-      SQLException {
+  public static void createTable(String tblName) throws NamingException, SQLException {
     String tableName = tblName;
     cache = TxnManagerMultiThreadDUnitTest.getCache();
     Context ctx = cache.getJNDIContext();
@@ -228,17 +229,16 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
     }
     sm.executeBatch();
     conn.close();
-  }//end of createTable
+  }
 
-  public static void destroyTable(String tblName) throws NamingException,
-      SQLException {
+  public static void destroyTable(String tblName) throws NamingException, SQLException {
     //the sleep below is given to give the time to threads to start and perform
     // before destroyTable is called.
     try {
       Thread.sleep(10 * 1000);
     }
     catch (InterruptedException ie) {
-      fail("interrupted");
+      fail("interrupted", ie);
     }
     try {
       String tableName = tblName;
@@ -266,11 +266,11 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
       LogWriterUtils.getLogWriter().fine("Closing cache...");
       closeCache();
     }
-  }//end of destroyTable
+  }
 
   public static Cache getCache() {
     return cache;
-  }//end of getCache
+  }
 
   public static void startCache() {
     try {
@@ -281,7 +281,7 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
     catch (Exception e) {
       LogWriterUtils.getLogWriter().warning("exception while creating cache", e);
     }
-  }//end of startCache
+  }
 
   public static void closeCache() {
     try {
@@ -300,7 +300,7 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
     catch (Exception e) {
       LogWriterUtils.getLogWriter().fine("Error in disconnecting from Distributed System");
     }
-  }//end of closeCache
+  }
 
   @Override
   public final void postSetUp() throws java.lang.Exception {
@@ -337,9 +337,9 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
       /*int rowsDeleted = */jtaObj.deleteRows(tblName_delRows);
     }
     catch (Exception e) {
-      LogWriterUtils.getLogWriter().warning("Error: while deleting rows from database using JTAUtils", e);
+      fail("Error: while deleting rows from database using JTAUtils", e);
     }
-  }//end of delRows
+  }
 
   @Override
   public final void preTearDown() throws Exception {
@@ -352,7 +352,7 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
     //that takes care of destroying table, closing cache, disconnecting from
     // DistributedSystem
     vm0.invoke(TxnManagerMultiThreadDUnitTest.class, "destroyTable", o);
-  }//end of tearDown
+  }
 
   /*
    * calldestroyTable method is written to destroyTable, close cache and
@@ -371,7 +371,6 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
    * ("Closing cache..."); getLogWriter().fine("destroyTable is Successful!"); }
    * catch (Exception e) { fail (" failed during tear down of this test..." +
    * e); } finally { closeCache(); ds.disconnect(); } }//end of destroyTable
-   *  
    */
   public static void getNumberOfRows() {
     //the sleep below is given to give the time to threads to start and perform
@@ -380,7 +379,7 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
       Thread.sleep(7 * 1000);
     }
     catch (InterruptedException ie) {
-      fail("interrupted");
+      fail("interrupted", ie);
     }
     Region currRegion = null;
     Cache cache;
@@ -400,15 +399,17 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
     }
     catch (Exception e) {
       LogWriterUtils.getLogWriter().warning("Error: while getting rows from database using JTAUtils", e);
+      fail("Error: while getting rows from database using JTAUtils", e);
     }
-  }//end of getNumberOfRows
+  }
 
-  /////test methods/////
-  /*
+  /**
    * The following method testAllCommit test the scenario in which all four
    * threads are committing the transaction
    */
-  public static void test1AllCommit() throws Throwable {
+  @Ignore("TODO: test is disabled")
+  @Test
+  public void test1AllCommit() throws Exception {
     VM vm0 = Host.getHost(0).getVM(0);
     AsyncInvocation asyncObj1 = vm0.invokeAsync(() -> TxnManagerMultiThreadDUnitTest.callCommitThreads());
     ThreadUtils.join(asyncObj1, 30 * 1000);
@@ -416,11 +417,10 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
       Assert.fail("asyncObj1 failed", asyncObj1.getException());
     }
     vm0.invoke(() -> TxnManagerMultiThreadDUnitTest.getNumberOfRows());
-  }//end of testAllCommit
+  }
 
-  /*
+  /**
    * This method gives call to CommitThread
-   *  
    */
   public static void callCommitThreads() {
     LogWriterUtils.getLogWriter().fine("This is callCommitThreads method");
@@ -432,15 +432,17 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
     }
     catch (Exception e) {
       LogWriterUtils.getLogWriter().warning("Failed in Commit Threads", e);
-      fail("Failed in Commit Threads" + e);
+      fail("Failed in Commit Threads", e);
     }
-  }//end of callCommitTheads
+  }
 
-  /*
+  /**
    * The following method test3Commit2Rollback test the scenario in which 3
    * threads are committing and 2 threads are rolling back the transaction
    */
-  public static void _test3Commit2Rollback() throws Throwable {
+  @Ignore("TODO: test is disabled")
+  @Test
+  public void test3Commit2Rollback() throws Exception {
     VM vm0 = Host.getHost(0).getVM(0);
     AsyncInvocation asyncObj1 = vm0.invokeAsync(() -> TxnManagerMultiThreadDUnitTest.callCommitandRollbackThreads());
     ThreadUtils.join(asyncObj1, 30 * 1000);
@@ -448,7 +450,7 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
       Assert.fail("asyncObj1 failed", asyncObj1.getException());
     }
     vm0.invoke(() -> TxnManagerMultiThreadDUnitTest.getNumberOfRows());
-  }//end of test3Commit2Rollback
+  }
 
   public static void callCommitandRollbackThreads() {
     LogWriterUtils.getLogWriter().fine("This is callCommitandRollbackThreads method");
@@ -461,9 +463,11 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
     }
     catch (Exception e) {
       LogWriterUtils.getLogWriter().info("Failed in Commit and Rollback threads", e);
-      fail("Failed in Commit and Rollback Threads" + e);
+      fail("Failed in Commit and Rollback Threads", e);
     }
-  }//end of callCommitandRollbackThreads
+  }
+
+  // TODO: test3Commit2BlockingTimeOut is static and commented out
   /*
    * The following method test3Commit2BlockingTimeOut over test the scenario in
    * which 3 threads are committing and 2 threads are passing blocking time out
@@ -502,5 +506,4 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
    *  
    */
 
-   public void testFoo() {}
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnTimeOutDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnTimeOutDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnTimeOutDUnitTest.java
index 10afad8..a3b3b53 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnTimeOutDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnTimeOutDUnitTest.java
@@ -16,36 +16,49 @@
  */
 package com.gemstone.gemfire.internal.jta.dunit;
 
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.util.Properties;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.SystemException;
+import javax.transaction.UserTransaction;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
 import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.internal.OSProcess;
 import com.gemstone.gemfire.internal.jta.CacheUtils;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 import com.gemstone.gemfire.util.test.TestUtil;
 
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.transaction.UserTransaction;
-import java.io.*;
-import java.sql.SQLException;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
 /**
-*This test sees if the TransactionTimeOut works properly
-*/
-public class TxnTimeOutDUnitTest extends DistributedTestCase {
+ * This test sees if the TransactionTimeOut works properly
+ */
+@Category(DistributedTest.class)
+public class TxnTimeOutDUnitTest extends JUnit4DistributedTestCase {
 
   static DistributedSystem ds;
   static Cache cache = null;
-  private static String tblName;
-  private boolean exceptionOccured = false;
-
-  public TxnTimeOutDUnitTest(String name) {
-    super(name);
-  }
 
   public static void init() throws Exception {
     Properties props = new Properties();
@@ -59,17 +72,9 @@ public class TxnTimeOutDUnitTest extends DistributedTestCase {
     wr.flush();
     wr.close();
     props.setProperty(CACHE_XML_FILE, path);
-    //    props.setProperty(DistributionConfig.DistributedSystemConfigProperties.MCAST_PORT, "10321");
     props.setProperty(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
-    try {
-//      ds = DistributedSystem.connect(props);
-      ds = (new TxnTimeOutDUnitTest("temp")).getSystem(props);
-      if (cache == null || cache.isClosed()) cache = CacheFactory.create(ds);
-    }
-    catch (Exception e) {
-      e.printStackTrace(System.err);
-      throw new Exception("" + e);
-    }
+    ds = (new TxnTimeOutDUnitTest()).getSystem(props);
+    if (cache == null || cache.isClosed()) cache = CacheFactory.create(ds);
   }
 
   public static Cache getCache() {
@@ -83,8 +88,7 @@ public class TxnTimeOutDUnitTest extends DistributedTestCase {
       }
     }
     catch (Exception e) {
-	fail("Exception in starting cache due to "+e);
-      e.printStackTrace();
+	    fail("Exception in starting cache due to ", e);
     }
   }
 
@@ -98,7 +102,7 @@ public class TxnTimeOutDUnitTest extends DistributedTestCase {
 
     }
     catch (Exception e) {
-	fail("Exception in closing cache or ds due to "+e);
+    	fail("Exception in closing cache or ds due to "+e);
       e.printStackTrace();
     }
   }
@@ -117,7 +121,8 @@ public class TxnTimeOutDUnitTest extends DistributedTestCase {
     vm0.invoke(() -> TxnTimeOutDUnitTest.closeCache());
   }
 
-  public void testMultiThreaded() throws NamingException, SQLException,Throwable {
+  @Test
+  public void testMultiThreaded() throws Exception {
     try{
 	Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -178,7 +183,9 @@ public class TxnTimeOutDUnitTest extends DistributedTestCase {
   e.printStackTrace();
   }
   }
-  public static void testLoginTimeOut() throws Throwable {
+
+  @Test
+  public void testLoginTimeOut() throws Throwable {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     AsyncInvocation asyncObj1 =  vm0.invokeAsync(() -> TxnTimeOutDUnitTest.runTest2());
@@ -252,34 +259,26 @@ public class TxnTimeOutDUnitTest extends DistributedTestCase {
     }
   }
 
-  public static  void runTest3(Object o) {
-  
-	   boolean exceptionOccured = false;
-	   try 
-	   {
-			int sleeptime = ((Integer)o).intValue();
-			Context ctx = cache.getJNDIContext();
-			UserTransaction utx = (UserTransaction) ctx.lookup("java:/UserTransaction");
-			utx.begin();
-			utx.setTransactionTimeout(sleeptime);
-			Thread.sleep(sleeptime * 2000);
-			try {
-				 utx.commit();
-			}
-			catch (Exception e) {
-				 exceptionOccured = true;
-			}
-			if(!exceptionOccured)
-			fail("exception did not occur although was supposed to"
-			+" occur");
-	   }
-	   catch (Exception e) {
-	   	fail("Exception in runTest3 due to "+e);
-			e.printStackTrace();
-	   }
+  public static void runTest3(Object o) throws SystemException, NotSupportedException, NamingException, InterruptedException {
+    boolean exceptionOccured = false;
+    int sleeptime = ((Integer)o).intValue();
+    Context ctx = cache.getJNDIContext();
+    UserTransaction utx = (UserTransaction) ctx.lookup("java:/UserTransaction");
+    utx.begin();
+    utx.setTransactionTimeout(sleeptime);
+    Thread.sleep(sleeptime * 2000);
+    try {
+       utx.commit();
+    }
+    catch (Exception e) {
+       exceptionOccured = true;
+    }
+    if(!exceptionOccured) {
+      fail("exception did not occur although was supposed to occur");
+    }
   }
+
   private static String readFile(String filename) throws IOException {
-//    String lineSep = System.getProperty("\n");
     BufferedReader br = new BufferedReader(new FileReader(filename));
     String nextLine = "";
     StringBuffer sb = new StringBuffer();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LocatorLogFileJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LocatorLogFileJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LocatorLogFileJUnitTest.java
index 78ee588..83cf09e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LocatorLogFileJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LocatorLogFileJUnitTest.java
@@ -17,6 +17,17 @@
 package com.gemstone.gemfire.internal.logging;
 
 import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Properties;
+
+import org.junit.After;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
 
 import com.gemstone.gemfire.distributed.Locator;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
@@ -26,35 +37,22 @@ import com.gemstone.gemfire.internal.logging.log4j.LogWriterLogger;
 import com.gemstone.gemfire.test.dunit.Wait;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import org.junit.After;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestName;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-import static org.junit.Assert.*;
 
 /**
  * Creates Locator and tests logging behavior at a high level.
- * 
  */
 @Category(IntegrationTest.class)
 public class LocatorLogFileJUnitTest {
-  @Rule public TestName name = new TestName();
 
   protected static final int TIMEOUT_MILLISECONDS = 180 * 1000; // 2 minutes
   protected static final int INTERVAL_MILLISECONDS = 100; // 100 milliseconds
   
   private Locator locator;
   private FileInputStream fis;
-  
-  
+
+  @Rule
+  public TestName name = new TestName();
+
   @After
   public void tearDown() throws Exception {
     if (this.locator != null) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogWriterDisabledPerformanceTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogWriterDisabledPerformanceTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogWriterDisabledPerformanceTest.java
index 2d76d12..53c10f5 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogWriterDisabledPerformanceTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogWriterDisabledPerformanceTest.java
@@ -16,14 +16,16 @@
  */
 package com.gemstone.gemfire.internal.logging;
 
+import org.junit.Ignore;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.LogWriter;
+import com.gemstone.gemfire.test.junit.categories.PerformanceTest;
 
+@Category(PerformanceTest.class)
+@Ignore("Tests have no assertions")
 public class LogWriterDisabledPerformanceTest extends LogWriterPerformanceTest {
 
-  public LogWriterDisabledPerformanceTest(String name) {
-    super(name);
-  }
-
   @Override
   protected PerformanceLogger createPerformanceLogger() {
     final LogWriter logWriter = createLogWriter();
@@ -41,24 +43,4 @@ public class LogWriterDisabledPerformanceTest extends LogWriterPerformanceTest {
     
     return perfLogger;
   }
-
-  @Override
-  public void testCountBasedLogging() throws Exception {
-    super.testCountBasedLogging();
-  }
-
-  @Override
-  public void testTimeBasedLogging() throws Exception {
-    super.testTimeBasedLogging();
-  }
-
-  @Override
-  public void testCountBasedIsEnabled() throws Exception {
-    super.testCountBasedIsEnabled();
-  }
-
-  @Override
-  public void testTimeBasedIsEnabled() throws Exception {
-    super.testTimeBasedIsEnabled();
-  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogWriterPerformanceTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogWriterPerformanceTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogWriterPerformanceTest.java
index 886c2ac..bec2bc4 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogWriterPerformanceTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogWriterPerformanceTest.java
@@ -16,33 +16,30 @@
  */
 package com.gemstone.gemfire.internal.logging;
 
-import com.gemstone.gemfire.LogWriter;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl;
-import com.gemstone.gemfire.internal.util.IOUtils;
-import com.gemstone.gemfire.test.junit.categories.PerformanceTest;
-import org.junit.Ignore;
-import org.junit.experimental.categories.Category;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
 
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.Properties;
 
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import org.junit.Ignore;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.LogWriter;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl;
+import com.gemstone.gemfire.internal.util.IOUtils;
+import com.gemstone.gemfire.test.junit.categories.PerformanceTest;
 
 /**
  * Tests performance of logging when level is OFF.
- * 
  */
 @Category(PerformanceTest.class)
 @Ignore("Tests have no assertions")
 public class LogWriterPerformanceTest extends LoggingPerformanceTestCase {
 
-  public LogWriterPerformanceTest(String name) {
-    super(name);
-  }
-  
   protected Properties createGemFireProperties() {
     final Properties props = new Properties();
     this.logFile = new File(this.configDirectory, DistributionConfig.GEMFIRE_PREFIX + "log");
@@ -87,7 +84,8 @@ public class LogWriterPerformanceTest extends LoggingPerformanceTestCase {
         appendToFile, isLoner, isSecurityLog, config, logConfig, fosHolder);
     return logWriter;
   }
-  
+
+  @Override
   protected PerformanceLogger createPerformanceLogger() {
     final LogWriter logWriter = createLogWriter();
     
@@ -104,24 +102,4 @@ public class LogWriterPerformanceTest extends LoggingPerformanceTestCase {
     
     return perfLogger;
   }
-  
-  @Override
-  public void testCountBasedLogging() throws Exception {
-    super.testCountBasedLogging();
-  }
-
-  @Override
-  public void testTimeBasedLogging() throws Exception {
-    super.testTimeBasedLogging();
-  }
-
-  @Override
-  public void testCountBasedIsEnabled() throws Exception {
-    super.testCountBasedIsEnabled();
-  }
-
-  @Override
-  public void testTimeBasedIsEnabled() throws Exception {
-    super.testTimeBasedIsEnabled();
-  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LoggingPerformanceTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LoggingPerformanceTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LoggingPerformanceTestCase.java
index bc7cf39..9f0a734 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LoggingPerformanceTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LoggingPerformanceTestCase.java
@@ -16,18 +16,23 @@
  */
 package com.gemstone.gemfire.internal.logging;
 
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.internal.util.StopWatch;
-import junit.framework.TestCase;
+import static org.junit.Assert.*;
 
 import java.io.File;
 import java.io.IOException;
 
+import org.junit.After;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.util.StopWatch;
+
 /**
  * Tests performance of logging when level is OFF.
- * 
  */
-public abstract class LoggingPerformanceTestCase extends TestCase {
+public abstract class LoggingPerformanceTestCase {
 
   protected static final boolean TIME_BASED = Boolean.getBoolean(DistributionConfig.GEMFIRE_PREFIX + "test.LoggingPerformanceTestCase.TIME_BASED");
   protected static final long TIME_TO_RUN = 1000 * 60 * 10; // ten minutes
@@ -38,23 +43,16 @@ public abstract class LoggingPerformanceTestCase extends TestCase {
   protected File configDirectory = new File(getUniqueName());//null;
   protected File logFile = new File(configDirectory, getUniqueName()+".log");
 
-  public LoggingPerformanceTestCase(String name) {
-    super(name);
-  }
-  
-  @Override
-  public void setUp() throws Exception {
-    super.setUp();
-  }
-  
-  @Override
-  public void tearDown() throws Exception {
-    super.tearDown();
+  @Rule
+  public TestName testName = new TestName();
+
+  @After
+  public void tearDownLoggingPerformanceTestCase() throws Exception {
     this.configDirectory = null; // leave this directory in place for now
   }
 
   protected String getUniqueName() {
-    return getClass().getSimpleName() + "_" + getName();
+    return getClass().getSimpleName() + "_" + testName.getMethodName();
   }
   
   protected long performLoggingTest(final PerformanceLogger perfLogger) {
@@ -171,22 +169,26 @@ public abstract class LoggingPerformanceTestCase extends TestCase {
   }
   
   protected abstract PerformanceLogger createPerformanceLogger() throws IOException;
-  
+
+  @Test
   public void testCountBasedLogging() throws Exception {
     performCountBasedLoggingTest(createPerformanceLogger());
     assertTrue(this.logFile.exists());
   }
 
+  @Test
   public void testTimeBasedLogging() throws Exception {
     performTimeBasedLoggingTest(createPerformanceLogger());
     assertTrue(this.logFile.exists());
   }
 
+  @Test
   public void testCountBasedIsEnabled() throws Exception {
     performCountBasedIsEnabledTest(createPerformanceLogger());
     assertTrue(this.logFile.exists());
   }
 
+  @Test
   public void testTimeBasedIsEnabled() throws Exception {
     performTimeBasedIsEnabledTest(createPerformanceLogger());
     assertTrue(this.logFile.exists());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/TestLogWriterFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/TestLogWriterFactory.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/TestLogWriterFactory.java
index 9b587a6..d0f5970 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/TestLogWriterFactory.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/TestLogWriterFactory.java
@@ -16,6 +16,14 @@
  */
 package com.gemstone.gemfire.internal.logging;
 
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+
+import org.junit.Assert;
+
 import com.gemstone.gemfire.GemFireIOException;
 import com.gemstone.gemfire.LogWriter;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
@@ -25,13 +33,9 @@ import com.gemstone.gemfire.internal.OSProcess;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.process.ProcessLauncherContext;
 import com.gemstone.gemfire.internal.util.LogFileUtils;
-import junit.framework.Assert;
-
-import java.io.*;
 
 /**
  * Creates LogWriter instances for testing.
- * 
  */
 public class TestLogWriterFactory extends Assert {
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2DisabledPerformanceTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2DisabledPerformanceTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2DisabledPerformanceTest.java
index caedadc..90428b4 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2DisabledPerformanceTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2DisabledPerformanceTest.java
@@ -29,45 +29,22 @@ import com.gemstone.gemfire.test.junit.categories.PerformanceTest;
 @Ignore("Tests have no assertions")
 public class Log4J2DisabledPerformanceTest extends Log4J2PerformanceTest {
 
-  public Log4J2DisabledPerformanceTest(String name) {
-    super(name);
-  }
-
   @Override
   protected PerformanceLogger createPerformanceLogger() throws IOException {
     final Logger logger = createLogger();
-    
+
     final PerformanceLogger perfLogger = new PerformanceLogger() {
       @Override
       public void log(String message) {
         logger.debug(message);
       }
+
       @Override
       public boolean isEnabled() {
         return logger.isEnabled(Level.DEBUG);
       }
     };
-    
-    return perfLogger;
-  }
-
-  @Override
-  public void testCountBasedLogging() throws Exception {
-    super.testCountBasedLogging();
-  }
 
-  @Override
-  public void testTimeBasedLogging() throws Exception {
-    super.testTimeBasedLogging();
-  }
-
-  @Override
-  public void testCountBasedIsEnabled() throws Exception {
-    super.testCountBasedIsEnabled();
-  }
-
-  @Override
-  public void testTimeBasedIsEnabled() throws Exception {
-    super.testTimeBasedIsEnabled();
+    return perfLogger;
   }
 }



Mime
View raw message