http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java
----------------------------------------------------------------------
diff --git
a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java
b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java
index 1afba75..17afcbb 100644
---
a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java
+++
b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java
@@ -81,7 +81,6 @@ import
com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
import com.gemstone.gemfire.cache30.CacheTestCase;
-import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.Locator;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
@@ -115,13 +114,16 @@ import
com.gemstone.gemfire.internal.cache.wan.parallel.ParallelGatewaySenderQue
import com.gemstone.gemfire.pdx.SimpleClass;
import com.gemstone.gemfire.pdx.SimpleClass1;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.util.test.TestUtil;
import com.jayway.awaitility.Awaitility;
-import junit.framework.Assert;
-
public class WANTestBase extends DistributedTestCase{
protected static Cache cache;
@@ -182,11 +184,11 @@ public class WANTestBase extends DistributedTestCase{
//this is done to vary the number of dispatchers for sender
//during every test method run
shuffleNumDispatcherThreads();
- invokeInEveryVM(WANTestBase.class,"setNumDispatcherThreadsForTheRun",
+
Invoke.invokeInEveryVM(WANTestBase.class,"setNumDispatcherThreadsForTheRun",
new Object[]{dispatcherThreads.get(0)});
- addExpectedException("Connection refused");
- addExpectedException("Software caused connection abort");
- addExpectedException("Connection reset");
+ IgnoredException.addIgnoredException("Connection refused");
+ IgnoredException.addIgnoredException("Software caused connection abort");
+ IgnoredException.addIgnoredException("Connection reset");
}
public static void shuffleNumDispatcherThreads() {
@@ -204,7 +206,7 @@ public class WANTestBase extends DistributedTestCase{
}
public static void createLocator(int dsId, int port, Set<String>
localLocatorsList, Set<String> remoteLocatorsList){
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME,"0");
props.setProperty(DistributionConfig.DISTRIBUTED_SYSTEM_ID_NAME, ""+dsId);
@@ -227,7 +229,7 @@ public class WANTestBase extends DistributedTestCase{
public static Integer createFirstLocatorWithDSId(int dsId) {
stopOldLocator();
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME,"0");
@@ -240,7 +242,7 @@ public class WANTestBase extends DistributedTestCase{
public static Integer createFirstPeerLocator(int dsId) {
stopOldLocator();
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME,"0");
@@ -253,7 +255,7 @@ public class WANTestBase extends DistributedTestCase{
public static Integer createSecondLocator(int dsId, int locatorPort) {
stopOldLocator();
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME,"0");
@@ -266,7 +268,7 @@ public class WANTestBase extends DistributedTestCase{
public static Integer createSecondPeerLocator(int dsId, int locatorPort) {
stopOldLocator();
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME,"0");
@@ -279,7 +281,7 @@ public class WANTestBase extends DistributedTestCase{
public static Integer createFirstRemoteLocator(int dsId, int remoteLocPort) {
stopOldLocator();
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME,"0");
@@ -292,7 +294,7 @@ public class WANTestBase extends DistributedTestCase{
}
public static void bringBackLocatorOnOldPort(int dsId, int remoteLocPort,
int oldPort) {
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
Properties props = new Properties();
props.put(DistributionConfig.LOG_LEVEL_NAME, "fine");
props.setProperty(DistributionConfig.MCAST_PORT_NAME,"0");
@@ -307,7 +309,7 @@ public class WANTestBase extends DistributedTestCase{
public static Integer createFirstRemotePeerLocator(int dsId, int
remoteLocPort) {
stopOldLocator();
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME,"0");
@@ -322,7 +324,7 @@ public class WANTestBase extends DistributedTestCase{
public static Integer createSecondRemoteLocator(int dsId, int localPort,
int remoteLocPort) {
stopOldLocator();
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME,"0");
@@ -337,7 +339,7 @@ public class WANTestBase extends DistributedTestCase{
public static Integer createSecondRemotePeerLocator(int dsId, int localPort,
int remoteLocPort) {
stopOldLocator();
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME,"0");
@@ -350,11 +352,11 @@ public class WANTestBase extends DistributedTestCase{
}
public static void createReplicatedRegion(String regionName, String
senderIds, Boolean offHeap){
- ExpectedException exp = addExpectedException(ForceReattemptException.class
+ IgnoredException exp =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
- ExpectedException exp1 = addExpectedException(InterruptedException.class
+ IgnoredException exp1 =
IgnoredException.addIgnoredException(InterruptedException.class
.getName());
- ExpectedException exp2 = addExpectedException(GatewaySenderException.class
+ IgnoredException exp2 =
IgnoredException.addIgnoredException(GatewaySenderException.class
.getName());
try {
AttributesFactory fact = new AttributesFactory();
@@ -455,7 +457,7 @@ public class WANTestBase extends DistributedTestCase{
public static void createReplicatedRegionWithAsyncEventQueue(
String regionName, String asyncQueueIds, Boolean offHeap) {
- ExpectedException exp1 = addExpectedException(ForceReattemptException.class
+ IgnoredException exp1 =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
try {
AttributesFactory fact = new AttributesFactory();
@@ -498,7 +500,7 @@ public class WANTestBase extends DistributedTestCase{
public static void createReplicatedRegionWithSenderAndAsyncEventQueue(
String regionName, String senderIds, String asyncChannelId, Boolean
offHeap) {
- ExpectedException exp = addExpectedException(ForceReattemptException.class
+ IgnoredException exp =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
try {
@@ -654,7 +656,7 @@ public class WANTestBase extends DistributedTestCase{
Integer batchSize, boolean isConflation, boolean isPersistent,
String diskStoreName, boolean isDiskSynchronous, int nDispatchers) {
- ExpectedException exp = addExpectedException(ForceReattemptException.class
+ IgnoredException exp =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
try {
@@ -730,7 +732,7 @@ public class WANTestBase extends DistributedTestCase{
} else {
persistentDirectory = new File(diskStoreName);
}
- getLogWriter().info("The ds is : " + persistentDirectory.getName());
+ LogWriterUtils.getLogWriter().info("The ds is : " +
persistentDirectory.getName());
persistentDirectory.mkdir();
DiskStoreFactory dsf = cache.createDiskStoreFactory();
File [] dirs1 = new File[] {persistentDirectory};
@@ -848,7 +850,7 @@ public class WANTestBase extends DistributedTestCase{
final Set<RegionQueue> queues = ((AbstractGatewaySender) sender)
.getQueues();
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
public String description() {
return "Waiting for EventQueue size to be " + numQueueEntries;
@@ -870,9 +872,9 @@ public class WANTestBase extends DistributedTestCase{
}
public static void createPartitionedRegion(String regionName, String
senderIds, Integer redundantCopies, Integer totalNumBuckets, Boolean offHeap){
- ExpectedException exp = addExpectedException(ForceReattemptException.class
+ IgnoredException exp =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
- ExpectedException exp1 =
addExpectedException(PartitionOfflineException.class
+ IgnoredException exp1 =
IgnoredException.addIgnoredException(PartitionOfflineException.class
.getName());
try {
AttributesFactory fact = new AttributesFactory();
@@ -903,9 +905,9 @@ public class WANTestBase extends DistributedTestCase{
// TODO:OFFHEAP: add offheap flavor
public static void createPartitionedRegionWithPersistence(String regionName,
String senderIds, Integer redundantCopies, Integer totalNumBuckets) {
- ExpectedException exp = addExpectedException(ForceReattemptException.class
+ IgnoredException exp =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
- ExpectedException exp1 =
addExpectedException(PartitionOfflineException.class
+ IgnoredException exp1 =
IgnoredException.addIgnoredException(PartitionOfflineException.class
.getName());
try {
AttributesFactory fact = new AttributesFactory();
@@ -934,9 +936,9 @@ public class WANTestBase extends DistributedTestCase{
}
public static void createColocatedPartitionedRegion(String regionName,
String senderIds, Integer redundantCopies, Integer
totalNumBuckets, String colocatedWith) {
- ExpectedException exp =
addExpectedException(ForceReattemptException.class
+ IgnoredException exp =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
- ExpectedException exp1 =
addExpectedException(PartitionOfflineException.class
+ IgnoredException exp1 =
IgnoredException.addIgnoredException(PartitionOfflineException.class
.getName());
try {
AttributesFactory fact = new AttributesFactory();
@@ -982,9 +984,9 @@ public class WANTestBase extends DistributedTestCase{
public static void createPartitionedRegionWithAsyncEventQueue(
String regionName, String asyncEventQueueId, Boolean offHeap) {
- ExpectedException exp = addExpectedException(ForceReattemptException.class
+ IgnoredException exp =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
- ExpectedException exp1 =
addExpectedException(PartitionOfflineException.class
+ IgnoredException exp1 =
IgnoredException.addIgnoredException(PartitionOfflineException.class
.getName());
try {
AttributesFactory fact = new AttributesFactory();
@@ -1006,9 +1008,9 @@ public class WANTestBase extends DistributedTestCase{
public static void createColocatedPartitionedRegionWithAsyncEventQueue(
String regionName, String asyncEventQueueId, Integer totalNumBuckets,
String colocatedWith) {
- ExpectedException exp =
addExpectedException(ForceReattemptException.class
+ IgnoredException exp =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
- ExpectedException exp1 =
addExpectedException(PartitionOfflineException.class
+ IgnoredException exp1 =
IgnoredException.addIgnoredException(PartitionOfflineException.class
.getName());
try {
AttributesFactory fact = new AttributesFactory();
@@ -1051,7 +1053,7 @@ public class WANTestBase extends DistributedTestCase{
*/
public static void createPRWithRedundantCopyWithAsyncEventQueue(
String regionName, String asyncEventQueueId, Boolean offHeap) {
- ExpectedException exp = addExpectedException(ForceReattemptException.class
+ IgnoredException exp =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
try {
@@ -1141,9 +1143,9 @@ public class WANTestBase extends DistributedTestCase{
Integer totalNumBuckets,
Boolean offHeap){
- ExpectedException exp = addExpectedException(ForceReattemptException.class
+ IgnoredException exp =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
- ExpectedException exp1 =
addExpectedException(PartitionOfflineException.class
+ IgnoredException exp1 =
IgnoredException.addIgnoredException(PartitionOfflineException.class
.getName());
try {
@@ -1175,7 +1177,7 @@ public class WANTestBase extends DistributedTestCase{
public static void createCustomerOrderShipmentPartitionedRegion(
String regionName, String senderIds, Integer redundantCopies,
Integer totalNumBuckets, Boolean offHeap) {
- ExpectedException exp = addExpectedException(ForceReattemptException.class
+ IgnoredException exp =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
try {
AttributesFactory fact = new AttributesFactory();
@@ -1201,7 +1203,7 @@ public class WANTestBase extends DistributedTestCase{
customerRegion = (PartitionedRegion)cache.createRegionFactory(
fact.create()).create(customerRegionName);
assertNotNull(customerRegion);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Partitioned Region CUSTOMER created Successfully :"
+ customerRegion.toString());
@@ -1226,7 +1228,7 @@ public class WANTestBase extends DistributedTestCase{
orderRegion = (PartitionedRegion)cache.createRegionFactory(fact.create())
.create(orderRegionName);
assertNotNull(orderRegion);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Partitioned Region ORDER created Successfully :"
+ orderRegion.toString());
@@ -1251,7 +1253,7 @@ public class WANTestBase extends DistributedTestCase{
shipmentRegion = (PartitionedRegion)cache.createRegionFactory(
fact.create()).create(shipmentRegionName);
assertNotNull(shipmentRegion);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Partitioned Region SHIPMENT created Successfully :"
+ shipmentRegion.toString());
}
@@ -1328,7 +1330,7 @@ public class WANTestBase extends DistributedTestCase{
}
public static void createCacheConserveSockets(Boolean
conserveSockets,Integer locPort){
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locPort
+ "]");
@@ -1338,7 +1340,7 @@ public class WANTestBase extends DistributedTestCase{
}
protected static void createCache(boolean management, Integer locPort) {
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
Properties props = new Properties();
if (management) {
props.setProperty(DistributionConfig.JMX_MANAGER_NAME, "true");
@@ -1353,7 +1355,7 @@ public class WANTestBase extends DistributedTestCase{
}
protected static void createCacheWithSSL(Integer locPort) {
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
boolean gatewaySslenabled = true;
String gatewaySslprotocols = "any";
@@ -1361,7 +1363,7 @@ public class WANTestBase extends DistributedTestCase{
boolean gatewaySslRequireAuth = true;
Properties gemFireProps = new Properties();
- gemFireProps.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
+ gemFireProps.put(DistributionConfig.LOG_LEVEL_NAME,
LogWriterUtils.getDUnitLogLevel());
gemFireProps.put(DistributionConfig.GATEWAY_SSL_ENABLED_NAME,
String.valueOf(gatewaySslenabled));
gemFireProps.put(DistributionConfig.GATEWAY_SSL_PROTOCOLS_NAME,
gatewaySslprotocols);
gemFireProps.put(DistributionConfig.GATEWAY_SSL_CIPHERS_NAME,
gatewaySslciphers);
@@ -1378,14 +1380,14 @@ public class WANTestBase extends DistributedTestCase{
gemFireProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
gemFireProps.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" +
locPort + "]");
- getLogWriter().info("Starting cache ds with following properties \n" +
gemFireProps);
+ LogWriterUtils.getLogWriter().info("Starting cache ds with following
properties \n" + gemFireProps);
InternalDistributedSystem ds = test.getSystem(gemFireProps);
cache = CacheFactory.create(ds);
}
public static void createCache_PDX(Integer locPort){
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locPort
+ "]");
@@ -1402,7 +1404,7 @@ public class WANTestBase extends DistributedTestCase{
}
public static void createCache(Integer locPort1, Integer locPort2){
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locPort1
@@ -1412,7 +1414,7 @@ public class WANTestBase extends DistributedTestCase{
}
public static void createCacheWithoutLocator(Integer mCastPort){
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, ""+mCastPort);
InternalDistributedSystem ds = test.getSystem(props);
@@ -1433,7 +1435,7 @@ public class WANTestBase extends DistributedTestCase{
server1.start();
}
catch (IOException e) {
- fail("Failed to start the Server", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Failed to start the
Server", e);
}
assertTrue(server1.isRunning());
@@ -1467,11 +1469,11 @@ public class WANTestBase extends DistributedTestCase{
}
public static void startSender(String senderId) {
- final ExpectedException exln = addExpectedException("Could not connect");
+ final IgnoredException exln = IgnoredException.addIgnoredException("Could
not connect");
- ExpectedException exp = addExpectedException(ForceReattemptException.class
+ IgnoredException exp =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
- ExpectedException exp1 = addExpectedException(InterruptedException.class
+ IgnoredException exp1 =
IgnoredException.addIgnoredException(InterruptedException.class
.getName());
try {
Set<GatewaySender> senders = cache.getGatewaySenders();
@@ -1569,7 +1571,7 @@ public class WANTestBase extends DistributedTestCase{
+ " but actual entries: " + regionQueue.size();
}
};
- DistributedTestCase.waitForCriterion(wc, 120000, 500, true);
+ Wait.waitForCriterion(wc, 120000, 500, true);
}
ArrayList<Integer> stats = new ArrayList<Integer>();
stats.add(statistics.getEventQueueSize());
@@ -1871,7 +1873,7 @@ public class WANTestBase extends DistributedTestCase{
}
public static void waitForSenderRunningState(String senderId){
- final ExpectedException exln = addExpectedException("Could not connect");
+ final IgnoredException exln = IgnoredException.addIgnoredException("Could
not connect");
try {
Set<GatewaySender> senders = cache.getGatewaySenders();
final GatewaySender sender = getGatewaySenderById(senders, senderId);
@@ -1888,7 +1890,7 @@ public class WANTestBase extends DistributedTestCase{
return "Expected sender isRunning state to be true but is false";
}
};
- DistributedTestCase.waitForCriterion(wc, 300000, 500, true);
+ Wait.waitForCriterion(wc, 300000, 500, true);
} finally {
exln.remove();
}
@@ -1909,7 +1911,7 @@ public class WANTestBase extends DistributedTestCase{
return "Expected sender primary state to be true but is false";
}
};
- DistributedTestCase.waitForCriterion(wc, 10000, 1000, true);
+ Wait.waitForCriterion(wc, 10000, 1000, true);
}
private static GatewaySender getGatewaySenderById(Set<GatewaySender>
senders, String senderId) {
@@ -1951,7 +1953,7 @@ public class WANTestBase extends DistributedTestCase{
return "Expected seconadry map to be " + primaryUpdatesMap + " but it
is " + secondaryUpdatesMap;
}
};
- DistributedTestCase.waitForCriterion(wc, 300000, 500, true);
+ Wait.waitForCriterion(wc, 300000, 500, true);
}
public static HashMap checkQueue2(){
@@ -2038,7 +2040,7 @@ public class WANTestBase extends DistributedTestCase{
}
public static void addListenerOnBucketRegion(String regionName, int
numBuckets) {
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
test.addCacheListenerOnBucketRegion(regionName, numBuckets);
}
@@ -2053,7 +2055,7 @@ public class WANTestBase extends DistributedTestCase{
}
public static void addListenerOnQueueBucketRegion(String senderId, int
numBuckets) {
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
test.addCacheListenerOnQueueBucketRegion(senderId, numBuckets);
}
@@ -2082,17 +2084,17 @@ public class WANTestBase extends DistributedTestCase{
}
public static void addQueueListener(String senderId, boolean isParallel){
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
test.addCacheQueueListener(senderId, isParallel);
}
public static void addSecondQueueListener(String senderId, boolean
isParallel){
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
test.addSecondCacheQueueListener(senderId, isParallel);
}
public static void addListenerOnRegion(String regionName){
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
test.addCacheListenerOnRegion(regionName);
}
private void addCacheListenerOnRegion(String regionName){
@@ -2149,8 +2151,8 @@ public class WANTestBase extends DistributedTestCase{
}
public static void pauseSender(String senderId) {
- final ExpectedException exln = addExpectedException("Could not connect");
- ExpectedException exp = addExpectedException(ForceReattemptException.class
+ final IgnoredException exln = IgnoredException.addIgnoredException("Could
not connect");
+ IgnoredException exp =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
try {
Set<GatewaySender> senders = cache.getGatewaySenders();
@@ -2170,10 +2172,31 @@ public class WANTestBase extends DistributedTestCase{
exln.remove();
}
}
+
+ public static void pauseSenderAndWaitForDispatcherToPause(String senderId) {
+ final IgnoredException exln = IgnoredException.addIgnoredException("Could
not connect");
+ IgnoredException exp =
IgnoredException.addIgnoredException(ForceReattemptException.class
+ .getName());
+ try {
+ Set<GatewaySender> senders = cache.getGatewaySenders();
+ GatewaySender sender = null;
+ for (GatewaySender s : senders) {
+ if (s.getId().equals(senderId)) {
+ sender = s;
+ break;
+ }
+ }
+ sender.pause();
+
((AbstractGatewaySender)sender).getEventProcessor().waitForDispatcherToPause();
+ } finally {
+ exp.remove();
+ exln.remove();
+ }
+ }
public static void resumeSender(String senderId) {
- final ExpectedException exln = addExpectedException("Could not connect");
- ExpectedException exp = addExpectedException(ForceReattemptException.class
+ final IgnoredException exln = IgnoredException.addIgnoredException("Could
not connect");
+ IgnoredException exp =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
try {
Set<GatewaySender> senders = cache.getGatewaySenders();
@@ -2193,8 +2216,8 @@ public class WANTestBase extends DistributedTestCase{
}
public static void stopSender(String senderId) {
- final ExpectedException exln = addExpectedException("Could not connect");
- ExpectedException exp = addExpectedException(ForceReattemptException.class
+ final IgnoredException exln = IgnoredException.addIgnoredException("Could
not connect");
+ IgnoredException exp =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
try {
Set<GatewaySender> senders = cache.getGatewaySenders();
@@ -2235,7 +2258,7 @@ public class WANTestBase extends DistributedTestCase{
boolean isParallel, Integer maxMemory,
Integer batchSize, boolean isConflation, boolean isPersistent,
GatewayEventFilter filter, boolean isManulaStart) {
- final ExpectedException exln = addExpectedException("Could not connect");
+ final IgnoredException exln = IgnoredException.addIgnoredException("Could
not connect");
try {
File persistentDirectory = new File(dsName + "_disk_"
+ System.currentTimeMillis() + "_" + VM.getCurrentVMNum());
@@ -2300,7 +2323,7 @@ public class WANTestBase extends DistributedTestCase{
boolean isParallel, Integer maxMemory,
Integer batchSize, boolean isConflation, boolean isPersistent,
GatewayEventFilter filter, boolean isManulaStart, int numDispatchers,
OrderPolicy orderPolicy) {
- final ExpectedException exln = addExpectedException("Could not
connect");
+ final IgnoredException exln =
IgnoredException.addIgnoredException("Could not connect");
try {
File persistentDirectory = new File(dsName + "_disk_"
+ System.currentTimeMillis() + "_" +
VM.getCurrentVMNum());
@@ -2485,7 +2508,7 @@ public class WANTestBase extends DistributedTestCase{
List<GatewayEventFilter> eventfilters,
List<GatewayTransportFilter> tranportFilters, boolean isManulaStart,
boolean isDiskSync) {
- ExpectedException exp1 =
addExpectedException(RegionDestroyedException.class
+ IgnoredException exp1 =
IgnoredException.addIgnoredException(RegionDestroyedException.class
.getName());
try {
File persistentDirectory = new File(dsName + "_disk_"
@@ -2577,7 +2600,7 @@ public class WANTestBase extends DistributedTestCase{
else {
persistentDirectory = new File(dsStore);
}
- getLogWriter().info("The ds is : " + persistentDirectory.getName());
+ LogWriterUtils.getLogWriter().info("The ds is : " +
persistentDirectory.getName());
persistentDirectory.mkdir();
DiskStoreFactory dsf = cache.createDiskStoreFactory();
@@ -2599,12 +2622,12 @@ public class WANTestBase extends DistributedTestCase{
gateway.setPersistenceEnabled(true);
String dsname = dsf.setDiskDirs(dirs1).create(dsName).getName();
gateway.setDiskStoreName(dsname);
- getLogWriter().info("The DiskStoreName is : " + dsname);
+ LogWriterUtils.getLogWriter().info("The DiskStoreName is : " + dsname);
}
else {
DiskStore store = dsf.setDiskDirs(dirs1).create(dsName);
gateway.setDiskStoreName(store.getName());
- getLogWriter().info("The ds is : " + store.getName());
+ LogWriterUtils.getLogWriter().info("The ds is : " + store.getName());
}
gateway.setBatchConflationEnabled(isConflation);
gateway.create(dsName, remoteDsId);
@@ -2714,11 +2737,11 @@ public class WANTestBase extends DistributedTestCase{
return "Expected to wait for " + millisec + " millisec.";
}
};
- DistributedTestCase.waitForCriterion(wc, millisec, 500, false);
+ Wait.waitForCriterion(wc, millisec, 500, false);
}
public static int createReceiver(int locPort) {
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locPort
@@ -2744,10 +2767,10 @@ public class WANTestBase extends DistributedTestCase{
}
public static void createReceiverWithBindAddress(int locPort) {
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
- props.setProperty(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
+ props.setProperty(DistributionConfig.LOG_LEVEL_NAME,
LogWriterUtils.getDUnitLogLevel());
props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locPort
+ "]");
@@ -2765,7 +2788,7 @@ public class WANTestBase extends DistributedTestCase{
fail("Expected GatewayReciever Exception");
}
catch (GatewayReceiverException gRE){
- getLogWriter().fine("KBKBKB : got the GatewayReceiverException", gRE);
+ LogWriterUtils.getLogWriter().fine("KBKBKB : got the
GatewayReceiverException", gRE);
assertTrue(gRE.getMessage().contains("Failed to create server socket
on"));
}
catch (IOException e) {
@@ -2775,7 +2798,7 @@ public class WANTestBase extends DistributedTestCase{
}
}
public static int createReceiverWithSSL(int locPort) {
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
boolean gatewaySslenabled = true;
String gatewaySslprotocols = "any";
String gatewaySslciphers = "any";
@@ -2783,7 +2806,7 @@ public class WANTestBase extends DistributedTestCase{
Properties gemFireProps = new Properties();
- gemFireProps.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
+ gemFireProps.put(DistributionConfig.LOG_LEVEL_NAME,
LogWriterUtils.getDUnitLogLevel());
gemFireProps.put(DistributionConfig.GATEWAY_SSL_ENABLED_NAME,
String.valueOf(gatewaySslenabled));
gemFireProps.put(DistributionConfig.GATEWAY_SSL_PROTOCOLS_NAME,
gatewaySslprotocols);
gemFireProps.put(DistributionConfig.GATEWAY_SSL_CIPHERS_NAME,
gatewaySslciphers);
@@ -2800,7 +2823,7 @@ public class WANTestBase extends DistributedTestCase{
gemFireProps.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
gemFireProps.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" +
locPort + "]");
- getLogWriter().info("Starting cache ds with following properties \n" +
gemFireProps);
+ LogWriterUtils.getLogWriter().info("Starting cache ds with following
properties \n" + gemFireProps);
InternalDistributedSystem ds = test.getSystem(gemFireProps);
cache = CacheFactory.create(ds);
@@ -2831,7 +2854,7 @@ public class WANTestBase extends DistributedTestCase{
}
public static int createReceiverAfterCache(int locPort) {
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
fact.setStartPort(port);
@@ -2850,7 +2873,7 @@ public class WANTestBase extends DistributedTestCase{
}
public static void createReceiverAndServer(int locPort) {
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locPort
@@ -2880,7 +2903,7 @@ public class WANTestBase extends DistributedTestCase{
try {
server.start();
} catch (IOException e) {
- fail("Failed to start server ", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Failed to start server ",
e);
}
}
@@ -2896,13 +2919,13 @@ public class WANTestBase extends DistributedTestCase{
}
catch (IOException e) {
e.printStackTrace();
- fail("Failed to start GatewayRecevier on port " + port, e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Failed to start
GatewayRecevier on port " + port, e);
}
return port;
}
public static int createServer(int locPort) {
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locPort
@@ -2918,14 +2941,14 @@ public class WANTestBase extends DistributedTestCase{
try {
server.start();
} catch (IOException e) {
- fail("Failed to start server ", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Failed to start server ",
e);
}
return port;
}
public static void createClientWithLocator(int port0,String host,
String regionName) {
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
Properties props = new Properties();
props = new Properties();
props.setProperty("mcast-port", "0");
@@ -2954,13 +2977,13 @@ public class WANTestBase extends DistributedTestCase{
region = cache.createRegion(regionName, attrs);
region.registerInterest("ALL_KEYS");
assertNotNull(region);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Distributed Region " + regionName + " created Successfully :"
+ region.toString());
}
public static int createReceiver_PDX(int locPort) {
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
Properties props = new Properties();
props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0");
props.setProperty(DistributionConfig.LOCATORS_NAME, "localhost[" + locPort
+ "]");
@@ -2992,7 +3015,7 @@ public class WANTestBase extends DistributedTestCase{
}
public static void createReceiver2(int locPort) {
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
fact.setStartPort(port);
@@ -3013,9 +3036,9 @@ public class WANTestBase extends DistributedTestCase{
CacheTransactionManager txMgr = cache.getCacheTransactionManager();
txMgr.setDistributed(true);
- ExpectedException exp1 = addExpectedException(InterruptedException.class
+ IgnoredException exp1 =
IgnoredException.addIgnoredException(InterruptedException.class
.getName());
- ExpectedException exp2 = addExpectedException(GatewaySenderException.class
+ IgnoredException exp2 =
IgnoredException.addIgnoredException(GatewaySenderException.class
.getName());
try {
Region r = cache.getRegion(Region.SEPARATOR + regionName);
@@ -3035,9 +3058,9 @@ public class WANTestBase extends DistributedTestCase{
}
public static void doPuts(String regionName, int numPuts) {
- ExpectedException exp1 = addExpectedException(InterruptedException.class
+ IgnoredException exp1 =
IgnoredException.addIgnoredException(InterruptedException.class
.getName());
- ExpectedException exp2 = addExpectedException(GatewaySenderException.class
+ IgnoredException exp2 =
IgnoredException.addIgnoredException(GatewaySenderException.class
.getName());
try {
Region r = cache.getRegion(Region.SEPARATOR + regionName);
@@ -3138,7 +3161,7 @@ public class WANTestBase extends DistributedTestCase{
return "Looking for min size of region to be " + min;
}
};
- DistributedTestCase.waitForCriterion(wc, 30000, 5, false);
+ Wait.waitForCriterion(wc, 30000, 5, false);
r.destroyRegion();
}
@@ -3157,13 +3180,13 @@ public class WANTestBase extends DistributedTestCase{
return "Looking for min size of region to be " + min;
}
};
- DistributedTestCase.waitForCriterion(wc, 30000, 5, false);
+ Wait.waitForCriterion(wc, 30000, 5, false);
r.destroyRegion();
destroyFlag = false;
}
public static void localDestroyRegion(String regionName) {
- ExpectedException exp =
addExpectedException(PRLocallyDestroyedException.class
+ IgnoredException exp =
IgnoredException.addIgnoredException(PRLocallyDestroyedException.class
.getName());
try {
Region r = cache.getRegion(Region.SEPARATOR + regionName);
@@ -3200,11 +3223,11 @@ public class WANTestBase extends DistributedTestCase{
custKeyValues.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 + " }");
}
return custKeyValues;
}
@@ -3226,11 +3249,11 @@ public class WANTestBase extends DistributedTestCase{
}
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 + " }");
}
return orderKeyValues;
}
@@ -3249,11 +3272,11 @@ public class WANTestBase extends DistributedTestCase{
assertEquals(order, orderRegion.get(custid));
} catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"putOrderPartitionedRegionUsingCustId : failed while doing put
operation in OrderPartitionedRegion ",
e);
}
- getLogWriter().info("Order :- { " + custid + " : " + order + " }");
+ LogWriterUtils.getLogWriter().info("Order :- { " + custid + " : " +
order + " }");
}
return orderKeyValues;
}
@@ -3276,11 +3299,11 @@ public class WANTestBase extends DistributedTestCase{
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"updateOrderPartitionedRegion : failed while doing put operation
in OrderPartitionedRegion ",
e);
}
- getLogWriter().info("Order :- { " + orderId + " : " + order + " }");
+ LogWriterUtils.getLogWriter().info("Order :- { " + orderId + " : " +
order + " }");
}
}
return orderKeyValues;
@@ -3299,11 +3322,11 @@ public class WANTestBase extends DistributedTestCase{
assertEquals(order, orderRegion.get(custid));
orderKeyValues.put(custid, order);
} catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"updateOrderPartitionedRegionUsingCustId : failed while doing put
operation in OrderPartitionedRegion ",
e);
}
- getLogWriter().info("Order :- { " + custid + " : " + order + " }");
+ LogWriterUtils.getLogWriter().info("Order :- { " + custid + " : " +
order + " }");
}
return orderKeyValues;
}
@@ -3328,11 +3351,11 @@ public class WANTestBase extends DistributedTestCase{
shipmentKeyValue.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 + " }");
}
}
@@ -3377,11 +3400,11 @@ public class WANTestBase extends DistributedTestCase{
assertEquals(shipment, shipmentRegion.get(custid));
shipmentKeyValue.put(custid, shipment);
} catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"putShipmentPartitionedRegionUsingCustId : failed while doing put
operation in ShipmentPartitionedRegion ",
e);
}
- getLogWriter().info("Shipment :- { " + custid + " : " + shipment + " }");
+ LogWriterUtils.getLogWriter().info("Shipment :- { " + custid + " : " +
shipment + " }");
}
return shipmentKeyValue;
}
@@ -3406,11 +3429,11 @@ public class WANTestBase extends DistributedTestCase{
shipmentKeyValue.put(shipmentId, shipment);
}
catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"updateShipmentPartitionedRegion : failed while doing put
operation in ShipmentPartitionedRegion ",
e);
}
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Shipment :- { " + shipmentId + " : " + shipment + " }");
}
}
@@ -3431,11 +3454,11 @@ public class WANTestBase extends DistributedTestCase{
assertEquals(shipment, shipmentRegion.get(custid));
shipmentKeyValue.put(custid, shipment);
} catch (Exception e) {
- fail(
+ com.gemstone.gemfire.test.dunit.Assert.fail(
"updateShipmentPartitionedRegionUsingCustId : failed while doing
put operation in ShipmentPartitionedRegion ",
e);
}
- getLogWriter().info("Shipment :- { " + custid + " : " + shipment + " }");
+ LogWriterUtils.getLogWriter().info("Shipment :- { " + custid + " : " +
shipment + " }");
}
return shipmentKeyValue;
}
@@ -3471,7 +3494,7 @@ public class WANTestBase extends DistributedTestCase{
public static void doNextPuts(String regionName, int start, int numPuts) {
//waitForSitesToUpdate();
- ExpectedException exp = addExpectedException(CacheClosedException.class
+ IgnoredException exp =
IgnoredException.addIgnoredException(CacheClosedException.class
.getName());
try {
Region r = cache.getRegion(Region.SEPARATOR + regionName);
@@ -3553,7 +3576,7 @@ public class WANTestBase extends DistributedTestCase{
};
- DistributedTestCase.waitForCriterion(wc, 120000, 500, true);
+ Wait.waitForCriterion(wc, 120000, 500, true);
}
}
@@ -3647,9 +3670,9 @@ public class WANTestBase extends DistributedTestCase{
}
public static void validateRegionSize(String regionName, final int
regionSize) {
- ExpectedException exp = addExpectedException(ForceReattemptException.class
+ IgnoredException exp =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
- ExpectedException exp1 = addExpectedException(CacheClosedException.class
+ IgnoredException exp1 =
IgnoredException.addIgnoredException(CacheClosedException.class
.getName());
try {
@@ -3669,7 +3692,7 @@ public class WANTestBase extends DistributedTestCase{
+ " present region keyset " + r.keySet();
}
};
- DistributedTestCase.waitForCriterion(wc, 240000, 500, true);
+ Wait.waitForCriterion(wc, 240000, 500, true);
} finally {
exp.remove();
exp1.remove();
@@ -3733,7 +3756,7 @@ public class WANTestBase extends DistributedTestCase{
+ " but actual entries: " + eventsMap.size();
}
};
- DistributedTestCase.waitForCriterion(wc, 60000, 500, true); //TODO:Yogs
+ Wait.waitForCriterion(wc, 60000, 500, true); //TODO:Yogs
}
public static void validateCustomAsyncEventListener(String asyncQueueId,
@@ -3762,7 +3785,7 @@ public class WANTestBase extends DistributedTestCase{
+ " but actual entries: " + eventsMap.size();
}
};
- DistributedTestCase.waitForCriterion(wc, 60000, 500, true); // TODO:Yogs
+ Wait.waitForCriterion(wc, 60000, 500, true); // TODO:Yogs
Iterator<AsyncEvent> itr = eventsMap.values().iterator();
while (itr.hasNext()) {
@@ -3809,7 +3832,7 @@ public class WANTestBase extends DistributedTestCase{
+ size;
}
};
- DistributedTestCase.waitForCriterion(wc, 60000, 500, true);
+ Wait.waitForCriterion(wc, 60000, 500, true);
} else {
WaitCriterion wc = new WaitCriterion() {
@@ -3837,7 +3860,7 @@ public class WANTestBase extends DistributedTestCase{
+ size;
}
};
- DistributedTestCase.waitForCriterion(wc, 60000, 500, true);
+ Wait.waitForCriterion(wc, 60000, 500, true);
}
}
@@ -3860,7 +3883,7 @@ public class WANTestBase extends DistributedTestCase{
for (int bucketId : bucketIds) {
List<GatewaySenderEventImpl> eventsForBucket = bucketToEventsMap
.get(bucketId);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Events for bucket: " + bucketId + " is " + eventsForBucket);
assertNotNull(eventsForBucket);
for (int i = 0; i < batchSize; i++) {
@@ -3882,7 +3905,7 @@ public class WANTestBase extends DistributedTestCase{
final Map eventsMap = ((MyAsyncEventListener)theListener).getEventsMap();
assertNotNull(eventsMap);
- getLogWriter().info("The events map size is " + eventsMap.size());
+ LogWriterUtils.getLogWriter().info("The events map size is " +
eventsMap.size());
return eventsMap.size();
}
@@ -3916,9 +3939,9 @@ public class WANTestBase extends DistributedTestCase{
return "Expected region entries: " + regionSize + " but actual
entries: " + r.keySet().size() + " present region keyset " + r.keySet() ;
}
};
- DistributedTestCase.waitForCriterion(wc, 200000, 500, true);
+ Wait.waitForCriterion(wc, 200000, 500, true);
for(int i = 0 ; i < regionSize; i++){
- getLogWriter().info("For Key : Key_"+i + " : Values : " + r.get("Key_" +
i));
+ LogWriterUtils.getLogWriter().info("For Key : Key_"+i + " : Values : " +
r.get("Key_" + i));
assertEquals(new SimpleClass(i, (byte)i), r.get("Key_" + i));
}
}
@@ -3938,9 +3961,9 @@ public class WANTestBase extends DistributedTestCase{
return "Expected region entries: " + regionSize + " but actual
entries: " + r.keySet().size() + " present region keyset " + r.keySet() ;
}
};
- DistributedTestCase.waitForCriterion(wc, 200000, 500, true);
+ Wait.waitForCriterion(wc, 200000, 500, true);
for(int i = 0 ; i < regionSize; i++){
- getLogWriter().info("For Key : Key_"+i + " : Values : " + r.get("Key_" +
i));
+ LogWriterUtils.getLogWriter().info("For Key : Key_"+i + " : Values : " +
r.get("Key_" + i));
assertEquals(new SimpleClass1(false, (short) i, "" + i, i,"" +i ,""+
i,i, i), r.get("Key_" + i));
}
}
@@ -3948,7 +3971,7 @@ public class WANTestBase extends DistributedTestCase{
public static void validateQueueSizeStat(String id, final int queueSize) {
final AbstractGatewaySender sender = (AbstractGatewaySender)
cache.getGatewaySender(id);
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
@Override
public boolean done() {
@@ -4001,7 +4024,7 @@ public class WANTestBase extends DistributedTestCase{
return "Expected region size to remain same below a specified limit
but actual region size does not remain same or exceeded the specified limit " +
sameRegionSizeCounter + " :regionSize " + previousSize;
}
};
- DistributedTestCase.waitForCriterion(wc, 200000, 500, true);
+ Wait.waitForCriterion(wc, 200000, 500, true);
}
public static String getRegionFullPath(String regionName) {
@@ -4023,7 +4046,7 @@ public class WANTestBase extends DistributedTestCase{
public boolean done() {
for(Object key: keyValues.keySet()) {
if (!r.get(key).equals(keyValues.get(key))) {
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"The values are for key " + " " + key + " " + r.get(key)
+ " in the map " + keyValues.get(key));
return false;
@@ -4036,7 +4059,7 @@ public class WANTestBase extends DistributedTestCase{
return "Expected region entries doesn't match";
}
};
- DistributedTestCase.waitForCriterion(wc, 120000, 500, true);
+ Wait.waitForCriterion(wc, 120000, 500, true);
}
public static void CheckContent(String regionName, final int regionSize) {
@@ -4063,7 +4086,7 @@ public class WANTestBase extends DistributedTestCase{
return "Expected region entries: " + regionSize + " but actual
entries: " + r.keySet().size();
}
};
- DistributedTestCase.waitForCriterion(wc, 120000, 500, true);
+ Wait.waitForCriterion(wc, 120000, 500, true);
}
public static void verifyPrimaryStatus(final Boolean isPrimary) {
@@ -4083,7 +4106,7 @@ public class WANTestBase extends DistributedTestCase{
return "Expected sender to be : " + isPrimary.booleanValue() + " but
actually it is : " + sender.isPrimary();
}
};
- DistributedTestCase.waitForCriterion(wc, 120000, 500, true);
+ Wait.waitForCriterion(wc, 120000, 500, true);
}
public static Boolean getPrimaryStatus(){
@@ -4102,7 +4125,7 @@ public class WANTestBase extends DistributedTestCase{
return "Checking Primary Status";
}
};
- DistributedTestCase.waitForCriterion(wc, 10000, 500, false);
+ Wait.waitForCriterion(wc, 10000, 500, false);
return sender.isPrimary();
}
@@ -4170,10 +4193,10 @@ public class WANTestBase extends DistributedTestCase{
}
public static Boolean killSender(String senderId){
- final ExpectedException exln = addExpectedException("Could not connect");
- ExpectedException exp = addExpectedException(CacheClosedException.class
+ final IgnoredException exln = IgnoredException.addIgnoredException("Could
not connect");
+ IgnoredException exp =
IgnoredException.addIgnoredException(CacheClosedException.class
.getName());
- ExpectedException exp1 = addExpectedException(ForceReattemptException.class
+ IgnoredException exp1 =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
try {
Set<GatewaySender> senders = cache.getGatewaySenders();
@@ -4185,7 +4208,7 @@ public class WANTestBase extends DistributedTestCase{
}
}
if (sender.isPrimary()) {
- getLogWriter().info("Gateway sender is killed by a test");
+ LogWriterUtils.getLogWriter().info("Gateway sender is killed by a test");
cache.getDistributedSystem().disconnect();
return Boolean.TRUE;
}
@@ -4207,7 +4230,7 @@ public class WANTestBase extends DistributedTestCase{
}
}
if (queue.isPrimary()) {
- getLogWriter().info("AsyncEventQueue is killed by a test");
+ LogWriterUtils.getLogWriter().info("AsyncEventQueue is killed by a
test");
cache.getDistributedSystem().disconnect();
return Boolean.TRUE;
}
@@ -4215,10 +4238,10 @@ public class WANTestBase extends DistributedTestCase{
}
public static void killSender(){
- getLogWriter().info("Gateway sender is going to be killed by a test");
+ LogWriterUtils.getLogWriter().info("Gateway sender is going to be killed
by a test");
cache.close();
cache.getDistributedSystem().disconnect();
- getLogWriter().info("Gateway sender is killed by a test");
+ LogWriterUtils.getLogWriter().info("Gateway sender is killed by a test");
}
static void waitForSitesToUpdate() {
@@ -4230,7 +4253,7 @@ public class WANTestBase extends DistributedTestCase{
return "Waiting for all sites to get updated";
}
};
- DistributedTestCase.waitForCriterion(wc, 10000, 500, false);
+ Wait.waitForCriterion(wc, 10000, 500, false);
}
public static void checkAllSiteMetaData(
@@ -4281,7 +4304,7 @@ public class WANTestBase extends DistributedTestCase{
return "Making sure system is initialized";
}
};
- DistributedTestCase.waitForCriterion(wc, 50000, 1000, true);
+ Wait.waitForCriterion(wc, 50000, 1000, true);
assertNotNull(system);
// final Map<Integer,Set<DistributionLocatorId>> allSiteMetaData =
((DistributionConfigImpl)system
@@ -4320,7 +4343,7 @@ public class WANTestBase extends DistributedTestCase{
+ " but actual meta data: " + allSiteMetaData;
}
};
- DistributedTestCase.waitForCriterion(wc, 300000, 500, true);
+ Wait.waitForCriterion(wc, 300000, 500, true);
return System.currentTimeMillis();
}
@@ -4340,7 +4363,7 @@ public class WANTestBase extends DistributedTestCase{
.getLocatorDiscoveryCallback();
boolean discovered = callback.waitForDiscovery(locatorToWaitFor, MAX_WAIT);
- Assert.assertTrue(
+ assertTrue(
"Waited " + MAX_WAIT + " for " + locatorToWaitFor
+ " to be discovered on client. List is now: "
+ callback.getDiscovered(), discovered);
@@ -4348,9 +4371,9 @@ public class WANTestBase extends DistributedTestCase{
public static void validateQueueContents(final String senderId,
final int regionSize) {
- ExpectedException exp1 = addExpectedException(InterruptedException.class
+ IgnoredException exp1 =
IgnoredException.addIgnoredException(InterruptedException.class
.getName());
- ExpectedException exp2 = addExpectedException(GatewaySenderException.class
+ IgnoredException exp2 =
IgnoredException.addIgnoredException(GatewaySenderException.class
.getName());
try {
Set<GatewaySender> senders = cache.getGatewaySenders();
@@ -4384,7 +4407,7 @@ public class WANTestBase extends DistributedTestCase{
+ " but actual entries: " + size;
}
};
- DistributedTestCase.waitForCriterion(wc, 120000, 500, true);
+ Wait.waitForCriterion(wc, 120000, 500, true);
} else if (sender.isParallel()) {
final RegionQueue regionQueue;
@@ -4403,7 +4426,7 @@ public class WANTestBase extends DistributedTestCase{
+ " but actual entries: " + regionQueue.size();
}
};
- DistributedTestCase.waitForCriterion(wc, 120000, 500, true);
+ Wait.waitForCriterion(wc, 120000, 500, true);
}
} finally {
exp1.remove();
@@ -4468,7 +4491,7 @@ public class WANTestBase extends DistributedTestCase{
+ " but actual entries: " + size;
}
};
- DistributedTestCase.waitForCriterion(wc, 120000, 500, true);
+ Wait.waitForCriterion(wc, 120000, 500, true);
}
public static Integer getQueueContentSize(final String senderId) {
@@ -4516,9 +4539,9 @@ public class WANTestBase extends DistributedTestCase{
public static void validateParallelSenderQueueAllBucketsDrained(
final String senderId) {
- ExpectedException exp = addExpectedException(RegionDestroyedException.class
+ IgnoredException exp =
IgnoredException.addIgnoredException(RegionDestroyedException.class
.getName());
- ExpectedException exp1 = addExpectedException(ForceReattemptException.class
+ IgnoredException exp1 =
IgnoredException.addIgnoredException(ForceReattemptException.class
.getName());
try {
Set<GatewaySender> senders = cache.getGatewaySenders();
@@ -4537,7 +4560,7 @@ public class WANTestBase extends DistributedTestCase{
WaitCriterion wc = new WaitCriterion() {
public boolean done() {
if (bucket.keySet().size() == 0) {
- getLogWriter().info("Bucket " + bucket.getId() + " is empty");
+ LogWriterUtils.getLogWriter().info("Bucket " + bucket.getId() +
" is empty");
return true;
}
return false;
@@ -4551,7 +4574,7 @@ public class WANTestBase extends DistributedTestCase{
+ bucket.keySet();
}
};
- DistributedTestCase.waitForCriterion(wc, 180000, 50, true);
+ Wait.waitForCriterion(wc, 180000, 50, true);
}// for loop ends
} finally {
exp.remove();
@@ -5095,8 +5118,8 @@ public class WANTestBase extends DistributedTestCase{
}
}*/
- public void tearDown2() throws Exception {
- super.tearDown2();
+ @Override
+ protected final void preTearDown() throws Exception {
cleanupVM();
vm0.invoke(WANTestBase.class, "cleanupVM");
vm1.invoke(WANTestBase.class, "cleanupVM");
@@ -5122,7 +5145,7 @@ public class WANTestBase extends DistributedTestCase{
cache.getDistributedSystem().disconnect();
cache = null;
} else {
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
if (test.isConnectedToDS()) {
test.getSystem().disconnect();
}
@@ -5135,7 +5158,7 @@ public class WANTestBase extends DistributedTestCase{
}
public static void shutdownLocator() {
- WANTestBase test = new WANTestBase(testName);
+ WANTestBase test = new WANTestBase(getTestMethodName());
test.getSystem().disconnect();
}