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:49 UTC
[25/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/partitioned/fixed/FixedPartitioningTestBase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java
index f48ab61..95ea49f 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningTestBase.java
@@ -73,8 +73,10 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientProxy;
import com.gemstone.gemfire.internal.cache.tier.sockets.Message;
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.test.dunit.DistributedTestCase.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* This is the base class to do operations
@@ -154,7 +156,7 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
assertNotNull(cache);
}
catch (Exception e) {
- fail("Failed while creating the cache", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Failed while creating the cache", e);
}
}
@@ -195,7 +197,7 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
try {
RebalanceResults result = operation.getResults();
} catch (InterruptedException e) {
- fail("Not expecting exception", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Not expecting exception", e);
}
}
@@ -342,7 +344,7 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
assertEquals(customer, region_Cust.get(custid));
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"getForColocation : failed while doing get operation in CustomerPartitionedRegion ",
e);
}
@@ -457,11 +459,11 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
partitionedregion.put(custid, customer);
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"putCustomerPartitionedRegion : failed while doing put operation in CustomerPartitionedRegion ",
e);
}
- getLogWriter().info("Customer :- { " + custid + " : " + customer + " }");
+ LogWriterUtils.getLogWriter().info("Customer :- { " + custid + " : " + customer + " }");
}
}
@@ -481,11 +483,11 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
partitionedregion.put(orderId, order);
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"putOrderPartitionedRegion : failed while doing put operation in OrderPartitionedRegion ",
e);
}
- getLogWriter().info("Order :- { " + orderId + " : " + order + " }");
+ LogWriterUtils.getLogWriter().info("Order :- { " + orderId + " : " + order + " }");
}
}
}
@@ -508,11 +510,11 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
partitionedregion.put(shipmentId, shipment);
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"putShipmentPartitionedRegion : failed while doing put operation in ShipmentPartitionedRegion ",
e);
}
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Shipment :- { " + shipmentId + " : " + shipment + " }");
}
}
@@ -532,11 +534,11 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
partitionedregion.put(custid, customer);
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"putCustomerPartitionedRegion : failed while doing put operation in CustomerPartitionedRegion ",
e);
}
- getLogWriter().info("Customer :- { " + custid + " : " + customer + " }");
+ LogWriterUtils.getLogWriter().info("Customer :- { " + custid + " : " + customer + " }");
}
}
@@ -556,11 +558,11 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
partitionedregion.put(orderId, order);
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"putOrderPartitionedRegion : failed while doing put operation in OrderPartitionedRegion ",
e);
}
- getLogWriter().info("Order :- { " + orderId + " : " + order + " }");
+ LogWriterUtils.getLogWriter().info("Order :- { " + orderId + " : " + order + " }");
}
}
}
@@ -583,11 +585,11 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
partitionedregion.put(shipmentId, shipment);
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"putShipmentPartitionedRegion : failed while doing put operation in ShipmentPartitionedRegion ",
e);
}
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Shipment :- { " + shipmentId + " : " + shipment + " }");
}
}
@@ -608,11 +610,11 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
partitionedregion.put(custid, customer);
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"putCustomerPartitionedRegion : failed while doing put operation in CustomerPartitionedRegion ",
e);
}
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info("Customer :- { " + custid + " : " + customer + " }");
}
}
@@ -635,11 +637,11 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
partitionedregion.put(orderId, order);
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"putOrderPartitionedRegion : failed while doing put operation in OrderPartitionedRegion ",
e);
}
- getLogWriter().info("Order :- { " + orderId + " : " + order + " }");
+ LogWriterUtils.getLogWriter().info("Order :- { " + orderId + " : " + order + " }");
}
}
}
@@ -664,11 +666,11 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
partitionedregion.put(shipmentId, shipment);
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"putShipmentPartitionedRegion : failed while doing put operation in ShipmentPartitionedRegion ",
e);
}
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Shipment :- { " + shipmentId + " : " + shipment + " }");
}
}
@@ -690,11 +692,11 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
partitionedregion.put(custid, customer);
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"putCustomerPartitionedRegion : failed while doing put operation in CustomerPartitionedRegion ",
e);
}
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info("Customer :- { " + custid + " : " + customer + " }");
}
}
@@ -717,11 +719,11 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
partitionedregion.put(orderId, order);
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"putOrderPartitionedRegion : failed while doing put operation in OrderPartitionedRegion ",
e);
}
- getLogWriter().info("Order :- { " + orderId + " : " + order + " }");
+ LogWriterUtils.getLogWriter().info("Order :- { " + orderId + " : " + order + " }");
}
}
}
@@ -746,11 +748,11 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
partitionedregion.put(shipmentId, shipment);
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"putShipmentPartitionedRegion : failed while doing put operation in ShipmentPartitionedRegion ",
e);
}
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Shipment :- { " + shipmentId + " : " + shipment + " }");
}
}
@@ -800,7 +802,7 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
}
}
catch (ParseException e) {
- FixedPartitioningTestBase.fail("Exception Occured while parseing date", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Exception Occured while parseing date", e);
}
return null;
}
@@ -822,7 +824,7 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
.getRegion(Region.SEPARATOR + shipmentPartitionedRegionName);
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"validateAfterPutPartitionedRegion : failed while getting the region",
e);
}
@@ -851,7 +853,7 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
// assertNotNull(orderPartitionedregion.get(orderId));
if (custId.equals(orderId.getCustId())) {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
orderId + "belongs to node " + idmForCustomer + " "
+ idmForOrder);
assertEquals(idmForCustomer, idmForOrder);
@@ -863,7 +865,7 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
ShipmentId shipmentId = (ShipmentId)shipmentIterator.next();
// assertNotNull(shipmentPartitionedregion.get(shipmentId));
if (orderId.equals(shipmentId.getOrderId())) {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
shipmentId + "belongs to node " + idmForOrder + " "
+ idmForShipment);
}
@@ -1087,15 +1089,15 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
Integer primaryBuckets) {
HashMap localBucket2RegionMap = (HashMap)region_FPR.getDataStore()
.getSizeLocally();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Size of the " + region_FPR + " in this VM :- "
+ localBucket2RegionMap.size() + "List of buckets : "
+ localBucket2RegionMap.keySet());
assertEquals(numBuckets.intValue(), localBucket2RegionMap.size());
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Size of primary buckets the " + region_FPR + " in this VM :- "
+ region_FPR.getDataStore().getNumberOfPrimaryBucketsManaged());
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Lit of Primaries in this VM :- "
+ region_FPR.getDataStore().getAllLocalPrimaryBucketIds());
@@ -1107,15 +1109,15 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
Integer numBuckets, Integer primaryBuckets) {
HashMap localBucket2RegionMap = (HashMap)region_FPR.getDataStore()
.getSizeLocally();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Size of the " + region_FPR + " in this VM :- "
+ localBucket2RegionMap.size() + "List of buckets : "
+ localBucket2RegionMap.keySet());
assertEquals(numBuckets.intValue(), localBucket2RegionMap.size());
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Size of primary buckets the " + region_FPR + " in this VM :- "
+ region_FPR.getDataStore().getNumberOfPrimaryBucketsManaged());
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Lit of Primaries in this VM :- "
+ region_FPR.getDataStore().getAllLocalPrimaryBucketIds());
@@ -1131,7 +1133,7 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
.getRegion(Region.SEPARATOR + customerPartitionedRegionName);
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"validateAfterPutPartitionedRegion : failed while getting the region",
e);
}
@@ -1159,7 +1161,7 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
.getRegion(Region.SEPARATOR + shipmentPartitionedRegionName);
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"validateAfterPutPartitionedRegion : failed while getting the region",
e);
}
@@ -1210,7 +1212,7 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
.getRegion(Region.SEPARATOR + shipmentPartitionedRegionName);
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"validateAfterPutPartitionedRegion : failed while getting the region",
e);
}
@@ -1304,8 +1306,8 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 20000, 500, false);
- getLogWriter().info("end of beforeCalculatingStartingBucketId");
+ Wait.waitForCriterion(wc, 20000, 500, false);
+ LogWriterUtils.getLogWriter().info("end of beforeCalculatingStartingBucketId");
}
});
}
@@ -1315,7 +1317,8 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
PartitionedRegion.BEFORE_CALCULATE_STARTING_BUCKET_FLAG = false;
}
- public void tearDown2() throws Exception {
+ @Override
+ protected final void preTearDown() throws Exception {
try {
closeCache();
member1.invoke(FixedPartitioningTestBase.class, "closeCache");
@@ -1334,7 +1337,6 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
vm.invoke(FixedPartitioningTestBase.class, "remoteTearDown");
}
}
- super.tearDown2();
}
}
@@ -1362,7 +1364,7 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
throw e;
}
catch (Throwable t) {
- getLogWriter().error(t);
+ LogWriterUtils.getLogWriter().error(t);
}
}
}
@@ -1376,7 +1378,7 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
throw e;
}
catch (Throwable t) {
- getLogWriter().error("Error in closing the cache ", t);
+ LogWriterUtils.getLogWriter().error("Error in closing the cache ", t);
}
}
@@ -1384,7 +1386,7 @@ public class FixedPartitioningTestBase extends DistributedTestCase {
try {
cleanDiskDirs();
} catch(IOException 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/internal/cache/partitioned/fixed/FixedPartitioningWithColocationAndPersistenceDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningWithColocationAndPersistenceDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningWithColocationAndPersistenceDUnitTest.java
index 8f2dceb..8a06f7e 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningWithColocationAndPersistenceDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/fixed/FixedPartitioningWithColocationAndPersistenceDUnitTest.java
@@ -20,8 +20,10 @@ import java.util.ArrayList;
import java.util.List;
import com.gemstone.gemfire.cache.FixedPartitionAttributes;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.Wait;
public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
FixedPartitioningTestBase {
@@ -42,10 +44,6 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
}
- public void tearDown2() throws Exception {
- super.tearDown2();
- }
-
/**
* This tests validates that in colocation of FPRs child region cannot specify
* FixedPartitionAttributes
@@ -75,7 +73,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
if (!((illegal.getCause() instanceof IllegalStateException) && (illegal
.getCause().getMessage()
.contains("not be specified in PartitionAttributesFactory if colocated-with is specified")))) {
- fail("Expected IllegalStateException ", illegal);
+ Assert.fail("Expected IllegalStateException ", illegal);
}
}
}
@@ -232,7 +230,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
}
catch (Exception e) {
- fail("Unexpected Exception ", e);
+ Assert.fail("Unexpected Exception ", e);
}
}
@@ -373,7 +371,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
}
catch (Exception e) {
- fail("Unexpected Exception ", e);
+ Assert.fail("Unexpected Exception ", e);
}
}
@@ -491,7 +489,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
"Customer", "Order", "Shipment" });
member3.invoke(FixedPartitioningTestBase.class, "closeCache");
- pause(4000);
+ Wait.pause(4000);
member1.invoke(FixedPartitioningTestBase.class,
"checkPrimaryBucketsForColocationAfterCacheClosed", new Object[] {
@@ -521,7 +519,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
false });
- pause(4000);
+ Wait.pause(4000);
member1.invoke(FixedPartitioningTestBase.class,
"validateAfterPutPartitionedRegion", new Object[] { "Customer",
@@ -552,7 +550,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
false });
- pause(4000);
+ Wait.pause(4000);
member1.invoke(FixedPartitioningTestBase.class,
"validateAfterPutPartitionedRegion", new Object[] { "Customer",
@@ -573,7 +571,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
}
catch (Exception e) {
- fail("Unexpected Exception ", e);
+ Assert.fail("Unexpected Exception ", e);
}
}
@@ -686,7 +684,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
"Customer", "Order", "Shipment" });
member3.invoke(FixedPartitioningTestBase.class, "closeCache");
- pause(4000);
+ Wait.pause(4000);
member1.invoke(FixedPartitioningTestBase.class,
"checkPrimaryBucketsForColocationAfterCacheClosed", new Object[] {
@@ -716,7 +714,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
false });
- pause(4000);
+ Wait.pause(4000);
member1.invoke(FixedPartitioningTestBase.class,
"validateAfterPutPartitionedRegion", new Object[] { "Customer",
@@ -747,7 +745,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
null, 2, 50, 20, new CustomerFixedPartitionResolver(), "Order",
false });
- pause(4000);
+ Wait.pause(4000);
member1.invoke(FixedPartitioningTestBase.class,
"validateAfterPutPartitionedRegion", new Object[] { "Customer",
@@ -768,7 +766,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
}
catch (Exception e) {
- fail("Unexpected Exception ", e);
+ Assert.fail("Unexpected Exception ", e);
}
}
@@ -801,7 +799,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
member2.invoke(FixedPartitioningTestBase.class, "closeCache");
- pause(1000);
+ Wait.pause(1000);
member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
fpa1 = FixedPartitionAttributes.createFixedPartition(Quarter2, true, 3);
@@ -909,14 +907,14 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
"createRegionWithPartitionAttributes", new Object[] { "Quarter",
fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true });
- pause(4000);
+ Wait.pause(4000);
member2.invoke(FixedPartitioningTestBase.class, "getForQuarter",
new Object[] { "Quarter", Quarter1 });
member2.invoke(FixedPartitioningTestBase.class, "getForQuarter",
new Object[] { "Quarter", Quarter2 });
member2.invoke(FixedPartitioningTestBase.class,
"checkPrimaryDataPersistence", new Object[] { Quarter2 });
- pause(2000);
+ Wait.pause(2000);
member2.invoke(FixedPartitioningTestBase.class,
"checkPrimaryBucketsForQuarter", new Object[] { 6, 6 });
@@ -930,7 +928,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
"createRegionWithPartitionAttributes", new Object[] { "Quarter",
fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true });
- pause(4000);
+ Wait.pause(4000);
member1.invoke(FixedPartitioningTestBase.class,
"checkPrimaryDataPersistence", new Object[] { Quarter1 });
@@ -1064,7 +1062,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
null, 1, 50, 20, new CustomerFixedPartitionResolver(), "Order",
false });
- pause(4000);
+ Wait.pause(4000);
member1.invoke(FixedPartitioningTestBase.class,
"checkPrimaryBucketsForColocation", new Object[] { 10, 5, "Customer",
"Order", "Shipment" });
@@ -1080,7 +1078,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
}
catch (Exception e) {
- fail("Unexpected Exception ", e);
+ Assert.fail("Unexpected Exception ", e);
}
}
@@ -1178,13 +1176,13 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
fpaList, 1, 50, 20, new CustomerFixedPartitionResolver(), null,
true });
- pause(4000);
+ Wait.pause(4000);
member2.invoke(FixedPartitioningTestBase.class, "getForColocation",
new Object[] { "Customer", "Order", "Shipment" });
}
catch (Exception e) {
- fail("Unexpected Exception ", e);
+ Assert.fail("Unexpected Exception ", e);
}
}
@@ -1247,7 +1245,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
"createRegionWithPartitionAttributes", new Object[] { "Quarter",
fpaList, 0, 40, 12, new QuarterPartitionResolver(), null, true });
- pause(4000);
+ Wait.pause(4000);
member2.invoke(FixedPartitioningTestBase.class,
"checkPrimarySecondaryData", new Object[] { Quarter3, false });
@@ -1374,7 +1372,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
"createRegionWithPartitionAttributes", new Object[] { "Quarter",
fpaList, 1, 40, 12, new QuarterPartitionResolver(), null, true });
- pause(4000);
+ Wait.pause(4000);
member4.invoke(FixedPartitioningTestBase.class,
"checkPrimarySecondaryData", new Object[] { Quarter4, false });
@@ -1424,7 +1422,7 @@ public class FixedPartitioningWithColocationAndPersistenceDUnitTest extends
member1.invoke(FixedPartitioningTestBase.class, "closeCache");
member2.invoke(FixedPartitioningTestBase.class, "closeCache");
- pause(1000);
+ Wait.pause(1000);
member2.invoke(FixedPartitioningTestBase.class, "createCacheOnMember");
member2.invoke(FixedPartitioningTestBase.class,
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRVVRecoveryDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRVVRecoveryDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRVVRecoveryDUnitTest.java
index ed0b6dc..ecaa1ba 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRVVRecoveryDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRVVRecoveryDUnitTest.java
@@ -66,10 +66,15 @@ import com.gemstone.gemfire.internal.cache.TombstoneService;
import com.gemstone.gemfire.internal.cache.versions.RegionVersionVector;
import com.gemstone.gemfire.internal.cache.versions.VersionTag;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase {
@@ -80,9 +85,8 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase
}
@Override
- public void tearDown2() throws Exception {
- super.tearDown2();
- invokeInEveryVM(PersistentRecoveryOrderDUnitTest.class, "resetAckWaitThreshold");
+ protected final void postTearDownPersistentReplicatedTestBase() throws Exception {
+ Invoke.invokeInEveryVM(PersistentRecoveryOrderDUnitTest.class, "resetAckWaitThreshold");
}
public void testNoConcurrencyChecks () {
@@ -215,7 +219,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase
}
});
- ExpectedException ex = addExpectedException("DiskAccessException");
+ IgnoredException ex = IgnoredException.addIgnoredException("DiskAccessException");
try {
//Force expiration, with our test hook that should close the cache
tombstoneService = cache.getTombstoneService();
@@ -285,7 +289,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase
// We should wait for timeout time so that tomstones are expired
// right away when they are gIId based on their original timestamp.
- pause((int) TEST_REPLICATED_TOMBSTONE_TIMEOUT);
+ Wait.pause((int) TEST_REPLICATED_TOMBSTONE_TIMEOUT);
TombstoneService.REPLICATED_TOMBSTONE_TIMEOUT = TEST_REPLICATED_TOMBSTONE_TIMEOUT;
TombstoneService.EXPIRED_TOMBSTONE_LIMIT = entryCount;
@@ -295,7 +299,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase
assertEquals(entryCount, getTombstoneCount(region));
getCache().getLogger().fine("Waiting for maximumSleepTime ms");
- pause(10000); // maximumSleepTime+500 in TombstoneSweeper GC thread
+ Wait.pause(10000); // maximumSleepTime+500 in TombstoneSweeper GC thread
// Tombstones should have been expired and garbage collected by now by
// TombstoneService.
@@ -390,7 +394,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase
Cache cache = getCache();
Region region = cache.getRegion("prRegion");
while (!region.get("testKey").equals("testValue2")) {
- pause(100);
+ Wait.pause(100);
}
region.destroy("testKey");
}
@@ -411,7 +415,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase
Region.Entry entry = ((PartitionedRegion)region).getEntry("testKey", true /*Entry is destroyed*/);
RegionEntry re = ((EntrySnapshot)entry).getRegionEntry();
- getLogWriter().fine("RegionEntry for testKey: " + re.getKey() + " " + re.getValueInVM((LocalRegion) region));
+ LogWriterUtils.getLogWriter().fine("RegionEntry for testKey: " + re.getKey() + " " + re.getValueInVM((LocalRegion) region));
assertTrue(re.getValueInVM((LocalRegion) region) instanceof Tombstone);
VersionTag tag = re.getVersionStamp().asVersionTag();
@@ -751,7 +755,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase
//and then do the wait in the flusher thread.
//Setup the callbacks to wait for krf creation and throw an exception
- ExpectedException ex = addExpectedException("DiskAccessException");
+ IgnoredException ex = IgnoredException.addIgnoredException("DiskAccessException");
LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER=true;
try {
final CountDownLatch krfCreated = new CountDownLatch(1);
@@ -808,7 +812,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase
//Wait for the region to be destroyed. The region won't be destroyed
//until the async flusher thread ends up switching oplogs
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
@Override
public boolean done() {
@@ -835,7 +839,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase
for(int i = 0; i < 3; i++) {
NonTXEntry entry = (NonTXEntry) recoveredRegion.getEntry("key" + i);
tagsFromKrf[i] = entry.getRegionEntry().getVersionStamp().asVersionTag();
- getLogWriter().info("krfTag[" + i + "]="+ tagsFromKrf[i] + ",value=" + entry.getValue());
+ LogWriterUtils.getLogWriter().info("krfTag[" + i + "]="+ tagsFromKrf[i] + ",value=" + entry.getValue());
}
closeCache();
@@ -850,7 +854,7 @@ public class PersistentRVVRecoveryDUnitTest extends PersistentReplicatedTestBase
for(int i = 0; i < 3; i++) {
NonTXEntry entry = (NonTXEntry) recoveredRegion.getEntry("key" + i);
tagsFromCrf[i] = entry.getRegionEntry().getVersionStamp().asVersionTag();
- getLogWriter().info("crfTag[" + i + "]="+ tagsFromCrf[i] + ",value=" + entry.getValue());
+ LogWriterUtils.getLogWriter().info("crfTag[" + i + "]="+ tagsFromCrf[i] + ",value=" + entry.getValue());
}
//Make sure the version tags from the krf and the crf match.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java
index cd6118a..f20762c 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java
@@ -70,11 +70,16 @@ import com.gemstone.gemfire.internal.cache.LocalRegion;
import com.gemstone.gemfire.internal.cache.TXManagerImpl;
import com.gemstone.gemfire.internal.cache.versions.RegionVersionHolder;
import com.gemstone.gemfire.internal.cache.versions.RegionVersionVector;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+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;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* This is a test of how persistent distributed
@@ -106,31 +111,31 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
- getLogWriter().info("Creating region in VM0");
+ LogWriterUtils.getLogWriter().info("Creating region in VM0");
createPersistentRegion(vm0);
- getLogWriter().info("Creating region in VM1");
+ LogWriterUtils.getLogWriter().info("Creating region in VM1");
createPersistentRegion(vm1);
putAnEntry(vm0);
- getLogWriter().info("closing region in vm0");
+ LogWriterUtils.getLogWriter().info("closing region in vm0");
closeRegion(vm0);
updateTheEntry(vm1);
- getLogWriter().info("closing region in vm1");
+ LogWriterUtils.getLogWriter().info("closing region in vm1");
closeRegion(vm1);
//This ought to wait for VM1 to come back
- getLogWriter().info("Creating region in VM0");
+ LogWriterUtils.getLogWriter().info("Creating region in VM0");
AsyncInvocation future = createPersistentRegionAsync(vm0);
waitForBlockedInitialization(vm0);
assertTrue(future.isAlive());
- getLogWriter().info("Creating region in VM1");
+ LogWriterUtils.getLogWriter().info("Creating region in VM1");
createPersistentRegion(vm1);
future.join(MAX_WAIT);
@@ -159,9 +164,9 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
- getLogWriter().info("Creating region in VM0");
+ LogWriterUtils.getLogWriter().info("Creating region in VM0");
createPersistentRegion(vm0);
- getLogWriter().info("Creating region in VM1");
+ LogWriterUtils.getLogWriter().info("Creating region in VM1");
createPersistentRegion(vm1);
putAnEntry(vm0);
@@ -176,17 +181,17 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
}
});
- getLogWriter().info("closing region in vm0");
+ LogWriterUtils.getLogWriter().info("closing region in vm0");
closeRegion(vm0);
updateTheEntry(vm1);
- getLogWriter().info("closing region in vm1");
+ LogWriterUtils.getLogWriter().info("closing region in vm1");
closeCache(vm1);
//This ought to wait for VM1 to come back
- getLogWriter().info("Creating region in VM0");
+ LogWriterUtils.getLogWriter().info("Creating region in VM0");
AsyncInvocation future = createPersistentRegionAsync(vm0);
waitForBlockedInitialization(vm0);
@@ -204,7 +209,7 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
adminDS = AdminDistributedSystemFactory.getDistributedSystem(config);
adminDS.connect();
Set<PersistentID> missingIds = adminDS.getMissingPersistentMembers();
- getLogWriter().info("waiting members=" + missingIds);
+ LogWriterUtils.getLogWriter().info("waiting members=" + missingIds);
assertEquals(1, missingIds.size());
PersistentID missingMember = missingIds.iterator().next();
adminDS.revokePersistentMember(
@@ -247,8 +252,8 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
//Now, we should not be able to create a region
//in vm1, because the this member was revoked
- getLogWriter().info("Creating region in VM1");
- ExpectedException e = addExpectedException(RevokedPersistentDataException.class.getSimpleName(), vm1);
+ LogWriterUtils.getLogWriter().info("Creating region in VM1");
+ IgnoredException e = IgnoredException.addIgnoredException(RevokedPersistentDataException.class.getSimpleName(), vm1);
try {
createPersistentRegion(vm1);
fail("We should have received a split distributed system exception");
@@ -294,9 +299,9 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
- getLogWriter().info("Creating region in VM0");
+ LogWriterUtils.getLogWriter().info("Creating region in VM0");
createPersistentRegion(vm0);
- getLogWriter().info("Creating region in VM1");
+ LogWriterUtils.getLogWriter().info("Creating region in VM1");
createPersistentRegion(vm1);
putAnEntry(vm0);
@@ -311,12 +316,12 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
}
});
- getLogWriter().info("closing region in vm0");
+ LogWriterUtils.getLogWriter().info("closing region in vm0");
closeRegion(vm0);
updateTheEntry(vm1);
- getLogWriter().info("closing region in vm1");
+ LogWriterUtils.getLogWriter().info("closing region in vm1");
closeRegion(vm1);
final File dirToRevoke = getDiskDirForVM(vm1);
@@ -332,7 +337,7 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
adminDS.connect();
adminDS.revokePersistentMember(InetAddress.getLocalHost(), dirToRevoke.getCanonicalPath());
} catch(Exception e) {
- fail("Unexpected exception", e);
+ Assert.fail("Unexpected exception", e);
} finally {
if(adminDS != null) {
adminDS.disconnect();
@@ -342,7 +347,7 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
});
//This shouldn't wait, because we revoked the member
- getLogWriter().info("Creating region in VM0");
+ LogWriterUtils.getLogWriter().info("Creating region in VM0");
createPersistentRegion(vm0);
checkForRecoveryStat(vm0, true);
@@ -361,8 +366,8 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
//Now, we should not be able to create a region
//in vm1, because the this member was revoked
- getLogWriter().info("Creating region in VM1");
- ExpectedException e = addExpectedException(RevokedPersistentDataException.class.getSimpleName(), vm1);
+ LogWriterUtils.getLogWriter().info("Creating region in VM1");
+ IgnoredException e = IgnoredException.addIgnoredException(RevokedPersistentDataException.class.getSimpleName(), vm1);
try {
createPersistentRegion(vm1);
fail("We should have received a split distributed system exception");
@@ -387,9 +392,9 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
- getLogWriter().info("Creating region in VM0");
+ LogWriterUtils.getLogWriter().info("Creating region in VM0");
createPersistentRegion(vm0);
- getLogWriter().info("Creating region in VM1");
+ LogWriterUtils.getLogWriter().info("Creating region in VM1");
createPersistentRegion(vm1);
createPersistentRegion(vm2);
@@ -405,28 +410,28 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
}
});
- getLogWriter().info("closing region in vm0");
+ LogWriterUtils.getLogWriter().info("closing region in vm0");
closeRegion(vm0);
updateTheEntry(vm1);
- getLogWriter().info("closing region in vm1");
+ LogWriterUtils.getLogWriter().info("closing region in vm1");
closeRegion(vm1);
updateTheEntry(vm2, "D");
- getLogWriter().info("closing region in vm2");
+ LogWriterUtils.getLogWriter().info("closing region in vm2");
closeRegion(vm2);
//These ought to wait for VM2 to come back
- getLogWriter().info("Creating region in VM0");
+ LogWriterUtils.getLogWriter().info("Creating region in VM0");
AsyncInvocation future0 = createPersistentRegionAsync(vm0);
waitForBlockedInitialization(vm0);
assertTrue(future0.isAlive());
- getLogWriter().info("Creating region in VM1");
+ LogWriterUtils.getLogWriter().info("Creating region in VM1");
final AsyncInvocation future1 = createPersistentRegionAsync(vm1);
waitForBlockedInitialization(vm1);
assertTrue(future1.isAlive());
@@ -442,7 +447,7 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
adminDS = AdminDistributedSystemFactory.getDistributedSystem(config);
adminDS.connect();
Set<PersistentID> missingIds = adminDS.getMissingPersistentMembers();
- getLogWriter().info("waiting members=" + missingIds);
+ LogWriterUtils.getLogWriter().info("waiting members=" + missingIds);
assertEquals(1, missingIds.size());
} catch (AdminException e) {
throw new RuntimeException(e);
@@ -461,7 +466,7 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
}
});
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public boolean done() {
return !future1.isAlive();
@@ -484,7 +489,7 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
adminDS = AdminDistributedSystemFactory.getDistributedSystem(config);
adminDS.connect();
final AdminDistributedSystem connectedDS = adminDS;
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public String description() {
return "Waiting for waiting members to have 2 members";
@@ -577,12 +582,12 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
restoreBackup(vm1);
//This ought to wait for VM1 to come back
- getLogWriter().info("Creating region in VM0");
+ LogWriterUtils.getLogWriter().info("Creating region in VM0");
AsyncInvocation future = createPersistentRegionAsync(vm0);
waitForBlockedInitialization(vm0);
assertTrue(future.isAlive());
- getLogWriter().info("Creating region in VM1");
+ LogWriterUtils.getLogWriter().info("Creating region in VM1");
createPersistentRegion(vm1);
future.join(MAX_WAIT);
@@ -1045,7 +1050,7 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
//so it will start up.
createPersistentRegion(vm0);
- ExpectedException e = addExpectedException(ConflictingPersistentDataException.class.getSimpleName(), vm1);
+ IgnoredException e = IgnoredException.addIgnoredException(ConflictingPersistentDataException.class.getSimpleName(), vm1);
try {
//VM1 should not start up, because we should detect that vm1
//was never in the same distributed system as vm0
@@ -1072,24 +1077,24 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
- getLogWriter().info("Creating region in VM0");
+ LogWriterUtils.getLogWriter().info("Creating region in VM0");
createPersistentRegion(vm0);
- getLogWriter().info("Creating region in VM1");
+ LogWriterUtils.getLogWriter().info("Creating region in VM1");
createPersistentRegion(vm1);
putAnEntry(vm0);
- getLogWriter().info("closing region in vm0");
+ LogWriterUtils.getLogWriter().info("closing region in vm0");
closeRegion(vm0);
updateTheEntry(vm1);
- getLogWriter().info("closing region in vm1");
+ LogWriterUtils.getLogWriter().info("closing region in vm1");
closeRegion(vm1);
//This ought to wait for VM1 to come back
- getLogWriter().info("Creating region in VM0");
+ LogWriterUtils.getLogWriter().info("Creating region in VM0");
AsyncInvocation future = createPersistentRegionAsync(vm0);
waitForBlockedInitialization(vm0);
@@ -1175,7 +1180,7 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
final VM vm1 = host.getVM(1);
final VM vm2 = host.getVM(2);
- getLogWriter().info("Creating region in VM0");
+ LogWriterUtils.getLogWriter().info("Creating region in VM0");
createPersistentRegion(vm0);
//Add a hook which will disconnect from the distributed
@@ -1240,7 +1245,7 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
public void run() {
final Cache cache = getCache();
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public String description() {
return "Waiting for creation of region " + REGION_NAME;
@@ -1341,7 +1346,7 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
createNonPersistentRegion(vm0);
- ExpectedException e = addExpectedException(IllegalStateException.class.getSimpleName(), vm1);
+ IgnoredException e = IgnoredException.addIgnoredException(IllegalStateException.class.getSimpleName(), vm1);
try {
createPersistentRegion(vm1);
fail("Should have received an IllegalState exception");
@@ -1381,10 +1386,10 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
Cache cache = getCache();
Region region = cache.getRegion(REGION_NAME);
if (region == null) {
- getLogWriter().severe("removing listener for PersistentRecoveryOrderDUnitTest because region was not found: " + REGION_NAME);
+ LogWriterUtils.getLogWriter().severe("removing listener for PersistentRecoveryOrderDUnitTest because region was not found: " + REGION_NAME);
Object old = DistributionMessageObserver.setInstance(null);
if (old != this) {
- getLogWriter().severe("removed listener was not the invoked listener", new Exception("stack trace"));
+ LogWriterUtils.getLogWriter().severe("removed listener was not the invoked listener", new Exception("stack trace"));
}
return;
}
@@ -1668,18 +1673,18 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
- getLogWriter().info("Creating region in VM0");
+ LogWriterUtils.getLogWriter().info("Creating region in VM0");
createPersistentRegion(vm0);
putAnEntry(vm0);
- getLogWriter().info("closing region in vm0");
+ LogWriterUtils.getLogWriter().info("closing region in vm0");
closeCache(vm0);
- getLogWriter().info("Creating region in VM1");
+ LogWriterUtils.getLogWriter().info("Creating region in VM1");
createPersistentRegion(vm1);
putAnEntry(vm1);
- getLogWriter().info("Creating region in VM0");
- ExpectedException ex = addExpectedException("ConflictingPersistentDataException", vm0);
+ LogWriterUtils.getLogWriter().info("Creating region in VM0");
+ IgnoredException ex = IgnoredException.addIgnoredException("ConflictingPersistentDataException", vm0);
try {
//this should cause a conflict
createPersistentRegion(vm0);
@@ -1692,7 +1697,7 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
ex.remove();
}
- getLogWriter().info("closing region in vm1");
+ LogWriterUtils.getLogWriter().info("closing region in vm1");
closeCache(vm1);
//This should work now
@@ -1700,9 +1705,9 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
updateTheEntry(vm0);
- ex = addExpectedException("ConflictingPersistentDataException", vm1);
+ ex = IgnoredException.addIgnoredException("ConflictingPersistentDataException", vm1);
//Now make sure vm1 gets a conflict
- getLogWriter().info("Creating region in VM1");
+ LogWriterUtils.getLogWriter().info("Creating region in VM1");
try {
//this should cause a conflict
createPersistentRegion(vm1);
@@ -1775,11 +1780,11 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
@Override
public Properties getDistributedSystemProperties() {
- getLogWriter().info("Looking for ack-wait-threshold");
+ LogWriterUtils.getLogWriter().info("Looking for ack-wait-threshold");
String s = System.getProperty("gemfire.ack-wait-threshold");
if (s != null) {
SAVED_ACK_WAIT_THRESHOLD = s;
- getLogWriter().info("removing system property gemfire.ack-wait-threshold");
+ LogWriterUtils.getLogWriter().info("removing system property gemfire.ack-wait-threshold");
System.getProperties().remove("gemfire.ack-wait-threshold");
}
Properties props = super.getDistributedSystemProperties();
@@ -1827,9 +1832,9 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
try {
((GemFireCacheImpl)cache).createVMRegion(REGION_NAME, rf.create(), internalArgs);
} catch (ClassNotFoundException e) {
- fail("error", e);
+ Assert.fail("error", e);
} catch (IOException e) {
- fail("error", e);
+ Assert.fail("error", e);
}
}
};
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentReplicatedTestBase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentReplicatedTestBase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentReplicatedTestBase.java
index ff82082..e07b145 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentReplicatedTestBase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/persistence/PersistentReplicatedTestBase.java
@@ -37,8 +37,11 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.InternalRegionArguments;
import com.gemstone.gemfire.internal.cache.RegionFactoryImpl;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
public abstract class PersistentReplicatedTestBase extends CacheTestCase {
@@ -54,7 +57,7 @@ public abstract class PersistentReplicatedTestBase extends CacheTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
- invokeInEveryVM(PersistentReplicatedTestBase.class,"setRegionName", new Object[]{getUniqueName()});
+ Invoke.invokeInEveryVM(PersistentReplicatedTestBase.class,"setRegionName", new Object[]{getUniqueName()});
setRegionName(getUniqueName());
diskDir = new File("diskDir-" + getName()).getAbsoluteFile();
com.gemstone.gemfire.internal.FileUtil.delete(diskDir);
@@ -67,16 +70,19 @@ public abstract class PersistentReplicatedTestBase extends CacheTestCase {
}
@Override
- public void tearDown2() throws Exception {
- super.tearDown2();
+ protected final void postTearDownCacheTestCase() throws Exception {
com.gemstone.gemfire.internal.FileUtil.delete(diskDir);
+ postTearDownPersistentReplicatedTestBase();
+ }
+
+ protected void postTearDownPersistentReplicatedTestBase() throws Exception {
}
protected void waitForBlockedInitialization(VM vm) {
vm.invoke(new SerializableRunnable() {
public void run() {
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public String description() {
return "Waiting for another persistent member to come online";
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/Bug40396DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/Bug40396DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/Bug40396DUnitTest.java
index ed85295..c28f9e7 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/Bug40396DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/Bug40396DUnitTest.java
@@ -32,6 +32,7 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.DeltaEOFException;
import com.gemstone.gemfire.internal.cache.tier.sockets.FaultyDelta;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
/**
@@ -201,13 +202,13 @@ public class Bug40396DUnitTest extends DistributedTestCase {
assertTrue("pattern not found", matched);
}
- public void tearDown2() throws Exception {
- super.tearDown2();
+ @Override
+ protected final void preTearDown() throws Exception {
// then close the servers
server.invoke(Bug40396DUnitTest.class, "removeExceptions");
server.invoke(Bug40396DUnitTest.class, "closeCache");
server2.invoke(Bug40396DUnitTest.class, "closeCache");
cache = null;
- invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
+ Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/BackwardCompatibilityHigherVersionClientDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/BackwardCompatibilityHigherVersionClientDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/BackwardCompatibilityHigherVersionClientDUnitTest.java
index 27240e5..3d53df9 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/BackwardCompatibilityHigherVersionClientDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/BackwardCompatibilityHigherVersionClientDUnitTest.java
@@ -30,8 +30,10 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.tier.ConnectionProxy;
+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.NetworkUtils;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.cache.client.PoolManager;
import com.gemstone.gemfire.cache.client.internal.ConnectionFactoryImpl;
@@ -133,8 +135,7 @@ public class BackwardCompatibilityHigherVersionClientDUnitTest extends
}
@Override
- public void tearDown2() throws Exception {
- super.tearDown2();
+ protected final void postTearDown() throws Exception {
client1.invoke(BackwardCompatibilityHigherVersionClientDUnitTest.class,
"unsetHandshakeVersionForTesting");
client1.invoke(BackwardCompatibilityHigherVersionClientDUnitTest.class,
@@ -168,7 +169,7 @@ public class BackwardCompatibilityHigherVersionClientDUnitTest extends
"setHandshakeVersionForTesting");
client1.invoke(BackwardCompatibilityHigherVersionClientDUnitTest.class,
"createClientCache", new Object[] {
- getServerHostName(server1.getHost()), port1 });
+ NetworkUtils.getServerHostName(server1.getHost()), port1 });
client1.invoke(BackwardCompatibilityHigherVersionClientDUnitTest.class,
"verifyConnectionToServerFailed");
}
@@ -250,7 +251,7 @@ public class BackwardCompatibilityHigherVersionClientDUnitTest extends
r.destroyRegion();
}
catch (Exception ex) {
- fail("failed while destroy region ", ex);
+ Assert.fail("failed while destroy region ", ex);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36269DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36269DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36269DUnitTest.java
index 6198ad2..c8ac91e 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36269DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36269DUnitTest.java
@@ -34,9 +34,13 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.ServerLocation;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.EventID;
+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.NetworkUtils;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* The Region Destroy Operation from Cache Client does not pass the Client side
@@ -104,10 +108,10 @@ public class Bug36269DUnitTest extends DistributedTestCase
{
try {
createClientCache();
- acquireConnectionsAndDestroyRegion(getServerHostName(Host.getHost(0)));
+ acquireConnectionsAndDestroyRegion(NetworkUtils.getServerHostName(Host.getHost(0)));
server1.invoke(Bug36269DUnitTest.class, "verifyRegionDestroy");
server2.invoke(Bug36269DUnitTest.class, "verifyRegionDestroy");
- pause(5000);
+ Wait.pause(5000);
verifyNoRegionDestroyOnOriginator();
}
catch (Exception ex) {
@@ -124,7 +128,7 @@ public class Bug36269DUnitTest extends DistributedTestCase
srp.destroyRegionOnForTestsOnly(desCon, new EventID(new byte[] {1}, 1, 1), null);
}
catch (Exception ex) {
- fail("while setting acquireConnections", ex);
+ Assert.fail("while setting acquireConnections", ex);
}
}
@@ -137,7 +141,7 @@ public class Bug36269DUnitTest extends DistributedTestCase
new Bug36269DUnitTest("temp").createCache(props);
CacheServerTestUtil.disableShufflingOfEndpoints();
PoolImpl p;
- String host = getServerHostName(Host.getHost(0));
+ String host = NetworkUtils.getServerHostName(Host.getHost(0));
try {
p = (PoolImpl)PoolManager.createFactory()
.addServer(host, PORT1)
@@ -184,7 +188,7 @@ public class Bug36269DUnitTest extends DistributedTestCase
assertNotNull(r);
}
catch (Exception ex) {
- fail("failed while verifyNoRegionDestroyOnOriginator()", ex);
+ Assert.fail("failed while verifyNoRegionDestroyOnOriginator()", ex);
}
}
@@ -199,10 +203,10 @@ public class Bug36269DUnitTest extends DistributedTestCase
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 40 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 40 * 1000, 200, true);
}
catch (Exception ex) {
- fail("failed while verifyRegionDestroy", ex);
+ Assert.fail("failed while verifyRegionDestroy", ex);
}
}
@@ -214,13 +218,11 @@ public class Bug36269DUnitTest extends DistributedTestCase
}
}
- public void tearDown2() throws Exception
- {
+ @Override
+ protected final void preTearDown() throws Exception {
closeCache();
// close server
server1.invoke(Bug36269DUnitTest.class, "closeCache");
server2.invoke(Bug36269DUnitTest.class, "closeCache");
-
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36457DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36457DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36457DUnitTest.java
index 0124e92..cff2266 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36457DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36457DUnitTest.java
@@ -37,8 +37,11 @@ import com.gemstone.gemfire.distributed.internal.ServerLocation;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.ClientServerObserverAdapter;
import com.gemstone.gemfire.internal.cache.ClientServerObserverHolder;
+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.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
import com.gemstone.gemfire.test.dunit.VM;
/**
@@ -136,9 +139,8 @@ public class Bug36457DUnitTest extends DistributedTestCase
return new Integer(server1.getPort());
}
- public void tearDown2() throws Exception
- {
- super.tearDown2();
+ @Override
+ protected final void preTearDown() throws Exception {
// close the clients first
client1.invoke(Bug36457DUnitTest.class, "closeCache");
client2.invoke(Bug36457DUnitTest.class, "closeCache");
@@ -162,9 +164,9 @@ public class Bug36457DUnitTest extends DistributedTestCase
Integer port2 = ((Integer)server2.invoke(Bug36457DUnitTest.class,
"createServerCache"));
client1.invoke(Bug36457DUnitTest.class, "createClientCache", new Object[] {
- getServerHostName(server1.getHost()), port1, port2 });
+ NetworkUtils.getServerHostName(server1.getHost()), port1, port2 });
client2.invoke(Bug36457DUnitTest.class, "createClientCache", new Object[] {
- getServerHostName(server1.getHost()), port1, port2 });
+ NetworkUtils.getServerHostName(server1.getHost()), port1, port2 });
//set a cllabck so that we come to know that whether a failover is called or not
// if failover is called means this bug is present.
client2.invoke(Bug36457DUnitTest.class, "setClientServerObserver");
@@ -188,7 +190,7 @@ public class Bug36457DUnitTest extends DistributedTestCase
.setInstance(new ClientServerObserverAdapter() {
public void afterPrimaryIdentificationFromBackup(ServerLocation primaryEndpoint)
{
- getLogWriter().fine("TEST FAILED HERE YOGI ");
+ LogWriterUtils.getLogWriter().fine("TEST FAILED HERE YOGI ");
isFaileoverHappened = true;
}
});
@@ -207,7 +209,7 @@ public class Bug36457DUnitTest extends DistributedTestCase
r.destroyRegion();
}
catch (Exception ex) {
- fail("failed while destroy region ", ex);
+ Assert.fail("failed while destroy region ", ex);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36805DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36805DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36805DUnitTest.java
index fa1bed1..d9f1a2e 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36805DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36805DUnitTest.java
@@ -36,7 +36,10 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
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;
/**
* bug test for bug 36805
@@ -130,9 +133,8 @@ public class Bug36805DUnitTest extends DistributedTestCase
return new Integer(server1.getPort());
}
- public void tearDown2() throws Exception
- {
- super.tearDown2();
+ @Override
+ protected final void preTearDown() throws Exception {
// close the clients first
client1.invoke(Bug36805DUnitTest.class, "closeCache");
client2.invoke(Bug36805DUnitTest.class, "closeCache");
@@ -156,9 +158,9 @@ public class Bug36805DUnitTest extends DistributedTestCase
Integer port2 = ((Integer)server2.invoke(Bug36805DUnitTest.class,
"createServerCache"));
client1.invoke(Bug36805DUnitTest.class, "createClientCache", new Object[] {
- getServerHostName(server1.getHost()), port1, port2 });
+ NetworkUtils.getServerHostName(server1.getHost()), port1, port2 });
client2.invoke(Bug36805DUnitTest.class, "createClientCache", new Object[] {
- getServerHostName(server1.getHost()), port1, port2 });
+ NetworkUtils.getServerHostName(server1.getHost()), port1, port2 });
// set a cllabck so that we come to know that whether a failover is called
// or not
// if failover is called means this bug is present.
@@ -215,7 +217,7 @@ public class Bug36805DUnitTest extends DistributedTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 3 * 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 3 * 60 * 1000, 1000, true);
// we no longer verify dead servers; live is good enough
// start = System.currentTimeMillis();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java
index 74139bb..ceac13b 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java
@@ -27,8 +27,10 @@ import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.cache.RegionDestroyedException;
import com.gemstone.gemfire.cache.client.*;
import com.gemstone.gemfire.internal.cache.PoolFactoryImpl;
+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.NetworkUtils;
import com.gemstone.gemfire.test.dunit.VM;
public class Bug36829DUnitTest extends DistributedTestCase {
@@ -66,7 +68,7 @@ public class Bug36829DUnitTest extends DistributedTestCase {
this.ClientVM.invoke(CacheServerTestUtil.class, "createCacheClient",
new Object[] {
- getClientPool(getServerHostName(ClientVM.getHost()), PORT, true, 0),
+ getClientPool(NetworkUtils.getServerHostName(ClientVM.getHost()), PORT, true, 0),
regionName,
getClientDistributedSystemProperties(durableClientId,
durableClientTimeout), Boolean.TRUE });
@@ -117,7 +119,7 @@ public class Bug36829DUnitTest extends DistributedTestCase {
}
}
catch (Exception ex) {
- fail("failed while registering interest in registerKey function", ex);
+ Assert.fail("failed while registering interest in registerKey function", ex);
}
}
@@ -141,7 +143,7 @@ public class Bug36829DUnitTest extends DistributedTestCase {
}
catch (Exception ex) {
- fail("failed while registering interest in registerKey function", ex);
+ Assert.fail("failed while registering interest in registerKey function", ex);
}
}
@@ -166,9 +168,8 @@ public class Bug36829DUnitTest extends DistributedTestCase {
return properties;
}
- public void tearDown2() throws Exception
- {
- super.tearDown2();
+ @Override
+ protected final void preTearDown() throws Exception {
CacheServerTestUtil.resetDisableShufflingOfEndpointsFlag();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36995DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36995DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36995DUnitTest.java
index 3eb924e..872f95c 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36995DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36995DUnitTest.java
@@ -29,7 +29,11 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.AvailablePort;
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.NetworkUtils;
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.cache.client.*;
import com.gemstone.gemfire.cache.client.internal.PoolImpl;
@@ -135,9 +139,8 @@ public class Bug36995DUnitTest extends DistributedTestCase
return new Integer(server1.getPort());
}
- public void tearDown2() throws Exception
- {
- super.tearDown2();
+ @Override
+ protected final void preTearDown() throws Exception {
closeCache();
server1.invoke(Bug36995DUnitTest.class, "closeCache");
server2.invoke(Bug36995DUnitTest.class, "closeCache");
@@ -164,7 +167,7 @@ public class Bug36995DUnitTest extends DistributedTestCase
Integer port3 = ((Integer)server3.invoke(Bug36995DUnitTest.class,
"createServerCache"));
createClientCacheWithDefaultMessageTrackingTimeout(
- getServerHostName(server1.getHost()), port1.intValue(), port2
+ NetworkUtils.getServerHostName(server1.getHost()), port1.intValue(), port2
.intValue(), port3.intValue());
assertEquals(PoolFactory.DEFAULT_SUBSCRIPTION_MESSAGE_TRACKING_TIMEOUT,
pool.getSubscriptionMessageTrackingTimeout());
@@ -176,14 +179,14 @@ public class Bug36995DUnitTest extends DistributedTestCase
public void testBug36995_UserSpecified()
{
//work around GEODE-507
- addExpectedException("Connection reset");
+ IgnoredException.addIgnoredException("Connection reset");
Integer port1 = ((Integer)server1.invoke(Bug36995DUnitTest.class,
"createServerCache"));
Integer port2 = ((Integer)server2.invoke(Bug36995DUnitTest.class,
"createServerCache"));
Integer port3 = ((Integer)server3.invoke(Bug36995DUnitTest.class,
"createServerCache"));
- createClientCache(getServerHostName(server1.getHost()),
+ createClientCache(NetworkUtils.getServerHostName(server1.getHost()),
port1.intValue(), port2.intValue(), port3.intValue());
assertEquals(54321, pool.getSubscriptionMessageTrackingTimeout());
}
@@ -199,7 +202,7 @@ public class Bug36995DUnitTest extends DistributedTestCase
"createServerCache"));
Integer port3 = ((Integer)server3.invoke(Bug36995DUnitTest.class,
"createServerCache"));
- createClientCache(getServerHostName(server1.getHost()),
+ createClientCache(NetworkUtils.getServerHostName(server1.getHost()),
port1.intValue(), port2.intValue(), port3.intValue());
verifyDeadAndLiveServers(0, 3);
server2.invoke(Bug36995DUnitTest.class, "stopServer");
@@ -232,7 +235,7 @@ public class Bug36995DUnitTest extends DistributedTestCase
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 3 * 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 3 * 60 * 1000, 1000, true);
// we no longer verify dead servers; just live
// while (proxy.getDeadServers().size() != expectedDeadServers) { // wait
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37210DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37210DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37210DUnitTest.java
index 3a9ab10..050a8fc 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37210DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37210DUnitTest.java
@@ -35,6 +35,9 @@ import com.gemstone.gemfire.internal.cache.CacheServerImpl;
import com.gemstone.gemfire.internal.cache.ha.HARegionQueue;
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.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.cache.client.*;
@@ -83,7 +86,7 @@ public class Bug37210DUnitTest extends DistributedTestCase
{
super.setUp();
- addExpectedException("java.io.IOException");
+ IgnoredException.addIgnoredException("java.io.IOException");
final Host host = Host.getHost(0);
server = host.getVM(0);
@@ -120,9 +123,8 @@ public class Bug37210DUnitTest extends DistributedTestCase
* @throws Exception
* thrown if any problem occurs in closing cache
*/
- public void tearDown2() throws Exception
- {
- super.tearDown2();
+ @Override
+ protected final void preTearDown() throws Exception {
// close client
client.invoke(Bug37210DUnitTest.class, "closeCache");
@@ -144,11 +146,11 @@ public class Bug37210DUnitTest extends DistributedTestCase
*/
public void testHAStatsCleanup() throws Exception
{
- getLogWriter().info("testHAStatsCleanup : BEGIN");
- addExpectedException("java.net.SocketException");
- addExpectedException("Unexpected IOException");
+ LogWriterUtils.getLogWriter().info("testHAStatsCleanup : BEGIN");
+ IgnoredException.addIgnoredException("java.net.SocketException");
+ IgnoredException.addIgnoredException("Unexpected IOException");
client.invoke(Bug37210DUnitTest.class, "createClientCache",
- new Object[] { getServerHostName(Host.getHost(0)), new Integer(PORT) });
+ new Object[] { NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT) });
server.invoke(Bug37210DUnitTest.class, "doEntryOperations");
server.invoke(Bug37210DUnitTest.class,
@@ -158,7 +160,7 @@ public class Bug37210DUnitTest extends DistributedTestCase
Thread.currentThread().sleep(1000);
server.invoke(Bug37210DUnitTest.class,
"closeCacheClientProxyAndVerifyStats2");
- getLogWriter().info("testHAStatsCleanup : END");
+ LogWriterUtils.getLogWriter().info("testHAStatsCleanup : END");
}
/**
@@ -187,7 +189,7 @@ public class Bug37210DUnitTest extends DistributedTestCase
server.setSocketBufferSize(32768);
server.setMaximumTimeBetweenPings(1000000);
server.start();
- getLogWriter().info("Server started at PORT = " + port);
+ LogWriterUtils.getLogWriter().info("Server started at PORT = " + port);
return new Integer(server.getPort());
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java
index 24674fe..f7adf6a 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java
@@ -30,6 +30,7 @@ import com.gemstone.gemfire.internal.cache.HARegion;
import com.gemstone.gemfire.internal.cache.PoolFactoryImpl;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
import com.gemstone.gemfire.test.dunit.VM;
/**
@@ -64,7 +65,8 @@ public class Bug37805DUnitTest extends DistributedTestCase{
CacheServerTestUtil.disableShufflingOfEndpoints();
}
- public void tearDown2() throws Exception {
+ @Override
+ protected final void preTearDown() throws Exception {
// Stop server 1
this.server1VM.invoke(CacheServerTestUtil.class, "closeCache");
CacheServerTestUtil.resetDisableShufflingOfEndpointsFlag();
@@ -84,7 +86,7 @@ public class Bug37805DUnitTest extends DistributedTestCase{
this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient",
new Object[] {
- getClientPool(getServerHostName(durableClientVM.getHost()), PORT1, true, 0),
+ getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), PORT1, true, 0),
regionName,
getDurableClientDistributedSystemProperties(durableClientId,
durableClientTimeout), Boolean.TRUE });
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerMaxConnectionsJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerMaxConnectionsJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerMaxConnectionsJUnitTest.java
index 3418ae2..ed0d7fd 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerMaxConnectionsJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerMaxConnectionsJUnitTest.java
@@ -39,8 +39,8 @@ import com.gemstone.gemfire.cache.client.internal.Connection;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.AvailablePort;
-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;
/**
@@ -177,7 +177,7 @@ public class CacheServerMaxConnectionsJUnitTest
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 1000, 200, true);
+ Wait.waitForCriterion(ev, 1000, 200, true);
assertEquals(MAX_CNXS, s.getInt("currentClientConnections"));
assertEquals(1, s.getInt("currentClients"));
this.system.getLogWriter().info("<ExpectedException action=add>"
@@ -214,7 +214,7 @@ public class CacheServerMaxConnectionsJUnitTest
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 3 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 3 * 1000, 200, true);
this.system.getLogWriter().info("currentClients="
+ s.getInt("currentClients")
+ " currentClientConnections="
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java
index f70a808..4a3cf5f 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java
@@ -50,7 +50,11 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.PoolFactoryImpl;
import com.gemstone.gemfire.internal.cache.PoolFactoryImpl.PoolAttributes;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
/**
*
* @author Yogesh Mahajan
@@ -59,7 +63,7 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
public class CacheServerTestUtil extends DistributedTestCase
{
private static Cache cache = null;
- private static ExpectedException expected;
+ private static IgnoredException expected;
private static PoolImpl pool = null;
@@ -156,7 +160,7 @@ public class CacheServerTestUtil extends DistributedTestCase
public static void createCacheClient(Pool poolAttr, String regionName,
Properties dsProperties, Boolean addControlListener, Properties javaSystemProperties) throws Exception {
new CacheServerTestUtil("temp").createCache(dsProperties);
- addExpectedException("java.net.ConnectException||java.net.SocketException");
+ IgnoredException.addIgnoredException("java.net.ConnectException||java.net.SocketException");
if (javaSystemProperties != null && javaSystemProperties.size() > 0) {
Enumeration e = javaSystemProperties.propertyNames();
@@ -222,9 +226,9 @@ public class CacheServerTestUtil extends DistributedTestCase
ccf.set(DistributionConfig.DURABLE_CLIENT_ID_NAME, durableClientId);
ccf.set(DistributionConfig.DURABLE_CLIENT_TIMEOUT_NAME, String.valueOf(timeout));
ccf.set("log-file", "abs_client_system.log");
- ccf.set("log-level", getDUnitLogLevel());
+ ccf.set("log-level", LogWriterUtils.getDUnitLogLevel());
cache = (Cache)ccf.create();
- expected = addExpectedException("java.net.ConnectionException||java.net.SocketException");
+ expected = IgnoredException.addIgnoredException("java.net.ConnectionException||java.net.SocketException");
pool = (PoolImpl)PoolManager.find(poolName);
}
@@ -243,7 +247,7 @@ public class CacheServerTestUtil extends DistributedTestCase
ccf.set(DistributionConfig.DURABLE_CLIENT_ID_NAME, durableClientId);
ccf.set(DistributionConfig.DURABLE_CLIENT_TIMEOUT_NAME, String.valueOf(timeout));
cache = (Cache)ccf.create();
- expected = addExpectedException("java.net.ConnectionException||java.net.SocketException");
+ expected = IgnoredException.addIgnoredException("java.net.ConnectionException||java.net.SocketException");
pool = (PoolImpl)PoolManager.find(poolName);
}
@@ -254,9 +258,9 @@ public class CacheServerTestUtil extends DistributedTestCase
File cacheXmlFile = new File(url.toURI().getPath());
ccf.set("cache-xml-file", cacheXmlFile.toURI().getPath());
ccf.set("mcast-port", "0");
- ccf.set("locators", "localhost["+DistributedTestCase.getDUnitLocatorPort()+"]");
+ ccf.set("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
ccf.set("log-file", "abs_server_system.log");
- ccf.set("log-level", getDUnitLogLevel());
+ ccf.set("log-level", LogWriterUtils.getDUnitLogLevel());
}
catch (URISyntaxException e) {
throw new ExceptionInInitializerError(e);
@@ -271,7 +275,7 @@ public class CacheServerTestUtil extends DistributedTestCase
File cacheXmlFile = new File(url.toURI().getPath());
ccf.set("cache-xml-file", cacheXmlFile.toURI().getPath());
ccf.set("mcast-port", "0");
- ccf.set("locators", "localhost["+DistributedTestCase.getDUnitLocatorPort()+"]");
+ ccf.set("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
}
catch (URISyntaxException e) {
throw new ExceptionInInitializerError(e);
@@ -326,7 +330,7 @@ public class CacheServerTestUtil extends DistributedTestCase
{
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost["+DistributedTestCase.getDUnitLocatorPort()+"]");
+ props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
new CacheServerTestUtil("temp").createCache(props);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
@@ -348,7 +352,7 @@ public class CacheServerTestUtil extends DistributedTestCase
Properties props = new Properties();
// int mcastPort = AvailablePort.getRandomAvailablePort(AvailablePort.JGROUPS);
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost["+DistributedTestCase.getDUnitLocatorPort()+"]");
+ props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
new CacheServerTestUtil("temp").createCache(props);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
@@ -369,7 +373,7 @@ public class CacheServerTestUtil extends DistributedTestCase
throws Exception {
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost["+DistributedTestCase.getDUnitLocatorPort()+"]");
+ props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]");
new CacheServerTestUtil("temp").createCache(props);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
@@ -425,7 +429,7 @@ public class CacheServerTestUtil extends DistributedTestCase
setSystem(props, cc.getDistributedSystem());
cache = (Cache)cc;
assertNotNull(cache);
- expected = addExpectedException("java.net.ConnectionException||java.net.SocketException");
+ expected = IgnoredException.addIgnoredException("java.net.ConnectionException||java.net.SocketException");
}
public static void closeCache()
@@ -489,7 +493,7 @@ public class CacheServerTestUtil extends DistributedTestCase
try {
server.start();
} catch(Exception e) {
- fail("Unexpected exception", e);
+ Assert.fail("Unexpected exception", e);
}
assertTrue(server.isRunning());
}