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/03/07 20:07:38 UTC
[2/2] incubator-geode git commit: Avoid overriding public static in
super class
Avoid overriding public static in super class
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/7baa2a7c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/7baa2a7c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/7baa2a7c
Branch: refs/heads/feature/GEODE-1050
Commit: 7baa2a7cbcf0748f9ed5acd0a9ff67a1c2e29d35
Parents: 30796b0
Author: Kirk Lund <kl...@apache.org>
Authored: Mon Mar 7 11:07:18 2016 -0800
Committer: Kirk Lund <kl...@apache.org>
Committed: Mon Mar 7 11:07:18 2016 -0800
----------------------------------------------------------------------
.../gemstone/gemfire/cache30/CacheTestCase.java | 34 +-
.../distributed/DistributedMemberDUnitTest.java | 6 +-
.../distributed/DistributedSystemDUnitTest.java | 5 +-
.../internal/cache/Bug39079DUnitTest.java | 6 +-
.../PartitionedRegionSingleHopDUnitTest.java | 16 +-
...RegionSingleHopWithServerGroupDUnitTest.java | 12 +-
.../internal/cache/SingleHopStatsDUnitTest.java | 12 +-
.../cache/execute/PRClientServerTestBase.java | 12 +-
.../cache/ha/Bug36853EventsExpiryDUnitTest.java | 8 +-
.../cache/ha/HAConflationDUnitTest.java | 6 +-
.../tier/sockets/ClientServerMiscDUnitTest.java | 6 +-
.../test/dunit/internal/DistributedTest.java | 61 --
.../dunit/internal/DistributedTestFixture.java | 70 +++
.../internal/JUnit3DistributedTestCase.java | 252 ++++++++
.../internal/JUnit4DistributedTestCase.java | 583 +++++++++++++++++++
.../internal/junit3/DistributedTestCase.java | 288 ---------
.../internal/junit4/DistributedTestCase.java | 548 -----------------
.../wan/wancommand/WANCommandTestBase.java | 20 +-
18 files changed, 976 insertions(+), 969 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7baa2a7c/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheTestCase.java
index c228e5c..5187dc8 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheTestCase.java
@@ -91,15 +91,15 @@ public abstract class CacheTestCase extends DistributedTestCase {
/**
* Creates the <code>Cache</code> for this test
*/
- private void createCache() {
+ private final void createCache() {
createCache(false);
}
- private void createCache(boolean client) {
+ private final void createCache(boolean client) {
createCache(client, null);
}
- private void createCache(boolean client, CacheFactory cf) {
+ private final void createCache(boolean client, CacheFactory cf) {
synchronized(CacheTestCase.class) {
try {
System.setProperty("gemfire.DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE", "true");
@@ -136,7 +136,7 @@ public abstract class CacheTestCase extends DistributedTestCase {
* Creates the <code>Cache</code> for this test that is not connected
* to other members
*/
- public Cache createLonerCache() {
+ public final Cache createLonerCache() {
synchronized(CacheTestCase.class) {
try {
System.setProperty("gemfire.DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE", "true");
@@ -162,7 +162,7 @@ public abstract class CacheTestCase extends DistributedTestCase {
* to other members.
* Added specifically to test scenario of defect #47181.
*/
- public Cache createLonerCacheWithEnforceUniqueHost() {
+ public final Cache createLonerCacheWithEnforceUniqueHost() {
synchronized(CacheTestCase.class) {
try {
System.setProperty("gemfire.DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE", "true");
@@ -187,7 +187,7 @@ public abstract class CacheTestCase extends DistributedTestCase {
* Sets this test up with a CacheCreation as its cache.
* Any existing cache is closed. Whoever calls this must also call finishCacheXml
*/
- public static synchronized void beginCacheXml() {
+ public static final synchronized void beginCacheXml() {
// getLogWriter().info("before closeCache");
closeCache();
// getLogWriter().info("before TestCacheCreation");
@@ -198,7 +198,7 @@ public abstract class CacheTestCase extends DistributedTestCase {
* Finish what beginCacheXml started. It does this be generating a cache.xml
* file and then creating a real cache using that cache.xml.
*/
- public void finishCacheXml(String name) {
+ public final void finishCacheXml(String name) {
synchronized(CacheTestCase.class) {
File file = new File(name + "-cache.xml");
try {
@@ -222,7 +222,7 @@ public abstract class CacheTestCase extends DistributedTestCase {
* Finish what beginCacheXml started. It does this be generating a cache.xml
* file and then creating a real cache using that cache.xml.
*/
- public void finishCacheXml(String name, boolean useSchema, String xmlVersion) {
+ public final void finishCacheXml(String name, boolean useSchema, String xmlVersion) {
synchronized(CacheTestCase.class) {
File dir = new File("XML_" + xmlVersion);
dir.mkdirs();
@@ -337,13 +337,13 @@ public abstract class CacheTestCase extends DistributedTestCase {
return cache;
}
- public static synchronized void disconnectFromDS() {
+ public static synchronized final void disconnectFromDS() {
closeCache();
DistributedTestCase.disconnectFromDS();
}
/** Close the cache */
- public static synchronized void closeCache() {
+ public static synchronized final void closeCache() {
//Workaround for that fact that some classes are now extending
//CacheTestCase but not using it properly.
if(cache == null) {
@@ -381,7 +381,7 @@ public abstract class CacheTestCase extends DistributedTestCase {
}
/** Closed the cache in all VMs. */
- protected void closeAllCache() {
+ protected final void closeAllCache() {
closeCache();
Invoke.invokeInEveryVM(CacheTestCase.class, "closeCache");
}
@@ -413,7 +413,7 @@ public abstract class CacheTestCase extends DistributedTestCase {
/**
* Local destroy all root regions and close the cache.
*/
- protected synchronized static void remoteTearDown() {
+ protected final synchronized static void remoteTearDown() {
try {
DistributionMessageObserver.setInstance(null);
destroyRegions(cache);
@@ -447,7 +447,7 @@ public abstract class CacheTestCase extends DistributedTestCase {
* @return internal arguements, which may be null. If null, then default
* InternalRegionArguments are used to construct the Region
*/
- public InternalRegionArguments getInternalRegionArguments()
+ public final InternalRegionArguments getInternalRegionArguments()
{
return null;
}
@@ -526,7 +526,7 @@ public abstract class CacheTestCase extends DistributedTestCase {
* send an unordered message requiring an ack to all connected members
* in order to flush the unordered communication channel
*/
- public void sendUnorderedMessageToAll() {
+ public final void sendUnorderedMessageToAll() {
//if (getCache() instanceof distcache.gemfire.GemFireCacheImpl) {
try {
com.gemstone.gemfire.distributed.internal.HighPriorityAckedMessage msg = new com.gemstone.gemfire.distributed.internal.HighPriorityAckedMessage();
@@ -620,7 +620,7 @@ public abstract class CacheTestCase extends DistributedTestCase {
}
}
- public static File getDiskDir() {
+ public static final File getDiskDir() {
int vmNum = VM.getCurrentVMNum();
File dir = new File("diskDir", "disk" + String.valueOf(vmNum)).getAbsoluteFile();
dir.mkdirs();
@@ -633,11 +633,11 @@ public abstract class CacheTestCase extends DistributedTestCase {
* will be automatically cleaned up
* on test case closure.
*/
- public static File[] getDiskDirs() {
+ public static final File[] getDiskDirs() {
return new File[] {getDiskDir()};
}
- public static void cleanDiskDirs() throws IOException {
+ public static final void cleanDiskDirs() throws IOException {
FileUtil.delete(getDiskDir());
File[] defaultStoreFiles = new File(".").listFiles(new FilenameFilter() {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7baa2a7c/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedMemberDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedMemberDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedMemberDUnitTest.java
index c184440..391ec8c 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedMemberDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedMemberDUnitTest.java
@@ -33,7 +33,7 @@ import com.gemstone.gemfire.distributed.internal.DM;
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.test.dunit.internal.junit4.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
@@ -51,9 +51,9 @@ import org.junit.experimental.categories.Category;
* @since 5.0
*/
@Category(DistributedTest.class)
-public class DistributedMemberDUnitTest extends DistributedTestCase {
+public class DistributedMemberDUnitTest extends JUnit4DistributedTestCase {
- protected void sleep(long millis) {
+ protected void sleep(long millis) { // TODO: replace with Awaitility
try {
Thread.sleep(millis);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7baa2a7c/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java
index 488238c..b341ae6 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java
@@ -28,7 +28,6 @@ import java.util.concurrent.TimeoutException;
import com.gemstone.gemfire.CancelException;
import com.gemstone.gemfire.GemFireConfigException;
-import com.gemstone.gemfire.SystemConnectException;
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheFactory;
@@ -46,7 +45,7 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershi
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.SocketCreator;
-import com.gemstone.gemfire.test.dunit.internal.junit4.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
@@ -63,7 +62,7 @@ import org.junit.experimental.categories.Category;
* @author David Whitlock
*/
@Category(DistributedTest.class)
-public class DistributedSystemDUnitTest extends DistributedTestCase {
+public class DistributedSystemDUnitTest extends JUnit4DistributedTestCase {
// public DistributedSystemDUnitTest(String name) {
// super(name);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7baa2a7c/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug39079DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug39079DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug39079DUnitTest.java
index 81e603c..31ac3d9 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug39079DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/Bug39079DUnitTest.java
@@ -311,9 +311,9 @@ public class Bug39079DUnitTest extends CacheTestCase {
vm0.invoke(() -> Bug39079DUnitTest.validateRuningBridgeServerList());
// close server cache
- vm0.invoke(() -> Bug39079DUnitTest.closeCache());
+ vm0.invoke(() -> Bug39079DUnitTest.closeCacheAndDisconnect());
// close client cache
- vm1.invoke(() -> Bug39079DUnitTest.closeCache());
+ vm1.invoke(() -> Bug39079DUnitTest.closeCacheAndDisconnect());
}
public static Integer createServerCache() throws Exception
@@ -335,7 +335,7 @@ public class Bug39079DUnitTest extends CacheTestCase {
return new Integer(bs1.getPort());
}
- public static void closeCache()
+ public static void closeCacheAndDisconnect()
{
if (gemfirecache != null && !gemfirecache.isClosed()) {
gemfirecache.close();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7baa2a7c/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java
index 558dd0b..d360c52 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopDUnitTest.java
@@ -121,7 +121,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
@Override
protected final void postTearDownCacheTestCase() throws Exception {
try {
- closeCache();
+ closeCacheAndDisconnect();
member0 = null;
member1 = null;
@@ -134,7 +134,7 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
}
}
- public static void closeCache() {
+ public static void closeCacheAndDisconnect() {
if (cache != null && !cache.isClosed()) {
cache.close();
cache.getDistributedSystem().disconnect();
@@ -913,8 +913,8 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
member2.invoke(() -> PartitionedRegionSingleHopDUnitTest.verifyMetadata(clientMap));
member3.invoke(() -> PartitionedRegionSingleHopDUnitTest.verifyMetadata(clientMap));
- member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.closeCache());
- member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.closeCache());
+ member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.closeCacheAndDisconnect());
+ member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.closeCacheAndDisconnect());
// member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServerOnPort(3,4,port0 ));
// member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.createServerOnPort(3,4,port1 ));
@@ -1114,10 +1114,10 @@ public class PartitionedRegionSingleHopDUnitTest extends CacheTestCase {
createClient(port0, port1, port2, port3);
fetchAndValidateMetadata();
- member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.closeCache());
- member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.closeCache());
- member2.invoke(() -> PartitionedRegionSingleHopDUnitTest.closeCache());
- member3.invoke(() -> PartitionedRegionSingleHopDUnitTest.closeCache());
+ member0.invoke(() -> PartitionedRegionSingleHopDUnitTest.closeCacheAndDisconnect());
+ member1.invoke(() -> PartitionedRegionSingleHopDUnitTest.closeCacheAndDisconnect());
+ member2.invoke(() -> PartitionedRegionSingleHopDUnitTest.closeCacheAndDisconnect());
+ member3.invoke(() -> PartitionedRegionSingleHopDUnitTest.closeCacheAndDisconnect());
Wait.pause(1000); //let client detect that servers are dead through ping
AsyncInvocation m3 = member3.invokeAsync(() -> PartitionedRegionSingleHopDUnitTest.createPersistentPrsAndServerOnPort( 3, 4,port3 ));
AsyncInvocation m2 = member2.invokeAsync(() -> PartitionedRegionSingleHopDUnitTest.createPersistentPrsAndServerOnPort( 3, 4,port2 ));
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7baa2a7c/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopWithServerGroupDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopWithServerGroupDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopWithServerGroupDUnitTest.java
index 5c9e643..c866110 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopWithServerGroupDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopWithServerGroupDUnitTest.java
@@ -128,11 +128,11 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
@Override
protected final void preTearDownCacheTestCase() throws Exception {
// close the clients first
- member0.invoke(() -> PartitionedRegionSingleHopWithServerGroupDUnitTest.closeCache());
- member1.invoke(() -> PartitionedRegionSingleHopWithServerGroupDUnitTest.closeCache());
- member2.invoke(() -> PartitionedRegionSingleHopWithServerGroupDUnitTest.closeCache());
- member3.invoke(() -> PartitionedRegionSingleHopWithServerGroupDUnitTest.closeCache());
- closeCache();
+ member0.invoke(() -> PartitionedRegionSingleHopWithServerGroupDUnitTest.closeCacheAndDisconnect());
+ member1.invoke(() -> PartitionedRegionSingleHopWithServerGroupDUnitTest.closeCacheAndDisconnect());
+ member2.invoke(() -> PartitionedRegionSingleHopWithServerGroupDUnitTest.closeCacheAndDisconnect());
+ member3.invoke(() -> PartitionedRegionSingleHopWithServerGroupDUnitTest.closeCacheAndDisconnect());
+ closeCacheAndDisconnect();
}
@Override
@@ -161,7 +161,7 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
}
}
- public static void closeCache() {
+ public static void closeCacheAndDisconnect() {
resetHonourServerGroupsInPRSingleHop();
if (cache != null && !cache.isClosed()) {
cache.close();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7baa2a7c/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SingleHopStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SingleHopStatsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SingleHopStatsDUnitTest.java
index 01522bf..f63ea31 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SingleHopStatsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SingleHopStatsDUnitTest.java
@@ -114,11 +114,11 @@ public class SingleHopStatsDUnitTest extends CacheTestCase{
@Override
protected final void preTearDownCacheTestCase() throws Exception {
// close the clients first
- member0.invoke(() -> SingleHopStatsDUnitTest.closeCache());
- member1.invoke(() -> SingleHopStatsDUnitTest.closeCache());
- member2.invoke(() -> SingleHopStatsDUnitTest.closeCache());
- member3.invoke(() -> SingleHopStatsDUnitTest.closeCache());
- closeCache();
+ member0.invoke(() -> SingleHopStatsDUnitTest.closeCacheAndDisconnect());
+ member1.invoke(() -> SingleHopStatsDUnitTest.closeCacheAndDisconnect());
+ member2.invoke(() -> SingleHopStatsDUnitTest.closeCacheAndDisconnect());
+ member3.invoke(() -> SingleHopStatsDUnitTest.closeCacheAndDisconnect());
+ closeCacheAndDisconnect();
}
@Override
@@ -137,7 +137,7 @@ public class SingleHopStatsDUnitTest extends CacheTestCase{
}
}
- public static void closeCache() {
+ public static void closeCacheAndDisconnect() {
if (cache != null && !cache.isClosed()) {
cache.close();
cache.getDistributedSystem().disconnect();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7baa2a7c/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerTestBase.java
index 560d305..2456cec 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerTestBase.java
@@ -683,14 +683,14 @@ public class PRClientServerTestBase extends CacheTestCase {
@Override
protected final void postTearDownCacheTestCase() throws Exception {
- closeCache();
- client.invoke(() -> PRClientServerTestBase.closeCache());
- server1.invoke(() -> PRClientServerTestBase.closeCache());
- server2.invoke(() -> PRClientServerTestBase.closeCache());
- server3.invoke(() -> PRClientServerTestBase.closeCache());
+ closeCacheAndDisconnect();
+ client.invoke(() -> PRClientServerTestBase.closeCacheAndDisconnect());
+ server1.invoke(() -> PRClientServerTestBase.closeCacheAndDisconnect());
+ server2.invoke(() -> PRClientServerTestBase.closeCacheAndDisconnect());
+ server3.invoke(() -> PRClientServerTestBase.closeCacheAndDisconnect());
}
- public static void closeCache() {
+ public static void closeCacheAndDisconnect() {
if (cache != null && !cache.isClosed()) {
cache.close();
cache.getDistributedSystem().disconnect();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7baa2a7c/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/Bug36853EventsExpiryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/Bug36853EventsExpiryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/Bug36853EventsExpiryDUnitTest.java
index cee0304..4eef430 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/Bug36853EventsExpiryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/Bug36853EventsExpiryDUnitTest.java
@@ -279,9 +279,9 @@ public class Bug36853EventsExpiryDUnitTest extends CacheTestCase
* Closes the cache
*
*/
- public static void closeCache()
+ public static void unSetExpiryTimeAndCloseCache()
{
- System.setProperty(HARegionQueue.REGION_ENTRY_EXPIRY_TIME, "");
+ System.clearProperty(HARegionQueue.REGION_ENTRY_EXPIRY_TIME);
CacheTestCase.closeCache();
}
@@ -295,9 +295,9 @@ public class Bug36853EventsExpiryDUnitTest extends CacheTestCase
protected final void preTearDownCacheTestCase() throws Exception
{
// close client
- client.invoke(() -> Bug36853EventsExpiryDUnitTest.closeCache());
+ client.invoke(() -> Bug36853EventsExpiryDUnitTest.unSetExpiryTimeAndCloseCache());
// close server
- server.invoke(() -> Bug36853EventsExpiryDUnitTest.closeCache());
+ server.invoke(() -> Bug36853EventsExpiryDUnitTest.unSetExpiryTimeAndCloseCache());
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7baa2a7c/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HAConflationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HAConflationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HAConflationDUnitTest.java
index 212a798..7b23f91 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HAConflationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HAConflationDUnitTest.java
@@ -116,12 +116,12 @@ public class HAConflationDUnitTest extends CacheTestCase
@Override
protected final void postTearDownCacheTestCase() throws Exception {
- client1.invoke(() -> HAConflationDUnitTest.closeCache());
+ client1.invoke(() -> HAConflationDUnitTest.closeCacheAndDisconnect());
// close server
- server1.invoke(() -> HAConflationDUnitTest.closeCache());
+ server1.invoke(() -> HAConflationDUnitTest.closeCacheAndDisconnect());
}
- public static void closeCache()
+ public static void closeCacheAndDisconnect()
{
if (cache != null && !cache.isClosed()) {
cache.close();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7baa2a7c/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java
index 8fb726a..45a9c2c 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java
@@ -1383,12 +1383,12 @@ public class ClientServerMiscDUnitTest extends CacheTestCase
@Override
protected final void postTearDownCacheTestCase() throws Exception {
// close the clients first
- closeCache();
+ closeCacheAndDisconnect();
// then close the servers
- server1.invoke(() -> ClientServerMiscDUnitTest.closeCache());
+ server1.invoke(() -> ClientServerMiscDUnitTest.closeCacheAndDisconnect());
}
- public static void closeCache()
+ public static void closeCacheAndDisconnect()
{
Cache cache = new ClientServerMiscDUnitTest("temp").getCache();
if (cache != null && !cache.isClosed()) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7baa2a7c/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/DistributedTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/DistributedTest.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/DistributedTest.java
deleted file mode 100755
index 62caad0..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/DistributedTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.gemstone.gemfire.test.dunit.internal;
-
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-
-import java.util.Properties;
-
-/**
- * Created by klund on 2/25/2016.
- */
-public interface DistributedTest {
-
- /**
- * <code>preSetUp()</code> is invoked before DistributedTestCase#setUp().
- * <p>
- * Override this as needed. Default implementation is empty.
- */
- public void preSetUp() throws Exception;
-
- /**
- * <code>postSetUp()</code> is invoked after DistributedTestCase#setUp().
- * <p>
- * Override this as needed. Default implementation is empty.
- */
- public void postSetUp() throws Exception;
-
- /**
- * <code>preTearDown()</code> is invoked before DistributedTestCase#tearDown().
- * <p>
- * Override this as needed. Default implementation is empty.
- */
- public void preTearDown() throws Exception;
-
- /**
- * <code>postTearDown()</code> is invoked after DistributedTestCase#tearDown().
- * <p>
- * Override this as needed. Default implementation is empty.
- */
- public void postTearDown() throws Exception;
-
- public Properties getDistributedSystemProperties();
-
- public InternalDistributedSystem getSystem(final Properties props); // TODO: remove and make final in DistributedTestCase
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7baa2a7c/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/DistributedTestFixture.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/DistributedTestFixture.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/DistributedTestFixture.java
new file mode 100755
index 0000000..2b82738
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/DistributedTestFixture.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.gemstone.gemfire.test.dunit.internal;
+
+import java.util.Properties;
+
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+
+/**
+ * Defines the {@code DistributedTestCase} methods that can be overridden by subclasses.
+ */
+public interface DistributedTestFixture {
+
+ /**
+ * {@code preSetUp()} is invoked before {@code DistributedTestCase#setUp()}.
+ *
+ * <p>Override this as needed. Default implementation is empty.
+ */
+ public void preSetUp() throws Exception;
+
+ /**
+ * {@code postSetUp()} is invoked after {@code DistributedTestCase#setUp()}.
+ *
+ * <p>Override this as needed. Default implementation is empty.
+ */
+ public void postSetUp() throws Exception;
+
+ /**
+ * {@code preTearDown()} is invoked before {@code DistributedTestCase#tearDown()}.
+ *
+ * <p>Override this as needed. Default implementation is empty.
+ */
+ public void preTearDown() throws Exception;
+
+ /**
+ * {@code postTearDown()</code> is invoked after {@code DistributedTestCase#tearDown()}.
+ *
+ * <p>Override this as needed. Default implementation is empty.
+ */
+ public void postTearDown() throws Exception;
+
+ /**
+ * Returns the {@code Properties} used to define the {@code DistributedSystem}.
+ *
+ * <p>Override this as needed. This method is called by various
+ * {@code getSystem} methods in {@code DistributedTestCase}.
+ */
+ public Properties getDistributedSystemProperties();
+
+ /**
+ * @deprecated Please override {@link #getDistributedSystemProperties()} instead. This should be removed.
+ */
+ public InternalDistributedSystem getSystem(final Properties props); // TODO: remove and make final in DistributedTestCase
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7baa2a7c/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit3DistributedTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit3DistributedTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit3DistributedTestCase.java
new file mode 100755
index 0000000..7e9f6b4
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit3DistributedTestCase.java
@@ -0,0 +1,252 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.dunit.internal;
+
+import java.io.Serializable;
+import java.text.DecimalFormat;
+import java.util.LinkedHashSet;
+import java.util.Properties;
+import java.util.Set;
+
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import junit.framework.TestCase;
+import org.apache.logging.log4j.Logger;
+import org.junit.experimental.categories.Category;
+
+/**
+ * This class is the superclass of all distributed tests using JUnit 3.
+ *
+ * tests/hydra/JUnitTestTask is the main DUnit driver. It supports two
+ * additional public static methods if they are defined in the test case:
+ *
+ * public static void caseSetUp() -- comparable to JUnit's BeforeClass annotation
+ *
+ * public static void caseTearDown() -- comparable to JUnit's AfterClass annotation
+ */
+@Category(DistributedTest.class)
+public abstract class JUnit3DistributedTestCase extends TestCase implements DistributedTestFixture, Serializable {
+
+ private final JUnit4DistributedTestCase delegate = new JUnit4DistributedTestCase(this);
+
+ private static final Logger logger = LogService.getLogger();
+
+ private static final Set<String> testHistory = new LinkedHashSet<String>();
+
+ /** This VM's connection to the distributed system */
+ public static InternalDistributedSystem system;
+ private static Class lastSystemCreatedInTest;
+ private static Properties lastSystemProperties;
+ private static volatile String testMethodName;
+
+ /** For formatting timing info */
+ private static final DecimalFormat format = new DecimalFormat("###.###");
+
+ public static boolean reconnect = false;
+
+ public static final boolean logPerTest = Boolean.getBoolean("dunitLogPerTest");
+
+ static {
+ JUnit4DistributedTestCase.initializeDistributedTestCase();
+ }
+
+ /**
+ * Creates a new <code>JUnit3DistributedTestCase</code> test with the
+ * given name.
+ */
+ public JUnit3DistributedTestCase(final String name) {
+ super(name);
+ }
+
+ //---------------------------------------------------------------------------
+ // methods for tests
+ //---------------------------------------------------------------------------
+
+ public final void setSystem(final Properties props, final DistributedSystem ds) { // TODO: override getDistributedSystemProperties and then delete
+ delegate.setSystem(props, ds);
+ }
+
+ /**
+ * Returns this VM's connection to the distributed system. If
+ * necessary, the connection will be lazily created using the given
+ * <code>Properties</code>. Note that this method uses hydra's
+ * configuration to determine the location of log files, etc.
+ * Note: "final" was removed so that WANTestBase can override this method.
+ * This was part of the xd offheap merge.
+ *
+ * see hydra.DistributedConnectionMgr#connect
+ * @since 3.0
+ */
+ public /*final*/ InternalDistributedSystem getSystem(final Properties props) { // TODO: make final
+ return delegate.getSystem(props);
+ }
+
+ /**
+ * Returns this VM's connection to the distributed system. If
+ * necessary, the connection will be lazily created using the
+ * <code>Properties</code> returned by {@link
+ * #getDistributedSystemProperties}.
+ *
+ * @see #getSystem(Properties)
+ *
+ * @since 3.0
+ */
+ public final InternalDistributedSystem getSystem() {
+ return delegate.getSystem();
+ }
+
+ /**
+ * Returns a loner distributed system that isn't connected to other
+ * vms
+ *
+ * @since 6.5
+ */
+ public final InternalDistributedSystem getLonerSystem() {
+ return delegate.getLonerSystem();
+ }
+
+ /**
+ * Returns a loner distributed system in combination with enforceUniqueHost
+ * and redundancyZone properties.
+ * Added specifically to test scenario of defect #47181.
+ */
+ public final InternalDistributedSystem getLonerSystemWithEnforceUniqueHost() {
+ return delegate.getLonerSystemWithEnforceUniqueHost();
+ }
+
+ /**
+ * Returns whether or this VM is connected to a {@link
+ * DistributedSystem}.
+ */
+ public final boolean isConnectedToDS() {
+ return delegate.isConnectedToDS();
+ }
+
+ /**
+ * Returns a <code>Properties</code> object used to configure a
+ * connection to a {@link
+ * com.gemstone.gemfire.distributed.DistributedSystem}.
+ * Unless overridden, this method will return an empty
+ * <code>Properties</code> object.
+ *
+ * @since 3.0
+ */
+ public Properties getDistributedSystemProperties() {
+ return delegate.getDistributedSystemProperties();
+ }
+
+ public static void disconnectAllFromDS() {
+ JUnit4DistributedTestCase.disconnectAllFromDS();
+ }
+
+ /**
+ * Disconnects this VM from the distributed system
+ */
+ public static void disconnectFromDS() {
+ JUnit4DistributedTestCase.disconnectFromDS();
+ }
+
+ //---------------------------------------------------------------------------
+ // name methods
+ //---------------------------------------------------------------------------
+
+ public static String getTestMethodName() {
+ return JUnit4DistributedTestCase.getTestMethodName();
+ }
+
+ public static void setTestMethodName(final String testMethodName) { // TODO: delete
+ JUnit4DistributedTestCase.setTestMethodName(testMethodName);
+ }
+
+ /**
+ * Returns a unique name for this test method. It is based on the
+ * name of the class as well as the name of the method.
+ */
+ public String getUniqueName() {
+ return delegate.getUniqueName();
+ }
+
+ //---------------------------------------------------------------------------
+ // setup methods
+ //---------------------------------------------------------------------------
+
+ /**
+ * Sets up the JUnit3DistributedTestCase.
+ * <p>
+ * Do not override this method. Override {@link #preSetUp()} with work that
+ * needs to occur before setUp() or override {@link #postSetUp()} with work
+ * that needs to occur after setUp().
+ */
+ @Override
+ public void setUp() throws Exception {
+ delegate.setUp();
+ }
+
+ /**
+ * <code>preSetUp()</code> is invoked before #setUpDistributedTestCase().
+ * <p>
+ * Override this as needed. Default implementation is empty.
+ */
+ public void preSetUp() throws Exception {
+ }
+
+ /**
+ * <code>postSetUp()</code> is invoked after #setUpDistributedTestCase().
+ * <p>
+ * Override this as needed. Default implementation is empty.
+ */
+ public void postSetUp() throws Exception {
+ }
+
+ //---------------------------------------------------------------------------
+ // teardown methods
+ //---------------------------------------------------------------------------
+
+ /**
+ * Tears down the DistributedTestCase.
+ * <p>
+ * Do not override this method. Override {@link #preTearDown()} with work that
+ * needs to occur before tearDown() or override {@link #postTearDown()} with work
+ * that needs to occur after tearDown().
+ */
+ @Override
+ public final void tearDown() throws Exception {
+ delegate.tearDown();
+ }
+
+ /**
+ * <code>preTearDown()</code> is invoked before {@link JUnit4DistributedTestCase#tearDownDistributedTestCase()}.
+ * <p>
+ * Override this as needed. Default implementation is empty.
+ */
+ public void preTearDown() throws Exception {
+ }
+
+ /**
+ * <code>postTearDown()</code> is invoked after {@link JUnit4DistributedTestCase#tearDownDistributedTestCase()}.
+ * <p>
+ * Override this as needed. Default implementation is empty.
+ */
+ public void postTearDown() throws Exception {
+ }
+
+ public static void cleanupAllVms() { // TODO: make private
+ JUnit4DistributedTestCase.cleanupAllVms();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7baa2a7c/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit4DistributedTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit4DistributedTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit4DistributedTestCase.java
new file mode 100755
index 0000000..559384d
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit4DistributedTestCase.java
@@ -0,0 +1,583 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.dunit.internal;
+
+import java.io.Serializable;
+import java.text.DecimalFormat;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import com.gemstone.gemfire.admin.internal.AdminDistributedSystemImpl;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.hdfs.internal.hoplog.HoplogConfig;
+import com.gemstone.gemfire.cache.query.QueryTestUtils;
+import com.gemstone.gemfire.cache.query.internal.QueryObserverHolder;
+import com.gemstone.gemfire.cache30.ClientServerTestCase;
+import com.gemstone.gemfire.cache30.GlobalLockingDUnitTest;
+import com.gemstone.gemfire.cache30.MultiVMRegionTestCase;
+import com.gemstone.gemfire.cache30.RegionTestCase;
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.DistributionMessageObserver;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.SocketCreator;
+import com.gemstone.gemfire.internal.admin.ClientStatsManager;
+import com.gemstone.gemfire.internal.cache.DiskStoreObserver;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.HARegion;
+import com.gemstone.gemfire.internal.cache.InitialImageOperation;
+import com.gemstone.gemfire.internal.cache.PartitionedRegion;
+import com.gemstone.gemfire.internal.cache.tier.InternalClientMembership;
+import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
+import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.management.internal.cli.LogWrapper;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+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.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.standalone.DUnitLauncher;
+import com.gemstone.gemfire.test.junit.rules.serializable.SerializableTestName;
+import org.apache.logging.log4j.Logger;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+
+/**
+ * This class is the base class for all distributed tests using JUnit 4.
+ *
+ * TODO: make this class abstract when JUnit3DistributedTestCase is deleted
+ */
+public class JUnit4DistributedTestCase implements DistributedTestFixture, Serializable {
+
+ private static final Logger logger = LogService.getLogger();
+
+ private static final Set<String> testHistory = new LinkedHashSet<String>();
+
+ /** This VM's connection to the distributed system */
+ public static InternalDistributedSystem system; // TODO: make private
+ private static Class lastSystemCreatedInTest;
+ private static Properties lastSystemProperties;
+ private static volatile String testMethodName;
+
+ /** For formatting timing info */
+ private static final DecimalFormat format = new DecimalFormat("###.###");
+
+ public static boolean reconnect = false; // TODO: make private
+
+ public static final boolean logPerTest = Boolean.getBoolean("dunitLogPerTest"); // TODO: make private
+
+ private final DistributedTestFixture distributedTestFixture;
+
+ /**
+ * Creates a new JUnit4DistributedTestCase distributedTestFixture with the given name.
+ *
+ * @deprecated Please use {@link #JUnit4DistributedTestCase()} instead. The {@code name} is ignored.
+ */
+ @Deprecated
+ public JUnit4DistributedTestCase(final String name) {
+ this();
+ }
+
+ public JUnit4DistributedTestCase() {
+ this((DistributedTestFixture)null);
+ }
+
+ JUnit4DistributedTestCase(final DistributedTestFixture distributedTestFixture) {
+ if (distributedTestFixture == null) {
+ this.distributedTestFixture = this;
+ } else {
+ this.distributedTestFixture = distributedTestFixture;
+ }
+ }
+
+ @Rule
+ public SerializableTestName testName = new SerializableTestName();
+
+ @BeforeClass
+ public static final void initializeDistributedTestCase() {
+ DUnitLauncher.launchIfNeeded();
+ }
+
+ public final String getName() {
+ return this.testName.getMethodName();
+ }
+
+ public final Class<? extends DistributedTestFixture> getTestClass() {
+ return this.distributedTestFixture.getClass();
+ }
+
+ //---------------------------------------------------------------------------
+ // methods for tests
+ //---------------------------------------------------------------------------
+
+ public final void setSystem(final Properties props, final DistributedSystem ds) { // TODO: override getDistributedSystemProperties and then delete
+ system = (InternalDistributedSystem)ds;
+ lastSystemProperties = props;
+ lastSystemCreatedInTest = getTestClass(); // used to be getDeclaringClass()
+ }
+
+ /**
+ * Returns this VM's connection to the distributed system. If
+ * necessary, the connection will be lazily created using the given
+ * <code>Properties</code>. Note that this method uses hydra's
+ * configuration to determine the location of log files, etc.
+ * Note: "final" was removed so that WANTestBase can override this method.
+ * This was part of the xd offheap merge.
+ *
+ * see hydra.DistributedConnectionMgr#connect
+ * @since 3.0
+ */
+ public /*final*/ InternalDistributedSystem getSystem(final Properties props) { // TODO: make final
+ if (this.distributedTestFixture != this) {
+ return this.distributedTestFixture.getSystem(props);
+ }
+
+ // Setting the default disk store name is now done in setUp
+ if (system == null) {
+ system = InternalDistributedSystem.getAnyInstance();
+ }
+ if (system == null || !system.isConnected()) {
+ // Figure out our distributed system properties
+ Properties p = DistributedTestUtils.getAllDistributedSystemProperties(props);
+ lastSystemCreatedInTest = getTestClass(); // used to be getDeclaringClass()
+ if (logPerTest) {
+ String testMethod = getTestMethodName();
+ String testName = lastSystemCreatedInTest.getName() + '-' + testMethod;
+ String oldLogFile = p.getProperty(DistributionConfig.LOG_FILE_NAME);
+ p.put(DistributionConfig.LOG_FILE_NAME,
+ oldLogFile.replace("system.log", testName+".log"));
+ String oldStatFile = p.getProperty(DistributionConfig.STATISTIC_ARCHIVE_FILE_NAME);
+ p.put(DistributionConfig.STATISTIC_ARCHIVE_FILE_NAME,
+ oldStatFile.replace("statArchive.gfs", testName+".gfs"));
+ }
+ system = (InternalDistributedSystem)DistributedSystem.connect(p);
+ lastSystemProperties = p;
+ } else {
+ boolean needNewSystem = false;
+ if(!getTestClass().equals(lastSystemCreatedInTest)) { // used to be getDeclaringClass()
+ Properties newProps = DistributedTestUtils.getAllDistributedSystemProperties(props);
+ needNewSystem = !newProps.equals(lastSystemProperties);
+ if(needNewSystem) {
+ LogWriterUtils.getLogWriter().info(
+ "Test class has changed and the new DS properties are not an exact match. "
+ + "Forcing DS disconnect. Old props = "
+ + lastSystemProperties + "new props=" + newProps);
+ }
+ } else {
+ Properties activeProps = system.getProperties();
+ for (Iterator iter = props.entrySet().iterator();
+ iter.hasNext(); ) {
+ Map.Entry entry = (Map.Entry) iter.next();
+ String key = (String) entry.getKey();
+ String value = (String) entry.getValue();
+ if (!value.equals(activeProps.getProperty(key))) {
+ needNewSystem = true;
+ LogWriterUtils.getLogWriter().info("Forcing DS disconnect. For property " + key
+ + " old value = " + activeProps.getProperty(key)
+ + " new value = " + value);
+ break;
+ }
+ }
+ }
+ if(needNewSystem) {
+ // the current system does not meet our needs to disconnect and
+ // call recursively to get a new system.
+ LogWriterUtils.getLogWriter().info("Disconnecting from current DS in order to make a new one");
+ disconnectFromDS();
+ getSystem(props);
+ }
+ }
+ return system;
+ }
+
+ /**
+ * Returns this VM's connection to the distributed system. If
+ * necessary, the connection will be lazily created using the
+ * <code>Properties</code> returned by {@link
+ * #getDistributedSystemProperties}.
+ *
+ * @see #getSystem(Properties)
+ *
+ * @since 3.0
+ */
+ public final InternalDistributedSystem getSystem() {
+ return getSystem(getDistributedSystemProperties());
+ }
+
+ /**
+ * Returns a loner distributed system that isn't connected to other
+ * vms
+ *
+ * @since 6.5
+ */
+ public final InternalDistributedSystem getLonerSystem() {
+ Properties props = getDistributedSystemProperties();
+ props.put(DistributionConfig.MCAST_PORT_NAME, "0");
+ props.put(DistributionConfig.LOCATORS_NAME, "");
+ return getSystem(props);
+ }
+
+ /**
+ * Returns a loner distributed system in combination with enforceUniqueHost
+ * and redundancyZone properties.
+ * Added specifically to test scenario of defect #47181.
+ */
+ public final InternalDistributedSystem getLonerSystemWithEnforceUniqueHost() {
+ Properties props = getDistributedSystemProperties();
+ props.put(DistributionConfig.MCAST_PORT_NAME, "0");
+ props.put(DistributionConfig.LOCATORS_NAME, "");
+ props.put(DistributionConfig.ENFORCE_UNIQUE_HOST_NAME, "true");
+ props.put(DistributionConfig.REDUNDANCY_ZONE_NAME, "zone1");
+ return getSystem(props);
+ }
+
+ /**
+ * Returns whether or this VM is connected to a {@link
+ * DistributedSystem}.
+ */
+ public final boolean isConnectedToDS() {
+ return system != null && system.isConnected();
+ }
+
+ /**
+ * Returns a {@code Properties} object used to configure a
+ * connection to a {@link
+ * com.gemstone.gemfire.distributed.DistributedSystem}.
+ * Unless overridden, this method will return an empty
+ * {@code Properties} object.
+ *
+ * <p>Override this as needed. Default implementation returns empty {@code Properties}.
+ *
+ * @since 3.0
+ */
+ public Properties getDistributedSystemProperties() {
+ if (this.distributedTestFixture != this) {
+ return this.distributedTestFixture.getDistributedSystemProperties();
+ }
+ return new Properties();
+ }
+
+ public static final void disconnectAllFromDS() {
+ disconnectFromDS();
+ Invoke.invokeInEveryVM(()->disconnectFromDS());
+ }
+
+ /**
+ * Disconnects this VM from the distributed system
+ */
+ public static void disconnectFromDS() { // TODO: this is overridden by CacheTestCase
+ setTestMethodName(null);
+ GemFireCacheImpl.testCacheXml = null;
+ if (system != null) {
+ system.disconnect();
+ system = null;
+ }
+
+ for (;;) {
+ DistributedSystem ds = InternalDistributedSystem.getConnectedInstance();
+ if (ds == null) {
+ break;
+ }
+ try {
+ ds.disconnect();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ AdminDistributedSystemImpl ads = AdminDistributedSystemImpl.getConnectedInstance();
+ if (ads != null) {// && ads.isConnected()) {
+ ads.disconnect();
+ }
+ }
+
+ //---------------------------------------------------------------------------
+ // name methods
+ //---------------------------------------------------------------------------
+
+ public static final String getTestMethodName() {
+ return testMethodName;
+ }
+
+ public static final void setTestMethodName(final String testMethodName) { // TODO: delete
+ JUnit4DistributedTestCase.testMethodName = testMethodName;
+ }
+
+ /**
+ * Returns a unique name for this test method. It is based on the
+ * name of the class as well as the name of the method.
+ */
+ public final String getUniqueName() {
+ return getTestClass().getSimpleName() + "_" + getName();
+ }
+
+ //---------------------------------------------------------------------------
+ // setup methods
+ //---------------------------------------------------------------------------
+
+ /**
+ * Sets up the DistributedTestCase.
+ * <p>
+ * Do not override this method. Override {@link #preSetUp()} with work that
+ * needs to occur before setUp() or override {@link #postSetUp()} with work
+ * that needs to occur after setUp().
+ */
+ @Before
+ public final void setUp() throws Exception {
+ preSetUp();
+ setUpDistributedTestCase();
+ postSetUp();
+ }
+
+ /**
+ * Sets up DistributedTest in controller and remote VMs. This includes the
+ * defining the test name, setting the default disk store name, logging the
+ * test history, and capturing a creation stack for detecting the source of
+ * incompatible DistributedSystem connections.
+ * <p>
+ * Do not override this method.
+ */
+ private final void setUpDistributedTestCase() {
+ final String className = getTestClass().getCanonicalName();
+ final String methodName = getName();
+
+ logTestHistory();
+
+ setUpVM(methodName, getDefaultDiskStoreName(0, -1, className, methodName));
+
+ for (int hostIndex = 0; hostIndex < Host.getHostCount(); hostIndex++) {
+ Host host = Host.getHost(hostIndex);
+ for (int vmIndex = 0; vmIndex < host.getVMCount(); vmIndex++) {
+ final String vmDefaultDiskStoreName = getDefaultDiskStoreName(hostIndex, vmIndex, className, methodName);
+ host.getVM(vmIndex).invoke(()->setUpVM(methodName, vmDefaultDiskStoreName));
+ }
+ }
+
+ logTestStart();
+ }
+
+ /**
+ * {@code preSetUp()} is invoked before {@link #setUpDistributedTestCase()}.
+ *
+ * <p>Override this as needed. Default implementation is empty.
+ */
+ public void preSetUp() throws Exception {
+ if (this.distributedTestFixture != this) {
+ this.distributedTestFixture.preSetUp();
+ return;
+ }
+ }
+
+ /**
+ * {@code postSetUp()} is invoked after {@link #setUpDistributedTestCase()}.
+ *
+ * <p>Override this as needed. Default implementation is empty.
+ */
+ public void postSetUp() throws Exception {
+ if (this.distributedTestFixture != this) {
+ this.distributedTestFixture.postSetUp();
+ return;
+ }
+ }
+
+ private static final String getDefaultDiskStoreName(final int hostIndex, final int vmIndex, final String className, final String methodName) {
+ return "DiskStore-" + String.valueOf(hostIndex) + "-" + String.valueOf(vmIndex) + "-" + className + "." + methodName; // used to be getDeclaringClass()
+ }
+
+ private static final void setUpVM(final String methodName, final String defaultDiskStoreName) {
+ setTestMethodName(methodName);
+ GemFireCacheImpl.setDefaultDiskStoreName(defaultDiskStoreName);
+ System.setProperty(HoplogConfig.ALLOW_LOCAL_HDFS_PROP, "true");
+ setUpCreationStackGenerator();
+ }
+
+ private final void logTestStart() {
+ System.out.println("\n\n[setup] START TEST " + getTestClass().getSimpleName()+"."+testMethodName+"\n\n");
+ }
+
+ private static final void setUpCreationStackGenerator() {
+ // the following is moved from InternalDistributedSystem to fix #51058
+ InternalDistributedSystem.TEST_CREATION_STACK_GENERATOR.set(
+ new InternalDistributedSystem.CreationStackGenerator() {
+ @Override
+ public Throwable generateCreationStack(final DistributionConfig config) {
+ final StringBuilder sb = new StringBuilder();
+ final String[] validAttributeNames = config.getAttributeNames();
+ for (int i = 0; i < validAttributeNames.length; i++) {
+ final String attName = validAttributeNames[i];
+ final Object actualAtt = config.getAttributeObject(attName);
+ String actualAttStr = actualAtt.toString();
+ sb.append(" ");
+ sb.append(attName);
+ sb.append("=\"");
+ if (actualAtt.getClass().isArray()) {
+ actualAttStr = InternalDistributedSystem.arrayToString(actualAtt);
+ }
+ sb.append(actualAttStr);
+ sb.append("\"");
+ sb.append("\n");
+ }
+ return new Throwable("Creating distributed system with the following configuration:\n" + sb.toString());
+ }
+ });
+ }
+
+ /**
+ * Write a message to the log about what tests have ran previously. This
+ * makes it easier to figure out if a previous test may have caused problems
+ */
+ private final void logTestHistory() {
+ String classname = getTestClass().getSimpleName();
+ testHistory.add(classname);
+ System.out.println("Previously run tests: " + testHistory);
+ }
+
+ //---------------------------------------------------------------------------
+ // teardown methods
+ //---------------------------------------------------------------------------
+
+ /**
+ * Tears down the DistributedTestCase.
+ * <p>
+ * Do not override this method. Override {@link #preTearDown()} with work that
+ * needs to occur before tearDown() or override {@link #postTearDown()} with work
+ * that needs to occur after tearDown().
+ */
+ @After
+ public final void tearDown() throws Exception {
+ preTearDown();
+ tearDownDistributedTestCase();
+ postTearDown();
+ }
+
+ private final void tearDownDistributedTestCase() throws Exception {
+ Invoke.invokeInEveryVM(()->tearDownCreationStackGenerator());
+ if (logPerTest) {
+ disconnectFromDS();
+ Invoke.invokeInEveryVM(()->disconnectFromDS());
+ }
+ cleanupAllVms();
+ }
+
+ /**
+ * {@code preTearDown()} is invoked before {@link #tearDownDistributedTestCase()}.
+ *
+ * <p>Override this as needed. Default implementation is empty.
+ */
+ public void preTearDown() throws Exception {
+ if (this.distributedTestFixture != this) {
+ this.distributedTestFixture.preTearDown();
+ return;
+ }
+ }
+
+ /**
+ * {@code postTearDown()} is invoked after {@link #tearDownDistributedTestCase()}.
+ *
+ * <p>Override this as needed. Default implementation is empty.
+ */
+ public void postTearDown() throws Exception {
+ if (this.distributedTestFixture != this) {
+ this.distributedTestFixture.postTearDown();
+ return;
+ }
+ }
+
+ public static final void cleanupAllVms() { // TODO: make private
+ tearDownVM();
+ Invoke.invokeInEveryVM(()->tearDownVM());
+ Invoke.invokeInLocator(()->{
+ DistributionMessageObserver.setInstance(null);
+ DistributedTestUtils.unregisterInstantiatorsInThisVM();
+ });
+ DUnitLauncher.closeAndCheckForSuspects();
+ }
+
+ private static final void tearDownVM() {
+ closeCache();
+
+ // keep alphabetized to detect duplicate lines
+ CacheCreation.clearThreadLocals();
+ CacheServerTestUtil.clearCacheReference();
+ ClientProxyMembershipID.system = null;
+ ClientServerTestCase.AUTO_LOAD_BALANCE = false;
+ ClientStatsManager.cleanupForTests();
+ DiskStoreObserver.setInstance(null);
+ DistributedTestUtils.unregisterInstantiatorsInThisVM();
+ DistributionMessageObserver.setInstance(null);
+ GlobalLockingDUnitTest.region_testBug32356 = null;
+ InitialImageOperation.slowImageProcessing = 0;
+ InternalClientMembership.unregisterAllListeners();
+ LogWrapper.close();
+ MultiVMRegionTestCase.CCRegion = null;
+ QueryObserverHolder.reset();
+ QueryTestUtils.setCache(null);
+ RegionTestCase.preSnapshotRegion = null;
+ SocketCreator.resetHostNameCache();
+ SocketCreator.resolve_dns = true;
+
+ // clear system properties -- keep alphabetized
+ System.clearProperty("gemfire.log-level");
+ System.clearProperty(HoplogConfig.ALLOW_LOCAL_HDFS_PROP);
+ System.clearProperty("jgroups.resolve_dns");
+
+ if (InternalDistributedSystem.systemAttemptingReconnect != null) {
+ InternalDistributedSystem.systemAttemptingReconnect.stopReconnecting();
+ }
+
+ IgnoredException.removeAllExpectedExceptions();
+ }
+
+ private static final void closeCache() {
+ GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
+ if (cache != null && !cache.isClosed()) {
+ destroyRegions(cache);
+ cache.close();
+ }
+ }
+
+ protected static final void destroyRegions(final Cache cache) { // TODO: make private
+ if (cache != null && !cache.isClosed()) {
+ // try to destroy the root regions first so that we clean up any persistent files.
+ for (Iterator itr = cache.rootRegions().iterator(); itr.hasNext();) {
+ Region root = (Region)itr.next();
+ String regionFullPath = root == null ? null : root.getFullPath();
+ // for colocated regions you can't locally destroy a partitioned region.
+ if(root.isDestroyed() || root instanceof HARegion || root instanceof PartitionedRegion) {
+ continue;
+ }
+ try {
+ root.localDestroyRegion("teardown");
+ } catch (Throwable t) {
+ logger.error("Failure during tearDown destroyRegions for " + regionFullPath, t);
+ }
+ }
+ }
+ }
+
+ private static final void tearDownCreationStackGenerator() {
+ InternalDistributedSystem.TEST_CREATION_STACK_GENERATOR.set(InternalDistributedSystem.DEFAULT_CREATION_STACK_GENERATOR);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7baa2a7c/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/junit3/DistributedTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/junit3/DistributedTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/junit3/DistributedTestCase.java
deleted file mode 100755
index 2ebf144..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/junit3/DistributedTestCase.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.gemstone.gemfire.test.dunit.internal.junit3;
-
-import com.gemstone.gemfire.admin.internal.AdminDistributedSystemImpl;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.hdfs.internal.hoplog.HoplogConfig;
-import com.gemstone.gemfire.cache.query.QueryTestUtils;
-import com.gemstone.gemfire.cache.query.internal.QueryObserverHolder;
-import com.gemstone.gemfire.cache30.ClientServerTestCase;
-import com.gemstone.gemfire.cache30.GlobalLockingDUnitTest;
-import com.gemstone.gemfire.cache30.MultiVMRegionTestCase;
-import com.gemstone.gemfire.cache30.RegionTestCase;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.distributed.internal.DistributionMessageObserver;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.internal.SocketCreator;
-import com.gemstone.gemfire.internal.admin.ClientStatsManager;
-import com.gemstone.gemfire.internal.cache.DiskStoreObserver;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.HARegion;
-import com.gemstone.gemfire.internal.cache.InitialImageOperation;
-import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-import com.gemstone.gemfire.internal.cache.tier.InternalClientMembership;
-import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
-import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID;
-import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.management.internal.cli.LogWrapper;
-import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
-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.LogWriterUtils;
-import com.gemstone.gemfire.test.dunit.internal.DistributedTest;
-import com.gemstone.gemfire.test.dunit.standalone.DUnitLauncher;
-import junit.framework.TestCase;
-import org.apache.logging.log4j.Logger;
-import org.junit.experimental.categories.Category;
-
-import java.io.Serializable;
-import java.text.DecimalFormat;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-/**
- * This class is the superclass of all distributed unit tests.
- *
- * tests/hydra/JUnitTestTask is the main DUnit driver. It supports two
- * additional public static methods if they are defined in the test case:
- *
- * public static void caseSetUp() -- comparable to JUnit's BeforeClass annotation
- *
- * public static void caseTearDown() -- comparable to JUnit's AfterClass annotation
- *
- * @author David Whitlock
- */
-@Category(com.gemstone.gemfire.test.junit.categories.DistributedTest.class)
-public abstract class DistributedTestCase extends TestCase implements DistributedTest, Serializable {
-
- private final com.gemstone.gemfire.test.dunit.internal.junit4.DistributedTestCase delegate = new com.gemstone.gemfire.test.dunit.internal.junit4.DistributedTestCase(this);
-
- private static final Logger logger = LogService.getLogger();
-
- private static final Set<String> testHistory = new LinkedHashSet<String>();
-
- /** This VM's connection to the distributed system */
- public static InternalDistributedSystem system;
- private static Class lastSystemCreatedInTest;
- private static Properties lastSystemProperties;
- private static volatile String testMethodName;
-
- /** For formatting timing info */
- private static final DecimalFormat format = new DecimalFormat("###.###");
-
- public static boolean reconnect = false;
-
- public static final boolean logPerTest = Boolean.getBoolean("dunitLogPerTest");
-
- static {
- com.gemstone.gemfire.test.dunit.internal.junit4.DistributedTestCase.initializeDistributedTestCase();
- }
-
- /**
- * Creates a new <code>DistributedTestCase</code> test with the
- * given name.
- */
- public DistributedTestCase(final String name) {
- super(name);
- }
-
- //---------------------------------------------------------------------------
- // methods for tests
- //---------------------------------------------------------------------------
-
- public final void setSystem(final Properties props, final DistributedSystem ds) { // TODO: override getDistributedSystemProperties and then delete
- delegate.setSystem(props, ds);
- }
-
- /**
- * Returns this VM's connection to the distributed system. If
- * necessary, the connection will be lazily created using the given
- * <code>Properties</code>. Note that this method uses hydra's
- * configuration to determine the location of log files, etc.
- * Note: "final" was removed so that WANTestBase can override this method.
- * This was part of the xd offheap merge.
- *
- * see hydra.DistributedConnectionMgr#connect
- * @since 3.0
- */
- public /*final*/ InternalDistributedSystem getSystem(final Properties props) { // TODO: make final
- return delegate.getSystem(props);
- }
-
- /**
- * Returns this VM's connection to the distributed system. If
- * necessary, the connection will be lazily created using the
- * <code>Properties</code> returned by {@link
- * #getDistributedSystemProperties}.
- *
- * @see #getSystem(Properties)
- *
- * @since 3.0
- */
- public final InternalDistributedSystem getSystem() {
- return delegate.getSystem();
- }
-
- /**
- * Returns a loner distributed system that isn't connected to other
- * vms
- *
- * @since 6.5
- */
- public final InternalDistributedSystem getLonerSystem() {
- return delegate.getLonerSystem();
- }
-
- /**
- * Returns a loner distributed system in combination with enforceUniqueHost
- * and redundancyZone properties.
- * Added specifically to test scenario of defect #47181.
- */
- public final InternalDistributedSystem getLonerSystemWithEnforceUniqueHost() {
- return delegate.getLonerSystemWithEnforceUniqueHost();
- }
-
- /**
- * Returns whether or this VM is connected to a {@link
- * DistributedSystem}.
- */
- public final boolean isConnectedToDS() {
- return delegate.isConnectedToDS();
- }
-
- /**
- * Returns a <code>Properties</code> object used to configure a
- * connection to a {@link
- * com.gemstone.gemfire.distributed.DistributedSystem}.
- * Unless overridden, this method will return an empty
- * <code>Properties</code> object.
- *
- * @since 3.0
- */
- public Properties getDistributedSystemProperties() {
- return delegate.getDistributedSystemProperties();
- }
-
- public static void disconnectAllFromDS() {
- com.gemstone.gemfire.test.dunit.internal.junit4.DistributedTestCase.disconnectAllFromDS();
- }
-
- /**
- * Disconnects this VM from the distributed system
- */
- public static void disconnectFromDS() {
- com.gemstone.gemfire.test.dunit.internal.junit4.DistributedTestCase.disconnectFromDS();
- }
-
- //---------------------------------------------------------------------------
- // name methods
- //---------------------------------------------------------------------------
-
- public static String getTestMethodName() {
- return com.gemstone.gemfire.test.dunit.internal.junit4.DistributedTestCase.getTestMethodName();
- }
-
- public static void setTestMethodName(final String testMethodName) { // TODO: delete
- com.gemstone.gemfire.test.dunit.internal.junit4.DistributedTestCase.setTestMethodName(testMethodName);
- }
-
- /**
- * Returns a unique name for this test method. It is based on the
- * name of the class as well as the name of the method.
- */
- public String getUniqueName() {
- return delegate.getUniqueName();
- }
-
- //---------------------------------------------------------------------------
- // setup methods
- //---------------------------------------------------------------------------
-
- /**
- * Sets up the DistributedTestCase.
- * <p>
- * Do not override this method. Override {@link #preSetUp()} with work that
- * needs to occur before setUp() or override {@link #postSetUp()} with work
- * that needs to occur after setUp().
- */
- @Override
- public void setUp() throws Exception {
- delegate.setUp();
- }
-
- /**
- * <code>preSetUp()</code> is invoked before #setUpDistributedTestCase().
- * <p>
- * Override this as needed. Default implementation is empty.
- */
- public void preSetUp() throws Exception {
- }
-
- /**
- * <code>postSetUp()</code> is invoked after #setUpDistributedTestCase().
- * <p>
- * Override this as needed. Default implementation is empty.
- */
- public void postSetUp() throws Exception {
- }
-
- //---------------------------------------------------------------------------
- // teardown methods
- //---------------------------------------------------------------------------
-
- /**
- * Tears down the DistributedTestCase.
- * <p>
- * Do not override this method. Override {@link #preTearDown()} with work that
- * needs to occur before tearDown() or override {@link #postTearDown()} with work
- * that needs to occur after tearDown().
- */
- @Override
- public final void tearDown() throws Exception {
- delegate.tearDown();
- }
-
- /**
- * <code>preTearDown()</code> is invoked before {@link com.gemstone.gemfire.test.dunit.internal.junit4.DistributedTestCase#tearDownDistributedTestCase()}.
- * <p>
- * Override this as needed. Default implementation is empty.
- */
- public void preTearDown() throws Exception {
- }
-
- /**
- * <code>postTearDown()</code> is invoked after {@link com.gemstone.gemfire.test.dunit.internal.junit4.DistributedTestCase#tearDownDistributedTestCase()}.
- * <p>
- * Override this as needed. Default implementation is empty.
- */
- public void postTearDown() throws Exception {
- }
-
- public static void cleanupAllVms() { // TODO: make private
- com.gemstone.gemfire.test.dunit.internal.junit4.DistributedTestCase.cleanupAllVms();
- }
-}