You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by je...@apache.org on 2016/02/11 16:27:02 UTC
[38/62] [abbrv] [partial] incubator-geode git commit: GEODE-773:
Extract static methods from DistributedTestCase
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/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 ace3e4b..01aa205 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
@@ -33,9 +33,13 @@ import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.RegionEvent;
import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.TimeoutException;
+import com.gemstone.gemfire.test.dunit.Assert;
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.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -72,7 +76,8 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
super(name);
}
- public void tearDown2() throws Exception {
+ @Override
+ protected final void preTearDownCacheTestCase() throws Exception {
for (int h = 0; h < Host.getHostCount(); h++) {
Host host = Host.getHost(h);
for (int v = 0; v < host.getVMCount(); v++) {
@@ -81,12 +86,9 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
cleanup();
}
});
- // already called in every VM in super.tearDown
-// host.getVM(v).invoke(this.getClass(), "remoteTearDown");
}
}
cleanup();
- super.tearDown2();
}
/**
@@ -130,7 +132,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
region.create(objectName,null);
}
catch (CacheException ex) {
- fail("While creating ACK region", ex);
+ Assert.fail("While creating ACK region", ex);
}
}
});
@@ -148,7 +150,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
}
catch (CacheException ex) {
- fail("While creating ACK region", ex);
+ Assert.fail("While creating ACK region", ex);
}
}
});
@@ -166,7 +168,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
}
catch (CacheException ex) {
- fail("While creating ACK region", ex);
+ Assert.fail("While creating ACK region", ex);
}
}
});
@@ -181,10 +183,10 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
// System.err.println("Results is " + result.toString() + " Key is " + objectName.toString());
}
catch(CacheLoaderException cle) {
- fail("While Get a value", cle);
+ Assert.fail("While Get a value", cle);
}
catch(TimeoutException te) {
- fail("While Get a value", te);
+ Assert.fail("While Get a value", te);
}
}
@@ -259,7 +261,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
Region region = createRegion(name,factory.create());
region.create(objectName, null);
- addExpectedException(exceptionString);
+ IgnoredException.addIgnoredException(exceptionString);
}
});
@@ -269,9 +271,9 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
public void run2() {
Region region = getCache().getRegion("root/"+name);
- getLogWriter().info("t1 is invoking get("+objectName+")");
+ LogWriterUtils.getLogWriter().info("t1 is invoking get("+objectName+")");
try {
- getLogWriter().info("t1 retrieved value " + region.get(objectName));
+ LogWriterUtils.getLogWriter().info("t1 retrieved value " + region.get(objectName));
fail("first load should have triggered an exception");
} catch (RuntimeException e) {
if (!e.getMessage().contains(exceptionString)) {
@@ -286,7 +288,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");
+ LogWriterUtils.getLogWriter().info("t2 is waiting for loader to be invoked by t1");
try {
loaderInvokedLatch.await(30, TimeUnit.SECONDS);
} catch (InterruptedException e) {
@@ -325,7 +327,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
fail("get() operation blocked for too long - test needs some work");
}
- getLogWriter().info("t2 is invoking get("+objectName+")");
+ LogWriterUtils.getLogWriter().info("t2 is invoking get("+objectName+")");
Object value = valueHolder[0];
if (value instanceof RuntimeException) {
if ( ((Exception)value).getMessage().contains(exceptionString) ) {
@@ -334,7 +336,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
throw (RuntimeException)value;
}
} else {
- getLogWriter().info("t2 retrieved value " + value);
+ LogWriterUtils.getLogWriter().info("t2 retrieved value " + value);
assertNotNull(value);
}
}
@@ -378,10 +380,10 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
assertNull(result);
}
catch(CacheLoaderException cle) {
- fail("While getting value for ACK region", cle);
+ Assert.fail("While getting value for ACK region", cle);
}
catch(TimeoutException te) {
- fail("While getting value for ACK region", te);
+ Assert.fail("While getting value for ACK region", te);
}
}
@@ -392,7 +394,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);
@@ -426,7 +428,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
}
catch (CacheException ex) {
- fail("While creating ACK region", ex);
+ Assert.fail("While creating ACK region", ex);
}
}
});
@@ -449,7 +451,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
createRegion(name,factory.create());
}
catch (CacheException ex) {
- fail("While creating ACK region", ex);
+ Assert.fail("While creating ACK region", ex);
}
}
});
@@ -464,7 +466,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
}
catch(CacheLoaderException cle) {
- fail("While getting value for ACK region", cle);
+ Assert.fail("While getting value for ACK region", cle);
}
/* catch(EntryNotFoundException enfe) {
@@ -472,7 +474,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
}*/
catch(TimeoutException te) {
- fail("While getting value for ACK region", te);
+ Assert.fail("While getting value for ACK region", te);
}
}
@@ -487,7 +489,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);
@@ -522,7 +524,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
region.create(objectName,null);
}
catch (CacheException ex) {
- fail("While creating ACK region", ex);
+ Assert.fail("While creating ACK region", ex);
}
}
});
@@ -549,7 +551,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
createRegion(name,factory.create());
}
catch (CacheException ex) {
- fail("While creating ACK region", ex);
+ Assert.fail("While creating ACK region", ex);
}
}
};
@@ -566,7 +568,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
}
catch(CacheLoaderException cle) {
- fail("While getting value for ACK region", cle);
+ Assert.fail("While getting value for ACK region", cle);
}
/* catch(EntryNotFoundException enfe) {
@@ -574,7 +576,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
}*/
catch(TimeoutException te) {
- fail("While getting value for ACK region", te);
+ Assert.fail("While getting value for ACK region", te);
}
}
@@ -640,7 +642,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
}
catch (CacheException ex) {
- fail("While creating ACK region", ex);
+ Assert.fail("While creating ACK region", ex);
}
}
});
@@ -665,7 +667,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
createRegion(name,factory.create());
}
catch (CacheException ex) {
- fail("While creating ACK region", ex);
+ Assert.fail("While creating ACK region", ex);
}
}
});
@@ -731,7 +733,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
}
catch (CacheException ex) {
- fail("While creating ACK region", ex);
+ Assert.fail("While creating ACK region", ex);
}
}
});
@@ -746,7 +748,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
createRegion(name,factory.create());
}
catch (CacheException ex) {
- fail("While creating ACK region", ex);
+ Assert.fail("While creating ACK region", ex);
}
}
});
@@ -828,7 +830,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
}
catch (CacheException ex) {
- fail("While creating replicated region", ex);
+ Assert.fail("While creating replicated region", ex);
}
}
});
@@ -841,7 +843,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
createRegion(name,factory.create());
}
catch (CacheException ex) {
- fail("While creating empty region", ex);
+ Assert.fail("While creating empty region", ex);
}
}
});
@@ -910,7 +912,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
createRegion(name,factory.create());
}
catch (CacheException ex) {
- fail("While creating empty region", ex);
+ Assert.fail("While creating empty region", ex);
}
}
});
@@ -923,7 +925,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
createRegion(name,factory.create());
}
catch (CacheException ex) {
- fail("While creating empty region", ex);
+ Assert.fail("While creating empty region", ex);
}
}
});
@@ -964,7 +966,7 @@ public class SearchAndLoadDUnitTest extends CacheTestCase {
}
catch (CacheException ex) {
- fail("While creating replicated region", ex);
+ Assert.fail("While creating replicated region", ex);
}
}
});
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/SlowRecDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/SlowRecDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/SlowRecDUnitTest.java
index 4d5cac2..899fbb1 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/SlowRecDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/SlowRecDUnitTest.java
@@ -39,10 +39,13 @@ import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
import com.gemstone.gemfire.distributed.internal.DM;
import com.gemstone.gemfire.distributed.internal.DMStats;
import com.gemstone.gemfire.internal.tcp.Connection;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
@@ -71,12 +74,10 @@ public class SlowRecDUnitTest extends CacheTestCase {
super.setUp();
}
}
- public void tearDown2() throws Exception {
- try {
- super.tearDown2();
- } finally {
- disconnectAllFromDS();
- }
+
+ @Override
+ protected final void postTearDownCacheTestCase() throws Exception {
+ disconnectAllFromDS();
}
////////////////////// Test Methods //////////////////////
@@ -164,7 +165,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
return "waiting for callback";
}
};
- DistributedTestCase.waitForCriterion(ev, 50 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 50 * 1000, 200, true);
assertEquals(lcb, lastCallback);
}
if (lastValue == null) {
@@ -177,7 +178,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
return "waiting for key to become null";
}
};
- DistributedTestCase.waitForCriterion(ev, 50 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 50 * 1000, 200, true);
assertEquals(null, r1.getEntry("key"));
} else if (CHECK_INVALID.equals(lastValue)) {
// should be invalid
@@ -195,7 +196,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
return "waiting for invalidate";
}
};
- DistributedTestCase.waitForCriterion(ev, 50 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 50 * 1000, 200, true);
// assertNotNull(re);
// assertEquals(null, value);
}
@@ -234,7 +235,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
return "Waiting for async threads to disappear";
}
};
- DistributedTestCase.waitForCriterion(ev, 10 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 10 * 1000, 200, true);
}
private void forceQueuing(final Region r) throws CacheException {
@@ -251,7 +252,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
return "waiting for flushes to start";
}
};
- DistributedTestCase.waitForCriterion(ev, 2 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 2 * 1000, 200, true);
}
/**
@@ -294,7 +295,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
dequeuedMsgs = stats.getAsyncDequeuedMsgs();
curQueuedMsgs = queuedMsgs - dequeuedMsgs;
}
- getLogWriter().info("After " + count + " " + " puts slowrec mode kicked in by queuing " + queuedMsgs + " for a total size of " + queueSize);
+ LogWriterUtils.getLogWriter().info("After " + count + " " + " puts slowrec mode kicked in by queuing " + queuedMsgs + " for a total size of " + queueSize);
} finally {
forceQueueFlush();
}
@@ -307,9 +308,9 @@ public class SlowRecDUnitTest extends CacheTestCase {
}
};
final long start = System.currentTimeMillis();
- DistributedTestCase.waitForCriterion(ev, 30 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 30 * 1000, 200, true);
final long finish = System.currentTimeMillis();
- getLogWriter().info("After " + (finish - start) + " ms async msgs where flushed. A total of " + stats.getAsyncDequeuedMsgs() + " were flushed. lastValue=" + lastValue);
+ LogWriterUtils.getLogWriter().info("After " + (finish - start) + " ms async msgs where flushed. A total of " + stats.getAsyncDequeuedMsgs() + " were flushed. lastValue=" + lastValue);
checkLastValueInOtherVm(lastValue, null);
}
@@ -392,7 +393,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
// + " dequeuedMsgs=" + dequeuedMsgs
// + " conflatedMsgs=" + conflatedMsgs);
final long finish = System.currentTimeMillis();
- getLogWriter().info("After " + (finish - start) + " ms async msgs where flushed. A total of " + (stats.getAsyncDequeuedMsgs()-intialDeQueuedMsgs) + " were flushed. Leaving a queue size of " + stats.getAsyncQueueSize() + ". The lastValue was " + lastValue);
+ LogWriterUtils.getLogWriter().info("After " + (finish - start) + " ms async msgs where flushed. A total of " + (stats.getAsyncDequeuedMsgs()-intialDeQueuedMsgs) + " were flushed. Leaving a queue size of " + stats.getAsyncQueueSize() + ". The lastValue was " + lastValue);
checkLastValueInOtherVm(lastValue, null);
}
@@ -436,8 +437,8 @@ public class SlowRecDUnitTest extends CacheTestCase {
// give threads a chance to get queued
try {Thread.sleep(100);} catch (InterruptedException ignore) {fail("interrupted");}
forceQueueFlush();
- DistributedTestCase.join(t, 2 * 1000, getLogWriter());
- DistributedTestCase.join(t2, 2 * 1000, getLogWriter());
+ ThreadUtils.join(t, 2 * 1000);
+ ThreadUtils.join(t2, 2 * 1000);
long endQueuedMsgs = stats.getAsyncQueuedMsgs();
long endConflatedMsgs = stats.getAsyncConflatedMsgs();
assertEquals(startConflatedMsgs, endConflatedMsgs);
@@ -480,7 +481,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
// now make sure update+destroy does not conflate
final Object key = "key";
- getLogWriter().info("[testConflationSequence] about to force queuing");
+ LogWriterUtils.getLogWriter().info("[testConflationSequence] about to force queuing");
forceQueuing(r);
int count = 0;
@@ -492,7 +493,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
// long dequeuedMsgs = stats.getAsyncDequeuedMsgs();
int endCount = count+60;
- getLogWriter().info("[testConflationSequence] about to build up queue");
+ LogWriterUtils.getLogWriter().info("[testConflationSequence] about to build up queue");
long begin = System.currentTimeMillis();
while (count < endCount) {
value = "count=" + count;
@@ -515,14 +516,14 @@ public class SlowRecDUnitTest extends CacheTestCase {
checkLastValueInOtherVm(lastValue, mylcb);
// now make sure create+update+localDestroy does not conflate
- getLogWriter().info("[testConflationSequence] force queuing create-update-destroy");
+ LogWriterUtils.getLogWriter().info("[testConflationSequence] force queuing create-update-destroy");
forceQueuing(r);
initialConflatedMsgs = stats.getAsyncConflatedMsgs();
// initialDequeuedMsgs = stats.getAsyncDequeuedMsgs();
// dequeuedMsgs = stats.getAsyncDequeuedMsgs();
endCount = count + 40;
- getLogWriter().info("[testConflationSequence] create-update-destroy");
+ LogWriterUtils.getLogWriter().info("[testConflationSequence] create-update-destroy");
begin = System.currentTimeMillis();
while (count < endCount) {
value = "count=" + count;
@@ -542,7 +543,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
checkLastValueInOtherVm(lastValue, null);
// now make sure update+invalidate does not conflate
- getLogWriter().info("[testConflationSequence] force queuing update-invalidate");
+ LogWriterUtils.getLogWriter().info("[testConflationSequence] force queuing update-invalidate");
forceQueuing(r);
initialConflatedMsgs = stats.getAsyncConflatedMsgs();
// initialDequeuedMsgs = stats.getAsyncDequeuedMsgs();
@@ -553,7 +554,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
// dequeuedMsgs = stats.getAsyncDequeuedMsgs();
endCount = count + 40;
- getLogWriter().info("[testConflationSequence] update-invalidate");
+ LogWriterUtils.getLogWriter().info("[testConflationSequence] update-invalidate");
begin = System.currentTimeMillis();
while (count < endCount) {
value = "count=" + count;
@@ -568,14 +569,14 @@ public class SlowRecDUnitTest extends CacheTestCase {
}
assertEquals(initialConflatedMsgs, stats.getAsyncConflatedMsgs());
forceQueueFlush();
- getLogWriter().info("[testConflationSequence] assert other vm");
+ LogWriterUtils.getLogWriter().info("[testConflationSequence] assert other vm");
checkLastValueInOtherVm(lastValue, null);
r.destroy(key);
// now make sure updates to a conflating region are conflated even while
// updates to a non-conflating are not.
- getLogWriter().info("[testConflationSequence] conflate & no-conflate regions");
+ LogWriterUtils.getLogWriter().info("[testConflationSequence] conflate & no-conflate regions");
forceQueuing(r);
final int initialAsyncSocketWrites = stats.getAsyncSocketWrites();
// initialDequeuedMsgs = stats.getAsyncDequeuedMsgs();
@@ -605,7 +606,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
endCount = count + 80;
begin = System.currentTimeMillis();
- getLogWriter().info("[testConflationSequence:DEBUG] count=" + count
+ LogWriterUtils.getLogWriter().info("[testConflationSequence:DEBUG] count=" + count
+ " queuedMsgs=" + stats.getAsyncQueuedMsgs()
+ " conflatedMsgs=" + stats.getAsyncConflatedMsgs()
+ " dequeuedMsgs=" + stats.getAsyncDequeuedMsgs()
@@ -636,7 +637,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
}
forceQueueFlush();
- getLogWriter().info("[testConflationSequence] assert other vm");
+ LogWriterUtils.getLogWriter().info("[testConflationSequence] assert other vm");
checkLastValueInOtherVm(lastValue, null);
}
/**
@@ -687,7 +688,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
fail("should have exceeded max-queue-size by now");
}
}
- getLogWriter().info("After " + count + " " + VALUE_SIZE + " byte puts slowrec mode kicked in but the queue filled when its size reached " + queueSize + " with " + queuedMsgs + " msgs");
+ LogWriterUtils.getLogWriter().info("After " + count + " " + VALUE_SIZE + " byte puts slowrec mode kicked in but the queue filled when its size reached " + queueSize + " with " + queuedMsgs + " msgs");
// make sure we lost a connection to vm0
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
@@ -698,7 +699,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
return "waiting for connection loss";
}
};
- DistributedTestCase.waitForCriterion(ev, 30 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 30 * 1000, 200, true);
}
finally {
forceQueueFlush();
@@ -759,7 +760,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
fail("should have exceeded async-queue-timeout by now");
}
}
- getLogWriter().info("After " + count + " " + VALUE_SIZE + " byte puts slowrec mode kicked in but the queue filled when its size reached " + queueSize + " with " + queuedMsgs + " msgs");
+ LogWriterUtils.getLogWriter().info("After " + count + " " + VALUE_SIZE + " byte puts slowrec mode kicked in but the queue filled when its size reached " + queueSize + " with " + queuedMsgs + " msgs");
// make sure we lost a connection to vm0
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
@@ -772,7 +773,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
return "waiting for departure";
}
};
- DistributedTestCase.waitForCriterion(ev, 2 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 2 * 1000, 200, true);
}
finally {
getCache().getLogger().info(removeExpected);
@@ -817,7 +818,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
public final Object CONTROL_LOCK = new Object();
public void afterCreate(EntryEvent event) {
- getLogWriter().info(event.getRegion().getName() + " afterCreate " + event.getKey());
+ LogWriterUtils.getLogWriter().info(event.getRegion().getName() + " afterCreate " + event.getKey());
synchronized(this.CONTROL_LOCK) {
if (event.getCallbackArgument() != null) {
this.callbackArguments.add(
@@ -829,7 +830,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
processEvent(event);
}
public void afterUpdate(EntryEvent event) {
- getLogWriter().info(event.getRegion().getName() + " afterUpdate " + event.getKey());
+ LogWriterUtils.getLogWriter().info(event.getRegion().getName() + " afterUpdate " + event.getKey());
synchronized(this.CONTROL_LOCK) {
if (event.getCallbackArgument() != null) {
this.callbackArguments.add(
@@ -883,14 +884,14 @@ public class SlowRecDUnitTest extends CacheTestCase {
}
private void processSleep(EntryEvent event) {
int sleepMs = ((Integer)event.getNewValue()).intValue();
- getLogWriter().info("[processSleep] sleeping for " + sleepMs);
+ LogWriterUtils.getLogWriter().info("[processSleep] sleeping for " + sleepMs);
try {
Thread.sleep(sleepMs);
} catch (InterruptedException ignore) {fail("interrupted");}
}
private void processWait(EntryEvent event) {
int sleepMs = ((Integer)event.getNewValue()).intValue();
- getLogWriter().info("[processWait] waiting for " + sleepMs);
+ LogWriterUtils.getLogWriter().info("[processWait] waiting for " + sleepMs);
synchronized(this.CONTROL_LOCK) {
try {
this.CONTROL_LOCK.wait(sleepMs);
@@ -898,7 +899,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
}
}
private void processDisconnect(EntryEvent event) {
- getLogWriter().info("[processDisconnect] disconnecting");
+ LogWriterUtils.getLogWriter().info("[processDisconnect] disconnecting");
disconnectFromDS();
}
};
@@ -919,7 +920,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
throw e;
}
catch (Throwable t) {
- getLogWriter().error("Encountered exception: ", t);
+ LogWriterUtils.getLogWriter().error("Encountered exception: ", t);
throw t;
}
finally {
@@ -988,11 +989,11 @@ public class SlowRecDUnitTest extends CacheTestCase {
});
// put vm0 cache listener into wait
- getLogWriter().info("[doTestMultipleRegionConflation] about to put vm0 into wait");
+ LogWriterUtils.getLogWriter().info("[doTestMultipleRegionConflation] about to put vm0 into wait");
r1.put(KEY_WAIT, new Integer(millisToWait));
// build up queue size
- getLogWriter().info("[doTestMultipleRegionConflation] building up queue size...");
+ LogWriterUtils.getLogWriter().info("[doTestMultipleRegionConflation] building up queue size...");
final Object key = "key";
final int socketBufferSize = getSystem().getConfig().getSocketBufferSize();
final int VALUE_SIZE = socketBufferSize*3;
@@ -1005,7 +1006,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
r1.put(key, value);
}
- getLogWriter().info("[doTestMultipleRegionConflation] After " +
+ LogWriterUtils.getLogWriter().info("[doTestMultipleRegionConflation] After " +
count + " puts of size " + VALUE_SIZE +
" slowrec mode kicked in with queue size=" + stats.getAsyncQueueSize());
@@ -1063,7 +1064,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
CALLBACK_DESTROY, CALLBACK_CREATE, CALLBACK_UPDATE };
// send notify to vm0
- getLogWriter().info("[doTestMultipleRegionConflation] wake up vm0");
+ LogWriterUtils.getLogWriter().info("[doTestMultipleRegionConflation] wake up vm0");
getOtherVm().invoke(new SerializableRunnable("Wake up other vm") {
public void run() {
synchronized(doTestMultipleRegionConflation_R1_Listener.CONTROL_LOCK) {
@@ -1073,7 +1074,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
});
// wait for queue to be flushed
- getLogWriter().info("[doTestMultipleRegionConflation] wait for vm0");
+ LogWriterUtils.getLogWriter().info("[doTestMultipleRegionConflation] wait for vm0");
getOtherVm().invoke(new SerializableRunnable("Wait for other vm") {
public void run() {
try {
@@ -1092,12 +1093,12 @@ public class SlowRecDUnitTest extends CacheTestCase {
});
// assert values on both listeners
- getLogWriter().info("[doTestMultipleRegionConflation] assert callback arguments");
+ LogWriterUtils.getLogWriter().info("[doTestMultipleRegionConflation] assert callback arguments");
getOtherVm().invoke(new SerializableRunnable("Assert callback arguments") {
public void run() {
synchronized(doTestMultipleRegionConflation_R1_Listener.CONTROL_LOCK) {
- getLogWriter().info("doTestMultipleRegionConflation_R1_Listener.callbackArguments=" + doTestMultipleRegionConflation_R1_Listener.callbackArguments);
- getLogWriter().info("doTestMultipleRegionConflation_R1_Listener.callbackTypes=" + doTestMultipleRegionConflation_R1_Listener.callbackTypes);
+ LogWriterUtils.getLogWriter().info("doTestMultipleRegionConflation_R1_Listener.callbackArguments=" + doTestMultipleRegionConflation_R1_Listener.callbackArguments);
+ LogWriterUtils.getLogWriter().info("doTestMultipleRegionConflation_R1_Listener.callbackTypes=" + doTestMultipleRegionConflation_R1_Listener.callbackTypes);
assertEquals(doTestMultipleRegionConflation_R1_Listener.callbackArguments.size(),
doTestMultipleRegionConflation_R1_Listener.callbackTypes.size());
int i = 0;
@@ -1111,8 +1112,8 @@ public class SlowRecDUnitTest extends CacheTestCase {
}
}
synchronized(doTestMultipleRegionConflation_R2_Listener.CONTROL_LOCK) {
- getLogWriter().info("doTestMultipleRegionConflation_R2_Listener.callbackArguments=" + doTestMultipleRegionConflation_R2_Listener.callbackArguments);
- getLogWriter().info("doTestMultipleRegionConflation_R2_Listener.callbackTypes=" + doTestMultipleRegionConflation_R2_Listener.callbackTypes);
+ LogWriterUtils.getLogWriter().info("doTestMultipleRegionConflation_R2_Listener.callbackArguments=" + doTestMultipleRegionConflation_R2_Listener.callbackArguments);
+ LogWriterUtils.getLogWriter().info("doTestMultipleRegionConflation_R2_Listener.callbackTypes=" + doTestMultipleRegionConflation_R2_Listener.callbackTypes);
assertEquals(doTestMultipleRegionConflation_R2_Listener.callbackArguments.size(),
doTestMultipleRegionConflation_R2_Listener.callbackTypes.size());
int i = 0;
@@ -1141,7 +1142,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
throw e;
}
catch (Throwable t) {
- getLogWriter().error("Encountered exception: ", t);
+ LogWriterUtils.getLogWriter().error("Encountered exception: ", t);
throw t;
}
finally {
@@ -1187,13 +1188,13 @@ public class SlowRecDUnitTest extends CacheTestCase {
});
// put vm0 cache listener into wait
- getLogWriter().info("[testDisconnectCleanup] about to put vm0 into wait");
+ LogWriterUtils.getLogWriter().info("[testDisconnectCleanup] about to put vm0 into wait");
int millisToWait = 1000 * 60 * 5; // 5 minutes
r.put(KEY_WAIT, new Integer(millisToWait));
r.put(KEY_DISCONNECT, KEY_DISCONNECT);
// build up queue size
- getLogWriter().info("[testDisconnectCleanup] building up queue size...");
+ LogWriterUtils.getLogWriter().info("[testDisconnectCleanup] building up queue size...");
final Object key = "key";
final int socketBufferSize = getSystem().getConfig().getSocketBufferSize();
final int VALUE_SIZE = socketBufferSize*3;
@@ -1208,7 +1209,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
assertFalse(System.currentTimeMillis() >= abortMillis);
}
- getLogWriter().info("[testDisconnectCleanup] After " +
+ LogWriterUtils.getLogWriter().info("[testDisconnectCleanup] After " +
count + " puts of size " + VALUE_SIZE +
" slowrec mode kicked in with queue size=" + stats.getAsyncQueueSize());
@@ -1221,11 +1222,11 @@ public class SlowRecDUnitTest extends CacheTestCase {
assertTrue(stats.getAsyncQueuedMsgs() >= 10);
while (stats.getAsyncQueues() < 1) {
- pause(100);
+ Wait.pause(100);
assertFalse(System.currentTimeMillis() >= abortMillis);
}
- getLogWriter().info("[testDisconnectCleanup] After " +
+ LogWriterUtils.getLogWriter().info("[testDisconnectCleanup] After " +
count + " puts of size " + VALUE_SIZE + " queue size has reached " +
stats.getAsyncQueueSize() + " bytes and number of queues is " +
stats.getAsyncQueues() + ".");
@@ -1237,7 +1238,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
assertTrue(dm.getOtherDistributionManagerIds().size() > others.size());
// send notify to vm0
- getLogWriter().info("[testDisconnectCleanup] wake up vm0");
+ LogWriterUtils.getLogWriter().info("[testDisconnectCleanup] wake up vm0");
getOtherVm().invoke(new SerializableRunnable("Wake up other vm") {
public void run() {
synchronized(doTestDisconnectCleanup_Listener.CONTROL_LOCK) {
@@ -1247,7 +1248,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
});
// make sure we lost a connection to vm0
- getLogWriter().info("[testDisconnectCleanup] wait for vm0 to disconnect");
+ LogWriterUtils.getLogWriter().info("[testDisconnectCleanup] wait for vm0 to disconnect");
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
return dm.getOtherDistributionManagerIds().size() <= others.size();
@@ -1256,11 +1257,11 @@ public class SlowRecDUnitTest extends CacheTestCase {
return "waiting for disconnect";
}
};
- DistributedTestCase.waitForCriterion(ev, 2 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 2 * 1000, 200, true);
assertEquals(others, dm.getOtherDistributionManagerIds());
// check free memory... perform wait loop with System.gc
- getLogWriter().info("[testDisconnectCleanup] wait for queue cleanup");
+ LogWriterUtils.getLogWriter().info("[testDisconnectCleanup] wait for queue cleanup");
ev = new WaitCriterion() {
public boolean done() {
if (stats.getAsyncQueues() <= initialQueues) {
@@ -1273,7 +1274,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
return "waiting for queue cleanup";
}
};
- DistributedTestCase.waitForCriterion(ev, 2 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 2 * 1000, 200, true);
// getLogWriter().info("[testDisconnectCleanup] initialQueues=" +
// initialQueues + " asyncQueues=" + stats.getAsyncQueues());
assertEquals(initialQueues, stats.getAsyncQueues());
@@ -1295,7 +1296,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
throw e;
}
catch (Throwable t) {
- getLogWriter().error("Encountered exception: ", t);
+ LogWriterUtils.getLogWriter().error("Encountered exception: ", t);
throw t;
}
finally {
@@ -1343,12 +1344,12 @@ public class SlowRecDUnitTest extends CacheTestCase {
});
// put vm0 cache listener into wait
- getLogWriter().info("[testPartialMessage] about to put vm0 into wait");
+ LogWriterUtils.getLogWriter().info("[testPartialMessage] about to put vm0 into wait");
final int millisToWait = 1000 * 60 * 5; // 5 minutes
r.put(KEY_WAIT, new Integer(millisToWait));
// build up queue size
- getLogWriter().info("[testPartialMessage] building up queue size...");
+ LogWriterUtils.getLogWriter().info("[testPartialMessage] building up queue size...");
final Object key = "key";
final int socketBufferSize = getSystem().getConfig().getSocketBufferSize();
final int VALUE_SIZE = socketBufferSize*3;
@@ -1364,11 +1365,11 @@ public class SlowRecDUnitTest extends CacheTestCase {
final int partialId = count;
assertEquals(0, stats.getAsyncConflatedMsgs());
- getLogWriter().info("[testPartialMessage] After " +
+ LogWriterUtils.getLogWriter().info("[testPartialMessage] After " +
count + " puts of size " + VALUE_SIZE +
" slowrec mode kicked in with queue size=" + stats.getAsyncQueueSize());
- pause(2000);
+ Wait.pause(2000);
// conflate 10 times
while (stats.getAsyncConflatedMsgs() < 10) {
@@ -1393,7 +1394,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
final int[] expectedArgs = { partialId, conflateId };
// send notify to vm0
- getLogWriter().info("[testPartialMessage] wake up vm0");
+ LogWriterUtils.getLogWriter().info("[testPartialMessage] wake up vm0");
getOtherVm().invoke(new SerializableRunnable("Wake up other vm") {
public void run() {
synchronized(doTestPartialMessage_Listener.CONTROL_LOCK) {
@@ -1403,7 +1404,7 @@ public class SlowRecDUnitTest extends CacheTestCase {
});
// wait for queue to be flushed
- getLogWriter().info("[testPartialMessage] wait for vm0");
+ LogWriterUtils.getLogWriter().info("[testPartialMessage] wait for vm0");
getOtherVm().invoke(new SerializableRunnable("Wait for other vm") {
public void run() {
try {
@@ -1429,11 +1430,11 @@ public class SlowRecDUnitTest extends CacheTestCase {
});
// assert values on both listeners
- getLogWriter().info("[testPartialMessage] assert callback arguments");
+ LogWriterUtils.getLogWriter().info("[testPartialMessage] assert callback arguments");
getOtherVm().invoke(new SerializableRunnable("Assert callback arguments") {
public void run() {
synchronized(doTestPartialMessage_Listener.CONTROL_LOCK) {
- getLogWriter().info("[testPartialMessage] " +
+ LogWriterUtils.getLogWriter().info("[testPartialMessage] " +
"doTestPartialMessage_Listener.callbackArguments=" +
doTestPartialMessage_Listener.callbackArguments);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TXDistributedDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TXDistributedDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TXDistributedDUnitTest.java
index 2c065a1..7a306f0 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TXDistributedDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TXDistributedDUnitTest.java
@@ -79,11 +79,17 @@ import com.gemstone.gemfire.internal.cache.TXStateProxyImpl;
import com.gemstone.gemfire.internal.cache.locks.TXLockBatch;
import com.gemstone.gemfire.internal.cache.locks.TXLockService;
import com.gemstone.gemfire.internal.cache.locks.TXLockServiceImpl;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+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.Host;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
public class TXDistributedDUnitTest extends CacheTestCase {
public TXDistributedDUnitTest(String name) {
@@ -107,19 +113,19 @@ public class TXDistributedDUnitTest extends CacheTestCase {
* Test a remote grantor
*/
public void testRemoteGrantor() throws Exception {
- addExpectedException("killing members ds");
+ IgnoredException.addIgnoredException("killing members ds");
final CacheTransactionManager txMgr = this.getCache().getCacheTransactionManager();
final String rgnName = getUniqueName();
Region rgn = getCache().createRegion(rgnName, getRegionAttributes());
rgn.create("key", null);
- invokeInEveryVM(new SerializableRunnable("testRemoteGrantor: initial configuration") {
+ Invoke.invokeInEveryVM(new SerializableRunnable("testRemoteGrantor: initial configuration") {
public void run() {
try {
Region rgn1 = getCache().createRegion(rgnName, getRegionAttributes());
rgn1.put("key", "val0");
} catch (CacheException e) {
- fail("While creating region", e);
+ Assert.fail("While creating region", e);
}
}
});
@@ -188,11 +194,11 @@ public class TXDistributedDUnitTest extends CacheTestCase {
assertTrue(!TXLockService.getDTLS().isLockGrantor());
}
} catch (CacheException e) {
- fail("While creating region", e);
+ Assert.fail("While creating region", e);
}
}
};
- invokeInEveryVM(remoteComm);
+ Invoke.invokeInEveryVM(remoteComm);
// vm1.invoke(remoteComm);
// vm2.invoke(remoteComm);
@@ -227,7 +233,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
rgn2.create("key", null);
rgn3.create("key", null);
} catch (CacheException e) {
- fail("While creating region", e);
+ Assert.fail("While creating region", e);
}
}
};
@@ -461,7 +467,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
});
Region rgn = getCache().createRegion(rgnName, factory.create());
- invokeInEveryVM(new SerializableRunnable("testDACKLoadedMessage: intial configuration") {
+ Invoke.invokeInEveryVM(new SerializableRunnable("testDACKLoadedMessage: intial configuration") {
public void run() {
try {
AttributesFactory factory2 = new AttributesFactory();
@@ -471,7 +477,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
factory2.setMirrorType(MirrorType.KEYS);
getCache().createRegion(rgnName, factory2.create());
} catch (CacheException e) {
- fail("While creating region", e);
+ Assert.fail("While creating region", e);
}
}
});
@@ -482,7 +488,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
txMgr.commit();
assertEquals("val1", rgn.getEntry("key1").getValue());
- invokeInEveryVM(new SerializableRunnable("testDACKLoadedMessage: confirm standard case") {
+ Invoke.invokeInEveryVM(new SerializableRunnable("testDACKLoadedMessage: confirm standard case") {
public void run() {
Region rgn1 = getCache().getRegion(rgnName);
assertEquals("val1", rgn1.getEntry("key1").getValue());
@@ -495,7 +501,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
txMgr.commit();
assertEquals("val2", rgn.getEntry("key2").getValue());
- invokeInEveryVM(new SerializableRunnable("testDACKLoadedMessage: confirm standard case") {
+ Invoke.invokeInEveryVM(new SerializableRunnable("testDACKLoadedMessage: confirm standard case") {
public void run() {
Region rgn1 = getCache().getRegion(rgnName);
assertEquals("val2", rgn1.getEntry("key2").getValue());
@@ -508,7 +514,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
rgn.get("key4", new Integer(4));
txMgr.commit();
- invokeInEveryVM(new SerializableRunnable("testDACKLoadedMessage: confirm standard case") {
+ Invoke.invokeInEveryVM(new SerializableRunnable("testDACKLoadedMessage: confirm standard case") {
public void run() {
Region rgn1 = getCache().getRegion(rgnName);
assertEquals("val3", rgn1.getEntry("key3").getValue());
@@ -521,12 +527,12 @@ public class TXDistributedDUnitTest extends CacheTestCase {
@Override
public Properties getDistributedSystemProperties() {
Properties p = super.getDistributedSystemProperties();
- p.put("log-level", getDUnitLogLevel());
+ p.put("log-level", LogWriterUtils.getDUnitLogLevel());
return p;
}
public void testHighAvailabilityFeatures() throws Exception {
- addExpectedException("DistributedSystemDisconnectedException");
+ IgnoredException.addIgnoredException("DistributedSystemDisconnectedException");
// final CacheTransactionManager txMgr = this.getCache().getCacheTransactionManager();
// final TXManagerImpl txMgrImpl = (TXManagerImpl) txMgr;
final String rgnName = getUniqueName();
@@ -534,7 +540,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setEarlyAck(false);
Region rgn = getCache().createRegion(rgnName, factory.create());
- invokeInEveryVM(new SerializableRunnable("testHighAvailabilityFeatures: intial region configuration") {
+ Invoke.invokeInEveryVM(new SerializableRunnable("testHighAvailabilityFeatures: intial region configuration") {
public void run() {
try {
AttributesFactory factory2 = new AttributesFactory();
@@ -543,7 +549,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
factory2.setDataPolicy(DataPolicy.REPLICATE);
getCache().createRegion(rgnName, factory2.create());
} catch (CacheException e) {
- fail("While creating region", e);
+ Assert.fail("While creating region", e);
}
}
});
@@ -615,7 +621,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
factory2.setDataPolicy(DataPolicy.REPLICATE);
rgn1 = getCache().createRegion(rgnName, factory2.create());
} catch (CacheException e) {
- fail("While creating region", e);
+ Assert.fail("While creating region", e);
}
}
Region.Entry re = rgn1.getEntry("key0");
@@ -626,7 +632,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
assertEquals("val1_0", re.getValue());
}
};
- invokeInEveryVM(noChangeValidator);
+ Invoke.invokeInEveryVM(noChangeValidator);
// Test that there is no commit after sending to all recipients
// but prior to sending the "commit process" message
@@ -667,7 +673,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
}
});
// 3. verify on all VMs, including the origin, that the transaction was not committed
- invokeInEveryVM(noChangeValidator);
+ Invoke.invokeInEveryVM(noChangeValidator);
// Test commit success upon a single commit process message received.
originVM.invoke(new SerializableRunnable("Flakey DuringIndividualCommitProcess Transaction") {
@@ -727,7 +733,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
factory2.setDataPolicy(DataPolicy.REPLICATE);
rgn1 = getCache().createRegion(rgnName, factory2.create());
} catch (CacheException e) {
- fail("While creating region", e);
+ Assert.fail("While creating region", e);
}
}
long giveUp = System.currentTimeMillis() + 10000;
@@ -748,7 +754,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
}
}
};
- invokeInEveryVM(nonSoloChangeValidator1);
+ Invoke.invokeInEveryVM(nonSoloChangeValidator1);
// Verify successful solo region commit after duringIndividualSend
// (same as afterIndividualSend).
@@ -766,7 +772,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
rgn1.put("soloKey0", "soloVal0_0");
rgn1.put("soloKey1", "soloVal1_0");
} catch (CacheException e) {
- fail("While creating region", e);
+ Assert.fail("While creating region", e);
}
}
};
@@ -829,7 +835,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
factory2.setDataPolicy(DataPolicy.REPLICATE);
soloRgn = getCache().createRegion(soloRegionName, factory2.create());
} catch (CacheException e) {
- fail("While creating region ", e);
+ Assert.fail("While creating region ", e);
}
}
Region.Entry re = soloRgn.getEntry("soloKey0");
@@ -843,7 +849,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
originVM.invoke(soloRegionCommitValidator1);
soloRegionVM.invoke(soloRegionCommitValidator1);
// verify no change in nonSolo region, re-establish region in originVM
- invokeInEveryVM(nonSoloChangeValidator1);
+ Invoke.invokeInEveryVM(nonSoloChangeValidator1);
// Verify no commit for failed send (afterIndividualSend) for solo
// Region combined with non-solo Region
@@ -893,7 +899,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
// Origin and Solo Region VM should be the same as last validation
originVM.invoke(soloRegionCommitValidator1);
soloRegionVM.invoke(soloRegionCommitValidator1);
- invokeInEveryVM(nonSoloChangeValidator1);
+ Invoke.invokeInEveryVM(nonSoloChangeValidator1);
// Verify commit after sending a single
// (duringIndividualCommitProcess) commit process for solo Region
@@ -959,7 +965,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
factory2.setDataPolicy(DataPolicy.REPLICATE);
soloRgn = getCache().createRegion(soloRegionName, factory2.create());
} catch (CacheException e) {
- fail("While creating region ", e);
+ Assert.fail("While creating region ", e);
}
}
Region.Entry re = soloRgn.getEntry("soloKey0");
@@ -985,7 +991,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
factory2.setDataPolicy(DataPolicy.REPLICATE);
rgn1 = getCache().createRegion(rgnName, factory2.create());
} catch (CacheException e) {
- fail("While creating region", e);
+ Assert.fail("While creating region", e);
}
}
Region.Entry re = rgn1.getEntry("key0");
@@ -996,7 +1002,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
assertEquals("val1_5", re.getValue());
}
};
- invokeInEveryVM(nonSoloChangeValidator2);
+ Invoke.invokeInEveryVM(nonSoloChangeValidator2);
}
/**
@@ -1110,7 +1116,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
Region rgn1 = getCache().createRegion(rgnName, getRegionAttributes());
rgn1.create("key", null);
} catch (CacheException e) {
- fail("While creating region", e);
+ Assert.fail("While creating region", e);
}
}
};
@@ -1217,7 +1223,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
factory.setDataPolicy(DataPolicy.REPLICATE);
getCache().createRegion(rgnName, factory.create());
} catch (CacheException e) {
- fail("While creating region", e);
+ Assert.fail("While creating region", e);
}
}
});
@@ -1409,9 +1415,9 @@ public class TXDistributedDUnitTest extends CacheTestCase {
}
}
};
- ExpectedException ee = null;
+ IgnoredException ee = null;
try {
- ee = addExpectedException(DiskAccessException.class.getName() + "|" +
+ ee = IgnoredException.addIgnoredException(DiskAccessException.class.getName() + "|" +
CommitIncompleteException.class.getName() + "|" +
CommitReplyException.class.getName());
origin.invoke(doTransaction);
@@ -1442,7 +1448,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
@Override
public void run2() {
final Cache c = getCache();
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
@Override
public boolean done() {
return c.getRegion(rgnName1) == null;
@@ -1508,7 +1514,7 @@ public class TXDistributedDUnitTest extends CacheTestCase {
};
origin.invoke(assertNoContent);
} finally {
- invokeInEveryVM(new SerializableCallable() {
+ Invoke.invokeInEveryVM(new SerializableCallable() {
@Override
public Object call() throws Exception {
TXManagerImpl.ALLOW_PERSISTENT_TRANSACTIONS = false;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TXOrderDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TXOrderDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TXOrderDUnitTest.java
index 6f42483..a253f09 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TXOrderDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TXOrderDUnitTest.java
@@ -52,6 +52,7 @@ import com.gemstone.gemfire.cache.util.TransactionListenerAdapter;
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.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -186,7 +187,7 @@ public class TXOrderDUnitTest extends CacheTestCase {
af.addCacheListener(cl1);
CacheLoader cl = new CacheLoader() {
public Object load(LoaderHelper helper) throws CacheLoaderException {
- getLogWriter().info("Loading value:"+helper.getKey()+"_value");
+ LogWriterUtils.getLogWriter().info("Loading value:"+helper.getKey()+"_value");
return helper.getKey()+"_value";
}
public void close() {
@@ -205,7 +206,7 @@ public class TXOrderDUnitTest extends CacheTestCase {
af.setScope(Scope.DISTRIBUTED_ACK);
CacheListener cl1 = new CacheListenerAdapter() {
public void afterCreate(EntryEvent e) {
- getLogWriter().info("op:"+e.getOperation().toString());
+ LogWriterUtils.getLogWriter().info("op:"+e.getOperation().toString());
assertTrue(!e.getOperation().isLocalLoad());
}
};
@@ -399,7 +400,7 @@ public class TXOrderDUnitTest extends CacheTestCase {
SerializableCallable createRegion = new SerializableCallable() {
public Object call() throws Exception {
- getCache().createRegionFactory(RegionShortcut.REPLICATE).create(testName);
+ getCache().createRegionFactory(RegionShortcut.REPLICATE).create(getTestMethodName());
return null;
}
};
@@ -409,7 +410,7 @@ public class TXOrderDUnitTest extends CacheTestCase {
vm1.invoke(new SerializableCallable() {
public Object call() throws Exception {
- Region r = getCache().getRegion(testName);
+ Region r = getCache().getRegion(getTestMethodName());
r.put("ikey", "value");
getCache().getCacheTransactionManager().begin();
r.put("key1", new byte[20]);
@@ -421,7 +422,7 @@ public class TXOrderDUnitTest extends CacheTestCase {
vm2.invoke(new SerializableCallable() {
public Object call() throws Exception {
- Region r = getCache().getRegion(testName);
+ Region r = getCache().getRegion(getTestMethodName());
Object v = r.get("key1");
assertNotNull(v);
assertTrue(v instanceof byte[]);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TXRestrictionsDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TXRestrictionsDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TXRestrictionsDUnitTest.java
index 14c0bca..d1ec415 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TXRestrictionsDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TXRestrictionsDUnitTest.java
@@ -37,6 +37,8 @@ import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.internal.OSProcess;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
public class TXRestrictionsDUnitTest extends CacheTestCase {
@@ -72,13 +74,13 @@ public class TXRestrictionsDUnitTest extends CacheTestCase {
final CacheTransactionManager txMgr = this.getCache().getCacheTransactionManager();
final String misConfigRegionName = getUniqueName();
Region misConfigRgn = getCache().createRegion(misConfigRegionName, getDiskRegionAttributes());
- invokeInEveryVM(new SerializableRunnable("testPersistentRestriction: Illegal Region Configuration") {
+ Invoke.invokeInEveryVM(new SerializableRunnable("testPersistentRestriction: Illegal Region Configuration") {
public void run() {
try {
getCache().createRegion(misConfigRegionName, getDiskRegionAttributes());
// rgn1.put("misConfigKey", "oldmisConfigVal");
} catch (CacheException e) {
- fail("While creating region", e);
+ Assert.fail("While creating region", e);
}
}
});
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TestCacheCallback.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TestCacheCallback.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TestCacheCallback.java
index 118ebca..b28089a 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TestCacheCallback.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/TestCacheCallback.java
@@ -17,8 +17,8 @@
package com.gemstone.gemfire.cache30;
import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* An abstract superclass of implementation of GemFire cache callbacks
@@ -69,7 +69,7 @@ public abstract class TestCacheCallback implements CacheCallback {
return "listener was never invoked";
}
};
- DistributedTestCase.waitForCriterion(ev, timeoutMs, interval, true);
+ Wait.waitForCriterion(ev, timeoutMs, interval, true);
}
return wasInvoked();
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/DistributedMemberDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/DistributedMemberDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/DistributedMemberDUnitTest.java
index 263ccf9..3dc6d75 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/DistributedMemberDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/DistributedMemberDUnitTest.java
@@ -31,6 +31,7 @@ import com.gemstone.gemfire.distributed.internal.DM;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
@@ -407,7 +408,7 @@ public class DistributedMemberDUnitTest extends DistributedTestCase {
assertTrue("Expected" + expected + " got " + members, members.containsAll(expected));
assertEquals(4, members.size());
} catch (UnknownHostException e) {
- fail("Unable to get IpAddress", e);
+ Assert.fail("Unable to get IpAddress", e);
}
}
});
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java
index 3975133..fcaaa2d 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/DistributedSystemDUnitTest.java
@@ -45,7 +45,9 @@ import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.SocketCreator;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.VM;
/**
@@ -256,7 +258,7 @@ public class DistributedSystemDUnitTest extends DistributedTestCase {
public void testSpecificTcpPort() throws Exception {
Properties config = new Properties();
int tcpPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- config.put("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.put("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
config.setProperty("tcp-port", String.valueOf(tcpPort));
system = (InternalDistributedSystem)DistributedSystem.connect(config);
DistributionManager dm = (DistributionManager)system.getDistributionManager();
@@ -284,10 +286,10 @@ public class DistributedSystemDUnitTest extends DistributedTestCase {
if (loopback != null) {
Properties config = new Properties();
config.put(DistributionConfig.MCAST_PORT_NAME, "0");
- String locators = InetAddress.getLocalHost().getHostName()+":"+getDUnitLocatorPort();
+ String locators = InetAddress.getLocalHost().getHostName()+":"+DistributedTestUtils.getDUnitLocatorPort();
config.put(DistributionConfig.LOCATORS_NAME, locators);
config.setProperty(DistributionConfig.BIND_ADDRESS_NAME, loopback.getHostAddress());
- getLogWriter().info("attempting to connect with " + loopback +" and locators=" + locators);
+ LogWriterUtils.getLogWriter().info("attempting to connect with " + loopback +" and locators=" + locators);
try {
system = (InternalDistributedSystem)DistributedSystem.connect(config);
system.disconnect();
@@ -303,7 +305,7 @@ public class DistributedSystemDUnitTest extends DistributedTestCase {
public void testUDPPortRange() throws Exception {
Properties config = new Properties();
int unicastPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- config.put("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.put("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
// Minimum 3 ports required in range for UDP, FD_SOCK and TcpConduit.
config.setProperty(DistributionConfig.MEMBERSHIP_PORT_RANGE_NAME,
""+unicastPort+"-"+(unicastPort+2));
@@ -317,7 +319,7 @@ public class DistributedSystemDUnitTest extends DistributedTestCase {
public void testMembershipPortRangeWithExactThreeValues() throws Exception {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
config.setProperty(DistributionConfig.MEMBERSHIP_PORT_RANGE_NAME, ""
+ (DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[1] - 2) + "-"
+ (DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[1]));
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java
index af241c1..fe2202f 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/HostedLocatorsDUnitTest.java
@@ -55,7 +55,8 @@ public class HostedLocatorsDUnitTest extends DistributedTestCase {
disconnectAllFromDS();
}
- public void tearDown2() throws Exception {
+ @Override
+ protected final void preTearDown() throws Exception {
disconnectAllFromDS();
}