You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/02/02 21:21:49 UTC
[42/44] incubator-geode git commit: Refactor dunit
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryDataInconsistencyDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
index 50b2f23..02ab55f 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryDataInconsistencyDUnitTest.java
@@ -42,10 +42,13 @@ import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.internal.cache.execute.PRClientServerTestBase;
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.Host;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterSupport;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.Threads;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
/**
* This tests the data inconsistency during update on an index and querying the
@@ -93,9 +96,9 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
@Override
public void tearDown2() throws Exception {
- invokeInEveryVM(CacheTestCase.class, "disconnectFromDS");
+ Invoke.invokeInEveryVM(CacheTestCase.class, "disconnectFromDS");
super.tearDown2();
- invokeInEveryVM(QueryObserverHolder.class, "reset");
+ Invoke.invokeInEveryVM(QueryObserverHolder.class, "reset");
}
@Override
@@ -150,7 +153,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
@Override
public void run2() throws CacheException {
QueryService qs = CacheFactory.getAnyInstance().getQueryService();
- while (!hooked){pause(100);}
+ while (!hooked){Wait.pause(100);}
Object rs = null;
try {
rs = qs.newQuery("<trace> select * from /"+repRegionName+" where ID = 1").execute();
@@ -176,7 +179,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
@Override
public void run2() throws CacheException {
QueryService qs = CacheFactory.getAnyInstance().getQueryService();
- while (!hooked){pause(100);}
+ while (!hooked){Wait.pause(100);}
Object rs = null;
try {
rs = qs.newQuery("<trace> select * from /"+repRegionName+" where ID = 1").execute();
@@ -198,7 +201,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
hooked = false;//Let client put go further.
}
});
- DistributedTestCase.join(putThread, 200, this.getLogWriter());
+ Threads.join(putThread, 200, LogWriterSupport.getLogWriter());
}
public void testRangeIndex() {
@@ -253,7 +256,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
QueryService qs = CacheFactory.getAnyInstance().getQueryService();
Position pos1 = null;
- while (!hooked){pause(100);}
+ while (!hooked){Wait.pause(100);}
try {
Object rs = qs.newQuery("<trace> select pos from /"+repRegionName+" p, p.positions.values pos where pos.secId = 'APPL' AND p.ID = 1").execute();
CacheFactory.getAnyInstance().getLogger().fine("Shobhit: "+rs);
@@ -271,7 +274,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
hooked = false;//Let client put go further.
}
while (!hooked) {
- pause(100);
+ Wait.pause(100);
}
try {
Object rs = qs.newQuery("<trace> select pos from /"+repRegionName+" p, p.positions.values pos where pos.secId = 'APPL' AND p.ID = 1").execute();
@@ -293,7 +296,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
}
}
});
- DistributedTestCase.join(putThread, 200, this.getLogWriter());
+ Threads.join(putThread, 200, LogWriterSupport.getLogWriter());
}
public void testRangeIndexWithIndexAndQueryFromCluaseMisMatch() {
@@ -345,7 +348,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
QueryService qs = CacheFactory.getAnyInstance().getQueryService();
Position pos1 = null;
- while (!hooked){pause(100);}
+ while (!hooked){Wait.pause(100);}
try {
Object rs = qs.newQuery("<trace> select pos from /"+repRegionName+" p, p.positions.values pos where pos.secId = 'APPL' AND p.ID = 1").execute();
CacheFactory.getAnyInstance().getLogger().fine("Shobhit: "+rs);
@@ -363,7 +366,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
hooked = false;//Let client put go further.
}
while (!hooked) {
- pause(100);
+ Wait.pause(100);
}
try {
Object rs = qs.newQuery("select pos from /"+repRegionName+" p, p.positions.values pos where pos.secId = 'APPL' AND p.ID = 1").execute();
@@ -384,7 +387,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
}
}
});
- DistributedTestCase.join(putThread, 200, this.getLogWriter());
+ Threads.join(putThread, 200, LogWriterSupport.getLogWriter());
}
public void testRangeIndexWithIndexAndQueryFromCluaseMisMatch2() {
@@ -436,7 +439,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
QueryService qs = CacheFactory.getAnyInstance().getQueryService();
Position pos1 = null;
- while (!hooked){pause(100);}
+ while (!hooked){Wait.pause(100);}
try {
Object rs = qs.newQuery("<trace> select pos from /"+repRegionName+" p, p.collectionHolderMap.values coll, p.positions.values pos where pos.secId = 'APPL' AND p.ID = 1").execute();
CacheFactory.getAnyInstance().getLogger().fine("Shobhit: "+rs);
@@ -454,7 +457,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
hooked = false;//Let client put go further.
}
while (!hooked) {
- pause(100);
+ Wait.pause(100);
}
try {
Object rs = qs.newQuery("select pos from /"+repRegionName+" p, p.collectionHolderMap.values coll, p.positions.values pos where pos.secId = 'APPL' AND p.ID = 1").execute();
@@ -475,7 +478,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
}
}
});
- DistributedTestCase.join(putThread, 200, this.getLogWriter());
+ Threads.join(putThread, 200, LogWriterSupport.getLogWriter());
}
public static void createProxyRegions() {
@@ -538,7 +541,7 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
Region region = cache.getRegion(repRegionName);
for (int j = from; j < to; j++)
region.put(new Integer(j), portfolio[j]);
- getLogWriter()
+ LogWriterSupport.getLogWriter()
.info(
"PRQueryDUnitHelper#getCacheSerializableRunnableForPRPuts: Inserted Portfolio data on Region "
+ regionName);
@@ -552,17 +555,17 @@ public class QueryDataInconsistencyDUnitTest extends CacheTestCase {
switch (spot) {
case 9: //Before Index update and after region entry lock.
hooked = true;
- getLogWriter().info("QueryDataInconsistency.IndexManagerTestHook is hooked in Update Index Entry.");
+ LogWriterSupport.getLogWriter().info("QueryDataInconsistency.IndexManagerTestHook is hooked in Update Index Entry.");
while(hooked) {
- pause(100);
+ Wait.pause(100);
}
assertEquals(hooked, false);
break;
case 10: //Before Region update and after Index Remove call.
hooked = true;
- getLogWriter().info("QueryDataInconsistency.IndexManagerTestHook is hooked in Remove Index Entry.");
+ LogWriterSupport.getLogWriter().info("QueryDataInconsistency.IndexManagerTestHook is hooked in Remove Index Entry.");
while(hooked) {
- pause(100);
+ Wait.pause(100);
}
assertEquals(hooked, false);
break;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUsingXMLDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUsingXMLDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUsingXMLDUnitTest.java
index ba6d86c..de56700 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUsingXMLDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUsingXMLDUnitTest.java
@@ -63,12 +63,15 @@ import com.gemstone.gemfire.internal.cache.LocalRegion;
import com.gemstone.gemfire.internal.cache.PartitionedRegion;
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.DistributedTestSupport;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.Threads;
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;
import com.gemstone.gemfire.util.test.TestUtil;
public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
@@ -132,7 +135,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
public void setUp() throws Exception {
super.setUp();
//Workaround for #52008
- IgnoredException.addExpectedException("Failed to create index");
+ IgnoredException.addIgnoredException("Failed to create index");
}
public void tearDown2() throws Exception {
@@ -142,7 +145,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
String diskStoreName = cache.getDefaultDiskStoreName();
//reset TestHook
- invokeInEveryVM(resetTestHook());
+ Invoke.invokeInEveryVM(resetTestHook());
// close the cache.
closeCache();
disconnectFromDS();
@@ -163,18 +166,18 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
VM vm1 = host.getVM(1);
final String fileName = "IndexCreation.xml";
- getLogWriter().info(
+ com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter().info(
"Creating index using an xml file name : " + fileName);
AsyncInvocation asyInvk0 = vm0.invokeAsync(createIndexThrougXML("vm0testCreateIndexThroughXML", name, fileName));
AsyncInvocation asyInvk1 = vm1.invokeAsync(createIndexThrougXML("vm1testCreateIndexThroughXML", name, fileName));
- DistributedTestCase.join(asyInvk1, 30 * 1000, getLogWriter());
+ Threads.join(asyInvk1, 30 * 1000, com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter());
if (asyInvk1.exceptionOccurred()) {
Assert.fail("asyInvk1 failed", asyInvk1.getException());
}
- DistributedTestCase.join(asyInvk0, 30 * 1000, getLogWriter());
+ Threads.join(asyInvk0, 30 * 1000, com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter());
if (asyInvk0.exceptionOccurred()) {
Assert.fail("asyInvk0 failed", asyInvk0.getException());
}
@@ -230,7 +233,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
VM vm1 = host.getVM(1);
final String fileName = "IndexCreation.xml";
- getLogWriter().info(
+ com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter().info(
"Creating index using an xml file name : " + fileName);
vm0.invoke(createIndexThrougXML("vm0testCreateIndexWhileDoingGII", name, fileName));
@@ -285,7 +288,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
VM vm1 = host.getVM(1);
final String fileName = "IndexCreation.xml";
- getLogWriter().info(
+ com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter().info(
"Creating index using an xml file name : " + fileName);
vm0.invoke(createIndexThrougXML("vm0testRRegionCreateIndexWhileDoingGII", repRegName, fileName));
@@ -333,7 +336,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
VM vm1 = host.getVM(1);
final String fileName = "IndexCreation.xml";
- getLogWriter().info(
+ com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter().info(
"Creating index using an xml file name : " + fileName);
vm0.invoke(createIndexThrougXML("vm0testPersistentPRRegion", persistentRegName, fileName));
@@ -398,7 +401,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
VM vm1 = host.getVM(1);
final String fileName = "IndexCreation.xml";
- getLogWriter().info("### in testCreateIndexWhileDoingGIIWithEmptyPRRegion.");
+ com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter().info("### in testCreateIndexWhileDoingGIIWithEmptyPRRegion.");
vm0.invoke(createIndexThrougXML("vm0testGIIWithEmptyPRRegion", name, fileName));
@@ -435,12 +438,12 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
VM vm1 = host.getVM(1);
final String fileName = "IndexCreation.xml";
- getLogWriter().info(
+ com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter().info(
"Creating index using an xml file name : " + fileName);
AsyncInvocation asyInvk0 = vm0.invokeAsync(createIndexThrougXML("vm0testAsyncIndexWhileDoingGII", name, fileName));
- DistributedTestCase.join(asyInvk0, 30 * 1000, getLogWriter());
+ Threads.join(asyInvk0, 30 * 1000, com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter());
if (asyInvk0.exceptionOccurred()) {
Assert.fail("asyInvk0 failed", asyInvk0.getException());
}
@@ -453,14 +456,14 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
vm0.invoke(prIndexCreationCheck(name, statusIndex, 50));
- DistributedTestCase.join(asyInvk1, 30 * 1000, getLogWriter());
+ Threads.join(asyInvk1, 30 * 1000, com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter());
if (asyInvk1.exceptionOccurred()) {
Assert.fail("asyInvk1 failed", asyInvk1.getException());
}
vm1.invoke(prIndexCreationCheck(name, statusIndex, 50));
- DistributedTestCase.join(asyInvk0, 30 * 1000, getLogWriter());
+ Threads.join(asyInvk0, 30 * 1000, com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter());
if (asyInvk0.exceptionOccurred()) {
Assert.fail("asyInvk0 failed", asyInvk0.getException());
}
@@ -481,7 +484,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
VM vm1 = host.getVM(1);
final String fileName = "IndexCreation.xml";
- getLogWriter().info(
+ com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter().info(
"Creating index using an xml file name : " + fileName);
vm0.invoke(createIndexThrougXML("vm0testIndexCompareQResults", name, fileName));
@@ -544,11 +547,11 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
VM vm1 = host.getVM(1);
final String fileName = "IndexCreation.xml";
- getLogWriter().info(
+ com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter().info(
"Creating index using an xml file name : " + fileName);
AsyncInvocation asyInvk0 = vm0.invokeAsync(createIndexThrougXML("vm0testCreateAsyncIndexGIIAndQuery", name, fileName));
- DistributedTestCase.join(asyInvk0, 30 * 1000, getLogWriter());
+ Threads.join(asyInvk0, 30 * 1000, com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter());
if (asyInvk0.exceptionOccurred()) {
Assert.fail("asyInvk0 failed", asyInvk0.getException());
}
@@ -560,11 +563,11 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
AsyncInvocation asyInvk1 = vm1.invokeAsync(createIndexThrougXML("vm1testCreateAsyncIndexGIIAndQuery", name, fileName));
- DistributedTestCase.join(asyInvk1, 30 * 1000, getLogWriter());
+ Threads.join(asyInvk1, 30 * 1000, com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter());
if (asyInvk1.exceptionOccurred()) {
Assert.fail("asyInvk1 failed", asyInvk1.getException());
}
- DistributedTestCase.join(asyInvk0, 30 * 1000, getLogWriter());
+ Threads.join(asyInvk0, 30 * 1000, com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter());
if (asyInvk0.exceptionOccurred()) {
Assert.fail("asyInvk0 failed", asyInvk0.getException());
}
@@ -594,7 +597,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
VM vm1 = host.getVM(1);
final String fileName = "IndexCreation.xml";
- getLogWriter().info(
+ com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter().info(
"Creating index using an xml file name : " + fileName);
vm0.invoke(createIndexThrougXML("vm0testAsyncIndexAndCompareQResults", name, fileName));
@@ -613,7 +616,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
vm1.invoke(setTestHook());
vm1.invoke(createIndexThrougXML("vm1testAsyncIndexAndCompareQResults", name, fileName));
- DistributedTestCase.join(asyInvk0, 30 * 1000, getLogWriter());
+ Threads.join(asyInvk0, 30 * 1000, com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter());
if (asyInvk0.exceptionOccurred()) {
Assert.fail("asyInvk0 failed", asyInvk0.getException());
}
@@ -637,7 +640,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
VM vm1 = host.getVM(1);
final String fileName = "IndexCreation.xml";
- getLogWriter().info(
+ com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter().info(
"Creating index using an xml file name : " + fileName);
//create index using xml
vm0.invoke(createIndexThrougXML("vm0testIndexCreationForReplicatedPersistentOverFlowRegionOnRestart", persistentOverFlowRegName, fileName));
@@ -783,7 +786,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
return "Number of Indexed Bucket is less than the expected number. "+ bucketCount + ", " + index.getNumberOfIndexedBuckets();
}
};
- DistributedTestCase.waitForCriterion(ev, MAX_TIME, 200, true);
+ Wait.waitForCriterion(ev, MAX_TIME, 200, true);
return true;
}
@@ -884,7 +887,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
}
// compare.
- getLogWriter().info("Execute query : \n queryStr with index: " + s[0] + " \n queryStr without index: " + s[1]);
+ com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter().info("Execute query : \n queryStr with index: " + s[0] + " \n queryStr without index: " + s[1]);
ssORrs.CompareQueryResultsWithoutAndWithIndexes(sr, 1, s);
}
}
@@ -944,7 +947,7 @@ public class QueryIndexUsingXMLDUnitTest extends CacheTestCase {
new Exception("TEST DEBUG###" + diskStoreId).printStackTrace();
if (system == null || !system.isConnected()) {
// Figure out our distributed system properties
- Properties p = getAllDistributedSystemProperties(getDistributedSystemProperties());
+ Properties p = DistributedTestSupport.getAllDistributedSystemProperties(getDistributedSystemProperties());
system = (InternalDistributedSystem)DistributedSystem.connect(p);
}
return system;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryParamsAuthorizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryParamsAuthorizationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryParamsAuthorizationDUnitTest.java
index 8030f09..5cb5bef 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryParamsAuthorizationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryParamsAuthorizationDUnitTest.java
@@ -32,6 +32,7 @@ import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkSupport;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -83,7 +84,7 @@ public class QueryParamsAuthorizationDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
ClientCacheFactory ccf = new ClientCacheFactory()
- .addPoolServer(getServerHostName(server1.getHost()), port)
+ .addPoolServer(NetworkSupport.getServerHostName(server1.getHost()), port)
.set("security-client-auth-init",
"templates.security.UserPasswordAuthInit.create")
.set("security-username", "root").set("security-password", "root");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java
index f6e6799..5a78b8d 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingFunctionContextDUnitTest.java
@@ -58,6 +58,9 @@ import com.gemstone.gemfire.internal.cache.execute.PRClientServerTestBase;
import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterSupport;
+import com.gemstone.gemfire.test.dunit.NetworkSupport;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -133,11 +136,11 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
@Override
public void tearDown2() throws Exception {
- invokeInEveryVM(CacheTestCase.class, "disconnectFromDS");
+ Invoke.invokeInEveryVM(CacheTestCase.class, "disconnectFromDS");
super.tearDown2();
- invokeInEveryVM(QueryObserverHolder.class, "reset");
+ Invoke.invokeInEveryVM(QueryObserverHolder.class, "reset");
cache = null;
- invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
+ Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
}
@Override
@@ -158,7 +161,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
* Test on Replicated Region.
*/
public void testQueriesWithFilterKeysOnReplicatedRegion() {
- IgnoredException.addExpectedException("IllegalArgumentException");
+ IgnoredException.addIgnoredException("IllegalArgumentException");
Object[][] r = new Object[queriesForRR.length][2];
@@ -228,7 +231,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
public void testInvalidQueries() {
- IgnoredException.addExpectedException("Syntax error");
+ IgnoredException.addIgnoredException("Syntax error");
client.invoke(new CacheSerializableRunnable("Test query on client and server") {
@Override
@@ -363,7 +366,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
*
*/
public void testQueriesWithFilterKeysOnPRWithBucketDestroy() {
- IgnoredException.addExpectedException("QueryInvocationTargetException");
+ IgnoredException.addIgnoredException("QueryInvocationTargetException");
Object[][] r = new Object[queries.length][2];
Set filter = new HashSet();
@@ -435,11 +438,11 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
*
*/
public void testQueriesWithFilterKeysOnPRWithRebalancing() {
- IgnoredException.addExpectedException("QueryInvocationTargetException");
- IgnoredException.addExpectedException("java.net.SocketException");
- IgnoredException.addExpectedException("ServerConnectivityException");
- IgnoredException.addExpectedException("FunctionException");
- IgnoredException.addExpectedException("IOException");
+ IgnoredException.addIgnoredException("QueryInvocationTargetException");
+ IgnoredException.addIgnoredException("java.net.SocketException");
+ IgnoredException.addIgnoredException("ServerConnectivityException");
+ IgnoredException.addIgnoredException("FunctionException");
+ IgnoredException.addIgnoredException("IOException");
// Close cache on server1
server1.invoke(new CacheSerializableRunnable("Set QueryObserver in cache on server1") {
@@ -514,7 +517,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
public void testNonColocatedRegionQueries() {
- IgnoredException.addExpectedException("UnsupportedOperationException");
+ IgnoredException.addIgnoredException("UnsupportedOperationException");
client.invoke(new CacheSerializableRunnable("Test query on non-colocated regions on server") {
@Override
public void run2() throws CacheException {
@@ -727,7 +730,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
//Create client cache without regions
client.invoke(QueryUsingFunctionContextDUnitTest.class, "createCacheClientWithoutRegion",
- new Object[] { getServerHostName(server1.getHost()), port1, port2,
+ new Object[] { NetworkSupport.getServerHostName(server1.getHost()), port1, port2,
port3 });
//Create proxy regions on client.
@@ -1018,7 +1021,7 @@ public class QueryUsingFunctionContextDUnitTest extends CacheTestCase {
Region region = cache.getRegion(regionName);
for (int j = from; j < to; j++)
region.put(new Integer(j), portfolio[j]);
- getLogWriter()
+ LogWriterSupport.getLogWriter()
.info(
"PRQueryDUnitHelper#getCacheSerializableRunnableForPRPuts: Inserted Portfolio data on Region "
+ regionName);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
index 9165c2e..c40be0e 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryUsingPoolDUnitTest.java
@@ -50,10 +50,14 @@ import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientNotifier;
import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.DistributedTestSupport;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterSupport;
+import com.gemstone.gemfire.test.dunit.NetworkSupport;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
/**
* Tests remote (client/server) query execution.
@@ -96,8 +100,8 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
public void setUp() throws Exception {
super.setUp();
disconnectAllFromDS();
- IgnoredException.addExpectedException("Connection reset");
- IgnoredException.addExpectedException("Socket input is shutdown");
+ IgnoredException.addIgnoredException("Connection reset");
+ IgnoredException.addIgnoredException("Socket input is shutdown");
}
public void tearDown2() throws Exception {
@@ -128,7 +132,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
PoolFactory cpf = PoolManager.createFactory();
cpf.setSubscriptionEnabled(subscriptionEnabled);
for (int i=0; i < servers.length; i++){
- getLogWriter().info("### Adding to Pool. ### Server : " + servers[i] + " Port : " + ports[i]);
+ LogWriterSupport.getLogWriter().info("### Adding to Pool. ### Server : " + servers[i] + " Port : " + ports[i]);
cpf.addServer(servers[i], ports[i]);
}
@@ -146,7 +150,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
if (count == compiledQueryCount){
break;
} else {
- pause(1 * 100);
+ Wait.pause(1 * 100);
}
}
assertEquals(compiledQueryCount, count);
@@ -171,12 +175,12 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name, rootRegionName, factory.create());
- pause(1000);
+ Wait.pause(1000);
try {
startBridgeServer(0, false);
} catch (Exception ex) {
@@ -197,7 +201,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
final int port = vm0.invokeInt(QueryUsingPoolDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
final String regionName = "/" + rootRegionName + "/" + name;
// Create client pool.
@@ -308,12 +312,12 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name, factory.create());
- pause(1000);
+ Wait.pause(1000);
try {
startBridgeServer(0, false);
} catch (Exception ex) {
@@ -333,7 +337,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
});
final int port = vm0.invokeInt(QueryUsingPoolDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
final String regionName = "/" + rootRegionName + "/" + name;
@@ -440,12 +444,12 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name, factory.create());
- pause(1000);
+ Wait.pause(1000);
try {
startBridgeServer(0, false);
} catch (Exception ex) {
@@ -573,7 +577,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
// Create client region
final int port = vm0.invokeInt(QueryUsingPoolDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
vm1.invoke(new CacheSerializableRunnable("Create region") {
public void run2() throws CacheException {
Properties config = new Properties();
@@ -604,7 +608,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
} catch (Exception e) {
Assert.fail("Failed executing " + queryString, e);
}
- getLogWriter().fine("size: " + results.size());
+ LogWriterSupport.getLogWriter().fine("size: " + results.size());
//assertEquals(numberOfEntries, results.size());
assertTrue(!results.getCollectionType().allowsDuplicates() && results.getCollectionType().getElementType().isStructType());
}
@@ -636,12 +640,12 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name, factory.create());
- pause(1000);
+ Wait.pause(1000);
try {
startBridgeServer(0, false);
} catch (Exception ex) {
@@ -662,7 +666,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
// Create client region
final int port = vm0.invokeInt(QueryUsingPoolDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
final String regionName = "/" + rootRegionName + "/" + name;
@@ -843,7 +847,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
// Create client region
final int port = vm0.invokeInt(QueryUsingPoolDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
final String regionName = "/" + this.rootRegionName + "/" + this.regionName;
@@ -868,7 +872,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
for (int i=0; i < queryString.length; i++){
try {
- getLogWriter().info("### Executing Query :" + queryString[i]);
+ LogWriterSupport.getLogWriter().info("### Executing Query :" + queryString[i]);
Query query = qService.newQuery(queryString[i]);
results = (SelectResults)query.execute(params[i]);
} catch (Exception e) {
@@ -901,7 +905,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
for (int x=0; x < useMaintainedCompiledQueries; x++){
for (int i=0; i < queryString.length; i++){
try {
- getLogWriter().info("### Executing Query :" + queryString[i]);
+ LogWriterSupport.getLogWriter().info("### Executing Query :" + queryString[i]);
Query query = qService.newQuery(queryString[i]);
results = (SelectResults)query.execute(params[i]);
} catch (Exception e) {
@@ -1002,7 +1006,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
final int port0 = vm0.invokeInt(QueryUsingPoolDUnitTest.class, "getCacheServerPort");
final int port1 = vm1.invokeInt(QueryUsingPoolDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
final String regionName = "/" + this.rootRegionName + "/" + this.regionName;
@@ -1027,7 +1031,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
for (int j=0; j < queryString.length; j++){
for (int i=0; i < queryString.length; i++){
try {
- getLogWriter().info("### Executing Query :" + queryString[i]);
+ LogWriterSupport.getLogWriter().info("### Executing Query :" + queryString[i]);
Query query = qService.newQuery(queryString[i]);
results = (SelectResults)query.execute(params[i]);
} catch (Exception e) {
@@ -1153,7 +1157,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
});
final int port = vm0.invokeInt(QueryUsingPoolDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
final String regionName = "/" + this.rootRegionName + "/" + this.regionName;
@@ -1244,7 +1248,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
});
final int port = vm0.invokeInt(QueryUsingPoolDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
final String regionName = "/" + this.rootRegionName + "/" + this.regionName;
@@ -1283,7 +1287,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
vm2.invokeAsync(new CacheSerializableRunnable("Execute queries") {
public void run2() throws CacheException {
for (int i=0; i < 10; i++) {
- pause(200);
+ Wait.pause(200);
executeCompiledQueries(poolName, params);
}
}
@@ -1293,7 +1297,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
validateCompiledQuery(vm0, queryString.length);
// Let the compiled queries to be idle (not used).
- pause(2 * 1000);
+ Wait.pause(2 * 1000);
// Validate maintained compiled queries.
this.validateCompiledQuery(vm0, 0);
@@ -1364,7 +1368,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
});
final int port = vm0.invokeInt(QueryUsingPoolDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
final String regionName = "/" + this.rootRegionName + "/" + this.regionName;
@@ -1405,7 +1409,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
vm2.invokeAsync(new CacheSerializableRunnable("Execute queries") {
public void run2() throws CacheException {
for (int i=0; i < 10; i++) {
- pause(10);
+ Wait.pause(10);
executeCompiledQueries(poolName, params);
}
}
@@ -1510,7 +1514,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
// Create client region
final int port0 = vm0.invokeInt(QueryUsingPoolDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
final String regionName = "/" + this.rootRegionName + "/" + this.regionName;
@@ -1536,7 +1540,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
for (int j=0; j < 5; j++){
for (int i=0; i < 2; i++){
try {
- getLogWriter().info("### Executing Query :" + queryString[i]);
+ LogWriterSupport.getLogWriter().info("### Executing Query :" + queryString[i]);
Query query = qService.newQuery(queryString[i]);
rs[0][0] = (SelectResults)query.execute(params[i]);
Query query2 = qService.newQuery(querys[i]);
@@ -1545,9 +1549,9 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
} catch (Exception e) {
Assert.fail("Failed executing " + queryString[i], e);
}
- getLogWriter().info("### Comparing results for Query :" + ((i+1) * (j+1)) + " : " + queryString[i]);
+ LogWriterSupport.getLogWriter().info("### Comparing results for Query :" + ((i+1) * (j+1)) + " : " + queryString[i]);
compareQueryResultsWithoutAndWithIndexes(rs, 1);
- getLogWriter().info("### Done Comparing results for Query :" + ((i+1) * (j+1)) + " : " + queryString[i]);
+ LogWriterSupport.getLogWriter().info("### Done Comparing results for Query :" + ((i+1) * (j+1)) + " : " + queryString[i]);
}
}
}
@@ -1562,9 +1566,9 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
long compiledQueryUsedCount = -1;
while (true) {
- getLogWriter().info("### CompiledQueryUsedCount :" + compiledQueryUsedCount);
+ LogWriterSupport.getLogWriter().info("### CompiledQueryUsedCount :" + compiledQueryUsedCount);
if (compiledQueryUsedCount == CacheClientNotifier.getInstance().getStats().getCompiledQueryUsedCount()) {
- getLogWriter().info("### previous and current CompiledQueryUsedCounts are same :" + compiledQueryUsedCount);
+ LogWriterSupport.getLogWriter().info("### previous and current CompiledQueryUsedCounts are same :" + compiledQueryUsedCount);
break;
} else {
compiledQueryUsedCount = CacheClientNotifier.getInstance().getStats().getCompiledQueryUsedCount();
@@ -1596,7 +1600,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
for (int j=0; j < queryString.length; j++){
for (int i=0; i < queryString.length; i++){
try {
- getLogWriter().info("### Executing Query :" + queryString[i]);
+ LogWriterSupport.getLogWriter().info("### Executing Query :" + queryString[i]);
Query query = qService.newQuery(queryString[i]);
rs[0][0] = (SelectResults)query.execute(params[i]);
Query query2 = qService.newQuery(querys[i]);
@@ -1620,9 +1624,9 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
public void run2() throws CacheException {
long compiledQueryUsedCount = -1;
while (true) {
- getLogWriter().info("### previous CompiledQueryUsedCount :" + compiledQueryUsedCount);
+ LogWriterSupport.getLogWriter().info("### previous CompiledQueryUsedCount :" + compiledQueryUsedCount);
if (compiledQueryUsedCount == CacheClientNotifier.getInstance().getStats().getCompiledQueryUsedCount()) {
- getLogWriter().info("### previous and current CompiledQueryUsedCounts are same :" + compiledQueryUsedCount);
+ LogWriterSupport.getLogWriter().info("### previous and current CompiledQueryUsedCounts are same :" + compiledQueryUsedCount);
break;
} else {
compiledQueryUsedCount = CacheClientNotifier.getInstance().getStats().getCompiledQueryUsedCount();
@@ -1666,13 +1670,13 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name+"1", factory.create());
createRegion(name+"2", factory.create());
- pause(1000);
+ Wait.pause(1000);
try {
startBridgeServer(0, false);
} catch (Exception ex) {
@@ -1697,7 +1701,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
// Create client region
final int port = vm0.invokeInt(QueryUsingPoolDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
final String regionName1 = "/" + rootRegionName + "/" + name+"1";
final String regionName2 = "/" + rootRegionName + "/" + name+"2";
@@ -1769,12 +1773,12 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name, factory.create());
- pause(1000);
+ Wait.pause(1000);
try {
startBridgeServer(0, false);
} catch (Exception ex) {
@@ -1794,7 +1798,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
});
final int port = vm0.invokeInt(QueryUsingPoolDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
final String regionName = "/" + rootRegionName + "/" + name;
@@ -1907,10 +1911,10 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
- pause(1000);
+ Wait.pause(1000);
try {
startBridgeServer(0, false);
} catch (Exception ex) {
@@ -1932,7 +1936,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
}
});
- pause(1000);
+ Wait.pause(1000);
for (int i=0; i<numberOfEntries; i++) {
region1.put("key-"+i, new TestObject(i, "ibm"));
region2.put("key-"+i, new TestObject(i, "ibm"));
@@ -1942,7 +1946,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
});
final int port = vm0.invokeInt(QueryUsingPoolDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
final String regionName1 = "/" + rootRegionName + "/" + name;
final String regionName2 = "/" + rootRegionName + "/" + name + "_2";
@@ -2003,12 +2007,12 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name, factory.create());
- pause(1000);
+ Wait.pause(1000);
try {
startBridgeServer(0, false);
} catch (Exception ex) {
@@ -2037,7 +2041,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
// Create client region
final int port = vm0.invokeInt(QueryUsingPoolDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
final String regionName = "/" + rootRegionName + "/" + name;
@@ -2161,10 +2165,10 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
- pause(1000);
+ Wait.pause(1000);
try {
startBridgeServer(0, false);
} catch (Exception ex) {
@@ -2188,7 +2192,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
});
final int port = vm0.invokeInt(QueryUsingPoolDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
final String regionName1 = "/" + rootRegionName + "/" + name;
// final String regionName2 = "/" + rootRegionName + "/" + name + "_2";
@@ -2306,16 +2310,16 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
type1 = ((SelectResults)r[j][0]).getCollectionType().getElementType();
type2 = ((SelectResults)r[j][1]).getCollectionType().getElementType();
if ((type1.getClass().getName()).equals(type2.getClass().getName())) {
- getLogWriter().info("Both SelectResults are of the same Type i.e.--> "
+ LogWriterSupport.getLogWriter().info("Both SelectResults are of the same Type i.e.--> "
+ ((SelectResults)r[j][0]).getCollectionType().getElementType());
}
else {
- getLogWriter().info("Classes are : " + type1.getClass().getName() + " "
+ LogWriterSupport.getLogWriter().info("Classes are : " + type1.getClass().getName() + " "
+ type2.getClass().getName());
fail("FAILED:Select result Type is different in both the cases");
}
if (((SelectResults)r[j][0]).size() == ((SelectResults)r[j][1]).size()) {
- getLogWriter().info("Both SelectResults are of Same Size i.e. Size= "
+ LogWriterSupport.getLogWriter().info("Both SelectResults are of Same Size i.e. Size= "
+ ((SelectResults)r[j][1]).size());
}
else {
@@ -2326,7 +2330,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
set2 = (((SelectResults)r[j][1]).asSet());
set1 = (((SelectResults)r[j][0]).asSet());
- getLogWriter().info(" SIZE1 = " + set1.size() + " SIZE2 = " + set2.size());
+ LogWriterSupport.getLogWriter().info(" SIZE1 = " + set1.size() + " SIZE2 = " + set2.size());
// boolean pass = true;
itert1 = set1.iterator();
@@ -2336,10 +2340,10 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
boolean exactMatch = false;
while (itert2.hasNext()) {
- getLogWriter().info("### Comparing results..");
+ LogWriterSupport.getLogWriter().info("### Comparing results..");
Object p2 = itert2.next();
if (p1 instanceof Struct) {
- getLogWriter().info("ITS a Set");
+ LogWriterSupport.getLogWriter().info("ITS a Set");
Object[] values1 = ((Struct)p1).getFieldValues();
Object[] values2 = ((Struct)p2).getFieldValues();
assertEquals(values1.length, values2.length);
@@ -2352,37 +2356,37 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
exactMatch = elementEqual;
}
else {
- getLogWriter().info("Not a Set p2:" + p2 + " p1: " + p1);
+ LogWriterSupport.getLogWriter().info("Not a Set p2:" + p2 + " p1: " + p1);
if (p2 instanceof TestObject) {
- getLogWriter().info("An instance of TestObject");
+ LogWriterSupport.getLogWriter().info("An instance of TestObject");
exactMatch = p2.equals(p1);
} else {
- getLogWriter().info("Not an instance of TestObject" + p2.getClass().getCanonicalName());
+ LogWriterSupport.getLogWriter().info("Not an instance of TestObject" + p2.getClass().getCanonicalName());
exactMatch = p2.equals(p1);
}
}
if (exactMatch) {
- getLogWriter().info("Exact MATCH");
+ LogWriterSupport.getLogWriter().info("Exact MATCH");
break;
}
}
if (!exactMatch) {
- getLogWriter().info("NOT A MATCH");
+ LogWriterSupport.getLogWriter().info("NOT A MATCH");
fail("Atleast one element in the pair of SelectResults supposedly identical, is not equal ");
}
}
- getLogWriter().info("### Done Comparing results..");
+ LogWriterSupport.getLogWriter().info("### Done Comparing results..");
}
}
protected void configAndStartBridgeServer() {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(this.regionName, this.rootRegionName, factory.create());
- pause(1000);
+ Wait.pause(1000);
try {
startBridgeServer(0, false);
} catch (Exception ex) {
@@ -2404,7 +2408,7 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
for (int i=0; i < queryString.length; i++){
try {
- getLogWriter().info("### Executing Query :" + queryString[i]);
+ LogWriterSupport.getLogWriter().info("### Executing Query :" + queryString[i]);
Query query = qService.newQuery(queryString[i]);
results = (SelectResults)query.execute(params[i]);
} catch (Exception e) {
@@ -2443,17 +2447,17 @@ public class QueryUsingPoolDUnitTest extends CacheTestCase {
SerializableRunnable closeCache =
new CacheSerializableRunnable("Close Client") {
public void run2() throws CacheException {
- getLogWriter().info("### Close Client. ###");
+ LogWriterSupport.getLogWriter().info("### Close Client. ###");
try {
closeCache();
} catch (Exception ex) {
- getLogWriter().info("### Failed to get close client. ###");
+ LogWriterSupport.getLogWriter().info("### Failed to get close client. ###");
}
}
};
client.invoke(closeCache);
- pause(2 * 1000);
+ Wait.pause(2 * 1000);
}
private static int getCacheServerPort() {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java
index de8ca54..3944c01 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/RemoteQueryDUnitTest.java
@@ -43,9 +43,13 @@ import com.gemstone.gemfire.cache30.ClientServerTestCase;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.DistributedTestSupport;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterSupport;
+import com.gemstone.gemfire.test.dunit.NetworkSupport;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
import cacheRunner.Portfolio;
import cacheRunner.Position;
@@ -99,12 +103,12 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name, factory.create());
- pause(1000);
+ Wait.pause(1000);
try {
startBridgeServer(0, false);
} catch (Exception ex) {
@@ -125,7 +129,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
// Create client region
final int port = vm0.invokeInt(RemoteQueryDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
vm1.invoke(new CacheSerializableRunnable("Create region") {
public void run2() throws CacheException {
Properties config = new Properties();
@@ -242,12 +246,12 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name, factory.create());
- pause(1000);
+ Wait.pause(1000);
try {
startBridgeServer(0, false);
} catch (Exception ex) {
@@ -268,7 +272,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
// Create client region
final int port = vm0.invokeInt(RemoteQueryDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
vm1.invoke(new CacheSerializableRunnable("Create region") {
public void run2() throws CacheException {
Properties config = new Properties();
@@ -370,12 +374,12 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name, factory.create());
- pause(1000);
+ Wait.pause(1000);
try {
startBridgeServer(0, false);
} catch (Exception ex) {
@@ -396,7 +400,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
// Create client region
final int port = vm0.invokeInt(RemoteQueryDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
vm1.invoke(new CacheSerializableRunnable("Create region") {
public void run2() throws CacheException {
Properties config = new Properties();
@@ -496,12 +500,12 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name, factory.create());
- pause(1000);
+ Wait.pause(1000);
try {
startBridgeServer(0, false);
} catch (Exception ex) {
@@ -629,7 +633,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
// Create client region
final int port = vm0.invokeInt(RemoteQueryDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
vm1.invoke(new CacheSerializableRunnable("Create region") {
public void run2() throws CacheException {
Properties config = new Properties();
@@ -660,7 +664,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
} catch (Exception e) {
Assert.fail("Failed executing " + queryString, e);
}
- getLogWriter().fine("size: " + results.size());
+ LogWriterSupport.getLogWriter().fine("size: " + results.size());
//assertEquals(numberOfEntries, results.size());
assertTrue(!results.getCollectionType().allowsDuplicates() && results.getCollectionType().getElementType().isStructType());
}
@@ -690,12 +694,12 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name, factory.create());
- pause(1000);
+ Wait.pause(1000);
try {
startBridgeServer(0, false);
} catch (Exception ex) {
@@ -716,7 +720,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
// Create client region
final int port = vm0.invokeInt(RemoteQueryDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
vm1.invoke(new CacheSerializableRunnable("Create region") {
public void run2() throws CacheException {
Properties config = new Properties();
@@ -855,13 +859,13 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createRegion(name+"1", factory.create());
createRegion(name+"2", factory.create());
- pause(1000);
+ Wait.pause(1000);
try {
startBridgeServer(0, false);
} catch (Exception ex) {
@@ -886,7 +890,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
// Create client region
final int port = vm0.invokeInt(RemoteQueryDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
vm1.invoke(new CacheSerializableRunnable("Create region") {
public void run2() throws CacheException {
Properties config = new Properties();
@@ -956,7 +960,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
@@ -980,7 +984,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
});
final int port = vm0.invokeInt(RemoteQueryDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
// Create client region in VM1
vm1.invoke(new CacheSerializableRunnable("Create region") {
@@ -1115,7 +1119,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
@@ -1139,7 +1143,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
});
final int port = vm0.invokeInt(RemoteQueryDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
// Create client region in VM1
vm1.invoke(new CacheSerializableRunnable("Create region") {
@@ -1219,7 +1223,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
vm0.invoke(new CacheSerializableRunnable("Create Bridge Server") {
public void run2() throws CacheException {
Properties config = new Properties();
- config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]");
+ config.setProperty("locators", "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
system = (InternalDistributedSystem) DistributedSystem.connect(config);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
@@ -1250,7 +1254,7 @@ public class RemoteQueryDUnitTest extends CacheTestCase {
});
final int port = vm0.invokeInt(RemoteQueryDUnitTest.class, "getCacheServerPort");
- final String host0 = getServerHostName(vm0.getHost());
+ final String host0 = NetworkSupport.getServerHostName(vm0.getHost());
// Create client region in VM1
vm1.invoke(new CacheSerializableRunnable("Create region") {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
index f104e9b..059272c 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/ResourceManagerWithQueryMonitorDUnitTest.java
@@ -66,10 +66,14 @@ import com.gemstone.gemfire.internal.cache.control.ResourceListener;
import com.gemstone.gemfire.internal.cache.control.TestMemoryThresholdListener;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.DistributedTestSupport;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterSupport;
+import com.gemstone.gemfire.test.dunit.NetworkSupport;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.Threads;
import com.gemstone.gemfire.test.dunit.VM;
public class ResourceManagerWithQueryMonitorDUnitTest extends ClientServerTestCase {
@@ -85,15 +89,15 @@ public class ResourceManagerWithQueryMonitorDUnitTest extends ClientServerTestCa
@Override
public void setUp() throws Exception {
super.setUp();
- invokeInEveryVM(this.setHeapMemoryMonitorTestMode);
- IgnoredException.addExpectedException("above heap critical threshold");
- IgnoredException.addExpectedException("below heap critical threshold");
+ Invoke.invokeInEveryVM(this.setHeapMemoryMonitorTestMode);
+ IgnoredException.addIgnoredException("above heap critical threshold");
+ IgnoredException.addIgnoredException("below heap critical threshold");
}
@Override
public void tearDown2() throws Exception {
- invokeInEveryVM(resetQueryMonitor);
- invokeInEveryVM(resetResourceManager);
+ Invoke.invokeInEveryVM(resetQueryMonitor);
+ Invoke.invokeInEveryVM(resetResourceManager);
super.tearDown2();
}
@@ -724,7 +728,7 @@ public class ResourceManagerWithQueryMonitorDUnitTest extends ClientServerTestCa
//unless otherwise configured
releaseHook(server);
- DistributedTestCase.join(queryExecution, 60000, getLogWriter());
+ Threads.join(queryExecution, 60000, LogWriterSupport.getLogWriter());
//Make sure no exceptions were thrown during query testing
try {
assertEquals(0, queryExecution.getResult());
@@ -1021,7 +1025,7 @@ public class ResourceManagerWithQueryMonitorDUnitTest extends ClientServerTestCa
getSystem(props);
final ClientCacheFactory ccf = new ClientCacheFactory(props);
- ccf.addPoolServer(getServerHostName(server.getHost()), port);
+ ccf.addPoolServer(NetworkSupport.getServerHostName(server.getHost()), port);
ClientCache cache = (ClientCache)getClientCache(ccf);
}
});
@@ -1036,7 +1040,7 @@ public class ResourceManagerWithQueryMonitorDUnitTest extends ClientServerTestCa
getSystem(props);
PoolFactory pf = PoolManager.createFactory();
- pf.addServer(getServerHostName(server.getHost()), port);
+ pf.addServer(NetworkSupport.getServerHostName(server.getHost()), port);
pf.create("pool1");
AttributesFactory af = new AttributesFactory();
@@ -1058,7 +1062,7 @@ public class ResourceManagerWithQueryMonitorDUnitTest extends ClientServerTestCa
protected Properties getServerProperties(boolean disableQueryMonitorForMemory, int queryTimeout) {
Properties p = new Properties();
- p.setProperty(DistributionConfig.LOCATORS_NAME, "localhost["+getDUnitLocatorPort()+"]");
+ p.setProperty(DistributionConfig.LOCATORS_NAME, "localhost["+DistributedTestSupport.getDUnitLocatorPort()+"]");
return p;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/SelectStarQueryDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/SelectStarQueryDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/SelectStarQueryDUnitTest.java
index e21e641..92d8e97 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/SelectStarQueryDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/SelectStarQueryDUnitTest.java
@@ -42,6 +42,8 @@ import com.gemstone.gemfire.internal.cache.VMCachedDeserializable;
import com.gemstone.gemfire.pdx.PdxInstance;
import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterSupport;
+import com.gemstone.gemfire.test.dunit.NetworkSupport;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.VM;
@@ -117,9 +119,9 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
ClientCacheFactory cf = new ClientCacheFactory();
- cf.addPoolServer(getServerHostName(server1.getHost()), port1);
- cf.addPoolServer(getServerHostName(server2.getHost()), port2);
- cf.addPoolServer(getServerHostName(server3.getHost()), port3);
+ cf.addPoolServer(NetworkSupport.getServerHostName(server1.getHost()), port1);
+ cf.addPoolServer(NetworkSupport.getServerHostName(server2.getHost()), port2);
+ cf.addPoolServer(NetworkSupport.getServerHostName(server3.getHost()), port3);
ClientCache cache = getClientCache(cf);
cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create(regName);
@@ -143,7 +145,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
client.invoke(new SerializableCallable("Query") {
@Override
public Object call() throws Exception {
- getLogWriter().info("Querying remotely from client");
+ LogWriterSupport.getLogWriter().info("Querying remotely from client");
QueryService localQS = null;
QueryService remoteQS = null;
try {
@@ -289,7 +291,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
ClientCacheFactory cf = new ClientCacheFactory();
- cf.addPoolServer(getServerHostName(server1.getHost()), port1);
+ cf.addPoolServer(NetworkSupport.getServerHostName(server1.getHost()), port1);
ClientCache cache = getClientCache(cf);
cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create(regName);
@@ -317,7 +319,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
client.invoke(new SerializableCallable("Query") {
@Override
public Object call() throws Exception {
- getLogWriter().info("Querying remotely from client");
+ LogWriterSupport.getLogWriter().info("Querying remotely from client");
QueryService localQS = null;
QueryService remoteQS = null;
try {
@@ -489,7 +491,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
ClientCacheFactory cf = new ClientCacheFactory();
- cf.addPoolServer(getServerHostName(server1.getHost()), port);
+ cf.addPoolServer(NetworkSupport.getServerHostName(server1.getHost()), port);
ClientCache cache = getClientCache(cf);
cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create(regName);
@@ -513,7 +515,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
client.invoke(new SerializableCallable("Query") {
@Override
public Object call() throws Exception {
- getLogWriter().info("Querying remotely from client");
+ LogWriterSupport.getLogWriter().info("Querying remotely from client");
QueryService localQS = null;
QueryService remoteQS = null;
try {
@@ -662,9 +664,9 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
ClientCacheFactory cf = new ClientCacheFactory();
- cf.addPoolServer(getServerHostName(server1.getHost()), port1);
- cf.addPoolServer(getServerHostName(server2.getHost()), port2);
- cf.addPoolServer(getServerHostName(server3.getHost()), port3);
+ cf.addPoolServer(NetworkSupport.getServerHostName(server1.getHost()), port1);
+ cf.addPoolServer(NetworkSupport.getServerHostName(server2.getHost()), port2);
+ cf.addPoolServer(NetworkSupport.getServerHostName(server3.getHost()), port3);
ClientCache cache = getClientCache(cf);
cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create(regName);
@@ -688,7 +690,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
client.invoke(new SerializableCallable("Query") {
@Override
public Object call() throws Exception {
- getLogWriter().info("Querying remotely from client");
+ LogWriterSupport.getLogWriter().info("Querying remotely from client");
QueryService localQS = null;
QueryService remoteQS = null;
try {
@@ -818,7 +820,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
ClientCacheFactory cf = new ClientCacheFactory();
- cf.addPoolServer(getServerHostName(server1.getHost()), port1);
+ cf.addPoolServer(NetworkSupport.getServerHostName(server1.getHost()), port1);
ClientCache cache = getClientCache(cf);
cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create(regName);
@@ -862,7 +864,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
client.invoke(new SerializableCallable("Query") {
@Override
public Object call() throws Exception {
- getLogWriter().info("Querying remotely from client");
+ LogWriterSupport.getLogWriter().info("Querying remotely from client");
QueryService localQS = null;
QueryService remoteQS = null;
try {
@@ -938,7 +940,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
client.invoke(new SerializableCallable("Query") {
@Override
public Object call() throws Exception {
- getLogWriter().info("Querying remotely from client");
+ LogWriterSupport.getLogWriter().info("Querying remotely from client");
QueryService localQS = null;
QueryService remoteQS = null;
try {
@@ -1020,7 +1022,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
ClientCacheFactory cf = new ClientCacheFactory();
- cf.addPoolServer(getServerHostName(server1.getHost()), port1);
+ cf.addPoolServer(NetworkSupport.getServerHostName(server1.getHost()), port1);
ClientCache cache = getClientCache(cf);
cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create(regName);
@@ -1044,7 +1046,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
client.invoke(new SerializableCallable("Query") {
@Override
public Object call() throws Exception {
- getLogWriter().info("Querying remotely from client");
+ LogWriterSupport.getLogWriter().info("Querying remotely from client");
QueryService localQS = null;
QueryService remoteQS = null;
try {
@@ -1241,7 +1243,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
ClientCacheFactory cf = new ClientCacheFactory();
- cf.addPoolServer(getServerHostName(server1.getHost()), port1);
+ cf.addPoolServer(NetworkSupport.getServerHostName(server1.getHost()), port1);
ClientCache cache = getClientCache(cf);
cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create(regName);
@@ -1265,7 +1267,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
client.invoke(new SerializableCallable("Query") {
@Override
public Object call() throws Exception {
- getLogWriter().info("Querying remotely from client");
+ LogWriterSupport.getLogWriter().info("Querying remotely from client");
QueryService localQS = null;
QueryService remoteQS = null;
try {
@@ -1468,7 +1470,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
@Override
public Object call() throws Exception {
ClientCacheFactory cf = new ClientCacheFactory();
- cf.addPoolServer(getServerHostName(server1.getHost()), port);
+ cf.addPoolServer(NetworkSupport.getServerHostName(server1.getHost()), port);
ClientCache cache = getClientCache(cf);
cache.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create(regName);
@@ -1484,7 +1486,7 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
client.invoke(new SerializableCallable("Query") {
@Override
public Object call() throws Exception {
- getLogWriter().info("Querying remotely from client");
+ LogWriterSupport.getLogWriter().info("Querying remotely from client");
QueryService localQS = null;
QueryService remoteQS = null;
try {
@@ -1603,10 +1605,10 @@ public class SelectStarQueryDUnitTest extends CacheTestCase {
public void beforeIterationEvaluation(CompiledValue executer,
Object currentObject) {
if (currentObject instanceof VMCachedDeserializable) {
- getLogWriter().fine("currentObject is serialized object");
+ LogWriterSupport.getLogWriter().fine("currentObject is serialized object");
isObjectSerialized = true;
} else {
- getLogWriter().fine("currentObject is deserialized object");
+ LogWriterSupport.getLogWriter().fine("currentObject is deserialized object");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexCreationDeadLockJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexCreationDeadLockJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexCreationDeadLockJUnitTest.java
index 37abacf..d3c2925 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexCreationDeadLockJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexCreationDeadLockJUnitTest.java
@@ -46,7 +46,7 @@ import com.gemstone.gemfire.cache.query.IndexType;
import com.gemstone.gemfire.cache.query.QueryService;
import com.gemstone.gemfire.cache.query.data.Portfolio;
import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.Threads;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
@@ -190,7 +190,7 @@ public class IndexCreationDeadLockJUnitTest
Thread th = new IndexCreationDeadLockJUnitTest.PutThread("put thread");
th.start();
- DistributedTestCase.join(th, 60 * 1000, null);
+ Threads.join(th, 60 * 1000, null);
}
/**
@@ -294,7 +294,7 @@ public class IndexCreationDeadLockJUnitTest
Thread indxCreationThread = new HelperThread("index creator thread");
indxCreationThread.start();
try {
- DistributedTestCase.join(indxCreationThread, 30 * 1000, null);
+ Threads.join(indxCreationThread, 30 * 1000, null);
}
catch (Exception e) {
e.printStackTrace();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexMaintenanceAsynchJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexMaintenanceAsynchJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexMaintenanceAsynchJUnitTest.java
index 84612b5..ac3b8bb 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexMaintenanceAsynchJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache/query/functional/IndexMaintenanceAsynchJUnitTest.java
@@ -45,8 +45,8 @@ import com.gemstone.gemfire.cache.query.data.Portfolio;
import com.gemstone.gemfire.cache.query.internal.QueryObserverAdapter;
import com.gemstone.gemfire.cache.query.internal.QueryObserverHolder;
import com.gemstone.gemfire.cache.query.internal.index.IndexProtocol;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
@@ -137,7 +137,7 @@ public class IndexMaintenanceAsynchJUnitTest {
return "index updates never became 8";
}
};
- DistributedTestCase.waitForCriterion(ev, 5000, 200, true);
+ Wait.waitForCriterion(ev, 5000, 200, true);
//queryString= "SELECT DISTINCT * FROM /portfolios p, p.positions.values pos where pos.secId='IBM'";
queryString= "SELECT DISTINCT * FROM /portfolios where status = 'active'";