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:26:43 UTC
[19/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/internal/cache/wan/asyncqueue/AsyncEventQueueStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventQueueStatsDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventQueueStatsDUnitTest.java
index 9258c49..55f9112 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventQueueStatsDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventQueueStatsDUnitTest.java
@@ -21,6 +21,7 @@ import java.util.Map;
import com.gemstone.gemfire.internal.cache.wan.AsyncEventQueueTestBase;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.Wait;
public class AsyncEventQueueStatsDUnitTest extends AsyncEventQueueTestBase {
@@ -56,20 +57,20 @@ public class AsyncEventQueueStatsDUnitTest extends AsyncEventQueueTestBase {
false, 100, 100, false, false, null, false });
vm4.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln", isOffHeap() });
vm5.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln", isOffHeap() });
vm6.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln", isOffHeap() });
vm7.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln", isOffHeap() });
- vm4.invoke(AsyncEventQueueTestBase.class, "doPuts", new Object[] { testName + "_RR",
+ vm4.invoke(AsyncEventQueueTestBase.class, "doPuts", new Object[] { getTestMethodName() + "_RR",
1000 });
vm4.invoke(AsyncEventQueueTestBase.class, "validateAsyncEventListener",
new Object[] { "ln", 1000 });// primary sender
- pause(2000);//give some time for system to become stable
+ Wait.pause(2000);//give some time for system to become stable
vm4.invoke(AsyncEventQueueTestBase.class, "checkAsyncEventQueueStats", new Object[] {
"ln", 0, 1000, 1000, 1000 });
@@ -111,22 +112,22 @@ public class AsyncEventQueueStatsDUnitTest extends AsyncEventQueueTestBase {
false, 100, 100, false, false, null, false });
vm4.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln1,ln2", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln1,ln2", isOffHeap() });
vm5.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln1,ln2", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln1,ln2", isOffHeap() });
vm6.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln1,ln2", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln1,ln2", isOffHeap() });
vm7.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln1,ln2", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln1,ln2", isOffHeap() });
- vm4.invoke(AsyncEventQueueTestBase.class, "doPuts", new Object[] { testName + "_RR",
+ vm4.invoke(AsyncEventQueueTestBase.class, "doPuts", new Object[] { getTestMethodName() + "_RR",
1000 });
vm4.invoke(AsyncEventQueueTestBase.class, "validateAsyncEventListener",
new Object[] { "ln1", 1000 });
vm4.invoke(AsyncEventQueueTestBase.class, "validateAsyncEventListener",
new Object[] { "ln2", 1000 });
- pause(2000);//give some time for system to become stable
+ Wait.pause(2000);//give some time for system to become stable
vm4.invoke(AsyncEventQueueTestBase.class, "checkAsyncEventQueueStats", new Object[] {
"ln1", 0, 1000, 1000, 1000 });
@@ -164,17 +165,17 @@ public class AsyncEventQueueStatsDUnitTest extends AsyncEventQueueTestBase {
false, 100, 100, false, false, null, false });
vm4.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue", new Object[] {
- testName + "_RR", "ln", isOffHeap() });
+ getTestMethodName() + "_RR", "ln", isOffHeap() });
vm5.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue", new Object[] {
- testName + "_RR", "ln", isOffHeap() });
+ getTestMethodName() + "_RR", "ln", isOffHeap() });
vm6.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue", new Object[] {
- testName + "_RR", "ln", isOffHeap() });
+ getTestMethodName() + "_RR", "ln", isOffHeap() });
vm7.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue", new Object[] {
- testName + "_RR", "ln", isOffHeap() });
+ getTestMethodName() + "_RR", "ln", isOffHeap() });
AsyncInvocation inv1 = vm5.invokeAsync(AsyncEventQueueTestBase.class, "doPuts",
- new Object[] { testName + "_RR", 10000 });
- pause(2000);
+ new Object[] { getTestMethodName() + "_RR", 10000 });
+ Wait.pause(2000);
AsyncInvocation inv2 = vm4.invokeAsync(AsyncEventQueueTestBase.class, "killAsyncEventQueue", new Object[] { "ln" });
Boolean isKilled = Boolean.FALSE;
try {
@@ -190,7 +191,7 @@ public class AsyncEventQueueStatsDUnitTest extends AsyncEventQueueTestBase {
}
inv1.join();
inv2.join();
- pause(2000);//give some time for system to become stable
+ Wait.pause(2000);//give some time for system to become stable
vm5.invoke(AsyncEventQueueTestBase.class, "checkAsyncEventQueueStats_Failover", new Object[] {"ln", 10000});
}
@@ -213,33 +214,33 @@ public class AsyncEventQueueStatsDUnitTest extends AsyncEventQueueTestBase {
//create one RR (RR_1) on local site
vm4.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue", new Object[] {
- testName + "_RR_1", "ln", isOffHeap() });
+ getTestMethodName() + "_RR_1", "ln", isOffHeap() });
vm5.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue", new Object[] {
- testName + "_RR_1", "ln", isOffHeap() });
+ getTestMethodName() + "_RR_1", "ln", isOffHeap() });
vm6.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue", new Object[] {
- testName + "_RR_1", "ln", isOffHeap() });
+ getTestMethodName() + "_RR_1", "ln", isOffHeap() });
vm7.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue", new Object[] {
- testName + "_RR_1", "ln", isOffHeap() });
+ getTestMethodName() + "_RR_1", "ln", isOffHeap() });
//create another RR (RR_2) on local site
vm4.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue", new Object[] {
- testName + "_RR_2", "ln", isOffHeap() });
+ getTestMethodName() + "_RR_2", "ln", isOffHeap() });
vm5.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue", new Object[] {
- testName + "_RR_2", "ln", isOffHeap() });
+ getTestMethodName() + "_RR_2", "ln", isOffHeap() });
vm6.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue", new Object[] {
- testName + "_RR_2", "ln", isOffHeap() });
+ getTestMethodName() + "_RR_2", "ln", isOffHeap() });
vm7.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue", new Object[] {
- testName + "_RR_2", "ln", isOffHeap() });
+ getTestMethodName() + "_RR_2", "ln", isOffHeap() });
//start puts in RR_1 in another thread
- vm4.invoke(AsyncEventQueueTestBase.class, "doPuts", new Object[] { testName + "_RR_1", 1000 });
+ vm4.invoke(AsyncEventQueueTestBase.class, "doPuts", new Object[] { getTestMethodName() + "_RR_1", 1000 });
//do puts in RR_2 in main thread
- vm4.invoke(AsyncEventQueueTestBase.class, "doPutsFrom", new Object[] { testName + "_RR_2", 1000, 1500 });
+ vm4.invoke(AsyncEventQueueTestBase.class, "doPutsFrom", new Object[] { getTestMethodName() + "_RR_2", 1000, 1500 });
vm4.invoke(AsyncEventQueueTestBase.class, "validateAsyncEventListener",
new Object[] { "ln", 1500 });
- pause(2000);//give some time for system to become stable
+ Wait.pause(2000);//give some time for system to become stable
vm4.invoke(AsyncEventQueueTestBase.class, "checkAsyncEventQueueStats", new Object[] {"ln",
0, 1500, 1500, 1500});
vm4.invoke(AsyncEventQueueTestBase.class, "checkAsyncEventQueueUnprocessedStats", new Object[] {"ln", 0});
@@ -266,19 +267,19 @@ public class AsyncEventQueueStatsDUnitTest extends AsyncEventQueueTestBase {
false, 100, 100, true, false, null, false });
vm4.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln", isOffHeap() });
vm5.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln", isOffHeap() });
vm6.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln", isOffHeap() });
vm7.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln", isOffHeap() });
vm4
.invoke(AsyncEventQueueTestBase.class, "pauseAsyncEventQueue",
new Object[] { "ln" });
//pause at least for the batchTimeInterval to make sure that the AsyncEventQueue is actually paused
- pause(2000);
+ Wait.pause(2000);
final Map keyValues = new HashMap();
final Map updateKeyValues = new HashMap();
@@ -286,7 +287,7 @@ public class AsyncEventQueueStatsDUnitTest extends AsyncEventQueueTestBase {
keyValues.put(i, i);
}
- vm4.invoke(AsyncEventQueueTestBase.class, "putGivenKeyValue", new Object[] { testName + "_RR", keyValues });
+ vm4.invoke(AsyncEventQueueTestBase.class, "putGivenKeyValue", new Object[] { getTestMethodName() + "_RR", keyValues });
vm4.invoke(AsyncEventQueueTestBase.class, "checkAsyncEventQueueSize", new Object[] { "ln", keyValues.size() });
for(int i=0;i<500;i++) {
@@ -295,12 +296,12 @@ public class AsyncEventQueueStatsDUnitTest extends AsyncEventQueueTestBase {
// Put the update events and check the queue size.
// There should be no conflation with the previous create events.
- vm4.invoke(AsyncEventQueueTestBase.class, "putGivenKeyValue", new Object[] { testName + "_RR", updateKeyValues });
+ vm4.invoke(AsyncEventQueueTestBase.class, "putGivenKeyValue", new Object[] { getTestMethodName() + "_RR", updateKeyValues });
vm4.invoke(AsyncEventQueueTestBase.class, "checkAsyncEventQueueSize", new Object[] { "ln", keyValues.size() + updateKeyValues.size() });
// Put the update events again and check the queue size.
// There should be conflation with the previous update events.
- vm4.invoke(AsyncEventQueueTestBase.class, "putGivenKeyValue", new Object[] { testName + "_RR", updateKeyValues });
+ vm4.invoke(AsyncEventQueueTestBase.class, "putGivenKeyValue", new Object[] { getTestMethodName() + "_RR", updateKeyValues });
vm4.invoke(AsyncEventQueueTestBase.class, "checkAsyncEventQueueSize", new Object[] { "ln", keyValues.size() + updateKeyValues.size() });
vm4.invoke(AsyncEventQueueTestBase.class, "validateAsyncEventListener",
@@ -310,7 +311,7 @@ public class AsyncEventQueueStatsDUnitTest extends AsyncEventQueueTestBase {
vm4.invoke(AsyncEventQueueTestBase.class, "validateAsyncEventListener",
new Object[] { "ln", 1000 });
- pause(2000);// give some time for system to become stable
+ Wait.pause(2000);// give some time for system to become stable
vm4.invoke(AsyncEventQueueTestBase.class, "checkAsyncEventQueueStats", new Object[] {
"ln", 0, 2000, 2000, 1000 });
vm4.invoke(AsyncEventQueueTestBase.class, "checkAsyncEventQueueConflatedStats",
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentAsyncEventQueueDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentAsyncEventQueueDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentAsyncEventQueueDUnitTest.java
index 0e6efa0..9398628 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentAsyncEventQueueDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentAsyncEventQueueDUnitTest.java
@@ -19,6 +19,7 @@ package com.gemstone.gemfire.internal.cache.wan.concurrent;
import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueFactoryImpl;
import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
import com.gemstone.gemfire.internal.cache.wan.AsyncEventQueueTestBase;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
/**
@@ -105,15 +106,15 @@ public class ConcurrentAsyncEventQueueDUnitTest extends AsyncEventQueueTestBase
false, 100, 10, true, false, null, false, 3, OrderPolicy.KEY });
vm4.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln", isOffHeap() });
vm5.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln", isOffHeap() });
vm6.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln", isOffHeap() });
vm7.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln", isOffHeap() });
- vm4.invoke(AsyncEventQueueTestBase.class, "doPuts", new Object[] { testName + "_RR",
+ vm4.invoke(AsyncEventQueueTestBase.class, "doPuts", new Object[] { getTestMethodName() + "_RR",
100 });
vm4.invoke(AsyncEventQueueTestBase.class, "waitForAsyncQueueToGetEmpty",
@@ -163,19 +164,19 @@ public class ConcurrentAsyncEventQueueDUnitTest extends AsyncEventQueueTestBase
false, 100, 10, true, false, null, false, 3, OrderPolicy.THREAD });
vm4.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln", isOffHeap() });
vm5.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln", isOffHeap() });
vm6.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln", isOffHeap() });
vm7.invoke(AsyncEventQueueTestBase.class, "createReplicatedRegionWithAsyncEventQueue",
- new Object[] { testName + "_RR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_RR", "ln", isOffHeap() });
- AsyncInvocation inv1 = vm4.invokeAsync(AsyncEventQueueTestBase.class, "doPuts", new Object[] { testName + "_RR",
+ AsyncInvocation inv1 = vm4.invokeAsync(AsyncEventQueueTestBase.class, "doPuts", new Object[] { getTestMethodName() + "_RR",
50 });
- AsyncInvocation inv2 = vm4.invokeAsync(AsyncEventQueueTestBase.class, "doNextPuts", new Object[] { testName + "_RR",
+ AsyncInvocation inv2 = vm4.invokeAsync(AsyncEventQueueTestBase.class, "doNextPuts", new Object[] { getTestMethodName() + "_RR",
50, 100 });
- AsyncInvocation inv3 = vm4.invokeAsync(AsyncEventQueueTestBase.class, "doNextPuts", new Object[] { testName + "_RR",
+ AsyncInvocation inv3 = vm4.invokeAsync(AsyncEventQueueTestBase.class, "doNextPuts", new Object[] { getTestMethodName() + "_RR",
100, 150 });
try {
@@ -183,7 +184,7 @@ public class ConcurrentAsyncEventQueueDUnitTest extends AsyncEventQueueTestBase
inv2.join();
inv3.join();
} catch (InterruptedException ie) {
- fail(
+ Assert.fail(
"Cought interrupted exception while waiting for the task tgo complete.",
ie);
}
@@ -235,15 +236,15 @@ public class ConcurrentAsyncEventQueueDUnitTest extends AsyncEventQueueTestBase
true, 100, 10, true, false, null, false, 3, OrderPolicy.KEY });
vm4.invoke(AsyncEventQueueTestBase.class, "createPartitionedRegionWithAsyncEventQueue",
- new Object[] { testName + "_PR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_PR", "ln", isOffHeap() });
vm5.invoke(AsyncEventQueueTestBase.class, "createPartitionedRegionWithAsyncEventQueue",
- new Object[] { testName + "_PR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_PR", "ln", isOffHeap() });
vm6.invoke(AsyncEventQueueTestBase.class, "createPartitionedRegionWithAsyncEventQueue",
- new Object[] { testName + "_PR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_PR", "ln", isOffHeap() });
vm7.invoke(AsyncEventQueueTestBase.class, "createPartitionedRegionWithAsyncEventQueue",
- new Object[] { testName + "_PR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_PR", "ln", isOffHeap() });
- vm4.invoke(AsyncEventQueueTestBase.class, "doPuts", new Object[] { testName + "_PR",
+ vm4.invoke(AsyncEventQueueTestBase.class, "doPuts", new Object[] { getTestMethodName() + "_PR",
100 });
vm4.invoke(AsyncEventQueueTestBase.class, "waitForAsyncQueueToGetEmpty",
@@ -301,15 +302,15 @@ public class ConcurrentAsyncEventQueueDUnitTest extends AsyncEventQueueTestBase
OrderPolicy.PARTITION });
vm4.invoke(AsyncEventQueueTestBase.class, "createPartitionedRegionWithAsyncEventQueue",
- new Object[] { testName + "_PR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_PR", "ln", isOffHeap() });
vm5.invoke(AsyncEventQueueTestBase.class, "createPartitionedRegionWithAsyncEventQueue",
- new Object[] { testName + "_PR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_PR", "ln", isOffHeap() });
vm6.invoke(AsyncEventQueueTestBase.class, "createPartitionedRegionWithAsyncEventQueue",
- new Object[] { testName + "_PR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_PR", "ln", isOffHeap() });
vm7.invoke(AsyncEventQueueTestBase.class, "createPartitionedRegionWithAsyncEventQueue",
- new Object[] { testName + "_PR", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_PR", "ln", isOffHeap() });
- vm4.invoke(AsyncEventQueueTestBase.class, "doPuts", new Object[] { testName + "_PR",
+ vm4.invoke(AsyncEventQueueTestBase.class, "doPuts", new Object[] { getTestMethodName() + "_PR",
100 });
vm4.invoke(AsyncEventQueueTestBase.class, "waitForAsyncQueueToGetEmpty",
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelAsyncEventQueueDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelAsyncEventQueueDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelAsyncEventQueueDUnitTest.java
index 5b9d3bd..0035d16 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelAsyncEventQueueDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelAsyncEventQueueDUnitTest.java
@@ -17,6 +17,8 @@
package com.gemstone.gemfire.internal.cache.wan.misc;
import com.gemstone.gemfire.internal.cache.wan.AsyncEventQueueTestBase;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
/**
* @author skumar
@@ -35,24 +37,24 @@ public class CommonParallelAsyncEventQueueDUnitTest extends AsyncEventQueueTestB
}
public void testSameSenderWithNonColocatedRegions() throws Exception {
- addExpectedException("cannot have the same parallel async");
+ IgnoredException.addIgnoredException("cannot have the same parallel async");
Integer lnPort = (Integer)vm0.invoke(AsyncEventQueueTestBase.class,
"createFirstLocatorWithDSId", new Object[] { 1 });
vm4.invoke(AsyncEventQueueTestBase.class, "createCache", new Object[] { lnPort });
vm4.invoke(AsyncEventQueueTestBase.class, "createAsyncEventQueue", new Object[] { "ln",
true, 100, 100, false, false, null, false });
vm4.invoke(AsyncEventQueueTestBase.class, "createPartitionedRegionWithAsyncEventQueue",
- new Object[] { testName + "_PR1", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_PR1", "ln", isOffHeap() });
try {
vm4.invoke(AsyncEventQueueTestBase.class, "createPartitionedRegionWithAsyncEventQueue",
- new Object[] { testName + "_PR2", "ln", isOffHeap() });
+ new Object[] { getTestMethodName() + "_PR2", "ln", isOffHeap() });
fail("Expected IllegateStateException : cannot have the same parallel gateway sender");
}
catch (Exception e) {
if (!(e.getCause() instanceof IllegalStateException)
|| !(e.getCause().getMessage()
.contains("cannot have the same parallel async event queue id"))) {
- fail("Expected IllegalStateException", e);
+ Assert.fail("Expected IllegalStateException", e);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java
index 84c9193..653a376 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java
@@ -26,7 +26,8 @@ import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.compression.Compressor;
import com.gemstone.gemfire.compression.SnappyCompressor;
import com.gemstone.gemfire.internal.cache.LocalRegion;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+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;
@@ -66,11 +67,6 @@ public class CompressionCacheConfigDUnitTest extends CacheTestCase {
super.setUp();
}
- @Override
- public void tearDown2() throws Exception {
- super.tearDown2();
- }
-
/**
* Asserts that a member is successfully initialized with a compressed region when
* a compressor is included in the region attributes.
@@ -96,9 +92,9 @@ public class CompressionCacheConfigDUnitTest extends CacheTestCase {
* @throws Exception
*/
public void testCreateCacheWithBadCompressor() throws Exception {
- addExpectedException("Unable to load class BAD_COMPRESSOR");
+ IgnoredException.addIgnoredException("Unable to load class BAD_COMPRESSOR");
File cacheXml = createCacheXml(BAD_COMPRESSOR);
- ExpectedException expectedException = DistributedTestCase.addExpectedException("While reading Cache XML file");
+ IgnoredException expectedException = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
assertFalse(createCacheOnVM(getVM(0), cacheXml.getCanonicalPath()));
} finally {
@@ -138,15 +134,15 @@ public class CompressionCacheConfigDUnitTest extends CacheTestCase {
disconnectFromDS();
Properties props = new Properties();
props.setProperty("cache-xml-file",cacheXml);
- getLogWriter().info("<ExpectedException action=add>ClassNotFoundException</ExpectedException>");
+ LogWriterUtils.getLogWriter().info("<ExpectedException action=add>ClassNotFoundException</ExpectedException>");
getSystem(props);
assertNotNull(getCache());
return Boolean.TRUE;
} catch(Exception e) {
- getLogWriter().error("Could not create the cache", e);
+ LogWriterUtils.getLogWriter().error("Could not create the cache", e);
return Boolean.FALSE;
} finally {
- getLogWriter().info("<ExpectedException action=remove>ClassNotFoundException</ExpectedException>");
+ LogWriterUtils.getLogWriter().info("<ExpectedException action=remove>ClassNotFoundException</ExpectedException>");
}
}
});
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerDUnitTest.java
index 3ff3e9b..84a9faf 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerDUnitTest.java
@@ -179,15 +179,18 @@ public class CompressionCacheListenerDUnitTest extends CacheTestCase {
}
@Override
- public void tearDown2() throws Exception {
+ protected final void preTearDownCacheTestCase() throws Exception {
+ preTearDownCompressionCacheListenerDUnitTest();
+
try {
SnappyCompressor.getDefaultInstance();
cleanup(getVM(TEST_VM));
} catch (Throwable t) {
// Not a supported OS
}
-
- super.tearDown2();
+ }
+
+ protected void preTearDownCompressionCacheListenerDUnitTest() throws Exception {
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java
index cf8583a..ec828fd 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java
@@ -21,6 +21,7 @@ import java.util.Properties;
import com.gemstone.gemfire.compression.SnappyCompressor;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.cache.OffHeapTestUtil;
+import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
@SuppressWarnings("serial")
@@ -39,7 +40,7 @@ public class CompressionCacheListenerOffHeapDUnitTest extends
}
@Override
- public void tearDown2() throws Exception {
+ protected final void preTearDownCompressionCacheListenerDUnitTest() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@Override
@@ -49,12 +50,8 @@ public class CompressionCacheListenerOffHeapDUnitTest extends
}
}
};
- invokeInEveryVM(checkOrphans);
- try {
- checkOrphans.run();
- } finally {
- super.tearDown2();
- }
+ Invoke.invokeInEveryVM(checkOrphans);
+ checkOrphans.run();
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionConfigDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionConfigDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionConfigDUnitTest.java
index 8061b3c..cd71a2c 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionConfigDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionConfigDUnitTest.java
@@ -27,11 +27,14 @@ import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.compression.Compressor;
import com.gemstone.gemfire.compression.SnappyCompressor;
-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.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;
import com.gemstone.gemfire.test.dunit.standalone.DUnitLauncher;
/**
@@ -73,11 +76,6 @@ public class CompressionRegionConfigDUnitTest extends CacheTestCase {
super.setUp();
}
- @Override
- public void tearDown2() throws Exception {
- super.tearDown2();
- }
-
/**
* Sanity check using two peers sharing a replicated region.
* @throws Exception
@@ -236,7 +234,7 @@ public class CompressionRegionConfigDUnitTest extends CacheTestCase {
* @param key the key to wait on.
*/
private void waitOnPut(final VM vm, final String key) {
- DistributedTestCase.waitForCriterion(new DistributedTestCase.WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
@Override
public boolean done() {
return (getUsingVM(vm, key) != null);
@@ -371,7 +369,7 @@ public class CompressionRegionConfigDUnitTest extends CacheTestCase {
try {
assertNotNull(createServerRegion(name,dataPolicy,compressor));
} catch(Exception e) {
- getLogWriter().error("Could not create the compressed region", e);
+ LogWriterUtils.getLogWriter().error("Could not create the compressed region", e);
return Boolean.FALSE;
}
@@ -394,7 +392,7 @@ public class CompressionRegionConfigDUnitTest extends CacheTestCase {
try {
assertNotNull(createRegion(name,dataPolicy,compressor));
} catch(Exception e) {
- getLogWriter().error("Could not create the compressed region", e);
+ LogWriterUtils.getLogWriter().error("Could not create the compressed region", e);
return Boolean.FALSE;
}
@@ -417,7 +415,7 @@ public class CompressionRegionConfigDUnitTest extends CacheTestCase {
try {
assertNotNull(createRegion(name,dataPolicy,compressor,diskStoreName));
} catch(Exception e) {
- getLogWriter().error("Could not create the compressed region", e);
+ LogWriterUtils.getLogWriter().error("Could not create the compressed region", e);
return Boolean.FALSE;
}
@@ -441,7 +439,7 @@ public class CompressionRegionConfigDUnitTest extends CacheTestCase {
try {
assertNotNull(createClientRegion(name,compressor,shortcut));
} catch(Exception e) {
- getLogWriter().error("Could not create the compressed region", e);
+ LogWriterUtils.getLogWriter().error("Could not create the compressed region", e);
return Boolean.FALSE;
}
@@ -523,7 +521,7 @@ public class CompressionRegionConfigDUnitTest extends CacheTestCase {
}
// Running in hydra
else {
- return getDUnitLocatorPort();
+ return DistributedTestUtils.getDUnitLocatorPort();
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionFactoryDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionFactoryDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionFactoryDUnitTest.java
index 37dbddf..7a0793b 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionFactoryDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionFactoryDUnitTest.java
@@ -59,11 +59,6 @@ public class CompressionRegionFactoryDUnitTest extends CacheTestCase {
super.setUp();
}
- @Override
- public void tearDown2() throws Exception {
- super.tearDown2();
- }
-
/**
* Asserts that a region is created when a valid compressor is used.
* Asserts that the region attributes contain the correct compressor value.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsDUnitTest.java
index e8153e2..32164bd 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsDUnitTest.java
@@ -147,7 +147,18 @@ public class CompressionRegionOperationsDUnitTest extends CacheTestCase {
}
@Override
- public void tearDown2() throws Exception {
+ protected final void preTearDownCacheTestCase() throws Exception {
+ Error error = null;
+ Exception exception = null;
+
+ try {
+ preTearDownCompressionRegionOperationsDUnitTest();
+ } catch (Error e) {
+ error = e;
+ } catch (Exception e) {
+ exception = e;
+ }
+
try {
SnappyCompressor.getDefaultInstance();
cleanup(getVM(TEST_VM));
@@ -155,8 +166,16 @@ public class CompressionRegionOperationsDUnitTest extends CacheTestCase {
// Not a supported OS
}
- super.tearDown2();
- }
+ if (error != null) {
+ throw error;
+ }
+ if (exception != null) {
+ throw exception;
+ }
+ }
+
+ protected void preTearDownCompressionRegionOperationsDUnitTest() throws Exception {
+ }
/**
* Invokes basic get/put operations tests on the test vm.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java
index 8c66f96..d76976f 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java
@@ -22,6 +22,7 @@ import com.gemstone.gemfire.compression.Compressor;
import com.gemstone.gemfire.compression.SnappyCompressor;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.cache.OffHeapTestUtil;
+import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
public class CompressionRegionOperationsOffHeapDUnitTest extends
@@ -30,8 +31,9 @@ public class CompressionRegionOperationsOffHeapDUnitTest extends
public CompressionRegionOperationsOffHeapDUnitTest(String name) {
super(name);
}
+
@Override
- public void tearDown2() throws Exception {
+ protected final void preTearDownCompressionRegionOperationsDUnitTest() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@Override
@@ -41,12 +43,8 @@ public class CompressionRegionOperationsOffHeapDUnitTest extends
}
}
};
- invokeInEveryVM(checkOrphans);
- try {
- checkOrphans.run();
- } finally {
- super.tearDown2();
- }
+ Invoke.invokeInEveryVM(checkOrphans);
+ checkOrphans.run();
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/ExceptionsDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/ExceptionsDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/ExceptionsDUnitTest.java
index 8015b6a..492ec61 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/ExceptionsDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/ExceptionsDUnitTest.java
@@ -38,6 +38,7 @@ import com.gemstone.gemfire.internal.OSProcess;
import com.gemstone.gemfire.internal.jta.CacheUtils;
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.VM;
import com.gemstone.gemfire.util.test.TestUtil;
@@ -60,7 +61,7 @@ public class ExceptionsDUnitTest extends DistributedTestCase {
//
// sb.append(lineSep);
}
- getLogWriter().fine("***********\n " + sb);
+ LogWriterUtils.getLogWriter().fine("***********\n " + sb);
return sb.toString();
}
@@ -110,10 +111,10 @@ public class ExceptionsDUnitTest extends DistributedTestCase {
* value=\"83f0069202c571faf1ae6c42b4ad46030e4e31c17409e19a\"/>";
*/
int n1 = str.indexOf(search);
- getLogWriter().fine("Start Index = " + n1);
+ LogWriterUtils.getLogWriter().fine("Start Index = " + n1);
int n2 = str.indexOf(last_search, n1);
StringBuffer sbuff = new StringBuffer(str);
- getLogWriter().fine("END Index = " + n2);
+ LogWriterUtils.getLogWriter().fine("END Index = " + n2);
String modified_str = sbuff.replace(n1, n2, new_str).toString();
return modified_str;
}
@@ -173,7 +174,7 @@ public class ExceptionsDUnitTest extends DistributedTestCase {
if (ds != null) ds.disconnect();
}
catch (Exception e) {
- getLogWriter().fine("Error in disconnecting from Distributed System");
+ LogWriterUtils.getLogWriter().fine("Error in disconnecting from Distributed System");
}
}
@@ -184,7 +185,8 @@ public class ExceptionsDUnitTest extends DistributedTestCase {
vm0.invoke(ExceptionsDUnitTest.class, "init");
}
- public void tearDown2() throws NamingException, SQLException {
+ @Override
+ protected final void preTearDown() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
vm0.invoke(ExceptionsDUnitTest.class, "closeCache");
@@ -234,7 +236,7 @@ public class ExceptionsDUnitTest extends DistributedTestCase {
+ "occur");
}
catch (Exception e) {
- getLogWriter().fine("Exception caught in runTest1 due to : " + e);
+ LogWriterUtils.getLogWriter().fine("Exception caught in runTest1 due to : " + e);
fail("failed in runTest1 due to " + e);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/IdleTimeOutDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/IdleTimeOutDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/IdleTimeOutDUnitTest.java
index c340ae3..96e5a8d 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/IdleTimeOutDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/IdleTimeOutDUnitTest.java
@@ -37,9 +37,12 @@ import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.OSProcess;
import com.gemstone.gemfire.internal.jta.CacheUtils;
+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.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.util.test.TestUtil;
@@ -62,7 +65,7 @@ public class IdleTimeOutDUnitTest extends DistributedTestCase {
//
// sb.append(lineSep);
}
- getLogWriter().info("***********\n " + sb);
+ LogWriterUtils.getLogWriter().info("***********\n " + sb);
return sb.toString();
}
@@ -112,22 +115,22 @@ public class IdleTimeOutDUnitTest extends DistributedTestCase {
* value=\"83f0069202c571faf1ae6c42b4ad46030e4e31c17409e19a\"/>";
*/
int n1 = str.indexOf(search);
- getLogWriter().info("Start Index = " + n1);
+ LogWriterUtils.getLogWriter().info("Start Index = " + n1);
int n2 = str.indexOf(last_search, n1);
StringBuffer sbuff = new StringBuffer(str);
- getLogWriter().info("END Index = " + n2);
+ LogWriterUtils.getLogWriter().info("END Index = " + n2);
String modified_str = sbuff.replace(n1, n2, new_str).toString();
return modified_str;
}
public static String init(String className) throws Exception {
- getLogWriter().fine("PATH11 ");
+ LogWriterUtils.getLogWriter().fine("PATH11 ");
Properties props = new Properties();
String path = System.getProperty("CACHEXMLFILE");
- getLogWriter().fine("PATH2 " + path);
+ LogWriterUtils.getLogWriter().fine("PATH2 " + path);
int pid = OSProcess.getId();
path = File.createTempFile("dunit-cachejta_", ".xml").getAbsolutePath();
- getLogWriter().fine("PATH " + path);
+ LogWriterUtils.getLogWriter().fine("PATH " + path);
/** * Return file as string and then modify the string accordingly ** */
String file_as_str = readFile(TestUtil.getResourcePath(CacheUtils.class, "cachejta.xml"));
file_as_str = file_as_str.replaceAll("newDB", "newDB_" + pid);
@@ -169,7 +172,7 @@ public class IdleTimeOutDUnitTest extends DistributedTestCase {
String sql = "create table "
+ tableName
+ " (id integer NOT NULL, name varchar(50), CONSTRAINT "+tableName+"_key PRIMARY KEY(id))";
- getLogWriter().info(sql);
+ LogWriterUtils.getLogWriter().info(sql);
Connection conn = ds.getConnection();
Statement sm = conn.createStatement();
sm.execute(sql);
@@ -178,7 +181,7 @@ public class IdleTimeOutDUnitTest extends DistributedTestCase {
for (int i = 1; i <= 10; i++) {
sql = "insert into " + tableName + " values (" + i + ",'name" + i + "')";
sm.addBatch(sql);
- getLogWriter().info(sql);
+ LogWriterUtils.getLogWriter().info(sql);
}
sm.executeBatch();
conn.close();
@@ -190,18 +193,18 @@ public class IdleTimeOutDUnitTest extends DistributedTestCase {
Context ctx = cache.getJNDIContext();
DataSource ds = (DataSource) ctx.lookup("java:/SimpleDataSource");
Connection conn = ds.getConnection();
- getLogWriter().info(" trying to drop table: " + tableName);
+ LogWriterUtils.getLogWriter().info(" trying to drop table: " + tableName);
String sql = "drop table " + tableName;
Statement sm = conn.createStatement();
sm.execute(sql);
conn.close();
}
catch (NamingException ne) {
- getLogWriter().info("destroy table naming exception: " + ne);
+ LogWriterUtils.getLogWriter().info("destroy table naming exception: " + ne);
throw ne;
}
catch (SQLException se) {
- getLogWriter().info("destroy table sql exception: " + se);
+ LogWriterUtils.getLogWriter().info("destroy table sql exception: " + se);
throw se;
}
finally {
@@ -237,7 +240,7 @@ public class IdleTimeOutDUnitTest extends DistributedTestCase {
ds.disconnect();
}
catch (Exception e) {
- getLogWriter().info("Error in disconnecting from Distributed System");
+ LogWriterUtils.getLogWriter().info("Error in disconnecting from Distributed System");
}
}
@@ -250,11 +253,9 @@ public class IdleTimeOutDUnitTest extends DistributedTestCase {
vm0.invoke(IdleTimeOutDUnitTest.class, "init", o);
}
- public void tearDown2() throws NamingException, SQLException {
+ @Override
+ protected final void preTearDown() throws Exception {
VM vm0 = Host.getHost(0).getVM(0);
- // destroyTable call disabled due to high rate of failure - see internal ticket #52274
-// vm0.invoke(IdleTimeOutDUnitTest.class, "destroyTable");
- // if destroyTable is fixed then this closeCache is not necessary and can be removed
vm0.invoke(IdleTimeOutDUnitTest.class, "closeCache");
}
@@ -264,9 +265,9 @@ public class IdleTimeOutDUnitTest extends DistributedTestCase {
vm0.invoke(IdleTimeOutDUnitTest.class, "runTest1");
AsyncInvocation asyncObj = vm0.invokeAsync(IdleTimeOutDUnitTest.class,
"runTest2");
- DistributedTestCase.join(asyncObj, 30 * 1000, getLogWriter());
+ ThreadUtils.join(asyncObj, 30 * 1000);
if(asyncObj.exceptionOccurred()){
- fail("asyncObj failed", asyncObj.getException());
+ Assert.fail("asyncObj failed", asyncObj.getException());
}
}
@@ -278,27 +279,27 @@ public class IdleTimeOutDUnitTest extends DistributedTestCase {
ds = (DataSource) ctx.lookup("java:/XAPooledDataSource");
}
catch (NamingException e) {
- getLogWriter().info("Naming Exception caught in lookup: " + e);
+ LogWriterUtils.getLogWriter().info("Naming Exception caught in lookup: " + e);
fail("failed in naming lookup: " + e);
return;
}
catch (Exception e) {
- getLogWriter().info("Exception caught during naming lookup: " + e);
+ LogWriterUtils.getLogWriter().info("Exception caught during naming lookup: " + e);
fail("failed in naming lookup: " + e);
return;
}
try {
for (int count = 0; count < MAX_CONNECTIONS; count++) {
ds.getConnection();
- getLogWriter().info("runTest1 :acquired connection #" + count);
+ LogWriterUtils.getLogWriter().info("runTest1 :acquired connection #" + count);
}
}
catch (SQLException e) {
- getLogWriter().info("Success SQLException caught in runTest1: " + e);
+ LogWriterUtils.getLogWriter().info("Success SQLException caught in runTest1: " + e);
fail("runTest1 SQL Exception caught: " + e);
}
catch (Exception e) {
- getLogWriter().info("Exception caught in runTest1: " + e);
+ LogWriterUtils.getLogWriter().info("Exception caught in runTest1: " + e);
fail("Exception caught in runTest1: " + e);
e.printStackTrace();
}
@@ -314,12 +315,12 @@ public class IdleTimeOutDUnitTest extends DistributedTestCase {
ds = (DataSource) ctx.lookup("java:/XAPooledDataSource");
}
catch (NamingException e) {
- getLogWriter().info("Exception caught during naming lookup: " + e);
+ LogWriterUtils.getLogWriter().info("Exception caught during naming lookup: " + e);
fail("failed in naming lookup: " + e);
return;
}
catch (Exception e) {
- getLogWriter().info("Exception caught during naming lookup: " + e);
+ LogWriterUtils.getLogWriter().info("Exception caught during naming lookup: " + e);
fail("failed in because of unhandled excpetion: " + e);
return;
}
@@ -327,16 +328,16 @@ public class IdleTimeOutDUnitTest extends DistributedTestCase {
for (int count = 0; count < MAX_CONNECTIONS; count++) {
Connection con = ds.getConnection();
assertNotNull("Connection object is null", con);
- getLogWriter().info("runTest2 :acquired connection #" + count);
+ LogWriterUtils.getLogWriter().info("runTest2 :acquired connection #" + count);
}
}
catch (SQLException sqle) {
- getLogWriter().info("SQLException caught in runTest2: " + sqle);
+ LogWriterUtils.getLogWriter().info("SQLException caught in runTest2: " + sqle);
fail("failed because of SQL exception : " + sqle);
sqle.printStackTrace();
}
catch (Exception e) {
- getLogWriter().info("Exception caught in runTest2: " + e);
+ LogWriterUtils.getLogWriter().info("Exception caught in runTest2: " + e);
fail("failed because of unhandled exception : " + e);
e.printStackTrace();
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/LoginTimeOutDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/LoginTimeOutDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/LoginTimeOutDUnitTest.java
index 6be7241..c5a4e02 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/LoginTimeOutDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/LoginTimeOutDUnitTest.java
@@ -40,11 +40,15 @@ import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.internal.OSProcess;
import com.gemstone.gemfire.internal.jta.CacheUtils;
import com.gemstone.gemfire.internal.logging.LogService;
+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.RMIException;
+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.util.test.TestUtil;
public class LoginTimeOutDUnitTest extends DistributedTestCase {
@@ -248,11 +252,11 @@ public class LoginTimeOutDUnitTest extends DistributedTestCase {
VM vm0 = host.getVM(0);
AsyncInvocation test1 = vm0.invokeAsync(LoginTimeOutDUnitTest.class, "runTest1");
AsyncInvocation test2 = vm0.invokeAsync(LoginTimeOutDUnitTest.class, "runTest2");
- DistributedTestCase.join(test2, 120 * 1000, getLogWriter());
+ ThreadUtils.join(test2, 120 * 1000);
if(test2.exceptionOccurred()){
- fail("asyncObj failed", test2.getException());
+ Assert.fail("asyncObj failed", test2.getException());
}
- DistributedTestCase.join(test1, 30000, getLogWriter());
+ ThreadUtils.join(test1, 30000);
}
public static void runTest1() throws Exception {
@@ -292,7 +296,7 @@ public class LoginTimeOutDUnitTest extends DistributedTestCase {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
}
public static void runTest2() throws Exception {
@@ -306,7 +310,7 @@ public class LoginTimeOutDUnitTest extends DistributedTestCase {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
DataSource ds = null;
try {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/MaxPoolSizeDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/MaxPoolSizeDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/MaxPoolSizeDUnitTest.java
index 5e31e12..1ab5b2c 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/MaxPoolSizeDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/MaxPoolSizeDUnitTest.java
@@ -37,9 +37,12 @@ import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.OSProcess;
import com.gemstone.gemfire.internal.jta.CacheUtils;
+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.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.util.test.TestUtil;
@@ -62,7 +65,7 @@ public class MaxPoolSizeDUnitTest extends DistributedTestCase {
//
// sb.append(lineSep);
}
- getLogWriter().fine("***********\n " + sb);
+ LogWriterUtils.getLogWriter().fine("***********\n " + sb);
return sb.toString();
}
@@ -112,20 +115,20 @@ public class MaxPoolSizeDUnitTest extends DistributedTestCase {
* value=\"83f0069202c571faf1ae6c42b4ad46030e4e31c17409e19a\"/>";
*/
int n1 = str.indexOf(search);
- getLogWriter().fine("Start Index = " + n1);
+ LogWriterUtils.getLogWriter().fine("Start Index = " + n1);
int n2 = str.indexOf(last_search, n1);
StringBuffer sbuff = new StringBuffer(str);
- getLogWriter().fine("END Index = " + n2);
+ LogWriterUtils.getLogWriter().fine("END Index = " + n2);
String modified_str = sbuff.replace(n1, n2, new_str).toString();
return modified_str;
}
public static String init(String className) throws Exception {
- getLogWriter().fine("PATH11 ");
+ LogWriterUtils.getLogWriter().fine("PATH11 ");
Properties props = new Properties();
int pid = OSProcess.getId();
String path = File.createTempFile("dunit-cachejta_", ".xml").getAbsolutePath();
- getLogWriter().fine("PATH " + path);
+ LogWriterUtils.getLogWriter().fine("PATH " + path);
/** * Return file as string and then modify the string accordingly ** */
String file_as_str = readFile(TestUtil.getResourcePath(CacheUtils.class, "cachejta.xml"));
file_as_str = file_as_str.replaceAll("newDB", "newDB_" + pid);
@@ -167,7 +170,7 @@ public class MaxPoolSizeDUnitTest extends DistributedTestCase {
String sql = "create table "
+ tableName
+ " (id integer NOT NULL, name varchar(50), CONSTRAINT "+tableName+"_key PRIMARY KEY(id))";
- getLogWriter().fine(sql);
+ LogWriterUtils.getLogWriter().fine(sql);
Connection conn = ds.getConnection();
Statement sm = conn.createStatement();
sm.execute(sql);
@@ -176,7 +179,7 @@ public class MaxPoolSizeDUnitTest extends DistributedTestCase {
for (int i = 1; i <= 10; i++) {
sql = "insert into " + tableName + " values (" + i + ",'name" + i + "')";
sm.addBatch(sql);
- getLogWriter().fine(sql);
+ LogWriterUtils.getLogWriter().fine(sql);
}
sm.executeBatch();
conn.close();
@@ -188,19 +191,19 @@ public class MaxPoolSizeDUnitTest extends DistributedTestCase {
Context ctx = cache.getJNDIContext();
DataSource ds = (DataSource) ctx.lookup("java:/SimpleDataSource");
Connection conn = ds.getConnection();
- getLogWriter().fine(" trying to drop table: " + tableName);
+ LogWriterUtils.getLogWriter().fine(" trying to drop table: " + tableName);
String sql = "drop table " + tableName;
Statement sm = conn.createStatement();
sm.execute(sql);
conn.close();
}
catch (NamingException ne) {
- getLogWriter().fine("destroy table naming exception: " + ne);
+ LogWriterUtils.getLogWriter().fine("destroy table naming exception: " + ne);
throw ne;
}
catch (SQLException se) {
if (!se.getMessage().contains("A lock could not be obtained within the time requested")) {
- getLogWriter().fine("destroy table sql exception: " + se);
+ LogWriterUtils.getLogWriter().fine("destroy table sql exception: " + se);
throw se;
} else {
// disregard - this happens sometimes on unit test runs on slower
@@ -238,7 +241,7 @@ public class MaxPoolSizeDUnitTest extends DistributedTestCase {
ds.disconnect();
}
catch (Exception e) {
- getLogWriter().fine("Error in disconnecting from Distributed System");
+ LogWriterUtils.getLogWriter().fine("Error in disconnecting from Distributed System");
}
}
@@ -252,7 +255,8 @@ public class MaxPoolSizeDUnitTest extends DistributedTestCase {
vm0.invoke(MaxPoolSizeDUnitTest.class, "init", o);
}
- public void tearDown2() throws NamingException, SQLException {
+ @Override
+ protected final void preTearDown() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
try {
@@ -267,9 +271,9 @@ public class MaxPoolSizeDUnitTest extends DistributedTestCase {
VM vm0 = host.getVM(0);
AsyncInvocation asyncObj = vm0.invokeAsync(MaxPoolSizeDUnitTest.class,
"runTest1");
- DistributedTestCase.join(asyncObj, 30 * 1000, getLogWriter());
+ ThreadUtils.join(asyncObj, 30 * 1000);
if(asyncObj.exceptionOccurred()){
- fail("asyncObj failed", asyncObj.getException());
+ Assert.fail("asyncObj failed", asyncObj.getException());
}
}
@@ -282,28 +286,28 @@ public class MaxPoolSizeDUnitTest extends DistributedTestCase {
ds = (DataSource) ctx.lookup("java:/XAPooledDataSource");
}
catch (NamingException e) {
- getLogWriter().fine("Naming Exception caught in lookup: " + e);
+ LogWriterUtils.getLogWriter().fine("Naming Exception caught in lookup: " + e);
fail("failed in naming lookup: " + e);
return;
}
catch (Exception e) {
- getLogWriter().fine("Exception caught during naming lookup: " + e);
+ LogWriterUtils.getLogWriter().fine("Exception caught during naming lookup: " + e);
fail("failed in naming lookup: " + e);
return;
}
try {
for (count = 0; count < MAX_CONNECTIONS; count++) {
ds.getConnection();
- getLogWriter().fine("Thread 1 acquired connection #" + count);
+ LogWriterUtils.getLogWriter().fine("Thread 1 acquired connection #" + count);
}
fail("expected max connect exception");
}
catch (SQLException e) {
if (count < (MAX_CONNECTIONS-1)) {
- fail("runTest1 SQL Exception", e);
+ Assert.fail("runTest1 SQL Exception", e);
}
else {
- getLogWriter().fine("Success SQLException caught at connection #"
+ LogWriterUtils.getLogWriter().fine("Success SQLException caught at connection #"
+ count);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TransactionTimeOutDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TransactionTimeOutDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TransactionTimeOutDUnitTest.java
index 22b8bff..fead02e 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TransactionTimeOutDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TransactionTimeOutDUnitTest.java
@@ -41,9 +41,12 @@ import com.gemstone.gemfire.internal.OSProcess;
import com.gemstone.gemfire.internal.datasource.GemFireTransactionDataSource;
import com.gemstone.gemfire.internal.jta.CacheUtils;
import com.gemstone.gemfire.internal.jta.UserTransactionImpl;
+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.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.util.test.TestUtil;
@@ -123,7 +126,8 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
vm0.invoke(TransactionTimeOutDUnitTest.class, "init");
}
- public void tearDown2() throws NamingException, SQLException {
+ @Override
+ protected final void preTearDown() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
vm0.invoke(TransactionTimeOutDUnitTest.class, "closeCache");
@@ -135,13 +139,13 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
AsyncInvocation async1 = vm0.invokeAsync(TransactionTimeOutDUnitTest.class, "runTest1");
AsyncInvocation async2 =vm0.invokeAsync(TransactionTimeOutDUnitTest.class, "runTest2");
- DistributedTestCase.join(async1, 30 * 1000, getLogWriter());
- DistributedTestCase.join(async2, 30 * 1000, getLogWriter());
+ ThreadUtils.join(async1, 30 * 1000);
+ ThreadUtils.join(async2, 30 * 1000);
if(async1.exceptionOccurred()){
- fail("async1 failed", async1.getException());
+ Assert.fail("async1 failed", async1.getException());
}
if(async2.exceptionOccurred()){
- fail("async2 failed", async2.getException());
+ Assert.fail("async2 failed", async2.getException());
}
}
@@ -213,7 +217,7 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
return;
}
catch (Exception e) {
- getLogWriter().fine("Exception caught " + e);
+ LogWriterUtils.getLogWriter().fine("Exception caught " + e);
fail("failed in naming lookup: " + e);
return;
}
@@ -239,7 +243,7 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
return;
}
catch (Exception e) {
- getLogWriter().fine("Exception caught " + e);
+ LogWriterUtils.getLogWriter().fine("Exception caught " + e);
fail("failed in naming lookup: " + e);
return;
}
@@ -492,7 +496,7 @@ public class TransactionTimeOutDUnitTest extends DistributedTestCase {
//
// sb.append(lineSep);
}
- getLogWriter().fine("***********\n " + sb);
+ LogWriterUtils.getLogWriter().fine("***********\n " + sb);
return sb.toString();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnManagerMultiThreadDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnManagerMultiThreadDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnManagerMultiThreadDUnitTest.java
index 83e29af..fab159d 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnManagerMultiThreadDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnManagerMultiThreadDUnitTest.java
@@ -42,9 +42,12 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.OSProcess;
import com.gemstone.gemfire.internal.jta.CacheUtils;
import com.gemstone.gemfire.internal.jta.JTAUtils;
+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.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.util.test.TestUtil;
@@ -184,7 +187,7 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
String jtest = System.getProperty("JTESTS");
int pid = OSProcess.getId();
String path = File.createTempFile("dunit-cachejta_", ".xml").getAbsolutePath();
- getLogWriter().fine("PATH " + path);
+ LogWriterUtils.getLogWriter().fine("PATH " + path);
/** * Return file as string and then modify the string accordingly ** */
String file_as_str = readFile(TestUtil.getResourcePath(CacheUtils.class, "cachejta.xml"));
file_as_str = file_as_str.replaceAll("newDB", "newDB_" + pid);
@@ -210,7 +213,7 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
}
}
catch (Exception e) {
- getLogWriter().info("", e);
+ LogWriterUtils.getLogWriter().info("", e);
throw new Exception("" + e);
}
return tableName;
@@ -225,7 +228,7 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
String sql = "create table "
+ tableName
+ " (id integer NOT NULL, name varchar(50), CONSTRAINT "+tableName+"_key PRIMARY KEY(id))";
- getLogWriter().fine(sql);
+ LogWriterUtils.getLogWriter().fine(sql);
Connection conn = ds.getConnection();
Statement sm = conn.createStatement();
sm.execute(sql);
@@ -234,7 +237,7 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
for (int i = 1; i <= 10; i++) {
sql = "insert into " + tableName + " values (" + i + ",'name" + i + "')";
sm.addBatch(sql);
- getLogWriter().fine(sql);
+ LogWriterUtils.getLogWriter().fine(sql);
}
sm.executeBatch();
conn.close();
@@ -252,28 +255,28 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
}
try {
String tableName = tblName;
- getLogWriter().fine("Destroying table: " + tableName);
+ LogWriterUtils.getLogWriter().fine("Destroying table: " + tableName);
cache = TxnManagerMultiThreadDUnitTest.getCache();
Context ctx = cache.getJNDIContext();
DataSource ds = (DataSource) ctx.lookup("java:/SimpleDataSource");
Connection conn = ds.getConnection();
- getLogWriter().fine(" trying to drop table: " + tableName);
+ LogWriterUtils.getLogWriter().fine(" trying to drop table: " + tableName);
String sql = "drop table " + tableName;
Statement sm = conn.createStatement();
sm.execute(sql);
conn.close();
- getLogWriter().fine("destroyTable is Successful!");
+ LogWriterUtils.getLogWriter().fine("destroyTable is Successful!");
}
catch (NamingException ne) {
- getLogWriter().fine("destroy table naming exception: " + ne);
+ LogWriterUtils.getLogWriter().fine("destroy table naming exception: " + ne);
throw ne;
}
catch (SQLException se) {
- getLogWriter().fine("destroy table sql exception: " + se);
+ LogWriterUtils.getLogWriter().fine("destroy table sql exception: " + se);
throw se;
}
finally {
- getLogWriter().fine("Closing cache...");
+ LogWriterUtils.getLogWriter().fine("Closing cache...");
closeCache();
}
}//end of destroyTable
@@ -289,7 +292,7 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
}
}
catch (Exception e) {
- getLogWriter().warning("exception while creating cache", e);
+ LogWriterUtils.getLogWriter().warning("exception while creating cache", e);
}
}//end of startCache
@@ -297,18 +300,18 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
try {
if (!cache.isClosed()) {
cache.close();
- getLogWriter().fine("Cache closed");
+ LogWriterUtils.getLogWriter().fine("Cache closed");
}
}
catch (Exception e) {
- getLogWriter().warning("exception while closing cache", e);
+ LogWriterUtils.getLogWriter().warning("exception while closing cache", e);
}
try {
CacheUtils.ds.disconnect();
- getLogWriter().fine("Disconnected from Distribuited System");
+ LogWriterUtils.getLogWriter().fine("Disconnected from Distribuited System");
}
catch (Exception e) {
- getLogWriter().fine("Error in disconnecting from Distributed System");
+ LogWriterUtils.getLogWriter().fine("Error in disconnecting from Distributed System");
}
}//end of closeCache
@@ -348,11 +351,12 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
/*int rowsDeleted = */jtaObj.deleteRows(tblName_delRows);
}
catch (Exception e) {
- getLogWriter().warning("Error: while deleting rows from database using JTAUtils", e);
+ LogWriterUtils.getLogWriter().warning("Error: while deleting rows from database using JTAUtils", e);
}
}//end of delRows
- public void tearDown2() throws java.lang.Exception {
+ @Override
+ protected final void preTearDown() throws Exception {
VM vm0 = Host.getHost(0).getVM(0);
//get tableName to pass to destroyTable
String tableName = CacheUtils.getTableName();
@@ -405,11 +409,11 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
//get how many rows actually got committed
try {
int rows = jtaObj.getRows(tblName);
- getLogWriter().fine("Number of rows committed current test method are: "
+ LogWriterUtils.getLogWriter().fine("Number of rows committed current test method are: "
+ rows);
}
catch (Exception e) {
- getLogWriter().warning("Error: while getting rows from database using JTAUtils", e);
+ LogWriterUtils.getLogWriter().warning("Error: while getting rows from database using JTAUtils", e);
}
}//end of getNumberOfRows
@@ -422,9 +426,9 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
VM vm0 = Host.getHost(0).getVM(0);
AsyncInvocation asyncObj1 = vm0.invokeAsync(
TxnManagerMultiThreadDUnitTest.class, "callCommitThreads");
- DistributedTestCase.join(asyncObj1, 30 * 1000, getLogWriter());
+ ThreadUtils.join(asyncObj1, 30 * 1000);
if(asyncObj1.exceptionOccurred()){
- fail("asyncObj1 failed", asyncObj1.getException());
+ Assert.fail("asyncObj1 failed", asyncObj1.getException());
}
vm0.invoke(TxnManagerMultiThreadDUnitTest.class, "getNumberOfRows");
}//end of testAllCommit
@@ -434,15 +438,15 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
*
*/
public static void callCommitThreads() {
- getLogWriter().fine("This is callCommitThreads method");
+ LogWriterUtils.getLogWriter().fine("This is callCommitThreads method");
try {
- new CommitThread("ct1", getLogWriter());
- new CommitThread("ct2", getLogWriter());
- new CommitThread("ct3", getLogWriter());
- new CommitThread("ct4", getLogWriter());
+ new CommitThread("ct1", LogWriterUtils.getLogWriter());
+ new CommitThread("ct2", LogWriterUtils.getLogWriter());
+ new CommitThread("ct3", LogWriterUtils.getLogWriter());
+ new CommitThread("ct4", LogWriterUtils.getLogWriter());
}
catch (Exception e) {
- getLogWriter().warning("Failed in Commit Threads", e);
+ LogWriterUtils.getLogWriter().warning("Failed in Commit Threads", e);
fail("Failed in Commit Threads" + e);
}
}//end of callCommitTheads
@@ -455,24 +459,24 @@ public class TxnManagerMultiThreadDUnitTest extends DistributedTestCase {
VM vm0 = Host.getHost(0).getVM(0);
AsyncInvocation asyncObj1 = vm0.invokeAsync(
TxnManagerMultiThreadDUnitTest.class, "callCommitandRollbackThreads");
- DistributedTestCase.join(asyncObj1, 30 * 1000, getLogWriter());
+ ThreadUtils.join(asyncObj1, 30 * 1000);
if(asyncObj1.exceptionOccurred()){
- fail("asyncObj1 failed", asyncObj1.getException());
+ Assert.fail("asyncObj1 failed", asyncObj1.getException());
}
vm0.invoke(TxnManagerMultiThreadDUnitTest.class, "getNumberOfRows");
}//end of test3Commit2Rollback
public static void callCommitandRollbackThreads() {
- getLogWriter().fine("This is callCommitandRollbackThreads method");
+ LogWriterUtils.getLogWriter().fine("This is callCommitandRollbackThreads method");
try {
- new CommitThread("ct1", getLogWriter());
- new CommitThread("ct2", getLogWriter());
- new CommitThread("ct3", getLogWriter());
- new RollbackThread("rt1", getLogWriter());
- new RollbackThread("rt2", getLogWriter());
+ new CommitThread("ct1", LogWriterUtils.getLogWriter());
+ new CommitThread("ct2", LogWriterUtils.getLogWriter());
+ new CommitThread("ct3", LogWriterUtils.getLogWriter());
+ new RollbackThread("rt1", LogWriterUtils.getLogWriter());
+ new RollbackThread("rt2", LogWriterUtils.getLogWriter());
}
catch (Exception e) {
- getLogWriter().info("Failed in Commit and Rollback threads", e);
+ LogWriterUtils.getLogWriter().info("Failed in Commit and Rollback threads", e);
fail("Failed in Commit and Rollback Threads" + e);
}
}//end of callCommitandRollbackThreads
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnTimeOutDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnTimeOutDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnTimeOutDUnitTest.java
index 7e81aae..a9f41ac 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnTimeOutDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/jta/dunit/TxnTimeOutDUnitTest.java
@@ -35,9 +35,12 @@ import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.OSProcess;
import com.gemstone.gemfire.internal.jta.CacheUtils;
+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.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.util.test.TestUtil;
@@ -69,7 +72,7 @@ public class TxnTimeOutDUnitTest extends DistributedTestCase {
wr.close();
props.setProperty("cache-xml-file", path);
// props.setProperty("mcast-port", "10321");
- props.setProperty("log-level", getDUnitLogLevel());
+ props.setProperty("log-level", LogWriterUtils.getDUnitLogLevel());
try {
// ds = DistributedSystem.connect(props);
ds = (new TxnTimeOutDUnitTest("temp")).getSystem(props);
@@ -119,7 +122,8 @@ public class TxnTimeOutDUnitTest extends DistributedTestCase {
vm0.invoke(TxnTimeOutDUnitTest.class, "init");
}
- public void tearDown2() throws NamingException, SQLException {
+ @Override
+ protected final void preTearDown() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
vm0.invoke(TxnTimeOutDUnitTest.class, "closeCache");
@@ -154,29 +158,29 @@ public class TxnTimeOutDUnitTest extends DistributedTestCase {
AsyncInvocation asyncObj5 = vm0.invokeAsync(TxnTimeOutDUnitTest.class,
"runTest3",o4);
- DistributedTestCase.join(asyncObj1, 5 * 60 * 1000, getLogWriter());
+ ThreadUtils.join(asyncObj1, 5 * 60 * 1000);
if(asyncObj1.exceptionOccurred()){
- fail("asyncObj1 failed", asyncObj1.getException());
+ Assert.fail("asyncObj1 failed", asyncObj1.getException());
}
- DistributedTestCase.join(asyncObj2, 5 * 60 * 1000, getLogWriter());
+ ThreadUtils.join(asyncObj2, 5 * 60 * 1000);
if(asyncObj2.exceptionOccurred()){
- fail("asyncObj2 failed", asyncObj2.getException());
+ Assert.fail("asyncObj2 failed", asyncObj2.getException());
}
- DistributedTestCase.join(asyncObj3, 5 * 60 * 1000, getLogWriter());
+ ThreadUtils.join(asyncObj3, 5 * 60 * 1000);
if(asyncObj3.exceptionOccurred()){
- fail("asyncObj3 failed", asyncObj3.getException());
+ Assert.fail("asyncObj3 failed", asyncObj3.getException());
}
- DistributedTestCase.join(asyncObj4, 5 * 60 * 1000, getLogWriter());
+ ThreadUtils.join(asyncObj4, 5 * 60 * 1000);
if(asyncObj4.exceptionOccurred()){
- fail("asyncObj4 failed", asyncObj4.getException());
+ Assert.fail("asyncObj4 failed", asyncObj4.getException());
}
- DistributedTestCase.join(asyncObj5, 5 * 60 * 1000, getLogWriter());
+ ThreadUtils.join(asyncObj5, 5 * 60 * 1000);
if(asyncObj5.exceptionOccurred()){
- fail("asyncObj5 failed", asyncObj5.getException());
+ Assert.fail("asyncObj5 failed", asyncObj5.getException());
}
@@ -193,14 +197,14 @@ public class TxnTimeOutDUnitTest extends DistributedTestCase {
"runTest2");
AsyncInvocation asyncObj2 = vm0.invokeAsync(TxnTimeOutDUnitTest.class, "runTest1");
- DistributedTestCase.join(asyncObj1, 5 * 60 * 1000, getLogWriter());
+ ThreadUtils.join(asyncObj1, 5 * 60 * 1000);
if(asyncObj1.exceptionOccurred()){
- fail("asyncObj1 failed", asyncObj1.getException());
+ Assert.fail("asyncObj1 failed", asyncObj1.getException());
}
- DistributedTestCase.join(asyncObj2, 5 * 60 * 1000, getLogWriter());
+ ThreadUtils.join(asyncObj2, 5 * 60 * 1000);
if(asyncObj2.exceptionOccurred()){
- fail("asyncObj2 failed", asyncObj2.getException());
+ Assert.fail("asyncObj2 failed", asyncObj2.getException());
}
}
@@ -227,7 +231,7 @@ public class TxnTimeOutDUnitTest extends DistributedTestCase {
fail("Exception did not occur although was supposed to occur");
}
catch (Exception e) {
- getLogWriter().fine("Exception caught " + e);
+ LogWriterUtils.getLogWriter().fine("Exception caught " + e);
fail("failed in naming lookup: " + e);
}
finally {
@@ -256,7 +260,7 @@ public class TxnTimeOutDUnitTest extends DistributedTestCase {
fail("Exception did not occur although was supposed to occur");
}
catch (Exception e) {
- getLogWriter().fine("Exception caught " + e);
+ LogWriterUtils.getLogWriter().fine("Exception caught " + e);
fail("failed in naming lookup: " + e);
}
}
@@ -300,7 +304,7 @@ public class TxnTimeOutDUnitTest extends DistributedTestCase {
//
// sb.append(lineSep);
}
- getLogWriter().fine("***********\n " + sb);
+ LogWriterUtils.getLogWriter().fine("***********\n " + sb);
return sb.toString();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/DistributedSystemLogFileJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/DistributedSystemLogFileJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/DistributedSystemLogFileJUnitTest.java
index a8b664e..b3f4029 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/DistributedSystemLogFileJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/DistributedSystemLogFileJUnitTest.java
@@ -43,8 +43,8 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.internal.logging.log4j.FastLogger;
import com.gemstone.gemfire.internal.logging.log4j.LogWriterLogger;
-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;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
@@ -113,7 +113,7 @@ public class DistributedSystemLogFileJUnitTest {
assertEquals("Expected " + LogWriterImpl.levelToString(InternalLogWriter.INFO_LEVEL) + " but was " + LogWriterImpl.levelToString(logWriter.getLogWriterLevel()),
InternalLogWriter.INFO_LEVEL, logWriter.getLogWriterLevel());
- DistributedTestCase.waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
@Override
public boolean done() {
return logFile.exists();
@@ -504,7 +504,7 @@ public class DistributedSystemLogFileJUnitTest {
assertTrue(logWriter instanceof FastLogger);
assertTrue(((FastLogger)logWriter).isDelegating());
- DistributedTestCase.waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
@Override
public boolean done() {
return logFile.exists();
@@ -720,7 +720,7 @@ public class DistributedSystemLogFileJUnitTest {
assertTrue(logWriter instanceof FastLogger);
assertTrue(((FastLogger)logWriter).isDelegating());
- DistributedTestCase.waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
@Override
public boolean done() {
return logFile.exists();
@@ -961,7 +961,7 @@ public class DistributedSystemLogFileJUnitTest {
assertTrue(((FastLogger)logWriter).isDelegating());
- DistributedTestCase.waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
@Override
public boolean done() {
return securityLogFile.exists() && logFile.exists();
@@ -1076,7 +1076,7 @@ public class DistributedSystemLogFileJUnitTest {
assertTrue(((FastLogger)securityLogWriter).isDelegating());
assertTrue(((FastLogger)logWriter).isDelegating());
- DistributedTestCase.waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
@Override
public boolean done() {
return securityLogFile.exists() && logFile.exists();
@@ -1248,7 +1248,7 @@ public class DistributedSystemLogFileJUnitTest {
assertTrue(((FastLogger)securityLogWriter).isDelegating());
assertTrue(((FastLogger)logWriter).isDelegating());
- DistributedTestCase.waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
@Override
public boolean done() {
return logFile.exists();
@@ -1397,7 +1397,7 @@ public class DistributedSystemLogFileJUnitTest {
assertTrue(((FastLogger)securityLogWriter).isDelegating());
assertTrue(((FastLogger)logWriter).isDelegating());
- DistributedTestCase.waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
@Override
public boolean done() {
return logFile.exists();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/LocatorLogFileJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/LocatorLogFileJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/LocatorLogFileJUnitTest.java
index d817f74..ffb09ce 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/LocatorLogFileJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/LocatorLogFileJUnitTest.java
@@ -35,8 +35,8 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.logging.log4j.LogWriterLogger;
-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;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
@@ -103,7 +103,7 @@ public class LocatorLogFileJUnitTest {
InternalLogWriter.INFO_LEVEL, logWriter.getLogWriterLevel());
assertNotNull(this.locator);
- DistributedTestCase.waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
@Override
public boolean done() {
return logFile.exists();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/MergeLogFilesJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/MergeLogFilesJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/MergeLogFilesJUnitTest.java
index e076d04..32d38c8 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/MergeLogFilesJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/logging/MergeLogFilesJUnitTest.java
@@ -41,7 +41,7 @@ import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.LogWriter;
import com.gemstone.gemfire.SystemFailure;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
@@ -79,7 +79,7 @@ public class MergeLogFilesJUnitTest {
for (Iterator iter = workers.iterator(); iter.hasNext(); ) {
Worker worker = (Worker) iter.next();
- DistributedTestCase.join(worker, 120 * 1000, null);
+ ThreadUtils.join(worker, 120 * 1000);
}
if (group.exceptionOccurred()) {