You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by hi...@apache.org on 2016/06/15 16:42:17 UTC
[36/97] [abbrv] [partial] incubator-geode git commit: GEODE-837:
update tests from JUnit3 to JUnit4
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedLockServiceDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedLockServiceDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedLockServiceDUnitTest.java
index 5729bf6..ebd0b95 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedLockServiceDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedLockServiceDUnitTest.java
@@ -16,6 +16,8 @@
*/
package com.gemstone.gemfire.distributed;
+import static org.junit.Assert.*;
+
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
@@ -25,8 +27,8 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
-import junit.framework.Assert;
-import junit.framework.AssertionFailedError;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.SystemFailure;
import com.gemstone.gemfire.distributed.internal.DistributionManager;
@@ -43,7 +45,6 @@ import com.gemstone.gemfire.distributed.internal.locks.RemoteThread;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.internal.util.StopWatch;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
@@ -54,32 +55,24 @@ 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 org.junit.experimental.categories.Category;
-
/**
* This class tests distributed ownership via the DistributedLockService api.
*/
@Category(DistributedTest.class)
-public class DistributedLockServiceDUnitTest extends DistributedTestCase {
-
- protected static DistributedSystem dlstSystem;
+public class DistributedLockServiceDUnitTest extends JUnit4DistributedTestCase {
+
+ private static DistributedSystem dlstSystem;
private static DistributedLockBlackboard blackboard;
- protected static Object monitor = new Object();
+ private static Object monitor = new Object();
private int hits = 0;
private int completes = 0;
private boolean done;
private boolean got;
-
- public DistributedLockServiceDUnitTest(String name) {
- super(name);
- }
-
- /////////// Test lifecycle //////////
-
/**
* Returns a previously created (or new, if this is the first
* time this method is called in this VM) distributed system
@@ -132,17 +125,14 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
DLockService.dumpAllServices();
}
- ///////// Remote setup/teardown support
-
/**
* Connects a DistributedSystem, saves it in static variable "system"
*/
protected static void connectDistributedSystem() {
- dlstSystem = (new DistributedLockServiceDUnitTest("dummy")).getSystem();
+ dlstSystem = (new DistributedLockServiceDUnitTest()).getSystem();
}
- ///////// Public test methods
-
+ @Test
public void testBasic() {
String serviceName = getUniqueName();
String objectName = "object";
@@ -169,6 +159,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
DistributedLockService.destroy(serviceName);
}
+ @Test
public void testCreateDestroy() throws Exception {
final String serviceName = getUniqueName();
final String abc = "abc";
@@ -275,6 +266,8 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
protected static volatile boolean stop_testFairness;
protected static volatile boolean[] done_testFairness = new boolean[16];
static { Arrays.fill(done_testFairness, true); }
+
+ @Test
public void testFairness() throws Exception {
final String serviceName = "testFairness_" + getUniqueName();
final Object lock = "lock";
@@ -418,6 +411,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
return new Integer(count_testFairness[i.intValue()]);
}
+ @Test
public void testOneGetsAndOthersTimeOut() throws Exception {
doOneGetsAndOthersTimeOut(1, 1);
// doOneGetsAndOthersTimeOut(2, 2);
@@ -475,6 +469,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
service.becomeLockGrantor();
}
+ @Test
public void testGrantorSelection() {
// TODO change distributedCreateService usage to be concurrent threads
@@ -501,6 +496,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
}
}
+ @Test
public void testBasicGrantorRecovery() {
//DLockGrantor.setUncleanDestroyEnabled(true);
// try {
@@ -572,7 +568,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
logInfo("[testBasicGrantorRecovery] succeeded attempt " + attempt);
break; // success
}
- catch (AssertionFailedError e) {
+ catch (AssertionError e) {
logInfo("[testBasicGrantorRecovery] failed attempt " + attempt);
if (attempt == attempts-1) throw e;
}
@@ -583,6 +579,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
// }
}
+ @Test
public void testLockFailover() {
final int originalGrantorVM = 0;
final int oneVM = 1;
@@ -672,6 +669,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
oneID, twoID);
}
+ @Test
public void testLockThenBecomeLockGrantor() {
final int originalGrantorVM = 0;
final int becomeGrantorVM = 1;
@@ -752,6 +750,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
Boolean.FALSE, unlocked);
}
+ @Test
public void testBecomeLockGrantor() {
// create lock services...
int numVMs = 4;
@@ -828,6 +827,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
// verify that pending requests are granted by unlocking them also
}
+ @Test
public void testTryLock() {
final Long waitMillis = new Long(100);
@@ -860,6 +860,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
1, unlockCount);
}
+ @Test
public void testOneGetsThenOtherGets() throws Exception { // (numVMs, numThreadsPerVM)
doOneGetsThenOtherGets(1, 1);
// doOneGetsThenOtherGets(2, 2);
@@ -867,6 +868,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
doOneGetsThenOtherGets(4, 3);
}
+ @Test
public void testLockDifferentNames() throws Exception {
String serviceName = getUniqueName();
@@ -890,6 +892,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
service.unlock("masterVMobj");
}
+ @Test
public void testLocalGetLockAndIncrement() throws Exception {
String serviceName = getUniqueName();
remoteCreateService(serviceName);
@@ -897,6 +900,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
assertEquals(Boolean.TRUE,
getLockAndIncrement(serviceName, "localVMobj", -1, 0));
}
+ @Test
public void testRemoteGetLockAndIncrement() {
String serviceName = getUniqueName();
VM vm = Host.getHost(0).getVM(0);
@@ -906,6 +910,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
)));
}
+ @Test
public void testLockSameNameDifferentService()
{
String serviceName1 = getUniqueName() + "_1";
@@ -933,6 +938,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
service1.unlock(objName);
}
+ @Test
public void testLeaseDoesntExpire()
throws InterruptedException
{
@@ -970,6 +976,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
service.unlock(objName);
}
+ @Test
public void testLockUnlock() {
String serviceName = getUniqueName();
Object objName = new Integer(42);
@@ -978,15 +985,16 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
DistributedLockService service =
DistributedLockService.getServiceNamed(serviceName);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
service.lock(objName, -1, -1);
- Assert.assertTrue(service.isHeldByCurrentThread(objName));
+ assertTrue(service.isHeldByCurrentThread(objName));
service.unlock(objName);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
}
+ @Test
public void testLockExpireUnlock() {
long leaseMs = 200;
long waitBeforeLockingMs = 210;
@@ -1013,6 +1021,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
}
}
+ @Test
public void testLockRecursion() {
String serviceName = getUniqueName();
Object objName = new Integer(42);
@@ -1021,24 +1030,25 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
DistributedLockService service =
DistributedLockService.getServiceNamed(serviceName);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
// initial lock...
- Assert.assertTrue(service.lock(objName, -1, -1));
- Assert.assertTrue(service.isHeldByCurrentThread(objName));
+ assertTrue(service.lock(objName, -1, -1));
+ assertTrue(service.isHeldByCurrentThread(objName));
// recursion +1...
- Assert.assertTrue(service.lock(objName, -1, -1));
+ assertTrue(service.lock(objName, -1, -1));
// recursion -1...
service.unlock(objName);
- Assert.assertTrue(service.isHeldByCurrentThread(objName));
+ assertTrue(service.isHeldByCurrentThread(objName));
// and unlock...
service.unlock(objName);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
}
+ @Test
public void testLockRecursionWithExpiration() {
long leaseMs = 500;
long waitBeforeLockingMs = 750;
@@ -1050,19 +1060,19 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
DistributedLockService service =
DistributedLockService.getServiceNamed(serviceName);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
// initial lock...
- Assert.assertTrue(service.lock(objName, -1, leaseMs));
- Assert.assertTrue(service.isHeldByCurrentThread(objName));
+ assertTrue(service.lock(objName, -1, leaseMs));
+ assertTrue(service.isHeldByCurrentThread(objName));
// recursion +1...
- Assert.assertTrue(service.lock(objName, -1, leaseMs));
- Assert.assertTrue(service.isHeldByCurrentThread(objName));
+ assertTrue(service.lock(objName, -1, leaseMs));
+ assertTrue(service.isHeldByCurrentThread(objName));
// expire...
sleep(waitBeforeLockingMs);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
// should fail...
try {
@@ -1072,39 +1082,41 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
}
// relock it...
- Assert.assertTrue(service.lock(objName, -1, leaseMs));
- Assert.assertTrue(service.isHeldByCurrentThread(objName));
+ assertTrue(service.lock(objName, -1, leaseMs));
+ assertTrue(service.isHeldByCurrentThread(objName));
// and unlock to verify no recursion...
service.unlock(objName);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName)); // throws failure!!
+ assertTrue(!service.isHeldByCurrentThread(objName)); // throws failure!!
// go thru again in different order...
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
// initial lock...
- Assert.assertTrue(service.lock(objName, -1, leaseMs));
- Assert.assertTrue(service.isHeldByCurrentThread(objName));
+ assertTrue(service.lock(objName, -1, leaseMs));
+ assertTrue(service.isHeldByCurrentThread(objName));
// expire...
sleep(waitBeforeLockingMs);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
// relock it...
- Assert.assertTrue(service.lock(objName, -1, leaseMs));
- Assert.assertTrue(service.isHeldByCurrentThread(objName));
+ assertTrue(service.lock(objName, -1, leaseMs));
+ assertTrue(service.isHeldByCurrentThread(objName));
// and unlock to verify no recursion...
service.unlock(objName);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
}
+ @Test
public void testLeaseExpiresBeforeOtherLocks()
throws InterruptedException
{
leaseExpiresTest(false);
}
+ @Test
public void testLeaseExpiresWhileOtherLocks()
throws InterruptedException
{
@@ -1131,7 +1143,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
sleep(waitBeforeLockingMs);
if (waitBeforeLockingMs > leaseMs) {
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
}
LogWriterUtils.getLogWriter().fine("[testLeaseExpires] acquire lock that expired");
@@ -1141,7 +1153,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
public void run() {
resultHolder[0] = service.lock(objName, -1, -1);
service.unlock(objName);
- Assert.assertTrue(!service.isHeldByCurrentThread(objName));
+ assertTrue(!service.isHeldByCurrentThread(objName));
}
});
thread.start();
@@ -1181,6 +1193,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
}
}
+ @Test
public void testSuspendLockingAfterExpiration() throws Exception {
LogWriterUtils.getLogWriter().fine("[leaseExpiresThenSuspendTest]");
@@ -1228,6 +1241,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
volatile Throwable exception = null;
volatile Throwable throwable = null;
+ @Test
public void testLockInterruptiblyIsInterruptible() {
started = false;
gotLock = false;
@@ -1291,6 +1305,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
volatile boolean wasFlagSet = false;
+ @Test
public void testLockIsNotInterruptible() {
// Lock entire service in first thread
LogWriterUtils.getLogWriter().fine("[testLockIsNotInterruptible] lock in first thread");
@@ -1355,6 +1370,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
/**
* Test DistributedLockService.acquireExclusiveLocking(), releaseExclusiveLocking()
*/
+ @Test
public void testSuspendLockingBasic()
throws InterruptedException {
final DistributedLockService service =
@@ -1396,6 +1412,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
/**
* Test that exlusive locking prohibits locking activity
*/
+ @Test
public void testSuspendLockingProhibitsLocking()
{
final String name = getUniqueName();
@@ -1646,6 +1663,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
/**
* Test that exlusive locking prohibits locking activity
*/
+ @Test
public void testSuspendLockingBlocksUntilNoLocks()
throws InterruptedException
{
@@ -1717,6 +1735,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
}
+ @Test
public void testSuspendLockingInterruptiblyIsInterruptible() {
started = false;
@@ -1761,6 +1780,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
DistributedLockService.destroy(name);
}
+ @Test
public void testSuspendLockingIsNotInterruptible() {
started = false;
@@ -1822,6 +1842,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
*
* @author David Whitlock
*/
+ @Test
public void testLockDestroyedService() {
String serviceName = this.getUniqueName();
DistributedLockService service =
@@ -1836,6 +1857,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
}
}
+ @Test
public void testDepartedLastOwnerWithLease() {
final String serviceName = this.getUniqueName();
@@ -1868,6 +1890,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
}
+ @Test
public void testDepartedLastOwnerNoLease() {
final String serviceName = this.getUniqueName();
@@ -1907,6 +1930,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
* attempts to lock "lock" and old dlock throws StuckLockException. VM-C
* should now succeed in acquiring the lock.
*/
+ @Test
public void testBug32461() throws Exception {
LogWriterUtils.getLogWriter().fine("[testBug32461] prepping");
@@ -1956,6 +1980,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
});
}
+ @Test
public void testNoStuckLock() {
final String serviceName = this.getUniqueName();
final Object keyWithLease = "key-with-lease";
@@ -1999,6 +2024,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
* the grant reply. This causes the Client to send a release msg to the
* grantor.
*/
+ @Test
public void testReleaseOrphanedGrant_Local() {
DLockRequestProcessor.setDebugReleaseOrphanedGrant(true);
DLockRequestProcessor.setWaitToProcessDLockResponse(false);
@@ -2089,9 +2115,11 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
static volatile boolean unlockedThreadVM1_testReleaseOrphanedGrant_Remote;
static volatile boolean startedThreadVM2_testReleaseOrphanedGrant_Remote;
static volatile boolean gotLockThreadVM2_testReleaseOrphanedGrant_Remote;
+ @Test
public void testReleaseOrphanedGrant_Remote() {
doTestReleaseOrphanedGrant_Remote(false);
}
+ @Test
public void testReleaseOrphanedGrant_RemoteWithDestroy() {
doTestReleaseOrphanedGrant_Remote(true);
}
@@ -2217,6 +2245,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
}
}
+ @Test
public void testDestroyLockServiceAfterGrantResponse() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -2270,6 +2299,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
});
}
+ @Test
public void testDestroyLockServiceBeforeGrantRequest() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -2537,6 +2567,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
}
+ @Test
public void testTokenCleanup() throws Exception {
final String dlsName = getUniqueName();
@@ -2666,6 +2697,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
//static volatile boolean finishedThreadVM2_testTokenCleanup;
//static volatile DLockToken grantorDLockToken_testTokenCleanup;
+ @Test
public void testGrantTokenCleanup() throws Exception {
final String dlsName = getUniqueName();
@@ -2761,6 +2793,7 @@ public class DistributedLockServiceDUnitTest extends DistributedTestCase {
}
static final AtomicBoolean testLockQuery_whileVM1Locks = new AtomicBoolean();
+ @Test
public void testLockQuery() throws Exception {
final String dlsName = getUniqueName();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
index 3e133f6..b40f91b 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.distributed;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+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.ForcedDisconnectException;
import com.gemstone.gemfire.GemFireConfigException;
import com.gemstone.gemfire.LogWriter;
@@ -57,7 +66,8 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties
*
* @since GemFire 4.0
*/
-public class LocatorDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class LocatorDUnitTest extends JUnit4DistributedTestCase {
private static volatile InternalDistributedSystem system = null;
@@ -66,8 +76,8 @@ public class LocatorDUnitTest extends DistributedTestCase {
/**
* Creates a new <code>LocatorDUnitTest</code>
*/
- public LocatorDUnitTest(String name) {
- super(name);
+ public LocatorDUnitTest() {
+ super();
}
private static final String WAIT2_MS_NAME = "LocatorDUnitTest.WAIT2_MS";
@@ -122,6 +132,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
* it hung with the restarted locator trying to become elder again because
* it put its address at the beginning of the new view it sent out.
*/
+ @Test
public void testCollocatedLocatorWithSecurity() throws Exception {
disconnectAllFromDS();
Host host = Host.getHost(0);
@@ -251,6 +262,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
*
* @throws Exception
*/
+ @Test
public void testStartTwoLocators() throws Exception {
disconnectAllFromDS();
Host host = Host.getHost(0);
@@ -364,6 +376,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
/**
* test lead member selection
*/
+ @Test
public void testLeadMemberSelection() throws Exception {
disconnectAllFromDS();
Host host = Host.getHost(0);
@@ -473,6 +486,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
* We then kill the lead member and demonstrate that the original locator
* (which is now the sole remaining member) shuts itself down.
*/
+ @Test
public void testLeadAndCoordFailure() throws Exception {
IgnoredException.addIgnoredException("Possible loss of quorum due");
disconnectAllFromDS();
@@ -606,6 +620,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
* We then shut down the group coordinator and observe the second locator
* pick up the job and the remaining member continues to operate normally.
*/
+ @Test
public void testLeadFailureAndCoordShutdown() throws Exception {
disconnectAllFromDS();
Host host = Host.getHost(0);
@@ -752,6 +767,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
*/
// disabled on trunk - should be reenabled on cedar_dev_Oct12
// this test leaves a CloserThread around forever that logs "pausing" messages every 500 ms
+ @Test
public void testForceDisconnectAndPeerShutdownCause() throws Exception {
disconnectAllFromDS();
Host host = Host.getHost(0);
@@ -889,6 +905,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
* We kill the coordinator and shut down the lead member and observe the second locator
* pick up the job and the remaining member continue to operate normally.
*/
+ @Test
public void testLeadShutdownAndCoordFailure() throws Exception {
disconnectAllFromDS();
Host host = Host.getHost(0);
@@ -1014,6 +1031,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
* Tests that attempting to connect to a distributed system in which
* no locator is defined throws an exception.
*/
+ @Test
public void testNoLocator() {
disconnectAllFromDS();
Host host = Host.getHost(0);
@@ -1074,6 +1092,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
* <p>The locator is then restarted and is shown to take over the
* role of membership coordinator.
*/
+ @Test
public void testOneLocator() throws Exception {
disconnectAllFromDS();
Host host = Host.getHost(0);
@@ -1166,6 +1185,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
* is correct. It then restarts the locator to demonstrate that
* it can connect to and function as the group coordinator
*/
+ @Test
public void testLocatorBecomesCoordinator() throws Exception {
disconnectAllFromDS();
final String expected = "java.net.ConnectException";
@@ -1303,6 +1323,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
/**
* Tests starting multiple locators in multiple VMs.
*/
+ @Test
public void testMultipleLocators() throws Exception {
disconnectAllFromDS();
Host host = Host.getHost(0);
@@ -1420,6 +1441,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
* GEODE-870
*/
@Category(FlakyTest.class) // GEODE-1150: random ports, disk pollution, waitForCriterion, time sensitive, eats exceptions (fixed several)
+ @Test
public void testMultipleLocatorsRestartingAtSameTime() throws Exception {
disconnectAllFromDS();
Host host = Host.getHost(0);
@@ -1622,6 +1644,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
/**
* Tests starting multiple locators in multiple VMs.
*/
+ @Test
public void testMultipleMcastLocators() throws Exception {
disconnectAllFromDS();
IgnoredException.addIgnoredException("Could not stop Distribution Locator"); // shutdown timing issue in InternalLocator
@@ -1737,6 +1760,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
* Tests that a VM can connect to a locator that is hosted in its
* own VM.
*/
+ @Test
public void testConnectToOwnLocator() throws Exception {
disconnectAllFromDS();
Host host = Host.getHost(0);
@@ -1764,6 +1788,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
/**
* Tests that a single VM can NOT host multiple locators
*/
+ @Test
public void testHostingMultipleLocators() throws Exception {
disconnectAllFromDS();
Host host = Host.getHost(0);
@@ -1821,6 +1846,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
*
* @since GemFire 4.1
*/
+ @Test
public void testRestartLocator() throws Exception {
disconnectAllFromDS();
port1 =
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/distributed/RoleDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/RoleDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/RoleDUnitTest.java
index 55fc69b..ac3c23e 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/RoleDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/RoleDUnitTest.java
@@ -16,34 +16,33 @@
*/
package com.gemstone.gemfire.distributed;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Set;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.distributed.internal.DM;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.distributed.internal.membership.InternalRole;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Set;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests the setting of Roles in a DistributedSystem
- *
*/
-public class RoleDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class RoleDUnitTest extends JUnit4DistributedTestCase {
static Properties distributionProperties = new Properties();
- public RoleDUnitTest(String name) {
- super(name);
- }
-
-
-
@Override
public Properties getDistributedSystemProperties() {
return distributionProperties;
@@ -52,11 +51,11 @@ public class RoleDUnitTest extends DistributedTestCase {
/**
* Tests usage of Roles in a Loner vm.
*/
+ @Test
public void testRolesInLonerVM() {
final String rolesProp = "A,B,C,D,E,F,G";
final String[] rolesArray = new String[] {"A","B","C","D","E","F","G"};
-// final List rolesList = Arrays.asList(rolesArray);
-
+
distributionProperties = new Properties();
distributionProperties.setProperty(MCAST_PORT, "0");
distributionProperties.setProperty(LOCATORS, "");
@@ -90,6 +89,7 @@ public class RoleDUnitTest extends DistributedTestCase {
/**
* Tests usage of Roles in four distributed vms.
*/
+ @Test
public void testRolesInDistributedVMs() {
// connect all four vms...
final String[] vmRoles = new String[]
@@ -150,6 +150,7 @@ public class RoleDUnitTest extends DistributedTestCase {
/**
* Tests that specifying duplicate role names results in just one Role.
*/
+ @Test
public void testDuplicateRoleNames() {
final String rolesProp = "A,A";
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/distributed/SystemAdminDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/SystemAdminDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/SystemAdminDUnitTest.java
index 73c9c8c..782a41b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/SystemAdminDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/SystemAdminDUnitTest.java
@@ -16,28 +16,29 @@
*/
package com.gemstone.gemfire.distributed;
+import static org.junit.Assert.*;
+
import java.io.BufferedReader;
import java.io.File;
-import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
-import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.distributed.internal.DistributionManager;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.internal.SystemAdmin;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-public class SystemAdminDUnitTest extends DistributedTestCase {
-
- public SystemAdminDUnitTest(String name) {
- super(name);
- }
+@Category(DistributedTest.class)
+public class SystemAdminDUnitTest extends JUnit4DistributedTestCase {
@Override
public final void postSetUp() throws Exception {
@@ -59,6 +60,7 @@ public class SystemAdminDUnitTest extends DistributedTestCase {
}
}
+ @Test
public void testPrintStacks() throws Exception {
// create a gemfire.properties that lets SystemAdmin find the dunit locator
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/Bug40751DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/Bug40751DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/Bug40751DUnitTest.java
index 9aee361..4c22cfd 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/Bug40751DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/Bug40751DUnitTest.java
@@ -16,30 +16,41 @@
*/
package com.gemstone.gemfire.distributed.internal;
-import com.gemstone.gemfire.DataSerializable;
-import com.gemstone.gemfire.ToDataException;
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache30.CacheTestCase;
-import com.gemstone.gemfire.test.dunit.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.Properties;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.DataSerializable;
+import com.gemstone.gemfire.ToDataException;
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.Scope;
+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.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-public class Bug40751DUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class Bug40751DUnitTest extends JUnit4CacheTestCase {
- public Bug40751DUnitTest(String name) {
- super(name);
- }
-
@Override
public final void postTearDownCacheTestCase() throws Exception {
disconnectAllFromDS();
}
+ @Test
public void testRR() {
System.setProperty("p2p.nodirectBuffers", "true");
try {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ConsoleDistributionManagerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ConsoleDistributionManagerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ConsoleDistributionManagerDUnitTest.java
index 10ebdaf..3c48fb9 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ConsoleDistributionManagerDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ConsoleDistributionManagerDUnitTest.java
@@ -17,40 +17,57 @@
package com.gemstone.gemfire.distributed.internal;
import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Set;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.SystemFailure;
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache30.CacheTestCase;
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.distributed.DistributedLockService;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.internal.Config;
-import com.gemstone.gemfire.internal.admin.*;
+import com.gemstone.gemfire.internal.admin.Alert;
+import com.gemstone.gemfire.internal.admin.AlertListener;
+import com.gemstone.gemfire.internal.admin.ApplicationVM;
+import com.gemstone.gemfire.internal.admin.DLockInfo;
+import com.gemstone.gemfire.internal.admin.EntryValueNode;
+import com.gemstone.gemfire.internal.admin.GemFireVM;
+import com.gemstone.gemfire.internal.admin.GfManagerAgent;
+import com.gemstone.gemfire.internal.admin.GfManagerAgentConfig;
+import com.gemstone.gemfire.internal.admin.GfManagerAgentFactory;
+import com.gemstone.gemfire.internal.admin.StatResource;
import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Set;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+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;
/**
* This class tests the functionality of the {@linkplain com.gemstone.gemfire.internal.admin internal
* admin} API.
*/
-public class ConsoleDistributionManagerDUnitTest
- extends CacheTestCase implements AlertListener {
+@Category(DistributedTest.class)
+public class ConsoleDistributionManagerDUnitTest extends JUnit4CacheTestCase implements AlertListener {
protected GfManagerAgent agent = null;
private static boolean firstTime = true;
- public ConsoleDistributionManagerDUnitTest(String name) {
- super(name);
- }
-
-// private volatile Alert lastAlert = null;
-
public void alert(Alert alert) {
LogWriterUtils.getLogWriter().info("DEBUG: alert=" + alert);
-// this.lastAlert = alert;
}
@Override
@@ -140,12 +157,14 @@ public class ConsoleDistributionManagerDUnitTest
}
}
+ @Test
public void testGetDistributionVMType() {
DM dm = this.agent.getDM();
InternalDistributedMember ipaddr = dm.getId();
assertEquals(DistributionManager.ADMIN_ONLY_DM_TYPE, ipaddr.getVmKind());
}
+ @Test
public void testAgent() {
assertEquals("expected empty peer array", 0, agent.listPeers().length);
int systemCount = 0;
@@ -159,6 +178,7 @@ public class ConsoleDistributionManagerDUnitTest
assertTrue("agent should have been disconnected", !agent.isConnected());
}
+ @Test
public void testApplications() throws Exception {
{
WaitCriterion ev = new WaitCriterion() {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisorDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisorDUnitTest.java
index 375c2c6..8a9806b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisorDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisorDUnitTest.java
@@ -16,31 +16,31 @@
*/
package com.gemstone.gemfire.distributed.internal;
+import static org.junit.Assert.*;
+
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.CancelCriterion;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class DistributionAdvisorDUnitTest extends JUnit4DistributedTestCase {
-/**
- *
- *
- */
-public class DistributionAdvisorDUnitTest extends DistributedTestCase {
private transient DistributionAdvisor.Profile profiles[];
protected transient DistributionAdvisor advisor;
- public DistributionAdvisorDUnitTest(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
// connect to distributed system in every VM
@@ -88,6 +88,7 @@ public class DistributionAdvisorDUnitTest extends DistributedTestCase {
}
+ @Test
public void testGenericAdvice() {
Set expected = new HashSet();
for (int i = 0; i < profiles.length; i++) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java
index 39a50b3..86e0fdc 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java
@@ -16,9 +16,34 @@
*/
package com.gemstone.gemfire.distributed.internal;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Properties;
+
+import org.apache.logging.log4j.Logger;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.LogWriter;
-import com.gemstone.gemfire.admin.*;
-import com.gemstone.gemfire.cache.*;
+import com.gemstone.gemfire.admin.AdminDistributedSystem;
+import com.gemstone.gemfire.admin.AdminDistributedSystemFactory;
+import com.gemstone.gemfire.admin.Alert;
+import com.gemstone.gemfire.admin.AlertLevel;
+import com.gemstone.gemfire.admin.AlertListener;
+import com.gemstone.gemfire.admin.DistributedSystemConfig;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheListener;
+import com.gemstone.gemfire.cache.DataPolicy;
+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.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
@@ -28,22 +53,26 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.MembershipManage
import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Manager;
import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershipManager;
import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.test.dunit.*;
-import org.apache.logging.log4j.Logger;
-import org.junit.Assert;
-
-import java.net.InetAddress;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+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;
/**
* This class tests the functionality of the {@link
* DistributionManager} class.
*/
-public class DistributionManagerDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class DistributionManagerDUnitTest extends JUnit4DistributedTestCase {
private static final Logger logger = LogService.getLogger();
-
+
+ public static DistributedSystem ds;
+
/**
* Clears the exceptionInThread flag in the given distribution
* manager.
@@ -52,18 +81,12 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
dm.clearExceptionInThreads();
}
- public DistributionManagerDUnitTest(String name) {
- super(name);
- }
-
@Override
public void preSetUp() throws Exception {
disconnectAllFromDS();
}
- //////// Test Methods
-
- protected static class ItsOkayForMyClassNotToBeFound
+ protected static class ItsOkayForMyClassNotToBeFound
extends SerialDistributionMessage {
public int getDSFID() {
@@ -76,8 +99,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
}
};
- public static DistributedSystem ds;
-
+ @Test
public void testGetDistributionVMType() {
DM dm = getSystem().getDistributionManager();
InternalDistributedMember ipaddr = dm.getId();
@@ -87,6 +109,8 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
/**
* Send the distribution manager a message it can't deserialize
*/
+ @Ignore("TODO: use Awaitility and reenable assertions")
+ @Test
public void testExceptionInThreads() throws InterruptedException {
DM dm = getSystem().getDistributionManager();
String p1 = "ItsOkayForMyClassNotToBeFound";
@@ -100,7 +124,9 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
// assertTrue(!dm.exceptionInThreads());
}
- public void _testGetDistributionManagerIds() {
+ @Ignore("TODO: this passes when enabled")
+ @Test
+ public void testGetDistributionManagerIds() {
int systemCount = 0;
for (int h = 0; h < Host.getHostCount(); h++) {
Host host = Host.getHost(h);
@@ -112,14 +138,12 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
assertEquals(systemCount, dm.getNormalDistributionManagerIds().size());
}
-
-
-
/**
* Demonstrate that a new UDP port is used when an attempt is made to
* reconnect using a shunned port
*/
+ @Test
public void testConnectAfterBeingShunned() {
InternalDistributedSystem sys = getSystem();
MembershipManager mgr = MembershipManagerHelper.getMembershipManager(sys);
@@ -149,6 +173,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
* until the member should be gone and force more view processing to have
* it scrubbed from the set.
**/
+ @Test
public void testSurpriseMemberHandling() {
VM vm0 = Host.getHost(0).getVM(0);
@@ -206,7 +231,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
Thread.sleep(gracePeriod);
}
catch (InterruptedException e) {
- fail("test was interrupted");
+ fail("test was interrupted", e);
}
vm0.invoke(connectDisconnect);
@@ -214,8 +239,8 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
!mgr.isSurpriseMember(mbr));
}
- catch (java.net.UnknownHostException e) {
- fail("unable to resolve localhost - test needs some attention");
+ catch (UnknownHostException e) {
+ fail("unable to resolve localhost - test needs some attention", e);
}
finally {
if (sys != null && sys.isConnected()) {
@@ -237,6 +262,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
* region that sleeps when notified, forcing the operation to take longer
* than ack-wait-threshold + ack-severe-alert-threshold
*/
+ @Test
public void testAckSevereAlertThreshold() throws Exception {
disconnectAllFromDS();
Host host = Host.getHost(0);
@@ -332,7 +358,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
Thread.sleep(15000);
}
catch (InterruptedException ie) {
- fail("interrupted");
+ fail("interrupted", ie);
}
}
@Override
@@ -378,6 +404,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
/**
* Tests that a sick member is kicked out
*/
+ @Test
public void testKickOutSickMember() throws Exception {
disconnectAllFromDS();
IgnoredException.addIgnoredException("10 seconds have elapsed while waiting");
@@ -490,8 +517,8 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
/**
* test use of a bad bind-address for bug #32565
- * @throws Exception
*/
+ @Test
public void testBadBindAddress() throws Exception {
disconnectAllFromDS();
@@ -521,6 +548,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
/**
* install a new view and show that waitForViewInstallation works as expected
*/
+ @Test
public void testWaitForViewInstallation() {
getSystem(new Properties());
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LDM.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LDM.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LDM.java
index bcc4041..ba16278 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LDM.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/LDM.java
@@ -16,14 +16,14 @@
*/
package com.gemstone.gemfire.distributed.internal;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.internal.logging.LogService;
-import org.apache.logging.log4j.Logger;
-import util.TestException;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
import java.util.Properties;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.internal.logging.LogService;
/**
* A little class for testing the local DistributionManager
@@ -50,7 +50,7 @@ public class LDM {
Thread.sleep(5 * 1000);
} catch (InterruptedException ex) {
- throw new TestException("interrupted");
+ throw new AssertionError("interrupted");
}
system.disconnect();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogDUnitTest.java
index c0aa6c5..cc99bad 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogDUnitTest.java
@@ -16,6 +16,18 @@
*/
package com.gemstone.gemfire.distributed.internal;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionShortcut;
@@ -23,26 +35,19 @@ import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
import com.gemstone.gemfire.cache.server.CacheServer;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.Locator;
import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.Properties;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
-
-public class ProductUseLogDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class ProductUseLogDUnitTest extends JUnit4CacheTestCase {
- public ProductUseLogDUnitTest(String name) {
- super(name);
- }
-
@Override
public void preSetUp() {
disconnectAllFromDS();
@@ -55,6 +60,7 @@ public class ProductUseLogDUnitTest extends CacheTestCase {
return p;
}
+ @Test
public void testMembershipMonitoring() throws Exception {
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/distributed/internal/deadlock/GemFireDeadlockDetectorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/GemFireDeadlockDetectorDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/GemFireDeadlockDetectorDUnitTest.java
index 8977172..7767432 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/GemFireDeadlockDetectorDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/GemFireDeadlockDetectorDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.distributed.internal.deadlock;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+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.Collections;
import java.util.HashSet;
import java.util.LinkedList;
@@ -46,7 +55,8 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-public class GemFireDeadlockDetectorDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class GemFireDeadlockDetectorDUnitTest extends JUnit4CacheTestCase {
private static final Set<Thread> stuckThreads = Collections.synchronizedSet(new HashSet<Thread>());
@@ -73,10 +83,11 @@ public class GemFireDeadlockDetectorDUnitTest extends CacheTestCase {
});
}
- public GemFireDeadlockDetectorDUnitTest(String name) {
- super(name);
+ public GemFireDeadlockDetectorDUnitTest() {
+ super();
}
+ @Test
public void testNoDeadlock() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -96,6 +107,7 @@ public class GemFireDeadlockDetectorDUnitTest extends CacheTestCase {
private static final Lock lock = new ReentrantLock();
@Category(FlakyTest.class) // GEODE-516 & GEODE-576: async actions, thread sleeps, time sensitive
+ @Test
public void testDistributedDeadlockWithFunction() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -142,6 +154,7 @@ public class GemFireDeadlockDetectorDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testDistributedDeadlockWithDLock() 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/distributed/internal/membership/gms/messenger/JGroupsMessengerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessengerJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessengerJUnitTest.java
index fb3c5a7..3a6060e 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessengerJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/messenger/JGroupsMessengerJUnitTest.java
@@ -16,10 +16,45 @@
*/
package com.gemstone.gemfire.distributed.internal.membership.gms.messenger;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.*;
+
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.commons.lang.SerializationException;
+import org.jgroups.Address;
+import org.jgroups.Event;
+import org.jgroups.JChannel;
+import org.jgroups.Message;
+import org.jgroups.conf.ClassConfigurator;
+import org.jgroups.protocols.UNICAST3;
+import org.jgroups.protocols.pbcast.NAKACK2;
+import org.jgroups.util.Digest;
+import org.jgroups.util.UUID;
+import org.junit.After;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.ForcedDisconnectException;
import com.gemstone.gemfire.GemFireIOException;
import com.gemstone.gemfire.distributed.DistributedSystemDisconnectedException;
-import com.gemstone.gemfire.distributed.internal.*;
+import com.gemstone.gemfire.distributed.internal.DM;
+import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl;
+import com.gemstone.gemfire.distributed.internal.DistributionManager;
+import com.gemstone.gemfire.distributed.internal.DistributionMessage;
+import com.gemstone.gemfire.distributed.internal.DistributionStats;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.distributed.internal.SerialAckedMessage;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.distributed.internal.membership.NetView;
import com.gemstone.gemfire.distributed.internal.membership.gms.GMSMember;
@@ -34,39 +69,19 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.messages.JoinReq
import com.gemstone.gemfire.distributed.internal.membership.gms.messages.JoinResponseMessage;
import com.gemstone.gemfire.distributed.internal.membership.gms.messages.LeaveRequestMessage;
import com.gemstone.gemfire.distributed.internal.membership.gms.messenger.JGroupsMessenger.JGroupsReceiver;
-import com.gemstone.gemfire.internal.*;
+import com.gemstone.gemfire.internal.AvailablePort;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.DataSerializableFixedID;
+import com.gemstone.gemfire.internal.HeapDataOutputStream;
+import com.gemstone.gemfire.internal.Version;
import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig;
import com.gemstone.gemfire.internal.cache.DistributedCacheOperation;
import com.gemstone.gemfire.internal.logging.log4j.AlertAppender;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import org.apache.commons.lang.SerializationException;
-import org.jgroups.Address;
-import org.jgroups.Event;
-import org.jgroups.JChannel;
-import org.jgroups.Message;
-import org.jgroups.conf.ClassConfigurator;
-import org.jgroups.protocols.UNICAST3;
-import org.jgroups.protocols.pbcast.NAKACK2;
-import org.jgroups.util.Digest;
-import org.jgroups.util.UUID;
-import org.junit.After;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.*;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.isA;
-import static org.mockito.Mockito.*;
@Category(IntegrationTest.class)
public class JGroupsMessengerJUnitTest {
+
private Services services;
private JGroupsMessenger messenger;
private JoinLeave joinLeave;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/streaming/StreamingOperationManyDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/streaming/StreamingOperationManyDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/streaming/StreamingOperationManyDUnitTest.java
index a5bba7c..f220e96 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/streaming/StreamingOperationManyDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/streaming/StreamingOperationManyDUnitTest.java
@@ -20,7 +20,7 @@
//
package com.gemstone.gemfire.distributed.internal.streaming;
-import static com.gemstone.gemfire.test.dunit.Wait.pause;
+import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.HashSet;
@@ -30,28 +30,26 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.TimeUnit;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.LogWriter;
-import com.gemstone.gemfire.distributed.internal.DM;
import com.gemstone.gemfire.distributed.internal.DistributionMessage;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.distributed.internal.ReplyException;
import com.gemstone.gemfire.distributed.internal.ReplyProcessor21;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.internal.cache.Token;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
-import com.jayway.awaitility.Awaitility;
-
-public class StreamingOperationManyDUnitTest extends DistributedTestCase {
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
- public StreamingOperationManyDUnitTest(String name) {
- super(name);
- }
+@Category(DistributedTest.class)
+public class StreamingOperationManyDUnitTest extends JUnit4DistributedTestCase {
+ @Test
public void testStreamingManyProvidersNoExceptions() throws Exception {
// final String name = this.getUniqueName();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/streaming/StreamingOperationOneDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/streaming/StreamingOperationOneDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/streaming/StreamingOperationOneDUnitTest.java
index a09c167..c46c7c5 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/streaming/StreamingOperationOneDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/streaming/StreamingOperationOneDUnitTest.java
@@ -20,6 +20,8 @@
//
package com.gemstone.gemfire.distributed.internal.streaming;
+import static org.junit.Assert.*;
+
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
@@ -30,6 +32,9 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.LogWriter;
import com.gemstone.gemfire.distributed.internal.DistributionMessage;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
@@ -37,16 +42,15 @@ import com.gemstone.gemfire.distributed.internal.ReplyException;
import com.gemstone.gemfire.distributed.internal.ReplyProcessor21;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.internal.cache.Token;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-public class StreamingOperationOneDUnitTest extends DistributedTestCase {
-
- public StreamingOperationOneDUnitTest(String name) {
- super(name);
- }
+@Category(DistributedTest.class)
+public class StreamingOperationOneDUnitTest extends JUnit4DistributedTestCase {
+ @Test
public void testStreamingOneProviderNoExceptions() throws Exception {
// final String name = this.getUniqueName();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java
index 976a2fa..4bf7ecb 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java
@@ -16,6 +16,16 @@
*/
package com.gemstone.gemfire.distributed.internal.tcpserver;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.CacheException;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
import com.gemstone.gemfire.distributed.Locator;
@@ -26,34 +36,18 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.locator.FindCoor
import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.SocketCreator;
import com.gemstone.gemfire.internal.Version;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.experimental.categories.Category;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
/**
* This tests the rolling upgrade for locators with
* different GOSSIPVERSION.
- *
- *
*/
@Category(DistributedTest.class)
-public class TcpServerBackwardCompatDUnitTest extends DistributedTestCase {
-
- /**
- * @param name
- */
- public TcpServerBackwardCompatDUnitTest(String name) {
- super(name);
- }
+public class TcpServerBackwardCompatDUnitTest extends JUnit4DistributedTestCase {
@Override
public final void postSetUp() throws Exception {
@@ -84,6 +78,7 @@ public class TcpServerBackwardCompatDUnitTest extends DistributedTestCase {
* GOSSIPVERSION and verifies that it has recoverd the system
* View. Then we upgrade next locator.
*/
+ @Test
public void testGossipVersionBackwardCompatibility() {
Host host = Host.getHost(0);
final VM locator0 = host.getVM(0);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerJUnitTest.java
index 9b1b8d3..425b391 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerJUnitTest.java
@@ -16,20 +16,19 @@
*/
package com.gemstone.gemfire.distributed.internal.tcpserver;
+import static org.junit.Assert.*;
+
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.net.ConnectException;
import java.net.InetAddress;
-import java.net.UnknownHostException;
import java.util.Properties;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
-import junit.framework.Assert;
-
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -44,12 +43,12 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
@Category(IntegrationTest.class)
public class TcpServerJUnitTest {
- protected/*GemStoneAddition*/ InetAddress localhost;
- protected/*GemStoneAddition*/ int port;
+ private/*GemStoneAddition*/ InetAddress localhost;
+ private/*GemStoneAddition*/ int port;
private SimpleStats stats;
private TcpServer server;
- public void start(TcpHandler handler) throws IOException {
+ private void start(TcpHandler handler) throws IOException {
localhost = InetAddress.getLocalHost();
port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
@@ -59,18 +58,18 @@ public class TcpServerJUnitTest {
}
@Test
- public void test() throws UnknownHostException, IOException, ClassNotFoundException, InterruptedException {
+ public void test() throws Exception {
EchoHandler handler = new EchoHandler();
start(handler);
TestObject test = new TestObject();
test.id = 5;
TestObject result = (TestObject) TcpClient.requestToServer(localhost, port, test, 60 * 1000 );
- Assert.assertEquals(test.id, result.id);
+ assertEquals(test.id, result.id);
String[] info = TcpClient.getInfo(localhost, port);
- Assert.assertNotNull(info);
- Assert.assertTrue(info.length > 1);
+ assertNotNull(info);
+ assertTrue(info.length > 1);
try {
TcpClient.stop(localhost, port);
@@ -78,16 +77,16 @@ public class TcpServerJUnitTest {
// must not be running
}
server.join(60 * 1000);
- Assert.assertFalse(server.isAlive());
- Assert.assertTrue(handler.shutdown);
+ assertFalse(server.isAlive());
+ assertTrue(handler.shutdown);
- Assert.assertEquals(4, stats.started.get());
- Assert.assertEquals(4, stats.ended.get());
+ assertEquals(4, stats.started.get());
+ assertEquals(4, stats.ended.get());
}
@Test
- public void testConcurrency() throws UnknownHostException, IOException, ClassNotFoundException, InterruptedException {
+ public void testConcurrency() throws Exception {
CountDownLatch latch = new CountDownLatch(1);
DelayHandler handler = new DelayHandler(latch);
start(handler);
@@ -109,17 +108,17 @@ public class TcpServerJUnitTest {
delayedThread.start();
try {
Thread.sleep(500);
- Assert.assertFalse(done.get());
+ assertFalse(done.get());
TcpClient.requestToServer(localhost, port, Boolean.valueOf(false), 60 * 1000 );
- Assert.assertFalse(done.get());
+ assertFalse(done.get());
latch.countDown();
Thread.sleep(500);
- Assert.assertTrue(done.get());
+ assertTrue(done.get());
} finally {
latch.countDown();
delayedThread.join(60 * 1000);
- Assert.assertTrue(!delayedThread.isAlive()); // GemStoneAddition
+ assertTrue(!delayedThread.isAlive()); // GemStoneAddition
try {
TcpClient.stop(localhost, port);
} catch ( ConnectException ignore ) {
@@ -128,8 +127,8 @@ public class TcpServerJUnitTest {
server.join(60 * 1000);
}
}
-
- public static class TestObject implements DataSerializable {
+
+ private static class TestObject implements DataSerializable {
int id;
public TestObject() {
@@ -146,7 +145,7 @@ public class TcpServerJUnitTest {
}
- protected/*GemStoneAddition*/ static class EchoHandler implements TcpHandler {
+ private/*GemStoneAddition*/ static class EchoHandler implements TcpHandler {
protected/*GemStoneAddition*/ boolean shutdown;
@@ -202,8 +201,8 @@ public class TcpServerJUnitTest {
public void endRequest(Object request,long startTime) { }
public void endResponse(Object request,long startTime) { }
}
-
- protected/*GemStoneAddition*/ static class SimpleStats implements PoolStatHelper {
+
+ private/*GemStoneAddition*/ static class SimpleStats implements PoolStatHelper {
AtomicInteger started = new AtomicInteger();
AtomicInteger ended = new AtomicInteger();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/disttx/CacheMapDistTXDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/CacheMapDistTXDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/CacheMapDistTXDUnitTest.java
index df05a3d..e776e2a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/CacheMapDistTXDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/CacheMapDistTXDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.disttx;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+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.cache30.CacheMapTxnDUnitTest;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.VM;
@@ -27,10 +36,11 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties
* Same tests as that of {@link CacheMapTxnDUnitTest} after setting
* "distributed-transactions" property to true
*/
+@Category(DistributedTest.class)
public class CacheMapDistTXDUnitTest extends CacheMapTxnDUnitTest {
- public CacheMapDistTXDUnitTest(String name) {
- super(name);
+ public CacheMapDistTXDUnitTest() {
+ super();
}
@Override
@@ -68,6 +78,7 @@ public class CacheMapDistTXDUnitTest extends CacheMapTxnDUnitTest {
}
@Override
+ @Test
public void testCommitTxn() {
// [DISTTX] TODO test overridden intentionally and left blank as it fails
// fix this
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXManagerImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXManagerImplJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXManagerImplJUnitTest.java
index a78216a..9dc6a96 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXManagerImplJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXManagerImplJUnitTest.java
@@ -16,6 +16,13 @@
*/
package com.gemstone.gemfire.disttx;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static junit.framework.TestCase.*;
+
+import java.util.Properties;
+
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.cache.CacheTransactionManager;
import com.gemstone.gemfire.cache.RegionShortcut;
@@ -24,25 +31,14 @@ import com.gemstone.gemfire.internal.cache.TXManagerImpl;
import com.gemstone.gemfire.internal.cache.TXManagerImplJUnitTest;
import com.gemstone.gemfire.test.junit.categories.DistributedTransactionsTest;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import org.junit.experimental.categories.Category;
-
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-import static junit.framework.TestCase.assertTrue;
/**
* Same tests as that of {@link TXManagerImplJUnitTest} after setting
* "distributed-transactions" property to true
- *
*/
@Category({IntegrationTest.class, DistributedTransactionsTest.class })
public class DistTXManagerImplJUnitTest extends TXManagerImplJUnitTest {
- public DistTXManagerImplJUnitTest() {
- }
-
@Override
protected void createCache() {
Properties props = new Properties();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXOrderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXOrderDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXOrderDUnitTest.java
index 76f7736..9d4623b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXOrderDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXOrderDUnitTest.java
@@ -16,37 +16,43 @@
*/
package com.gemstone.gemfire.disttx;
-import com.gemstone.gemfire.cache.CacheException;
-import com.gemstone.gemfire.cache30.TXOrderDUnitTest;
-
import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+
import java.util.Properties;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache30.TXOrderDUnitTest;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Same tests as that of {@link TXOrderDUnitTest} after setting
* "distributed-transactions" property to true
*/
+@Category(DistributedTest.class)
public class DistTXOrderDUnitTest extends TXOrderDUnitTest {
- public DistTXOrderDUnitTest(String name) {
- super(name);
- }
-
@Override
public Properties getDistributedSystemProperties() {
Properties props = super.getDistributedSystemProperties();
props.setProperty(DISTRIBUTED_TRANSACTIONS, "true");
return props;
}
-
+
+ @Ignore("TODO: test is disabled for Dist TX")
@Override
+ @Test
public void testFarSideOrder() throws CacheException {
// [DISTTX] TODO test overridden intentionally and left blank as it fails
// fix this
}
-
+
+ @Ignore("TODO: test is disabled for Dist TX")
@Override
+ @Test
public void testInternalRegionNotExposed() {
// [DISTTX] TODO test overridden intentionally and left blank as it fails
// fix this
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXRestrictionsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXRestrictionsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXRestrictionsDUnitTest.java
index c0fbd8d..b8165d5 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXRestrictionsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXRestrictionsDUnitTest.java
@@ -16,20 +16,22 @@
*/
package com.gemstone.gemfire.disttx;
-import com.gemstone.gemfire.cache30.TXRestrictionsDUnitTest;
import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+
import java.util.Properties;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache30.TXRestrictionsDUnitTest;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
/**
* Same tests as that of {@link TXRestrictionsDUnitTest} after setting
* "distributed-transactions" property to true
*/
+@Category(DistributedTest.class)
public class DistTXRestrictionsDUnitTest extends TXRestrictionsDUnitTest {
- public DistTXRestrictionsDUnitTest(String name) {
- super(name);
- }
-
@Override
public Properties getDistributedSystemProperties() {
Properties props = super.getDistributedSystemProperties();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWithDeltaDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWithDeltaDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWithDeltaDUnitTest.java
index 8aa5c51..32f6dae 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWithDeltaDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/disttx/DistTXWithDeltaDUnitTest.java
@@ -16,14 +16,20 @@
*/
package com.gemstone.gemfire.disttx;
-import com.gemstone.gemfire.internal.cache.TransactionsWithDeltaDUnitTest;
-import java.util.Properties;
import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import java.util.Properties;
+
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.internal.cache.TransactionsWithDeltaDUnitTest;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
public class DistTXWithDeltaDUnitTest extends TransactionsWithDeltaDUnitTest {
- public DistTXWithDeltaDUnitTest(String name) {
- super(name);
+ public DistTXWithDeltaDUnitTest() {
+ super();
}
@Override