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/18 22:54:56 UTC
[10/11] incubator-geode git commit: GEODE-1050: add JUnit 4 versions
of DistributedTestCase and CacheTestCase
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java
index 09fd945..d144c00 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java
@@ -73,13 +73,12 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
//////// Test Methods
@Override
- public void setUp() throws Exception {
- super.setUp();
+ public final void postSetUp() throws Exception {
disconnectAllFromDS();
}
@Override
- protected final void postTearDownCacheTestCase() throws Exception {
+ public final void postTearDownCacheTestCase() throws Exception {
disconnectAllFromDS();
}
@@ -99,7 +98,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ InternalDistributedSystem system = getSystem(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name, factory.create());
@@ -129,7 +128,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("mcast-port", "0");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ getSystem(config);
getCache();
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
@@ -242,7 +241,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ getSystem(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name, factory.create());
@@ -272,7 +271,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("mcast-port", "0");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ getSystem(config);
getCache();
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
@@ -370,7 +369,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ getSystem(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name, factory.create());
@@ -400,7 +399,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("mcast-port", "0");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ getSystem(config);
getCache();
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
@@ -496,7 +495,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ getSystem(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name, factory.create());
@@ -633,7 +632,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("mcast-port", "0");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ getSystem(config);
getCache();
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
@@ -690,7 +689,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ getSystem(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name, factory.create());
@@ -720,7 +719,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("mcast-port", "0");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ getSystem(config);
getCache();
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
@@ -855,7 +854,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ getSystem(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name+"1", factory.create());
@@ -890,7 +889,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("mcast-port", "0");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ getSystem(config);
getCache();
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
@@ -956,7 +955,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ getSystem(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name, factory.create());
@@ -986,7 +985,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("mcast-port", "0");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ getSystem(config);
PoolManager.createFactory().addServer(host0, port).setSubscriptionEnabled(true).create("clientPool");
getCache();
AttributesFactory factory = new AttributesFactory();
@@ -1001,7 +1000,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("mcast-port", "0");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ getSystem(config);
PoolManager.createFactory().addServer(host0, port).setSubscriptionEnabled(true).create("clientPool");
getCache();
AttributesFactory factory = new AttributesFactory();
@@ -1115,7 +1114,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ getSystem(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name, factory.createRegionAttributes());
@@ -1145,7 +1144,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("mcast-port", "0");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ getSystem(config);
PoolManager.createFactory().addServer(host0, port).setSubscriptionEnabled(true).create("clientPool");
getCache();
AttributesFactory factory = new AttributesFactory();
@@ -1219,7 +1218,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ getSystem(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
final Region region = createRegion(name, factory.createRegionAttributes());
@@ -1256,7 +1255,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
Properties config = new Properties();
config.setProperty("mcast-port", "0");
- system = (InternalDistributedSystem) DistributedSystem.connect(config);
+ getSystem(config);
PoolManager.createFactory().addServer(host0, port).setSubscriptionEnabled(true).create("clientPool");
getCache();
AttributesFactory factory = new AttributesFactory();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
index 85ae9aa..8b392cb 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
@@ -86,8 +86,7 @@ public class ResourceManagerWithQueryMonitorDUnitTest extends ClientServerTestCa
}
@Override
- public void setUp() throws Exception {
- super.setUp();
+ public final void postSetUpClientServerTestCase() throws Exception {
Invoke.invokeInEveryVM(this.setHeapMemoryMonitorTestMode);
IgnoredException.addIgnoredException("above heap critical threshold");
IgnoredException.addIgnoredException("below heap critical threshold");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java
index 6cbbef2..c6c103f 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest.java
@@ -91,7 +91,7 @@ public class ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest extends
}
@Override
- public void setUp() throws Exception {
+ public final void preSetUp() throws Exception {
Invoke.invokeInEveryVM(new CacheSerializableRunnable("Set INPLACE_OBJECT_MODIFICATION false") {
@Override
@@ -100,7 +100,6 @@ public class ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest extends
IndexManager.INPLACE_OBJECT_MODIFICATION_FOR_TEST = true;
}
});
- super.setUp();
}
/**
@@ -108,7 +107,7 @@ public class ConcurrentIndexUpdateWithInplaceObjectModFalseDUnitTest extends
* (mainly because we want to destroy any existing PartitionedRegions)
*/
@Override
- protected final void preTearDown() throws Exception {
+ public final void preTearDown() throws Exception {
Invoke.invokeInEveryVM(new CacheSerializableRunnable("Set INPLACE_OBJECT_MODIFICATION false") {
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/ConcurrentIndexUpdateWithoutWLDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/ConcurrentIndexUpdateWithoutWLDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/ConcurrentIndexUpdateWithoutWLDUnitTest.java
index 2ac564a..4cf42de 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/ConcurrentIndexUpdateWithoutWLDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/ConcurrentIndexUpdateWithoutWLDUnitTest.java
@@ -93,9 +93,9 @@ public class ConcurrentIndexUpdateWithoutWLDUnitTest extends
* (mainly because we want to destroy any existing PartitionedRegions)
*/
@Override
- protected final void preTearDown() throws Exception {
- Invoke.invokeInEveryVM(ConcurrentIndexUpdateWithoutWLDUnitTest.class, "destroyRegions");
- Invoke.invokeInEveryVM(CacheTestCase.class, "closeCache");
+ public final void preTearDown() throws Exception {
+ Invoke.invokeInEveryVM(() -> ConcurrentIndexUpdateWithoutWLDUnitTest.destroyRegions());
+ Invoke.invokeInEveryVM(() -> CacheTestCase.closeCache());
}
public static synchronized void destroyRegions() {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/CopyOnReadIndexDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/CopyOnReadIndexDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/CopyOnReadIndexDUnitTest.java
index d44c7f6..18c73dc 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/CopyOnReadIndexDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/CopyOnReadIndexDUnitTest.java
@@ -59,13 +59,12 @@ public class CopyOnReadIndexDUnitTest extends CacheTestCase {
VM vm1;
VM vm2;
-
public CopyOnReadIndexDUnitTest(String name) {
super(name);
}
- public void setUp() throws Exception {
- super.setUp();
+ @Override
+ public final void postSetUp() throws Exception {
getSystem();
Invoke.invokeInEveryVM(new SerializableRunnable("getSystem") {
public void run() {
@@ -79,11 +78,10 @@ public class CopyOnReadIndexDUnitTest extends CacheTestCase {
}
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
+ public final void preTearDownCacheTestCase() throws Exception {
disconnectAllFromDS();
}
-
-
+
//test different queries against partitioned region
public void testPRQueryOnLocalNode() throws Exception {
QueryTestUtils utils = new QueryTestUtils();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/MultiIndexCreationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/MultiIndexCreationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/MultiIndexCreationDUnitTest.java
index cea00c1..e18e720 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/MultiIndexCreationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/MultiIndexCreationDUnitTest.java
@@ -172,14 +172,14 @@ public class MultiIndexCreationDUnitTest extends CacheTestCase {
}
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
+ public final void preTearDownCacheTestCase() throws Exception {
hooked = false;
- Invoke.invokeInEveryVM(CacheTestCase.class, "disconnectFromDS");
+ Invoke.invokeInEveryVM(() -> disconnectFromDS());
}
@Override
- protected final void postTearDownCacheTestCase() throws Exception {
- Invoke.invokeInEveryVM(QueryObserverHolder.class, "reset");
+ public final void postTearDownCacheTestCase() throws Exception {
+ Invoke.invokeInEveryVM(() -> QueryObserverHolder.reset());
}
private static class MultiIndexCreationTestHook implements TestHook {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PutAllWithIndexPerfDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PutAllWithIndexPerfDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PutAllWithIndexPerfDUnitTest.java
index 960bd4e..053f87a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PutAllWithIndexPerfDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/PutAllWithIndexPerfDUnitTest.java
@@ -63,13 +63,13 @@ public class PutAllWithIndexPerfDUnitTest extends CacheTestCase {
super(name);
}
- public void setUp() throws Exception {
- super.setUp();
+ @Override
+ public final void postSetUp() throws Exception {
disconnectAllFromDS();
}
@Override
- protected final void postTearDownCacheTestCase() throws Exception {
+ public final void postTearDownCacheTestCase() throws Exception {
disconnectAllFromDS();
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/ParallelSnapshotDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/ParallelSnapshotDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/ParallelSnapshotDUnitTest.java
index ea95558..5b123f2 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/ParallelSnapshotDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/ParallelSnapshotDUnitTest.java
@@ -155,14 +155,14 @@ public class ParallelSnapshotDUnitTest extends CacheTestCase {
}
return null;
}
-
- public void setUp() throws Exception {
- super.setUp();
+
+ @Override
+ public final void postSetUp() throws Exception {
loadCache();
}
@Override
- protected final void postTearDownCacheTestCase() throws Exception {
+ public final void postTearDownCacheTestCase() throws Exception {
File[] snaps = new File(".").listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotByteArrayDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotByteArrayDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotByteArrayDUnitTest.java
index 43fc2e3..eae745a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotByteArrayDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotByteArrayDUnitTest.java
@@ -105,13 +105,13 @@ public class SnapshotByteArrayDUnitTest extends CacheTestCase {
}
}
- public void setUp() throws Exception {
- super.setUp();
+ @Override
+ public final void postSetUp() throws Exception {
loadCache();
}
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
+ public final void preTearDownCacheTestCase() throws Exception {
if (snap.exists()) {
snap.delete();
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotDUnitTest.java
index 764f276..06bfecc 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotDUnitTest.java
@@ -158,9 +158,9 @@ public class SnapshotDUnitTest extends CacheTestCase {
assertTrue(caughtException);
}
-
- public void setUp() throws Exception {
- super.setUp();
+
+ @Override
+ public final void postSetUp() throws Exception {
loadCache();
RegionGenerator rgen = new RegionGenerator();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotPerformanceDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotPerformanceDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotPerformanceDUnitTest.java
index 83fc231..c5b0e55 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotPerformanceDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotPerformanceDUnitTest.java
@@ -100,9 +100,9 @@ public class SnapshotPerformanceDUnitTest extends CacheTestCase {
LogWriterUtils.getLogWriter().info("SNP: Import entry rate: " + eps + " entries / sec");
LogWriterUtils.getLogWriter().info("SNP: Import data rate: " + mbps + " MB / sec");
}
-
- public void setUp() throws Exception {
- super.setUp();
+
+ @Override
+ public final void postSetUp() throws Exception {
createCache();
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheMapTxnDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheMapTxnDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheMapTxnDUnitTest.java
index f7e1739..0be86e2 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheMapTxnDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheMapTxnDUnitTest.java
@@ -57,17 +57,20 @@ public class CacheMapTxnDUnitTest extends DistributedTestCase{
}
@Override
- public void setUp() throws Exception {
- super.setUp();
+ public final void postSetUp() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
vm0.invoke(() -> CacheMapTxnDUnitTest.createCache());
vm1.invoke(() -> CacheMapTxnDUnitTest.createCache());
+ postSetUpCacheMapTxnDUnitTest();
+ }
+
+ protected void postSetUpCacheMapTxnDUnitTest() throws Exception {
}
@Override
- protected final void preTearDown() throws Exception {
+ public final void preTearDown() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/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..b326c58 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
@@ -16,53 +16,8 @@
*/
package com.gemstone.gemfire.cache30;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.logging.log4j.Logger;
-
-import com.gemstone.gemfire.InternalGemFireError;
-import com.gemstone.gemfire.SystemFailure;
-import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheException;
-import com.gemstone.gemfire.cache.CacheExistsException;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.CacheTransactionManager;
-import com.gemstone.gemfire.cache.ExpirationAttributes;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionAttributes;
-import com.gemstone.gemfire.cache.RegionExistsException;
-import com.gemstone.gemfire.cache.TimeoutException;
-import com.gemstone.gemfire.cache.client.ClientCache;
-import com.gemstone.gemfire.cache.client.ClientCacheFactory;
-import com.gemstone.gemfire.cache.client.PoolManager;
-import com.gemstone.gemfire.distributed.internal.DistributionMessageObserver;
-import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
-import com.gemstone.gemfire.internal.FileUtil;
-import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.internal.cache.HARegion;
-import com.gemstone.gemfire.internal.cache.InternalRegionArguments;
-import com.gemstone.gemfire.internal.cache.LocalRegion;
-import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
-import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
-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.VM;
-import com.gemstone.gemfire.test.dunit.Wait;
-import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit3CacheTestCase;
/**
* The abstract superclass of tests that require the creation of a
@@ -71,583 +26,9 @@ import com.gemstone.gemfire.test.dunit.WaitCriterion;
* @author David Whitlock
* @since 3.0
*/
-public abstract class CacheTestCase extends DistributedTestCase {
- private static final Logger logger = LogService.getLogger();
-
- /** The Cache from which regions are obtained
- *
- * All references synchronized via <code>CacheTestCase.class</code>
- * */
- // static so it doesn't get serialized with SerializableRunnable inner classes
- protected static Cache cache;
-
- //////// Constructors
+public abstract class CacheTestCase extends JUnit3CacheTestCase {
public CacheTestCase(String name) {
super(name);
}
-
- //////// Helper methods
- /**
- * Creates the <code>Cache</code> for this test
- */
- private void createCache() {
- createCache(false);
- }
-
- private void createCache(boolean client) {
- createCache(client, null);
- }
-
- private void createCache(boolean client, CacheFactory cf) {
- synchronized(CacheTestCase.class) {
- try {
- System.setProperty("gemfire.DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE", "true");
- Cache c;
- if (client) {
- c = (Cache)new ClientCacheFactory(getSystem().getProperties()).create();
- } else {
- if(cf == null) {
- c = CacheFactory.create(getSystem());
- } else {
- Properties props = getSystem().getProperties();
- for(Map.Entry entry : props.entrySet()) {
- cf.set((String) entry.getKey(), (String)entry.getValue());
- }
- c = cf.create();
- }
- }
- cache = c;
- } catch (CacheExistsException e) {
- Assert.fail("the cache already exists", e);
-
- } catch (RuntimeException ex) {
- throw ex;
-
- } catch (Exception ex) {
- Assert.fail("Checked exception while initializing cache??", ex);
- } finally {
- System.clearProperty("gemfire.DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE");
- }
- }
- }
-
- /**
- * Creates the <code>Cache</code> for this test that is not connected
- * to other members
- */
- public Cache createLonerCache() {
- synchronized(CacheTestCase.class) {
- try {
- System.setProperty("gemfire.DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE", "true");
- Cache c = CacheFactory.create(getLonerSystem());
- cache = c;
- } catch (CacheExistsException e) {
- Assert.fail("the cache already exists", e);
-
- } catch (RuntimeException ex) {
- throw ex;
-
- } catch (Exception ex) {
- Assert.fail("Checked exception while initializing cache??", ex);
- } finally {
- System.clearProperty("gemfire.DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE");
- }
- return cache;
- }
- }
-
- /**
- * Creates the <code>Cache</code> for this test that is not connected
- * to other members.
- * Added specifically to test scenario of defect #47181.
- */
- public Cache createLonerCacheWithEnforceUniqueHost() {
- synchronized(CacheTestCase.class) {
- try {
- System.setProperty("gemfire.DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE", "true");
- Cache c = CacheFactory.create(getLonerSystemWithEnforceUniqueHost());
- cache = c;
- } catch (CacheExistsException e) {
- Assert.fail("the cache already exists", e);
-
- } catch (RuntimeException ex) {
- throw ex;
-
- } catch (Exception ex) {
- Assert.fail("Checked exception while initializing cache??", ex);
- } finally {
- System.clearProperty("gemfire.DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE");
- }
- return cache;
- }
- }
-
- /**
- * 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() {
-// getLogWriter().info("before closeCache");
- closeCache();
-// getLogWriter().info("before TestCacheCreation");
- cache = new TestCacheCreation();
-// getLogWriter().info("after TestCacheCreation");
- }
- /**
- * 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) {
- synchronized(CacheTestCase.class) {
- File file = new File(name + "-cache.xml");
- try {
- PrintWriter pw = new PrintWriter(new FileWriter(file), true);
- CacheXmlGenerator.generate(cache, pw);
- pw.close();
- } catch (IOException ex) {
- Assert.fail("IOException during cache.xml generation to " + file, ex);
- }
- cache = null;
- GemFireCacheImpl.testCacheXml = file;
- try {
- createCache();
- } finally {
- GemFireCacheImpl.testCacheXml = null;
- }
- }
- }
-
- /**
- * 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) {
- synchronized(CacheTestCase.class) {
- File dir = new File("XML_" + xmlVersion);
- dir.mkdirs();
- File file = new File(dir, name + ".xml");
- try {
- PrintWriter pw = new PrintWriter(new FileWriter(file), true);
- CacheXmlGenerator.generate(cache, pw, useSchema, xmlVersion);
- pw.close();
- } catch (IOException ex) {
- Assert.fail("IOException during cache.xml generation to " + file, ex);
- }
- cache = null;
- GemFireCacheImpl.testCacheXml = file;
- try {
- createCache();
- } finally {
- GemFireCacheImpl.testCacheXml = null;
- }
- }
- }
-
- /**
- * Return a cache for obtaining regions, created lazily.
- */
- public final Cache getCache() {
- return getCache(false);
- }
-
- public final Cache getCache(CacheFactory cf) {
- return getCache(false, cf);
- }
-
- public final Cache getCache(boolean client) {
- return getCache(client, null);
- }
-
- public final Cache getCache(boolean client, CacheFactory cf) {
- synchronized (CacheTestCase.class) {
- final GemFireCacheImpl gfCache = GemFireCacheImpl.getInstance();
- if (gfCache != null && !gfCache.isClosed()
- && gfCache.getCancelCriterion().cancelInProgress() != null) {
- Wait.waitForCriterion(new WaitCriterion() {
-
- public boolean done() {
- return gfCache.isClosed();
- }
-
- public String description() {
- return "waiting for cache to close";
- }
- }, 30 * 1000, 300, true);
- }
- if (cache == null || cache.isClosed()) {
- cache = null;
- createCache(client, cf);
- }
- if (client && cache != null) {
- IgnoredException.addIgnoredException("java.net.ConnectException");
- }
- return cache;
- }
- }
-
- /**
- * creates a client cache from the factory if one does not already exist
- * @since 6.5
- * @param factory
- * @return the client cache
- */
- public final ClientCache getClientCache(ClientCacheFactory factory) {
- synchronized (CacheTestCase.class) {
- final GemFireCacheImpl gfCache = GemFireCacheImpl.getInstance();
- if (gfCache != null && !gfCache.isClosed()
- && gfCache.getCancelCriterion().cancelInProgress() != null) {
- Wait.waitForCriterion(new WaitCriterion() {
-
- public boolean done() {
- return gfCache.isClosed();
- }
-
- public String description() {
- return "waiting for cache to close";
- }
- }, 30 * 1000, 300, true);
- }
- if (cache == null || cache.isClosed()) {
- cache = null;
- disconnectFromDS();
- cache = (Cache)factory.create();
- }
- if (cache != null) {
- IgnoredException.addIgnoredException("java.net.ConnectException");
- }
- return (ClientCache)cache;
- }
- }
-
- /**
- * same as {@link #getCache()} but with casting
- */
- public final GemFireCacheImpl getGemfireCache() {
- return (GemFireCacheImpl)getCache();
- }
- public static synchronized final boolean hasCache() {
- return cache != null;
- }
-
- /**
- * Return current cache without creating one.
- */
- public static synchronized final Cache basicGetCache() {
- return cache;
- }
-
- public static synchronized void disconnectFromDS() {
- closeCache();
- DistributedTestCase.disconnectFromDS();
- }
-
- /** Close the cache */
- public static synchronized void closeCache() {
- //Workaround for that fact that some classes are now extending
- //CacheTestCase but not using it properly.
- if(cache == null) {
- cache = GemFireCacheImpl.getInstance();
- }
- try {
- if (cache != null) {
- try {
- if (!cache.isClosed()) {
- if (cache instanceof GemFireCacheImpl) {
- CacheTransactionManager txMgr = ((GemFireCacheImpl)cache).getTxManager();
- if (txMgr != null) {
- if (txMgr.exists()) {
- try {
- // make sure we cleanup this threads txid stored in a thread local
- txMgr.rollback();
- }catch(Exception ignore) {
-
- }
- }
- }
- }
- cache.close();
- }
- }
- finally {
- cache = null;
- }
- } // cache != null
- } finally {
- //Make sure all pools are closed, even if we never
- //created a cache
- PoolManager.close(false);
- }
- }
-
- /** Closed the cache in all VMs. */
- protected void closeAllCache() {
- closeCache();
- Invoke.invokeInEveryVM(CacheTestCase.class, "closeCache");
- }
-
- @Override
- protected final void preTearDown() throws Exception {
- preTearDownCacheTestCase();
-
- // locally destroy all root regions and close the cache
- remoteTearDown();
- // Now invoke it in every VM
- for (int h = 0; h < Host.getHostCount(); h++) {
- Host host = Host.getHost(h);
- for (int v = 0; v < host.getVMCount(); v++) {
- VM vm = host.getVM(v);
- vm.invoke(()->remoteTearDown());
- }
- }
-
- postTearDownCacheTestCase();
- }
-
- protected void preTearDownCacheTestCase() throws Exception {
- }
-
- protected void postTearDownCacheTestCase() throws Exception {
- }
-
- /**
- * Local destroy all root regions and close the cache.
- */
- protected synchronized static void remoteTearDown() {
- try {
- DistributionMessageObserver.setInstance(null);
- destroyRegions(cache);
- }
- finally {
- try {
- closeCache();
- }
- finally {
- try {
- cleanDiskDirs();
- } catch(Exception e) {
- LogWriterUtils.getLogWriter().error("Error cleaning disk dirs", e);
- }
- }
- }
- }
-
- /**
- * Returns a region with the given name and attributes
- */
- public final Region createRegion(String name,
- RegionAttributes attrs)
- throws CacheException {
- return createRegion(name, "root", attrs);
- }
-
- /**
- * Provide any internal region arguments, typically required when
- * internal use (aka meta-data) regions are needed.
- * @return internal arguements, which may be null. If null, then default
- * InternalRegionArguments are used to construct the Region
- */
- public InternalRegionArguments getInternalRegionArguments()
- {
- return null;
- }
-
- final public Region createRegion(String name, String rootName,
- RegionAttributes attrs)
- throws CacheException {
- Region root = getRootRegion(rootName);
- if (root == null) {
- // don't put listeners on root region
- RegionAttributes rootAttrs = attrs;
- AttributesFactory fac = new AttributesFactory(attrs);
- ExpirationAttributes expiration = ExpirationAttributes.DEFAULT;
-
- // fac.setCacheListener(null);
- fac.setCacheLoader(null);
- fac.setCacheWriter(null);
- fac.setPoolName(null);
- fac.setPartitionAttributes(null);
- fac.setRegionTimeToLive(expiration);
- fac.setEntryTimeToLive(expiration);
- fac.setRegionIdleTimeout(expiration);
- fac.setEntryIdleTimeout(expiration);
- rootAttrs = fac.create();
- root = createRootRegion(rootName, rootAttrs);
- }
-
- InternalRegionArguments internalArgs = getInternalRegionArguments();
- if (internalArgs == null) {
- return root.createSubregion(name, attrs);
- } else {
- try {
- LocalRegion lr = (LocalRegion) root;
- return lr.createSubregion(name, attrs, internalArgs);
- } catch (IOException ioe) {
- AssertionError assErr = new AssertionError("unexpected exception");
- assErr.initCause(ioe);
- throw assErr;
- } catch (ClassNotFoundException cnfe) {
- AssertionError assErr = new AssertionError("unexpected exception");
- assErr.initCause(cnfe);
- throw assErr;
- }
- }
- }
-
- public final Region getRootRegion() {
- return getRootRegion("root");
- }
-
- public final Region getRootRegion(String rootName) {
- return getCache().getRegion(rootName);
- }
-
- protected final Region createRootRegion(RegionAttributes attrs)
- throws RegionExistsException, TimeoutException {
- return createRootRegion("root", attrs);
- }
-
- public final Region createRootRegion(String rootName, RegionAttributes attrs)
- throws RegionExistsException, TimeoutException {
- return getCache().createRegion(rootName, attrs);
- }
- public final Region createExpiryRootRegion(String rootName, RegionAttributes attrs)
- throws RegionExistsException, TimeoutException {
- System.setProperty(LocalRegion.EXPIRY_MS_PROPERTY, "true");
- try {
- return createRootRegion(rootName, attrs);
- } finally {
- System.getProperties().remove(LocalRegion.EXPIRY_MS_PROPERTY);
- }
- }
-
-
- /**
- * send an unordered message requiring an ack to all connected members
- * in order to flush the unordered communication channel
- */
- public void sendUnorderedMessageToAll() {
- //if (getCache() instanceof distcache.gemfire.GemFireCacheImpl) {
- try {
- com.gemstone.gemfire.distributed.internal.HighPriorityAckedMessage msg = new com.gemstone.gemfire.distributed.internal.HighPriorityAckedMessage();
- msg.send(InternalDistributedSystem.getConnectedInstance().getDM().getNormalDistributionManagerIds(), false);
- }
- catch (Exception e) {
- throw new RuntimeException("Unable to send unordered message due to exception", e);
- }
- //}
- }
-
- /**
- * send an unordered message requiring an ack to all connected admin members
- * in order to flush the unordered communication channel
- */
-// public void sendUnorderedMessageToAdminMembers() {
-// //if (getCache() instanceof distcache.gemfire.GemFireCacheImpl) {
-// try {
-// com.gemstone.gemfire.distributed.internal.HighPriorityAckedMessage msg = new com.gemstone.gemfire.distributed.internal.HighPriorityAckedMessage();
-// msg.send(DistributedSystemHelper.getAdminMembers(), false);
-// }
-// catch (Exception e) {
-// throw new RuntimeException("Unable to send unordered message due to exception", e);
-// }
-// //}
-// }
-
- /**
- * send an ordered message requiring an ack to all connected members
- * in order to flush the ordered communication channel
- */
- public void sendSerialMessageToAll() {
- if (getCache() instanceof GemFireCacheImpl) {
- try {
- com.gemstone.gemfire.distributed.internal.SerialAckedMessage msg = new com.gemstone.gemfire.distributed.internal.SerialAckedMessage();
- msg.send(InternalDistributedSystem.getConnectedInstance().getDM().getNormalDistributionManagerIds(), false);
- }
- catch (Exception e) {
- throw new RuntimeException("Unable to send serial message due to exception", e);
- }
- }
- }
-
- /**
- * @deprecated Use DistributedTestCase.addExpectedException
- */
- @Deprecated
- protected CacheSerializableRunnable addExceptionTag1(final String expectedException) {
- CacheSerializableRunnable addExceptionTag = new CacheSerializableRunnable(
- "addExceptionTag") {
- public void run2()
- {
- getCache().getLogger().info(
- "<ExpectedException action=add>" + expectedException
- + "</ExpectedException>");
- }
- };
-
- return addExceptionTag;
- }
-
- /**
- * @deprecated Use DistributedTestCase.addExpectedException
- */
- @Deprecated
- protected CacheSerializableRunnable removeExceptionTag1(final String expectedException) {
- CacheSerializableRunnable removeExceptionTag = new CacheSerializableRunnable(
- "removeExceptionTag") {
- public void run2() throws CacheException {
- getCache().getLogger().info(
- "<ExpectedException action=remove>" + expectedException
- + "</ExpectedException>");
- }
- };
- return removeExceptionTag;
- }
-
- /**
- * Used to generate a cache.xml. Basically just a CacheCreation
- * with a few more methods implemented.
- */
- static class TestCacheCreation extends CacheCreation {
- private boolean closed = false;
- @Override
- public void close() {
- this.closed = true;
- }
- @Override
- public boolean isClosed() {
- return this.closed;
- }
- }
-
- public static File getDiskDir() {
- int vmNum = VM.getCurrentVMNum();
- File dir = new File("diskDir", "disk" + String.valueOf(vmNum)).getAbsoluteFile();
- dir.mkdirs();
- return dir;
- }
-
- /**
- * Return a set of disk directories
- * for persistence tests. These directories
- * will be automatically cleaned up
- * on test case closure.
- */
- public static File[] getDiskDirs() {
- return new File[] {getDiskDir()};
- }
-
- public static void cleanDiskDirs() throws IOException {
- FileUtil.delete(getDiskDir());
- File[] defaultStoreFiles = new File(".").listFiles(new FilenameFilter() {
-
- public boolean accept(File dir, String name) {
- return name.startsWith("BACKUPDiskStore-" + System.getProperty("vmid"));
- }
- });
-
- for(File file: defaultStoreFiles) {
- FileUtil.delete(file);
- }
- }
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlTestCase.java
index dd127cb..8c9776e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXmlTestCase.java
@@ -44,18 +44,18 @@ public class CacheXmlTestCase extends CacheTestCase {
super(name);
}
- public void setUp() throws Exception {
- super.setUp();
+ @Override
+ public final void postSetUp() throws Exception {
disconnectAllFromDS();
}
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
+ public final void preTearDownCacheTestCase() throws Exception {
this.xmlFile = null;
}
@Override
- protected final void postTearDownCacheTestCase() throws Exception {
+ public final void postTearDownCacheTestCase() throws Exception {
disconnectAllFromDS();
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CachedAllEventsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CachedAllEventsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CachedAllEventsDUnitTest.java
index c3f97f7..6ffc53d 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CachedAllEventsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CachedAllEventsDUnitTest.java
@@ -16,6 +16,8 @@
*/
package com.gemstone.gemfire.cache30;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.CacheException;
import com.gemstone.gemfire.cache.DataPolicy;
@@ -27,6 +29,10 @@ import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.test.dunit.Host;
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 org.junit.Test;
+import org.junit.experimental.categories.Category;
/**
* Make sure that create are distributed and done in
@@ -35,15 +41,8 @@ import com.gemstone.gemfire.test.dunit.VM;
* @author darrel
* @since 5.0
*/
-public class CachedAllEventsDUnitTest extends CacheTestCase {
-
-// private transient Region r;
-// private transient DistributedMember otherId;
-// private transient int invokeCount;
-
- public CachedAllEventsDUnitTest(String name) {
- super(name);
- }
+@Category(DistributedTest.class)
+public class CachedAllEventsDUnitTest extends JUnit4CacheTestCase {
private VM getOtherVm() {
Host host = Host.getHost(0);
@@ -75,8 +74,6 @@ public class CachedAllEventsDUnitTest extends CacheTestCase {
return InternalDistributedSystem.getAnyInstance().getDistributedMember();
}
- ////////////////////// Test Methods //////////////////////
-
/**
* make sure a remote create will be done in a NORMAL+ALL region
* @param rmtCreate is true if create should happen in remote region
@@ -98,13 +95,18 @@ public class CachedAllEventsDUnitTest extends CacheTestCase {
assertEquals(false, r1.containsKey("key"));
}
}
- // TODO these are never used
+
+ @Test
public void testRemoteCreate_CAE() throws CacheException {
remoteCreate(DataPolicy.NORMAL, InterestPolicy.ALL, true);
}
+
+ @Test
public void testRemoteCreate_CAER() throws CacheException {
remoteCreate(DataPolicy.REPLICATE, InterestPolicy.CACHE_CONTENT, true);
}
+
+ @Test
public void testRemoteCreate_C() throws CacheException {
remoteCreate(DataPolicy.NORMAL, InterestPolicy.CACHE_CONTENT, false);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClearMultiVmCallBkDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClearMultiVmCallBkDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClearMultiVmCallBkDUnitTest.java
index e748a42..031fd76 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClearMultiVmCallBkDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClearMultiVmCallBkDUnitTest.java
@@ -60,10 +60,8 @@ public class ClearMultiVmCallBkDUnitTest extends DistributedTestCase{
static CacheTransactionManager cacheTxnMgr;
static boolean afterClear=false;
-
@Override
- public void setUp() throws Exception {
- super.setUp();
+ public final void postSetUp() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -73,7 +71,7 @@ public class ClearMultiVmCallBkDUnitTest extends DistributedTestCase{
}
@Override
- protected final void preTearDown() throws Exception {
+ public final void preTearDown() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClearMultiVmDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClearMultiVmDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClearMultiVmDUnitTest.java
index 5f9450b..9aa4e95 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClearMultiVmDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClearMultiVmDUnitTest.java
@@ -66,8 +66,7 @@ public class ClearMultiVmDUnitTest extends DistributedTestCase{
static CacheTransactionManager cacheTxnMgr;
@Override
- public void setUp() throws Exception {
- super.setUp();
+ public final void postSetUp() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -76,7 +75,7 @@ public class ClearMultiVmDUnitTest extends DistributedTestCase{
}
@Override
- protected final void preTearDown() throws Exception {
+ public final void preTearDown() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientMembershipDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientMembershipDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientMembershipDUnitTest.java
index 19ce28d..02fa580 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientMembershipDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientMembershipDUnitTest.java
@@ -89,17 +89,13 @@ public class ClientMembershipDUnitTest extends ClientServerTestCase {
}
@Override
- public void setUp() throws Exception {
- super.setUp();
- }
-
- @Override
- protected void postTearDown() throws Exception {
+ public final void postTearDownCacheTestCase() throws Exception {
Invoke.invokeInEveryVM((() -> cleanup()));
}
public static void cleanup() {
properties = null;
+ InternalClientMembership.unregisterAllListeners();
}
private void waitForAcceptsInProgressToBe(final int target)
@@ -1082,7 +1078,7 @@ public class ClientMembershipDUnitTest extends ClientServerTestCase {
Pool pool = ClientServerTestCase.configureConnectionPool(factory, NetworkUtils.getServerHostName(host), ports, true, -1, 2, null);
createRegion(name, factory.create());
assertNotNull(getRootRegion().getSubregion(name));
- assertTrue(s == system); // see geode-1078
+ assertTrue(s == basicGetSystem()); // see geode-1078
return getMemberId();
}
};
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientRegisterInterestDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientRegisterInterestDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientRegisterInterestDUnitTest.java
index f7e2277..ce8783b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientRegisterInterestDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientRegisterInterestDUnitTest.java
@@ -46,7 +46,7 @@ public class ClientRegisterInterestDUnitTest extends ClientServerTestCase {
}
@Override
- protected final void postTearDownCacheTestCase() throws Exception {
+ public final void postTearDownCacheTestCase() throws Exception {
disconnectAllFromDS(); // cleans up bridge server and client and lonerDS
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientServerCCEDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientServerCCEDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientServerCCEDUnitTest.java
index fb319b6..1355571 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientServerCCEDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientServerCCEDUnitTest.java
@@ -69,7 +69,7 @@ public class ClientServerCCEDUnitTest extends CacheTestCase {
}
@Override
- protected final void preTearDownCacheTestCase() {
+ public final void preTearDownCacheTestCase() {
disconnectAllFromDS();
HARegionQueue.setMessageSyncInterval(HARegionQueue.DEFAULT_MESSAGE_SYNC_INTERVAL);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientServerTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientServerTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientServerTestCase.java
index d9d8858..a3968ea 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientServerTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ClientServerTestCase.java
@@ -56,14 +56,17 @@ public class ClientServerTestCase extends CacheTestCase {
public static boolean AUTO_LOAD_BALANCE = false;
@Override
- public void setUp() throws Exception {
- super.setUp();
+ public final void postSetUp() throws Exception {
// this makes sure we don't have any connection left over from previous tests
disconnectAllFromDS();
+ postSetUpClientServerTestCase();
+ }
+
+ protected void postSetUpClientServerTestCase() throws Exception {
}
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
+ public final void preTearDownCacheTestCase() throws Exception {
preTearDownClientServerTestCase();
// this makes sure we don't leave anything for the next tests
disconnectAllFromDS();
@@ -292,14 +295,14 @@ public class ClientServerTestCase extends CacheTestCase {
WaitCriterion w = new WaitCriterion() {
public String description() {
- return "client never finished connecting: " + system.getMemberId();
+ return "client never finished connecting: " + getSystemStatic().getMemberId();
}
public boolean done() {
// getLogWriter().warning("checking member id " + system.getMemberId() +
// " for member " + system.getDistributedMember() + " hash " +
// System.identityHashCode(system.getDistributedMember()));
- return system.getDistributedMember().getPort() > 0;
+ return getSystemStatic().getDistributedMember().getPort() > 0;
}
};
@@ -307,7 +310,7 @@ public class ClientServerTestCase extends CacheTestCase {
int interval = 100;
boolean throwException = true;
Wait.waitForCriterion(w, waitMillis, interval, throwException);
- return system.getDistributedMember();
+ return getSystemStatic().getDistributedMember();
}
protected static DistributedMember getDistributedMember() {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistAckMapMethodsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistAckMapMethodsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistAckMapMethodsDUnitTest.java
index cf6226d..9284e26 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistAckMapMethodsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistAckMapMethodsDUnitTest.java
@@ -71,8 +71,7 @@ public class DistAckMapMethodsDUnitTest extends DistributedTestCase{
}
@Override
- public void setUp() throws Exception {
- super.setUp();
+ public final void postSetUp() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -81,7 +80,7 @@ public class DistAckMapMethodsDUnitTest extends DistributedTestCase{
}
@Override
- protected final void preTearDown() throws Exception {
+ public final void preTearDown() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckOverflowRegionCCEOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckOverflowRegionCCEOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckOverflowRegionCCEOffHeapDUnitTest.java
index 2323b0e..2ab2446 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckOverflowRegionCCEOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckOverflowRegionCCEOffHeapDUnitTest.java
@@ -39,7 +39,7 @@ public class DistributedAckOverflowRegionCCEOffHeapDUnitTest extends Distributed
}
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
+ public final void preTearDownCacheTestCase() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckPersistentRegionCCEOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckPersistentRegionCCEOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckPersistentRegionCCEOffHeapDUnitTest.java
index 52a4313..718ca18 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckPersistentRegionCCEOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckPersistentRegionCCEOffHeapDUnitTest.java
@@ -39,7 +39,7 @@ public class DistributedAckPersistentRegionCCEOffHeapDUnitTest extends Distribut
}
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
+ public final void preTearDownCacheTestCase() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEOffHeapDUnitTest.java
index 1c1cbaf..c8fc191 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionCCEOffHeapDUnitTest.java
@@ -39,7 +39,7 @@ public class DistributedAckRegionCCEOffHeapDUnitTest extends DistributedAckRegio
}
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
+ public final void preTearDownCacheTestCase() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionOffHeapDUnitTest.java
index cbf8367..f218f14 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedAckRegionOffHeapDUnitTest.java
@@ -39,7 +39,7 @@ public class DistributedAckRegionOffHeapDUnitTest extends DistributedAckRegionDU
}
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
+ public final void preTearDownCacheTestCase() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java
index 01632a4..011b8f5 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java
@@ -61,13 +61,12 @@ public class DistributedMulticastRegionDUnitTest extends CacheTestCase {
}
@Override
- public void setUp() throws Exception {
+ public final void preSetUp() throws Exception {
clean();
- super.setUp();
}
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
+ public final void preTearDownCacheTestCase() throws Exception {
clean();
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEOffHeapDUnitTest.java
index c068876..b49d8f5 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionCCEOffHeapDUnitTest.java
@@ -39,7 +39,7 @@ public class DistributedNoAckRegionCCEOffHeapDUnitTest extends DistributedNoAckR
}
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
+ public final void preTearDownCacheTestCase() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionOffHeapDUnitTest.java
index e668d3f..c2e22b4 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedNoAckRegionOffHeapDUnitTest.java
@@ -39,7 +39,7 @@ public class DistributedNoAckRegionOffHeapDUnitTest extends DistributedNoAckRegi
}
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
+ public final void preTearDownCacheTestCase() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DynamicRegionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DynamicRegionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DynamicRegionDUnitTest.java
index 19d2bb7..eacb1d1 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DynamicRegionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DynamicRegionDUnitTest.java
@@ -53,15 +53,15 @@ public class DynamicRegionDUnitTest extends CacheTestCase {
// the setUp and tearDown methods need to make sure we don't
// use the ds from previous test and that we don't leave ours around
// for the next test to use.
-
- public void setUp() throws Exception {
+
+ @Override
+ public final void preSetUp() throws Exception {
try {
disconnectAllFromDS();
} finally {
File d = new File("DynamicRegionData" + OSProcess.getId());
d.mkdirs();
DynamicRegionFactory.get().open(new DynamicRegionFactory.Config(d, null));
- super.setUp();
}
}
@@ -73,7 +73,7 @@ public class DynamicRegionDUnitTest extends CacheTestCase {
* </p>
*/
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
+ public final void preTearDownCacheTestCase() throws Exception {
LogWriterUtils.getLogWriter().info("Running tearDown in " + this);
try {
//Asif destroy dynamic regions at the end of the test
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEOffHeapDUnitTest.java
index 653cab2..5362137 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionCCEOffHeapDUnitTest.java
@@ -39,7 +39,7 @@ public class GlobalRegionCCEOffHeapDUnitTest extends GlobalRegionCCEDUnitTest {
}
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
+ public final void preTearDownCacheTestCase() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionOffHeapDUnitTest.java
index c652c55..2f774cc 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/GlobalRegionOffHeapDUnitTest.java
@@ -39,7 +39,7 @@ public class GlobalRegionOffHeapDUnitTest extends GlobalRegionDUnitTest {
}
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
+ public final void preTearDownCacheTestCase() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
index 8127eea..8f4740c 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java
@@ -171,7 +171,6 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
@Override
protected final void postTearDownRegionTestCase() throws Exception {
- DistributedTestCase.cleanupAllVms();
CCRegion = null;
}
@@ -5713,7 +5712,6 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
*/
private static void unregisterAllSerializers() {
DistributedTestUtils.unregisterAllDataSerializersFromAllVms();
- cleanupAllVms();
}
/**
@@ -9128,6 +9126,17 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase {
return CCRegion.getDistributionManager().getDistributionManagerId();
}
+ public void sendSerialMessageToAll() {
+ if (getCache() instanceof GemFireCacheImpl) {
+ try {
+ com.gemstone.gemfire.distributed.internal.SerialAckedMessage msg = new com.gemstone.gemfire.distributed.internal.SerialAckedMessage();
+ msg.send(InternalDistributedSystem.getConnectedInstance().getDM().getNormalDistributionManagerIds(), false);
+ }
+ catch (Exception e) {
+ throw new RuntimeException("Unable to send serial message due to exception", e);
+ }
+ }
+ }
/** a class for testing handling of concurrent delta operations */
static class DeltaValue implements com.gemstone.gemfire.Delta, Serializable {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/OffHeapLRUEvictionControllerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/OffHeapLRUEvictionControllerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/OffHeapLRUEvictionControllerDUnitTest.java
index 0caa7bd..89a721e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/OffHeapLRUEvictionControllerDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/OffHeapLRUEvictionControllerDUnitTest.java
@@ -41,7 +41,7 @@ public class OffHeapLRUEvictionControllerDUnitTest extends
}
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
+ public final void preTearDownCacheTestCase() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionOffHeapDUnitTest.java
index efd42ad..ca4c192 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PartitionedRegionOffHeapDUnitTest.java
@@ -38,7 +38,7 @@ public class PartitionedRegionOffHeapDUnitTest extends PartitionedRegionDUnitTes
}
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
+ public final void preTearDownCacheTestCase() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkRemoteVMDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkRemoteVMDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkRemoteVMDUnitTest.java
index 01a1f42..781dc2d 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkRemoteVMDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkRemoteVMDUnitTest.java
@@ -77,8 +77,7 @@ public class PutAllCallBkRemoteVMDUnitTest extends DistributedTestCase {
static boolean notified = false;
@Override
- public void setUp() throws Exception {
- super.setUp();
+ public final void postSetUp() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -88,7 +87,7 @@ public class PutAllCallBkRemoteVMDUnitTest extends DistributedTestCase {
}
@Override
- protected final void preTearDown() throws Exception {
+ public final void preTearDown() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkSingleVMDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkSingleVMDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkSingleVMDUnitTest.java
index 12337cd..faeb8b3 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkSingleVMDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkSingleVMDUnitTest.java
@@ -67,8 +67,7 @@ public class PutAllCallBkSingleVMDUnitTest extends DistributedTestCase{
static int beforeUpdateputAllcounter = 0;
@Override
- public void setUp() throws Exception {
- super.setUp();
+ public final void postSetUp() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -78,7 +77,7 @@ public class PutAllCallBkSingleVMDUnitTest extends DistributedTestCase{
}
@Override
- protected final void preTearDown() throws Exception {
+ public final void preTearDown() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java
index 4ec8054..7ff73f9 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java
@@ -64,8 +64,7 @@ public class PutAllMultiVmDUnitTest extends DistributedTestCase{
static CacheTransactionManager cacheTxnMgr;
@Override
- public void setUp() throws Exception {
- super.setUp();
+ public final void postSetUp() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -74,7 +73,7 @@ public class PutAllMultiVmDUnitTest extends DistributedTestCase{
}
@Override
- protected final void preTearDown() throws Exception {
+ public final void preTearDown() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java
index 70c7171..a4ba33d 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java
@@ -85,8 +85,7 @@ public class ReconnectDUnitTest extends CacheTestCase
}
@Override
- public void setUp() throws Exception {
- super.setUp();
+ public final void postSetUp() throws Exception {
this.locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
final int locPort = this.locatorPort;
Host.getHost(0).getVM(locatorVMNumber)
@@ -133,7 +132,7 @@ public class ReconnectDUnitTest extends CacheTestCase
}
@Override
- protected final void postTearDownCacheTestCase() throws Exception {
+ public final void postTearDownCacheTestCase() throws Exception {
try {
Host.getHost(0).getVM(locatorVMNumber).invoke(new SerializableRunnable("stop locator") {
public void run() {
@@ -680,8 +679,8 @@ public class ReconnectDUnitTest extends CacheTestCase
getSystem(props);
addReconnectListener();
-
- system.getLogWriter().info("<ExpectedException action=add>"
+
+ basicGetSystem().getLogWriter().info("<ExpectedException action=add>"
+ "CacheClosedException" + "</ExpectedException");
try{
getCache();
@@ -691,7 +690,7 @@ public class ReconnectDUnitTest extends CacheTestCase
LogWriterUtils.getLogWriter().info("Got Expected CancelException ");
}
finally {
- system.getLogWriter().info("<ExpectedException action=remove>"
+ basicGetSystem().getLogWriter().info("<ExpectedException action=remove>"
+ "CacheClosedException" + "</ExpectedException");
}
LogWriterUtils.getLogWriter().fine("roleLoss Sleeping SO call dumprun.sh");
@@ -901,7 +900,7 @@ public class ReconnectDUnitTest extends CacheTestCase
props.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
getSystem(props);
- system.getLogWriter().info("<ExpectedException action=add>"
+ basicGetSystem().getLogWriter().info("<ExpectedException action=add>"
+ "CacheClosedException" + "</ExpectedException");
try {
@@ -1015,7 +1014,7 @@ public class ReconnectDUnitTest extends CacheTestCase
}
// greplogs won't care if you remove an exception that was never added,
// and this ensures that it gets removed.
- system.getLogWriter().info("<ExpectedException action=remove>"
+ basicGetSystem().getLogWriter().info("<ExpectedException action=remove>"
+ "CacheClosedException" + "</ExpectedException");
}
@@ -1139,7 +1138,7 @@ public class ReconnectDUnitTest extends CacheTestCase
// since the system will disconnect and attempt to reconnect
// a new system the old reference to DTC.system can cause
// trouble, so we first null it out.
- DistributedTestCase.system = null;
+ nullSystem();
final DistributedSystem msys = InternalDistributedSystem.getAnyInstance();
final Locator oldLocator = Locator.getLocator();
MembershipManagerHelper.crashDistributedSystem(msys);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectedCacheServerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectedCacheServerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectedCacheServerDUnitTest.java
index 6daf213..8da7dfb 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectedCacheServerDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectedCacheServerDUnitTest.java
@@ -16,6 +16,7 @@
*/
package com.gemstone.gemfire.cache30;
+import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.distributed.internal.membership.gms.MembershipManagerHelper;
import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershipManager;
@@ -32,22 +33,24 @@ public class ReconnectedCacheServerDUnitTest extends CacheTestCase {
private static final long serialVersionUID = 1L;
private boolean addedCacheServer = false;
-
+
+ private Cache cache;
+
@Override
- public void setUp() {
- getCache();
- if (cache.getCacheServers().isEmpty()) {
- cache.addCacheServer();
+ public final void postSetUp() {
+ this.cache = getCache();
+ if (this.cache.getCacheServers().isEmpty()) {
+ this.cache.addCacheServer();
addedCacheServer = true;
}
}
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
- if (addedCacheServer && cache != null && !cache.isClosed()) {
+ public final void preTearDownCacheTestCase() throws Exception {
+ if (addedCacheServer && this.cache != null && !this.cache.isClosed()) {
// since I polluted the cache I should shut it down in order
// to avoid affecting other tests
- cache.close();
+ this.cache.close();
}
}
@@ -55,7 +58,7 @@ public class ReconnectedCacheServerDUnitTest extends CacheTestCase {
// make sure the environment isn't polluted
assertFalse(Boolean.getBoolean("gemfire.autoReconnect-useCacheXMLFile"));
- GemFireCacheImpl gc = (GemFireCacheImpl)cache;
+ GemFireCacheImpl gc = (GemFireCacheImpl)this.cache;
// fool the system into thinking cluster-config is being used
GMSMembershipManager mgr = (GMSMembershipManager)MembershipManagerHelper
@@ -71,7 +74,7 @@ public class ReconnectedCacheServerDUnitTest extends CacheTestCase {
assertFalse(Boolean.getBoolean("gemfire.autoReconnect-useCacheXMLFile"));
- GemFireCacheImpl gc = (GemFireCacheImpl)cache;
+ GemFireCacheImpl gc = (GemFireCacheImpl)this.cache;
// fool the system into thinking cluster-config is being used
GMSMembershipManager mgr = (GMSMembershipManager)MembershipManagerHelper
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java
index 0572c76..9a0554a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java
@@ -62,13 +62,12 @@ public class RegionMembershipListenerDUnitTest extends CacheTestCase {
}
@Override
- public void setUp() throws Exception {
- super.setUp();
+ public final void postSetUp() throws Exception {
DistributedRegion.TEST_HOOK_ADD_PROFILE = true;
}
@Override
- protected final void postTearDownCacheTestCase() throws Exception {
+ public final void postTearDownCacheTestCase() throws Exception {
DistributedRegion.TEST_HOOK_ADD_PROFILE = false;
}
@@ -295,7 +294,7 @@ public class RegionMembershipListenerDUnitTest extends CacheTestCase {
crashCacheOtherVm();
int to = getOpTimeout();
- MembershipManagerHelper.waitForMemberDeparture(system, this.otherId, to);
+ MembershipManagerHelper.waitForMemberDeparture(basicGetSystem(), this.otherId, to);
this.myListener.waitForCrashOp();
{
RegionEvent e = this.myListener.getLastEvent();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/57c8600b/geode-core/src/test/java/com/gemstone/gemfire/cache30/RegionReliabilityTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/RegionReliabilityTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/RegionReliabilityTestCase.java
index 8cc65d3..b630eec 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/RegionReliabilityTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/RegionReliabilityTestCase.java
@@ -85,7 +85,7 @@ public abstract class RegionReliabilityTestCase extends ReliabilityTestCase {
}
@Override
- protected final void preTearDownCacheTestCase() throws Exception {
+ public final void preTearDownCacheTestCase() throws Exception {
DistributedCacheOperation.setBeforePutOutgoing(null);
}