You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2016/02/11 01:39:03 UTC
[29/61] [abbrv] [partial] incubator-geode git commit: GEODE-773:
Extract static methods from DistributedTestCase
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java
index 72780f1..be5b082 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionDUnitTest.java
@@ -56,9 +56,13 @@ import com.gemstone.gemfire.internal.cache.PartitionedRegion;
import com.gemstone.gemfire.internal.cache.functions.TestFunction;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServerTestBase {
private static final String TEST_FUNCTION7 = TestFunction.TEST_FUNCTION7;
@@ -211,7 +215,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
isByName = new Boolean(true);
toRegister = new Boolean(true);
- final ExpectedException ex = addExpectedException("did not send last result");
+ final IgnoredException ex = IgnoredException.addIgnoredException("did not send last result");
client.invoke(PRClientServerRegionFunctionExecutionDUnitTest.class,
"serverSingleKeyExecution_NoLastResult", new Object[] { isByName,
toRegister });
@@ -485,7 +489,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
if (!(ex.getCause() instanceof ServerConnectivityException)
&& !(ex.getCause() instanceof FunctionInvocationTargetException)) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
fail("Test failed after the execute operation");
}
}
@@ -521,8 +525,8 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
assertEquals(1, ((List)rs.getResult()).size());
} catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
- fail("Test failed after the execute operation", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
+ Assert.fail("Test failed after the execute operation", ex);
}
}
@@ -556,7 +560,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
assertEquals(1, ((List)rs.getResult()).size());
} catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
fail("Test failed after the execute operation");
}
}
@@ -668,7 +672,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
String excuse;
public boolean done() {
int sz = pool.getConnectedServerCount();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Checking for the Live Servers : Expected : " + expectedLiveServers
+ " Available :" + sz);
if (sz == expectedLiveServers.intValue()) {
@@ -681,7 +685,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 3 * 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 3 * 60 * 1000, 1000, true);
}
public static void executeFunction() throws ServerException,
@@ -701,7 +705,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
ResultCollector rc1 = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(
function.getId());
List l = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + l.size());
+ LogWriterUtils.getLogWriter().info("Result size : " + l.size());
assertEquals(3, l.size());
for (Iterator i = l.iterator(); i.hasNext();) {
@@ -709,7 +713,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
}
}
catch (Exception e) {
- getLogWriter().info("Got an exception : " + e.getMessage());
+ LogWriterUtils.getLogWriter().info("Got an exception : " + e.getMessage());
assertTrue(e instanceof EOFException || e instanceof SocketException
|| e instanceof SocketTimeoutException
|| e instanceof ServerException || e instanceof IOException
@@ -730,7 +734,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
ResultCollector rc1 = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(
function.getId());
List l = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + l.size());
+ LogWriterUtils.getLogWriter().info("Result size : " + l.size());
return l;
}
@@ -778,7 +782,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
PartitionedRegion region = (PartitionedRegion)cache.getRegion(PartitionedRegionName);
HashMap localBucket2RegionMap = (HashMap)region
.getDataStore().getSizeLocally();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Size of the " + PartitionedRegionName + " in this VM :- "
+ localBucket2RegionMap.size());
Set entrySet = localBucket2RegionMap.entrySet();
@@ -821,7 +825,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
.iterator().next());
}
catch (Exception expected) {
- getLogWriter().info("Exception : " + expected.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception : " + expected.getMessage());
expected.printStackTrace();
fail("Test failed after the put operation");
}
@@ -850,7 +854,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
List l = null;
ResultCollector rc1 = execute(dataSet, testKeysSet, Boolean.TRUE, function, isByName);
l = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + l.size());
+ LogWriterUtils.getLogWriter().info("Result size : " + l.size());
assertEquals(3, l.size());
for (Iterator i = l.iterator(); i.hasNext();) {
assertEquals(Boolean.TRUE, i.next());
@@ -872,7 +876,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
assertEquals(origVals, foundVals);
}catch(Exception e){
- fail("Test failed after the put operation", e);
+ Assert.fail("Test failed after the put operation", e);
}
}
@@ -902,7 +906,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
ResultCollector rc1 = execute(dataSet, testKeysSet, Boolean.TRUE,
function, isByName);
l = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + l.size());
+ LogWriterUtils.getLogWriter().info("Result size : " + l.size());
assertEquals(3, l.size());
for (Iterator i = l.iterator(); i.hasNext();) {
assertTrue(i.next() instanceof MyFunctionExecutionException);
@@ -987,14 +991,14 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
ResultCollector rc1 = execute(dataSet, testKeysSet, Boolean.TRUE,
function, isByName);
l = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + l.size());
+ LogWriterUtils.getLogWriter().info("Result size : " + l.size());
assertEquals(3, l.size());
for (Iterator i = l.iterator(); i.hasNext();) {
assertEquals(Boolean.TRUE, i.next());
}
}catch(Exception e){
- fail("Test failed after the put operation", e);
+ Assert.fail("Test failed after the put operation", e);
}
}
@@ -1023,8 +1027,8 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
}catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : " , ex);
- fail("Test failed after the put operation",ex);
+ LogWriterUtils.getLogWriter().info("Exception : " , ex);
+ Assert.fail("Test failed after the put operation",ex);
}
}
@@ -1067,13 +1071,13 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
}
});
l = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + l.size());
+ LogWriterUtils.getLogWriter().info("Result size : " + l.size());
assertEquals(3, l.size());
for (Iterator i = l.iterator(); i.hasNext();) {
assertEquals(Boolean.TRUE, i.next());
}
}catch(Exception e){
- getLogWriter().info("Exception : " + e.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception : " + e.getMessage());
e.printStackTrace();
fail("Test failed after the put operation");
@@ -1127,7 +1131,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
}
catch (Throwable e) {
e.printStackTrace();
- fail("This is not expected Exception", e);
+ Assert.fail("This is not expected Exception", e);
}
}
@@ -1163,7 +1167,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
.toLocalizedString("return any"))));
}
catch (Exception notexpected) {
- fail("Test failed during execute or sleeping", notexpected);
+ Assert.fail("Test failed during execute or sleeping", notexpected);
} finally {
cache.getLogger().info("<ExpectedException action=remove>" +
"FunctionException" +
@@ -1245,8 +1249,8 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
}catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : " , ex);
- fail("Test failed after the put operation",ex);
+ LogWriterUtils.getLogWriter().info("Exception : " , ex);
+ Assert.fail("Test failed after the put operation",ex);
}
}
@@ -1300,8 +1304,8 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
}
catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
- fail("Test failed after the put operation", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
+ Assert.fail("Test failed after the put operation", ex);
}
try {
@@ -1320,8 +1324,8 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
}
catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
- fail("Test failed after the put operation", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
+ Assert.fail("Test failed after the put operation", ex);
}
}
@@ -1382,8 +1386,8 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
}catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : " , ex);
- fail("Test failed after the put operation",ex);
+ LogWriterUtils.getLogWriter().info("Exception : " , ex);
+ Assert.fail("Test failed after the put operation",ex);
}
Region region2 = cache.getRegion(PartitionedRegionName+"2");
@@ -1454,7 +1458,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
}
catch (Exception ex) {
ex.printStackTrace();
- fail("This is not expected Exception", ex);
+ Assert.fail("This is not expected Exception", ex);
}
}
@@ -1494,7 +1498,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
});
}
catch (Exception expected) {
- getLogWriter().fine("Exception occured : " + expected.getMessage());
+ LogWriterUtils.getLogWriter().fine("Exception occured : " + expected.getMessage());
assertTrue(expected.getMessage().contains(
"No target node found for KEY = " + testKey)
|| expected.getMessage()
@@ -1556,8 +1560,8 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
}catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : " , ex);
- fail("Test failed after the put operation",ex);
+ LogWriterUtils.getLogWriter().info("Exception : " , ex);
+ Assert.fail("Test failed after the put operation",ex);
}
}
@@ -1612,7 +1616,7 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
});
}
catch (Exception expected) {
- getLogWriter().fine("Exception occured : " + expected.getMessage());
+ LogWriterUtils.getLogWriter().fine("Exception occured : " + expected.getMessage());
assertTrue(expected.getCause().getMessage().contains(
"Could not create an instance of com.gemstone.gemfire.internal.cache.execute.PRClientServerRegionFunctionExecutionDUnitTest$UnDeserializable"));
} finally {
@@ -1633,11 +1637,6 @@ public class PRClientServerRegionFunctionExecutionDUnitTest extends PRClientServ
}
}
- @Override
- public void tearDown2() throws Exception {
- super.tearDown2();
- }
-
/**
* Attempt to do a client server function execution with an arg that fail deserialization
* on the server. The client should see an exception instead of a hang if bug 43430 is fixed.
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java
index 5ee1472..3615ce4 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionFailoverDUnitTest.java
@@ -44,10 +44,15 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.LocalRegion;
import com.gemstone.gemfire.internal.cache.functions.TestFunction;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.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.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.dunit.VM;
public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
@@ -64,15 +69,10 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
@Override
public void setUp() throws Exception {
super.setUp();
- addExpectedException("Connection reset");
- addExpectedException("SocketTimeoutException");
- addExpectedException("ServerConnectivityException");
- addExpectedException("Socket Closed");
- }
-
- @Override
- public void tearDown2() throws Exception {
- super.tearDown2();
+ IgnoredException.addIgnoredException("Connection reset");
+ IgnoredException.addIgnoredException("SocketTimeoutException");
+ IgnoredException.addIgnoredException("ServerConnectivityException");
+ IgnoredException.addIgnoredException("Socket Closed");
}
public void testserverMultiKeyExecution_SocektTimeOut() {
@@ -90,7 +90,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
*/
public void testServerFailoverWithTwoServerAliveHA()
throws InterruptedException {
- addExpectedException("FunctionInvocationTargetException");
+ IgnoredException.addIgnoredException("FunctionInvocationTargetException");
ArrayList commonAttributes = createCommonServerAttributes(
"TestPartitionedRegion", null, 1, 13, null);
createClientServerScenarion(commonAttributes, 20, 20, 20);
@@ -116,9 +116,9 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
client.invoke(PRClientServerRegionFunctionExecutionDUnitTest.class,
"verifyDeadAndLiveServers", new Object[] { new Integer(1),
new Integer(2) });
- DistributedTestCase.join(async[0], 6 * 60 * 1000, getLogWriter());
+ ThreadUtils.join(async[0], 6 * 60 * 1000);
if (async[0].getException() != null) {
- fail("UnExpected Exception Occured : ", async[0].getException());
+ Assert.fail("UnExpected Exception Occured : ", async[0].getException());
}
List l = (List)async[0].getReturnValue();
assertEquals(2, l.size());
@@ -130,7 +130,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
*/
public void testServerCacheClosedFailoverWithTwoServerAliveHA()
throws InterruptedException {
- addExpectedException("FunctionInvocationTargetException");
+ IgnoredException.addIgnoredException("FunctionInvocationTargetException");
ArrayList commonAttributes = createCommonServerAttributes(
"TestPartitionedRegion", null, 1, 13, null);
createClientServerScenarion(commonAttributes, 20, 20, 20);
@@ -156,9 +156,9 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
client.invoke(PRClientServerRegionFunctionExecutionDUnitTest.class,
"verifyDeadAndLiveServers", new Object[] { new Integer(1),
new Integer(2) });
- DistributedTestCase.join(async[0], 5 * 60 * 1000, getLogWriter());
+ ThreadUtils.join(async[0], 5 * 60 * 1000);
if (async[0].getException() != null) {
- fail("UnExpected Exception Occured : ", async[0].getException());
+ Assert.fail("UnExpected Exception Occured : ", async[0].getException());
}
List l = (List)async[0].getReturnValue();
assertEquals(2, l.size());
@@ -180,7 +180,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
public void testOnRegionFailoverWithTwoServerDownHA()
throws InterruptedException {
- addExpectedException("FunctionInvocationTargetException");
+ IgnoredException.addIgnoredException("FunctionInvocationTargetException");
createScenario();
server1.invoke(PRClientServerRegionFunctionExecutionDUnitTest.class,
@@ -194,7 +194,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
client.invoke(PRClientServerRegionFunctionExecutionDUnitTest.class,
"createProxyRegion",
- new Object[] { getServerHostName(server1.getHost()) });
+ new Object[] { NetworkUtils.getServerHostName(server1.getHost()) });
Function function = new TestFunction(true,
TestFunction.TEST_FUNCTION_HA_REGION);
@@ -211,7 +211,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
// retry attempts is 2
public void testOnRegionFailoverWithOneServerDownHA()
throws InterruptedException {
- addExpectedException("FunctionInvocationTargetException");
+ IgnoredException.addIgnoredException("FunctionInvocationTargetException");
createScenario();
server1.invokeAsync(PRClientServerRegionFunctionExecutionDUnitTest.class,
@@ -225,7 +225,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
client.invoke(PRClientServerRegionFunctionExecutionDUnitTest.class,
"createProxyRegion",
- new Object[] { getServerHostName(server1.getHost()) });
+ new Object[] { NetworkUtils.getServerHostName(server1.getHost()) });
Function function = new TestFunction(true,
TestFunction.TEST_FUNCTION_HA_REGION);
@@ -245,7 +245,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
*/
public void testOnRegionFailoverNonHA() throws InterruptedException { // See #47489 before enabling it
createScenario();
- addExpectedException("FunctionInvocationTargetException");
+ IgnoredException.addIgnoredException("FunctionInvocationTargetException");
server1.invoke(PRClientServerRegionFunctionExecutionDUnitTest.class,
"createReplicatedRegion");
@@ -257,7 +257,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
client.invoke(PRClientServerRegionFunctionExecutionDUnitTest.class,
"createProxyRegion",
- new Object[] { getServerHostName(server1.getHost()) });
+ new Object[] { NetworkUtils.getServerHostName(server1.getHost()) });
Function function = new TestFunction(true,
TestFunction.TEST_FUNCTION_NONHA_REGION);
@@ -290,7 +290,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
client.invoke(PRClientServerRegionFunctionExecutionDUnitTest.class,
"createProxyRegion",
- new Object[] { getServerHostName(server1.getHost()) });
+ new Object[] { NetworkUtils.getServerHostName(server1.getHost()) });
//Make sure the buckets are created.
client.invoke(new SerializableRunnable() {
@@ -341,7 +341,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
public void testServerBucketMovedException() throws InterruptedException {
- addExpectedException("BucketMovedException");
+ IgnoredException.addIgnoredException("BucketMovedException");
final Host host = Host.getHost(0);
VM server1 = host.getVM(0);
VM server2 = host.getVM(1);
@@ -355,7 +355,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
final int portLocator = AvailablePort
.getRandomAvailablePort(AvailablePort.SOCKET);
- final String hostLocator = getServerHostName(server1.getHost());
+ final String hostLocator = NetworkUtils.getServerHostName(server1.getHost());
final String locator = hostLocator + "[" + portLocator + "]";
startLocatorInVM(portLocator);
@@ -400,7 +400,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
public void testServerBucketMovedException_LocalServer()
throws InterruptedException {
- addExpectedException("BucketMovedException");
+ IgnoredException.addIgnoredException("BucketMovedException");
final Host host = Host.getHost(0);
VM server1 = host.getVM(0);
@@ -413,7 +413,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
final int portLocator = AvailablePort
.getRandomAvailablePort(AvailablePort.SOCKET);
- final String hostLocator = getServerHostName(server1.getHost());
+ final String hostLocator = NetworkUtils.getServerHostName(server1.getHost());
final String locator = hostLocator + "[" + portLocator + "]";
startLocatorInVM(portLocator);
@@ -460,14 +460,14 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
File logFile = new File("locator-" + locatorPort + ".log");
Properties props = new Properties();
- props = getAllDistributedSystemProperties(props);
+ props = DistributedTestUtils.getAllDistributedSystemProperties(props);
props.setProperty(DistributionConfig.ENABLE_CLUSTER_CONFIGURATION_NAME, "false");
try {
locator = Locator.startLocatorAndDS(locatorPort, logFile, null, props);
}
catch (IOException e) {
- fail("Unable to start locator ", e);
+ Assert.fail("Unable to start locator ", e);
}
}
@@ -492,7 +492,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
server.start();
}
catch (IOException e) {
- fail("Failed to start server ", e);
+ Assert.fail("Failed to start server ", e);
}
PartitionAttributesFactory paf = new PartitionAttributesFactory();
if (isAccessor) {
@@ -505,7 +505,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
attr.setPartitionAttributes(paf.create());
region = cache.createRegion(regionName, attr.create());
assertNotNull(region);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Partitioned Region " + regionName + " created Successfully :"
+ region.toString());
return port;
@@ -538,7 +538,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
RegionAttributes attrs = factory.create();
region = cache.createRegion(regionName, attrs);
assertNotNull(region);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Distributed Region " + regionName + " created Successfully :"
+ region.toString());
}
@@ -547,7 +547,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
for(int i = 0 ; i < 113; i++){
region.put(i, "KB_"+i);
}
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Distributed Region " + regionName + " Have size :"
+ region.size());
}
@@ -556,7 +556,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
Execution execute = FunctionService.onRegion(region);
ResultCollector rc = execute.withArgs(Boolean.TRUE).execute(
new TestFunction(true, TestFunction.TEST_FUNCTION_LASTRESULT));
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Exeuction Result :"
+ rc.getResult());
List l = ((List)rc.getResult());
@@ -564,7 +564,7 @@ public class PRClientServerRegionFunctionExecutionFailoverDUnitTest extends
}
public static void checkSize(){
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Partitioned Region " + regionName + " Have size :"
+ region.size());
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest.java
index 0344a55..f1d354b 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest.java
@@ -47,8 +47,13 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.cache.PartitionedRegion;
import com.gemstone.gemfire.internal.cache.functions.TestFunction;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
PRClientServerTestBase {
@@ -329,7 +334,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
*/
public void testServerFailoverWithTwoServerAliveHA()
throws InterruptedException {
- addExpectedException("FunctionInvocationTargetException");
+ IgnoredException.addIgnoredException("FunctionInvocationTargetException");
ArrayList commonAttributes = createCommonServerAttributes(
"TestPartitionedRegion", null, 1, 13, null);
createClientServerScenarion(commonAttributes, 20, 20, 20);
@@ -362,9 +367,9 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
client.invoke(PRClientServerRegionFunctionExecutionDUnitTest.class,
"verifyDeadAndLiveServers", new Object[] { new Integer(1),
new Integer(2) });
- DistributedTestCase.join(async[0], 6 * 60 * 1000, getLogWriter());
+ ThreadUtils.join(async[0], 6 * 60 * 1000);
if (async[0].getException() != null) {
- fail("UnExpected Exception Occured : ", async[0].getException());
+ Assert.fail("UnExpected Exception Occured : ", async[0].getException());
}
List l = (List)async[0].getReturnValue();
@@ -377,7 +382,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
*/
public void testServerCacheClosedFailoverWithTwoServerAliveHA()
throws InterruptedException {
- addExpectedException("FunctionInvocationTargetException");
+ IgnoredException.addIgnoredException("FunctionInvocationTargetException");
ArrayList commonAttributes = createCommonServerAttributes(
"TestPartitionedRegion", null, 1, 13, null);
createClientServerScenarion(commonAttributes, 20, 20, 20);
@@ -410,9 +415,9 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest.class,
"verifyDeadAndLiveServers", new Object[] { new Integer(1),
new Integer(2) });
- DistributedTestCase.join(async[0], 5 * 60 * 1000, getLogWriter());
+ ThreadUtils.join(async[0], 5 * 60 * 1000);
if (async[0].getException() != null) {
- fail("UnExpected Exception Occured : ", async[0].getException());
+ Assert.fail("UnExpected Exception Occured : ", async[0].getException());
}
List l = (List)async[0].getReturnValue();
assertEquals(2, l.size());
@@ -515,7 +520,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
public boolean done() {
int sz = pool.getConnectedServerCount();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Checking for the Live Servers : Expected : "
+ expectedLiveServers + " Available :" + sz);
if (sz == expectedLiveServers.intValue()) {
@@ -530,7 +535,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 3 * 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 3 * 60 * 1000, 1000, true);
}
public static void executeFunction() throws ServerException,
@@ -569,7 +574,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
}
}
catch (Exception e) {
- getLogWriter().info("Got an exception : " + e.getMessage());
+ LogWriterUtils.getLogWriter().info("Got an exception : " + e.getMessage());
assertTrue(e instanceof EOFException || e instanceof SocketException
|| e instanceof SocketTimeoutException
|| e instanceof ServerException || e instanceof IOException
@@ -590,7 +595,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
ResultCollector rc1 = dataSet.withFilter(testKeysSet)
.withArgs(Boolean.TRUE).execute(function.getId());
List l = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + l.size());
+ LogWriterUtils.getLogWriter().info("Result size : " + l.size());
return l;
}
@@ -627,7 +632,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
.getRegion(PartitionedRegionName);
HashMap localBucket2RegionMap = (HashMap)region.getDataStore()
.getSizeLocally();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Size of the " + PartitionedRegionName + " in this VM :- "
+ localBucket2RegionMap.size());
Set entrySet = localBucket2RegionMap.entrySet();
@@ -656,8 +661,8 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
ResultCollector rc1 = executeOnAll(dataSet, Boolean.TRUE, function,
isByName);
List resultList = (List)((List)rc1.getResult());
- getLogWriter().info("Result size : " + resultList.size());
- getLogWriter().info("Result are SSSS : " + resultList);
+ LogWriterUtils.getLogWriter().info("Result size : " + resultList.size());
+ LogWriterUtils.getLogWriter().info("Result are SSSS : " + resultList);
assertEquals(3, resultList.size());
Iterator resultIterator = resultList.iterator();
@@ -692,7 +697,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
}
catch (Exception e) {
- fail("Test failed after the put operation", e);
+ Assert.fail("Test failed after the put operation", e);
}
}
@@ -716,13 +721,13 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
}
Map resultMap = region.getAll(testKeysList);
assertTrue(resultMap.equals(origVals));
- pause(2000);
+ Wait.pause(2000);
Map secondResultMap = region.getAll(testKeysList);
assertTrue(secondResultMap.equals(origVals));
}
catch (Exception e) {
- fail("Test failed after the put operation", e);
+ Assert.fail("Test failed after the put operation", e);
}
}
@@ -746,13 +751,13 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
}
Map resultMap = region.getAll(testKeysList);
assertTrue(resultMap.equals(origVals));
- pause(2000);
+ Wait.pause(2000);
Map secondResultMap = region.getAll(testKeysList);
assertTrue(secondResultMap.equals(origVals));
}
catch (Exception e) {
- fail("Test failed after the put operation", e);
+ Assert.fail("Test failed after the put operation", e);
}
}
@@ -794,7 +799,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
.iterator().next());
}
catch (Exception expected) {
- getLogWriter().info("Exception : " + expected.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception : " + expected.getMessage());
expected.printStackTrace();
fail("Test failed after the put operation");
}
@@ -824,7 +829,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
ResultCollector rc1 = execute(dataSet, testKeysSet, Boolean.TRUE,
function, isByName);
l = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + l.size());
+ LogWriterUtils.getLogWriter().info("Result size : " + l.size());
assertEquals(3, l.size());
for (Iterator i = l.iterator(); i.hasNext();) {
assertEquals(Boolean.TRUE, i.next());
@@ -847,7 +852,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
}
catch (Exception e) {
- fail("Test failed after the put operation", e);
+ Assert.fail("Test failed after the put operation", e);
}
}
@@ -877,7 +882,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
ResultCollector rc1 = execute(dataSet, testKeysSet, Boolean.TRUE,
function, isByName);
l = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + l.size());
+ LogWriterUtils.getLogWriter().info("Result size : " + l.size());
assertEquals(3, l.size());
for (Iterator i = l.iterator(); i.hasNext();) {
assertEquals(Boolean.TRUE, i.next());
@@ -885,7 +890,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
}
catch (Exception e) {
- fail("Test failed after the function execution", e);
+ Assert.fail("Test failed after the function execution", e);
}
}
@@ -916,8 +921,8 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
}
catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
- fail("Test failed after the put operation", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
+ Assert.fail("Test failed after the put operation", ex);
}
}
@@ -959,14 +964,14 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
}
});
l = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + l.size());
+ LogWriterUtils.getLogWriter().info("Result size : " + l.size());
assertEquals(3, l.size());
for (Iterator i = l.iterator(); i.hasNext();) {
assertEquals(Boolean.TRUE, i.next());
}
}
catch (Exception e) {
- getLogWriter().info("Exception : " + e.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception : " + e.getMessage());
e.printStackTrace();
fail("Test failed after the put operation");
@@ -1018,7 +1023,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
}
catch (Throwable e) {
e.printStackTrace();
- fail("This is not expected Exception", e);
+ Assert.fail("This is not expected Exception", e);
}
}
@@ -1053,13 +1058,13 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
}
catch (FunctionException expected) {
expected.printStackTrace();
- getLogWriter().info("Exception : " + expected.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception : " + expected.getMessage());
assertTrue(expected.getMessage().startsWith(
(LocalizedStrings.ExecuteFunction_CANNOT_0_RESULTS_HASRESULT_FALSE
.toLocalizedString("return any"))));
}
catch (Exception notexpected) {
- fail("Test failed during execute or sleeping", notexpected);
+ Assert.fail("Test failed during execute or sleeping", notexpected);
}
finally {
cache.getLogger().info(
@@ -1114,8 +1119,8 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
}
catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
- fail("Test failed after the put operation", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
+ Assert.fail("Test failed after the put operation", ex);
}
}
@@ -1141,7 +1146,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
}
catch (Exception ex) {
ex.printStackTrace();
- fail("This is not expected Exception", ex);
+ Assert.fail("This is not expected Exception", ex);
}
}
@@ -1178,7 +1183,7 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
});
}
catch (Exception expected) {
- getLogWriter().fine("Exception occured : " + expected.getMessage());
+ LogWriterUtils.getLogWriter().fine("Exception occured : " + expected.getMessage());
assertTrue(expected.getMessage().contains(
"No target node found for KEY = " + testKey)
|| expected.getMessage()
@@ -1240,8 +1245,8 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
}
catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
- fail("Test failed after the put operation", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
+ Assert.fail("Test failed after the put operation", ex);
}
}
@@ -1265,9 +1270,4 @@ public class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest extends
return dataSet.withArgs(args).execute(function);
}
}
-
- public void tearDown2() throws Exception {
- super.tearDown2();
- }
-
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest.java
index cf97932..8e2d2d4 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest.java
@@ -47,8 +47,13 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.cache.PartitionedRegion;
import com.gemstone.gemfire.internal.cache.functions.TestFunction;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest extends
PRClientServerTestBase {
@@ -286,11 +291,11 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
*/
public void testServerFailoverWithTwoServerAliveHA()
throws InterruptedException {
- addExpectedException("FunctionInvocationTargetException");
- addExpectedException("Connection reset");
- addExpectedException("SocketTimeoutException");
- addExpectedException("ServerConnectivityException");
- addExpectedException("Socket Closed");
+ IgnoredException.addIgnoredException("FunctionInvocationTargetException");
+ IgnoredException.addIgnoredException("Connection reset");
+ IgnoredException.addIgnoredException("SocketTimeoutException");
+ IgnoredException.addIgnoredException("ServerConnectivityException");
+ IgnoredException.addIgnoredException("Socket Closed");
ArrayList commonAttributes = createCommonServerAttributes(
"TestPartitionedRegion", null, 1, 13, null);
createClientServerScenarion(commonAttributes, 20, 20, 20);
@@ -323,9 +328,9 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
client.invoke(PRClientServerRegionFunctionExecutionDUnitTest.class,
"verifyDeadAndLiveServers", new Object[] { new Integer(1),
new Integer(2) });
- DistributedTestCase.join(async[0], 6 * 60 * 1000, getLogWriter());
+ ThreadUtils.join(async[0], 6 * 60 * 1000);
if (async[0].getException() != null) {
- fail("UnExpected Exception Occured : ", async[0].getException());
+ Assert.fail("UnExpected Exception Occured : ", async[0].getException());
}
List l = (List)async[0].getReturnValue();
@@ -338,11 +343,11 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
*/
public void testServerCacheClosedFailoverWithTwoServerAliveHA()
throws InterruptedException {
- addExpectedException("FunctionInvocationTargetException");
- addExpectedException("Connection reset");
- addExpectedException("SocketTimeoutException");
- addExpectedException("ServerConnectivityException");
- addExpectedException("Socket Closed");
+ IgnoredException.addIgnoredException("FunctionInvocationTargetException");
+ IgnoredException.addIgnoredException("Connection reset");
+ IgnoredException.addIgnoredException("SocketTimeoutException");
+ IgnoredException.addIgnoredException("ServerConnectivityException");
+ IgnoredException.addIgnoredException("Socket Closed");
ArrayList commonAttributes = createCommonServerAttributes(
"TestPartitionedRegion", null, 1, 13, null);
createClientServerScenarion(commonAttributes, 20, 20, 20);
@@ -375,9 +380,9 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest.class,
"verifyDeadAndLiveServers", new Object[] { new Integer(1),
new Integer(2) });
- DistributedTestCase.join(async[0], 5 * 60 * 1000, getLogWriter());
+ ThreadUtils.join(async[0], 5 * 60 * 1000);
if (async[0].getException() != null) {
- fail("UnExpected Exception Occured : ", async[0].getException());
+ Assert.fail("UnExpected Exception Occured : ", async[0].getException());
}
List l = (List)async[0].getReturnValue();
assertEquals(2, l.size());
@@ -480,7 +485,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
public boolean done() {
int sz = pool.getConnectedServerCount();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Checking for the Live Servers : Expected : "
+ expectedLiveServers + " Available :" + sz);
if (sz == expectedLiveServers.intValue()) {
@@ -495,7 +500,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 3 * 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 3 * 60 * 1000, 1000, true);
}
public static void executeFunction() throws ServerException,
@@ -534,7 +539,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
}
}
catch (Exception e) {
- getLogWriter().info("Got an exception : " + e.getMessage());
+ LogWriterUtils.getLogWriter().info("Got an exception : " + e.getMessage());
assertTrue(e instanceof EOFException || e instanceof SocketException
|| e instanceof SocketTimeoutException
|| e instanceof ServerException || e instanceof IOException
@@ -555,7 +560,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
ResultCollector rc1 = dataSet.withFilter(testKeysSet)
.withArgs(Boolean.TRUE).execute(function.getId());
List l = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + l.size());
+ LogWriterUtils.getLogWriter().info("Result size : " + l.size());
return l;
}
@@ -586,7 +591,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
.getRegion(PartitionedRegionName);
HashMap localBucket2RegionMap = (HashMap)region.getDataStore()
.getSizeLocally();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Size of the " + PartitionedRegionName + " in this VM :- "
+ localBucket2RegionMap.size());
Set entrySet = localBucket2RegionMap.entrySet();
@@ -615,8 +620,8 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
ResultCollector rc1 = executeOnAll(dataSet, Boolean.TRUE, function,
isByName);
List resultList = (List)((List)rc1.getResult());
- getLogWriter().info("Result size : " + resultList.size());
- getLogWriter().info("Result are SSSS : " + resultList);
+ LogWriterUtils.getLogWriter().info("Result size : " + resultList.size());
+ LogWriterUtils.getLogWriter().info("Result are SSSS : " + resultList);
assertEquals(3, resultList.size());
Iterator resultIterator = resultList.iterator();
@@ -651,7 +656,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
}
catch (Exception e) {
- fail("Test failed after the put operation", e);
+ Assert.fail("Test failed after the put operation", e);
}
}
@@ -675,13 +680,13 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
}
Map resultMap = region.getAll(testKeysList);
assertTrue(resultMap.equals(origVals));
- pause(2000);
+ Wait.pause(2000);
Map secondResultMap = region.getAll(testKeysList);
assertTrue(secondResultMap.equals(origVals));
}
catch (Exception e) {
- fail("Test failed after the put operation", e);
+ Assert.fail("Test failed after the put operation", e);
}
}
@@ -705,13 +710,13 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
}
Map resultMap = region.getAll(testKeysList);
assertTrue(resultMap.equals(origVals));
- pause(2000);
+ Wait.pause(2000);
Map secondResultMap = region.getAll(testKeysList);
assertTrue(secondResultMap.equals(origVals));
}
catch (Exception e) {
- fail("Test failed after the put operation", e);
+ Assert.fail("Test failed after the put operation", e);
}
}
@@ -753,7 +758,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
.iterator().next());
}
catch (Exception expected) {
- getLogWriter().info("Exception : " + expected.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception : " + expected.getMessage());
expected.printStackTrace();
fail("Test failed after the put operation");
}
@@ -783,7 +788,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
ResultCollector rc1 = execute(dataSet, testKeysSet, Boolean.TRUE,
function, isByName);
l = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + l.size());
+ LogWriterUtils.getLogWriter().info("Result size : " + l.size());
assertEquals(3, l.size());
for (Iterator i = l.iterator(); i.hasNext();) {
assertEquals(Boolean.TRUE, i.next());
@@ -806,7 +811,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
}
catch (Exception e) {
- fail("Test failed after the put operation", e);
+ Assert.fail("Test failed after the put operation", e);
}
}
@@ -835,7 +840,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
ResultCollector rc1 = execute(dataSet, testKeysSet, Boolean.TRUE,
function, isByName);
l = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + l.size());
+ LogWriterUtils.getLogWriter().info("Result size : " + l.size());
assertEquals(3, l.size());
for (Iterator i = l.iterator(); i.hasNext();) {
assertEquals(Boolean.TRUE, i.next());
@@ -843,7 +848,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
}
catch (Exception e) {
- fail("Test failed after the function execution", e);
+ Assert.fail("Test failed after the function execution", e);
}
}
@@ -874,8 +879,8 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
}
catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
- fail("Test failed after the put operation", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
+ Assert.fail("Test failed after the put operation", ex);
}
}
@@ -917,14 +922,14 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
}
});
l = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + l.size());
+ LogWriterUtils.getLogWriter().info("Result size : " + l.size());
assertEquals(3, l.size());
for (Iterator i = l.iterator(); i.hasNext();) {
assertEquals(Boolean.TRUE, i.next());
}
}
catch (Exception e) {
- getLogWriter().info("Exception : " + e.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception : " + e.getMessage());
e.printStackTrace();
fail("Test failed after the put operation");
@@ -976,7 +981,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
}
catch (Throwable e) {
e.printStackTrace();
- fail("This is not expected Exception", e);
+ Assert.fail("This is not expected Exception", e);
}
}
@@ -1011,13 +1016,13 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
}
catch (FunctionException expected) {
expected.printStackTrace();
- getLogWriter().info("Exception : " + expected.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception : " + expected.getMessage());
assertTrue(expected.getMessage().startsWith(
(LocalizedStrings.ExecuteFunction_CANNOT_0_RESULTS_HASRESULT_FALSE
.toLocalizedString("return any"))));
}
catch (Exception notexpected) {
- fail("Test failed during execute or sleeping", notexpected);
+ Assert.fail("Test failed during execute or sleeping", notexpected);
}
finally {
cache.getLogger().info(
@@ -1072,8 +1077,8 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
}
catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
- fail("Test failed after the put operation", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
+ Assert.fail("Test failed after the put operation", ex);
}
}
@@ -1099,7 +1104,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
}
catch (Exception ex) {
ex.printStackTrace();
- fail("This is not expected Exception", ex);
+ Assert.fail("This is not expected Exception", ex);
}
}
@@ -1136,7 +1141,7 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
});
}
catch (Exception expected) {
- getLogWriter().fine("Exception occured : " + expected.getMessage());
+ LogWriterUtils.getLogWriter().fine("Exception occured : " + expected.getMessage());
assertTrue(expected.getMessage().contains(
"No target node found for KEY = " + testKey)
|| expected.getMessage()
@@ -1198,8 +1203,8 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
}
catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
- fail("Test failed after the put operation", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
+ Assert.fail("Test failed after the put operation", ex);
}
}
@@ -1223,9 +1228,4 @@ public class PRClientServerRegionFunctionExecutionSelectorNoSingleHopDUnitTest e
return dataSet.withArgs(args).execute(function);
}
}
-
- public void tearDown2() throws Exception {
- super.tearDown2();
- }
-
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSingleHopDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSingleHopDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSingleHopDUnitTest.java
index d6f2fd8..1afd8f5 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSingleHopDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerRegionFunctionExecutionSingleHopDUnitTest.java
@@ -47,8 +47,13 @@ import com.gemstone.gemfire.distributed.DistributedSystemDisconnectedException;
import com.gemstone.gemfire.internal.cache.PartitionedRegion;
import com.gemstone.gemfire.internal.cache.functions.TestFunction;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
public class PRClientServerRegionFunctionExecutionSingleHopDUnitTest extends PRClientServerTestBase {
private static final String TEST_FUNCTION7 = TestFunction.TEST_FUNCTION7;
@@ -64,8 +69,8 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
@Override
public void setUp() throws Exception {
//Workaround for bug #52004
- addExpectedException("InternalFunctionInvocationTargetException");
- addExpectedException("Connection refused");
+ IgnoredException.addIgnoredException("InternalFunctionInvocationTargetException");
+ IgnoredException.addIgnoredException("Connection refused");
super.setUp();
}
@@ -132,7 +137,7 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
registerFunctionAtServer(function);
isByName = Boolean.TRUE;
// add expected exception for server going down after wait
- final ExpectedException expectedEx = addExpectedException(
+ final IgnoredException expectedEx = IgnoredException.addIgnoredException(
DistributedSystemDisconnectedException.class.getName(), server1);
try {
client.invoke(
@@ -252,8 +257,8 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
* After 5th attempt function will send Boolean as last result.
*/
public void testserverMultiKeyExecution_FunctionInvocationTargetException() {
- addExpectedException("FunctionException: IOException while sending");
- addExpectedException("java.net.SocketException: Software caused connection abort");
+ IgnoredException.addIgnoredException("FunctionException: IOException while sending");
+ IgnoredException.addIgnoredException("java.net.SocketException: Software caused connection abort");
createScenario();
client.invoke(PRClientServerRegionFunctionExecutionSingleHopDUnitTest.class,
"serverMultiKeyExecution_FunctionInvocationTargetException");
@@ -264,7 +269,7 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
* object and using the name of the function
*/
public void testserverMultiKeyExecutionNoResult_byName(){
- addExpectedException("Cannot send result");
+ IgnoredException.addIgnoredException("Cannot send result");
createScenario();
Function function = new TestFunction(false,TEST_FUNCTION7);
registerFunctionAtServer(function);
@@ -348,9 +353,9 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
client.invoke(PRClientServerRegionFunctionExecutionDUnitTest.class,
"verifyDeadAndLiveServers", new Object[] { new Integer(1),
new Integer(2) });
- DistributedTestCase.join(async[0], 6 * 60 * 1000, getLogWriter());
+ ThreadUtils.join(async[0], 6 * 60 * 1000);
if (async[0].getException() != null) {
- fail("UnExpected Exception Occured : ", async[0].getException());
+ Assert.fail("UnExpected Exception Occured : ", async[0].getException());
}
List l = (List)async[0].getReturnValue();
@@ -377,9 +382,9 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
server3.invoke(PRClientServerRegionFunctionExecutionSingleHopDUnitTest.class, "startServerHA");
server1.invoke(PRClientServerRegionFunctionExecutionSingleHopDUnitTest.class, "closeCacheHA");
client.invoke(PRClientServerRegionFunctionExecutionSingleHopDUnitTest.class, "verifyDeadAndLiveServers",new Object[]{new Integer(1),new Integer(2)});
- DistributedTestCase.join(async[0], 5 * 60 * 1000, getLogWriter());
+ ThreadUtils.join(async[0], 5 * 60 * 1000);
if(async[0].getException() != null){
- fail("UnExpected Exception Occured : ", async[0].getException());
+ Assert.fail("UnExpected Exception Occured : ", async[0].getException());
}
List l = (List)async[0].getReturnValue();
assertEquals(2, l.size());
@@ -481,7 +486,7 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
String excuse;
public boolean done() {
int sz = pool.getConnectedServerCount();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Checking for the Live Servers : Expected : " + expectedLiveServers
+ " Available :" + sz);
if (sz == expectedLiveServers.intValue()) {
@@ -494,7 +499,7 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 3 * 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 3 * 60 * 1000, 1000, true);
}
public static void executeFunction() throws ServerException,
@@ -531,7 +536,7 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
}
}
catch (Exception e) {
- getLogWriter().info("Got an exception : " + e.getMessage());
+ LogWriterUtils.getLogWriter().info("Got an exception : " + e.getMessage());
assertTrue(e instanceof EOFException || e instanceof SocketException
|| e instanceof SocketTimeoutException
|| e instanceof ServerException || e instanceof IOException
@@ -552,7 +557,7 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
ResultCollector rc1 = dataSet.withFilter(testKeysSet).withArgs(Boolean.TRUE).execute(
function.getId());
List l = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + l.size());
+ LogWriterUtils.getLogWriter().info("Result size : " + l.size());
return l;
}
@@ -587,7 +592,7 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
PartitionedRegion region = (PartitionedRegion)cache.getRegion(PartitionedRegionName);
HashMap localBucket2RegionMap = (HashMap)region
.getDataStore().getSizeLocally();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Size of the " + PartitionedRegionName + " in this VM :- "
+ localBucket2RegionMap.size());
Set entrySet = localBucket2RegionMap.entrySet();
@@ -615,8 +620,8 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
}
ResultCollector rc1 = executeOnAll(dataSet, Boolean.TRUE, function, isByName);
List resultList = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + resultList.size());
- getLogWriter().info("Result are SSSS : " + resultList);
+ LogWriterUtils.getLogWriter().info("Result size : " + resultList.size());
+ LogWriterUtils.getLogWriter().info("Result are SSSS : " + resultList);
assertEquals(3, resultList.size());
// while (resultIterator.hasNext()) {
@@ -644,7 +649,7 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
assertEquals(origVals, foundVals);
}catch(Exception e){
- fail("Test failed after the put operation", e);
+ Assert.fail("Test failed after the put operation", e);
}
}
@@ -669,12 +674,12 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
}
Map resultMap = region.getAll(testKeysList);
assertTrue(resultMap.equals(origVals));
- pause(2000);
+ Wait.pause(2000);
Map secondResultMap = region.getAll(testKeysList);
assertTrue(secondResultMap.equals(origVals));
}catch(Exception e){
- fail("Test failed after the put operation", e);
+ Assert.fail("Test failed after the put operation", e);
}
}
@@ -698,12 +703,12 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
}
Map resultMap = region.getAll(testKeysList);
assertTrue(resultMap.equals(origVals));
- pause(2000);
+ Wait.pause(2000);
Map secondResultMap = region.getAll(testKeysList);
assertTrue(secondResultMap.equals(origVals));
}catch(Exception e){
- fail("Test failed after the put operation", e);
+ Assert.fail("Test failed after the put operation", e);
}
}
@@ -746,7 +751,7 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
.iterator().next());
}
catch (Exception expected) {
- getLogWriter().info("Exception : " + expected.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception : " + expected.getMessage());
expected.printStackTrace();
fail("Test failed after the put operation");
}
@@ -775,7 +780,7 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
List l = null;
ResultCollector rc1 = execute(dataSet, testKeysSet, Boolean.TRUE, function, isByName);
l = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + l.size());
+ LogWriterUtils.getLogWriter().info("Result size : " + l.size());
assertEquals(3, l.size());
for (Iterator i = l.iterator(); i.hasNext();) {
assertEquals(Boolean.TRUE, i.next());
@@ -797,7 +802,7 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
assertEquals(origVals, foundVals);
}catch(Exception e){
- fail("Test failed after the put operation", e);
+ Assert.fail("Test failed after the put operation", e);
}
}
@@ -825,14 +830,14 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
ResultCollector rc1 = execute(dataSet, testKeysSet, Boolean.TRUE,
function, isByName);
l = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + l.size());
+ LogWriterUtils.getLogWriter().info("Result size : " + l.size());
assertEquals(3, l.size());
for (Iterator i = l.iterator(); i.hasNext();) {
assertEquals(Boolean.TRUE, i.next());
}
}catch(Exception e){
- fail("Test failed after the function execution", e);
+ Assert.fail("Test failed after the function execution", e);
}
}
@@ -861,8 +866,8 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
}catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : " , ex);
- fail("Test failed after the put operation",ex);
+ LogWriterUtils.getLogWriter().info("Exception : " , ex);
+ Assert.fail("Test failed after the put operation",ex);
}
}
@@ -905,13 +910,13 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
}
});
l = ((List)rc1.getResult());
- getLogWriter().info("Result size : " + l.size());
+ LogWriterUtils.getLogWriter().info("Result size : " + l.size());
assertEquals(3, l.size());
for (Iterator i = l.iterator(); i.hasNext();) {
assertEquals(Boolean.TRUE, i.next());
}
}catch(Exception e){
- getLogWriter().info("Exception : " + e.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception : " + e.getMessage());
e.printStackTrace();
fail("Test failed after the put operation");
@@ -965,7 +970,7 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
}
catch (Throwable e) {
e.printStackTrace();
- fail("This is not expected Exception", e);
+ Assert.fail("This is not expected Exception", e);
}
}
@@ -998,12 +1003,12 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
fail("Test failed after the put operation");
} catch(FunctionException expected) {
expected.printStackTrace();
- getLogWriter().info("Exception : " + expected.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception : " + expected.getMessage());
assertTrue(expected.getMessage().startsWith((LocalizedStrings.ExecuteFunction_CANNOT_0_RESULTS_HASRESULT_FALSE
.toLocalizedString("return any"))));
}
catch (Exception notexpected) {
- fail("Test failed during execute or sleeping", notexpected);
+ Assert.fail("Test failed during execute or sleeping", notexpected);
} finally {
cache.getLogger().info("<ExpectedException action=remove>" +
"FunctionException" +
@@ -1056,8 +1061,8 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
}catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : " , ex);
- fail("Test failed after the put operation",ex);
+ LogWriterUtils.getLogWriter().info("Exception : " , ex);
+ Assert.fail("Test failed after the put operation",ex);
}
}
@@ -1083,7 +1088,7 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
}
catch (Exception ex) {
ex.printStackTrace();
- fail("This is not expected Exception", ex);
+ Assert.fail("This is not expected Exception", ex);
}
}
@@ -1123,7 +1128,7 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
});
}
catch (Exception expected) {
- getLogWriter().fine("Exception occured : " + expected.getMessage());
+ LogWriterUtils.getLogWriter().fine("Exception occured : " + expected.getMessage());
assertTrue(expected.getMessage().contains(
"No target node found for KEY = " + testKey)
|| expected.getMessage()
@@ -1185,8 +1190,8 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
}catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : " , ex);
- fail("Test failed after the put operation",ex);
+ LogWriterUtils.getLogWriter().info("Exception : " , ex);
+ Assert.fail("Test failed after the put operation",ex);
}
}
@@ -1210,12 +1215,5 @@ import com.gemstone.gemfire.test.dunit.DistributedTestCase;
return dataSet.withArgs(args).execute(function);
}
}
-
- @Override
- public void tearDown2() throws Exception {
- super.tearDown2();
- }
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerTestBase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerTestBase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerTestBase.java
index 7026ead..4bee088 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerTestBase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerTestBase.java
@@ -51,11 +51,14 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.functions.TestFunction;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+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.DistributedTestCase.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
public class PRClientServerTestBase extends CacheTestCase {
@@ -151,7 +154,7 @@ public class PRClientServerTestBase extends CacheTestCase {
server1.start();
}
catch (IOException e) {
- fail("Failed to start the Server", e);
+ Assert.fail("Failed to start the Server", e);
}
assertTrue(server1.isRunning());
@@ -183,7 +186,7 @@ public class PRClientServerTestBase extends CacheTestCase {
server1.start();
}
catch (IOException e) {
- fail("Failed to start the Server", e);
+ Assert.fail("Failed to start the Server", e);
}
assertTrue(server1.isRunning());
@@ -216,7 +219,7 @@ public class PRClientServerTestBase extends CacheTestCase {
server1.start();
}
catch (IOException e) {
- fail("Failed to start the Server", e);
+ Assert.fail("Failed to start the Server", e);
}
assertTrue(server1.isRunning());
@@ -231,7 +234,7 @@ public class PRClientServerTestBase extends CacheTestCase {
server1.start();
}
catch (IOException e) {
- fail("Failed to start the Server", e);
+ Assert.fail("Failed to start the Server", e);
}
assertTrue(server1.isRunning());
@@ -254,7 +257,7 @@ public class PRClientServerTestBase extends CacheTestCase {
server1.start();
}
catch (IOException e) {
- fail("Failed to start the Server", e);
+ Assert.fail("Failed to start the Server", e);
}
assertTrue(server1.isRunning());
@@ -409,7 +412,7 @@ public class PRClientServerTestBase extends CacheTestCase {
public static void createCacheClientWithoutRegion(String host, Integer port1,
Integer port2, Integer port3) throws Exception {
CacheServerTestUtil.disableShufflingOfEndpoints();
- getLogWriter().info("PRClientServerTestBase#createCacheClientWithoutRegion : creating pool");
+ LogWriterUtils.getLogWriter().info("PRClientServerTestBase#createCacheClientWithoutRegion : creating pool");
serverPort1 = port1;
serverPort2 = port2;
serverPort3 = port3;
@@ -432,7 +435,7 @@ public class PRClientServerTestBase extends CacheTestCase {
public static void createCacheClientWithDistributedRegion(String host, Integer port1,
Integer port2, Integer port3) throws Exception {
CacheServerTestUtil.disableShufflingOfEndpoints();
- getLogWriter().info("PRClientServerTestBase#createCacheClientWithoutRegion : creating pool");
+ LogWriterUtils.getLogWriter().info("PRClientServerTestBase#createCacheClientWithoutRegion : creating pool");
serverPort1 = port1;
serverPort2 = port2;
serverPort3 = port3;
@@ -474,7 +477,7 @@ public class PRClientServerTestBase extends CacheTestCase {
serverPort2 = port2;
serverPort3 = port3;
client.invoke(PRClientServerTestBase.class, "createCacheClient",
- new Object[] { getServerHostName(server1.getHost()), port1, port2,
+ new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1, port2,
port3 });
}
@@ -489,7 +492,7 @@ public class PRClientServerTestBase extends CacheTestCase {
new Object[] {commonAttributes ,new Integer(localMaxMemoryServer2) });
serverPort1 = port1;
client.invoke(PRClientServerTestBase.class, "createCacheClient_SingleConnection",
- new Object[] { getServerHostName(server1.getHost()), port1});
+ new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1});
}
@@ -510,7 +513,7 @@ public class PRClientServerTestBase extends CacheTestCase {
serverPort2 = port2;
serverPort3 = port3;
client.invoke(PRClientServerTestBase.class, "createCacheClientWith2Regions",
- new Object[] { getServerHostName(server1.getHost()), port1, port2,
+ new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1, port2,
port3 });
}
@@ -559,7 +562,7 @@ public class PRClientServerTestBase extends CacheTestCase {
serverPort2 = port2;
serverPort3 = port3;
client.invoke(PRClientServerTestBase.class, "createNoSingleHopCacheClient",
- new Object[] { getServerHostName(server1.getHost()), port1, port2,
+ new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1, port2,
port3 });
}
@@ -579,13 +582,13 @@ public class PRClientServerTestBase extends CacheTestCase {
serverPort2 = port2;
serverPort3 = port3;
client.invoke(PRClientServerTestBase.class, "createNoSingleHopCacheClient",
- new Object[] { getServerHostName(server1.getHost()), port1, port2,
+ new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1, port2,
port3 });
}
protected void createClientServerScenarionWithoutRegion () {
- getLogWriter().info("PRClientServerTestBase#createClientServerScenarionWithoutRegion : creating client server");
+ LogWriterUtils.getLogWriter().info("PRClientServerTestBase#createClientServerScenarionWithoutRegion : creating client server");
createCacheInClientServer();
Integer port1 = (Integer)server1.invoke(PRClientServerTestBase.class,
"createCacheServer");
@@ -598,12 +601,12 @@ public class PRClientServerTestBase extends CacheTestCase {
serverPort3 = port3;
client.invoke(PRClientServerTestBase.class, "createCacheClientWithoutRegion",
- new Object[] { getServerHostName(server1.getHost()), port1, port2,
+ new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1, port2,
port3 });
}
protected void createClientServerScenarionWithDistributedtRegion () {
- getLogWriter().info("PRClientServerTestBase#createClientServerScenarionWithoutRegion : creating client server");
+ LogWriterUtils.getLogWriter().info("PRClientServerTestBase#createClientServerScenarionWithoutRegion : creating client server");
createCacheInClientServer();
Integer port1 = (Integer)server1.invoke(PRClientServerTestBase.class,
"createCacheServerWithDR");
@@ -617,7 +620,7 @@ public class PRClientServerTestBase extends CacheTestCase {
client.invoke(PRClientServerTestBase.class, "createCacheClientWithDistributedRegion",
- new Object[] { getServerHostName(server1.getHost()), port1, port2,
+ new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1, port2,
port3 });
}
@@ -675,7 +678,7 @@ public class PRClientServerTestBase extends CacheTestCase {
assertNotNull(cache);
}
catch (Exception e) {
- fail("Failed while creating the cache", e);
+ Assert.fail("Failed while creating the cache", e);
}
}
@@ -691,13 +694,13 @@ public class PRClientServerTestBase extends CacheTestCase {
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 2000, 500, false);
+ Wait.waitForCriterion(wc, 2000, 500, false);
Collection bridgeServers = cache.getCacheServers();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Start Server Bridge Servers list : " + bridgeServers.size());
Iterator bridgeIterator = bridgeServers.iterator();
CacheServer bridgeServer = (CacheServer)bridgeIterator.next();
- getLogWriter().info("start Server Bridge Server" + bridgeServer);
+ LogWriterUtils.getLogWriter().info("start Server Bridge Server" + bridgeServer);
try {
bridgeServer.start();
}
@@ -718,7 +721,7 @@ public class PRClientServerTestBase extends CacheTestCase {
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 1000, 200, false);
+ Wait.waitForCriterion(wc, 1000, 200, false);
try {
Iterator iter = cache.getCacheServers().iterator();
if (iter.hasNext()) {
@@ -731,8 +734,8 @@ public class PRClientServerTestBase extends CacheTestCase {
}
}
- public void tearDown2() throws Exception {
- super.tearDown2();
+ @Override
+ protected final void postTearDownCacheTestCase() throws Exception {
closeCache();
client.invoke(PRClientServerTestBase.class, "closeCache");
server1.invoke(PRClientServerTestBase.class, "closeCache");
@@ -759,7 +762,7 @@ public class PRClientServerTestBase extends CacheTestCase {
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 1000, 200, false);
+ Wait.waitForCriterion(wc, 1000, 200, false);
if (cache != null && !cache.isClosed()) {
cache.close();
}
@@ -798,7 +801,7 @@ public class PRClientServerTestBase extends CacheTestCase {
}catch(Exception e){
- fail("Test failed ", e);
+ Assert.fail("Test failed ", e);
}
}
@@ -839,7 +842,7 @@ public class PRClientServerTestBase extends CacheTestCase {
}
assertTrue(expectedBucketSet.isEmpty());
}catch(Exception e){
- fail("Test failed ", e);
+ Assert.fail("Test failed ", e);
}