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/02/02 21:21:41 UTC
[34/44] incubator-geode git commit: Refactor dunit
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkSingleVMDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkSingleVMDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkSingleVMDUnitTest.java
index ad35385..42d98e3 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkSingleVMDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkSingleVMDUnitTest.java
@@ -42,6 +42,7 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
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.LogWriterSupport;
import com.gemstone.gemfire.test.dunit.VM;
public class PutAllCallBkSingleVMDUnitTest extends DistributedTestCase{
@@ -73,7 +74,7 @@ public class PutAllCallBkSingleVMDUnitTest extends DistributedTestCase{
VM vm1 = host.getVM(1);
vm0.invoke(PutAllCallBkSingleVMDUnitTest.class, "createCache");
vm1.invoke(PutAllCallBkSingleVMDUnitTest.class, "createCache");
- getLogWriter().fine("Cache created in successfully");
+ LogWriterSupport.getLogWriter().fine("Cache created in successfully");
}
public void tearDown2(){
@@ -266,12 +267,12 @@ public class PutAllCallBkSingleVMDUnitTest extends DistributedTestCase{
static class AfterCreateCallback extends CacheListenerAdapter {
public void afterCreate(EntryEvent event){
putAllcounter++;
- getLogWriter().fine("In afterCreate"+putAllcounter);
+ LogWriterSupport.getLogWriter().fine("In afterCreate"+putAllcounter);
if (event.getOperation().isPutAll()) {
assertEquals("putAllCreateCallback", event.getCallbackArgument());
}
if(putAllcounter == 25){
- getLogWriter().fine("performingtrue");
+ LogWriterSupport.getLogWriter().fine("performingtrue");
afterCreate = true;
}
}
@@ -280,12 +281,12 @@ public class PutAllCallBkSingleVMDUnitTest extends DistributedTestCase{
static class AfterUpdateCallback extends CacheListenerAdapter {
public void afterUpdate(EntryEvent event){
afterUpdateputAllcounter++;
- getLogWriter().fine("In afterUpdate"+afterUpdateputAllcounter);
+ LogWriterSupport.getLogWriter().fine("In afterUpdate"+afterUpdateputAllcounter);
if (event.getOperation().isPutAll()) {
assertEquals("putAllAfterUpdateCallback", event.getCallbackArgument());
}
if(afterUpdateputAllcounter == 5){
- getLogWriter().fine("performingtrue afterUpdate");
+ LogWriterSupport.getLogWriter().fine("performingtrue afterUpdate");
afterUpdate = true;
}
}
@@ -293,12 +294,12 @@ public class PutAllCallBkSingleVMDUnitTest extends DistributedTestCase{
static class BeforeCreateCallback extends CacheWriterAdapter {
public void beforeCreate(EntryEvent event){
beforeCreateputAllcounter++;
- getLogWriter().fine("In beforeCreate"+beforeCreateputAllcounter);
+ LogWriterSupport.getLogWriter().fine("In beforeCreate"+beforeCreateputAllcounter);
if (event.getOperation().isPutAll()) {
assertEquals("putAllCreateCallback", event.getCallbackArgument());
}
if(beforeCreateputAllcounter == 25){
- getLogWriter().fine("performingtrue beforeCreateputAll");
+ LogWriterSupport.getLogWriter().fine("performingtrue beforeCreateputAll");
beforeCreate = true;
}
}
@@ -306,12 +307,12 @@ public class PutAllCallBkSingleVMDUnitTest extends DistributedTestCase{
static class BeforeUpdateCallback extends CacheWriterAdapter {
public void beforeUpdate(EntryEvent event){
beforeUpdateputAllcounter++;
- getLogWriter().fine("In beforeUpdate"+beforeUpdateputAllcounter);
+ LogWriterSupport.getLogWriter().fine("In beforeUpdate"+beforeUpdateputAllcounter);
if (event.getOperation().isPutAll()) {
assertEquals("putAllAfterUpdateCallback", event.getCallbackArgument());
}
if(beforeUpdateputAllcounter == 5){
- getLogWriter().fine("performingtrue beforeUpdate");
+ LogWriterSupport.getLogWriter().fine("performingtrue beforeUpdate");
beforeUpdate = true;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java
index 2113118..48c259a 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java
@@ -40,6 +40,7 @@ import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -79,7 +80,7 @@ public class PutAllMultiVmDUnitTest extends DistributedTestCase{
vm0.invoke(PutAllMultiVmDUnitTest.class, "closeCache");
vm1.invoke(PutAllMultiVmDUnitTest.class, "closeCache");
cache = null;
- invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
+ Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
}
public static void createCache(){
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/QueueMsgDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/QueueMsgDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/QueueMsgDUnitTest.java
index 5a00ec0..82d5205 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/QueueMsgDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/QueueMsgDUnitTest.java
@@ -35,10 +35,11 @@ import com.gemstone.gemfire.cache.SubscriptionAttributes;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.cache.CachePerfStats;
import com.gemstone.gemfire.internal.cache.DistributedRegion;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* Test to make sure message queuing works.
@@ -128,7 +129,7 @@ public class QueueMsgDUnitTest extends ReliabilityTestCase {
return "waiting for reliableQueuedOps to become 0";
}
};
- DistributedTestCase.waitForCriterion(ev, 5 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 5 * 1000, 200, true);
// now check that the queued op was delivered
vm.invoke(new CacheSerializableRunnable("check") {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RRSynchronizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RRSynchronizationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RRSynchronizationDUnitTest.java
index 47746cb..f0149f1 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RRSynchronizationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RRSynchronizationDUnitTest.java
@@ -44,10 +44,14 @@ import com.gemstone.gemfire.internal.cache.VMCachedDeserializable;
import com.gemstone.gemfire.internal.cache.versions.VMVersionTag;
import com.gemstone.gemfire.internal.cache.versions.VersionSource;
import com.gemstone.gemfire.internal.cache.versions.VersionTag;
+import com.gemstone.gemfire.test.dunit.DistributedSystemSupport;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterSupport;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* concurrency-control tests for client/server
@@ -86,7 +90,7 @@ public class RRSynchronizationDUnitTest extends CacheTestCase {
* distributed in the 7.0 release.
*/
public void doRegionsSyncOnPeerLoss(TestType typeOfTest) {
- IgnoredException.addExpectedException("killing member's ds");
+ IgnoredException.addIgnoredException("killing member's ds");
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -112,7 +116,7 @@ public class RRSynchronizationDUnitTest extends CacheTestCase {
// Now we crash the member who "modified" vm1's cache.
// The other replicates should perform a delta-GII for the lost member and
// get back in sync
- crashDistributedSystem(vm0);
+ DistributedSystemSupport.crashDistributedSystem(vm0);
verifySynchronized(vm2, crashedID);
} finally {
@@ -159,7 +163,7 @@ public class RRSynchronizationDUnitTest extends CacheTestCase {
tag.setEntryVersion(1);
tag.setIsRemoteForTesting();
EntryEventImpl event = EntryEventImpl.create(dr, Operation.CREATE, "Object3", true, forMember, true, false);
- getLogWriter().info("applying this event to the cache: " + event);
+ LogWriterSupport.getLogWriter().info("applying this event to the cache: " + event);
event.setNewValue(new VMCachedDeserializable("value3", 12));
event.setVersionTag(tag);
dr.getRegionMap().basicPut(event, System.currentTimeMillis(), true, false, null, false, false);
@@ -174,12 +178,12 @@ public class RRSynchronizationDUnitTest extends CacheTestCase {
event = EntryEventImpl.create(dr, Operation.CREATE, "Object5", true, forMember, true, false);
event.setNewValue(Token.TOMBSTONE);
event.setVersionTag(tag);
- getLogWriter().info("applying this event to the cache: " + event);
+ LogWriterSupport.getLogWriter().info("applying this event to the cache: " + event);
dr.getRegionMap().basicPut(event, System.currentTimeMillis(), true, false, null, false, false);
event.release();
dr.dumpBackingMap();
- getLogWriter().info("version vector is now " + dr.getVersionVector().fullToString());
+ LogWriterSupport.getLogWriter().info("version vector is now " + dr.getVersionVector().fullToString());
assertTrue("should hold entry Object3 now", dr.containsKey("Object3"));
return true;
}
@@ -190,17 +194,17 @@ public class RRSynchronizationDUnitTest extends CacheTestCase {
vm.invoke(new SerializableCallable("check that synchronization happened") {
public Object call() throws Exception {
final DistributedRegion dr = (DistributedRegion)TestRegion;
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
String waitingFor = "crashed member is still in membership view: " + crashedMember;
boolean dumped = false;
public boolean done() {
if (TestRegion.getCache().getDistributionManager().isCurrentMember(crashedMember)) {
- getLogWriter().info(waitingFor);
+ LogWriterSupport.getLogWriter().info(waitingFor);
return false;
}
if (!TestRegion.containsKey("Object3")) {
waitingFor = "entry for Object3 not found";
- getLogWriter().info(waitingFor);
+ LogWriterSupport.getLogWriter().info(waitingFor);
return false;
}
RegionEntry re = dr.getRegionMap().getEntry("Object5");
@@ -210,7 +214,7 @@ public class RRSynchronizationDUnitTest extends CacheTestCase {
dr.dumpBackingMap();
}
waitingFor = "entry for Object5 not found";
- getLogWriter().info(waitingFor);
+ LogWriterSupport.getLogWriter().info(waitingFor);
return false;
}
if (!re.isTombstone()) {
@@ -219,7 +223,7 @@ public class RRSynchronizationDUnitTest extends CacheTestCase {
dr.dumpBackingMap();
}
waitingFor = "Object5 is not a tombstone but should be: " + re;
- getLogWriter().info(waitingFor);
+ LogWriterSupport.getLogWriter().info(waitingFor);
return false;
}
return true;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java
index 9bc13ed..b6e12da 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java
@@ -56,12 +56,18 @@ import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator;
import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.DistributedSystemSupport;
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.LogWriterSupport;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.Threads;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
@SuppressWarnings("serial")
public class ReconnectDUnitTest extends CacheTestCase
@@ -94,7 +100,7 @@ public class ReconnectDUnitTest extends CacheTestCase
locatorPort = locPort;
Properties props = getDistributedSystemProperties();
locator = Locator.startLocatorAndDS(locatorPort, new File(""), props);
- IgnoredException.addExpectedException("com.gemstone.gemfire.ForcedDisconnectException||Possible loss of quorum");
+ IgnoredException.addIgnoredException("com.gemstone.gemfire.ForcedDisconnectException||Possible loss of quorum");
// MembershipManagerHelper.getMembershipManager(InternalDistributedSystem.getConnectedInstance()).setDebugJGroups(true);
} catch (IOException e) {
Assert.fail("unable to start locator", e);
@@ -108,7 +114,7 @@ public class ReconnectDUnitTest extends CacheTestCase
//Cache cache = getCache();
closeCache();
getSystem().disconnect();
- getLogWriter().fine("Cache Closed ");
+ LogWriterSupport.getLogWriter().fine("Cache Closed ");
}
@Override
@@ -121,7 +127,7 @@ public class ReconnectDUnitTest extends CacheTestCase
dsProperties.put(DistributionConfig.LOCATORS_NAME, "localHost["+this.locatorPort+"]");
dsProperties.put(DistributionConfig.MCAST_PORT_NAME, "0");
dsProperties.put(DistributionConfig.MEMBER_TIMEOUT_NAME, "1000");
- dsProperties.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
+ dsProperties.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterSupport.getDUnitLogLevel());
}
return dsProperties;
}
@@ -133,13 +139,13 @@ public class ReconnectDUnitTest extends CacheTestCase
Host.getHost(0).getVM(locatorVMNumber).invoke(new SerializableRunnable("stop locator") {
public void run() {
if (locator != null) {
- getLogWriter().info("stopping locator " + locator);
+ LogWriterSupport.getLogWriter().info("stopping locator " + locator);
locator.stop();
}
}
});
} finally {
- invokeInEveryVM(new SerializableRunnable() {
+ Invoke.invokeInEveryVM(new SerializableRunnable() {
public void run() {
ReconnectDUnitTest.savedSystem = null;
}
@@ -169,7 +175,7 @@ public class ReconnectDUnitTest extends CacheTestCase
// quorum check fails, then succeeds
public void testReconnectWithQuorum() throws Exception {
- IgnoredException.addExpectedException("killing member's ds");
+ IgnoredException.addIgnoredException("killing member's ds");
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -199,7 +205,7 @@ public class ReconnectDUnitTest extends CacheTestCase
props.put("max-num-reconnect-tries", "2");
props.put("log-file", "autoReconnectVM"+VM.getCurrentVMNum()+"_"+getPID()+".log");
Cache cache = new CacheFactory(props).create();
- IgnoredException.addExpectedException("com.gemstone.gemfire.ForcedDisconnectException||Possible loss of quorum");
+ IgnoredException.addIgnoredException("com.gemstone.gemfire.ForcedDisconnectException||Possible loss of quorum");
Region myRegion = cache.getRegion("root/myRegion");
ReconnectDUnitTest.savedSystem = cache.getDistributedSystem();
myRegion.put("MyKey1", "MyValue1");
@@ -221,7 +227,7 @@ public class ReconnectDUnitTest extends CacheTestCase
*/
System.out.println("disconnecting vm0");
forceDisconnect(vm0);
- pause(10000);
+ Wait.pause(10000);
System.out.println("disconnecting vm1");
forceDisconnect(vm1);
@@ -233,7 +239,7 @@ public class ReconnectDUnitTest extends CacheTestCase
waitForReconnect(vm1);
System.out.println("done reconnecting vm0 and vm1");
} catch (Exception e) {
- dumpAllStacks();
+ Threads.dumpAllStacks();
throw e;
}
}
@@ -251,7 +257,7 @@ public class ReconnectDUnitTest extends CacheTestCase
public void doTestReconnectOnForcedDisconnect(final boolean createInAppToo) throws Exception {
- IgnoredException.addExpectedException("killing member's ds");
+ IgnoredException.addIgnoredException("killing member's ds");
// getSystem().disconnect();
// getLogWriter().fine("Cache Closed ");
@@ -262,7 +268,7 @@ public class ReconnectDUnitTest extends CacheTestCase
final int locPort = locatorPort;
final int secondLocPort = AvailablePortHelper.getRandomAvailableTCPPort();
- deleteLocatorStateFile(locPort, secondLocPort);
+ DistributedSystemSupport.deleteLocatorStateFile(locPort, secondLocPort);
final String xmlFileLoc = (new File(".")).getAbsolutePath();
@@ -313,11 +319,11 @@ public class ReconnectDUnitTest extends CacheTestCase
Thread recreateCacheThread = new Thread("ReconnectDUnitTest.createInAppThread") {
public void run() {
while (!cache.isClosed()) {
- pause(100);
+ Wait.pause(100);
}
try {
new CacheFactory(props).create();
- getLogWriter().error("testReconnectCollidesWithApplication failed - application thread was able to create a cache");
+ LogWriterSupport.getLogWriter().error("testReconnectCollidesWithApplication failed - application thread was able to create a cache");
} catch (IllegalStateException cacheExists) {
// expected
}
@@ -337,7 +343,7 @@ public class ReconnectDUnitTest extends CacheTestCase
public Object call() {
final DistributedSystem ds = ReconnectDUnitTest.savedSystem;
ReconnectDUnitTest.savedSystem = null;
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public boolean done() {
return ds.isReconnecting();
}
@@ -345,8 +351,8 @@ public class ReconnectDUnitTest extends CacheTestCase
return "waiting for ds to begin reconnecting";
}
}, 30000, 1000, true);
- getLogWriter().info("entering reconnect wait for " + ds);
- getLogWriter().info("ds.isReconnecting() = " + ds.isReconnecting());
+ LogWriterSupport.getLogWriter().info("entering reconnect wait for " + ds);
+ LogWriterSupport.getLogWriter().info("ds.isReconnecting() = " + ds.isReconnecting());
boolean failure = true;
try {
ds.waitUntilReconnected(60, TimeUnit.SECONDS);
@@ -359,7 +365,7 @@ public class ReconnectDUnitTest extends CacheTestCase
failure = false;
return ds.getReconnectedSystem().getDistributedMember();
} catch (InterruptedException e) {
- getLogWriter().warning("interrupted while waiting for reconnect");
+ LogWriterSupport.getLogWriter().warning("interrupted while waiting for reconnect");
return null;
} finally {
if (failure) {
@@ -375,7 +381,7 @@ public class ReconnectDUnitTest extends CacheTestCase
public Object call() {
final DistributedSystem ds = ReconnectDUnitTest.savedSystem;
ReconnectDUnitTest.savedSystem = null;
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public boolean done() {
return ds.isReconnecting() || ds.getReconnectedSystem() != null;
}
@@ -388,7 +394,7 @@ public class ReconnectDUnitTest extends CacheTestCase
assertFalse(ds.isReconnecting());
DistributedSystem newDs = InternalDistributedSystem.getAnyInstance();
if (newDs != null) {
- getLogWriter().warning("expected distributed system to be disconnected: " + newDs);
+ LogWriterSupport.getLogWriter().warning("expected distributed system to be disconnected: " + newDs);
return false;
}
return true;
@@ -401,8 +407,8 @@ public class ReconnectDUnitTest extends CacheTestCase
forceDisconnect(vm1);
newdm = waitForReconnect(vm1);
assertNotSame("expected a reconnect to occur in member", dm, newdm);
- deleteLocatorStateFile(locPort);
- deleteLocatorStateFile(secondLocPort);
+ DistributedSystemSupport.deleteLocatorStateFile(locPort);
+ DistributedSystemSupport.deleteLocatorStateFile(secondLocPort);
}
private DistributedMember getDMID(VM vm) {
@@ -420,7 +426,7 @@ public class ReconnectDUnitTest extends CacheTestCase
System.out.println("waitForReconnect invoked");
final DistributedSystem ds = ReconnectDUnitTest.savedSystem;
ReconnectDUnitTest.savedSystem = null;
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public boolean done() {
return ds.isReconnecting();
}
@@ -429,7 +435,7 @@ public class ReconnectDUnitTest extends CacheTestCase
}
}, 30000, 1000, true);
long waitTime = 120;
- getLogWriter().info("VM"+VM.getCurrentVMNum() + " waiting up to "+waitTime+" seconds for reconnect to complete");
+ LogWriterSupport.getLogWriter().info("VM"+VM.getCurrentVMNum() + " waiting up to "+waitTime+" seconds for reconnect to complete");
try {
ds.waitUntilReconnected(waitTime, TimeUnit.SECONDS);
} catch (InterruptedException e) {
@@ -455,7 +461,7 @@ public class ReconnectDUnitTest extends CacheTestCase
final int locPort = locatorPort;
final int secondLocPort = AvailablePortHelper.getRandomAvailableTCPPort();
- deleteLocatorStateFile(locPort, secondLocPort);
+ DistributedSystemSupport.deleteLocatorStateFile(locPort, secondLocPort);
final String xmlFileLoc = (new File(".")).getAbsolutePath();
@@ -525,13 +531,13 @@ public class ReconnectDUnitTest extends CacheTestCase
return "waiting for locator to restart";
}
};
- waitForCriterion(wc, 30000, 1000, false);
+ Wait.waitForCriterion(wc, 30000, 1000, false);
if (Locator.getLocator() == null) {
- getLogWriter().error("expected to find a running locator but getLocator() returns null");
+ LogWriterSupport.getLogWriter().error("expected to find a running locator but getLocator() returns null");
return false;
}
if (((InternalLocator)Locator.getLocator()).isStopped()) {
- getLogWriter().error("found a stopped locator");
+ LogWriterSupport.getLogWriter().error("found a stopped locator");
return false;
}
return true;
@@ -563,8 +569,8 @@ public class ReconnectDUnitTest extends CacheTestCase
gfshThread = null;
}
});
- deleteLocatorStateFile(locPort);
- deleteLocatorStateFile(secondLocPort);
+ DistributedSystemSupport.deleteLocatorStateFile(locPort);
+ DistributedSystemSupport.deleteLocatorStateFile(secondLocPort);
}
}
@@ -620,7 +626,7 @@ public class ReconnectDUnitTest extends CacheTestCase
locatorPort = locPort;
Properties config = getDistributedSystemProperties();
config.put(DistributionConfig.ROLES_NAME, "");
- config.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
+ config.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterSupport.getDUnitLogLevel());
// config.put("log-file", "roleLossController.log");
//creating the DS
getSystem(config);
@@ -649,7 +655,7 @@ public class ReconnectDUnitTest extends CacheTestCase
closeCache();
getSystem().disconnect();
- getLogWriter().info("disconnected from the system...");
+ LogWriterSupport.getLogWriter().info("disconnected from the system...");
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -660,14 +666,14 @@ public class ReconnectDUnitTest extends CacheTestCase
"ROLERECONNECTTESTS") {
public void run2() throws CacheException, RuntimeException
{
- getLogWriter().info("####### STARTING THE REAL TEST ##########");
+ LogWriterSupport.getLogWriter().info("####### STARTING THE REAL TEST ##########");
locatorPort = locPort;
Properties props = getDistributedSystemProperties();
props.put("cache-xml-file", xmlFileLoc+File.separator+"RoleReconnect-cache.xml");
props.put("max-wait-time-reconnect", "200");
final int timeReconnect = 3;
props.put("max-num-reconnect-tries", "3");
- props.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
+ props.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterSupport.getDUnitLogLevel());
props.put("log-file", "roleLossVM0.log");
getSystem(props);
@@ -681,13 +687,13 @@ public class ReconnectDUnitTest extends CacheTestCase
throw new RuntimeException("The test should throw a CancelException ");
}
catch (CancelException ignor){ // can be caused by role loss during intialization.
- getLogWriter().info("Got Expected CancelException ");
+ LogWriterSupport.getLogWriter().info("Got Expected CancelException ");
}
finally {
system.getLogWriter().info("<ExpectedException action=remove>"
+ "CacheClosedException" + "</ExpectedException");
}
- getLogWriter().fine("roleLoss Sleeping SO call dumprun.sh");
+ LogWriterSupport.getLogWriter().fine("roleLoss Sleeping SO call dumprun.sh");
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
return reconnectTries >= timeReconnect;
@@ -696,8 +702,8 @@ public class ReconnectDUnitTest extends CacheTestCase
return "Waiting for reconnect count " + timeReconnect + " currently " + reconnectTries;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
- getLogWriter().fine("roleLoss done Sleeping");
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
+ LogWriterSupport.getLogWriter().fine("roleLoss done Sleeping");
assertEquals(timeReconnect,
reconnectTries);
}
@@ -753,7 +759,7 @@ public class ReconnectDUnitTest extends CacheTestCase
locatorPort = locPort;
Properties config = getDistributedSystemProperties();
config.put(DistributionConfig.ROLES_NAME, "");
- config.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
+ config.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterSupport.getDUnitLogLevel());
//creating the DS
getSystem(config);
@@ -807,7 +813,7 @@ public class ReconnectDUnitTest extends CacheTestCase
+ " trying to reconnect");
final AsyncInvocation roleLossAsync = vm0.invokeAsync(roleLoss);
- getLogWriter().info("waiting for role loss vm to start reconnect attempts");
+ LogWriterSupport.getLogWriter().info("waiting for role loss vm to start reconnect attempts");
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
@@ -824,7 +830,7 @@ public class ReconnectDUnitTest extends CacheTestCase
return "waiting for event";
}
};
- DistributedTestCase.waitForCriterion(ev, 120 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 120 * 1000, 200, true);
VM vm2 = host.getVM(2);
if (roleLossAsync.isAlive()) {
@@ -848,15 +854,15 @@ public class ReconnectDUnitTest extends CacheTestCase
getLogWriter().severe("Exception : "+ee);
}
}*/
- getLogWriter().info("waiting for vm0 to finish reconnecting");
- DistributedTestCase.join(roleLossAsync, 120 * 1000, getLogWriter());
+ LogWriterSupport.getLogWriter().info("waiting for vm0 to finish reconnecting");
+ Threads.join(roleLossAsync, 120 * 1000, LogWriterSupport.getLogWriter());
}
if (roleLossAsync.getException() != null){
Assert.fail("Exception in Vm0", roleLossAsync.getException());
}
- DistributedTestCase.join(avkVm1, 30 * 1000, getLogWriter());
+ Threads.join(avkVm1, 30 * 1000, LogWriterSupport.getLogWriter());
if (avkVm1.getException() != null){
Assert.fail("Exception in Vm1", avkVm1.getException());
}
@@ -874,7 +880,7 @@ public class ReconnectDUnitTest extends CacheTestCase
try {
// closeCache();
// getSystem().disconnect();
- getLogWriter().info(startupMessage);
+ LogWriterSupport.getLogWriter().info(startupMessage);
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
return ((Boolean)otherVM.invoke(ReconnectDUnitTest.class, "isInitialRolePlayerStarted")).booleanValue();
@@ -883,15 +889,15 @@ public class ReconnectDUnitTest extends CacheTestCase
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 10 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 10 * 1000, 200, true);
- getLogWriter().info("Starting the test and creating the cache and regions etc ...");
+ LogWriterSupport.getLogWriter().info("Starting the test and creating the cache and regions etc ...");
locatorPort = locPort;
Properties props = getDistributedSystemProperties();
props.put("cache-xml-file", "RoleRegained.xml");
props.put("max-wait-time-reconnect", "3000");
props.put("max-num-reconnect-tries", "8");
- props.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
+ props.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterSupport.getDUnitLogLevel());
getSystem(props);
system.getLogWriter().info("<ExpectedException action=add>"
@@ -901,7 +907,7 @@ public class ReconnectDUnitTest extends CacheTestCase
getCache();
} catch (CancelException e) {
// can happen if RoleA goes away during initialization
- getLogWriter().info("cache threw CancelException while creating the cache");
+ LogWriterSupport.getLogWriter().info("cache threw CancelException while creating the cache");
}
initialized = true;
@@ -910,14 +916,14 @@ public class ReconnectDUnitTest extends CacheTestCase
ev = new WaitCriterion() {
public boolean done() {
- getLogWriter().info("ReconnectTries=" + reconnectTries);
+ LogWriterSupport.getLogWriter().info("ReconnectTries=" + reconnectTries);
return reconnectTries != 0;
}
public String description() {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 30 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 30 * 1000, 200, true);
// long startTime = System.currentTimeMillis();
@@ -967,8 +973,8 @@ public class ReconnectDUnitTest extends CacheTestCase
excuse = "value is wrong";
return false;
}
- getLogWriter().info("All assertions passed");
- getLogWriter().info("MyKey : "+key+" and myvalue : "+value);
+ LogWriterSupport.getLogWriter().info("All assertions passed");
+ LogWriterSupport.getLogWriter().info("MyKey : "+key+" and myvalue : "+value);
return true;
}
catch (CancelException ecc){
@@ -979,7 +985,7 @@ public class ReconnectDUnitTest extends CacheTestCase
}
finally {
- getLogWriter().info("waiting for reconnect. Current status is '"+excuse+"'");
+ LogWriterSupport.getLogWriter().info("waiting for reconnect. Current status is '"+excuse+"'");
}
return false;
}
@@ -988,7 +994,7 @@ public class ReconnectDUnitTest extends CacheTestCase
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true); // was 5 * 60 * 1000
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true); // was 5 * 60 * 1000
Cache cache = CacheFactory.getAnyInstance();
if (cache != null) {
@@ -1000,11 +1006,11 @@ public class ReconnectDUnitTest extends CacheTestCase
throw e;
}
catch (Error th) {
- getLogWriter().severe("DEBUG", th);
+ LogWriterSupport.getLogWriter().severe("DEBUG", th);
throw th;
} finally {
if (t != null) {
- DistributedTestCase.join(t, 2 * 60 * 1000, getLogWriter());
+ Threads.join(t, 2 * 60 * 1000, LogWriterSupport.getLogWriter());
}
// greplogs won't care if you remove an exception that was never added,
// and this ensures that it gets removed.
@@ -1024,12 +1030,12 @@ public class ReconnectDUnitTest extends CacheTestCase
"second RoleA player") {
public void run2() throws CacheException
{
- getLogWriter().info(startupMessage);
+ LogWriterSupport.getLogWriter().info(startupMessage);
//closeCache();
// getSystem().disconnect();
locatorPort = locPort;
Properties props = getDistributedSystemProperties();
- props.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
+ props.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterSupport.getDUnitLogLevel());
props.put(DistributionConfig.ROLES_NAME, "RoleA");
getSystem(props);
@@ -1040,7 +1046,7 @@ public class ReconnectDUnitTest extends CacheTestCase
RegionAttributes attr = fac.create();
Region region = createRootRegion(regionName, attr);
- getLogWriter().info("STARTED THE REQUIREDROLES CACHE");
+ LogWriterSupport.getLogWriter().info("STARTED THE REQUIREDROLES CACHE");
try{
Thread.sleep(120);
}
@@ -1057,7 +1063,7 @@ public class ReconnectDUnitTest extends CacheTestCase
catch(InterruptedException ee){
fail("interrupted");
}
- getLogWriter().info("RolePlayer is done...");
+ LogWriterSupport.getLogWriter().info("RolePlayer is done...");
}
@@ -1076,10 +1082,10 @@ public class ReconnectDUnitTest extends CacheTestCase
{
// closeCache();
// getSystem().disconnect();
- getLogWriter().info(startupMessage);
+ LogWriterSupport.getLogWriter().info(startupMessage);
locatorPort = locPort;
Properties props = getDistributedSystemProperties();
- props.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
+ props.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterSupport.getDUnitLogLevel());
props.put(DistributionConfig.ROLES_NAME, "RoleA");
getSystem(props);
@@ -1090,7 +1096,7 @@ public class ReconnectDUnitTest extends CacheTestCase
RegionAttributes attr = fac.create();
createRootRegion(regionName, attr);
- getLogWriter().info("STARTED THE REQUIREDROLES CACHE");
+ LogWriterSupport.getLogWriter().info("STARTED THE REQUIREDROLES CACHE");
initialRolePlayerStarted = true;
while(!((Boolean)otherVM.invoke(ReconnectDUnitTest.class, "isInitialized")).booleanValue()){
@@ -1100,7 +1106,7 @@ public class ReconnectDUnitTest extends CacheTestCase
fail("interrupted");
}
}
- getLogWriter().info("RoleAPlayerInitializer is done...");
+ LogWriterSupport.getLogWriter().info("RoleAPlayerInitializer is done...");
closeCache();
}
@@ -1110,10 +1116,10 @@ public class ReconnectDUnitTest extends CacheTestCase
void addReconnectListener() {
reconnectTries = 0; // reset the count for this listener
- getLogWriter().info("adding reconnect listener");
+ LogWriterSupport.getLogWriter().info("adding reconnect listener");
ReconnectListener reconlis = new ReconnectListener() {
public void reconnecting(InternalDistributedSystem oldSys) {
- getLogWriter().info("reconnect listener invoked");
+ LogWriterSupport.getLogWriter().info("reconnect listener invoked");
reconnectTries++;
}
public void onReconnect(InternalDistributedSystem system1, InternalDistributedSystem system2) {}
@@ -1145,7 +1151,7 @@ public class ReconnectDUnitTest extends CacheTestCase
return "waiting for locator to start reconnecting: " + oldLocator;
}
};
- waitForCriterion(wc, 10000, 50, true);
+ Wait.waitForCriterion(wc, 10000, 50, true);
}
return true;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionExpirationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionExpirationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionExpirationDUnitTest.java
index af10e85..a6e228c 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionExpirationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionExpirationDUnitTest.java
@@ -23,9 +23,11 @@ import com.gemstone.gemfire.cache.ExpirationAttributes;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.Scope;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterSupport;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* Test Region expiration - both time-to-live and idle timeout.
@@ -124,7 +126,7 @@ public class RegionExpirationDUnitTest extends CacheTestCase {
return "region never destroyed";
}
};
- DistributedTestCase.waitForCriterion(wc, 30 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 30 * 1000, 1000, true);
}
public void testWhenBothTtlAndIdleAreSet()
@@ -162,9 +164,9 @@ public class RegionExpirationDUnitTest extends CacheTestCase {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
- getLogWriter().info("vm0 is " + vm0.getPid() + ", vm1 is " + vm1);
+ LogWriterSupport.getLogWriter().info("vm0 is " + vm0.getPid() + ", vm1 is " + vm1);
- getLogWriter().info("2: " + regionName + " action is " + action);
+ LogWriterSupport.getLogWriter().info("2: " + regionName + " action is " + action);
final long tilt = System.currentTimeMillis() + timeoutSecs * 1000;
@@ -216,7 +218,7 @@ public class RegionExpirationDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Get") {
public void run2() throws CacheException {
Region region = getRootRegion().getSubregion(regionName);
- getLogWriter().info("3: " + regionName + ", " + region + ", action is " + action);
+ LogWriterSupport.getLogWriter().info("3: " + regionName + ", " + region + ", action is " + action);
if (action.isInvalidate() || action.isLocalInvalidate()) {
assertTrue(!region.containsValueForKey(key));
} else {
@@ -253,7 +255,7 @@ public class RegionExpirationDUnitTest extends CacheTestCase {
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setEarlyAck(false);
RegionAttributes attrs = factory.create();
- getLogWriter().info("4: " + regionName + " ttl action is " + ttl);
+ LogWriterSupport.getLogWriter().info("4: " + regionName + " ttl action is " + ttl);
getOrCreateRootRegion().createSubregion(regionName, attrs);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java
index 8ecb00a..c87fff4 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java
@@ -37,9 +37,11 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.MembershipManage
import com.gemstone.gemfire.internal.cache.CacheDistributionAdvisor.CacheProfile;
import com.gemstone.gemfire.internal.cache.DistributedRegion;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterSupport;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* Test {@link RegionMembershipListener}
@@ -366,9 +368,9 @@ public class RegionMembershipListenerDUnitTest extends CacheTestCase {
return MyRML.this.toString() + " waiting for Op " + op + " when lastOp was " + getOpName(MyRML.this.lastOp);
}
};
- getLogWriter().info(this.toString() + " waiting for Op " + getOpName(op)
+ LogWriterSupport.getLogWriter().info(this.toString() + " waiting for Op " + getOpName(op)
+ " when lastOp was " + getOpName(this.lastOp));
- DistributedTestCase.waitForCriterion(ev, this.timeOut, 200, true);
+ Wait.waitForCriterion(ev, this.timeOut, 200, true);
assertEquals(op, this.lastOp);
return true;
}
@@ -387,7 +389,7 @@ public class RegionMembershipListenerDUnitTest extends CacheTestCase {
this.lastOp = Op.Initial;
this.lastEvent = null;
this.initialMembers = initialMembers;
- getLogWriter().info(this.toString() + " received initialMembers notification for region " + r
+ LogWriterSupport.getLogWriter().info(this.toString() + " received initialMembers notification for region " + r
+ " with members " + Arrays.deepToString(initialMembers));
}
public void afterRemoteRegionCreate(RegionEvent event) {
@@ -397,23 +399,23 @@ public class RegionMembershipListenerDUnitTest extends CacheTestCase {
if (cacheProfile != null) {
this.memberInitialized = cacheProfile.regionInitialized;
if (!this.memberInitialized) {
- getLogWriter().warning("afterRemoteRegionCreate invoked when member is not done initializing!", new Exception("stack trace"));
+ LogWriterSupport.getLogWriter().warning("afterRemoteRegionCreate invoked when member is not done initializing!", new Exception("stack trace"));
}
- getLogWriter().info(this.toString() + " received afterRemoteRegionCreate notification for event " + event);
+ LogWriterSupport.getLogWriter().info(this.toString() + " received afterRemoteRegionCreate notification for event " + event);
} else {
- getLogWriter().warning("afterRemoteRegionCreate was expecting a profile in the event callback but there was none. " +
+ LogWriterSupport.getLogWriter().warning("afterRemoteRegionCreate was expecting a profile in the event callback but there was none. " +
" This indicates a problem with the test hook DistributedRegion.TEST_HOOK_ADD_PROFILE");
}
}
public void afterRemoteRegionDeparture(RegionEvent event) {
this.lastOp = Op.Departure;
this.lastEvent = event;
- getLogWriter().info(this.toString() + " received afterRemoteRegionDeparture notification for event " + event);
+ LogWriterSupport.getLogWriter().info(this.toString() + " received afterRemoteRegionDeparture notification for event " + event);
}
public void afterRemoteRegionCrash(RegionEvent event) {
this.lastOp = Op.Crash;
this.lastEvent = event;
- getLogWriter().info(this.toString() + " received afterRemoteRegionCrash notification for event " + event);
+ LogWriterSupport.getLogWriter().info(this.toString() + " received afterRemoteRegionCrash notification for event " + event);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionReliabilityTestCase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionReliabilityTestCase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionReliabilityTestCase.java
index 26108cd..56f2f41 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionReliabilityTestCase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionReliabilityTestCase.java
@@ -65,9 +65,12 @@ import com.gemstone.gemfire.internal.cache.TXManagerImpl;
import com.gemstone.gemfire.internal.cache.TXState;
import com.gemstone.gemfire.internal.cache.TXStateInterface;
import com.gemstone.gemfire.internal.cache.TXStateProxyImpl;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterSupport;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.Threads;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* Tests region reliability defined by MembershipAttributes.
@@ -825,7 +828,7 @@ public abstract class RegionReliabilityTestCase extends ReliabilityTestCase {
return "expected zero entries but have " + ((LocalRegion) region).basicEntries(false).size();
}
};
- DistributedTestCase.waitForCriterion(wc1, 30*1000, 10, true);
+ Wait.waitForCriterion(wc1, 30*1000, 10, true);
// create region again
Host.getHost(0).getVM(1).invoke(new CacheSerializableRunnable("Create Region") {
@@ -1007,7 +1010,7 @@ public abstract class RegionReliabilityTestCase extends ReliabilityTestCase {
return "expected region " + region + " to be destroyed";
}
};
- DistributedTestCase.waitForCriterion(wc, 30*1000, 10, true);
+ Wait.waitForCriterion(wc, 30*1000, 10, true);
}
public static void waitForEntryDestroy(final Region region, final Object key) {
@@ -1019,7 +1022,7 @@ public abstract class RegionReliabilityTestCase extends ReliabilityTestCase {
return "expected entry " + key + " to not exist but it has the value " + region.get(key);
}
};
- DistributedTestCase.waitForCriterion(wc, 30*1000, 10, true);
+ Wait.waitForCriterion(wc, 30*1000, 10, true);
}
/**
@@ -1412,7 +1415,7 @@ public abstract class RegionReliabilityTestCase extends ReliabilityTestCase {
}
});
- DistributedTestCase.join(thread, 30 * 1000, getLogWriter());
+ Threads.join(thread, 30 * 1000, LogWriterSupport.getLogWriter());
assertTrue(region.isDestroyed());
try {
region.put("fee", "fi");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java
index 9c3add6..85119fd 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java
@@ -58,10 +58,11 @@ import com.gemstone.gemfire.internal.cache.EntryExpiryTask;
import com.gemstone.gemfire.internal.cache.EntrySnapshot;
import com.gemstone.gemfire.internal.cache.ExpiryTask;
import com.gemstone.gemfire.internal.cache.LocalRegion;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
//import com.gemstone.gemfire.internal.util.DebuggerSupport;
@@ -112,7 +113,7 @@ public abstract class RegionTestCase extends CacheTestCase {
public void tearDown2() throws Exception {
super.tearDown2();
cleanup();
- invokeInEveryVM(getClass(), "cleanup");
+ Invoke.invokeInEveryVM(getClass(), "cleanup");
/*for (int h = 0; h < Host.getHostCount(); h++) {
Host host = Host.getHost(h);
for (int v = 0; v < host.getVMCount(); v++) {
@@ -268,7 +269,7 @@ public abstract class RegionTestCase extends CacheTestCase {
assertEquals(value, values.iterator().next());
}
catch (UnsupportedOperationException uoe) {
- getLogWriter().info("Region.values() reported UnsupportedOperation");
+ com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter().info("Region.values() reported UnsupportedOperation");
}
}
@@ -472,7 +473,7 @@ public abstract class RegionTestCase extends CacheTestCase {
region.destroy(key);
Region.Entry entry2 = region.getEntry(key);
- getLogWriter().info("Found entry for destroyed key: " + entry2);
+ com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter().info("Found entry for destroyed key: " + entry2);
assertNull(entry2);
if (entry.isLocal()) {
assertTrue(entry.isDestroyed());
@@ -1979,11 +1980,11 @@ public abstract class RegionTestCase extends CacheTestCase {
break;
}
if (!wasInvalidated) {
- pause(pauseMs);
+ Wait.pause(pauseMs);
continue;
}
if (now >= tilt - SLOP) {
- getLogWriter().warning("Entry invalidated sloppily "
+ com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter().warning("Entry invalidated sloppily "
+ "now=" + now + " tilt=" + tilt + " delta = " + (tilt - now));
break;
}
@@ -2003,7 +2004,7 @@ public abstract class RegionTestCase extends CacheTestCase {
if (fetchEntryValue(entry) == null) break;
fail("Entry failed to invalidate");
}
- pause(pauseMs);
+ Wait.pause(pauseMs);
}
}
@@ -2050,11 +2051,11 @@ public abstract class RegionTestCase extends CacheTestCase {
if (now >= tilt)
break;
if (!isEntryDestroyed(entry)) {
- pause(pauseMs);
+ Wait.pause(pauseMs);
continue;
}
if (now >= tilt - SLOP) {
- getLogWriter().warning("Entry destroyed sloppily "
+ com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter().warning("Entry destroyed sloppily "
+ "now=" + now + " tilt=" + tilt + " delta = " + (tilt - now));
break;
}
@@ -2072,7 +2073,7 @@ public abstract class RegionTestCase extends CacheTestCase {
break;
Assert.assertTrue(System.currentTimeMillis() <= tilt,
"Entry failed to destroy");
- pause(pauseMs);
+ Wait.pause(pauseMs);
}
}
@@ -2094,11 +2095,11 @@ public abstract class RegionTestCase extends CacheTestCase {
if (now >= tilt)
break;
if (!region.isDestroyed()) {
- pause(10);
+ Wait.pause(10);
continue;
}
if (now >= tilt - SLOP) {
- getLogWriter().warning("Region destroyed sloppily "
+ com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter().warning("Region destroyed sloppily "
+ "now=" + now + " tilt=" + tilt + " delta = " + (tilt - now));
break;
}
@@ -2116,7 +2117,7 @@ public abstract class RegionTestCase extends CacheTestCase {
break;
Assert.assertTrue(System.currentTimeMillis() <= tilt,
"Region failed to destroy");
- pause(10);
+ Wait.pause(10);
}
}
@@ -2201,7 +2202,7 @@ public abstract class RegionTestCase extends CacheTestCase {
// Random values should not expire
region.put(key1, value);
- pause(timeout * 2);
+ Wait.pause(timeout * 2);
assert(region.get(key1).equals(value));
// key2 *should* expire
@@ -2260,7 +2261,7 @@ public abstract class RegionTestCase extends CacheTestCase {
region.create(key1, value);
// This value should NOT expire.
- pause(timeout * 2);
+ Wait.pause(timeout * 2);
assertTrue(region.get(key1).equals(value));
// This value SHOULD expire
@@ -2363,7 +2364,7 @@ public abstract class RegionTestCase extends CacheTestCase {
ExpiryTask.permitExpiration();
}
waitForInvalidate(entry, tilt1, timeout1/2);
- DistributedTestCase.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 100, true);
+ Wait.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 100, true);
eventCount = 0;
// Do it again with a put (I guess)
@@ -2379,7 +2380,7 @@ public abstract class RegionTestCase extends CacheTestCase {
ExpiryTask.permitExpiration();
}
waitForInvalidate(entry, tilt1, timeout1/2);
- DistributedTestCase.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 100, true);
+ Wait.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 100, true);
eventCount = 0;
// Change custom expiry for this region now...
@@ -2405,7 +2406,7 @@ public abstract class RegionTestCase extends CacheTestCase {
ExpiryTask.permitExpiration();
}
waitForInvalidate(entry, tilt2, timeout2/2);
- DistributedTestCase.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 100, true);
+ Wait.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 100, true);
eventCount = 0;
// key1 should not be invalidated since we mutated to custom expiry to only expire key2
entry = region.getEntry(key1);
@@ -2480,7 +2481,7 @@ public abstract class RegionTestCase extends CacheTestCase {
assertEquals(0, eventCount);
// now set it to a really short time and make sure it expires immediately
- waitForExpiryClockToChange(region);
+ Wait.waitForExpiryClockToChange(region);
final Region.Entry entry = region.getEntry(key1);
mutt = region.getAttributesMutator();
ExpirationAttributes expire4 = new ExpirationAttributes(1, ExpirationAction.INVALIDATE);
@@ -2493,7 +2494,7 @@ public abstract class RegionTestCase extends CacheTestCase {
return "entry never became invalid";
}
};
- DistributedTestCase.waitForCriterion(wc, 10 * 1000, 10, true);
+ Wait.waitForCriterion(wc, 10 * 1000, 10, true);
WaitCriterion waitForEventCountToBeOne = new WaitCriterion() {
public boolean done() {
@@ -2503,7 +2504,7 @@ public abstract class RegionTestCase extends CacheTestCase {
return "eventCount never became 1";
}
};
- DistributedTestCase.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 10, true);
+ Wait.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 10, true);
eventCount = 0;
}
@@ -2933,7 +2934,7 @@ public abstract class RegionTestCase extends CacheTestCase {
region.create(key1, value);
// This value should NOT expire.
- pause(timeout * 2);
+ Wait.pause(timeout * 2);
assertTrue(region.get(key1).equals(value));
// This value SHOULD expire
@@ -3013,7 +3014,7 @@ public abstract class RegionTestCase extends CacheTestCase {
region.create(key2, value);
// This value should NOT expire.
- pause(timeout * 2);
+ Wait.pause(timeout * 2);
assertTrue(region.get(key2).equals(value));
// This value SHOULD expire
@@ -3114,7 +3115,7 @@ public abstract class RegionTestCase extends CacheTestCase {
assertEquals(0, eventCount);
// now set it to a really short time and make sure it expires immediately
- waitForExpiryClockToChange(region);
+ Wait.waitForExpiryClockToChange(region);
final Region.Entry entry = region.getEntry(key1);
mutt = region.getAttributesMutator();
ExpirationAttributes expire4 = new ExpirationAttributes(1, ExpirationAction.INVALIDATE);
@@ -3127,7 +3128,7 @@ public abstract class RegionTestCase extends CacheTestCase {
return "entry never became invalid";
}
};
- DistributedTestCase.waitForCriterion(wc, 10 * 1000, 10, true);
+ Wait.waitForCriterion(wc, 10 * 1000, 10, true);
WaitCriterion waitForEventCountToBeOne = new WaitCriterion() {
public boolean done() {
@@ -3137,7 +3138,7 @@ public abstract class RegionTestCase extends CacheTestCase {
return "eventCount never became 1";
}
};
- DistributedTestCase.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 10, true);
+ Wait.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 10, true);
eventCount = 0;
}
@@ -3201,7 +3202,7 @@ public abstract class RegionTestCase extends CacheTestCase {
assertEquals(0, eventCount);
// now set it to a really short time and make sure it expires immediately
- waitForExpiryClockToChange(region);
+ Wait.waitForExpiryClockToChange(region);
final Region.Entry entry = region.getEntry(key1);
mutt = region.getAttributesMutator();
ExpirationAttributes expire4 = new ExpirationAttributes(1, ExpirationAction.INVALIDATE);
@@ -3214,7 +3215,7 @@ public abstract class RegionTestCase extends CacheTestCase {
return "entry never became invalid";
}
};
- DistributedTestCase.waitForCriterion(wc, 10 * 1000, 10, true);
+ Wait.waitForCriterion(wc, 10 * 1000, 10, true);
WaitCriterion waitForEventCountToBeOne = new WaitCriterion() {
public boolean done() {
@@ -3224,7 +3225,7 @@ public abstract class RegionTestCase extends CacheTestCase {
return "eventCount never became 1";
}
};
- DistributedTestCase.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 10, true);
+ Wait.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 10, true);
eventCount = 0;
}
@@ -3413,7 +3414,7 @@ public abstract class RegionTestCase extends CacheTestCase {
// Random values should not expire
region.put(key1, value);
- pause(timeout * 2);
+ Wait.pause(timeout * 2);
assert(region.get(key1).equals(value));
// key2 *should* expire
@@ -3487,14 +3488,14 @@ public abstract class RegionTestCase extends CacheTestCase {
assertNotNull(entry.getValue());
EntryExpiryTask eet = region.getEntryExpiryTask(key1);
final long createExpiryTime = eet.getExpirationTime();
- waitForExpiryClockToChange(region);
+ Wait.waitForExpiryClockToChange(region);
region.get(key1);
assertSame(eet, region.getEntryExpiryTask(key1));
final long getExpiryTime = eet.getExpirationTime();
if (getExpiryTime - createExpiryTime <= 0L) {
fail("get did not reset the expiration time. createExpiryTime=" + createExpiryTime + " getExpiryTime=" + getExpiryTime);
}
- waitForExpiryClockToChange(region);
+ Wait.waitForExpiryClockToChange(region);
region.put(key1, value);
assertSame(eet, region.getEntryExpiryTask(key1));
final long putExpiryTime = eet.getExpirationTime();
@@ -3597,7 +3598,7 @@ public abstract class RegionTestCase extends CacheTestCase {
EntryExpiryTask eet = region.getEntryExpiryTask(key);
long createExpiryTime = eet.getExpirationTime();
- waitForExpiryClockToChange(region);
+ Wait.waitForExpiryClockToChange(region);
region.get(key); // touch
assertSame(eet, region.getEntryExpiryTask(key));
long getExpiryTime = eet.getExpirationTime();
@@ -3605,7 +3606,7 @@ public abstract class RegionTestCase extends CacheTestCase {
fail("get did not reset the expiration time. createExpiryTime=" + createExpiryTime + " getExpiryTime=" + getExpiryTime);
}
- waitForExpiryClockToChange(region);
+ Wait.waitForExpiryClockToChange(region);
region.put(key, value); // touch
assertSame(eet, region.getEntryExpiryTask(key));
long putExpiryTime = eet.getExpirationTime();
@@ -3617,7 +3618,7 @@ public abstract class RegionTestCase extends CacheTestCase {
// Now verify operations that do not modify the expiry time
- waitForExpiryClockToChange(region);
+ Wait.waitForExpiryClockToChange(region);
region.invalidate(key); // touch
assertSame(eet, region.getEntryExpiryTask(key));
long invalidateExpiryTime = eet.getExpirationTime();
@@ -3679,7 +3680,7 @@ public abstract class RegionTestCase extends CacheTestCase {
region.put(key, value);
tilt = System.currentTimeMillis() + timeout;
entry = region.getEntry(key);
- pause(timeout * 2);
+ Wait.pause(timeout * 2);
assertEquals(value, entry.getValue());
region.getAttributesMutator().setEntryIdleTimeout(expire);
waitForInvalidate(entry, tilt);
@@ -3715,7 +3716,7 @@ public abstract class RegionTestCase extends CacheTestCase {
if ((firstIdleExpiryTime - firstTTLExpiryTime) >= 0) {
fail("idle should be less than ttl: idle=" + firstIdleExpiryTime + " ttl=" + firstTTLExpiryTime);
}
- waitForExpiryClockToChange(region);
+ Wait.waitForExpiryClockToChange(region);
region.get(key);
eet = region.getEntryExpiryTask(key);
final long secondIdleExpiryTime = eet.getIdleExpirationTime();
@@ -3865,23 +3866,23 @@ public abstract class RegionTestCase extends CacheTestCase {
ExpiryTask expiryTask = lr.getRegionIdleExpiryTask();
region.put(key, value);
long createExpiry = expiryTask.getExpirationTime();
- long changeTime = waitForExpiryClockToChange(lr, createExpiry-EXPIRATION_MS);
+ long changeTime = Wait.waitForExpiryClockToChange(lr, createExpiry-EXPIRATION_MS);
region.put(key, "VALUE2");
long putExpiry = expiryTask.getExpirationTime();
assertTrue("CLOCK went back in time! Expected putBaseExpiry=" + (putExpiry-EXPIRATION_MS) + " to be >= than changeTime=" + changeTime, (putExpiry-EXPIRATION_MS - changeTime) >= 0);
assertTrue("expected putExpiry=" + putExpiry + " to be > than createExpiry=" + createExpiry, (putExpiry - createExpiry) > 0);
- changeTime = waitForExpiryClockToChange(lr, putExpiry-EXPIRATION_MS);
+ changeTime = Wait.waitForExpiryClockToChange(lr, putExpiry-EXPIRATION_MS);
region.get(key);
long getExpiry = expiryTask.getExpirationTime();
assertTrue("CLOCK went back in time! Expected getBaseExpiry=" + (getExpiry-EXPIRATION_MS) + " to be >= than changeTime=" + changeTime, (getExpiry-EXPIRATION_MS - changeTime) >= 0);
assertTrue("expected getExpiry=" + getExpiry + " to be > than putExpiry=" + putExpiry, (getExpiry - putExpiry) > 0);
- changeTime = waitForExpiryClockToChange(lr, getExpiry-EXPIRATION_MS);
+ changeTime = Wait.waitForExpiryClockToChange(lr, getExpiry-EXPIRATION_MS);
sub.put(key, value);
long subPutExpiry = expiryTask.getExpirationTime();
assertTrue("CLOCK went back in time! Expected subPutBaseExpiry=" + (subPutExpiry-EXPIRATION_MS) + " to be >= than changeTime=" + changeTime, (subPutExpiry-EXPIRATION_MS - changeTime) >= 0);
assertTrue("expected subPutExpiry=" + subPutExpiry + " to be > than getExpiry=" + getExpiry, (subPutExpiry - getExpiry) > 0);
- changeTime = waitForExpiryClockToChange(lr, subPutExpiry-EXPIRATION_MS);
+ changeTime = Wait.waitForExpiryClockToChange(lr, subPutExpiry-EXPIRATION_MS);
sub.get(key);
long subGetExpiry = expiryTask.getExpirationTime();
assertTrue("CLOCK went back in time! Expected subGetBaseExpiry=" + (subGetExpiry-EXPIRATION_MS) + " to be >= than changeTime=" + changeTime, (subGetExpiry-EXPIRATION_MS - changeTime) >= 0);
@@ -3950,7 +3951,7 @@ public abstract class RegionTestCase extends CacheTestCase {
// create region in other VMs if distributed
boolean isDistributed = getRegionAttributes().getScope().isDistributed();
if (isDistributed) {
- invokeInEveryVM(new CacheSerializableRunnable("create presnapshot region") {
+ Invoke.invokeInEveryVM(new CacheSerializableRunnable("create presnapshot region") {
public void run2() throws CacheException {
preSnapshotRegion = createRegion(name);
}
@@ -3993,7 +3994,7 @@ public abstract class RegionTestCase extends CacheTestCase {
// test postSnapshot behavior in other VMs if distributed
if (isDistributed) {
- invokeInEveryVM(new CacheSerializableRunnable("postSnapshot") {
+ Invoke.invokeInEveryVM(new CacheSerializableRunnable("postSnapshot") {
public void run2() throws CacheException {
RegionTestCase.this.remoteTestPostSnapshot(name, false, false);
}
@@ -4014,7 +4015,7 @@ public abstract class RegionTestCase extends CacheTestCase {
// create region in other VMs if distributed
boolean isDistributed = getRegionAttributes().getScope().isDistributed();
if (isDistributed) {
- invokeInEveryVM(new CacheSerializableRunnable("create presnapshot region") {
+ Invoke.invokeInEveryVM(new CacheSerializableRunnable("create presnapshot region") {
public void run2() throws CacheException {
preSnapshotRegion = createRootRegion(name, getRegionAttributes());
}
@@ -4063,7 +4064,7 @@ public abstract class RegionTestCase extends CacheTestCase {
// test postSnapshot behavior in other VMs if distributed
if (isDistributed) {
log.info("before distributed remoteTestPostSnapshot");
- invokeInEveryVM(new CacheSerializableRunnable("postSnapshot") {
+ Invoke.invokeInEveryVM(new CacheSerializableRunnable("postSnapshot") {
public void run2() throws CacheException {
RegionTestCase.this.remoteTestPostSnapshot(name, false, true);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RemoveAllMultiVmDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RemoveAllMultiVmDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RemoveAllMultiVmDUnitTest.java
index 1d878aa..d8f98d7 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RemoveAllMultiVmDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RemoveAllMultiVmDUnitTest.java
@@ -38,6 +38,7 @@ import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -77,7 +78,7 @@ public class RemoveAllMultiVmDUnitTest extends DistributedTestCase {
vm0.invoke(RemoveAllMultiVmDUnitTest.class, "closeCache");
vm1.invoke(RemoveAllMultiVmDUnitTest.class, "closeCache");
cache = null;
- invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
+ Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
}
public static void createCache(){
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RequiredRolesDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RequiredRolesDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RequiredRolesDUnitTest.java
index a4120b0..3e5ed6a 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RequiredRolesDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RequiredRolesDUnitTest.java
@@ -34,9 +34,12 @@ import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.distributed.Role;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.membership.InternalRole;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterSupport;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.Threads;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* Tests the functionality of the {@link RequiredRoles} class.
@@ -192,7 +195,7 @@ public class RequiredRolesDUnitTest extends ReliabilityTestCase {
return "waiting for test start";
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
assertTrue(this.startTestWaitForRequiredRoles);
assertFalse(this.finishTestWaitForRequiredRoles);
@@ -220,7 +223,7 @@ public class RequiredRolesDUnitTest extends ReliabilityTestCase {
// create region in vm3... gain for 2 roles
Host.getHost(0).getVM(vm3).invoke(create);
- DistributedTestCase.join(threadA, 30 * 1000, getLogWriter());
+ Threads.join(threadA, 30 * 1000, LogWriterSupport.getLogWriter());
assertTrue(this.finishTestWaitForRequiredRoles);
assertTrue(this.rolesTestWaitForRequiredRoles.isEmpty());
@@ -240,7 +243,7 @@ public class RequiredRolesDUnitTest extends ReliabilityTestCase {
this.finishTestWaitForRequiredRoles = false;
threadA = new Thread(group, runWaitForRequiredRoles);
threadA.start();
- DistributedTestCase.join(threadA, 30 * 1000, getLogWriter());
+ Threads.join(threadA, 30 * 1000, LogWriterSupport.getLogWriter());
assertTrue(this.startTestWaitForRequiredRoles);
assertTrue(this.finishTestWaitForRequiredRoles);
assertTrue(this.rolesTestWaitForRequiredRoles.isEmpty());
@@ -253,7 +256,7 @@ public class RequiredRolesDUnitTest extends ReliabilityTestCase {
this.finishTestWaitForRequiredRoles = false;
threadA = new Thread(group, runWaitForRequiredRoles);
threadA.start();
- DistributedTestCase.join(threadA, 30 * 1000, getLogWriter());
+ Threads.join(threadA, 30 * 1000, LogWriterSupport.getLogWriter());
assertTrue(this.startTestWaitForRequiredRoles);
assertTrue(this.finishTestWaitForRequiredRoles);
assertTrue(this.rolesTestWaitForRequiredRoles.isEmpty());
@@ -276,14 +279,14 @@ public class RequiredRolesDUnitTest extends ReliabilityTestCase {
return "waiting for test start";
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
assertTrue(this.startTestWaitForRequiredRoles);
assertFalse(this.finishTestWaitForRequiredRoles);
assertMissingRoles(name, vmRoles[vm2]);
// end the wait and make sure no roles are missing
Host.getHost(0).getVM(vm2).invoke(create);
- DistributedTestCase.join(threadA, 30 * 1000, getLogWriter());
+ Threads.join(threadA, 30 * 1000, LogWriterSupport.getLogWriter());
assertTrue(this.startTestWaitForRequiredRoles);
assertTrue(this.finishTestWaitForRequiredRoles);
assertTrue(this.rolesTestWaitForRequiredRoles.isEmpty());
@@ -429,7 +432,7 @@ public class RequiredRolesDUnitTest extends ReliabilityTestCase {
SystemFailure.setFailure((VirtualMachineError)e); // don't throw
}
String s = "Uncaught exception in thread " + t;
- getLogWriter().error(s, e);
+ LogWriterSupport.getLogWriter().error(s, e);
fail(s);
}
};
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RolePerformanceDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RolePerformanceDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RolePerformanceDUnitTest.java
index 81cd191..e0249e0 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RolePerformanceDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RolePerformanceDUnitTest.java
@@ -26,6 +26,7 @@ import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterSupport;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
/**
@@ -63,7 +64,7 @@ public class RolePerformanceDUnitTest extends CacheTestCase {
throw e;
}
else {
- getLogWriter().info("testRolePerformance attempt #" + i +
+ LogWriterSupport.getLogWriter().info("testRolePerformance attempt #" + i +
" failed -- reattempting up to 10x", e);
}
}
@@ -101,7 +102,7 @@ public class RolePerformanceDUnitTest extends CacheTestCase {
String data = name + " results: millisNoRoles=" + millisNoRoles +
", millisWithRoles=" + millisWithRoles + ", deviation=" + deviation +
", ceiling=" + ceiling;
- getLogWriter().info(data);
+ LogWriterSupport.getLogWriter().info(data);
assertTrue("millisWithRoles is greater than allowable deviation: " + data,
millisWithRoles <= ceiling);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/SearchAndLoadDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/SearchAndLoadDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/SearchAndLoadDUnitTest.java
index 47ab179..05a1901 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/SearchAndLoadDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/SearchAndLoadDUnitTest.java
@@ -38,6 +38,8 @@ import com.gemstone.gemfire.test.dunit.AsyncInvocation;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterSupport;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -261,7 +263,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
Region region = createRegion(name,factory.create());
region.create(objectName, null);
- IgnoredException.addExpectedException(exceptionString);
+ IgnoredException.addIgnoredException(exceptionString);
}
});
@@ -271,9 +273,9 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
public void run2() {
Region region = getCache().getRegion("root/"+name);
- getLogWriter().info("t1 is invoking get("+objectName+")");
+ LogWriterSupport.getLogWriter().info("t1 is invoking get("+objectName+")");
try {
- getLogWriter().info("t1 retrieved value " + region.get(objectName));
+ LogWriterSupport.getLogWriter().info("t1 retrieved value " + region.get(objectName));
fail("first load should have triggered an exception");
} catch (RuntimeException e) {
if (!e.getMessage().contains(exceptionString)) {
@@ -288,7 +290,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
final Object[] valueHolder = new Object[1];
// wait for vm1 to cause the loader to be invoked
- getLogWriter().info("t2 is waiting for loader to be invoked by t1");
+ LogWriterSupport.getLogWriter().info("t2 is waiting for loader to be invoked by t1");
try {
loaderInvokedLatch.await(30, TimeUnit.SECONDS);
} catch (InterruptedException e) {
@@ -327,7 +329,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
fail("get() operation blocked for too long - test needs some work");
}
- getLogWriter().info("t2 is invoking get("+objectName+")");
+ LogWriterSupport.getLogWriter().info("t2 is invoking get("+objectName+")");
Object value = valueHolder[0];
if (value instanceof RuntimeException) {
if ( ((Exception)value).getMessage().contains(exceptionString) ) {
@@ -336,7 +338,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
throw (RuntimeException)value;
}
} else {
- getLogWriter().info("t2 retrieved value " + value);
+ LogWriterSupport.getLogWriter().info("t2 retrieved value " + value);
assertNotNull(value);
}
}
@@ -394,7 +396,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
public void testNetLoad()
throws CacheException, InterruptedException {
- invokeInEveryVM(DistributedTestCase.class,
+ Invoke.invokeInEveryVM(DistributedTestCase.class,
"disconnectFromDS");
Host host = Host.getHost(0);
@@ -489,7 +491,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
*/
public void testEmptyNetLoad()
throws CacheException, InterruptedException {
- invokeInEveryVM(DistributedTestCase.class,
+ Invoke.invokeInEveryVM(DistributedTestCase.class,
"disconnectFromDS");
Host host = Host.getHost(0);