You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by je...@apache.org on 2016/02/11 16:27:01 UTC
[37/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/distributed/LocatorDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
index de60132..545a0ea 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
@@ -52,10 +52,17 @@ import com.gemstone.gemfire.internal.logging.LocalLogWriter;
import com.gemstone.gemfire.internal.tcp.Connection;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* Tests the ability of the {@link Locator} API to start and stop
@@ -87,21 +94,21 @@ public class LocatorDUnitTest extends DistributedTestCase {
super.setUp();
port1 = -1;
port2 = -1;
- addExpectedException("Removing shunned member");
+ IgnoredException.addIgnoredException("Removing shunned member");
}
@Override
- public void tearDown2() {
+ protected final void preTearDown() throws Exception {
if (Locator.hasLocator()) {
Locator.getLocator().stop();
}
// delete locator state files so they don't accidentally
// get used by other tests
if (port1 > 0) {
- deleteLocatorStateFile(port1);
+ DistributedTestUtils.deleteLocatorStateFile(port1);
}
if (port2 > 0) {
- deleteLocatorStateFile(port2);
+ DistributedTestUtils.deleteLocatorStateFile(port2);
}
}
@@ -124,13 +131,13 @@ public class LocatorDUnitTest extends DistributedTestCase {
VM vm3 = host.getVM(3);
port1 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- deleteLocatorStateFile(port1);
+ DistributedTestUtils.deleteLocatorStateFile(port1);
- final String locators = getServerHostName(host) + "[" + port1 + "]";
+ final String locators = NetworkUtils.getServerHostName(host) + "[" + port1 + "]";
final Properties properties = new Properties();
properties.put("mcast-port", "0");
properties.put("start-locator", locators);
- properties.put("log-level", getDUnitLogLevel());
+ properties.put("log-level", LogWriterUtils.getDUnitLogLevel());
properties.put("security-peer-auth-init","com.gemstone.gemfire.distributed.AuthInitializer.create");
properties.put("security-peer-authenticator","com.gemstone.gemfire.distributed.MyAuthenticator.create");
properties.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
@@ -141,7 +148,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
DistributionManager.NORMAL_DM_TYPE, system.getDistributedMember().getVmKind());
properties.remove("start-locator");
- properties.put("log-level", getDUnitLogLevel());
+ properties.put("log-level", LogWriterUtils.getDUnitLogLevel());
properties.put("locators", locators);
SerializableRunnable startSystem = new SerializableRunnable("start system") {
public void run() {
@@ -184,7 +191,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
public void run() {
final DistributedLockService service = DistributedLockService.getServiceNamed("test service");
service.lock("foo3", 0, 0);
- waitForCriterion(new WaitCriterion() {
+ Wait.waitForCriterion(new WaitCriterion() {
@Override
public boolean done() {
return service.isLockGrantor();
@@ -200,13 +207,13 @@ public class LocatorDUnitTest extends DistributedTestCase {
});
properties.put("start-locator", locators);
- properties.put("log-level", getDUnitLogLevel());
+ properties.put("log-level", LogWriterUtils.getDUnitLogLevel());
system = (InternalDistributedSystem)DistributedSystem.connect(properties);
System.out.println("done connecting distributed system");
assertEquals("should be the coordinator", system.getDistributedMember(), MembershipManagerHelper.getCoordinator(system));
NetView view = MembershipManagerHelper.getMembershipManager(system).getView();
- getLogWriter().info("view after becoming coordinator is " + view);
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("view after becoming coordinator is " + view);
assertNotSame("should not be the first member in the view ("+view+")", system.getDistributedMember(), view.get(0));
service = DistributedLockService.create("test service", system);
@@ -254,9 +261,9 @@ public class LocatorDUnitTest extends DistributedTestCase {
this.port1 = port1;
final int port2 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
this.port2 = port2; // for cleanup in tearDown2
- deleteLocatorStateFile(port1);
- deleteLocatorStateFile(port2);
- final String host0 = getServerHostName(host);
+ DistributedTestUtils.deleteLocatorStateFile(port1);
+ DistributedTestUtils.deleteLocatorStateFile(port2);
+ final String host0 = NetworkUtils.getServerHostName(host);
final String locators = host0 + "[" + port1 + "]," +
host0 + "[" + port2 + "]";
final Properties properties = new Properties();
@@ -265,7 +272,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
properties.put("enable-network-partition-detection", "false");
properties.put("disable-auto-reconnect", "true");
properties.put("member-timeout", "2000");
- properties.put("log-level", getDUnitLogLevel());
+ properties.put("log-level", LogWriterUtils.getDUnitLogLevel());
properties.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
SerializableCallable startLocator1 = new SerializableCallable("start locator1") {
@@ -302,14 +309,14 @@ public class LocatorDUnitTest extends DistributedTestCase {
AsyncInvocation async2 = null;
try {
async2 = loc2.invokeAsync(startLocator2);
- pause(2000);
+ Wait.pause(2000);
async1 = loc1.invokeAsync(startLocator1);
} finally {
try {
if (async1 != null) {
async1.join(45000);
if (async1.isAlive()) {
- dumpAllStacks();
+ ThreadUtils.dumpAllStacks();
}
if (async2 != null) {
async2.join();
@@ -364,8 +371,8 @@ public class LocatorDUnitTest extends DistributedTestCase {
VM vm3 = host.getVM(3);
port1 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- deleteLocatorStateFile(port1);
- final String locators = getServerHostName(host) + "[" + port1 + "]";
+ DistributedTestUtils.deleteLocatorStateFile(port1);
+ final String locators = NetworkUtils.getServerHostName(host) + "[" + port1 + "]";
final Properties properties = new Properties();
properties.put("mcast-port", "0");
properties.put("locators", locators);
@@ -454,7 +461,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, timeout, 200, true);
+ Wait.waitForCriterion(ev, timeout, 200, true);
}
/**
@@ -475,7 +482,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
* (which is now the sole remaining member) shuts itself down.
*/
public void testLeadAndCoordFailure() throws Exception {
- addExpectedException("Possible loss of quorum due");
+ IgnoredException.addIgnoredException("Possible loss of quorum due");
disconnectAllFromDS();
Host host = Host.getHost(0);
VM vm1 = host.getVM(1);
@@ -487,8 +494,8 @@ public class LocatorDUnitTest extends DistributedTestCase {
this.port1 = port1;
final int port2 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
this.port2 = port2; // for cleanup in tearDown2()
- deleteLocatorStateFile(port1, port2);
- final String host0 = getServerHostName(host);
+ DistributedTestUtils.deleteLocatorStateFile(port1, port2);
+ final String host0 = NetworkUtils.getServerHostName(host);
final String locators = host0 + "[" + port1 + "]," +
host0 + "[" + port2 + "]";
final Properties properties = new Properties();
@@ -497,7 +504,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
properties.put("enable-network-partition-detection", "true");
properties.put("disable-auto-reconnect", "true");
properties.put("member-timeout", "2000");
- properties.put("log-level", getDUnitLogLevel());
+ properties.put("log-level", LogWriterUtils.getDUnitLogLevel());
// properties.put("log-level", "fine");
properties.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
@@ -515,7 +522,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
Locator.startLocatorAndDS(port2, lf, properties);
}
catch (IOException ios) {
- fail("Unable to start locator2", ios);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Unable to start locator2", ios);
}
}
});
@@ -546,7 +553,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
assertEquals(sys.getDistributedMember(), MembershipManagerHelper.getCoordinator(sys));
// crash the second vm and the locator. Should be okay
- crashDistributedSystem(vm2);
+ DistributedTestUtils.crashDistributedSystem(vm2);
locvm.invoke(crashLocator);
assertTrue("Distributed system should not have disconnected",
@@ -559,14 +566,14 @@ public class LocatorDUnitTest extends DistributedTestCase {
// disconnect the first vm and demonstrate that the third vm and the
// locator notice the failure and exit
- crashDistributedSystem(vm1);
+ DistributedTestUtils.crashDistributedSystem(vm1);
/* This vm is watching vm1, which is watching vm2 which is watching locvm.
* It will take 3 * (3 * member-timeout) milliseconds to detect the full
* failure and eject the lost members from the view.
*/
- getLogWriter().info("waiting for my distributed system to disconnect due to partition detection");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("waiting for my distributed system to disconnect due to partition detection");
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
return !sys.isConnected();
@@ -575,7 +582,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 12 * 2000, 200, true);
+ Wait.waitForCriterion(ev, 12 * 2000, 200, true);
if (sys.isConnected()) {
fail("Distributed system did not disconnect as expected - network partition detection is broken");
}
@@ -622,8 +629,8 @@ public class LocatorDUnitTest extends DistributedTestCase {
this.port1 = port1;
final int port2 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
this.port2 = port2;
- deleteLocatorStateFile(port1, port2);
- final String host0 = getServerHostName(host);
+ DistributedTestUtils.deleteLocatorStateFile(port1, port2);
+ final String host0 = NetworkUtils.getServerHostName(host);
final String locators = host0 + "[" + port1 + "],"
+ host0 + "[" + port2 + "]";
final Properties properties = new Properties();
@@ -649,7 +656,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
MembershipManagerHelper.inhibitForcedDisconnectLogging(true);
}
catch (IOException ios) {
- fail("Unable to start locator2", ios);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Unable to start locator2", ios);
}
}
});
@@ -683,7 +690,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
// crash the lead vm. Should be okay
vm1.invoke(crashSystem);
- pause(4 * 2000); // 4 x the member-timeout
+ Wait.pause(4 * 2000); // 4 x the member-timeout
assertTrue("Distributed system should not have disconnected",
isSystemConnected());
@@ -699,7 +706,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
if (!Locator.getLocators().isEmpty()) {
// log this for debugging purposes before throwing assertion error
- getLogWriter().warning("found locator " + Locator.getLocators().iterator().next());
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().warning("found locator " + Locator.getLocators().iterator().next());
}
assertTrue("locator is not stopped", Locator.getLocators().isEmpty());
@@ -737,7 +744,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
try {
locvm.invoke(stopLocator);
} catch (Exception e) {
- getLogWriter().severe("failed to stop locator in vm 3", e);
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().severe("failed to stop locator in vm 3", e);
}
}
}
@@ -769,8 +776,8 @@ public class LocatorDUnitTest extends DistributedTestCase {
this.port1 = port1;
final int port2 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
this.port2 = port2;
- deleteLocatorStateFile(port1, port2);
- final String host0 = getServerHostName(host);
+ DistributedTestUtils.deleteLocatorStateFile(port1, port2);
+ final String host0 = NetworkUtils.getServerHostName(host);
final String locators = host0 + "[" + port1 + "]," + host0 + "[" + port2 + "]";
final Properties properties = new Properties();
@@ -779,7 +786,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
properties.put("enable-network-partition-detection", "true");
properties.put("disable-auto-reconnect", "true");
properties.put("member-timeout", "2000");
- properties.put("log-level", getDUnitLogLevel());
+ properties.put("log-level", LogWriterUtils.getDUnitLogLevel());
properties.put(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
SerializableRunnable stopLocator = getStopLocatorRunnable();
@@ -796,7 +803,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
Locator.startLocatorAndDS(port2, lf, properties);
}
catch (IOException ios) {
- fail("Unable to start locator2", ios);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Unable to start locator2", ios);
}
}
});
@@ -847,7 +854,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
vm2.invokeAsync(crashSystem);
- pause(1000); // 4 x the member-timeout
+ Wait.pause(1000); // 4 x the member-timeout
// request member removal for first peer from second peer.
vm2.invoke(new SerializableRunnable("Request Member Removal") {
@@ -908,8 +915,8 @@ public class LocatorDUnitTest extends DistributedTestCase {
this.port1 = port1;
final int port2 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
this.port2 = port2;
- deleteLocatorStateFile(port1, port2);
- final String host0 = getServerHostName(host);
+ DistributedTestUtils.deleteLocatorStateFile(port1, port2);
+ final String host0 = NetworkUtils.getServerHostName(host);
final String locators = host0 + "[" + port1 + "],"
+ host0 + "[" + port2 + "]";
final Properties properties = new Properties();
@@ -945,7 +952,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
Locator.startLocatorAndDS(port2, lf, properties);
}
catch (IOException ios) {
- fail("Unable to start locator1", ios);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Unable to start locator1", ios);
}
}
});
@@ -986,7 +993,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
// crash the lead locator. Should be okay
locvm.invoke(crashLocator);
- pause(10 * 1000);
+ Wait.pause(10 * 1000);
assertTrue("Distributed system should not have disconnected",
sys.isConnected());
@@ -1000,7 +1007,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
// disconnect the first vm and demonstrate that the non-lead vm and the
// locator notice the failure and continue to run
vm1.invoke(disconnect);
- pause(10 * 1000);
+ Wait.pause(10 * 1000);
assertTrue("Distributed system should not have disconnected",
vm2.invokeBoolean(LocatorDUnitTest.class, "isSystemConnected"));
@@ -1029,8 +1036,8 @@ public class LocatorDUnitTest extends DistributedTestCase {
Host host = Host.getHost(0);
int port =
AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- deleteLocatorStateFile(port1);
- String locators = getServerHostName(host) + "[" + port + "]";
+ DistributedTestUtils.deleteLocatorStateFile(port1);
+ String locators = NetworkUtils.getServerHostName(host) + "[" + port + "]";
Properties props = new Properties();
props.setProperty("mcast-port", "0");
props.setProperty("locators", locators);
@@ -1061,7 +1068,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
} catch (Exception ex) {
// if you see this fail, determine if unexpected exception is expected
// if expected then add in a catch block for it above this catch
- fail("Failed with unexpected exception", ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Failed with unexpected exception", ex);
}
finally {
if (oldValue == null) {
@@ -1092,8 +1099,8 @@ public class LocatorDUnitTest extends DistributedTestCase {
final int port =
AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- deleteLocatorStateFile(port1);
- final String locators = getServerHostName(host) + "[" + port + "]";
+ DistributedTestUtils.deleteLocatorStateFile(port1);
+ final String locators = NetworkUtils.getServerHostName(host) + "[" + port + "]";
final String uniqueName = getUniqueName();
vm0.invoke(new SerializableRunnable("Start locator " + locators) {
@@ -1106,7 +1113,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
Locator.startLocatorAndDS(port, logFile, locProps);
} catch (IOException ex) {
- fail("While starting locator on port " + port, ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While starting locator on port " + port, ex);
}
}
});
@@ -1132,7 +1139,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
system = (InternalDistributedSystem)DistributedSystem.connect(props);
final DistributedMember coord = MembershipManagerHelper.getCoordinator(system);
- getLogWriter().info("coordinator before termination of locator is " + coord);
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("coordinator before termination of locator is " + coord);
vm0.invoke(getStopLocatorRunnable());
@@ -1146,9 +1153,9 @@ public class LocatorDUnitTest extends DistributedTestCase {
MembershipManagerHelper.getCoordinator(system);
}
};
- DistributedTestCase.waitForCriterion(ev, 15 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 15 * 1000, 200, true);
DistributedMember newCoord = MembershipManagerHelper.getCoordinator(system);
- getLogWriter().info("coordinator after shutdown of locator was " +
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("coordinator after shutdown of locator was " +
newCoord);
if (coord.equals(newCoord)) {
fail("another member should have become coordinator after the locator was stopped");
@@ -1204,8 +1211,8 @@ public class LocatorDUnitTest extends DistributedTestCase {
final int port =
AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- deleteLocatorStateFile(port1);
- final String locators = getServerHostName(host) + "[" + port + "]";
+ DistributedTestUtils.deleteLocatorStateFile(port1);
+ final String locators = NetworkUtils.getServerHostName(host) + "[" + port + "]";
vm0.invoke(getStartSBLocatorRunnable(port, getUniqueName()+"1"));
try {
@@ -1229,7 +1236,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
system = (InternalDistributedSystem)getSystem(props);
final DistributedMember coord = MembershipManagerHelper.getCoordinator(system);
- getLogWriter().info("coordinator before termination of locator is " + coord);
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("coordinator before termination of locator is " + coord);
vm0.invoke(getStopLocatorRunnable());
@@ -1243,9 +1250,9 @@ public class LocatorDUnitTest extends DistributedTestCase {
MembershipManagerHelper.getCoordinator(system);
}
};
- DistributedTestCase.waitForCriterion(ev, 15000, 200, true);
+ Wait.waitForCriterion(ev, 15000, 200, true);
DistributedMember newCoord = MembershipManagerHelper.getCoordinator(system);
- getLogWriter().info("coordinator after shutdown of locator was " +
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("coordinator after shutdown of locator was " +
newCoord);
if (newCoord == null || coord.equals(newCoord)) {
fail("another member should have become coordinator after the locator was stopped: "
@@ -1267,7 +1274,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 5000, 200, true);
+ Wait.waitForCriterion(ev, 5000, 200, true);
system.disconnect();
LogWriter bgexecLogger =
@@ -1337,8 +1344,8 @@ public class LocatorDUnitTest extends DistributedTestCase {
this.port1 = port1;
final int port2 = freeTCPPorts[1];
this.port2 = port2;
- deleteLocatorStateFile(port1, port2);
- final String host0 = getServerHostName(host);
+ DistributedTestUtils.deleteLocatorStateFile(port1, port2);
+ final String host0 = NetworkUtils.getServerHostName(host);
final String locators = host0 + "[" + port1 + "]," +
host0 + "[" + port2 + "]";
@@ -1355,7 +1362,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
try {
Locator.startLocatorAndDS(port1, logFile, dsProps);
} catch (IOException ex) {
- fail("While starting locator on port " + port1, ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While starting locator on port " + port1, ex);
}
}
});
@@ -1370,7 +1377,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
Locator.startLocatorAndDS(port2, logFile, dsProps);
} catch (IOException ex) {
- fail("While starting locator on port " + port2, ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While starting locator on port " + port2, ex);
}
}
});
@@ -1409,7 +1416,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 10 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 10 * 1000, 200, true);
// three applications plus
assertEquals(5, system.getDM().getViewMembers().size());
@@ -1441,7 +1448,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
*/
public void testMultipleMcastLocators() throws Exception {
disconnectAllFromDS();
- addExpectedException("Could not stop Distribution Locator"); // shutdown timing issue in InternalLocator
+ IgnoredException.addIgnoredException("Could not stop Distribution Locator"); // shutdown timing issue in InternalLocator
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -1453,10 +1460,10 @@ public class LocatorDUnitTest extends DistributedTestCase {
this.port1 = port1;
final int port2 = freeTCPPorts[1];
this.port2 = port2;
- deleteLocatorStateFile(port1, port2);
+ DistributedTestUtils.deleteLocatorStateFile(port1, port2);
final int mcastport = AvailablePort.getRandomAvailablePort(AvailablePort.MULTICAST);
- final String host0 = getServerHostName(host);
+ final String host0 = NetworkUtils.getServerHostName(host);
final String locators = host0 + "[" + port1 + "]," +
host0 + "[" + port2 + "]";
final String uniqueName = getUniqueName();
@@ -1468,7 +1475,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
Properties props = new Properties();
props.setProperty("mcast-port", String.valueOf(mcastport));
props.setProperty("locators", locators);
- props.setProperty("log-level", getDUnitLogLevel());
+ props.setProperty("log-level", LogWriterUtils.getDUnitLogLevel());
props.setProperty("mcast-ttl", "0");
props.setProperty("enable-network-partition-detection", "true");
props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
@@ -1476,7 +1483,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
Locator.startLocatorAndDS(port1, logFile, null, props);
}
catch (IOException ex) {
- fail("While starting locator on port " + port1, ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While starting locator on port " + port1, ex);
}
}
});
@@ -1487,14 +1494,14 @@ public class LocatorDUnitTest extends DistributedTestCase {
Properties props = new Properties();
props.setProperty("mcast-port", String.valueOf(mcastport));
props.setProperty("locators", locators);
- props.setProperty("log-level", getDUnitLogLevel());
+ props.setProperty("log-level", LogWriterUtils.getDUnitLogLevel());
props.setProperty("mcast-ttl", "0");
props.setProperty("enable-network-partition-detection", "true");
props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
Locator.startLocatorAndDS(port2, logFile, null, props);
}
catch (IOException ex) {
- fail("While starting locator on port " + port2, ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While starting locator on port " + port2, ex);
}
}
});
@@ -1505,7 +1512,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
Properties props = new Properties();
props.setProperty("mcast-port", String.valueOf(mcastport));
props.setProperty("locators", locators);
- props.setProperty("log-level", getDUnitLogLevel());
+ props.setProperty("log-level", LogWriterUtils.getDUnitLogLevel());
props.setProperty("mcast-ttl", "0");
props.setProperty("enable-network-partition-detection", "true");
DistributedSystem.connect(props);
@@ -1518,7 +1525,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
Properties props = new Properties();
props.setProperty("mcast-port", String.valueOf(mcastport));
props.setProperty("locators", locators);
- props.setProperty("log-level", getDUnitLogLevel());
+ props.setProperty("log-level", LogWriterUtils.getDUnitLogLevel());
props.setProperty("mcast-ttl", "0");
props.setProperty("enable-network-partition-detection", "true");
@@ -1529,7 +1536,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
return system.getDM().getViewMembers().size() == 5;
}
catch (Exception e) {
- fail("unexpected exception", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("unexpected exception", e);
}
return false; // NOTREACHED
}
@@ -1537,7 +1544,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
return "waiting for 5 members - have " + system.getDM().getViewMembers().size();
}
};
- DistributedTestCase.waitForCriterion(ev, WAIT2_MS, 200, true);
+ Wait.waitForCriterion(ev, WAIT2_MS, 200, true);
system.disconnect();
SerializableRunnable disconnect =
@@ -1573,12 +1580,12 @@ public class LocatorDUnitTest extends DistributedTestCase {
port1 =
AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- deleteLocatorStateFile(port1);
+ DistributedTestUtils.deleteLocatorStateFile(port1);
File logFile = new File("");
Locator locator = Locator.startLocator(port1, logFile);
try {
- final String locators = getServerHostName(host) + "[" + port1 + "]";
+ final String locators = NetworkUtils.getServerHostName(host) + "[" + port1 + "]";
Properties props = new Properties();
props.setProperty("mcast-port", "0");
@@ -1603,8 +1610,8 @@ public class LocatorDUnitTest extends DistributedTestCase {
try {
port1 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- deleteLocatorStateFile(port1);
- final String locators = getServerHostName(host) + "[" + port1 + "]";
+ DistributedTestUtils.deleteLocatorStateFile(port1);
+ final String locators = NetworkUtils.getServerHostName(host) + "[" + port1 + "]";
final Properties properties = new Properties();
properties.put("mcast-port", "0");
properties.put("locators", locators);
@@ -1680,7 +1687,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
port1 =
AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
File logFile1 = new File("");
- deleteLocatorStateFile(port1);
+ DistributedTestUtils.deleteLocatorStateFile(port1);
Locator locator1 = Locator.startLocator(port1, logFile1);
try {
@@ -1689,7 +1696,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
File logFile2 = new File("");
- deleteLocatorStateFile(port2);
+ DistributedTestUtils.deleteLocatorStateFile(port2);
try {
Locator locator2 = Locator.startLocator(port2, logFile2);
@@ -1697,7 +1704,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
} catch (IllegalStateException expected) {
}
- final String host0 = getServerHostName(host);
+ final String host0 = NetworkUtils.getServerHostName(host);
final String locators = host0 + "[" + port1 + "]," +
host0 + "[" + port2 + "]";
@@ -1707,7 +1714,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
Properties props = new Properties();
props.setProperty("mcast-port", "0");
props.setProperty("locators", locators);
- props.setProperty("log-level", getDUnitLogLevel());
+ props.setProperty("log-level", LogWriterUtils.getDUnitLogLevel());
DistributedSystem.connect(props);
}
};
@@ -1742,7 +1749,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
disconnectAllFromDS();
port1 =
AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
- deleteLocatorStateFile(port1);
+ DistributedTestUtils.deleteLocatorStateFile(port1);
File logFile = new File("");
File stateFile = new File("locator"+port1+"state.dat");
VM vm0 = Host.getHost(0).getVM(0);
@@ -1754,7 +1761,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
stateFile.delete();
}
- getLogWriter().info("Starting locator");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Starting locator");
Locator locator = Locator.startLocatorAndDS(port1, logFile, p);
try {
@@ -1766,10 +1773,10 @@ public class LocatorDUnitTest extends DistributedTestCase {
};
vm0.invoke(connect);
- getLogWriter().info("Stopping locator");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Stopping locator");
locator.stop();
- getLogWriter().info("Starting locator");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Starting locator");
locator = Locator.startLocatorAndDS(port1, logFile, p);
vm0.invoke(new SerializableRunnable("disconnect") {
@@ -1828,10 +1835,10 @@ public class LocatorDUnitTest extends DistributedTestCase {
System.setProperty("p2p.joinTimeout", "1000");
Properties locProps = new Properties();
locProps.put("mcast-port", "0");
- locProps.put("log-level", getDUnitLogLevel());
+ locProps.put("log-level", LogWriterUtils.getDUnitLogLevel());
Locator.startLocatorAndDS(port, logFile, locProps);
} catch (IOException ex) {
- fail("While starting locator on port " + port, ex);
+ com.gemstone.gemfire.test.dunit.Assert.fail("While starting locator on port " + port, ex);
}
finally {
System.getProperties().remove(InternalLocator.LOCATORS_PREFERRED_AS_COORDINATORS);
@@ -1866,7 +1873,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
long giveUp = System.currentTimeMillis() + 30000;
if (cause instanceof ForcedDisconnectException) {
while (unboundedWait && System.currentTimeMillis() < giveUp) {
- pause(1000);
+ Wait.pause(1000);
}
} else {
cause.printStackTrace();
@@ -1895,7 +1902,7 @@ public class LocatorDUnitTest extends DistributedTestCase {
public void quorumLost(Set<InternalDistributedMember> failures,
List<InternalDistributedMember> remaining) {
quorumLostInvoked = true;
- getLogWriter().info("quorumLost invoked in test code");
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("quorumLost invoked in test code");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorJUnitTest.java
index c369f19..3c80d9a 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/LocatorJUnitTest.java
@@ -51,7 +51,6 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID;
import com.gemstone.gemfire.management.internal.JmxManagerAdvisor.JmxManagerProfile;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
@Category(IntegrationTest.class)
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/SystemAdminDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/SystemAdminDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/SystemAdminDUnitTest.java
index 42d4ed1..64014de 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/SystemAdminDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/SystemAdminDUnitTest.java
@@ -29,7 +29,9 @@ import java.util.Properties;
import com.gemstone.gemfire.distributed.internal.DistributionManager;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.internal.SystemAdmin;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
public class SystemAdminDUnitTest extends DistributedTestCase {
@@ -43,9 +45,8 @@ public class SystemAdminDUnitTest extends DistributedTestCase {
disconnect();
}
- @Override
- public void tearDown2() throws Exception {
- super.tearDown2();
+ @Override
+ protected final void preTearDown() throws Exception {
disconnect();
}
@@ -54,7 +55,7 @@ public class SystemAdminDUnitTest extends DistributedTestCase {
system = null;
InternalDistributedSystem sys = InternalDistributedSystem.getAnyInstance();
if (sys != null && sys.isConnected()) {
- getLogWriter().info("disconnecting(3)");
+ LogWriterUtils.getLogWriter().info("disconnecting(3)");
sys.disconnect();
}
}
@@ -62,7 +63,7 @@ public class SystemAdminDUnitTest extends DistributedTestCase {
public void testPrintStacks() throws Exception {
// create a gemfire.properties that lets SystemAdmin find the dunit locator
- Properties p = getAllDistributedSystemProperties(getDistributedSystemProperties());
+ Properties p = DistributedTestUtils.getAllDistributedSystemProperties(getDistributedSystemProperties());
try {
SystemAdmin.setDistributedSystemProperties(p);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/Bug40751DUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/Bug40751DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/Bug40751DUnitTest.java
index cedf650..e98c608 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/Bug40751DUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/Bug40751DUnitTest.java
@@ -36,6 +36,7 @@ import com.gemstone.gemfire.cache.SubscriptionAttributes;
import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.internal.cache.lru.Sizeable;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -47,11 +48,9 @@ public class Bug40751DUnitTest extends CacheTestCase {
}
@Override
- public void tearDown2() throws Exception {
- super.tearDown2();
+ protected final void postTearDownCacheTestCase() throws Exception {
disconnectAllFromDS();
}
-
public void testRR() {
System.setProperty("p2p.nodirectBuffers", "true");
@@ -95,7 +94,7 @@ public class Bug40751DUnitTest extends CacheTestCase {
vm1.invoke(createEmptyRegion);
} finally {
- invokeInEveryVM(new SerializableCallable() {
+ Invoke.invokeInEveryVM(new SerializableCallable() {
public Object call() throws Exception {
System.getProperties().remove("p2p.oldIO");
System.getProperties().remove("p2p.nodirectBuffers");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/ConsoleDistributionManagerDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/ConsoleDistributionManagerDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/ConsoleDistributionManagerDUnitTest.java
index 6872f32..166d5ac 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/ConsoleDistributionManagerDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/ConsoleDistributionManagerDUnitTest.java
@@ -42,10 +42,13 @@ import com.gemstone.gemfire.internal.admin.GfManagerAgentConfig;
import com.gemstone.gemfire.internal.admin.GfManagerAgentFactory;
import com.gemstone.gemfire.internal.admin.StatResource;
import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig;
-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.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* This class tests the functionality of the {@linkplain com.gemstone.gemfire.internal.admin internal
@@ -64,13 +67,13 @@ public class ConsoleDistributionManagerDUnitTest
// private volatile Alert lastAlert = null;
public void alert(Alert alert) {
- getLogWriter().info("DEBUG: alert=" + alert);
+ LogWriterUtils.getLogWriter().info("DEBUG: alert=" + alert);
// this.lastAlert = alert;
}
public void setUp() throws Exception {
boolean finishedSetup = false;
- addExpectedException("Error occurred while reading system log");
+ IgnoredException.addIgnoredException("Error occurred while reading system log");
try {
if (firstTime) {
disconnectFromDS(); //make sure there's no ldm lying around
@@ -94,7 +97,7 @@ public class ConsoleDistributionManagerDUnitTest
}
// create a GfManagerAgent in the master vm.
this.agent = GfManagerAgentFactory.
- getManagerAgent(new GfManagerAgentConfig(null, transport, getLogWriter(), Alert.SEVERE, this, null));
+ getManagerAgent(new GfManagerAgentConfig(null, transport, LogWriterUtils.getLogWriter(), Alert.SEVERE, this, null));
if (!agent.isConnected()) {
WaitCriterion ev = new WaitCriterion() {
public boolean done() {
@@ -104,7 +107,7 @@ public class ConsoleDistributionManagerDUnitTest
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
}
finishedSetup = true;
} finally {
@@ -119,7 +122,7 @@ public class ConsoleDistributionManagerDUnitTest
catch (Throwable ignore) {
}
try {
- super.tearDown2();
+ super.preTearDown();
}
catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
@@ -141,21 +144,17 @@ public class ConsoleDistributionManagerDUnitTest
}
}
- public void tearDown2() throws Exception {
-
+ @Override
+ protected final void preTearDownCacheTestCase() throws Exception {
+ this.agent.disconnect();
+ }
+
+ @Override
+ protected final void postTearDownCacheTestCase() throws Exception {
try {
-
- this.agent.disconnect();
- super.tearDown2();
-
- // Clean up "admin-only" distribution manager
disconnectFromDS(); //make sure there's no ldm lying around
-
- }
- finally {
-
+ } finally {
DistributionManager.isDedicatedAdminVM = false;
-
}
}
@@ -189,7 +188,7 @@ public class ConsoleDistributionManagerDUnitTest
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
}
//final Serializable controllerId = getSystem().getDistributionManager().getId(); //can't do this...
@@ -249,7 +248,7 @@ public class ConsoleDistributionManagerDUnitTest
Region[] roots = apps[i].getRootRegions();
if (roots.length == 0) {
- getLogWriter().info("DEBUG: testApplications: apps[" + i + "]=" + apps[i] + " did not have a root region");
+ LogWriterUtils.getLogWriter().info("DEBUG: testApplications: apps[" + i + "]=" + apps[i] + " did not have a root region");
} else {
Region root = roots[0];
assertNotNull(root);
@@ -290,7 +289,7 @@ public class ConsoleDistributionManagerDUnitTest
assertTrue(!node.isPrimitiveOrString());
EntryValueNode[] fields = node.getChildren();
assertNotNull(fields);
- getLogWriter().warning("The tests use StringBuffers for values which might be implmented differently in jdk 1.5");
+ LogWriterUtils.getLogWriter().warning("The tests use StringBuffers for values which might be implmented differently in jdk 1.5");
// assertTrue(fields.length > 0);
/// test destruction in the last valid app
@@ -314,7 +313,7 @@ public class ConsoleDistributionManagerDUnitTest
return "Waited 20 seconds for region " + r.getFullPath() + "to be destroyed.";
}
};
- DistributedTestCase.waitForCriterion(ev, 20 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 20 * 1000, 200, true);
}
}
}
@@ -367,7 +366,7 @@ public class ConsoleDistributionManagerDUnitTest
region.create(entryName, value);
- getLogWriter().info("Put value " + value + " in entry " +
+ LogWriterUtils.getLogWriter().info("Put value " + value + " in entry " +
entryName + " in region '" +
region.getFullPath() +"'");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisorDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisorDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisorDUnitTest.java
index 98bfbbd..8e238ac 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisorDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionAdvisorDUnitTest.java
@@ -25,6 +25,7 @@ import java.util.Set;
import com.gemstone.gemfire.CancelCriterion;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
/**
@@ -43,7 +44,7 @@ public class DistributionAdvisorDUnitTest extends DistributedTestCase {
public void setUp() throws Exception {
super.setUp();
// connect to distributed system in every VM
- invokeInEveryVM(new SerializableRunnable("DistributionAdvisorDUnitTest: SetUp") {
+ Invoke.invokeInEveryVM(new SerializableRunnable("DistributionAdvisorDUnitTest: SetUp") {
public void run() {
getSystem();
}
@@ -81,9 +82,9 @@ public class DistributionAdvisorDUnitTest extends DistributedTestCase {
new DistributionAdvisor.Profile[profileList.size()]);
}
- public void tearDown2() throws Exception {
+ @Override
+ protected final void preTearDown() throws Exception {
this.advisor.close();
- super.tearDown2();
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java
index 3da075f..2164fdc 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java
@@ -48,8 +48,12 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershi
import com.gemstone.gemfire.internal.logging.LogService;
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.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
* This class tests the functionality of the {@link
@@ -147,7 +151,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
mgr = MembershipManagerHelper.getMembershipManager(sys);
sys.disconnect();
InternalDistributedMember idm2 = mgr.getLocalMember();
- getLogWriter().info("original ID=" + idm +
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("original ID=" + idm +
" and after connecting=" + idm2);
assertTrue("should not have used a different udp port",
idm.getPort() == idm2.getPort());
@@ -172,7 +176,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
try {
InternalDistributedMember mbr = new InternalDistributedMember(
- DistributedTestCase.getIPLiteral(), 12345);
+ NetworkUtils.getIPLiteral(), 12345);
// first make sure we can't add this as a surprise member (bug #44566)
@@ -182,8 +186,8 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
int oldViewId = mbr.getVmViewId();
mbr.setVmViewId((int)mgr.getView().getViewId()-1);
- getLogWriter().info("current membership view is " + mgr.getView());
- getLogWriter().info("created ID " + mbr + " with view ID " + mbr.getVmViewId());
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("current membership view is " + mgr.getView());
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("created ID " + mbr + " with view ID " + mbr.getVmViewId());
sys.getLogWriter().info("<ExpectedException action=add>attempt to add old member</ExpectedException>");
sys.getLogWriter().info("<ExpectedException action=add>Removing shunned GemFire node</ExpectedException>");
try {
@@ -283,7 +287,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
public void run() {
props.setProperty(DistributionConfig.NAME_NAME, "sleeper");
getSystem(props);
- addExpectedException("elapsed while waiting for replies");
+ IgnoredException.addIgnoredException("elapsed while waiting for replies");
RegionFactory rf = new RegionFactory();
Region r = rf.setScope(Scope.DISTRIBUTED_ACK)
.setDataPolicy(DataPolicy.REPLICATE)
@@ -397,7 +401,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
*/
public void testKickOutSickMember() throws Exception {
disconnectAllFromDS();
- addExpectedException("10 seconds have elapsed while waiting");
+ IgnoredException.addIgnoredException("10 seconds have elapsed while waiting");
Host host = Host.getHost(0);
// VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -460,7 +464,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
}
};
// if this fails it means the sick member wasn't kicked out and something is wrong
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
ev = new WaitCriterion() {
public boolean done() {
@@ -470,7 +474,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 20 * 1000, 200, false);
+ Wait.waitForCriterion(ev, 20 * 1000, 200, false);
if (!myCache.isClosed()) {
if (system.isConnected()) {
@@ -492,7 +496,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
return "vm1's listener should have received afterRegionDestroyed notification";
}
};
- DistributedTestCase.waitForCriterion(wc, 30 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 30 * 1000, 1000, true);
}
});
@@ -521,14 +525,14 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
try {
getSystem(props);
} catch (IllegalArgumentException e) {
- getLogWriter().info("caught expected exception (1)", e);
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("caught expected exception (1)", e);
}
// use an invalid address
props.setProperty(DistributionConfig.BIND_ADDRESS_NAME, "bruce.schuchardt");
try {
getSystem(props);
} catch (IllegalArgumentException e) {
- getLogWriter().info("caught expected exception (2_", e);
+ com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("caught expected exception (2_", e);
}
// use a valid bind address
props.setProperty(DistributionConfig.BIND_ADDRESS_NAME, InetAddress.getLocalHost().getCanonicalHostName());
@@ -561,12 +565,12 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
t.setDaemon(true);
t.start();
- pause(2000);
+ Wait.pause(2000);
NetView newView = new NetView(v, v.getViewId()+1);
((Manager)mgr).installView(newView);
- pause(2000);
+ Wait.pause(2000);
synchronized(passed) {
Assert.assertTrue(passed[0]);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogDUnitTest.java
index d6f45d1..149d6d8 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/ProductUseLogDUnitTest.java
@@ -28,6 +28,7 @@ import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.distributed.Locator;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.CacheServerImpl;
+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.SerializableRunnable;
@@ -75,7 +76,7 @@ public class ProductUseLogDUnitTest extends DistributedTestCase {
try {
server.start();
} catch (IOException e) {
- fail("failed to start server", e);
+ Assert.fail("failed to start server", e);
}
}
});
@@ -100,7 +101,8 @@ public class ProductUseLogDUnitTest extends DistributedTestCase {
return sb.toString();
}
- public void tearDown2() {
+ @Override
+ protected final void preTearDown() throws Exception {
disconnectAllFromDS();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/GemFireDeadlockDetectorDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/GemFireDeadlockDetectorDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/GemFireDeadlockDetectorDUnitTest.java
index efdcb0c..bc3bee6 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/GemFireDeadlockDetectorDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/deadlock/GemFireDeadlockDetectorDUnitTest.java
@@ -33,8 +33,11 @@ import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.DistributedLockService;
import com.gemstone.gemfire.distributed.LockServiceDestroyedException;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
+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.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -50,12 +53,12 @@ public class GemFireDeadlockDetectorDUnitTest extends CacheTestCase {
@Override
- public void tearDown2() throws Exception {
+ protected final void preTearDownCacheTestCase() throws Exception {
disconnectAllFromDS();
}
private void stopStuckThreads() {
- invokeInEveryVM(new SerializableRunnable() {
+ Invoke.invokeInEveryVM(new SerializableRunnable() {
public void run() {
for(Thread thread: stuckThreads) {
@@ -65,7 +68,7 @@ public class GemFireDeadlockDetectorDUnitTest extends CacheTestCase {
thread.join(30000);
assertTrue(!thread.isAlive());
} catch (InterruptedException e) {
- fail("interrupted", e);
+ Assert.fail("interrupted", e);
}
}
}
@@ -114,7 +117,7 @@ public class GemFireDeadlockDetectorDUnitTest extends CacheTestCase {
Thread.sleep(5000);
GemFireDeadlockDetector detect = new GemFireDeadlockDetector();
LinkedList<Dependency> deadlock = detect.find().findCycle();
- getLogWriter().info("Deadlock=" + DeadlockDetector.prettyFormat(deadlock));
+ LogWriterUtils.getLogWriter().info("Deadlock=" + DeadlockDetector.prettyFormat(deadlock));
assertEquals(8, deadlock.size());
stopStuckThreads();
async1.getResult(30000);
@@ -131,7 +134,7 @@ public class GemFireDeadlockDetectorDUnitTest extends CacheTestCase {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
- fail("interrupted", e);
+ Assert.fail("interrupted", e);
}
ResultCollector collector = FunctionService.onMember(member).execute(new TestFunction());
//wait the function to lock the lock on member.
@@ -161,7 +164,7 @@ public class GemFireDeadlockDetectorDUnitTest extends CacheTestCase {
}
assertTrue(deadlock != null);
- getLogWriter().info("Deadlock=" + DeadlockDetector.prettyFormat(deadlock));
+ LogWriterUtils.getLogWriter().info("Deadlock=" + DeadlockDetector.prettyFormat(deadlock));
assertEquals(4, deadlock.size());
stopStuckThreads();
disconnectAllFromDS();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/locks/CollaborationJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/locks/CollaborationJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/locks/CollaborationJUnitTest.java
index 991030e..6985044 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/locks/CollaborationJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/locks/CollaborationJUnitTest.java
@@ -30,8 +30,9 @@ import com.gemstone.gemfire.CancelCriterion;
import com.gemstone.gemfire.LogWriter;
import com.gemstone.gemfire.SystemFailure;
import com.gemstone.gemfire.internal.logging.LocalLogWriter;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
import com.gemstone.gemfire.internal.logging.InternalLogWriter;
@@ -104,7 +105,7 @@ public class CollaborationJUnitTest {
return "waiting for thread";
}
};
- DistributedTestCase.waitForCriterion(ev, 5 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 5 * 1000, 200, true);
assertTrue(this.collaboration.hasCurrentTopic(threadA));
// thread two blocks until one releeases
@@ -125,7 +126,7 @@ public class CollaborationJUnitTest {
return "waiting for release";
}
};
- DistributedTestCase.waitForCriterion(ev2, 20 * 1000, 200, true);
+ Wait.waitForCriterion(ev2, 20 * 1000, 200, true);
}
finally {
collaboration.release();
@@ -145,7 +146,7 @@ public class CollaborationJUnitTest {
return "waiting for thread b";
}
};
- DistributedTestCase.waitForCriterion(ev, 5 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 5 * 1000, 200, true);
// threadA holds topic and threadB is waiting...
assertTrue(this.collaboration.hasCurrentTopic(threadA));
@@ -153,7 +154,7 @@ public class CollaborationJUnitTest {
// let threadA release so that threadB gets lock
this.flagTestBlocksUntilRelease = false;
- DistributedTestCase.join(threadA, 30 * 1000, null);
+ ThreadUtils.join(threadA, 30 * 1000);
// make sure threadB is doing what it's supposed to do...
ev = new WaitCriterion() {
@@ -166,11 +167,11 @@ public class CollaborationJUnitTest {
return "threadB";
}
};
- DistributedTestCase.waitForCriterion(ev, 5 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 5 * 1000, 200, true);
// threadB must have lock now... let threadB release
assertTrue(this.collaboration.hasCurrentTopic(threadB));
this.flagTestBlocksUntilRelease = false;
- DistributedTestCase.join(threadB, 30 * 1000, null);
+ ThreadUtils.join(threadB, 30 * 1000);
// collaboration should be free now
assertFalse(this.collaboration.hasCurrentTopic(threadA));
@@ -207,7 +208,7 @@ public class CollaborationJUnitTest {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
}
finally {
collaboration.release();
@@ -225,7 +226,7 @@ public class CollaborationJUnitTest {
return "wait for ThreadA";
}
};
- DistributedTestCase.waitForCriterion(ev, 30 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 30 * 1000, 200, true);
assertTrue(this.collaboration.hasCurrentTopic(threadA));
assertTrue(this.collaboration.isCurrentTopic(topicA));
@@ -245,7 +246,7 @@ public class CollaborationJUnitTest {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev2, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev2, 60 * 1000, 200, true);
}
finally {
collaboration.release();
@@ -263,7 +264,7 @@ public class CollaborationJUnitTest {
return "";
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
assertTrue(this.collaboration.hasCurrentTopic(threadB));
// thread three blocks for new topic
@@ -284,7 +285,7 @@ public class CollaborationJUnitTest {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev2, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev2, 60 * 1000, 200, true);
}
finally {
collaboration.release();
@@ -302,7 +303,7 @@ public class CollaborationJUnitTest {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
assertFalse(this.collaboration.hasCurrentTopic(threadC));
assertFalse(this.collaboration.isCurrentTopic(topicB));
@@ -336,12 +337,12 @@ public class CollaborationJUnitTest {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
assertTrue(this.collaboration.hasCurrentTopic(threadD));
// release threadA
this.threadAFlag_TestLateComerJoinsIn = false;
- DistributedTestCase.join(threadA, 30 * 1000, null);
+ ThreadUtils.join(threadA, 30 * 1000);
assertFalse(this.collaboration.hasCurrentTopic(threadA));
assertTrue(this.collaboration.hasCurrentTopic(threadB));
assertFalse(this.collaboration.hasCurrentTopic(threadC));
@@ -351,7 +352,7 @@ public class CollaborationJUnitTest {
// release threadB
this.threadBFlag_TestLateComerJoinsIn = false;
- DistributedTestCase.join(threadB, 30 * 1000, null);
+ ThreadUtils.join(threadB, 30 * 1000);
assertFalse(this.collaboration.hasCurrentTopic(threadB));
assertFalse(this.collaboration.hasCurrentTopic(threadC));
assertTrue(this.collaboration.hasCurrentTopic(threadD));
@@ -360,7 +361,7 @@ public class CollaborationJUnitTest {
// release threadD
this.threadDFlag_TestLateComerJoinsIn = false;
- DistributedTestCase.join(threadD, 30 * 1000, null);
+ ThreadUtils.join(threadD, 30 * 1000);
ev = new WaitCriterion() {
@Override
public boolean done() {
@@ -371,7 +372,7 @@ public class CollaborationJUnitTest {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
assertTrue(this.collaboration.hasCurrentTopic(threadC));
assertFalse(this.collaboration.hasCurrentTopic(threadD));
assertFalse(this.collaboration.isCurrentTopic(topicA));
@@ -379,7 +380,7 @@ public class CollaborationJUnitTest {
// release threadC
this.threadCFlag_TestLateComerJoinsIn = false;
- DistributedTestCase.join(threadC, 30 * 1000, null);
+ ThreadUtils.join(threadC, 30 * 1000);
assertFalse(this.collaboration.hasCurrentTopic(threadC));
assertFalse(this.collaboration.isCurrentTopic(topicA));
assertFalse(this.collaboration.isCurrentTopic(topicB));
@@ -420,7 +421,7 @@ public class CollaborationJUnitTest {
return "other threads lining up";
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
collaboration.release();
released = true;
}
@@ -454,7 +455,7 @@ public class CollaborationJUnitTest {
return "waiting for numThreads * 10";
}
};
- DistributedTestCase.waitForCriterion(ev, 5 * 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 5 * 60 * 1000, 200, true);
}
finally {
if (this.runTestFairnessStressfully) {
@@ -463,7 +464,7 @@ public class CollaborationJUnitTest {
}
for (int t = 0; t < threads.length; t++) {
- DistributedTestCase.join(threads[t], 30 * 1000, null);
+ ThreadUtils.join(threads[t], 30 * 1000);
}
// assert that all topics are acquired in order
@@ -552,7 +553,7 @@ public class CollaborationJUnitTest {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
}
finally {
collaboration.release();
@@ -573,12 +574,12 @@ public class CollaborationJUnitTest {
return null;
}
};
- DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+ Wait.waitForCriterion(ev, 60 * 1000, 200, true);
// after starting thread, hasCurrentTopic(thread) returns true
assertTrue(this.collaboration.hasCurrentTopic(thread));
this.flagTestThreadHasCurrentTopic = false;
- DistributedTestCase.join(thread, 30 * 1000, null);
+ ThreadUtils.join(thread, 30 * 1000);
// after thread finishes, hasCurrentTopic(thread) returns false
assertTrue(!this.collaboration.hasCurrentTopic(thread));
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/MembershipManagerHelper.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/MembershipManagerHelper.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/MembershipManagerHelper.java
index cda4e29..e44d761 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/MembershipManagerHelper.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/MembershipManagerHelper.java
@@ -26,8 +26,8 @@ import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedM
import com.gemstone.gemfire.distributed.internal.membership.MembershipManager;
import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Manager;
import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershipManager;
-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;
/**
* This helper class provides access to membership manager information that
@@ -149,7 +149,7 @@ public class MembershipManagerHelper
return assMsg;
}
};
- DistributedTestCase.waitForCriterion(ev, timeout, 200, true);
+ Wait.waitForCriterion(ev, timeout, 200, true);
}
public static void crashDistributedSystem(final DistributedSystem msys) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java
index a6cc444..a66367b 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServerBackwardCompatDUnitTest.java
@@ -37,7 +37,10 @@ import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.Version;
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.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
@@ -62,7 +65,7 @@ public class TcpServerBackwardCompatDUnitTest extends DistributedTestCase {
public void setUp() throws Exception {
super.setUp();
disconnectAllFromDS();
- invokeInEveryVM(new CacheSerializableRunnable("Set TcpServer.isTesting true") {
+ Invoke.invokeInEveryVM(new CacheSerializableRunnable("Set TcpServer.isTesting true") {
@Override
public void run2() throws CacheException {
@@ -72,15 +75,14 @@ public class TcpServerBackwardCompatDUnitTest extends DistributedTestCase {
}
@Override
- public void tearDown2() throws Exception {
- invokeInEveryVM(new CacheSerializableRunnable("Set TcpServer.isTesting true") {
+ protected final void preTearDown() throws Exception {
+ Invoke.invokeInEveryVM(new CacheSerializableRunnable("Set TcpServer.isTesting true") {
@Override
public void run2() throws CacheException {
TcpServer.isTesting = false;
}
});
- super.tearDown2();
}
/**
@@ -128,7 +130,7 @@ public class TcpServerBackwardCompatDUnitTest extends DistributedTestCase {
Locator.startLocatorAndDS(port0, logFile0, props);
} catch (IOException e) {
- fail("Locator1 start failed with Gossip Version: " + TcpServer.GOSSIPVERSION + "!", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Locator1 start failed with Gossip Version: " + TcpServer.GOSSIPVERSION + "!", e);
}
}
});
@@ -185,7 +187,7 @@ public class TcpServerBackwardCompatDUnitTest extends DistributedTestCase {
}
};
- DistributedTestCase.waitForCriterion(ev, 1000, 200, true);
+ Wait.waitForCriterion(ev, 1000, 200, true);
fail("this test must be fixed to work with the jgroups replacement");
// TODO
// Vector members = client.getMembers("mygroup1", new IpAddress(InetAddress.getLocalHost(), port0), true, 5000);
@@ -194,7 +196,7 @@ public class TcpServerBackwardCompatDUnitTest extends DistributedTestCase {
// Assert.assertTrue(members.contains(new IpAddress(InetAddress.getLocalHost(), port1)));
} catch (IOException e) {
- fail("Locator1 start failed with Gossip Version: " + TcpServer.GOSSIPVERSION + "!", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Locator1 start failed with Gossip Version: " + TcpServer.GOSSIPVERSION + "!", e);
}
}
});
@@ -247,7 +249,7 @@ public class TcpServerBackwardCompatDUnitTest extends DistributedTestCase {
// }
} catch (IOException e) {
- fail("Locator0 start failed with Gossip Version: " + TcpServer.GOSSIPVERSION + "!", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Locator0 start failed with Gossip Version: " + TcpServer.GOSSIPVERSION + "!", e);
}
}
});