You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by je...@apache.org on 2016/02/11 16:26:54 UTC
[30/62] [abbrv] [partial] incubator-geode git commit: GEODE-773:
Extract static methods from DistributedTestCase
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/ClientServerFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/ClientServerFunctionExecutionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/ClientServerFunctionExecutionDUnitTest.java
index 1e78da2..3890498 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/ClientServerFunctionExecutionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/ClientServerFunctionExecutionDUnitTest.java
@@ -33,8 +33,13 @@ import com.gemstone.gemfire.cache.execute.ResultCollector;
import com.gemstone.gemfire.distributed.DistributedSystem;
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.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
import java.io.Serializable;
import java.util.ArrayList;
@@ -59,7 +64,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
public void setUp() throws Exception {
super.setUp();
- addExpectedException("java.net.ConnectException");
+ IgnoredException.addIgnoredException("java.net.ConnectException");
}
@@ -97,7 +102,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
registerFunctionAtServer(function);
isByName = new Boolean(true);
toRegister = new Boolean(true);
- getLogWriter().info("ClientServerFFunctionExecutionDUnitTest#testServerSingleKeyExecution_byName : Starting test");
+ LogWriterUtils.getLogWriter().info("ClientServerFFunctionExecutionDUnitTest#testServerSingleKeyExecution_byName : Starting test");
client.invoke(ClientServerFunctionExecutionDUnitTest.class,
"serverExecution", new Object[] { isByName, function, toRegister});
client.invoke(ClientServerFunctionExecutionDUnitTest.class,
@@ -114,7 +119,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
registerFunctionAtServer(function);
isByName = new Boolean(true);
toRegister = new Boolean(true);
- getLogWriter().info("ClientServerFFunctionExecutionDUnitTest#testServerSingleKeyExecution_byName : Starting test");
+ LogWriterUtils.getLogWriter().info("ClientServerFFunctionExecutionDUnitTest#testServerSingleKeyExecution_byName : Starting test");
client.invoke(ClientServerFunctionExecutionDUnitTest.class,
"serverExecution_SendException", new Object[] { isByName, function, toRegister});
client.invoke(ClientServerFunctionExecutionDUnitTest.class,
@@ -133,7 +138,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
registerFunctionAtServer(function);
isByName = new Boolean(true);
toRegister = new Boolean(true);
- getLogWriter().info("ClientServerFFunctionExecutionDUnitTest#testServerSingleKeyExecution_byName : Starting test");
+ LogWriterUtils.getLogWriter().info("ClientServerFFunctionExecutionDUnitTest#testServerSingleKeyExecution_byName : Starting test");
client.invoke(ClientServerFunctionExecutionDUnitTest.class,
"serverExecution_NoLastResult", new Object[] { isByName, function, toRegister});
client.invoke(ClientServerFunctionExecutionDUnitTest.class,
@@ -149,7 +154,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
registerFunctionAtServer(function);
isByName = new Boolean(true);
toRegister = new Boolean(false);
- getLogWriter().info("ClientServerFFunctionExecutionDUnitTest#testServerSingleKeyExecution_byName : Starting test");
+ LogWriterUtils.getLogWriter().info("ClientServerFFunctionExecutionDUnitTest#testServerSingleKeyExecution_byName : Starting test");
client.invoke(ClientServerFunctionExecutionDUnitTest.class,
"serverExecution", new Object[] { isByName, function, toRegister});
client.invoke(ClientServerFunctionExecutionDUnitTest.class,
@@ -160,7 +165,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
*/
public void testServerExecution_byInlineFunction() {
createScenario();
- getLogWriter().info("ClientServerFunctionExecutionDUnitTest#testServerSingleKeyExecution_byName : Starting test");
+ LogWriterUtils.getLogWriter().info("ClientServerFunctionExecutionDUnitTest#testServerSingleKeyExecution_byName : Starting test");
client.invoke(ClientServerFunctionExecutionDUnitTest.class,
"serverExecution_Inline");
client.invoke(ClientServerFunctionExecutionDUnitTest.class,
@@ -173,7 +178,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
*/
public void testServerExecution_byInlineFunction_InvalidAttrbiutes() {
createScenario();
- getLogWriter().info("ClientServerFunctionExecutionDUnitTest#testServerSingleKeyExecution_byName : Starting test");
+ LogWriterUtils.getLogWriter().info("ClientServerFunctionExecutionDUnitTest#testServerSingleKeyExecution_byName : Starting test");
client.invoke(ClientServerFunctionExecutionDUnitTest.class,
"serverExecution_Inline_InvalidAttributes");
}
@@ -183,7 +188,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
*/
public void testBug40714() {
createScenario();
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"ClientServerFunctionExecutionDUnitTest#testBug40714 : Starting test");
@@ -253,7 +258,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
}
catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
fail("Test failed after the execute operation.");
}
}
@@ -268,7 +273,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
registerFunctionAtServer(function);
isByName = new Boolean(true);
toRegister = new Boolean(true);
- getLogWriter().info("ClientServerFFunctionExecutionDUnitTest#testServerSingleKeyExecution_byName : Starting test");
+ LogWriterUtils.getLogWriter().info("ClientServerFFunctionExecutionDUnitTest#testServerSingleKeyExecution_byName : Starting test");
client.invoke(ClientServerFunctionExecutionDUnitTest.class,
"serverExecution", new Object[] { isByName, function, toRegister});
client.invoke(ClientServerFunctionExecutionDUnitTest.class,
@@ -282,7 +287,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
registerFunctionAtServer(function);
isByName = new Boolean(true);
toRegister = new Boolean(false);
- getLogWriter().info("ClientServerFFunctionExecutionDUnitTest#testServerSingleKeyExecution_byName : Starting test");
+ LogWriterUtils.getLogWriter().info("ClientServerFFunctionExecutionDUnitTest#testServerSingleKeyExecution_byName : Starting test");
client.invoke(ClientServerFunctionExecutionDUnitTest.class,
"serverExecution", new Object[] { isByName, function, toRegister});
client.invoke(ClientServerFunctionExecutionDUnitTest.class,
@@ -300,7 +305,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
//The test code appears to trigger this because the first
//call to the function disconnects from the DS but does not call
//last result;
- addExpectedException("did not send last result");
+ IgnoredException.addIgnoredException("did not send last result");
createScenario();
server1.invoke(
@@ -317,7 +322,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
client.invoke(ClientServerFunctionExecutionDUnitTest.class,
"createProxyRegion",
- new Object[] { getServerHostName(server1.getHost()) });
+ new Object[] { NetworkUtils.getServerHostName(server1.getHost()) });
function = new TestFunction(true, TestFunction.TEST_FUNCTION_HA_SERVER);
registerFunctionAtServer(function);
@@ -337,8 +342,8 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
//The test code appears to trigger this because the first
//call to the function disconnects from the DS but does not call
//last result;
- addExpectedException("Socket Closed");
- addExpectedException("did not send last result");
+ IgnoredException.addIgnoredException("Socket Closed");
+ IgnoredException.addIgnoredException("did not send last result");
createScenario();
server1.invoke(
@@ -355,7 +360,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
client.invoke(ClientServerFunctionExecutionDUnitTest.class,
"createProxyRegion",
- new Object[] { getServerHostName(server1.getHost()) });
+ new Object[] { NetworkUtils.getServerHostName(server1.getHost()) });
function = new TestFunction(true, TestFunction.TEST_FUNCTION_HA_SERVER);
registerFunctionAtServer(function);
@@ -379,7 +384,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
//The test code appears to trigger this because the first
//call to the function disconnects from the DS but does not call
//last result;
- addExpectedException("did not send last result");
+ IgnoredException.addIgnoredException("did not send last result");
createScenario();
server1.invoke(
ClientServerFunctionExecutionDUnitTest.class,
@@ -395,7 +400,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
client.invoke(ClientServerFunctionExecutionDUnitTest.class,
"createProxyRegion",
- new Object[] { getServerHostName(server1.getHost()) });
+ new Object[] { NetworkUtils.getServerHostName(server1.getHost()) });
function = new TestFunction(true, TestFunction.TEST_FUNCTION_NONHA_SERVER);
registerFunctionAtServer(function);
@@ -426,7 +431,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
private void createScenario() {
- getLogWriter().info("ClientServerFFunctionExecutionDUnitTest#createScenario : creating scenario");
+ LogWriterUtils.getLogWriter().info("ClientServerFFunctionExecutionDUnitTest#createScenario : creating scenario");
createClientServerScenarionWithoutRegion();
}
@@ -445,7 +450,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
}catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : " , ex);
+ LogWriterUtils.getLogWriter().info("Exception : " , ex);
fail("Test failed after the execute operation");
}
@@ -465,7 +470,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
}catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : " , ex);
+ LogWriterUtils.getLogWriter().info("Exception : " , ex);
fail("Test failed after the execute operations");
}
}
@@ -502,7 +507,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
}catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : " , ex);
+ LogWriterUtils.getLogWriter().info("Exception : " , ex);
fail("Test failed after the execute operation");
}
@@ -529,7 +534,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
}catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : " , ex);
+ LogWriterUtils.getLogWriter().info("Exception : " , ex);
fail("Test failed after the execute operations");
}
}
@@ -574,7 +579,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
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()) {
@@ -587,7 +592,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 3 * 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 3 * 60 * 1000, 1000, true);
}
public static Object serverExecutionHAOneServerDown(Boolean isByName, Function function,
@@ -608,7 +613,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
assertEquals(retryRegionName, ((List)rs.getResult()).get(0));
} catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
fail("Test failed after the execute operation");
}
return rs.getResult();
@@ -631,7 +636,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
} catch (Exception ex) {
if (!(ex instanceof ServerConnectivityException)) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
fail("Test failed after the execute operation");
}
}
@@ -655,7 +660,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
} catch (Exception ex) {
if (!(ex instanceof ServerConnectivityException)) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
fail("Test failed after the execute operation");
}
}
@@ -678,7 +683,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
assertTrue(((Integer)list.get(1)) == 5);
} catch (Exception ex) {
ex.printStackTrace();
- fail("This is not expected Exception", ex);
+ Assert.fail("This is not expected Exception", ex);
}
}
@@ -729,7 +734,7 @@ public class ClientServerFunctionExecutionDUnitTest extends PRClientServerTestBa
}catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : " , ex);
+ LogWriterUtils.getLogWriter().info("Exception : " , ex);
fail("Test failed after the execute operation nn TRUE");
}
}
@@ -764,7 +769,7 @@ public static void serverExecution_Inline_InvalidAttributes() {
fail("Should have failed with Invalid attributes.");
}catch (Exception ex) {
- getLogWriter().info("Exception : " , ex);
+ LogWriterUtils.getLogWriter().info("Exception : " , ex);
assertTrue(ex.getMessage().contains(
"For Functions with isHA true, hasResult must also be true."));
}
@@ -793,7 +798,7 @@ public static void serverExecution_Inline_InvalidAttributes() {
}catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : " , ex);
+ LogWriterUtils.getLogWriter().info("Exception : " , ex);
fail("Test failed after the execute operation");
}
@@ -818,7 +823,7 @@ public static void serverExecution_Inline_InvalidAttributes() {
}catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : " , ex);
+ LogWriterUtils.getLogWriter().info("Exception : " , ex);
fail("Test failed after the execute operation");
}
@@ -846,7 +851,7 @@ public static void allServerExecution_SendException(Boolean isByName, Function f
}catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : " , ex);
+ LogWriterUtils.getLogWriter().info("Exception : " , ex);
fail("Test failed after the execute operation");
}
@@ -872,7 +877,7 @@ public static void allServerExecution_SendException(Boolean isByName, Function f
}catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : " , ex);
+ LogWriterUtils.getLogWriter().info("Exception : " , ex);
fail("Test failed after the execute operation");
}
@@ -927,7 +932,7 @@ public static void allServerExecution_SendException(Boolean isByName, Function f
}catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : " , ex);
+ LogWriterUtils.getLogWriter().info("Exception : " , ex);
fail("Test failed after the execute operation asdfasdfa ");
}
}
@@ -935,17 +940,13 @@ public static void allServerExecution_SendException(Boolean isByName, Function f
private static ResultCollector execute(Execution member,
Serializable args, Function function, Boolean isByName) throws Exception {
if (isByName.booleanValue()) {// by name
- getLogWriter().info("The function name to execute : " + function.getId());
+ LogWriterUtils.getLogWriter().info("The function name to execute : " + function.getId());
Execution me = member.withArgs(args);
- getLogWriter().info("The args passed : " + args);
+ LogWriterUtils.getLogWriter().info("The args passed : " + args);
return me.execute(function.getId());
}
else { // By Instance
return member.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/ColocationFailoverDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/ColocationFailoverDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/ColocationFailoverDUnitTest.java
index 81b9984..2ae358d 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/ColocationFailoverDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/ColocationFailoverDUnitTest.java
@@ -39,10 +39,15 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.cache.PartitionedRegion;
import com.gemstone.gemfire.internal.cache.partitioned.RegionAdvisor;
import com.gemstone.gemfire.internal.logging.InternalLogWriter;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
public class ColocationFailoverDUnitTest extends DistributedTestCase {
@@ -100,7 +105,7 @@ public class ColocationFailoverDUnitTest extends DistributedTestCase {
putInPRs();
verifyColocationInAllVms();
dataStore1.invoke(ColocationFailoverDUnitTest.class, "closeCache");
- pause(5000); //wait for volunteering primary
+ Wait.pause(5000); //wait for volunteering primary
verifyColocationAfterFailover();
}
@@ -206,12 +211,12 @@ public class ColocationFailoverDUnitTest extends DistributedTestCase {
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
}
protected static void dump() {
- final InternalLogWriter logger = getLogWriter();
+ final InternalLogWriter logger = LogWriterUtils.getLogWriter();
((PartitionedRegion)customerPR).dumpAllBuckets(false);
((PartitionedRegion)orderPR).dumpAllBuckets(false);
((PartitionedRegion)shipmentPR).dumpAllBuckets(false);
@@ -348,7 +353,7 @@ public class ColocationFailoverDUnitTest extends DistributedTestCase {
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 2 * 60 * 1000, 1000, true);
+ Wait.waitForCriterion(wc, 2 * 60 * 1000, 1000, true);
}
public static void createCacheInAllVms() {
@@ -374,7 +379,7 @@ public class ColocationFailoverDUnitTest extends DistributedTestCase {
assertNotNull(cache);
}
catch (Exception e) {
- fail("Failed while creating the cache", e);
+ Assert.fail("Failed while creating the cache", e);
}
}
@@ -426,7 +431,7 @@ public class ColocationFailoverDUnitTest extends DistributedTestCase {
if (partitionedRegionName.equals(customerPR_Name)) {
customerPR = cache.createRegion(partitionedRegionName, attr.create());
assertNotNull(customerPR);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Partitioned Region " + partitionedRegionName
+ " created Successfully :" + customerPR);
@@ -434,7 +439,7 @@ public class ColocationFailoverDUnitTest extends DistributedTestCase {
if (partitionedRegionName.equals(orderPR_Name)) {
orderPR = cache.createRegion(partitionedRegionName, attr.create());
assertNotNull(orderPR);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Partitioned Region " + partitionedRegionName
+ " created Successfully :" + orderPR);
@@ -443,7 +448,7 @@ public class ColocationFailoverDUnitTest extends DistributedTestCase {
if (partitionedRegionName.equals(shipmentPR_Name)) {
shipmentPR = cache.createRegion(partitionedRegionName, attr.create());
assertNotNull(shipmentPR);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Partitioned Region " + partitionedRegionName
+ " created Successfully :" + shipmentPR);
@@ -466,14 +471,14 @@ public class ColocationFailoverDUnitTest extends DistributedTestCase {
}
}
- public void tearDown2() throws Exception {
+ @Override
+ protected final void preTearDown() throws Exception {
closeCache();
- invokeInEveryVM(new SerializableRunnable() {
+ Invoke.invokeInEveryVM(new SerializableRunnable() {
public void run() {
closeCache();
}
});
- 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/DistributedRegionFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java
index 286a5bd..66d8ade 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/DistributedRegionFunctionExecutionDUnitTest.java
@@ -52,10 +52,16 @@ import com.gemstone.gemfire.internal.cache.functions.DistribuedRegionFunctionFun
import com.gemstone.gemfire.internal.cache.functions.DistributedRegionFunction;
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.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
public class DistributedRegionFunctionExecutionDUnitTest extends
DistributedTestCase {
@@ -93,7 +99,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
}
@Override
- public void tearDown2() throws Exception {
+ protected final void preTearDown() throws Exception {
// this test creates a cache that is incompatible with CacheTestCase,
// so we need to close it and null out the cache variable
disconnectAllFromDS();
@@ -314,7 +320,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
"registerFunction", new Object[] { new Boolean(true), new Integer(5) });
// add expected exception to avoid suspect strings
- final ExpectedException ex = addExpectedException("I have been thrown");
+ final IgnoredException ex = IgnoredException.addIgnoredException("I have been thrown");
replicate1.invoke(DistributedRegionFunctionExecutionDUnitTest.class,
"executeFunctionFunctionInvocationTargetException");
ex.remove();
@@ -361,7 +367,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
new Integer(0) });
// add expected exception to avoid suspect strings
- final ExpectedException ex = addExpectedException("I have been thrown");
+ final IgnoredException ex = IgnoredException.addIgnoredException("I have been thrown");
replicate1.invoke(DistributedRegionFunctionExecutionDUnitTest.class,
"executeFunctionFunctionInvocationTargetExceptionWithoutHA");
ex.remove();
@@ -401,7 +407,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
"registerFunction", new Object[] { new Boolean(true), new Integer(5) });
// add expected exception to avoid suspect strings
- final ExpectedException ex = addExpectedException("I have been thrown");
+ final IgnoredException ex = IgnoredException.addIgnoredException("I have been thrown");
executeFunctionFunctionInvocationTargetException();
ex.remove();
}
@@ -443,7 +449,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
new Integer(0) });
// add expected exception to avoid suspect strings
- final ExpectedException ex = addExpectedException("I have been thrown");
+ final IgnoredException ex = IgnoredException.addIgnoredException("I have been thrown");
executeFunctionFunctionInvocationTargetExceptionWithoutHA();
ex.remove();
}
@@ -531,9 +537,9 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
replicate1.invoke(DistributedRegionFunctionExecutionDUnitTest.class,
"disconnect");
- DistributedTestCase.join(async[0], 50 * 1000, getLogWriter());
+ ThreadUtils.join(async[0], 50 * 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(5001, l.size());
@@ -634,9 +640,9 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
createClientAndPopulateClientRegion(DataPolicy.EMPTY, port1, port2);
// add ExpectedException's to servers since client can connect to any
// one of those
- final ExpectedException expectedEx = addExpectedException(
+ final IgnoredException expectedEx = IgnoredException.addIgnoredException(
"did not send last result", empty1);
- final ExpectedException expectedEx2 = addExpectedException(
+ final IgnoredException expectedEx2 = IgnoredException.addIgnoredException(
"did not send last result", empty2);
try {
executeFunction_NoLastResult();
@@ -687,9 +693,9 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
"startServerHA");
emptyServer1.invoke(DistributedRegionFunctionExecutionDUnitTest.class,
"closeCacheHA");
- DistributedTestCase.join(async[0], 4 * 60 * 1000, getLogWriter());
+ ThreadUtils.join(async[0], 4 * 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(5001, l.size());
@@ -730,7 +736,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
createClientAndPopulateClientRegion(DataPolicy.EMPTY, port1, port2);
// add expected exception
- final ExpectedException ex = addExpectedException(
+ final IgnoredException ex = IgnoredException.addIgnoredException(
"DataPolicy.NORMAL is not supported");
try {
executeFunction();
@@ -846,7 +852,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
createClientAndPopulateClientRegion(DataPolicy.EMPTY, port1, port2);
// add expected exception to avoid suspect strings
- final ExpectedException ex = addExpectedException("I have been thrown");
+ final IgnoredException ex = IgnoredException.addIgnoredException("I have been thrown");
executeFunctionFunctionInvocationTargetException_ClientServer();
ex.remove();
}
@@ -897,7 +903,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
createClientAndPopulateClientRegion(DataPolicy.EMPTY, port1, port2);
// add expected exception to avoid suspect strings
- final ExpectedException ex = addExpectedException("I have been thrown");
+ final IgnoredException ex = IgnoredException.addIgnoredException("I have been thrown");
executeFunctionFunctionInvocationTargetException_ClientServer_WithoutHA();
ex.remove();
}
@@ -939,7 +945,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
"registerFunction", new Object[] { new Boolean(true), new Integer(5) });
// add expected exception to avoid suspect strings
- final ExpectedException ex = addExpectedException("I have been thrown");
+ final IgnoredException ex = IgnoredException.addIgnoredException("I have been thrown");
executeFunctionFunctionInvocationTargetException_ClientServer();
ex.remove();
}
@@ -989,7 +995,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
new Integer(0) });
// add expected exception to avoid suspect strings
- final ExpectedException ex = addExpectedException("I have been thrown");
+ final IgnoredException ex = IgnoredException.addIgnoredException("I have been thrown");
executeFunctionFunctionInvocationTargetException_ClientServer_WithoutHA();
ex.remove();
}
@@ -1079,7 +1085,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
}
public void testFunctionWithNoResultThrowsException(){
- addExpectedException("RuntimeException");
+ IgnoredException.addIgnoredException("RuntimeException");
replicate1.invoke(DistributedRegionFunctionExecutionDUnitTest.class,
"createCacheInVm");
replicate2.invoke(DistributedRegionFunctionExecutionDUnitTest.class,
@@ -1097,7 +1103,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
createClientAndPopulateClientRegion(DataPolicy.EMPTY, port1, port2);
executeFunctionWithNoResultThrowException();
- pause(10000);
+ Wait.pause(10000);
}
public static void executeFunction_NoResult() {
@@ -1132,9 +1138,9 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
ds.disconnect();
}
catch (Exception e) {
- getLogWriter().info("Exception Occured : " + e.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception Occured : " + e.getMessage());
e.printStackTrace();
- fail("Test failed", e);
+ Assert.fail("Test failed", e);
}
}
@@ -1314,7 +1320,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
}
catch (Exception e) {
e.printStackTrace();
- fail("This is not expected Exception", e);
+ Assert.fail("This is not expected Exception", e);
}
}
@@ -1344,7 +1350,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
}
catch (Exception e) {
e.printStackTrace();
- fail("This is not expected Exception", e);
+ Assert.fail("This is not expected Exception", e);
}
}
@@ -1412,7 +1418,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
factory.setDataPolicy(policy);
assertNotNull(cache);
region = cache.createRegion(REGION_NAME, factory.create());
- getLogWriter().info("Client Region Created :" + region);
+ LogWriterUtils.getLogWriter().info("Client Region Created :" + region);
assertNotNull(region);
for (int i = 1; i <= 200; i++) {
region.put("execKey-" + i, new Integer(i));
@@ -1438,7 +1444,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
factory.setPoolName(p.getName());
assertNotNull(cache);
region = cache.createRegion(REGION_NAME, factory.create());
- getLogWriter().info("Client Region Created :" + region);
+ LogWriterUtils.getLogWriter().info("Client Region Created :" + region);
assertNotNull(region);
}
@@ -1448,7 +1454,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
factory.setDataPolicy(policy);
assertNotNull(cache);
region = cache.createRegion(REGION_NAME, factory.create());
- getLogWriter().info("Region Created :" + region);
+ LogWriterUtils.getLogWriter().info("Region Created :" + region);
assertNotNull(region);
CacheServer server = cache.addCacheServer();
@@ -1459,7 +1465,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
server.start();
}
catch (IOException e) {
- fail("Failed to start the Server", e);
+ Assert.fail("Failed to start the Server", e);
}
assertTrue(server.isRunning());
return new Integer(server.getPort());
@@ -1471,7 +1477,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
factory.setDataPolicy(policy);
assertNotNull(cache);
region = cache.createRegion(REGION_NAME, factory.create());
- getLogWriter().info("Region Created :" + region);
+ LogWriterUtils.getLogWriter().info("Region Created :" + region);
assertNotNull(region);
}
@@ -1491,12 +1497,12 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
ds.disconnect();
ds = getSystem(props);
cache = CacheFactory.create(ds);
- getLogWriter().info("Created Cache on peer");
+ LogWriterUtils.getLogWriter().info("Created Cache on peer");
assertNotNull(cache);
FunctionService.registerFunction(function);
}
catch (Exception e) {
- fail(
+ Assert.fail(
"DistributedRegionFunctionExecutionDUnitTest#createCache() Failed while creating the cache",
e);
}
@@ -1515,7 +1521,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 3000, 200, false);
+ Wait.waitForCriterion(wc, 3000, 200, false);
long endTime = System.currentTimeMillis();
region.getCache().getLogger().fine(
"Time wait for Cache Close = " + (endTime - startTime));
@@ -1534,13 +1540,13 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
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();
}
@@ -1561,7 +1567,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 1000, 200, false);
+ Wait.waitForCriterion(wc, 1000, 200, false);
try {
Iterator iter = cache.getCacheServers().iterator();
if (iter.hasNext()) {
@@ -1586,7 +1592,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 1000, 200, false);
+ Wait.waitForCriterion(wc, 1000, 200, false);
if (cache != null && !cache.isClosed()) {
try {
Iterator iter = cache.getCacheServers().iterator();
@@ -1616,7 +1622,7 @@ public class DistributedRegionFunctionExecutionDUnitTest extends
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 2000, 200, false);
+ Wait.waitForCriterion(wc, 2000, 200, false);
long endTime = System.currentTimeMillis();
region.getCache().getLogger().fine(
"Time wait for Disconnecting = " + (endTime - startTime));
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStatsDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStatsDUnitTest.java
index edcbfda..9edb736 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStatsDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/FunctionServiceStatsDUnitTest.java
@@ -52,11 +52,13 @@ import com.gemstone.gemfire.internal.cache.PartitionedRegion;
import com.gemstone.gemfire.internal.cache.PartitionedRegionTestHelper;
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.SerializableCallable;
import com.gemstone.gemfire.test.dunit.VM;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/*
* This is DUnite Test to test the Function Execution stats under various
@@ -261,7 +263,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
}
catch (Exception e) {
- getLogWriter().info("Exception : " + e.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception : " + e.getMessage());
e.printStackTrace();
fail("Test failed after the put operation");
}
@@ -285,9 +287,9 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
.getFunctionExecutionsCompleted());
assertTrue(functionServiceStats.getResultsReceived() >= resultReceived_Aggregate);
- getLogWriter().info("Calling FunctionStats for TEST_FUNCTION2 :");
+ LogWriterUtils.getLogWriter().info("Calling FunctionStats for TEST_FUNCTION2 :");
FunctionStats functionStats = FunctionStats.getFunctionStats(TestFunction.TEST_FUNCTION2, iDS);
- getLogWriter().info("Called FunctionStats for TEST_FUNCTION2 :");
+ LogWriterUtils.getLogWriter().info("Called FunctionStats for TEST_FUNCTION2 :");
assertEquals(noOfExecutionCalls_TESTFUNCTION2, functionStats
.getFunctionExecutionCalls());
assertEquals(noOfExecutionsCompleted_TESTFUNCTION2, functionStats
@@ -378,14 +380,14 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
ds.disconnect();
ds = getSystem(props);
cache = CacheFactory.create(ds);
- getLogWriter().info("Created Cache on Server");
+ LogWriterUtils.getLogWriter().info("Created Cache on Server");
assertNotNull(cache);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.REPLICATE);
assertNotNull(cache);
Region region = cache.createRegion(regionName, factory.create());
- getLogWriter().info("Region Created :" + region);
+ LogWriterUtils.getLogWriter().info("Region Created :" + region);
assertNotNull(region);
for (int i = 1; i <= 200; i++) {
region.put("execKey-" + i, new Integer(i));
@@ -398,13 +400,13 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
server.start();
}
catch (IOException e) {
- fail("Failed to start the Server", e);
+ Assert.fail("Failed to start the Server", e);
}
assertTrue(server.isRunning());
return new Integer(server.getPort());
}
catch (Exception e) {
- fail(
+ Assert.fail(
"FunctionServiceStatsDUnitTest#createCache() Failed while creating the cache",
e);
throw e;
@@ -427,7 +429,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
ds.disconnect();
ds = getSystem(props);
cache = CacheFactory.create(ds);
- getLogWriter().info("Created Cache on Client");
+ LogWriterUtils.getLogWriter().info("Created Cache on Client");
assertNotNull(cache);
@@ -452,7 +454,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
factory.setPoolName(p.getName());
assertNotNull(cache);
Region region = cache.createRegion(regionName, factory.create());
- getLogWriter().info("Client Region Created :" + region);
+ LogWriterUtils.getLogWriter().info("Client Region Created :" + region);
assertNotNull(region);
for (int i = 1; i <= 200; i++) {
region.put("execKey-" + i, new Integer(i));
@@ -460,7 +462,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
return Boolean.TRUE;
}
catch (Exception e) {
- fail(
+ Assert.fail(
"FunctionServiceStatsDUnitTest#createCache() Failed while creating the cache",
e);
throw e;
@@ -517,12 +519,12 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
}
catch (FunctionException e) {
e.printStackTrace();
- fail("test failed due to", e);
+ Assert.fail("test failed due to", e);
throw e;
}
catch (Exception e) {
e.printStackTrace();
- fail("test failed due to", e);
+ Assert.fail("test failed due to", e);
throw e;
}
@@ -603,7 +605,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
}
catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
fail("Test failed after the execute operation nn TRUE");
}
function = new TestFunction(true, TestFunction.TEST_FUNCTION5);
@@ -625,7 +627,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
}
catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
fail("Test failed after the execute operationssssss");
}
return Boolean.TRUE;
@@ -973,7 +975,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.EMPTY);
Region region = getCache().createRegion(rName, factory.create());
- getLogWriter().info("Region Created :" + region);
+ LogWriterUtils.getLogWriter().info("Region Created :" + region);
assertNotNull(region);
FunctionService.registerFunction(new TestFunction(true, TestFunction.TEST_FUNCTION2));
for (int i = 1; i <= 200; i++) {
@@ -991,7 +993,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.REPLICATE);
Region region = getCache().createRegion(rName, factory.create());
- getLogWriter().info("Region Created :" + region);
+ LogWriterUtils.getLogWriter().info("Region Created :" + region);
assertNotNull(region);
FunctionService.registerFunction(new TestFunction(true, TestFunction.TEST_FUNCTION2));
for (int i = 1; i <= 200; i++) {
@@ -1026,12 +1028,12 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
}
catch (FunctionException e) {
e.printStackTrace();
- fail("test failed due to", e);
+ Assert.fail("test failed due to", e);
return Boolean.FALSE;
}
catch (Exception e) {
e.printStackTrace();
- fail("test failed due to", e);
+ Assert.fail("test failed due to", e);
return Boolean.FALSE;
}
@@ -1088,7 +1090,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
assertNotNull(ds);
}
catch (Exception e) {
- fail("Failed while creating the Distribued System", e);
+ Assert.fail("Failed while creating the Distribued System", e);
}
return Boolean.TRUE;
}
@@ -1145,9 +1147,9 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
}
catch (Exception e) {
- getLogWriter().info("Exception Occured : " + e.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception Occured : " + e.getMessage());
e.printStackTrace();
- fail("Test failed", e);
+ Assert.fail("Test failed", e);
}
return Boolean.TRUE;
}
@@ -1294,7 +1296,7 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
return excuse;
}
};
- DistributedTestCase.waitForCriterion(wc, 20000, 1000, false);
+ Wait.waitForCriterion(wc, 20000, 1000, false);
rc.getResult();
}
catch (Exception expected) {
@@ -1359,11 +1361,4 @@ public class FunctionServiceStatsDUnitTest extends PRClientServerTestBase{
ArrayList commonAttributes = createCommonServerAttributes("TestPartitionedRegion", null, 0, 13, null);
createClientServerScenarion(commonAttributes, 20, 20, 20);
}
-
- // this tear down is geeting used in client server mode. this is making use of
- // cache object for client server
- //For P2P, i have added separate closeDistributedSystem method
- 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/LocalDataSetDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetDUnitTest.java
index 5dfb429..6d582ed 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetDUnitTest.java
@@ -44,8 +44,10 @@ import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.cache.PartitionedRegion;
import com.gemstone.gemfire.internal.cache.functions.LocalDataSetFunction;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -141,7 +143,7 @@ public class LocalDataSetDUnitTest extends CacheTestCase {
Region localRegion = PartitionRegionHelper.getLocalDataForContext((RegionFunctionContext)context);
Iterator it = localRegion.keySet().iterator();
while (it.hasNext()) {
- getLogWriter().info("LocalKeys:"+it.next());
+ LogWriterUtils.getLogWriter().info("LocalKeys:"+it.next());
}
context.getResultSender().lastResult(Boolean.TRUE);
}
@@ -204,7 +206,7 @@ public class LocalDataSetDUnitTest extends CacheTestCase {
}
catch (Exception e) {
e.printStackTrace();
- fail("Test failed due to ", e);
+ Assert.fail("Test failed due to ", e);
}
}
private void registerFunctions() {
@@ -249,7 +251,7 @@ public class LocalDataSetDUnitTest extends CacheTestCase {
assertNotNull(cache);
}
catch (Exception e) {
- fail("Failed while creating the cache", e);
+ Assert.fail("Failed while creating the cache", e);
}
}
@@ -302,7 +304,7 @@ public class LocalDataSetDUnitTest extends CacheTestCase {
if (partitionedRegionName.equals("CustomerPR")) {
customerPR = cache.createRegion(partitionedRegionName, attr.create());
assertNotNull(customerPR);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Partitioned Region " + partitionedRegionName
+ " created Successfully :" + customerPR);
@@ -310,7 +312,7 @@ public class LocalDataSetDUnitTest extends CacheTestCase {
if (partitionedRegionName.equals("OrderPR")) {
orderPR = cache.createRegion(partitionedRegionName, attr.create());
assertNotNull(orderPR);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Partitioned Region " + partitionedRegionName
+ " created Successfully :" + orderPR);
@@ -319,7 +321,7 @@ public class LocalDataSetDUnitTest extends CacheTestCase {
if (partitionedRegionName.equals("ShipmentPR")) {
shipmentPR = cache.createRegion(partitionedRegionName, attr.create());
assertNotNull(shipmentPR);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Partitioned Region " + partitionedRegionName
+ " created Successfully :" + shipmentPR);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetIndexingDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetIndexingDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetIndexingDUnitTest.java
index 8b0d4ba..1d933e3 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetIndexingDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalDataSetIndexingDUnitTest.java
@@ -124,7 +124,7 @@ public class LocalDataSetIndexingDUnitTest extends CacheTestCase {
"/pr2 e2");
}
catch (Exception e) {
- fail("Test failed due to Exception in index creation ", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Test failed due to Exception in index creation ", e);
}
}
};
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalFunctionExecutionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalFunctionExecutionDUnitTest.java
index f58d349..33c8f3e 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalFunctionExecutionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/LocalFunctionExecutionDUnitTest.java
@@ -34,8 +34,11 @@ import com.gemstone.gemfire.cache.execute.ResultCollector;
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.cache.functions.TestFunction;
+import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -96,7 +99,7 @@ public class LocalFunctionExecutionDUnitTest extends DistributedTestCase{
assertNotNull(cache);
}
catch (Exception e) {
- fail("Failed while creating the cache", e);
+ Assert.fail("Failed while creating the cache", e);
}
}
@@ -113,7 +116,7 @@ public class LocalFunctionExecutionDUnitTest extends DistributedTestCase{
region = cache.createRegion(partitionedRegionName, attr.create());
assertNotNull(region);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Partitioned Region " + partitionedRegionName
+ " created Successfully :" + region);
}
@@ -126,7 +129,7 @@ public class LocalFunctionExecutionDUnitTest extends DistributedTestCase{
assertNotNull(cache);
region = cache.createRegion(distributedRegionName, attr.create());
assertNotNull(region);
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"Distributed Region " + distributedRegionName
+ " created Successfully :" + region);
}
@@ -144,7 +147,7 @@ public class LocalFunctionExecutionDUnitTest extends DistributedTestCase{
FunctionService.registerFunction(function1);
ResultCollector rc = FunctionService.onRegion(region).withArgs(Boolean.TRUE).execute(function1.getId());
rc.getResult();
- fail("Exception should occur",new Exception("Test Failed"));
+ Assert.fail("Exception should occur",new Exception("Test Failed"));
}
catch (Exception e) {
assertTrue(e.getMessage().contains("I have been thrown from TestFunction"));
@@ -158,7 +161,7 @@ public class LocalFunctionExecutionDUnitTest extends DistributedTestCase{
DistributedMember localmember = system.getDistributedMember();
ResultCollector rc = FunctionService.onMember(system, localmember).withArgs(Boolean.TRUE).execute(function1.getId());
rc.getResult();
- fail("Exception should occur",new Exception("Test Failed"));
+ Assert.fail("Exception should occur",new Exception("Test Failed"));
}
catch (Exception e) {
assertTrue(e.getMessage().contains("I have been thrown from TestFunction"));
@@ -166,13 +169,13 @@ public class LocalFunctionExecutionDUnitTest extends DistributedTestCase{
}
}
- public void tearDown2() throws Exception {
- super.tearDown2();
+ @Override
+ protected final void preTearDown() throws Exception {
if(cache != null) {
cache.close();
}
cache = null;
- invokeInEveryVM(new SerializableRunnable() { public void run() {
+ Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() {
if(cache != null) {
cache.close();
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MemberFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MemberFunctionExecutionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MemberFunctionExecutionDUnitTest.java
index 9508726..1f3ed17 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MemberFunctionExecutionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MemberFunctionExecutionDUnitTest.java
@@ -48,7 +48,9 @@ import com.gemstone.gemfire.i18n.LogWriterI18n;
import com.gemstone.gemfire.internal.ClassBuilder;
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.Host;
+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;
@@ -166,7 +168,7 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
resultCollector.getResult();
fail("Should have received FunctionException due to class not found");
} catch (FunctionException expected) {
- getLogWriter().warning("received wrong exception cause", expected.getCause());
+ LogWriterUtils.getLogWriter().warning("received wrong exception cause", expected.getCause());
assertTrue((expected.getCause() instanceof ClassNotFoundException));
}
}
@@ -340,7 +342,7 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
fail("Should have seen an exception");
} catch (Exception e) {
if(!(e.getCause() instanceof FunctionInvocationTargetException)) {
- fail("failed", e);
+ Assert.fail("failed", e);
}
}
@@ -385,7 +387,7 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
}
});
List li = (ArrayList)rc.getResult();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"MemberFunctionExecutionDUnitTest#excuteOnMembers: Result : " + li);
assertEquals(li.size(), 1);
for (Object obj : li) {
@@ -394,9 +396,9 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
ds.disconnect();
}
catch (Exception e) {
- getLogWriter().info("Exception Occured : "+ e.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception Occured : "+ e.getMessage());
e.printStackTrace();
- fail("Test failed",e);
+ Assert.fail("Test failed",e);
}
}
/*
@@ -442,7 +444,7 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
try {
ResultCollector rc = executor.execute(function.getId());
List li = (ArrayList)rc.getResult();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"MemberFunctionExecutionDUnitTest#excuteOnMembers: Result : " + li);
assertEquals(li.size(), noOfMembers.intValue());
for (Object obj : li) {
@@ -450,9 +452,9 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
}
}
catch (Exception e) {
- getLogWriter().info("Exception Occured : "+ e.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception Occured : "+ e.getMessage());
e.printStackTrace();
- fail("Test failed",e);
+ Assert.fail("Test failed",e);
}
}
@@ -482,7 +484,7 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
try {
ResultCollector rc = memberExcution.withArgs(Boolean.TRUE).execute(function);
List li = (ArrayList)rc.getResult();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"MemberFunctionExecutionDUnitTest#excuteOnMembers: Result : " + li);
assertEquals(noOfMembers.intValue(), li.size());
for (Object obj : li) {
@@ -490,9 +492,9 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
}
}
catch (Exception e) {
- getLogWriter().info("Exception Occured : "+ e.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception Occured : "+ e.getMessage());
e.printStackTrace();
- fail("Test failed",e);
+ Assert.fail("Test failed",e);
}
}
@@ -584,7 +586,7 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
}
});
List li = (ArrayList)rc.getResult();
- getLogWriter().info(
+ LogWriterUtils.getLogWriter().info(
"MemberFunctionExecutionDUnitTest#excuteOnMembers: Result : " + li);
assertEquals(li.size(), noOfMembers.intValue());
for (Object obj : li) {
@@ -592,9 +594,9 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
}
}
catch (Exception e) {
- getLogWriter().info("Exception Occured : "+ e.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception Occured : "+ e.getMessage());
e.printStackTrace();
- fail("Test failed",e);
+ Assert.fail("Test failed",e);
}
}
@@ -612,7 +614,7 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
fail("Test Failed");
}
catch (Exception expected) {
- getLogWriter().info("Exception Occured : "+ expected.getMessage());
+ LogWriterUtils.getLogWriter().info("Exception Occured : "+ expected.getMessage());
// boolean check = expected.getMessage().equals("Cannot return any result, as Function.hasResult() is false");
assertTrue(expected.getMessage().equals(LocalizedStrings.ExecuteFunction_CANNOT_0_RESULTS_HASRESULT_FALSE
.toLocalizedString("return any")));
@@ -658,20 +660,23 @@ public class MemberFunctionExecutionDUnitTest extends CacheTestCase {
FunctionService.registerFunction(new TestFunction(true,TestFunction.TEST_FUNCTION_NO_LASTRESULT));
}
catch (Exception e) {
- fail("Failed while creating the Distribued System", e);
+ Assert.fail("Failed while creating the Distribued System", e);
}
return ds;
}
@Override
- public void tearDown2() throws Exception {
+ protected final void preTearDownCacheTestCase() throws Exception {
List<VM> members = new ArrayList<VM>(4);
members.add(member1); members.add(member2); members.add(member3); members.add(member4);
for (VM member: members) {
member.invoke(MemberFunctionExecutionDUnitTest.class, "registerExpectedExceptions",
new Object[] { Boolean.FALSE });
}
- super.tearDown2();
+ }
+
+ @Override
+ protected final void postTearDownCacheTestCase() throws Exception {
disconnectAllFromDS();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MultiRegionFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MultiRegionFunctionExecutionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MultiRegionFunctionExecutionDUnitTest.java
index b9f0dc2..899e2bf 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MultiRegionFunctionExecutionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/MultiRegionFunctionExecutionDUnitTest.java
@@ -35,6 +35,7 @@ import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.Assert;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -70,10 +71,10 @@ public class MultiRegionFunctionExecutionDUnitTest extends CacheTestCase {
vm3 = host.getVM(3);
}
- public void tearDown2() throws Exception {
- super.tearDown2();
+ @Override
+ protected final void postTearDownCacheTestCase() throws Exception {
cache = null;
- invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
+ Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
}
public void testMultiRegionFunctionExecution(){
@@ -153,7 +154,7 @@ public class MultiRegionFunctionExecutionDUnitTest extends CacheTestCase {
assertNotNull(cache);
}
catch (Exception e) {
- fail("Failed while creating the cache", e);
+ com.gemstone.gemfire.test.dunit.Assert.fail("Failed while creating the cache", e);
}
}
@SuppressWarnings("unchecked")
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/OnGroupsFunctionExecutionDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/OnGroupsFunctionExecutionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/OnGroupsFunctionExecutionDUnitTest.java
index fd5b1a4..3cc34d8 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/OnGroupsFunctionExecutionDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/OnGroupsFunctionExecutionDUnitTest.java
@@ -44,9 +44,14 @@ import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
*
@@ -59,8 +64,8 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
}
@Override
- public void tearDown2() throws Exception {
- invokeInEveryVM(new SerializableCallable() {
+ protected final void preTearDown() throws Exception {
+ Invoke.invokeInEveryVM(new SerializableCallable() {
@Override
public Object call() throws Exception {
Cache c = null;
@@ -83,7 +88,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
@Override
public void execute(FunctionContext context) {
- getLogWriter().fine("SWAP:1:executing OnGroupsFunction:"+invocationCount);
+ LogWriterUtils.getLogWriter().fine("SWAP:1:executing OnGroupsFunction:"+invocationCount);
InternalDistributedSystem ds = InternalDistributedSystem.getConnectedInstance();
synchronized (OnGroupsFunction.class) {
invocationCount++;
@@ -228,7 +233,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
vm0.invoke(new SerializableCallable() {
@Override
public Object call() throws Exception {
- getLogWriter().fine("SWAP:invoking on gm");
+ LogWriterUtils.getLogWriter().fine("SWAP:invoking on gm");
DistributedSystem ds = getSystem();
try {
FunctionService.onMember("no such group");
@@ -255,7 +260,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
@Override
public Object call() throws Exception {
DistributedSystem ds = getSystem();
- getLogWriter().fine("SWAP:invoking on g0");
+ LogWriterUtils.getLogWriter().fine("SWAP:invoking on g0");
Execution e = FunctionService.onMembers("g0");
ArrayList<String> args = new ArrayList<String>();
args.add("g0");
@@ -295,7 +300,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
vm0.invoke(new SerializableCallable() {
@Override
public Object call() throws Exception {
- getLogWriter().fine("SWAP:invoking on g0 g1");
+ LogWriterUtils.getLogWriter().fine("SWAP:invoking on g0 g1");
InternalDistributedSystem ds = InternalDistributedSystem.getConnectedInstance();
Execution e = FunctionService.onMembers("g0", "g1");
ArrayList<String> args = new ArrayList<String>();
@@ -492,7 +497,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
//The test function deliberately throws a null pointer exception.
//which is logged.
- addExpectedException(NullPointerException.class.getSimpleName());
+ IgnoredException.addIgnoredException(NullPointerException.class.getSimpleName());
initVM(vm0, "g0,mg", regionName, false);
initVM(vm1, "g1", regionName, false);
@@ -680,11 +685,11 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
} catch (CacheClosedException cce) {
}
disconnectFromDS();
- getLogWriter().fine("SWAP:creating client cache");
+ LogWriterUtils.getLogWriter().fine("SWAP:creating client cache");
ClientCacheFactory ccf = new ClientCacheFactory();
ccf.addPoolLocator(hostName, locatorPort);
ccf.setPoolServerGroup("mg");
- ccf.set("log-level", getDUnitLogLevel());
+ ccf.set("log-level", LogWriterUtils.getDUnitLogLevel());
ClientCache c = ccf.create();
c.getLogger().info("SWAP:invoking function from client on g0");
@@ -778,11 +783,11 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
} catch (CacheClosedException cce) {
}
disconnectFromDS();
- getLogWriter().fine("SWAP:creating client cache");
+ LogWriterUtils.getLogWriter().fine("SWAP:creating client cache");
ClientCacheFactory ccf = new ClientCacheFactory();
ccf.addPoolLocator(hostName, locatorPort);
ccf.setPoolServerGroup("mg");
- ccf.set("log-level", getDUnitLogLevel());
+ ccf.set("log-level", LogWriterUtils.getDUnitLogLevel());
ClientCache c = ccf.create();
c.getLogger().info("SWAP:invoking function from client on g0");
@@ -855,14 +860,14 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
} catch (CacheClosedException cce) {
}
disconnectFromDS();
- getLogWriter().fine("SWAP:creating client cache");
+ LogWriterUtils.getLogWriter().fine("SWAP:creating client cache");
ClientCacheFactory ccf = new ClientCacheFactory();
ccf.addPoolLocator(hostName, locatorPort);
ccf.setPoolServerGroup("mg");
- ccf.set("log-level", getDUnitLogLevel());
+ ccf.set("log-level", LogWriterUtils.getDUnitLogLevel());
ClientCache c = ccf.create();
- ExpectedException ex = addExpectedException("No member found");
+ IgnoredException ex = IgnoredException.addIgnoredException("No member found");
try {
InternalFunctionService.onServer(c, "no such group").execute(new OnGroupsFunction()).getResult();
fail("expected exception not thrown");
@@ -935,14 +940,14 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
} catch (CacheClosedException cce) {
}
disconnectFromDS();
- getLogWriter().fine("SWAP:creating client cache");
+ LogWriterUtils.getLogWriter().fine("SWAP:creating client cache");
ClientCacheFactory ccf = new ClientCacheFactory();
ccf.addPoolLocator(hostName, locatorPort);
ccf.setPoolServerGroup("mg");
- ccf.set("log-level", getDUnitLogLevel());
+ ccf.set("log-level", LogWriterUtils.getDUnitLogLevel());
ClientCache c = ccf.create();
- ExpectedException expected = addExpectedException("No member found");
+ IgnoredException expected = IgnoredException.addIgnoredException("No member found");
try {
InternalFunctionService.onServers(c, "no such group").execute(new OnGroupsFunction()).getResult();
fail("expected exception not thrown");
@@ -951,7 +956,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
expected.remove();
}
- addExpectedException("NullPointerException");
+ IgnoredException.addIgnoredException("NullPointerException");
Execution e = InternalFunctionService.onServers(c, "mg");
ArrayList<String> args = new ArrayList<String>();
args.add("runtime");
@@ -1012,11 +1017,11 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
} catch (CacheClosedException cce) {
}
disconnectFromDS();
- getLogWriter().fine("SWAP:creating client cache");
+ LogWriterUtils.getLogWriter().fine("SWAP:creating client cache");
ClientCacheFactory ccf = new ClientCacheFactory();
ccf.addPoolLocator(hostName, locatorPort);
ccf.setPoolServerGroup("mg");
- ccf.set("log-level", getDUnitLogLevel());
+ ccf.set("log-level", LogWriterUtils.getDUnitLogLevel());
ClientCache c = ccf.create();
Execution e = InternalFunctionService.onServers(c, "g1");
@@ -1024,7 +1029,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
args.add("disconnect");
e = e.withArgs(args);
- addExpectedException("FunctionInvocationTargetException");
+ IgnoredException.addIgnoredException("FunctionInvocationTargetException");
try {
e.execute(new OnGroupsExceptionFunction()).getResult();
fail("expected exception not thrown");
@@ -1061,11 +1066,11 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
} catch (CacheClosedException cce) {
}
disconnectFromDS();
- getLogWriter().fine("SWAP:creating client cache");
+ LogWriterUtils.getLogWriter().fine("SWAP:creating client cache");
ClientCacheFactory ccf = new ClientCacheFactory();
ccf.addPoolLocator(hostName, locatorPort);
ccf.setPoolServerGroup("mg");
- ccf.set("log-level", getDUnitLogLevel());
+ ccf.set("log-level", LogWriterUtils.getDUnitLogLevel());
ClientCache c = ccf.create();
Execution e = InternalFunctionService.onServers(c, "g1");
@@ -1073,7 +1078,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
args.add("disconnect");
args.add("g2");
e = e.withArgs(args);
- addExpectedException("FunctionInvocationTargetException");
+ IgnoredException.addIgnoredException("FunctionInvocationTargetException");
try {
e.execute(new OnGroupsExceptionFunction()).getResult();
fail("expected exception not thrown");
@@ -1110,11 +1115,11 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
} catch (CacheClosedException cce) {
}
disconnectFromDS();
- getLogWriter().fine("SWAP:creating client cache");
+ LogWriterUtils.getLogWriter().fine("SWAP:creating client cache");
ClientCacheFactory ccf = new ClientCacheFactory();
ccf.addPoolLocator(hostName, locatorPort);
ccf.setPoolServerGroup("mg");
- ccf.set("log-level", getDUnitLogLevel());
+ ccf.set("log-level", LogWriterUtils.getDUnitLogLevel());
ClientCache c = ccf.create();
Execution e = InternalFunctionService.onServers(c, "g1");
@@ -1124,7 +1129,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
e = e.withArgs(args);
((AbstractExecution)e).setIgnoreDepartedMembers(true);
ArrayList l = (ArrayList) e.execute(new OnGroupsExceptionFunction()).getResult();
- getLogWriter().info("SWAP:result:"+l);
+ LogWriterUtils.getLogWriter().info("SWAP:result:"+l);
assertEquals(2, l.size());
if (l.get(0) instanceof Throwable) {
assertTrue((Boolean) l.get(1));
@@ -1152,7 +1157,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
public void testNoAckGroupsFunction() {
//Workaround for #52005. This is a product bug
//that should be fixed
- addExpectedException("Cannot return any result");
+ IgnoredException.addIgnoredException("Cannot return any result");
Host host = Host.getHost(0);
final VM server0 = host.getVM(0);
final VM server1 = host.getVM(1);
@@ -1177,11 +1182,11 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
} catch (CacheClosedException cce) {
}
disconnectFromDS();
- getLogWriter().fine("SWAP:creating client cache");
+ LogWriterUtils.getLogWriter().fine("SWAP:creating client cache");
ClientCacheFactory ccf = new ClientCacheFactory();
ccf.addPoolLocator(hostName, locatorPort);
ccf.setPoolServerGroup("mg");
- ccf.set("log-level", getDUnitLogLevel());
+ ccf.set("log-level", LogWriterUtils.getDUnitLogLevel());
ClientCache c = ccf.create();
c.getLogger().info("SWAP:invoking function from client on g0");
@@ -1203,7 +1208,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
return "OnGroupsNoAck invocation count mismatch";
}
};
- DistributedTestCase.waitForCriterion(wc, 30000, 1000, true);
+ Wait.waitForCriterion(wc, 30000, 1000, true);
resetInvocationCount(server0);
resetInvocationCount(server1);
@@ -1219,7 +1224,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
}
});
// pause here to verify that we do not get more than 1 invocation
- DistributedTestCase.pause(5000);
+ Wait.pause(5000);
WaitCriterion wc2 = new WaitCriterion() {
@Override
public boolean done() {
@@ -1233,7 +1238,7 @@ public class OnGroupsFunctionExecutionDUnitTest extends DistributedTestCase {
return "OnGroupsNoAck invocation count mismatch";
}
};
- DistributedTestCase.waitForCriterion(wc2, 30000, 1000, true);
+ Wait.waitForCriterion(wc2, 30000, 1000, true);
resetInvocationCount(server0);
resetInvocationCount(server1);
resetInvocationCount(server2);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerFunctionExecutionNoAckDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerFunctionExecutionNoAckDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerFunctionExecutionNoAckDUnitTest.java
index d923eda..d33dc47 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerFunctionExecutionNoAckDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/execute/PRClientServerFunctionExecutionNoAckDUnitTest.java
@@ -31,6 +31,7 @@ import com.gemstone.gemfire.cache.execute.ResultCollector;
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.cache.functions.TestFunction;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
public class PRClientServerFunctionExecutionNoAckDUnitTest extends PRClientServerTestBase{
/**
@@ -66,7 +67,7 @@ public class PRClientServerFunctionExecutionNoAckDUnitTest extends PRClientServe
isByName = new Boolean(true);
toRegister = new Boolean(true);
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRClientServerFunctionExecutionNoAckDUnitTest#testServerFunctionExecution_NoAck : Starting test");
client.invoke(PRClientServerFunctionExecutionNoAckDUnitTest.class,
@@ -84,7 +85,7 @@ public class PRClientServerFunctionExecutionNoAckDUnitTest extends PRClientServe
registerFunctionAtServer(functionAck);
toRegister = new Boolean(false);
isByName = new Boolean(true);
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRClientServerFunctionExecutionNoAckDUnitTest#testServerFunctionExecution_NoAck : Starting test");
client.invoke(PRClientServerFunctionExecutionNoAckDUnitTest.class,
@@ -94,7 +95,7 @@ public class PRClientServerFunctionExecutionNoAckDUnitTest extends PRClientServe
}
private void createScenario() {
- getLogWriter()
+ LogWriterUtils.getLogWriter()
.info(
"PRClientServerFFunctionExecutionDUnitTest#createScenario : creating scenario");
createClientServerScenarionWithoutRegion();
@@ -117,11 +118,11 @@ public class PRClientServerFunctionExecutionNoAckDUnitTest extends PRClientServe
for(int i=0;i< NUM_ITERATION;i++)
execute(member, Boolean.TRUE, functionNoAck, isByName, toRegister);
t.stop();
- getLogWriter().info("Time taken to execute boolean based" + NUM_ITERATION + "NoAck functions :" + t.getTimeInMs());
+ LogWriterUtils.getLogWriter().info("Time taken to execute boolean based" + NUM_ITERATION + "NoAck functions :" + t.getTimeInMs());
}
catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
fail("Test failed after the execute operation");
}
@@ -135,11 +136,11 @@ public class PRClientServerFunctionExecutionNoAckDUnitTest extends PRClientServe
for(int i=0;i< NUM_ITERATION;i++)
execute(member, testKeysSet, functionNoAck, isByName, toRegister);
t.stop();
- getLogWriter().info("Time taken to execute setbased" + NUM_ITERATION + "NoAck functions :" + t.getTimeInMs());
+ LogWriterUtils.getLogWriter().info("Time taken to execute setbased" + NUM_ITERATION + "NoAck functions :" + t.getTimeInMs());
}
catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
fail("Test failed after the execute operationssssss");
}
if(toRegister.booleanValue()){
@@ -158,11 +159,11 @@ public class PRClientServerFunctionExecutionNoAckDUnitTest extends PRClientServe
timeinms += t.getTimeInMs();
assertEquals(Boolean.TRUE, ((List)rc.getResult()).get(0));
}
- getLogWriter().info("Time taken to execute boolean based" + NUM_ITERATION + "haveResults functions :" + timeinms);
+ LogWriterUtils.getLogWriter().info("Time taken to execute boolean based" + NUM_ITERATION + "haveResults functions :" + timeinms);
}
catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
fail("Test failed after the execute operation");
}
@@ -184,11 +185,11 @@ public class PRClientServerFunctionExecutionNoAckDUnitTest extends PRClientServe
}
}
- getLogWriter().info("Time taken to execute setbased" + NUM_ITERATION + "haveResults functions :" + timeinms);
+ LogWriterUtils.getLogWriter().info("Time taken to execute setbased" + NUM_ITERATION + "haveResults functions :" + timeinms);
}
catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
fail("Test failed after the execute operationssssss");
}
}
@@ -211,7 +212,7 @@ public class PRClientServerFunctionExecutionNoAckDUnitTest extends PRClientServe
}
catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
fail("Test failed after the execute operation allserver ");
}
@@ -224,7 +225,7 @@ public class PRClientServerFunctionExecutionNoAckDUnitTest extends PRClientServe
}
catch (Exception ex) {
ex.printStackTrace();
- getLogWriter().info("Exception : ", ex);
+ LogWriterUtils.getLogWriter().info("Exception : ", ex);
fail("Test failed after the execute operation");
}
}
@@ -234,15 +235,15 @@ public class PRClientServerFunctionExecutionNoAckDUnitTest extends PRClientServe
throws Exception {
if (isByName.booleanValue()) {// by name
if(toRegister.booleanValue()){
- getLogWriter().info("The function name to execute : " + function.getId());
+ LogWriterUtils.getLogWriter().info("The function name to execute : " + function.getId());
Execution me = member.withArgs(args);
- getLogWriter().info("The args passed : " + args);
+ LogWriterUtils.getLogWriter().info("The args passed : " + args);
return me.execute(function.getId());
}
else {
- getLogWriter().info("The function name to execute : (without Register) " + function.getId());
+ LogWriterUtils.getLogWriter().info("The function name to execute : (without Register) " + function.getId());
Execution me = member.withArgs(args);
- getLogWriter().info("The args passed : " + args);
+ LogWriterUtils.getLogWriter().info("The args passed : " + args);
return me.execute(function.getId(), function.hasResult(),function.isHA(),function.optimizeForWrite());
}
}
@@ -250,9 +251,4 @@ public class PRClientServerFunctionExecutionNoAckDUnitTest extends PRClientServe
return member.withArgs(args).execute(function);
}
}
-
- public void tearDown2() throws Exception {
- super.tearDown2();
- }
-
}