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:07 UTC
[43/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/cache/query/partitioned/PRQueryRemoteNodeExceptionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRemoteNodeExceptionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRemoteNodeExceptionDUnitTest.java
index 830d35b..07807c8 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRemoteNodeExceptionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/partitioned/PRQueryRemoteNodeExceptionDUnitTest.java
@@ -41,11 +41,13 @@ import com.gemstone.gemfire.distributed.internal.DistributionMessageObserver;
import com.gemstone.gemfire.internal.cache.BucketRegion;
import com.gemstone.gemfire.internal.cache.PartitionedRegion;
import com.gemstone.gemfire.internal.cache.PartitionedRegionDUnitTestCase;
+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.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase.WaitCriterion;
/**
* This test verifies exception handling on coordinator node for remote as
@@ -88,9 +90,8 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
private int numOfBuckets = 10;
@Override
- public void tearDown2() throws Exception {
- invokeInEveryVM(QueryObserverHolder.class, "reset");
- super.tearDown2();
+ protected final void preTearDownPartitionedRegionDUnitTest() throws Exception {
+ Invoke.invokeInEveryVM(QueryObserverHolder.class, "reset");
}
/**
@@ -108,7 +109,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
public void testPRWithLocalAndRemoteException()
throws Exception {
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Querying with PR Local/Remote Exception test Started");
Host host = Host.getHost(0);
@@ -119,7 +120,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
vmList.add(vm1);
vmList.add(vm0);
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Creating PR's across all VM0 , VM1");
vm0.invoke(PRQHelp
@@ -127,17 +128,17 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
vm1.invoke(PRQHelp
.getCacheSerializableRunnableForPRCreateLimitedBuckets(name, redundancy, numOfBuckets));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Created PR on VM0 , VM1");
// creating a local region on one of the JVM's
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Creating Local Region on VM0");
vm0.invoke(PRQHelp
.getCacheSerializableRunnableForLocalRegionCreation(localName));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Created Local Region on VM0");
@@ -147,29 +148,29 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
// Putting the data into the accessor node
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Inserting Portfolio data through the accessor node");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Inserted Portfolio data through the accessor node");
// Putting the same data in the local region created
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Inserting Portfolio data on local node VM0 for result Set Comparison");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName,
portfolio, cnt, cntDest));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Inserted Portfolio data on local node VM0 for result Set Comparison");
// Execute query first time. This is to make sure all the buckets are
// created
// (lazy bucket creation).
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Querying on VM0 First time");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRQueryAndCompareResults(
@@ -219,9 +220,9 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
gotException = true;
if (ex.getMessage().contains("local node")) {
// ex.printStackTrace();
- getLogWriter().info("PRQueryRemoteNodeExceptionDUnitTest: Test received Exception from local node successfully.");
+ LogWriterUtils.getLogWriter().info("PRQueryRemoteNodeExceptionDUnitTest: Test received Exception from local node successfully.");
} else {
- fail("PRQueryRemoteNodeExceptionDUnitTest: Test did not receive Exception as expected from local node rather received", ex);
+ Assert.fail("PRQueryRemoteNodeExceptionDUnitTest: Test did not receive Exception as expected from local node rather received", ex);
}
}
if (!gotException) {
@@ -231,14 +232,14 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
}
);
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRemoteNodeExceptionDUnitTest#testPRWithLocalAndRemoteException: Querying with PR Local/Remote Exception Test ENDED");
}
public void testRemoteException() throws Exception {
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Querying with PR Local/Remote Exception test Started");
Host host = Host.getHost(0);
@@ -249,7 +250,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
vmList.add(vm1);
vmList.add(vm0);
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Creating PR's across all VM0 , VM1");
vm0.invoke(PRQHelp
@@ -257,17 +258,17 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
vm1.invoke(PRQHelp
.getCacheSerializableRunnableForPRCreateLimitedBuckets(name, redundancy, numOfBuckets));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Created PR on VM0 , VM1");
// creating a local region on one of the JVM's
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Creating Local Region on VM0");
vm0.invoke(PRQHelp
.getCacheSerializableRunnableForLocalRegionCreation(localName));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Created Local Region on VM0");
@@ -277,22 +278,22 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
// Putting the data into the accessor node
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Inserting Portfolio data through the accessor node");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Inserted Portfolio data through the accessor node");
// Putting the same data in the local region created
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Inserting Portfolio data on local node VM0 for result Set Comparison");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName,
portfolio, cnt, cntDest));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Inserted Portfolio data on local node VM0 for result Set Comparison");
@@ -350,9 +351,9 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
gotException = true;
if (ex.getMessage().contains("remote node")) {
ex.printStackTrace();
- getLogWriter().info("PRQueryRemoteNodeExceptionDUnitTest: Test received Exception from remote node successfully.");
+ LogWriterUtils.getLogWriter().info("PRQueryRemoteNodeExceptionDUnitTest: Test received Exception from remote node successfully.");
} else {
- fail("PRQueryRemoteNodeExceptionDUnitTest: Test did not receive Exception as expected from remote node rather received", ex);
+ Assert.fail("PRQueryRemoteNodeExceptionDUnitTest: Test did not receive Exception as expected from remote node rather received", ex);
}
}
if (!gotException) {
@@ -362,14 +363,14 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
}
);
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRemoteNodeExceptionDUnitTest#testPRWithLocalAndRemoteException: Querying with PR Local/Remote Exception Test ENDED");
}
public void testCacheCloseExceptionFromLocalAndRemote() throws Exception {
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Querying with PR Local/Remote Exception test Started");
Host host = Host.getHost(0);
@@ -380,7 +381,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
vmList.add(vm1);
vmList.add(vm0);
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Creating PR's across all VM0 , VM1");
vm0.invoke(PRQHelp
@@ -388,17 +389,17 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
vm1.invoke(PRQHelp
.getCacheSerializableRunnableForPRCreateLimitedBuckets(name, redundancy, numOfBuckets));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Created PR on VM0 , VM1");
// creating a local region on one of the JVM's
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Creating Local Region on VM0");
vm0.invoke(PRQHelp
.getCacheSerializableRunnableForLocalRegionCreation(localName));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Created Local Region on VM0");
@@ -408,22 +409,22 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
// Putting the data into the accessor node
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Inserting Portfolio data through the accessor node");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Inserted Portfolio data through the accessor node");
// Putting the same data in the local region created
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Inserting Portfolio data on local node VM0 for result Set Comparison");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName,
portfolio, cnt, cntDest));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Inserted Portfolio data on local node VM0 for result Set Comparison");
@@ -439,7 +440,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
@Override
public void afterIterationEvaluation(Object result) {
- getLogWriter().info("Calling after IterationEvaluation :" + noOfAccess);
+ LogWriterUtils.getLogWriter().info("Calling after IterationEvaluation :" + noOfAccess);
if (noOfAccess > 2) {
PRQHelp.getCache().getRegion(name).destroyRegion();
}
@@ -465,7 +466,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
@Override
public void afterIterationEvaluation(Object result) {
//Object region = ((DefaultQuery)query).getRegionsInQuery(null).iterator().next();
- getLogWriter().info("Calling after IterationEvaluation :" + noOfAccess);
+ LogWriterUtils.getLogWriter().info("Calling after IterationEvaluation :" + noOfAccess);
if (noOfAccess > 2) {
PRQHelp.getCache().close();
}
@@ -482,10 +483,10 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
} catch (Exception ex) {
gotException = true;
if (ex instanceof CacheClosedException || ex instanceof QueryInvocationTargetException) {
- getLogWriter().info(ex.getMessage());
- getLogWriter().info("PRQueryRemoteNodeExceptionDUnitTest: Test received Exception from local node successfully.");
+ LogWriterUtils.getLogWriter().info(ex.getMessage());
+ LogWriterUtils.getLogWriter().info("PRQueryRemoteNodeExceptionDUnitTest: Test received Exception from local node successfully.");
} else {
- fail("PRQueryRemoteNodeExceptionDUnitTest: Test did not receive Exception as expected from local node rather received", ex);
+ Assert.fail("PRQueryRemoteNodeExceptionDUnitTest: Test did not receive Exception as expected from local node rather received", ex);
}
}
if (!gotException) {
@@ -495,14 +496,14 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
}
);
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRemoteNodeExceptionDUnitTest#testPRWithLocalAndRemoteException: Querying with PR Local/Remote Exception Test ENDED");
}
public void testCacheCloseExceptionFromLocalAndRemote2() throws Exception {
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Querying with PR Local/Remote Exception test Started");
Host host = Host.getHost(0);
@@ -513,7 +514,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
vmList.add(vm1);
vmList.add(vm0);
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Creating PR's across all VM0 , VM1");
vm0.invoke(PRQHelp
@@ -521,17 +522,17 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
vm1.invoke(PRQHelp
.getCacheSerializableRunnableForPRCreateLimitedBuckets(name, redundancy, numOfBuckets));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Created PR on VM0 , VM1");
// creating a local region on one of the JVM's
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Creating Local Region on VM0");
vm0.invoke(PRQHelp
.getCacheSerializableRunnableForLocalRegionCreation(localName));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Created Local Region on VM0");
@@ -541,22 +542,22 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
// Putting the data into the accessor node
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Inserting Portfolio data through the accessor node");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Inserted Portfolio data through the accessor node");
// Putting the same data in the local region created
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Inserting Portfolio data on local node VM0 for result Set Comparison");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName,
portfolio, cnt, cntDest));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Inserted Portfolio data on local node VM0 for result Set Comparison");
@@ -572,7 +573,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
@Override
public void afterIterationEvaluation(Object result) {
- getLogWriter().info("Calling after IterationEvaluation :" + noOfAccess);
+ LogWriterUtils.getLogWriter().info("Calling after IterationEvaluation :" + noOfAccess);
if (noOfAccess > 1) {
PRQHelp.getCache().getRegion(name).destroyRegion();
}
@@ -625,10 +626,10 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
} catch (Exception ex) {
gotException = true;
if (ex instanceof QueryInvocationTargetException) {
- getLogWriter().info(ex.getMessage());
- getLogWriter().info("PRQueryRemoteNodeExceptionDUnitTest: Test received Exception from remote node successfully as region.destroy happened before cache.close().");
+ LogWriterUtils.getLogWriter().info(ex.getMessage());
+ LogWriterUtils.getLogWriter().info("PRQueryRemoteNodeExceptionDUnitTest: Test received Exception from remote node successfully as region.destroy happened before cache.close().");
} else {
- fail("PRQueryRemoteNodeExceptionDUnitTest: Test did not receive Exception as expected from local node rather received", ex);
+ Assert.fail("PRQueryRemoteNodeExceptionDUnitTest: Test did not receive Exception as expected from local node rather received", ex);
}
}
if (!gotException) {
@@ -638,14 +639,14 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
}
);
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRemoteNodeExceptionDUnitTest#testPRWithLocalAndRemoteException: Querying with PR Local/Remote Exception Test ENDED");
}
public void testForceReattemptExceptionFromLocal() throws Exception {
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Querying with PR Local/Remote Exception test Started");
Host host = Host.getHost(0);
@@ -658,7 +659,7 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
vmList.add(vm0);
vmList.add(vm2);
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Creating PR's across all VM0 , VM1");
vm0.invoke(PRQHelp
@@ -668,17 +669,17 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
vm2.invoke(PRQHelp
.getCacheSerializableRunnableForPRCreateLimitedBuckets(name, 1/*redundancy*/, numOfBuckets));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Created PR on VM0 , VM1");
// creating a local region on one of the JVM's
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Creating Local Region on VM0");
vm0.invoke(PRQHelp
.getCacheSerializableRunnableForLocalRegionCreation(localName));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Created Local Region on VM0");
@@ -688,22 +689,22 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
final PortfolioData[] portfolio = PRQHelp.createPortfolioData(cnt, cntDest);
// Putting the data into the accessor node
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Inserting Portfolio data through the accessor node");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio,
cnt, cntDest));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Inserted Portfolio data through the accessor node");
// Putting the same data in the local region created
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Inserting Portfolio data on local node VM0 for result Set Comparison");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName,
portfolio, cnt, cntDest));
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRegionDestroyedDUnitTest#testPRWithLocalAndRemoteException: Successfully Inserted Portfolio data on local node VM0 for result Set Comparison");
@@ -720,13 +721,13 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
@Override
public void startQuery(Query query) {
Object region = ((DefaultQuery)query).getRegionsInQuery(null).iterator().next();
- getLogWriter().info("Region type on VM1:"+region);
+ LogWriterUtils.getLogWriter().info("Region type on VM1:"+region);
if (noOfAccess == 1) {
PartitionedRegion pr = (PartitionedRegion)PRQHelp.getCache().getRegion(name);
List buks = pr.getLocalPrimaryBucketsListTestOnly();
- getLogWriter().info("Available buckets:"+buks);
+ LogWriterUtils.getLogWriter().info("Available buckets:"+buks);
int bukId = ((Integer)(buks.get(0))).intValue();
- getLogWriter().info("Destroying bucket id:"+bukId);
+ LogWriterUtils.getLogWriter().info("Destroying bucket id:"+bukId);
pr.getDataStore().getLocalBucketById(bukId).destroyRegion();
}
++noOfAccess;
@@ -751,13 +752,13 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
@Override
public void startQuery(Query query) {
Object region = ((DefaultQuery)query).getRegionsInQuery(null).iterator().next();
- getLogWriter().info("Region type on VM0:"+region);
+ LogWriterUtils.getLogWriter().info("Region type on VM0:"+region);
if (noOfAccess == 2) {
PartitionedRegion pr = (PartitionedRegion)PRQHelp.getCache().getRegion(name);
List buks = pr.getLocalPrimaryBucketsListTestOnly();
- getLogWriter().info("Available buckets:"+buks);
+ LogWriterUtils.getLogWriter().info("Available buckets:"+buks);
int bukId = ((Integer)(buks.get(0))).intValue();
- getLogWriter().info("Destroying bucket id:"+bukId);
+ LogWriterUtils.getLogWriter().info("Destroying bucket id:"+bukId);
pr.getDataStore().getLocalBucketById(bukId).destroyRegion();
}
++noOfAccess;
@@ -769,16 +770,16 @@ public class PRQueryRemoteNodeExceptionDUnitTest extends PartitionedRegionDUnitT
try {
query.execute();
- getLogWriter().info("PRQueryRemoteNodeExceptionDUnitTest: Query executed successfully with ForceReattemptException on local and remote both.");
+ LogWriterUtils.getLogWriter().info("PRQueryRemoteNodeExceptionDUnitTest: Query executed successfully with ForceReattemptException on local and remote both.");
} catch (Exception ex) {
gotException = true;
- fail("PRQueryRemoteNodeExceptionDUnitTest#testPRWithLocalAndRemoteException: Test received Exception", ex);
+ Assert.fail("PRQueryRemoteNodeExceptionDUnitTest#testPRWithLocalAndRemoteException: Test received Exception", ex);
}
}
}
);
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRQueryRemoteNodeExceptionDUnitTest#testPRWithLocalAndRemoteException: Querying with PR Local/Remote Exception Test ENDED");
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache/snapshot/ParallelSnapshotDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/snapshot/ParallelSnapshotDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/snapshot/ParallelSnapshotDUnitTest.java
index ea1195e..ea95558 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/snapshot/ParallelSnapshotDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/snapshot/ParallelSnapshotDUnitTest.java
@@ -161,9 +161,8 @@ public class ParallelSnapshotDUnitTest extends CacheTestCase {
loadCache();
}
- public void tearDown2() throws Exception {
- super.tearDown2();
-
+ @Override
+ protected final void postTearDownCacheTestCase() throws Exception {
File[] snaps = new File(".").listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotByteArrayDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotByteArrayDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotByteArrayDUnitTest.java
index e43d39b..43fc2e3 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotByteArrayDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotByteArrayDUnitTest.java
@@ -28,6 +28,7 @@ import com.gemstone.gemfire.cache.snapshot.SnapshotOptions.SnapshotFormat;
import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
public class SnapshotByteArrayDUnitTest extends CacheTestCase {
@@ -80,13 +81,13 @@ public class SnapshotByteArrayDUnitTest extends CacheTestCase {
}
private void dump(EntryEvent<Integer, Object> event) {
- getLogWriter().info("op = " + event.getOperation());
+ LogWriterUtils.getLogWriter().info("op = " + event.getOperation());
Object obj1 = event.getNewValue();
- getLogWriter().info("new = " + obj1);
+ LogWriterUtils.getLogWriter().info("new = " + obj1);
Object obj2 = event.getOldValue();
- getLogWriter().info("old = " + obj2);
+ LogWriterUtils.getLogWriter().info("old = " + obj2);
}
});
@@ -109,11 +110,11 @@ public class SnapshotByteArrayDUnitTest extends CacheTestCase {
loadCache();
}
- public void tearDown2() throws Exception {
+ @Override
+ protected final void preTearDownCacheTestCase() throws Exception {
if (snap.exists()) {
snap.delete();
}
- super.tearDown2();
}
public void loadCache() throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotPerformanceDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotPerformanceDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotPerformanceDUnitTest.java
index 309363e..83fc231 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotPerformanceDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/snapshot/SnapshotPerformanceDUnitTest.java
@@ -31,6 +31,7 @@ import com.gemstone.gemfire.cache.snapshot.RegionGenerator.SerializationType;
import com.gemstone.gemfire.cache.snapshot.SnapshotOptions.SnapshotFormat;
import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
public class SnapshotPerformanceDUnitTest extends CacheTestCase {
@@ -52,7 +53,7 @@ public class SnapshotPerformanceDUnitTest extends CacheTestCase {
for (SerializationType st : sts) {
for (int i = 0; i < iterations; i++) {
Region<Integer, MyObject> region = createRegion(rt, st);
- getLogWriter().info("SNP: Testing region " + region.getName() + ", iteration = " + i);
+ LogWriterUtils.getLogWriter().info("SNP: Testing region " + region.getName() + ", iteration = " + i);
loadData(region, st, dataCount);
doExport(region);
@@ -77,9 +78,9 @@ public class SnapshotPerformanceDUnitTest extends CacheTestCase {
double eps = 1000.0 * size / elapsed;
double mbps = 1000.0 * bytes / elapsed / (1024 * 1024);
- getLogWriter().info("SNP: Exported " + size + " entries (" + bytes + " bytes) in " + elapsed + " ms");
- getLogWriter().info("SNP: Export entry rate: " + eps + " entries / sec");
- getLogWriter().info("SNP: Export data rate: " + mbps + " MB / sec");
+ LogWriterUtils.getLogWriter().info("SNP: Exported " + size + " entries (" + bytes + " bytes) in " + elapsed + " ms");
+ LogWriterUtils.getLogWriter().info("SNP: Export entry rate: " + eps + " entries / sec");
+ LogWriterUtils.getLogWriter().info("SNP: Export data rate: " + mbps + " MB / sec");
}
private void doImport(Region<Integer, MyObject> region) throws Exception {
@@ -95,9 +96,9 @@ public class SnapshotPerformanceDUnitTest extends CacheTestCase {
double eps = 1000.0 * size / elapsed;
double mbps = 1000.0 * bytes / elapsed / (1024 * 1024);
- getLogWriter().info("SNP: Imported " + size + " entries (" + bytes + " bytes) in " + elapsed + " ms");
- getLogWriter().info("SNP: Import entry rate: " + eps + " entries / sec");
- getLogWriter().info("SNP: Import data rate: " + mbps + " MB / sec");
+ LogWriterUtils.getLogWriter().info("SNP: Imported " + size + " entries (" + bytes + " bytes) in " + elapsed + " ms");
+ LogWriterUtils.getLogWriter().info("SNP: Import entry rate: " + eps + " entries / sec");
+ LogWriterUtils.getLogWriter().info("SNP: Import data rate: " + mbps + " MB / sec");
}
public void setUp() throws Exception {
@@ -105,10 +106,6 @@ public class SnapshotPerformanceDUnitTest extends CacheTestCase {
createCache();
}
- public void tearDown2() throws Exception {
- super.tearDown2();
- }
-
private void createCache() throws Exception {
SerializableCallable setup = new SerializableCallable() {
@Override
@@ -163,7 +160,7 @@ public class SnapshotPerformanceDUnitTest extends CacheTestCase {
}
long elapsed = System.currentTimeMillis() - start;
- getLogWriter().info("SNP: loaded " + count + " entries in " + elapsed + " ms");
+ LogWriterUtils.getLogWriter().info("SNP: loaded " + count + " entries in " + elapsed + " ms");
assertEquals(count, region.size());
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug35214DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug35214DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug35214DUnitTest.java
index 04b214f..7f6d29a 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug35214DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug35214DUnitTest.java
@@ -29,10 +29,14 @@ import com.gemstone.gemfire.cache.RegionEvent;
import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
import com.gemstone.gemfire.internal.cache.LocalRegion;
+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.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* Make sure entry expiration does not happen during gii for bug 35214
@@ -93,7 +97,7 @@ public class Bug35214DUnitTest extends CacheTestCase {
//pause(5);
}
else {
- getLogWriter().info("PROFILE CHECK: Found " + numProfiles + " getInitialImage Profiles (OK)");
+ LogWriterUtils.getLogWriter().info("PROFILE CHECK: Found " + numProfiles + " getInitialImage Profiles (OK)");
break;
}
}
@@ -156,7 +160,7 @@ public class Bug35214DUnitTest extends CacheTestCase {
throw e;
}
catch (Throwable e1) {
- fail("failed due to "+e1, e1);
+ Assert.fail("failed due to "+e1, e1);
}
System.setProperty(LocalRegion.EXPIRY_MS_PROPERTY, "true");
com.gemstone.gemfire.internal.cache.InitialImageOperation.slowImageProcessing = 30;
@@ -184,7 +188,7 @@ public class Bug35214DUnitTest extends CacheTestCase {
};
af.addCacheListener(cl1);
final Region r1 = createRootRegion("r1", af.create());
- DistributedTestCase.join(updater, 60 * 1000, getLogWriter());
+ ThreadUtils.join(updater, 60 * 1000);
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
return r1.values().size() == 0;
@@ -193,7 +197,7 @@ public class Bug35214DUnitTest extends CacheTestCase {
return "region never became empty";
}
};
- DistributedTestCase.waitForCriterion(ev, 2 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 2 * 1000, 200, true);
{
assertEquals(0, r1.values().size());
assertEquals(ENTRY_COUNT, r1.keys().size());
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug38741DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug38741DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug38741DUnitTest.java
index 417456f..d1a8bb4 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug38741DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/Bug38741DUnitTest.java
@@ -50,9 +50,12 @@ import com.gemstone.gemfire.internal.cache.ha.HARegionQueue;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientProxy;
import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID;
import com.gemstone.gemfire.internal.cache.tier.sockets.ClientUpdateMessageImpl;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
*
@@ -153,7 +156,7 @@ public class Bug38741DUnitTest extends ClientServerTestCase {
// Setup a client which subscribes to the server region, registers (aka pulls)
// interest in keys which creates an assumed HARegionQueue on the server
// (in the event that the above code didn't already create a HARegion)
- final String serverHostName = getServerHostName(server.getHost());
+ final String serverHostName = NetworkUtils.getServerHostName(server.getHost());
client.invoke(new CacheSerializableRunnable("Assert server copy behavior from client") {
public void run2() throws CacheException {
getCache();
@@ -200,7 +203,7 @@ public class Bug38741DUnitTest extends ClientServerTestCase {
return "region queue never became empty";
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
// Capture the current processed message count to know
// when the next message has been serialized
@@ -221,7 +224,7 @@ public class Bug38741DUnitTest extends ClientServerTestCase {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
// assert one serialization to send value to interested client
// more than one implies copy-on-read behavior (bad)
@@ -242,7 +245,7 @@ public class Bug38741DUnitTest extends ClientServerTestCase {
long start = NanoTimer.getTime();
final int maxSecs = 30;
while(!r.containsKey(ks2)) {
- pause(100);
+ Wait.pause(100);
if ((NanoTimer.getTime() - start) > TimeUnit.SECONDS.toNanos(maxSecs)) {
fail("Waited over " + maxSecs + "s");
}
@@ -313,7 +316,7 @@ public class Bug38741DUnitTest extends ClientServerTestCase {
SerializationCountingValue scv = (SerializationCountingValue)cd.getDeserializedForReading();
assertEquals(1, scv.count.get());
} catch (IOException fail) {
- fail("Unexpected IOException", fail);
+ Assert.fail("Unexpected IOException", fail);
}
}
});
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheListenerTestCase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheListenerTestCase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheListenerTestCase.java
index 4e4147f..a8df712 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheListenerTestCase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheListenerTestCase.java
@@ -16,10 +16,16 @@
*/
package com.gemstone.gemfire.cache30;
-import com.gemstone.gemfire.cache.*;
-//import com.gemstone.gemfire.cache.util.*;
-//import java.util.*;
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.CacheListener;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.EntryNotFoundException;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.RegionEvent;
import com.gemstone.gemfire.internal.cache.AbstractRegionMap;
+import com.gemstone.gemfire.test.dunit.Wait;
/**
* An abstract class whose test methods test the functionality of
@@ -359,7 +365,7 @@ public abstract class CacheListenerTestCase
assertTrue(region.getAttributes().getCacheListener() != null);
// com.gemstone.gemfire.internal.util.DebuggerSupport.waitForJavaDebugger(getLogWriter());
region.destroyRegion();
- pause(100); // extra pause
+ Wait.pause(100); // extra pause
assertTrue(region.isDestroyed());
assertTrue(listener.wasInvoked());
@@ -414,7 +420,7 @@ public abstract class CacheListenerTestCase
region = createRegion(name, attrs);
region.invalidateRegion();
- pause(500);
+ Wait.pause(500);
assertTrue(listener.wasInvoked());
assertEquals(0, region.values().size());
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheLoaderTestCase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheLoaderTestCase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheLoaderTestCase.java
index fc23365..2e1def8 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheLoaderTestCase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheLoaderTestCase.java
@@ -26,6 +26,8 @@ import com.gemstone.gemfire.cache.LoaderHelper;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.TimeoutException;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Wait;
/**
* An abstract class whose test methods test the functionality of
@@ -68,7 +70,7 @@ public abstract class CacheLoaderTestCase
}
} catch (TimeoutException ex) {
- fail("Why did I time out?", ex);
+ Assert.fail("Why did I time out?", ex);
}
Object argument = helper.getArgument();
@@ -303,7 +305,7 @@ public abstract class CacheLoaderTestCase
assertEquals(oldValue, region.get(key));
assertTrue(loader.wasInvoked());
- pause(500);
+ Wait.pause(500);
assertTrue(listener.wasInvoked());
listener = new TestCacheListener() {
@@ -320,7 +322,7 @@ public abstract class CacheLoaderTestCase
region.getAttributesMutator().setCacheListener(listener);
region.put(key, newValue);
- pause(500);
+ Wait.pause(500);
assertFalse(loader.wasInvoked());
assertTrue(listener.wasInvoked());
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheMapTxnDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheMapTxnDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheMapTxnDUnitTest.java
index 588ec7e..b889bc7 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheMapTxnDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheMapTxnDUnitTest.java
@@ -35,9 +35,11 @@ import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.UnsupportedOperationInTransactionException;
import com.gemstone.gemfire.distributed.DistributedSystem;
+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.ThreadUtils;
import com.gemstone.gemfire.test.dunit.VM;
public class CacheMapTxnDUnitTest extends DistributedTestCase{
@@ -64,13 +66,13 @@ public class CacheMapTxnDUnitTest extends DistributedTestCase{
vm1.invoke(CacheMapTxnDUnitTest.class, "createCache");
}
- public void tearDown2(){
- Host host = Host.getHost(0);
- VM vm0 = host.getVM(0);
- VM vm1 = host.getVM(1);
- vm0.invoke(CacheMapTxnDUnitTest.class, "closeCache");
- vm1.invoke(CacheMapTxnDUnitTest.class, "closeCache");
-
+ @Override
+ protected final void preTearDown() throws Exception {
+ Host host = Host.getHost(0);
+ VM vm0 = host.getVM(0);
+ VM vm1 = host.getVM(1);
+ vm0.invoke(CacheMapTxnDUnitTest.class, "closeCache");
+ vm1.invoke(CacheMapTxnDUnitTest.class, "closeCache");
}
public static void createCache(){
@@ -145,15 +147,15 @@ public class CacheMapTxnDUnitTest extends DistributedTestCase{
vm0.invoke(CacheMapTxnDUnitTest.class, "miscMethodsOwner");
AsyncInvocation o2 = vm0.invokeAsync(CacheMapTxnDUnitTest.class, "miscMethodsNotOwner");//invoke in same vm but in seperate thread
AsyncInvocation o3 = vm1.invokeAsync(CacheMapTxnDUnitTest.class, "miscMethodsNotOwner");//invoke in another vm
- DistributedTestCase.join(o2, 30 * 1000, getLogWriter());
- DistributedTestCase.join(o3, 30 * 1000, getLogWriter());
+ ThreadUtils.join(o2, 30 * 1000);
+ ThreadUtils.join(o3, 30 * 1000);
if(o2.exceptionOccurred()){
- fail("o2 failed", o2.getException());
+ Assert.fail("o2 failed", o2.getException());
}
if(o3.exceptionOccurred()){
- fail("o3 failed", o3.getException());
+ Assert.fail("o3 failed", o3.getException());
}
}//end of testMiscMethods
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheRegionsReliablityStatsCheckDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheRegionsReliablityStatsCheckDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheRegionsReliablityStatsCheckDUnitTest.java
index 3834f83..1efae19 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheRegionsReliablityStatsCheckDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheRegionsReliablityStatsCheckDUnitTest.java
@@ -33,6 +33,7 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.cache.CachePerfStats;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
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.VM;
@@ -101,7 +102,7 @@ public class CacheRegionsReliablityStatsCheckDUnitTest extends CacheTestCase {
{
Properties props = new Properties();
- props.setProperty(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
+ props.setProperty(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
props.setProperty(DistributionConfig.ROLES_NAME, rr1);
getSystem(props);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheStatisticsDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheStatisticsDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheStatisticsDUnitTest.java
index a07a749..422dbe9 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheStatisticsDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheStatisticsDUnitTest.java
@@ -27,6 +27,7 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
/**
* Tests the {@link CacheStatistics} that are maintained by a {@link
@@ -213,7 +214,7 @@ public class CacheStatisticsDUnitTest extends CacheTestCase {
oldBefore = before;
oldAfter = after;
- pause(150);
+ Wait.pause(150);
before = ((GemFireCacheImpl)getCache()).cacheTimeMillis();
region.get(key);
after = ((GemFireCacheImpl)getCache()).cacheTimeMillis();
@@ -222,7 +223,7 @@ public class CacheStatisticsDUnitTest extends CacheTestCase {
assertInRange(before, after, rootStats.getLastAccessedTime());
assertInRange(oldBefore, oldAfter, rootStats.getLastModifiedTime());
- pause(150);
+ Wait.pause(150);
before = ((GemFireCacheImpl)getCache()).cacheTimeMillis();
region.put(key, value);
CacheStatistics eStats = region.getEntry(key).getStatistics();
@@ -237,7 +238,7 @@ public class CacheStatisticsDUnitTest extends CacheTestCase {
oldBefore = before;
oldAfter = after;
- pause(150);
+ Wait.pause(150);
before = ((GemFireCacheImpl)getCache()).cacheTimeMillis();
region.get(key);
after = ((GemFireCacheImpl)getCache()).cacheTimeMillis();
@@ -252,7 +253,7 @@ public class CacheStatisticsDUnitTest extends CacheTestCase {
long oldOldAfter = oldAfter;
oldBefore = before;
oldAfter = after;
- pause(150);
+ Wait.pause(150);
before = ((GemFireCacheImpl)getCache()).cacheTimeMillis();
region.create(key2, null);
CacheStatistics eStats2 = region.getEntry(key2).getStatistics();
@@ -272,7 +273,7 @@ public class CacheStatisticsDUnitTest extends CacheTestCase {
// times
oldBefore = before;
oldAfter = after;
- pause(150);
+ Wait.pause(150);
before = ((GemFireCacheImpl)getCache()).cacheTimeMillis();
region.invalidate(key2);
after = ((GemFireCacheImpl)getCache()).cacheTimeMillis();
@@ -283,7 +284,7 @@ public class CacheStatisticsDUnitTest extends CacheTestCase {
assertInRange(oldBefore, oldAfter, rootStats.getLastAccessedTime());
assertInRange(oldBefore, oldAfter, rootStats.getLastModifiedTime());
- pause(150);
+ Wait.pause(150);
before = ((GemFireCacheImpl)getCache()).cacheTimeMillis();
region.destroy(key2);
after = ((GemFireCacheImpl)getCache()).cacheTimeMillis();
@@ -397,7 +398,7 @@ public class CacheStatisticsDUnitTest extends CacheTestCase {
// make sure at least 100ms have passed; otherwise, the update
// may not actually bump the statistics
- pause(100);
+ Wait.pause(100);
vm1.invoke(new CacheSerializableRunnable("Update") {
public void run2() throws CacheException {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheTestCase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheTestCase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheTestCase.java
index 7f32a46..c228e5c 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheTestCase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheTestCase.java
@@ -54,9 +54,15 @@ import com.gemstone.gemfire.internal.cache.PartitionedRegion;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator;
import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* The abstract superclass of tests that require the creation of a
@@ -113,13 +119,13 @@ public abstract class CacheTestCase extends DistributedTestCase {
}
cache = c;
} catch (CacheExistsException e) {
- fail("the cache already exists", e);
+ Assert.fail("the cache already exists", e);
} catch (RuntimeException ex) {
throw ex;
} catch (Exception ex) {
- fail("Checked exception while initializing cache??", ex);
+ Assert.fail("Checked exception while initializing cache??", ex);
} finally {
System.clearProperty("gemfire.DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE");
}
@@ -137,13 +143,13 @@ public abstract class CacheTestCase extends DistributedTestCase {
Cache c = CacheFactory.create(getLonerSystem());
cache = c;
} catch (CacheExistsException e) {
- fail("the cache already exists", e);
+ Assert.fail("the cache already exists", e);
} catch (RuntimeException ex) {
throw ex;
} catch (Exception ex) {
- fail("Checked exception while initializing cache??", ex);
+ Assert.fail("Checked exception while initializing cache??", ex);
} finally {
System.clearProperty("gemfire.DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE");
}
@@ -163,13 +169,13 @@ public abstract class CacheTestCase extends DistributedTestCase {
Cache c = CacheFactory.create(getLonerSystemWithEnforceUniqueHost());
cache = c;
} catch (CacheExistsException e) {
- fail("the cache already exists", e);
+ Assert.fail("the cache already exists", e);
} catch (RuntimeException ex) {
throw ex;
} catch (Exception ex) {
- fail("Checked exception while initializing cache??", ex);
+ Assert.fail("Checked exception while initializing cache??", ex);
} finally {
System.clearProperty("gemfire.DISABLE_DISCONNECT_DS_ON_CACHE_CLOSE");
}
@@ -200,7 +206,7 @@ public abstract class CacheTestCase extends DistributedTestCase {
CacheXmlGenerator.generate(cache, pw);
pw.close();
} catch (IOException ex) {
- fail("IOException during cache.xml generation to " + file, ex);
+ Assert.fail("IOException during cache.xml generation to " + file, ex);
}
cache = null;
GemFireCacheImpl.testCacheXml = file;
@@ -226,7 +232,7 @@ public abstract class CacheTestCase extends DistributedTestCase {
CacheXmlGenerator.generate(cache, pw, useSchema, xmlVersion);
pw.close();
} catch (IOException ex) {
- fail("IOException during cache.xml generation to " + file, ex);
+ Assert.fail("IOException during cache.xml generation to " + file, ex);
}
cache = null;
GemFireCacheImpl.testCacheXml = file;
@@ -258,7 +264,7 @@ public abstract class CacheTestCase extends DistributedTestCase {
final GemFireCacheImpl gfCache = GemFireCacheImpl.getInstance();
if (gfCache != null && !gfCache.isClosed()
&& gfCache.getCancelCriterion().cancelInProgress() != null) {
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public boolean done() {
return gfCache.isClosed();
@@ -274,7 +280,7 @@ public abstract class CacheTestCase extends DistributedTestCase {
createCache(client, cf);
}
if (client && cache != null) {
- addExpectedException("java.net.ConnectException");
+ IgnoredException.addIgnoredException("java.net.ConnectException");
}
return cache;
}
@@ -291,7 +297,7 @@ public abstract class CacheTestCase extends DistributedTestCase {
final GemFireCacheImpl gfCache = GemFireCacheImpl.getInstance();
if (gfCache != null && !gfCache.isClosed()
&& gfCache.getCancelCriterion().cancelInProgress() != null) {
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public boolean done() {
return gfCache.isClosed();
@@ -308,7 +314,7 @@ public abstract class CacheTestCase extends DistributedTestCase {
cache = (Cache)factory.create();
}
if (cache != null) {
- addExpectedException("java.net.ConnectException");
+ IgnoredException.addIgnoredException("java.net.ConnectException");
}
return (ClientCache)cache;
}
@@ -377,11 +383,13 @@ public abstract class CacheTestCase extends DistributedTestCase {
/** Closed the cache in all VMs. */
protected void closeAllCache() {
closeCache();
- invokeInEveryVM(CacheTestCase.class, "closeCache");
+ Invoke.invokeInEveryVM(CacheTestCase.class, "closeCache");
}
@Override
- public void tearDown2() throws Exception {
+ protected final void preTearDown() throws Exception {
+ preTearDownCacheTestCase();
+
// locally destroy all root regions and close the cache
remoteTearDown();
// Now invoke it in every VM
@@ -389,10 +397,17 @@ public abstract class CacheTestCase extends DistributedTestCase {
Host host = Host.getHost(h);
for (int v = 0; v < host.getVMCount(); v++) {
VM vm = host.getVM(v);
- vm.invoke(CacheTestCase.class, "remoteTearDown");
+ vm.invoke(()->remoteTearDown());
}
}
- super.tearDown2();
+
+ postTearDownCacheTestCase();
+ }
+
+ protected void preTearDownCacheTestCase() throws Exception {
+ }
+
+ protected void postTearDownCacheTestCase() throws Exception {
}
/**
@@ -411,7 +426,7 @@ public abstract class CacheTestCase extends DistributedTestCase {
try {
cleanDiskDirs();
} catch(Exception e) {
- getLogWriter().error("Error cleaning disk dirs", e);
+ LogWriterUtils.getLogWriter().error("Error cleaning disk dirs", e);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml30DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml30DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml30DUnitTest.java
index 6df49b2..85fa8a4 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml30DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml30DUnitTest.java
@@ -61,7 +61,8 @@ import com.gemstone.gemfire.internal.cache.xmlcache.ClientCacheCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.Declarable2;
import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.RegionCreation;
-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.util.test.TestUtil;
/**
@@ -96,7 +97,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
setXmlFile(nonExistent);
// System.out.println("testNonExistentFile - set: " + System.currentTimeMillis());
- ExpectedException expectedException = CacheTestCase.addExpectedException(LocalizedStrings.
+ IgnoredException expectedException = IgnoredException.addIgnoredException(LocalizedStrings.
GemFireCache_DECLARATIVE_CACHE_XML_FILERESOURCE_0_DOES_NOT_EXIST.toLocalizedString(nonExistent.getPath()));
try {
getCache();
@@ -119,7 +120,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
dir.deleteOnExit();
setXmlFile(dir);
- ExpectedException expectedException = CacheTestCase.addExpectedException(LocalizedStrings.
+ IgnoredException expectedException = IgnoredException.addIgnoredException(LocalizedStrings.
GemFireCache_DECLARATIVE_XML_FILE_0_IS_NOT_A_FILE.toLocalizedString(dir));
try {
getCache();
@@ -293,7 +294,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
public void testMalformed() {
setXmlFile(findFile("malformed.xml"));
- ExpectedException expectedException = DistributedTestCase.addExpectedException("While reading Cache XML file");
+ IgnoredException expectedException = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
getCache();
fail("Should have thrown a CacheXmlException");
@@ -311,7 +312,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
public void testBadInt() {
setXmlFile(findFile("badInt.xml"));
- ExpectedException expectedException = DistributedTestCase.addExpectedException("While reading Cache XML file");
+ IgnoredException expectedException = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
getCache();
fail("Should have thrown a CacheXmlException");
@@ -333,7 +334,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
public void testBadFloat() {
setXmlFile(findFile("badFloat.xml"));
- ExpectedException expectedException = DistributedTestCase.addExpectedException("While reading Cache XML file");
+ IgnoredException expectedException = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
getCache();
fail("Should have thrown a CacheXmlException");
@@ -352,7 +353,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
public void testBadScope() {
setXmlFile(findFile("badScope.xml"));
- ExpectedException expectedException = DistributedTestCase.addExpectedException("While reading Cache XML file");
+ IgnoredException expectedException = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
getCache();
fail("Should have thrown a CacheXmlException");
@@ -371,7 +372,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
public void testBadKeyConstraintClass() {
setXmlFile(findFile("badKeyConstraintClass.xml"));
- ExpectedException expectedException = DistributedTestCase.addExpectedException("While reading Cache XML file");
+ IgnoredException expectedException = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
getCache();
fail("Should have thrown a CacheXmlException");
@@ -390,7 +391,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
public void testCallbackNotDeclarable() {
setXmlFile(findFile("callbackNotDeclarable.xml"));
- ExpectedException expectedException = DistributedTestCase.addExpectedException("While reading Cache XML file");
+ IgnoredException expectedException = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
getCache();
fail("Should have thrown a CacheXmlException");
@@ -412,7 +413,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
public void testCallbackWithException() {
setXmlFile(findFile("callbackWithException.xml"));
- ExpectedException expectedException = DistributedTestCase.addExpectedException("While reading Cache XML file");
+ IgnoredException expectedException = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
getCache();
fail("Should have thrown a CacheXmlException");
@@ -434,7 +435,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
public void testLoaderNotLoader() {
setXmlFile(findFile("loaderNotLoader.xml"));
- ExpectedException expectedException = DistributedTestCase.addExpectedException("While reading Cache XML file");
+ IgnoredException expectedException = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
getCache();
fail("Should have thrown a CacheXmlException");
@@ -595,7 +596,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
assertTrue("No XML files in " + dirName, xmlFiles.length > 0);
for (int i = 0; i < xmlFiles.length; i++) {
File xmlFile = xmlFiles[i];
- getLogWriter().info("Parsing " + xmlFile);
+ LogWriterUtils.getLogWriter().info("Parsing " + xmlFile);
FileInputStream fis = new FileInputStream(xmlFile);
CacheXmlParser.parse(fis);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml41DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml41DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml41DUnitTest.java
index bc1f7e4..7fffce5 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml41DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml41DUnitTest.java
@@ -42,7 +42,8 @@ import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator;
import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
/**
* Tests the declarative caching functionality introduced in GemFire 4.1.
@@ -162,7 +163,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
{
setXmlFile(findFile("unknownNamedAttributes.xml"));
- ExpectedException expectedException = CacheTestCase.addExpectedException(LocalizedStrings.RegionAttributesCreation_CANNOT_REFERENCE_NONEXISTING_REGION_ATTRIBUTES_NAMED_0.toLocalizedString());
+ IgnoredException expectedException = IgnoredException.addIgnoredException(LocalizedStrings.RegionAttributesCreation_CANNOT_REFERENCE_NONEXISTING_REGION_ATTRIBUTES_NAMED_0.toLocalizedString());
try {
getCache();
fail("Should have thrown an IllegalStateException");
@@ -198,7 +199,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
setXmlFile(findFile("sameRootRegion.xml"));
- ExpectedException expectedException = DistributedTestCase.addExpectedException("While reading Cache XML file");
+ IgnoredException expectedException = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
getCache();
fail("Should have thrown a CacheXmlException");
@@ -209,7 +210,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
assertTrue(cause instanceof SAXException);
cause = ((SAXException)cause).getException();
if (!(cause instanceof RegionExistsException)) {
- fail("Expected a RegionExistsException, not a "
+ Assert.fail("Expected a RegionExistsException, not a "
+ cause.getClass().getName(), cause);
}
} finally {
@@ -242,7 +243,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
setXmlFile(findFile("sameSubregion.xml"));
- ExpectedException expectedException = DistributedTestCase.addExpectedException("While reading Cache XML file");
+ IgnoredException expectedException = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
getCache();
fail("Should have thrown a CacheXmlException");
@@ -253,7 +254,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
assertTrue(cause instanceof SAXException);
cause = ((SAXException)cause).getException();
if (!(cause instanceof RegionExistsException)) {
- fail("Expected a RegionExistsException, not a "
+ Assert.fail("Expected a RegionExistsException, not a "
+ cause.getClass().getName(), cause);
}
} finally {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml45DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml45DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml45DUnitTest.java
index 30284a4..19dc89f 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml45DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml45DUnitTest.java
@@ -169,7 +169,7 @@ public class CacheXml45DUnitTest extends CacheXml41DUnitTest {
} finally {
this.xmlProps = null;
try {
- tearDown2();
+ preTearDown();
} finally {
DistributedRegion.ignoreReconnect = false;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml57DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml57DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml57DUnitTest.java
index be78e26..f2eddd6 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml57DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml57DUnitTest.java
@@ -53,6 +53,8 @@ import com.gemstone.gemfire.internal.cache.xmlcache.Declarable2;
import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.RegionCreation;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -207,7 +209,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
attrs.setPoolName("mypool");
cache.createVMRegion("rootNORMAL", attrs);
- addExpectedException("Connection refused: connect");
+ IgnoredException.addIgnoredException("Connection refused: connect");
testXml(cache);
Cache c = getCache();
assertNotNull(c);
@@ -326,7 +328,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
attrs.setPoolName("mypool");
cache.createVMRegion("rootNORMAL", attrs);
- ExpectedException expectedException = CacheTestCase.addExpectedException(LocalizedStrings.AbstractRegion_THE_CONNECTION_POOL_0_HAS_NOT_BEEN_CREATED.toLocalizedString("mypool"));
+ IgnoredException expectedException = IgnoredException.addIgnoredException(LocalizedStrings.AbstractRegion_THE_CONNECTION_POOL_0_HAS_NOT_BEEN_CREATED.toLocalizedString("mypool"));
try {
testXml(cache);
fail("expected IllegalStateException");
@@ -344,7 +346,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
// now make sure declarative cache can't create the same pool
CacheCreation cache = new CacheCreation();
cache.createPoolFactory().addLocator(ALIAS2, 12345).create("mypool");
- ExpectedException expectedException = CacheTestCase.addExpectedException(LocalizedStrings.PoolManagerImpl_POOL_NAMED_0_ALREADY_EXISTS.toLocalizedString("mypool"));
+ IgnoredException expectedException = IgnoredException.addIgnoredException(LocalizedStrings.PoolManagerImpl_POOL_NAMED_0_ALREADY_EXISTS.toLocalizedString("mypool"));
try {
testXml(cache);
fail("expected IllegalStateException");
@@ -358,10 +360,10 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
}
public void testDynamicRegionFactoryConnectionPool() throws CacheException, IOException {
- addExpectedException("Connection reset");
- addExpectedException("SocketTimeoutException");
- addExpectedException("ServerConnectivityException");
- addExpectedException("Socket Closed");
+ IgnoredException.addIgnoredException("Connection reset");
+ IgnoredException.addIgnoredException("SocketTimeoutException");
+ IgnoredException.addIgnoredException("ServerConnectivityException");
+ IgnoredException.addIgnoredException("Socket Closed");
getSystem();
VM vm0 = Host.getHost(0).getVM(0);
final int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
@@ -378,7 +380,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
});
CacheCreation cache = new CacheCreation();
cache.createPoolFactory()
- .addServer(getServerHostName(vm0.getHost()), port)
+ .addServer(NetworkUtils.getServerHostName(vm0.getHost()), port)
.setSubscriptionEnabled(true)
.create("connectionPool");
cache.setDynamicRegionFactoryConfig(new DynamicRegionFactory.Config(null, "connectionPool", false, false));
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml60DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml60DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml60DUnitTest.java
index 3a20c07..39edee3 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml60DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml60DUnitTest.java
@@ -37,7 +37,7 @@ import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.ResourceManagerCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.SerializerCreation;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
/**
* Tests 6.0 cache.xml features.
@@ -192,7 +192,7 @@ public class CacheXml60DUnitTest extends CacheXml58DUnitTest
rmc.setEvictionHeapPercentage(high);
rmc.setCriticalHeapPercentage(low);
cache.setResourceManagerCreation(rmc);
- ExpectedException expectedException = CacheTestCase.addExpectedException(LocalizedStrings.MemoryMonitor_EVICTION_PERCENTAGE_LTE_CRITICAL_PERCENTAGE.toLocalizedString());
+ IgnoredException expectedException = IgnoredException.addIgnoredException(LocalizedStrings.MemoryMonitor_EVICTION_PERCENTAGE_LTE_CRITICAL_PERCENTAGE.toLocalizedString());
try {
testXml(cache);
assertTrue(false);
@@ -310,7 +310,7 @@ public class CacheXml60DUnitTest extends CacheXml58DUnitTest
closeCache();
cc.setSerializerCreation(sc);
- ExpectedException expectedException = DistributedTestCase.addExpectedException("While reading Cache XML file");
+ IgnoredException expectedException = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
testXml(cc);
fail("Instantiator should not have registered due to bad class.");
@@ -324,7 +324,7 @@ public class CacheXml60DUnitTest extends CacheXml58DUnitTest
closeCache();
cc.setSerializerCreation(sc);
- ExpectedException expectedException1 = DistributedTestCase.addExpectedException("While reading Cache XML file");
+ IgnoredException expectedException1 = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
testXml(cc);
fail("Serializer should not have registered due to bad class.");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml65DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml65DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml65DUnitTest.java
index e4d62f0..40718e1 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml65DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml65DUnitTest.java
@@ -60,6 +60,8 @@ import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.RegionCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.ResourceManagerCreation;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
/**
* Tests 6.5 cache.xml features.
@@ -247,7 +249,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
attrs.setPoolName("mypool");
attrs.setDataPolicy(DataPolicy.EMPTY); // required for multiuser mode
cache.createVMRegion("rootNORMAL", attrs);
- addExpectedException("Connection refused: connect");
+ IgnoredException.addIgnoredException("Connection refused: connect");
testXml(cache);
Cache c = getCache();
assertNotNull(c);
@@ -296,7 +298,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
} catch (IllegalStateException e) {
assertTrue(e.getMessage().contains(LocalizedStrings.DiskStore_IS_USED_IN_NONPERSISTENT_REGION.toLocalizedString()));
} catch (Exception ex) {
- fail("Unexpected exception", ex);
+ Assert.fail("Unexpected exception", ex);
}
EvictionAttributes ea = EvictionAttributes.createLRUEntryAttributes(1000, EvictionAction.OVERFLOW_TO_DISK);
@@ -304,9 +306,9 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
try {
root = (RegionCreation)cache.createRegion("root", attrs);
} catch (IllegalStateException e) {
- fail("With eviction of overflow to disk, region can specify disk store name", e);
+ Assert.fail("With eviction of overflow to disk, region can specify disk store name", e);
} catch (Exception ex) {
- fail("Unexpected exception", ex);
+ Assert.fail("Unexpected exception", ex);
}
File dir = new File("testDiskStoreValidation");
@@ -323,7 +325,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertTrue(e.getMessage().contains(LocalizedStrings.DiskStore_Deprecated_API_0_Cannot_Mix_With_DiskStore_1
.toLocalizedString(new Object[] {"setDiskDirs or setDiskWriteAttributes", getUniqueName()})));
} catch (Exception ex) {
- fail("Unexpected exception", ex);
+ Assert.fail("Unexpected exception", ex);
}
try {
@@ -335,7 +337,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertTrue(e.getMessage().contains(LocalizedStrings.DiskStore_Deprecated_API_0_Cannot_Mix_With_DiskStore_1
.toLocalizedString(new Object[] {"setDiskDirs", getUniqueName()})));
} catch (Exception ex) {
- fail("Unexpected exception", ex);
+ Assert.fail("Unexpected exception", ex);
}
testXml(cache);
@@ -369,7 +371,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
try {
root = (RegionCreation)cache.createRegion("root", ra);
} catch (Exception ex) {
- fail("Unexpected exception", ex);
+ Assert.fail("Unexpected exception", ex);
}
factory = new AttributesFactory();
@@ -383,7 +385,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
try {
root2 = (RegionCreation)cache.createRegion("root2", ra);
} catch (Exception ex) {
- fail("Unexpected exception", ex);
+ Assert.fail("Unexpected exception", ex);
}
factory = new AttributesFactory();
@@ -397,7 +399,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
try {
root3 = (RegionCreation)cache.createRegion("root3", ra);
} catch (Exception ex) {
- fail("Unexpected exception", ex);
+ Assert.fail("Unexpected exception", ex);
}
testXml(cache);
@@ -418,7 +420,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
try {
root = (RegionCreation)cache.createRegion("root", ra);
} catch (Exception ex) {
- fail("Unexpected exception", ex);
+ Assert.fail("Unexpected exception", ex);
}
testXml(cache);
@@ -481,7 +483,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
LocalizedStrings.DiskStore_Deprecated_API_0_Cannot_Mix_With_DiskStore_1
.toLocalizedString(new Object[] {"setOverflowDirectory", getUniqueName()})));
} catch (Exception ex) {
- fail("Unexpected exception", ex);
+ Assert.fail("Unexpected exception", ex);
}
cache.getLogger().config(
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml66DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml66DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml66DUnitTest.java
index ce07ecb..63a9202 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml66DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml66DUnitTest.java
@@ -41,6 +41,8 @@ import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
import com.gemstone.gemfire.internal.cache.xmlcache.ClientCacheCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
/**
* Tests 7.0 cache.xml feature : Fixed Partitioning.
@@ -157,7 +159,7 @@ public class CacheXml66DUnitTest extends CacheXml65DUnitTest{
catch (Exception illegal) {
if (!((illegal instanceof IllegalStateException) && (illegal.getMessage()
.contains("can not be specified in PartitionAttributesFactory")))) {
- fail("Expected IllegalStateException ", illegal);
+ Assert.fail("Expected IllegalStateException ", illegal);
}
RegionAttributesCreation attrs = new RegionAttributesCreation();
@@ -353,7 +355,7 @@ public class CacheXml66DUnitTest extends CacheXml65DUnitTest{
CacheTransactionManagerCreation txMgrCreation = new CacheTransactionManagerCreation();
txMgrCreation.setWriter(new TestTransactionWriter());
cc.addCacheTransactionManagerCreation(txMgrCreation);
- ExpectedException expectedException = addExpectedException(LocalizedStrings.TXManager_NO_WRITER_ON_CLIENT.toLocalizedString());
+ IgnoredException expectedException = IgnoredException.addIgnoredException(LocalizedStrings.TXManager_NO_WRITER_ON_CLIENT.toLocalizedString());
try {
testXml(cc);
fail("expected exception not thrown");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml80DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml80DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml80DUnitTest.java
index 27d7bf2..98134ce 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml80DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml80DUnitTest.java
@@ -47,6 +47,7 @@ import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator;
import com.gemstone.gemfire.internal.cache.xmlcache.DiskStoreAttributesCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
+import com.gemstone.gemfire.test.dunit.Assert;
/**
* @author dsmith
@@ -121,7 +122,7 @@ public class CacheXml80DUnitTest extends CacheXml70DUnitTest {
pw.close();
}
catch (IOException ex) {
- fail("IOException during cache.xml generation to " + file, ex);
+ Assert.fail("IOException during cache.xml generation to " + file, ex);
}
// Get index info before closing cache.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml81DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml81DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml81DUnitTest.java
index c94505f..0a41b10 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml81DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml81DUnitTest.java
@@ -31,7 +31,7 @@ import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.XmlParser;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
/**
* Tests 8.1 schema based configuration. From this point all config test cases
@@ -140,7 +140,7 @@ public class CacheXml81DUnitTest extends CacheXml80DUnitTest {
assertEquals(0, extension.onCreateCounter.get());
assertEquals(0, extension.getXmlGeneratorCounter.get());
- ExpectedException expectedException = DistributedTestCase.addExpectedException("While reading Cache XML file");
+ IgnoredException expectedException = IgnoredException.addIgnoredException("While reading Cache XML file");
try {
testXml(cache);
fail("Excepted CacheXmlException");