You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/06/07 20:55:01 UTC
[46/62] [abbrv] incubator-geode git commit: Merge remote-tracking
branch 'origin/develop' into feature/GEODE-837
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/GlobalTransactionJUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/internal/jta/GlobalTransactionJUnitTest.java
index 52c8a47,1ede356..84d1978
--- 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,24 -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;
@@@ -52,12 -43,12 +52,12 @@@ public class GlobalTransactionJUnitTes
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(DistributionConfig.MCAST_PORT_NAME, "0");
+ props.setProperty(MCAST_PORT, "0");
String path = TestUtil.getResourcePath(GlobalTransactionJUnitTest.class, "/jta/cachejta.xml");
- props.setProperty("cache-xml-file", path);
+ props.setProperty(CACHE_XML_FILE, path);
ds1 = DistributedSystem.connect(props);
cache = CacheFactory.create(ds1);
utx = new UserTransactionImpl();
@@@ -69,42 -60,43 +69,30 @@@
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() {
- try {
- utx.begin();
- utx.setRollbackOnly();
- Transaction txn = tm.getTransaction();
- if (txn.getStatus() != Status.STATUS_MARKED_ROLLBACK) {
- utx.rollback();
- fail("testSetRollbackonly failed");
- }
++ 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() {
++ public void testEnlistResource() throws Exception {
try {
boolean exceptionoccured = false;
utx.begin();
@@@ -133,8 -125,7 +121,8 @@@
}
}
- public void testRegisterSynchronization() {
+ @Test
- public void testRegisterSynchronization() {
++ public void testRegisterSynchronization() throws Exception {
try {
boolean exceptionoccured = false;
utx.begin();
@@@ -162,8 -153,7 +150,8 @@@
}
}
- public void testEnlistResourceAfterRollBack() {
+ @Test
- public void testEnlistResourceAfterRollBack() {
++ public void testEnlistResourceAfterRollBack() throws Exception {
try {
boolean exceptionoccured = false;
utx.begin();
@@@ -193,8 -183,7 +181,8 @@@
}
}
- public void testRegisterSynchronizationAfterRollBack() {
+ @Test
- public void testRegisterSynchronizationAfterRollBack() {
++ public void testRegisterSynchronizationAfterRollBack() throws Exception {
try {
boolean exceptionoccured = false;
utx.begin();
@@@ -224,36 -213,34 +212,23 @@@
}
}
- 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() {
- 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();
- }
++ 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() {
- 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();
- }
++ 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/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/TransactionTimeOutJUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/internal/jta/TransactionTimeOutJUnitTest.java
index 7472a98,548b9b1..727e1ea
--- 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,64 -16,46 +16,64 @@@
*/
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.util.test.TestUtil;
+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");
+ 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);
@@@ -83,54 -64,48 +83,54 @@@
wr.write(modified_file_str);
wr.flush();
wr.close();
+
- props.setProperty("cache-xml-file", path);
+ 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) {
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/ExceptionsDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/ExceptionsDUnitTest.java
index b2867ca,117f3e3..a7edbd4
--- 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,23 -16,6 +16,24 @@@
*/
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;
@@@ -136,12 -126,12 +137,12 @@@ public class ExceptionsDUnitTest extend
wr.write(modified_file_str);
wr.flush();
wr.close();
- props.setProperty("cache-xml-file", path);
+ props.setProperty(CACHE_XML_FILE, path);
// String tableName = "";
- // props.setProperty("mcast-port", "10339");
+ // 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/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/IdleTimeOutDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/IdleTimeOutDUnitTest.java
index 3e48a14,ff97dd2..2440f35
--- 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,15 -16,18 +16,16 @@@
*/
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;
@@@ -146,12 -129,12 +147,12 @@@ public class IdleTimeOutDUnitTest exten
wr.write(modified_file_str);
wr.flush();
wr.close();
- props.setProperty("cache-xml-file", path);
+ props.setProperty(CACHE_XML_FILE, path);
String tableName = "";
- // props.setProperty("mcast-port", "10339");
+ // 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();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/LoginTimeOutDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/LoginTimeOutDUnitTest.java
index 5d05bf5,5d058d1..85f265c
--- 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,27 -16,6 +16,29 @@@
*/
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;
@@@ -65,10 -46,10 +67,6 @@@ public class LoginTimeOutDUnitTest exte
private static Cache cache;
private static String tblName;
- public LoginTimeOutDUnitTest() {
- super();
- public LoginTimeOutDUnitTest(String name) {
- super(name);
-- }
--
private static String readFile(String filename) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(filename));
String nextLine = "";
@@@ -223,8 -204,8 +221,8 @@@
}
}
-- 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];
@@@ -232,7 -213,7 +230,8 @@@
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 {
@@@ -246,14 -227,13 +245,11 @@@
}
}
- @Test
-- 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/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/MaxPoolSizeDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/MaxPoolSizeDUnitTest.java
index f03539c,544463c..c6284d6
--- 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,49 -16,33 +16,50 @@@
*/
package com.gemstone.gemfire.internal.jta.dunit;
- import static org.junit.Assert.*;
-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();
@@@ -74,10 -58,10 +75,6 @@@
return sb.toString();
}
- public MaxPoolSizeDUnitTest() {
- super();
- 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>";
@@@ -143,22 -127,22 +140,14 @@@
wr.write(modified_file_str);
wr.flush();
wr.close();
- props.setProperty("cache-xml-file", path);
+ props.setProperty(CACHE_XML_FILE, path);
String tableName = "";
- // props.setProperty("mcast-port", "10339");
- // props.setProperty(DistributionConfig.DistributedSystemConfigProperties.MCAST_PORT, "10339");
-- try {
-- // ds = DistributedSystem.connect(props);
- ds = (new MaxPoolSizeDUnitTest()).getSystem(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;
@@@ -202,10 -186,10 +191,6 @@@
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);
@@@ -229,7 -213,7 +214,7 @@@
}
}
catch (Exception e) {
-- e.printStackTrace();
++ fail("startCache failed", e);
}
}
@@@ -240,7 -224,7 +225,7 @@@
}
}
catch (Exception e) {
-- e.printStackTrace();
++ fail("closeCache failed", e);
}
try {
ds.disconnect();
@@@ -271,7 -255,7 +256,8 @@@
}
}
-- 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());
@@@ -291,12 -275,12 +277,12 @@@
}
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/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TransactionTimeOutDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TransactionTimeOutDUnitTest.java
index 8af2646,38745ba..0e7660f
--- 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,25 -16,6 +16,27 @@@
*/
package com.gemstone.gemfire.internal.jta.dunit;
- import static org.junit.Assert.*;
++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;
@@@ -42,30 -23,33 +44,26 @@@ import com.gemstone.gemfire.internal.OS
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
-*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() {
- super();
- public TransactionTimeOutDUnitTest(String name) {
- super(name);
-- }
--
public static void init() throws Exception {
Properties props = new Properties();
int pid = OSProcess.getId();
@@@ -78,17 -62,17 +76,10 @@@
wr.flush();
wr.close();
- props.setProperty("cache-xml-file", path);
- // props.setProperty("mcast-port", "10321");
- try {
- // ds = DistributedSystem.connect(props);
- ds = (new TransactionTimeOutDUnitTest()).getSystem(props);
- if (cache == null || cache.isClosed()) cache = CacheFactory.create(ds);
- }
- catch (Exception e) {
- e.printStackTrace(System.err);
- throw new Exception("" + e);
- }
+ 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() {
@@@ -102,8 -86,8 +93,7 @@@
}
}
catch (Exception e) {
-- fail("Exception in cache creation due to "+e);
-- e.printStackTrace();
++ fail("Exception in cache creation due to ", e);
}
}
@@@ -116,8 -100,8 +106,7 @@@
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);
}
}
@@@ -143,57 -127,57 +132,65 @@@
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());
@@@ -216,12 -200,12 +213,9 @@@
}
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);
}
}
@@@ -241,13 -225,13 +235,10 @@@
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);
}
}
@@@ -263,7 -247,7 +254,7 @@@
utx.commit();
}
catch (Exception e) {
-- fail("Exception in TestSetTransactionTimeOut due to " + e);
++ fail("Exception in TestSetTransactionTimeOut due to ", e);
}
}
@@@ -288,7 -272,7 +279,7 @@@
}
}
catch (Exception e) {
-- fail("Exception in testExceptionOnCommitAfterTimeOut() due to " + e);
++ fail("Exception in testExceptionOnCommitAfterTimeOut() due to ", e);
}
}
@@@ -316,7 -300,7 +307,7 @@@
}
}
catch (Exception e) {
-- fail("Exception in testExceptionOnCommitAfterTimeOut() due to " + e);
++ fail("Exception in testExceptionOnCommitAfterTimeOut() due to ", e);
}
}
@@@ -340,7 -324,7 +331,7 @@@
}
}
catch (Exception e) {
-- fail("Exception in testExceptionOnCommitAfterTimeOut() due to " + e);
++ fail("Exception in testExceptionOnCommitAfterTimeOut() due to ", e);
}
}
@@@ -357,12 -341,12 +348,11 @@@
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);
}
}
@@@ -396,8 -380,8 +386,7 @@@
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);
}
}
@@@ -439,8 -423,8 +428,7 @@@
}
}
catch (Exception e) {
-- fail("Exception occured in test Commit due to " + e);
-- e.printStackTrace();
++ fail("Exception occured in test Commit due to ", e);
}
}
@@@ -482,10 -466,10 +470,10 @@@
}
}
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/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnManagerMultiThreadDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnManagerMultiThreadDUnitTest.java
index 05c7295,439c961..24597e0
--- 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,28 -16,6 +16,30 @@@
*/
package com.gemstone.gemfire.internal.jta.dunit;
- import static org.junit.Assert.*;
++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;
@@@ -57,34 -28,49 +59,26 @@@ import com.gemstone.gemfire.util.test.T
/**
* 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 {
- /////constructor/////
- public TxnManagerMultiThreadDUnitTest() {
- super();
- }
-
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\"";
@@@ -132,7 -118,7 +126,7 @@@
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\"";
@@@ -180,7 -166,7 +174,7 @@@
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;
@@@ -199,29 -185,29 +193,22 @@@
wr.write(modified_file_str1);
wr.flush();
wr.close();
- props.setProperty("cache-xml-file", path);
+ props.setProperty(CACHE_XML_FILE, path);
String tableName = "";
- // props.setProperty("mcast-port", "10339");
- // props.setProperty(DistributionConfig.DistributedSystemConfigProperties.MCAST_PORT, "10339");
-- try {
-- // ds = DistributedSystem.connect(props);
- ds = (new TxnManagerMultiThreadDUnitTest()).getSystem(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();
@@@ -242,17 -228,17 +229,16 @@@
}
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;
@@@ -280,11 -266,11 +266,11 @@@
LogWriterUtils.getLogWriter().fine("Closing cache...");
closeCache();
}
-- }//end of destroyTable
++ }
public static Cache getCache() {
return cache;
-- }//end of getCache
++ }
public static void startCache() {
try {
@@@ -295,7 -281,7 +281,7 @@@
catch (Exception e) {
LogWriterUtils.getLogWriter().warning("exception while creating cache", e);
}
-- }//end of startCache
++ }
public static void closeCache() {
try {
@@@ -314,7 -300,7 +300,7 @@@
catch (Exception e) {
LogWriterUtils.getLogWriter().fine("Error in disconnecting from Distributed System");
}
-- }//end of closeCache
++ }
@Override
public final void postSetUp() throws java.lang.Exception {
@@@ -351,9 -337,9 +337,9 @@@
/*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 {
@@@ -366,7 -352,7 +352,7 @@@
//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
@@@ -385,7 -371,7 +371,6 @@@
* ("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
@@@ -394,7 -380,7 +379,7 @@@
Thread.sleep(7 * 1000);
}
catch (InterruptedException ie) {
-- fail("interrupted");
++ fail("interrupted", ie);
}
Region currRegion = null;
Cache cache;
@@@ -414,15 -400,15 +399,17 @@@
}
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);
@@@ -430,11 -416,11 +417,10 @@@
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");
@@@ -446,15 -432,15 +432,16 @@@
}
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 {
++ @Test
++ public void test3Commit2Rollback() throws Exception {
VM vm0 = Host.getHost(0).getVM(0);
AsyncInvocation asyncObj1 = vm0.invokeAsync(() -> TxnManagerMultiThreadDUnitTest.callCommitandRollbackThreads());
ThreadUtils.join(asyncObj1, 30 * 1000);
@@@ -462,7 -448,7 +449,7 @@@
Assert.fail("asyncObj1 failed", asyncObj1.getException());
}
vm0.invoke(() -> TxnManagerMultiThreadDUnitTest.getNumberOfRows());
-- }//end of test3Commit2Rollback
++ }
public static void callCommitandRollbackThreads() {
LogWriterUtils.getLogWriter().fine("This is callCommitandRollbackThreads method");
@@@ -475,9 -461,9 +462,11 @@@
}
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
@@@ -516,6 -502,5 +505,4 @@@
*
*/
- @Test
- public void testFoo() {}
- public void testFoo() {}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnTimeOutDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnTimeOutDUnitTest.java
index 24e5796,10afad8..a3b3b53
--- 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,53 -16,36 +16,49 @@@
*/
package com.gemstone.gemfire.internal.jta.dunit;
- import static org.junit.Assert.*;
++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.SQLException;
+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
-*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() {
- super();
- public TxnTimeOutDUnitTest(String name) {
- super(name);
-- }
public static void init() throws Exception {
Properties props = new Properties();
@@@ -75,18 -58,18 +71,10 @@@
wr.write(modified_file_str);
wr.flush();
wr.close();
- props.setProperty("cache-xml-file", path);
- // props.setProperty("mcast-port", "10321");
- props.setProperty("log-level", LogWriterUtils.getDUnitLogLevel());
- try {
- // ds = DistributedSystem.connect(props);
- ds = (new TxnTimeOutDUnitTest()).getSystem(props);
- if (cache == null || cache.isClosed()) cache = CacheFactory.create(ds);
- }
- catch (Exception e) {
- e.printStackTrace(System.err);
- throw new Exception("" + e);
- }
+ 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() {
@@@ -100,8 -83,8 +88,7 @@@
}
}
catch (Exception e) {
-- fail("Exception in starting cache due to "+e);
-- e.printStackTrace();
++ fail("Exception in starting cache due to ", e);
}
}
@@@ -115,7 -98,7 +102,7 @@@
}
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();
}
}
@@@ -134,8 -117,7 +121,8 @@@
vm0.invoke(() -> TxnTimeOutDUnitTest.closeCache());
}
- public void testMultiThreaded() throws NamingException, SQLException,Throwable {
+ @Test
- public void testMultiThreaded() throws NamingException, SQLException,Throwable {
++ public void testMultiThreaded() throws Exception {
try{
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@@ -196,7 -178,7 +183,9 @@@
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());
@@@ -270,34 -252,34 +259,26 @@@
}
}
-- 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/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LocatorLogFileJUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LocatorLogFileJUnitTest.java
index 70668e1,78ee588..83cf09e
--- 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
@@@ -16,17 -16,7 +16,18 @@@
*/
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;
@@@ -39,7 -29,20 +40,6 @@@ import com.gemstone.gemfire.test.junit.
/**
* Creates Locator and tests logging behavior at a high level.
-- *
*/
@Category(IntegrationTest.class)
public class LocatorLogFileJUnitTest {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogWriterPerformanceTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LogWriterPerformanceTest.java
index bcc4786,886c2ac..bec2bc4
--- 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,22 -16,20 +16,22 @@@
*/
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.Test;
+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.
@@@ -40,12 -39,16 +40,12 @@@
@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, "gemfire.log");
+ this.logFile = new File(this.configDirectory, DistributionConfig.GEMFIRE_PREFIX + "log");
final String logFilePath = IOUtils.tryGetCanonicalPathElseGetAbsolutePath(logFile);
- props.setProperty(DistributionConfig.LOG_FILE_NAME, logFilePath);
- props.setProperty(DistributionConfig.LOG_LEVEL_NAME, "info");
+ props.setProperty(LOG_FILE, logFilePath);
+ props.setProperty(LOG_LEVEL, "info");
return props;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LoggingPerformanceTestCase.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/internal/logging/LoggingPerformanceTestCase.java
index e8b2f0c,bc7cf39..9f0a734
--- 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
@@@ -21,19 -23,13 +21,20 @@@ 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("gemfire.test.LoggingPerformanceTestCase.TIME_BASED");
+ 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
protected static final int LOG_SETS = 1000;
protected static final int LOG_REPETITIONS_PER_SET = 1000;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2PerformanceTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2PerformanceTest.java
index c46f880,f303d35..12f2744
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2PerformanceTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/Log4J2PerformanceTest.java
@@@ -34,10 -29,8 +34,11 @@@ import org.junit.After
import org.junit.Ignore;
import org.junit.experimental.categories.Category;
-import java.io.*;
-import java.net.URL;
++import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.FileUtil;
+import com.gemstone.gemfire.internal.logging.LoggingPerformanceTestCase;
+import com.gemstone.gemfire.internal.util.IOUtils;
+import com.gemstone.gemfire.test.junit.categories.PerformanceTest;
@Category(PerformanceTest.class)
@Ignore("Tests have no assertions")
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLoggerPerformanceTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLoggerPerformanceTest.java
index a079213,f186672..3eb6602
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLoggerPerformanceTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/logging/log4j/LogWriterLoggerPerformanceTest.java
@@@ -33,10 -28,8 +33,11 @@@ import org.junit.After
import org.junit.Ignore;
import org.junit.experimental.categories.Category;
-import java.io.*;
-import java.net.URL;
++import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.FileUtil;
+import com.gemstone.gemfire.internal.logging.LoggingPerformanceTestCase;
+import com.gemstone.gemfire.internal.util.IOUtils;
+import com.gemstone.gemfire.test.junit.categories.PerformanceTest;
@Category(PerformanceTest.class)
@Ignore("Tests have no assertions")
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OutOfOffHeapMemoryDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OutOfOffHeapMemoryDUnitTest.java
index b0fbed1,43406d3..02a8050
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OutOfOffHeapMemoryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/offheap/OutOfOffHeapMemoryDUnitTest.java
@@@ -16,66 -16,52 +16,50 @@@
*/
package com.gemstone.gemfire.internal.offheap;
- import org.junit.experimental.categories.Category;
- import org.junit.Test;
-
++import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
++import static com.jayway.awaitility.Awaitility.*;
++import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+
- import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
- import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
- import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
+import java.util.Properties;
+import java.util.concurrent.Callable;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
+
- import org.apache.logging.log4j.Logger;
++import org.junit.Test;
++import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.OutOfOffHeapMemoryException;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionShortcut;
--import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.DistributedSystemDisconnectedException;
- import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.DistributionManager;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.internal.cache.DistributedRegion;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.OffHeapTestUtil;
--import com.gemstone.gemfire.internal.logging.LogService;
import com.gemstone.gemfire.internal.util.StopWatch;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.IgnoredException;
import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
- import com.gemstone.gemfire.test.dunit.Wait;
- import com.gemstone.gemfire.test.dunit.WaitCriterion;
-import org.apache.logging.log4j.Logger;
--
-import java.util.Properties;
-import java.util.concurrent.Callable;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
--
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
--import static com.jayway.awaitility.Awaitility.with;
--import static org.hamcrest.CoreMatchers.equalTo;
++import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
++import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Test behavior of region when running out of off-heap memory.
-- *
*/
- @SuppressWarnings("serial")
+@Category(DistributedTest.class)
+ @SuppressWarnings("serial")
-public class OutOfOffHeapMemoryDUnitTest extends CacheTestCase {
- private static final Logger logger = LogService.getLogger();
-
+public class OutOfOffHeapMemoryDUnitTest extends JUnit4CacheTestCase {
- private static final Logger logger = LogService.getLogger();
-
++
protected static final AtomicReference<Cache> cache = new AtomicReference<Cache>();
protected static final AtomicReference<DistributedSystem> system = new AtomicReference<DistributedSystem>();
protected static final AtomicBoolean isSmallerVM = new AtomicBoolean();
- public OutOfOffHeapMemoryDUnitTest() {
- super();
- public OutOfOffHeapMemoryDUnitTest(String name) {
- super(name);
-- }
--
@Override
public final void preSetUp() throws Exception {
disconnectAllFromDS();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/process/LocalProcessLauncherDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/internal/process/LocalProcessLauncherDUnitTest.java
index de90537,8d037b2..692b2a5
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/process/LocalProcessLauncherDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/process/LocalProcessLauncherDUnitTest.java
@@@ -35,14 -29,13 +35,14 @@@ import com.gemstone.gemfire.test.junit.
/**
* Multi-process tests for ProcessLauncher.
*
- * @since 7.0
+ * @since GemFire 7.0
*/
+@Category(DistributedTest.class)
@SuppressWarnings("serial")
-public class LocalProcessLauncherDUnitTest extends DistributedTestCase {
+public class LocalProcessLauncherDUnitTest extends JUnit4DistributedTestCase {
- public LocalProcessLauncherDUnitTest(String name) {
- super(name);
+ public LocalProcessLauncherDUnitTest() {
+ super();
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/StatisticsDUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/StatisticsDUnitTest.java
index e1657bb,09cf61a..5f46199
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/StatisticsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/StatisticsDUnitTest.java
@@@ -16,67 -16,32 +16,64 @@@
*/
package com.gemstone.gemfire.internal.statistics;
- import org.junit.experimental.categories.Category;
- import org.junit.Test;
-
+ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
- import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
- import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
- import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-
-import com.gemstone.gemfire.*;
-import com.gemstone.gemfire.cache.*;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.atomic.AtomicReferenceArray;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
++import org.junit.Test;
++import org.junit.experimental.categories.Category;
++
+import com.gemstone.gemfire.StatisticDescriptor;
+import com.gemstone.gemfire.Statistics;
+import com.gemstone.gemfire.StatisticsFactory;
+import com.gemstone.gemfire.StatisticsType;
+import com.gemstone.gemfire.StatisticsTypeFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.CacheListener;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionEvent;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
import com.gemstone.gemfire.cache.util.RegionMembershipListenerAdapter;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
--import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.DistributedMember;
- import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
-import com.gemstone.gemfire.internal.*;
+import com.gemstone.gemfire.internal.GemFireStatSampler;
+import com.gemstone.gemfire.internal.NanoTimer;
+import com.gemstone.gemfire.internal.StatArchiveReader;
import com.gemstone.gemfire.internal.StatArchiveReader.StatSpec;
+ import com.gemstone.gemfire.internal.StatArchiveReader.StatValue;
+import com.gemstone.gemfire.internal.StatSamplerStats;
+import com.gemstone.gemfire.internal.StatisticsTypeFactoryImpl;
- import com.gemstone.gemfire.internal.StatArchiveReader.StatValue;
import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.concurrent.atomic.AtomicReferenceArray;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+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.cache.internal.JUnit4CacheTestCase;
++import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Integration tests for Statistics. VM0 performs puts and VM1 receives
@@@ -88,11 -53,10 +85,11 @@@
* This test mimics hydratest/locators/cacheDS.conf in an attempt to reproduce
* bug #45478. So far this test passes consistently.
*
- * @since 7.0
+ * @since GemFire 7.0
*/
@SuppressWarnings("serial")
-public class StatisticsDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class StatisticsDUnitTest extends JUnit4CacheTestCase {
private static final String dir = "StatisticsDUnitTest";
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/statistics/ValueMonitorJUnitTest.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bd38e10f/geode-core/src/test/java/com/gemstone/gemfire/internal/util/concurrent/ConcurrentHashMapIteratorJUnitTest.java
----------------------------------------------------------------------
diff --cc geode-core/src/test/java/com/gemstone/gemfire/internal/util/concurrent/ConcurrentHashMapIteratorJUnitTest.java
index 079db17,e5aa0fe..ca1fb64
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/util/concurrent/ConcurrentHashMapIteratorJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/util/concurrent/ConcurrentHashMapIteratorJUnitTest.java
@@@ -16,28 -16,22 +16,28 @@@
*/
package com.gemstone.gemfire.internal.util.concurrent;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import junit.framework.TestCase;
-import org.junit.experimental.categories.Category;
++import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
-import java.util.*;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Random;
import java.util.concurrent.ConcurrentMap;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-@SuppressWarnings({ "rawtypes", "unchecked" })
@Category(IntegrationTest.class)
-public class ConcurrentHashMapIteratorJUnitTest extends TestCase {
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public class ConcurrentHashMapIteratorJUnitTest {
+ @Test
public void test() throws InterruptedException {
--
//Apparently, we need a distributed system to create
//this CHM, because it's locks use DS properties.
Properties props = new Properties();
@@@ -52,14 -46,14 +52,9 @@@
assertEquals(baselineMap, testMap);
initialSet = new HashMap(baselineMap);
--// putter = new Putter(baselineMap, testMap, 1000, 2000);
--// putter.run();
--
--
RandomMutations randomer = new RandomMutations(baselineMap, testMap, 1001, 50000);
randomer.start();
--
for(int i = 0; i < 1000; i++) {
checkForInitialSet(i, testMap, initialSet);
}
@@@ -92,8 -86,8 +87,7 @@@
private int start;
private int end;
private volatile boolean done;
--
--
++
public RandomMutations(ConcurrentMap baselineMap, ConcurrentMap testMap, int start, int end) {
this.baselineMap = baselineMap;
this.testMap = testMap;
@@@ -101,6 -95,6 +95,7 @@@
this.end = end;
}
++ @Override
public void run() {
Random random = new Random();
while(!done) {
@@@ -121,6 -115,6 +116,4 @@@
this.join();
}
}
--
--
}