http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryMonitorDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryMonitorDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryMonitorDUnitTest.java index 14884bd..febe78e 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryMonitorDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryMonitorDUnitTest.java @@ -48,11 +48,16 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl; import com.gemstone.gemfire.cache30.CacheSerializableRunnable; import com.gemstone.gemfire.cache30.CacheTestCase; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; +import com.gemstone.gemfire.test.dunit.Assert; import com.gemstone.gemfire.test.dunit.AsyncInvocation; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; +import com.gemstone.gemfire.test.dunit.DistributedTestUtils; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.LogWriterUtils; +import com.gemstone.gemfire.test.dunit.NetworkUtils; import com.gemstone.gemfire.test.dunit.SerializableRunnable; +import com.gemstone.gemfire.test.dunit.ThreadUtils; import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.Wait; /** * Tests for QueryMonitoring service. @@ -155,7 +160,7 @@ public class QueryMonitorDUnitTest extends CacheTestCase { r = new SerializableRunnable("getClientSystem") { public void run() { - Properties props = getAllDistributedSystemProperties(new Properties()); + Properties props = DistributedTestUtils.getAllDistributedSystemProperties(new Properties()); props.put(DistributionConfigImpl.LOCATORS_NAME, ""); getSystem(props); } @@ -167,14 +172,13 @@ public class QueryMonitorDUnitTest extends CacheTestCase { } @Override - public void tearDown2() throws Exception { + protected final void preTearDownCacheTestCase() throws Exception { Host host = Host.getHost(0); disconnectFromDS(); // shut down clients before servers for (int i=numServers; i<4; i++) { host.getVM(i).invoke(CacheTestCase.class, "disconnectFromDS"); } - super.tearDown2(); } public void createRegion(VM vm){ @@ -227,7 +231,7 @@ public class QueryMonitorDUnitTest extends CacheTestCase { try { startBridgeServer(0, false); } catch (Exception ex) { - fail("While starting CacheServer", ex); + Assert.fail("While starting CacheServer", ex); } Cache cache = getCache(); GemFireCacheImpl.getInstance().TEST_MAX_QUERY_EXECUTION_TIME = queryMonitorTime; @@ -260,7 +264,7 @@ public class QueryMonitorDUnitTest extends CacheTestCase { for (int i=0; i < server.length; i++){ port[i] = server[i].invokeInt(QueryMonitorDUnitTest.class, "getCacheServerPort"); } - final String host0 = getServerHostName(server[0].getHost()); + final String host0 = NetworkUtils.getServerHostName(server[0].getHost()); SerializableRunnable initClient = new CacheSerializableRunnable("Init client") { public void run2() throws CacheException { @@ -618,7 +622,7 @@ public class QueryMonitorDUnitTest extends CacheTestCase { } } catch (Exception ex){ - fail("Exception creating the query service", ex); + Assert.fail("Exception creating the query service", ex); } } }; @@ -1016,7 +1020,7 @@ public class QueryMonitorDUnitTest extends CacheTestCase { cqDUnitTest.createServer(server, 0, true); final int port = server.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort"); - final String host0 = getServerHostName(server.getHost()); + final String host0 = NetworkUtils.getServerHostName(server.getHost()); // Create client. cqDUnitTest.createClient(client, port, host0); @@ -1133,7 +1137,7 @@ public class QueryMonitorDUnitTest extends CacheTestCase { exampleRegion.put(""+i, new Portfolio(i)); } } - getLogWriter().info("### Completed updates in server1 in testCacheOpAfterQueryCancel"); + LogWriterUtils.getLogWriter().info("### Completed updates in server1 in testCacheOpAfterQueryCancel"); } }); @@ -1146,7 +1150,7 @@ public class QueryMonitorDUnitTest extends CacheTestCase { exampleRegion.put(""+i, new Portfolio(i)); } } - getLogWriter().info("### Completed updates in server2 in testCacheOpAfterQueryCancel"); + LogWriterUtils.getLogWriter().info("### Completed updates in server2 in testCacheOpAfterQueryCancel"); } }); @@ -1167,19 +1171,19 @@ public class QueryMonitorDUnitTest extends CacheTestCase { Query query = queryService.newQuery(qStr); query.execute(); } catch (QueryExecutionTimeoutException qet) { - getLogWriter().info("### Got Expected QueryExecutionTimeout exception. " + + LogWriterUtils.getLogWriter().info("### Got Expected QueryExecutionTimeout exception. " + qet.getMessage()); if (qet.getMessage().contains("cancelled after exceeding max execution")){ - getLogWriter().info("### Doing a put operation"); + LogWriterUtils.getLogWriter().info("### Doing a put operation"); exampleRegion.put(""+i, new Portfolio(i)); } } catch (Exception e){ fail("Exception executing query." + e.getMessage()); } } - getLogWriter().info("### Completed Executing queries in testCacheOpAfterQueryCancel"); + LogWriterUtils.getLogWriter().info("### Completed Executing queries in testCacheOpAfterQueryCancel"); } catch (Exception ex){ - fail("Exception creating the query service", ex); + Assert.fail("Exception creating the query service", ex); } } }; @@ -1187,23 +1191,23 @@ public class QueryMonitorDUnitTest extends CacheTestCase { AsyncInvocation ai3 = server3.invokeAsync(executeQuery); AsyncInvocation ai4 = server4.invokeAsync(executeQuery); - getLogWriter().info("### Waiting for async threads to join in testCacheOpAfterQueryCancel"); + LogWriterUtils.getLogWriter().info("### Waiting for async threads to join in testCacheOpAfterQueryCancel"); try { - DistributedTestCase.join(ai1, 5 * 60 * 1000, null); - DistributedTestCase.join(ai2, 5 * 60 * 1000, null); - DistributedTestCase.join(ai3, 5 * 60 * 1000, null); - DistributedTestCase.join(ai4, 5 * 60 * 1000, null); + ThreadUtils.join(ai1, 5 * 60 * 1000); + ThreadUtils.join(ai2, 5 * 60 * 1000); + ThreadUtils.join(ai3, 5 * 60 * 1000); + ThreadUtils.join(ai4, 5 * 60 * 1000); } catch (Exception ex) { fail("Async thread join failure"); } - getLogWriter().info("### DONE Waiting for async threads to join in testCacheOpAfterQueryCancel"); + LogWriterUtils.getLogWriter().info("### DONE Waiting for async threads to join in testCacheOpAfterQueryCancel"); validateQueryMonitorThreadCnt(server1, 0, 1000); validateQueryMonitorThreadCnt(server2, 0, 1000); validateQueryMonitorThreadCnt(server3, 0, 1000); validateQueryMonitorThreadCnt(server4, 0, 1000); - getLogWriter().info("### DONE validating query monitor threads testCacheOpAfterQueryCancel"); + LogWriterUtils.getLogWriter().info("### DONE validating query monitor threads testCacheOpAfterQueryCancel"); stopServer(server1); stopServer(server2); @@ -1223,7 +1227,7 @@ public class QueryMonitorDUnitTest extends CacheTestCase { while (true) { if (qm.getQueryMonitorThreadCount() != threadCount) { if (waited <= waitTime) { - pause(10); + Wait.pause(10); waited+=10; continue; } else {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/snapshot/ClientSnapshotDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/snapshot/ClientSnapshotDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/snapshot/ClientSnapshotDUnitTest.java index cc053fc..540b37b 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/snapshot/ClientSnapshotDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/snapshot/ClientSnapshotDUnitTest.java @@ -41,6 +41,8 @@ import com.gemstone.gemfire.cache.util.CqListenerAdapter; 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.LogWriterUtils; +import com.gemstone.gemfire.test.dunit.NetworkUtils; import com.gemstone.gemfire.test.dunit.SerializableCallable; public class ClientSnapshotDUnitTest extends CacheTestCase { @@ -253,9 +255,9 @@ public class ClientSnapshotDUnitTest extends CacheTestCase { @Override public Object call() throws Exception { ClientCacheFactory cf = new ClientCacheFactory() - .set("log-level", getDUnitLogLevel()) + .set("log-level", LogWriterUtils.getDUnitLogLevel()) .setPdxSerializer(new MyPdxSerializer()) - .addPoolServer(getServerHostName(host), port) + .addPoolServer(NetworkUtils.getServerHostName(host), port) .setPoolSubscriptionEnabled(true) .setPoolPRSingleHopEnabled(false); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-cq/src/test/java/com/gemstone/gemfire/internal/cache/PRDeltaPropagationDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/internal/cache/PRDeltaPropagationDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/internal/cache/PRDeltaPropagationDUnitTest.java index f77f845..8a4eeaa 100755 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/internal/cache/PRDeltaPropagationDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/internal/cache/PRDeltaPropagationDUnitTest.java @@ -56,10 +56,14 @@ import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientNotifier; import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientProxy; import com.gemstone.gemfire.internal.cache.tier.sockets.ConflationDUnitTest; +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.SerializableRunnable; import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; /** * @@ -784,7 +788,7 @@ public class PRDeltaPropagationDUnitTest extends DistributedTestCase { assertNotNull(cache); } catch (Exception e) { - fail("Failed while creating the cache", e); + Assert.fail("Failed while creating the cache", e); } } @@ -820,7 +824,7 @@ public class PRDeltaPropagationDUnitTest extends DistributedTestCase { assertNotNull(cache); deltaPR = cache.createRegion(partitionedRegionName, attr.create()); assertNotNull(deltaPR); - getLogWriter().info( + LogWriterUtils.getLogWriter().info( "Partitioned Region " + partitionedRegionName + " created Successfully :" + deltaPR); } @@ -842,7 +846,7 @@ public class PRDeltaPropagationDUnitTest extends DistributedTestCase { server1.start(); } catch (IOException e) { - fail("Failed to start the Server", e); + Assert.fail("Failed to start the Server", e); } assertTrue(server1.isRunning()); return new Integer(server1.getPort()); @@ -1107,7 +1111,7 @@ public class PRDeltaPropagationDUnitTest extends DistributedTestCase { return "Last key NOT received."; } }; - DistributedTestCase.waitForCriterion(wc, 10*1000, 100, true); + Wait.waitForCriterion(wc, 10*1000, 100, true); } public static Boolean verifyQueryUpdateExecuted() { @@ -1138,14 +1142,13 @@ public class PRDeltaPropagationDUnitTest extends DistributedTestCase { ConflationDUnitTest.unsetIsSlowStart(); } - public void tearDown2() throws Exception { - super.tearDown2(); + @Override + protected final void preTearDown() throws Exception { closeCache(); client1.invoke(PRDeltaPropagationDUnitTest.class, "closeCache"); dataStore1.invoke(PRDeltaPropagationDUnitTest.class, "closeCache"); dataStore2.invoke(PRDeltaPropagationDUnitTest.class, "closeCache"); dataStore3.invoke(PRDeltaPropagationDUnitTest.class, "closeCache"); - } public static void closeCache() { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-cq/src/test/java/com/gemstone/gemfire/internal/cache/PutAllCSDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/internal/cache/PutAllCSDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/internal/cache/PutAllCSDUnitTest.java index cd2a26e..cc5876f 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/internal/cache/PutAllCSDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/internal/cache/PutAllCSDUnitTest.java @@ -75,12 +75,19 @@ import com.gemstone.gemfire.internal.AvailablePort; import com.gemstone.gemfire.internal.AvailablePortHelper; import com.gemstone.gemfire.internal.cache.versions.VersionTag; import com.gemstone.gemfire.internal.i18n.LocalizedStrings; +import com.gemstone.gemfire.test.dunit.Assert; import com.gemstone.gemfire.test.dunit.AsyncInvocation; -import com.gemstone.gemfire.test.dunit.DistributedTestCase; +import com.gemstone.gemfire.test.dunit.DistributedTestUtils; import com.gemstone.gemfire.test.dunit.Host; +import com.gemstone.gemfire.test.dunit.IgnoredException; +import com.gemstone.gemfire.test.dunit.LogWriterUtils; +import com.gemstone.gemfire.test.dunit.NetworkUtils; import com.gemstone.gemfire.test.dunit.SerializableCallable; import com.gemstone.gemfire.test.dunit.SerializableRunnable; +import com.gemstone.gemfire.test.dunit.ThreadUtils; import com.gemstone.gemfire.test.dunit.VM; +import com.gemstone.gemfire.test.dunit.Wait; +import com.gemstone.gemfire.test.dunit.WaitCriterion; /** * Tests putAll for c/s. Also tests removeAll @@ -132,7 +139,7 @@ public class PutAllCSDUnitTest extends ClientServerTestCase { return null; } }; - DistributedTestCase.waitForCriterion(ev, 10 * 1000, 1000, true); + Wait.waitForCriterion(ev, 10 * 1000, 1000, true); assertEquals(expectedSize, region.size()); } @@ -149,7 +156,7 @@ public void testOneServer() throws CacheException, InterruptedException { VM client2 = host.getVM(3); final String regionName = getUniqueName(); final int serverPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); - final String serverHost = getServerHostName(server.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server.getHost()); // set <false, true> means <PR=false, notifyBySubscription=true> to enable registerInterest and CQ createBridgeServer(server, regionName, serverPort, false, 0, null); @@ -170,7 +177,7 @@ public void testOneServer() throws CacheException, InterruptedException { // registerInterest for ALL_KEYS region.registerInterest("ALL_KEYS"); - getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); + LogWriterUtils.getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); } }); @@ -196,7 +203,7 @@ public void testOneServer() throws CacheException, InterruptedException { CqAttributes cqa1 = cqf1.create(); String cqName1 = "EOInfoTracker"; String queryStr1 = "SELECT ALL * FROM /root/"+regionName+" ii WHERE ii.getTicker() >= '10' and ii.getTicker() < '20'"; - getLogWriter().info("Query String: "+queryStr1); + LogWriterUtils.getLogWriter().info("Query String: "+queryStr1); try { QueryService cqService = getCache().getQueryService(); CqQuery EOTracker = cqService.newCq(cqName1, queryStr1, cqa1); @@ -206,11 +213,11 @@ public void testOneServer() throws CacheException, InterruptedException { for (int i=0; i<list1.size(); i++) { Struct s = (Struct)list1.get(i); TestObject o = (TestObject)s.get("value"); - getLogWriter().info("InitialResult:"+i+":"+o); + LogWriterUtils.getLogWriter().info("InitialResult:"+i+":"+o); localregion.put("key-"+i, o); } if (localregion.size() > 0) { - getLogWriter().info("CQ is ready"); + LogWriterUtils.getLogWriter().info("CQ is ready"); synchronized(lockObject) { lockObject.notify(); } @@ -220,19 +227,19 @@ public void testOneServer() throws CacheException, InterruptedException { EOTracker.close(); } catch (CqClosedException e) { - fail("CQ", e); + Assert.fail("CQ", e); } catch (RegionNotFoundException e) { - fail("CQ", e); + Assert.fail("CQ", e); } catch (QueryInvalidException e) { - fail("CQ", e); + Assert.fail("CQ", e); } catch (CqExistsException e) { - fail("CQ", e); + Assert.fail("CQ", e); } catch (CqException e) { - fail("CQ", e); + Assert.fail("CQ", e); } } }); @@ -289,9 +296,9 @@ public void testOneServer() throws CacheException, InterruptedException { obj = (TestObject)localregion.get("key-"+i); if (obj != null) { // wait for the key to be destroyed - pause(100); - if (getLogWriter().fineEnabled()) { - getLogWriter().info("Waiting 100ms("+cnt+") for key-" + i + " to be destroyed"); + Wait.pause(100); + if (LogWriterUtils.getLogWriter().fineEnabled()) { + LogWriterUtils.getLogWriter().info("Waiting 100ms("+cnt+") for key-" + i + " to be destroyed"); } cnt++; } else { @@ -321,8 +328,8 @@ public void testOneServer() throws CacheException, InterruptedException { while (cnt < 100) { obj = (TestObject)localregion.get("key-"+i); if (obj == null || obj.getPrice() != i*10) { - pause(100); - getLogWriter().info("Waiting 100ms("+cnt+") for obj.getPrice() == i*10 at entry "+i); + Wait.pause(100); + LogWriterUtils.getLogWriter().info("Waiting 100ms("+cnt+") for obj.getPrice() == i*10 at entry "+i); cnt++; } else { break; @@ -336,7 +343,7 @@ public void testOneServer() throws CacheException, InterruptedException { } }); - DistributedTestCase.join(async1, 30 * 1000, getLogWriter()); + ThreadUtils.join(async1, 30 * 1000); // verify stats for client putAll into distributed region // 1. verify client staus @@ -422,7 +429,7 @@ public void testOneServer() throws CacheException, InterruptedException { int serverPorts[] = AvailablePortHelper.getRandomAvailableTCPPorts(2); final int serverPort1 = serverPorts[0]; final int serverPort2 = serverPorts[1]; - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set notifyBySubscription=false to test local-invalidates createBridgeServer(server1, regionName, serverPort1, false, 0, null); @@ -437,7 +444,7 @@ public void testOneServer() throws CacheException, InterruptedException { // registerInterest for ALL_KEYS region.registerInterest("ALL_KEYS"); - getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); + LogWriterUtils.getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); } }); @@ -493,7 +500,7 @@ public void testOneServer() throws CacheException, InterruptedException { int serverPorts[] = AvailablePortHelper.getRandomAvailableTCPPorts(2); final int serverPort1 = serverPorts[0]; final int serverPort2 = serverPorts[1]; - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set notifyBySubscription=false to test local-invalidates createBridgeServer(server1, regionName, serverPort1, false, 0, null); @@ -576,7 +583,7 @@ public void testOneServer() throws CacheException, InterruptedException { Region region = getRootRegion().getSubregion(regionName); assertEquals(0, region.size()); MyWriter mywriter = (MyWriter)region.getAttributes().getCacheWriter(); - getLogWriter().info("server cachewriter triggered for destroy: "+mywriter.num_destroyed); + LogWriterUtils.getLogWriter().info("server cachewriter triggered for destroy: "+mywriter.num_destroyed); assertEquals(numberOfEntries, mywriter.num_destroyed); } }); @@ -588,7 +595,7 @@ public void testOneServer() throws CacheException, InterruptedException { Region region = getRootRegion().getSubregion(regionName); assertEquals(0, region.size()); MyWriter mywriter = (MyWriter)region.getAttributes().getCacheWriter(); - getLogWriter().info("server cachewriter triggered for destroy: "+mywriter.num_destroyed); + LogWriterUtils.getLogWriter().info("server cachewriter triggered for destroy: "+mywriter.num_destroyed); // beforeDestroys are only triggered at server1 since the removeAll is submitted from client1 assertEquals(0, mywriter.num_destroyed); } @@ -616,8 +623,8 @@ public void testOneServer() throws CacheException, InterruptedException { } }); - DistributedTestCase.join(async1, 30 * 1000, getLogWriter()); - DistributedTestCase.join(async2, 30 * 1000, getLogWriter()); + ThreadUtils.join(async1, 30 * 1000); + ThreadUtils.join(async2, 30 * 1000); } client1.invoke(new CacheSerializableRunnable(title @@ -715,8 +722,8 @@ public void testOneServer() throws CacheException, InterruptedException { } }); - DistributedTestCase.join(async1, 30 * 1000, getLogWriter()); - DistributedTestCase.join(async2, 30 * 1000, getLogWriter()); + ThreadUtils.join(async1, 30 * 1000); + ThreadUtils.join(async2, 30 * 1000); } client1.invoke(new CacheSerializableRunnable(title+"client1 removeAll") { @@ -863,7 +870,7 @@ public void testOneServer() throws CacheException, InterruptedException { return null; } }; - DistributedTestCase.waitForCriterion(ev, 10 * 1000, 1000, true); + Wait.waitForCriterion(ev, 10 * 1000, 1000, true); // local invalidate will set the value to null TestObject obj = null; obj = (TestObject)region.getEntry("key-" + i).getValue(); @@ -911,7 +918,7 @@ public void testOneServer() throws CacheException, InterruptedException { VM client2 = host.getVM(3); final String regionName = getUniqueName(); - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set notifyBySubscription=false to test local-invalidates int serverPort1 = createServerRegion(server1, regionName, CCE); @@ -984,7 +991,7 @@ public void testOneServer() throws CacheException, InterruptedException { Region region = getRootRegion().getSubregion(regionName); assertEquals(0, region.size()); MyWriter mywriter = (MyWriter)region.getAttributes().getCacheWriter(); - getLogWriter().info("server cachewriter triggered for destroy: "+mywriter.num_destroyed); + LogWriterUtils.getLogWriter().info("server cachewriter triggered for destroy: "+mywriter.num_destroyed); assertEquals(numberOfEntries, mywriter.num_destroyed); } }); @@ -996,7 +1003,7 @@ public void testOneServer() throws CacheException, InterruptedException { Region region = getRootRegion().getSubregion(regionName); assertEquals(0, region.size()); MyWriter mywriter = (MyWriter)region.getAttributes().getCacheWriter(); - getLogWriter().info("server cachewriter triggered for destroy: "+mywriter.num_destroyed); + LogWriterUtils.getLogWriter().info("server cachewriter triggered for destroy: "+mywriter.num_destroyed); // beforeDestroys are only triggered at server1 since the removeAll is submitted from client1 assertEquals(0, mywriter.num_destroyed); } @@ -1138,7 +1145,7 @@ public void testOneServer() throws CacheException, InterruptedException { int serverPorts[] = AvailablePortHelper.getRandomAvailableTCPPorts(2); final int serverPort1 = serverPorts[0]; final int serverPort2 = serverPorts[1]; - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set <true, false> means <PR=true, notifyBySubscription=false> to test local-invalidates createBridgeServer(server1, regionName, serverPort1, isPR, redundantCopies, null); @@ -1179,7 +1186,7 @@ public void testOneServer() throws CacheException, InterruptedException { client2.invoke(new CacheSerializableRunnable(title + "verify Bridge Server 2") { public void run2() throws CacheException { - pause(5000); + Wait.pause(5000); Region region = getRootRegion().getSubregion(regionName); Region.Entry re = region.getEntry("case3-1"); assertNotNull(re); @@ -1237,7 +1244,7 @@ public void testOneServer() throws CacheException, InterruptedException { client2.invoke(new CacheSerializableRunnable(title + "verify Bridge Server 2") { public void run2() throws CacheException { - pause(5000); + Wait.pause(5000); Region region = getRootRegion().getSubregion(regionName); Region.Entry re = region.getEntry("case3-1"); assertNull(re); @@ -1287,7 +1294,7 @@ public void testOneServer() throws CacheException, InterruptedException { int serverPorts[] = AvailablePortHelper.getRandomAvailableTCPPorts(2); final int serverPort1 = serverPorts[0]; final int serverPort2 = serverPorts[1]; - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set <true, false> means <PR=true, notifyBySubscription=false> to test local-invalidates createBridgeServer(server1, regionName, serverPort1, true, 0, "ds1"); @@ -1306,7 +1313,7 @@ public void testOneServer() throws CacheException, InterruptedException { region.getAttributesMutator().addCacheListener(new MyListener(false)); region.registerInterest("ALL_KEYS"); - getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); + LogWriterUtils.getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); } }); @@ -1361,7 +1368,7 @@ public void testOneServer() throws CacheException, InterruptedException { client2.invoke(new CacheSerializableRunnable(title+"verify entries from client2") { public void run2() throws CacheException { - pause(5000); + Wait.pause(5000); Region region = getRootRegion().getSubregion(regionName); Region.Entry re; for (int i=0; i<numberOfEntries; i++) { @@ -1392,7 +1399,7 @@ public void testOneServer() throws CacheException, InterruptedException { int serverPorts[] = AvailablePortHelper.getRandomAvailableTCPPorts(2); final int serverPort1 = serverPorts[0]; final int serverPort2 = serverPorts[1]; - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set <true, false> means <PR=true, notifyBySubscription=false> to test local-invalidates createBridgeServer(server1, regionName, serverPort1, true, 1, null); @@ -1475,7 +1482,7 @@ public void testOneServer() throws CacheException, InterruptedException { Region region = getRootRegion().getSubregion(regionName); assertEquals(0, region.size()); MyWriter mywriter = (MyWriter)region.getAttributes().getCacheWriter(); - getLogWriter().info("server cachewriter triggered for destroy: "+mywriter.num_destroyed); + LogWriterUtils.getLogWriter().info("server cachewriter triggered for destroy: "+mywriter.num_destroyed); // beforeDestroys are only triggered at primary buckets. server1 and server2 each holds half of buckets assertEquals(numberOfEntries/2, mywriter.num_destroyed); } @@ -1488,7 +1495,7 @@ public void testOneServer() throws CacheException, InterruptedException { Region region = getRootRegion().getSubregion(regionName); assertEquals(0, region.size()); MyWriter mywriter = (MyWriter)region.getAttributes().getCacheWriter(); - getLogWriter().info("server cachewriter triggered for destroy: "+mywriter.num_destroyed); + LogWriterUtils.getLogWriter().info("server cachewriter triggered for destroy: "+mywriter.num_destroyed); // beforeDestroys are only triggered at primary buckets. server1 and server2 each holds half of buckets assertEquals(numberOfEntries/2, mywriter.num_destroyed); } @@ -1516,8 +1523,8 @@ public void testOneServer() throws CacheException, InterruptedException { } }); - DistributedTestCase.join(async1, 30 * 1000, getLogWriter()); - DistributedTestCase.join(async2, 30 * 1000, getLogWriter()); + ThreadUtils.join(async1, 30 * 1000); + ThreadUtils.join(async2, 30 * 1000); } client1.invoke(new CacheSerializableRunnable(title @@ -1594,8 +1601,8 @@ public void testOneServer() throws CacheException, InterruptedException { } }); - DistributedTestCase.join(async1, 30 * 1000, getLogWriter()); - DistributedTestCase.join(async2, 30 * 1000, getLogWriter()); + ThreadUtils.join(async1, 30 * 1000); + ThreadUtils.join(async2, 30 * 1000); } client1.invoke(new CacheSerializableRunnable(title+"client1 removeAll") { @@ -1742,7 +1749,7 @@ public void testOneServer() throws CacheException, InterruptedException { return null; } }; - DistributedTestCase.waitForCriterion(ev, 10 * 1000, 1000, true); + Wait.waitForCriterion(ev, 10 * 1000, 1000, true); // local invalidate will set the value to null TestObject obj = (TestObject)region.getEntry("key-" + i).getValue(); assertEquals(null, obj); @@ -1766,7 +1773,7 @@ public void testOneServer() throws CacheException, InterruptedException { final String regionName = getUniqueName(); final int serverPort1 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set <true, false> means <PR=true, notifyBySubscription=false> to test local-invalidates createBridgeServer(server1, regionName, serverPort1, false, 0, null); @@ -1821,7 +1828,7 @@ public void testOneServer() throws CacheException, InterruptedException { int serverPorts[] = AvailablePortHelper.getRandomAvailableTCPPorts(2); final int serverPort1 = serverPorts[0]; final int serverPort2 = serverPorts[1]; - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set <true, false> means <PR=true, notifyBySubscription=false> to test local-invalidates createBridgeServer(server1, regionName, serverPort1, false, 0, null); @@ -1849,7 +1856,7 @@ public void testOneServer() throws CacheException, InterruptedException { region.getAttributesMutator().addCacheListener(new MyListener(false)); region.registerInterest("ALL_KEYS"); - getLogWriter().info("client1 registerInterest ALL_KEYS at "+region.getFullPath()); + LogWriterUtils.getLogWriter().info("client1 registerInterest ALL_KEYS at "+region.getFullPath()); } }); @@ -1879,27 +1886,27 @@ public void testOneServer() throws CacheException, InterruptedException { int c2Size = getRegionSize(client2, regionName); int s1Size = getRegionSize(server1, regionName); int s2Size = getRegionSize(server2, regionName); - getLogWriter().info("region sizes: "+c1Size+","+c2Size+","+s1Size+","+s2Size); + LogWriterUtils.getLogWriter().info("region sizes: "+c1Size+","+c2Size+","+s1Size+","+s2Size); if (c1Size != 15) { - getLogWriter().info("waiting for client1 to get all updates"); + LogWriterUtils.getLogWriter().info("waiting for client1 to get all updates"); return false; } if (c2Size != 15) { - getLogWriter().info("waiting for client2 to get all updates"); + LogWriterUtils.getLogWriter().info("waiting for client2 to get all updates"); return false; } if (s1Size != 15) { - getLogWriter().info("waiting for server1 to get all updates"); + LogWriterUtils.getLogWriter().info("waiting for server1 to get all updates"); return false; } if (s2Size != 15) { - getLogWriter().info("waiting for server2 to get all updates"); + LogWriterUtils.getLogWriter().info("waiting for server2 to get all updates"); return false; } return true; } }; - waitForCriterion(waitForSizes, 10000, 1000, true); + Wait.waitForCriterion(waitForSizes, 10000, 1000, true); } int server1Size = getRegionSize(server1, regionName); int server2Size = getRegionSize(server1, regionName); @@ -1943,27 +1950,27 @@ public void testOneServer() throws CacheException, InterruptedException { int c2Size = getRegionSize(client2, regionName); int s1Size = getRegionSize(server1, regionName); int s2Size = getRegionSize(server2, regionName); - getLogWriter().info("region sizes: "+c1Size+","+c2Size+","+s1Size+","+s2Size); + LogWriterUtils.getLogWriter().info("region sizes: "+c1Size+","+c2Size+","+s1Size+","+s2Size); if (c1Size != 15) { // client 1 did not register interest - getLogWriter().info("waiting for client1 to get all updates"); + LogWriterUtils.getLogWriter().info("waiting for client1 to get all updates"); return false; } if (c2Size != 15*2) { - getLogWriter().info("waiting for client2 to get all updates"); + LogWriterUtils.getLogWriter().info("waiting for client2 to get all updates"); return false; } if (s1Size != 15*2) { - getLogWriter().info("waiting for server1 to get all updates"); + LogWriterUtils.getLogWriter().info("waiting for server1 to get all updates"); return false; } if (s2Size != 15*2) { - getLogWriter().info("waiting for server2 to get all updates"); + LogWriterUtils.getLogWriter().info("waiting for server2 to get all updates"); return false; } return true; } }; - waitForCriterion(waitForSizes, 10000, 1000, true); + Wait.waitForCriterion(waitForSizes, 10000, 1000, true); } // now do a removeAll that is not allowed to remove everything @@ -2000,27 +2007,27 @@ public void testOneServer() throws CacheException, InterruptedException { int c2Size = getRegionSize(client2, regionName); int s1Size = getRegionSize(server1, regionName); int s2Size = getRegionSize(server2, regionName); - getLogWriter().info("region sizes: "+c1Size+","+c2Size+","+s1Size+","+s2Size); + LogWriterUtils.getLogWriter().info("region sizes: "+c1Size+","+c2Size+","+s1Size+","+s2Size); if (c1Size != 15-5) { // client 1 did not register interest - getLogWriter().info("waiting for client1 to get all destroys"); + LogWriterUtils.getLogWriter().info("waiting for client1 to get all destroys"); return false; } if (c2Size != (15*2)-5) { - getLogWriter().info("waiting for client2 to get all destroys"); + LogWriterUtils.getLogWriter().info("waiting for client2 to get all destroys"); return false; } if (s1Size != (15*2)-5) { - getLogWriter().info("waiting for server1 to get all destroys"); + LogWriterUtils.getLogWriter().info("waiting for server1 to get all destroys"); return false; } if (s2Size != (15*2)-5) { - getLogWriter().info("waiting for server2 to get all destroys"); + LogWriterUtils.getLogWriter().info("waiting for server2 to get all destroys"); return false; } return true; } }; - waitForCriterion(waitForSizes, 10000, 1000, true); + Wait.waitForCriterion(waitForSizes, 10000, 1000, true); } // reset cacheWriter's count to allow another 5 keys to be destroyed @@ -2059,27 +2066,27 @@ public void testOneServer() throws CacheException, InterruptedException { int c2Size = getRegionSize(client2, regionName); int s1Size = getRegionSize(server1, regionName); int s2Size = getRegionSize(server2, regionName); - getLogWriter().info("region sizes: "+c1Size+","+c2Size+","+s1Size+","+s2Size); + LogWriterUtils.getLogWriter().info("region sizes: "+c1Size+","+c2Size+","+s1Size+","+s2Size); if (c1Size != 15-5) { // client 1 did not register interest - getLogWriter().info("waiting for client1 to get all destroys"); + LogWriterUtils.getLogWriter().info("waiting for client1 to get all destroys"); return false; } if (c2Size != (15*2)-5-5) { - getLogWriter().info("waiting for client2 to get all destroys"); + LogWriterUtils.getLogWriter().info("waiting for client2 to get all destroys"); return false; } if (s1Size != (15*2)-5-5) { - getLogWriter().info("waiting for server1 to get all destroys"); + LogWriterUtils.getLogWriter().info("waiting for server1 to get all destroys"); return false; } if (s2Size != (15*2)-5-5) { - getLogWriter().info("waiting for server2 to get all destroys"); + LogWriterUtils.getLogWriter().info("waiting for server2 to get all destroys"); return false; } return true; } }; - waitForCriterion(waitForSizes, 10000, 1000, true); + Wait.waitForCriterion(waitForSizes, 10000, 1000, true); } server1.invoke(removeExceptionTag1(expectedExceptions)); server2.invoke(removeExceptionTag1(expectedExceptions)); @@ -2109,7 +2116,7 @@ public void testOneServer() throws CacheException, InterruptedException { int serverPorts[] = AvailablePortHelper.getRandomAvailableTCPPorts(2); final int serverPort1 = serverPorts[0]; final int serverPort2 = serverPorts[1]; - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set <true, false> means <PR=true, notifyBySubscription=false> to test local-invalidates createBridgeServer(server1, regionName, serverPort1, true, 0, "ds1"); @@ -2146,7 +2153,7 @@ public void testOneServer() throws CacheException, InterruptedException { region.getAttributesMutator().addCacheListener(new MyListener(false)); region.registerInterest("ALL_KEYS"); - getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); + LogWriterUtils.getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); } }); @@ -2173,23 +2180,23 @@ public void testOneServer() throws CacheException, InterruptedException { // server2 will closeCache after created 10 keys - DistributedTestCase.join(async1, 30 * 1000, getLogWriter()); + ThreadUtils.join(async1, 30 * 1000); if (async1.exceptionOccurred()) { - fail("Aync1 get exceptions:", async1.getException()); + Assert.fail("Aync1 get exceptions:", async1.getException()); } int client1Size = getRegionSize(client1, regionName); // client2Size maybe more than client1Size int client2Size = getRegionSize(client2, regionName); int server1Size = getRegionSize(server1, regionName); - getLogWriter().info("region sizes: "+client1Size+","+client2Size+","+server1Size); + LogWriterUtils.getLogWriter().info("region sizes: "+client1Size+","+client2Size+","+server1Size); // assertEquals(server1Size, client1Size); // restart server2 createBridgeServer(server2, regionName, serverPort2, true, 0, "ds1"); server1Size = getRegionSize(server1, regionName); int server2Size = getRegionSize(server2, regionName); - getLogWriter().info("region sizes after server2 restarted: "+client1Size+","+client2Size+","+server1Size+":"+server2Size); + LogWriterUtils.getLogWriter().info("region sizes after server2 restarted: "+client1Size+","+client2Size+","+server1Size+":"+server2Size); assertEquals(client2Size, server1Size); assertEquals(client2Size, server2Size); @@ -2215,7 +2222,7 @@ public void testOneServer() throws CacheException, InterruptedException { int new_client1Size = getRegionSize(client1, regionName); int new_client2Size = getRegionSize(client2, regionName); - getLogWriter().info("region sizes after re-run the putAll: "+new_client1Size+","+new_client2Size+","+new_server1Size); + LogWriterUtils.getLogWriter().info("region sizes after re-run the putAll: "+new_client1Size+","+new_client2Size+","+new_server1Size); assertEquals(server1Size+numberOfEntries/2, new_server1Size); assertEquals(client1Size+numberOfEntries/2, new_client1Size); assertEquals(client2Size+numberOfEntries/2, new_client2Size); @@ -2224,7 +2231,7 @@ public void testOneServer() throws CacheException, InterruptedException { createBridgeServer(server2, regionName, serverPort2, true, 0, "ds1"); server1Size = getRegionSize(server1, regionName); server2Size = getRegionSize(server2, regionName); - getLogWriter().info("region sizes after restart server2: "+server1Size+","+server2Size); + LogWriterUtils.getLogWriter().info("region sizes after restart server2: "+server1Size+","+server2Size); assertEquals(server1Size, server2Size); // add a cacheWriter for server to stop after created 15 keys @@ -2252,7 +2259,7 @@ public void testOneServer() throws CacheException, InterruptedException { new_server1Size = getRegionSize(server1, regionName); int new_server2Size = getRegionSize(server2, regionName); - getLogWriter().info("region sizes after restart server2: "+new_server1Size+","+new_server2Size); + LogWriterUtils.getLogWriter().info("region sizes after restart server2: "+new_server1Size+","+new_server2Size); assertEquals(server1Size+15, new_server1Size); assertEquals(server2Size+15, new_server2Size); server1.invoke(removeExceptionTag1(expectedExceptions)); @@ -2289,7 +2296,7 @@ public void testOneServer() throws CacheException, InterruptedException { int serverPorts[] = AvailablePortHelper.getRandomAvailableTCPPorts(2); final int serverPort1 = serverPorts[0]; final int serverPort2 = serverPorts[1]; - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set <true, false> means <PR=true, notifyBySubscription=false> to test local-invalidates createBridgeServer(server1, regionName, serverPort1, true, 0, "ds1"); @@ -2308,7 +2315,7 @@ public void testOneServer() throws CacheException, InterruptedException { region.getAttributesMutator().addCacheListener(new MyListener(false)); region.registerInterest("ALL_KEYS"); - getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); + LogWriterUtils.getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); } }); @@ -2327,27 +2334,27 @@ public void testOneServer() throws CacheException, InterruptedException { int c2Size = getRegionSize(client2, regionName); int s1Size = getRegionSize(server1, regionName); int s2Size = getRegionSize(server2, regionName); - getLogWriter().info("region sizes: "+c1Size+","+c2Size+","+s1Size+","+s2Size); + LogWriterUtils.getLogWriter().info("region sizes: "+c1Size+","+c2Size+","+s1Size+","+s2Size); if (c1Size != numberOfEntries) { - getLogWriter().info("waiting for client1 to get all updates"); + LogWriterUtils.getLogWriter().info("waiting for client1 to get all updates"); return false; } if (c2Size != numberOfEntries) { - getLogWriter().info("waiting for client2 to get all updates"); + LogWriterUtils.getLogWriter().info("waiting for client2 to get all updates"); return false; } if (s1Size != numberOfEntries) { - getLogWriter().info("waiting for server1 to get all updates"); + LogWriterUtils.getLogWriter().info("waiting for server1 to get all updates"); return false; } if (s2Size != numberOfEntries) { - getLogWriter().info("waiting for server2 to get all updates"); + LogWriterUtils.getLogWriter().info("waiting for server2 to get all updates"); return false; } return true; } }; - waitForCriterion(waitForSizes, 10000, 1000, true); + Wait.waitForCriterion(waitForSizes, 10000, 1000, true); client1Size = getRegionSize(client1, regionName); client2Size = getRegionSize(client2, regionName); @@ -2390,20 +2397,20 @@ public void testOneServer() throws CacheException, InterruptedException { // server2 will closeCache after creating 10 keys - DistributedTestCase.join(async1, 30 * 1000, getLogWriter()); + ThreadUtils.join(async1, 30 * 1000); if (async1.exceptionOccurred()) { - fail("Aync1 get exceptions:", async1.getException()); + Assert.fail("Aync1 get exceptions:", async1.getException()); } client1Size = getRegionSize(client1, regionName); // client2Size maybe more than client1Size client2Size = getRegionSize(client2, regionName); server1Size = getRegionSize(server1, regionName); - getLogWriter().info("region sizes: "+client1Size+","+client2Size+","+server1Size); + LogWriterUtils.getLogWriter().info("region sizes: "+client1Size+","+client2Size+","+server1Size); // assertEquals(server1Size, client1Size); // restart server2 - getLogWriter().info("restarting server 2"); + LogWriterUtils.getLogWriter().info("restarting server 2"); createBridgeServer(server2, regionName, serverPort2, true, 0, "ds1"); // Test Case1: Trigger singleHop putAll. Stop server2 in middle. @@ -2414,7 +2421,7 @@ public void testOneServer() throws CacheException, InterruptedException { client2Size = getRegionSize(client2, regionName); server1Size = getRegionSize(server1, regionName); server2Size = getRegionSize(server2, regionName); - getLogWriter().info("region sizes after server2 restarted: "+client1Size+","+client2Size+","+server1Size); + LogWriterUtils.getLogWriter().info("region sizes after server2 restarted: "+client1Size+","+client2Size+","+server1Size); assertEquals(150, client1Size); assertEquals(client2Size, server1Size); assertEquals(client2Size, server2Size); @@ -2442,7 +2449,7 @@ public void testOneServer() throws CacheException, InterruptedException { // Test Case 2: based on case 1, but this time, there should be no X keys // created on server2. - getLogWriter().info("region sizes after re-run the putAll: "+new_client1Size+","+new_client2Size+","+new_server1Size); + LogWriterUtils.getLogWriter().info("region sizes after re-run the putAll: "+new_client1Size+","+new_client2Size+","+new_server1Size); assertEquals(server1Size+numberOfEntries/2, new_server1Size); assertEquals(client1Size+numberOfEntries/2, new_client1Size); assertEquals(client2Size+numberOfEntries/2, new_client2Size); @@ -2451,7 +2458,7 @@ public void testOneServer() throws CacheException, InterruptedException { createBridgeServer(server2, regionName, serverPort2, true, 0, "ds1"); server1Size = getRegionSize(server1, regionName); server2Size = getRegionSize(server2, regionName); - getLogWriter().info("region sizes after restart server2: "+server1Size+","+server2Size); + LogWriterUtils.getLogWriter().info("region sizes after restart server2: "+server1Size+","+server2Size); assertEquals(server1Size, server2Size); // add a cacheWriter for server to fail putAll after it created cacheWriterAllowedKeyNum keys @@ -2483,7 +2490,7 @@ public void testOneServer() throws CacheException, InterruptedException { int oncemore_client2Size = getRegionSize(client2, regionName); int oncemore_server1Size = getRegionSize(server1, regionName); int oncemore_server2Size = getRegionSize(server2, regionName); - getLogWriter().info("region sizes in once more test: " + LogWriterUtils.getLogWriter().info("region sizes in once more test: " +oncemore_client1Size+","+oncemore_client2Size+","+oncemore_server1Size+","+oncemore_server2Size); int delta_at_server = oncemore_server1Size - server1Size; assertEquals(new_client1Size+delta_at_server, oncemore_client1Size); @@ -2521,7 +2528,7 @@ public void testOneServer() throws CacheException, InterruptedException { int serverPorts[] = AvailablePortHelper.getRandomAvailableTCPPorts(2); final int serverPort1 = serverPorts[0]; final int serverPort2 = serverPorts[1]; - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set <true, false> means <PR=true, notifyBySubscription=false> to test local-invalidates createBridgeServer(server1, regionName, serverPort1, true, 1, "ds1"); @@ -2540,7 +2547,7 @@ public void testOneServer() throws CacheException, InterruptedException { region.getAttributesMutator().addCacheListener(new MyListener(false)); region.registerInterest("ALL_KEYS"); - getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); + LogWriterUtils.getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); } }); @@ -2559,27 +2566,27 @@ public void testOneServer() throws CacheException, InterruptedException { int c2Size = getRegionSize(client2, regionName); int s1Size = getRegionSize(server1, regionName); int s2Size = getRegionSize(server2, regionName); - getLogWriter().info("region sizes: "+c1Size+","+c2Size+","+s1Size+","+s2Size); + LogWriterUtils.getLogWriter().info("region sizes: "+c1Size+","+c2Size+","+s1Size+","+s2Size); if (c1Size != numberOfEntries) { - getLogWriter().info("waiting for client1 to get all updates"); + LogWriterUtils.getLogWriter().info("waiting for client1 to get all updates"); return false; } if (c2Size != numberOfEntries) { - getLogWriter().info("waiting for client2 to get all updates"); + LogWriterUtils.getLogWriter().info("waiting for client2 to get all updates"); return false; } if (s1Size != numberOfEntries) { - getLogWriter().info("waiting for server1 to get all updates"); + LogWriterUtils.getLogWriter().info("waiting for server1 to get all updates"); return false; } if (s2Size != numberOfEntries) { - getLogWriter().info("waiting for server2 to get all updates"); + LogWriterUtils.getLogWriter().info("waiting for server2 to get all updates"); return false; } return true; } }; - waitForCriterion(waitForSizes, 10000, 1000, true); + Wait.waitForCriterion(waitForSizes, 10000, 1000, true); client1Size = getRegionSize(client1, regionName); client2Size = getRegionSize(client2, regionName); @@ -2616,9 +2623,9 @@ public void testOneServer() throws CacheException, InterruptedException { // server2 will closeCache after created 10 keys - DistributedTestCase.join(async1, 30 * 1000, getLogWriter()); + ThreadUtils.join(async1, 30 * 1000); if (async1.exceptionOccurred()) { - fail("Aync1 get exceptions:", async1.getException()); + Assert.fail("Aync1 get exceptions:", async1.getException()); } client1Size = getRegionSize(client1, regionName); @@ -2626,7 +2633,7 @@ public void testOneServer() throws CacheException, InterruptedException { client2Size = getRegionSize(client2, regionName); server1Size = getRegionSize(server1, regionName); // putAll should succeed after retry - getLogWriter().info("region sizes: "+client1Size+","+client2Size+","+server1Size); + LogWriterUtils.getLogWriter().info("region sizes: "+client1Size+","+client2Size+","+server1Size); assertEquals(server1Size, client1Size); assertEquals(server1Size, client2Size); @@ -2635,7 +2642,7 @@ public void testOneServer() throws CacheException, InterruptedException { server1Size = getRegionSize(server1, regionName); server2Size = getRegionSize(server2, regionName); - getLogWriter().info("region sizes after server2 restarted: "+client1Size+","+client2Size+","+server1Size); + LogWriterUtils.getLogWriter().info("region sizes after server2 restarted: "+client1Size+","+client2Size+","+server1Size); assertEquals(client2Size, server1Size); assertEquals(client2Size, server2Size); @@ -2653,7 +2660,7 @@ public void testOneServer() throws CacheException, InterruptedException { int new_client2Size = getRegionSize(client2, regionName); // putAll should succeed, all the numbers should match - getLogWriter().info("region sizes after re-run the putAll: "+new_client1Size+","+new_client2Size+","+new_server1Size); + LogWriterUtils.getLogWriter().info("region sizes after re-run the putAll: "+new_client1Size+","+new_client2Size+","+new_server1Size); assertEquals(new_server1Size, new_client1Size); assertEquals(new_server1Size, new_client2Size); @@ -2678,7 +2685,7 @@ public void testOneServer() throws CacheException, InterruptedException { final String regionName = getUniqueName(); final int[] serverPorts = AvailablePortHelper.getRandomAvailableTCPPorts(3); - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); final SharedCounter sc_server1 = new SharedCounter("server1"); final SharedCounter sc_server2 = new SharedCounter("server2"); @@ -2709,7 +2716,7 @@ public void testOneServer() throws CacheException, InterruptedException { assertNotNull(getRootRegion().getSubregion(regionName)); } catch (CacheException ex) { - fail("While creating Region on Edge", ex); + Assert.fail("While creating Region on Edge", ex); } } @@ -2759,7 +2766,7 @@ public void testOneServer() throws CacheException, InterruptedException { int server1Size = getRegionSize(server1, regionName); int server2Size = getRegionSize(server2, regionName); int server3Size = getRegionSize(server2, regionName); - getLogWriter().info("region sizes: "+client1Size+","+server1Size+","+server2Size+","+server3Size); + LogWriterUtils.getLogWriter().info("region sizes: "+client1Size+","+server1Size+","+server2Size+","+server3Size); AsyncInvocation async1 = client1.invokeAsync(new CacheSerializableRunnable(title+"client1 add listener and putAll") { public void run2() throws CacheException { @@ -2771,9 +2778,9 @@ public void testOneServer() throws CacheException, InterruptedException { // server1 and server2 will closeCache after created 10 keys - DistributedTestCase.join(async1, 30 * 1000, getLogWriter()); + ThreadUtils.join(async1, 30 * 1000); if (async1.exceptionOccurred()) { - fail("Aync1 get exceptions:", async1.getException()); + Assert.fail("Aync1 get exceptions:", async1.getException()); } server3.invoke(new CacheSerializableRunnable(title @@ -2781,14 +2788,14 @@ public void testOneServer() throws CacheException, InterruptedException { public void run2() throws CacheException { Region r = getRootRegion().getSubregion(regionName); MyListener l = (MyListener)r.getAttributes().getCacheListeners()[0]; - getLogWriter().info("event counters : "+l.sc); + LogWriterUtils.getLogWriter().info("event counters : "+l.sc); assertEquals(numberOfEntries, l.sc.num_create_event); assertEquals(0, l.sc.num_update_event); } }); - getLogWriter().info("event counters : "+myListener.sc); + LogWriterUtils.getLogWriter().info("event counters : "+myListener.sc); assertEquals(numberOfEntries, myListener.sc.num_create_event); assertEquals(0, myListener.sc.num_update_event); @@ -2808,9 +2815,9 @@ public void testOneServer() throws CacheException, InterruptedException { */ public void test2FailOverDistributedServer() throws CacheException, InterruptedException { - addExpectedException("Broken pipe"); - addExpectedException("Connection reset"); - addExpectedException("Unexpected IOException"); + IgnoredException.addIgnoredException("Broken pipe"); + IgnoredException.addIgnoredException("Connection reset"); + IgnoredException.addIgnoredException("Unexpected IOException"); final String title = "test2FailOverDistributedServer:"; // disconnectAllFromDS(); @@ -2824,7 +2831,7 @@ public void testOneServer() throws CacheException, InterruptedException { int serverPorts[] = AvailablePortHelper.getRandomAvailableTCPPorts(2); final int serverPort1 = serverPorts[0]; final int serverPort2 = serverPorts[1]; - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set notifyBySubscription=true to test register interest createBridgeServer(server1, regionName, serverPort1, false, 0, null); @@ -2853,7 +2860,7 @@ public void testOneServer() throws CacheException, InterruptedException { // registerInterest for ALL_KEYS region.registerInterest("ALL_KEYS"); - getLogWriter().info("client1 registerInterest ALL_KEYS at "+region.getFullPath()); + LogWriterUtils.getLogWriter().info("client1 registerInterest ALL_KEYS at "+region.getFullPath()); } }); @@ -2864,7 +2871,7 @@ public void testOneServer() throws CacheException, InterruptedException { // registerInterest for ALL_KEYS region.registerInterest("ALL_KEYS"); - getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); + LogWriterUtils.getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); } }); @@ -2877,7 +2884,7 @@ public void testOneServer() throws CacheException, InterruptedException { }); - pause(2000); + Wait.pause(2000); server1.invoke(new CacheSerializableRunnable(title + "stop Bridge Server 1") { public void run2() throws CacheException { @@ -2885,7 +2892,7 @@ public void testOneServer() throws CacheException, InterruptedException { } }); - DistributedTestCase.join(async1, 30 * 1000, getLogWriter()); + ThreadUtils.join(async1, 30 * 1000); // verify bridge server 2 for asyn keys server2.invoke(new CacheSerializableRunnable(title @@ -2924,7 +2931,7 @@ public void testOneServer() throws CacheException, InterruptedException { int serverPorts[] = AvailablePortHelper.getRandomAvailableTCPPorts(2); final int serverPort1 = serverPorts[0]; final int serverPort2 = serverPorts[1]; - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set notifyBySubscription=true to test register interest createBridgeServer(server1, regionName, serverPort1, false, 0, null); @@ -2955,7 +2962,7 @@ public void testOneServer() throws CacheException, InterruptedException { try { doPutAll(regionName, "key-", thousandEntries); } catch (Exception e) { - getLogWriter().info(title + "Expected SocketTimeOut:"+e.getMessage()); + LogWriterUtils.getLogWriter().info(title + "Expected SocketTimeOut:"+e.getMessage()); exceptionTriggered = true; } assertTrue(exceptionTriggered); @@ -2971,9 +2978,9 @@ public void testOneServer() throws CacheException, InterruptedException { * Tests while putAll timeout at endpoint1 and switch to endpoint2 */ public void testEndPointSwitch() throws CacheException, InterruptedException { - addExpectedException("Broken pipe"); - addExpectedException("Connection reset"); - addExpectedException("Unexpected IOException"); + IgnoredException.addIgnoredException("Broken pipe"); + IgnoredException.addIgnoredException("Connection reset"); + IgnoredException.addIgnoredException("Unexpected IOException"); final String title = "testEndPointSwitch:"; disconnectAllFromDS(); @@ -2986,7 +2993,7 @@ public void testOneServer() throws CacheException, InterruptedException { final int serverPort1 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); final int serverPort2 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set notifyBySubscription=true to test register interest createBridgeServer(server1, regionName, serverPort1, false, 0, null); @@ -3008,7 +3015,7 @@ public void testOneServer() throws CacheException, InterruptedException { Region region = getRootRegion().getSubregion(regionName); region.getAttributesMutator().addCacheListener(new MyListener(false)); region.registerInterest("ALL_KEYS"); - getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); + LogWriterUtils.getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); } }); @@ -3018,7 +3025,7 @@ public void testOneServer() throws CacheException, InterruptedException { try { doPutAll(regionName, title, testEndPointSwitchNumber); } catch (Exception e) { - getLogWriter().info(title + "Expected SocketTimeOut"+e.getMessage()); + LogWriterUtils.getLogWriter().info(title + "Expected SocketTimeOut"+e.getMessage()); } } }); @@ -3106,7 +3113,7 @@ public void testOneServer() throws CacheException, InterruptedException { final int serverPort1 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); final int serverPort2 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set notifyBySubscription=true to test register interest createBridgeServer(server1, regionName, serverPort1, false, 0, null); @@ -3124,7 +3131,7 @@ public void testOneServer() throws CacheException, InterruptedException { public void run2() throws CacheException { Region region = getRootRegion().getSubregion(regionName); region.registerInterest("ALL_KEYS"); - getLogWriter().info("client1 registerInterest ALL_KEYS at "+region.getFullPath()); + LogWriterUtils.getLogWriter().info("client1 registerInterest ALL_KEYS at "+region.getFullPath()); } }); @@ -3133,7 +3140,7 @@ public void testOneServer() throws CacheException, InterruptedException { Region region = getRootRegion().getSubregion(regionName); region.getAttributesMutator().addCacheListener(new MyListener(false)); region.registerInterest("ALL_KEYS"); - getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); + LogWriterUtils.getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); } }); @@ -3153,7 +3160,7 @@ public void testOneServer() throws CacheException, InterruptedException { } }); - pause(2000); + Wait.pause(2000); server1.invoke(new CacheSerializableRunnable(title + "stop Bridge Server 1") { public void run2() throws CacheException { @@ -3161,8 +3168,8 @@ public void testOneServer() throws CacheException, InterruptedException { } }); - DistributedTestCase.join(async1, 30 * 1000, getLogWriter()); - DistributedTestCase.join(async2, 30 * 1000, getLogWriter()); + ThreadUtils.join(async1, 30 * 1000); + ThreadUtils.join(async2, 30 * 1000); // verify client 2 for asyn keys client2.invokeAsync(new CacheSerializableRunnable(title @@ -3234,18 +3241,18 @@ public void testOneServer() throws CacheException, InterruptedException { } region.putAll(map, "putAllCallback"); try { - getLogWriter().info("before commit TX1"); + LogWriterUtils.getLogWriter().info("before commit TX1"); //tx.commit(); - getLogWriter().info("TX1 committed"); + LogWriterUtils.getLogWriter().info("TX1 committed"); } catch (CommitConflictException e) { - getLogWriter().info("TX1 rollbacked"); + LogWriterUtils.getLogWriter().info("TX1 rollbacked"); } } }); // we have to pause a while to let TX1 finish earlier - pause(500); + Wait.pause(500); // TX2: server2 do a putAll AsyncInvocation async2 = server2.invokeAsync(new CacheSerializableRunnable( title + "TX2: async putAll from server2") { @@ -3261,12 +3268,12 @@ public void testOneServer() throws CacheException, InterruptedException { } region.putAll(map, "putAllCallback"); try { - getLogWriter().info("before commit TX2"); + LogWriterUtils.getLogWriter().info("before commit TX2"); //tx.commit(); - getLogWriter().info("TX2 committed"); + LogWriterUtils.getLogWriter().info("TX2 committed"); } catch (CommitConflictException e) { - getLogWriter().info("TX2 rollbacked"); + LogWriterUtils.getLogWriter().info("TX2 rollbacked"); } } }); @@ -3289,19 +3296,19 @@ public void testOneServer() throws CacheException, InterruptedException { } region.putAll(map, "putAllCallback"); try { - getLogWriter().info("before commit TX3"); + LogWriterUtils.getLogWriter().info("before commit TX3"); //tx.commit(); - getLogWriter().info("TX3 committed"); + LogWriterUtils.getLogWriter().info("TX3 committed"); } catch (CommitConflictException e) { - getLogWriter().info("TX3 rollbacked"); + LogWriterUtils.getLogWriter().info("TX3 rollbacked"); } } }); - DistributedTestCase.join(async1, 30 * 1000, getLogWriter()); - DistributedTestCase.join(async2, 30 * 1000, getLogWriter()); - DistributedTestCase.join(async3, 30 * 1000, getLogWriter()); + ThreadUtils.join(async1, 30 * 1000); + ThreadUtils.join(async2, 30 * 1000); + ThreadUtils.join(async3, 30 * 1000); // verify server 2 for asyn keys server2.invoke(new CacheSerializableRunnable(title @@ -3324,7 +3331,7 @@ public void testOneServer() throws CacheException, InterruptedException { else if (obj.getPrice() == i + numberOfEntries * 2) { tx_no = 3; } - getLogWriter().info("Verifying TX:" + tx_no); + LogWriterUtils.getLogWriter().info("Verifying TX:" + tx_no); } if (tx_no == 1) { assertEquals(i, obj.getPrice()); @@ -3363,7 +3370,7 @@ public void testOneServer() throws CacheException, InterruptedException { final int serverPort1 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); final int serverPort2 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set notifyBySubscription=true to test register interest createBridgeServer(server1, regionName, serverPort1, true, 0, null); @@ -3390,7 +3397,7 @@ public void testOneServer() throws CacheException, InterruptedException { public void run2() throws CacheException { Region region = getRootRegion().getSubregion(regionName); region.registerInterest("ALL_KEYS"); - getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); + LogWriterUtils.getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); } }); @@ -3405,7 +3412,7 @@ public void testOneServer() throws CacheException, InterruptedException { for (Object key : entries.keySet()) { RegionEntry internalRegionEntry = entries.getEntry(key); VersionTag tag = internalRegionEntry.getVersionStamp().asVersionTag(); - getLogWriter().info("Entry version tag on client for " + key + ": " + tag); + LogWriterUtils.getLogWriter().info("Entry version tag on client for " + key + ": " + tag); versions.add(tag); } @@ -3425,7 +3432,7 @@ public void testOneServer() throws CacheException, InterruptedException { for (Object key : entries.keySet()) { RegionEntry internalRegionEntry = entries.getEntry(key); VersionTag tag = internalRegionEntry.getVersionStamp().asVersionTag(); - getLogWriter().info("Entry version tag on client for " + key + ": " + tag); + LogWriterUtils.getLogWriter().info("Entry version tag on client for " + key + ": " + tag); versions.add(tag); } return versions; @@ -3433,9 +3440,9 @@ public void testOneServer() throws CacheException, InterruptedException { }); assertEquals(numberOfEntries*2, client1Versions.size()); - getLogWriter().info(Arrays.toString(client1Versions.toArray())); + LogWriterUtils.getLogWriter().info(Arrays.toString(client1Versions.toArray())); - getLogWriter().info(Arrays.toString(client2Versions.toArray())); + LogWriterUtils.getLogWriter().info(Arrays.toString(client2Versions.toArray())); for (VersionTag tag : client1Versions) { if (!client2Versions.contains(tag)) { @@ -3463,7 +3470,7 @@ public void testOneServer() throws CacheException, InterruptedException { final int serverPort1 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); final int serverPort2 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set notifyBySubscription=true to test register interest createBridgeServer(server1, regionName, serverPort1, true, 0, null); @@ -3493,7 +3500,7 @@ public void testOneServer() throws CacheException, InterruptedException { Region region = getRootRegion().getSubregion(regionName); region.registerInterest("ALL_KEYS"); assertEquals(numberOfEntries, region.size()); - getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); + LogWriterUtils.getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); } }); @@ -3509,7 +3516,7 @@ public void testOneServer() throws CacheException, InterruptedException { for (Object key : entries.keySet()) { RegionEntry internalRegionEntry = entries.getEntry(key); VersionTag tag = internalRegionEntry.getVersionStamp().asVersionTag(); - getLogWriter().info("Entry version tag on client for " + key + ": " + tag); + LogWriterUtils.getLogWriter().info("Entry version tag on client for " + key + ": " + tag); versions.add(tag); } @@ -3529,7 +3536,7 @@ public void testOneServer() throws CacheException, InterruptedException { for (Object key : entries.keySet()) { RegionEntry internalRegionEntry = entries.getEntry(key); VersionTag tag = internalRegionEntry.getVersionStamp().asVersionTag(); - getLogWriter().info("Entry version tag on client for " + key + ": " + tag); + LogWriterUtils.getLogWriter().info("Entry version tag on client for " + key + ": " + tag); versions.add(tag); } return versions; @@ -3537,9 +3544,9 @@ public void testOneServer() throws CacheException, InterruptedException { }); assertEquals(numberOfEntries*2, client1RAVersions.size()); - getLogWriter().info(Arrays.toString(client1RAVersions.toArray())); + LogWriterUtils.getLogWriter().info(Arrays.toString(client1RAVersions.toArray())); - getLogWriter().info(Arrays.toString(client2RAVersions.toArray())); + LogWriterUtils.getLogWriter().info(Arrays.toString(client2RAVersions.toArray())); for (VersionTag tag : client1RAVersions) { if (!client2RAVersions.contains(tag)) { @@ -3566,7 +3573,7 @@ public void testOneServer() throws CacheException, InterruptedException { final int serverPort1 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); final int serverPort2 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); final int serverPort3 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set notifyBySubscription=true to test register interest createBridgeServer(server1, regionName, serverPort1, true, 1, null); @@ -3585,7 +3592,7 @@ public void testOneServer() throws CacheException, InterruptedException { public void run2() throws CacheException { Region region = getRootRegion().getSubregion(regionName); region.registerInterest("ALL_KEYS"); - getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); + LogWriterUtils.getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); } }); @@ -3612,7 +3619,7 @@ public void testOneServer() throws CacheException, InterruptedException { for (Object key : entries.keySet()) { RegionEntry internalRegionEntry = entries.getEntry(key); VersionTag tag = internalRegionEntry.getVersionStamp().asVersionTag(); - getLogWriter().info("Entry version tag on server1:" + tag); + LogWriterUtils.getLogWriter().info("Entry version tag on server1:" + tag); versions.add(key + " " + tag); } } @@ -3622,7 +3629,7 @@ public void testOneServer() throws CacheException, InterruptedException { }); // Let client be updated with all keys. - pause(1000); + Wait.pause(1000); actualVersions = (List<String>) client1.invoke(new SerializableCallable(title+"client2 versions collection") { @@ -3643,10 +3650,10 @@ public void testOneServer() throws CacheException, InterruptedException { } }); - getLogWriter().info(Arrays.toString(expectedVersions.toArray())); + LogWriterUtils.getLogWriter().info(Arrays.toString(expectedVersions.toArray())); assertEquals(numberOfEntries*2, actualVersions.size()); - getLogWriter().info(Arrays.toString(actualVersions.toArray())); + LogWriterUtils.getLogWriter().info(Arrays.toString(actualVersions.toArray())); for (String keyTag : expectedVersions) { if (!actualVersions.contains(keyTag)) { @@ -3674,7 +3681,7 @@ public void testOneServer() throws CacheException, InterruptedException { final int serverPort1 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); final int serverPort2 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); final int serverPort3 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set notifyBySubscription=true to test register interest createBridgeServer(server1, regionName, serverPort1, true, 1, null); @@ -3693,7 +3700,7 @@ public void testOneServer() throws CacheException, InterruptedException { public void run2() throws CacheException { Region region = getRootRegion().getSubregion(regionName); region.registerInterest("ALL_KEYS"); - getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); + LogWriterUtils.getLogWriter().info("client2 registerInterest ALL_KEYS at "+region.getFullPath()); } }); @@ -3722,7 +3729,7 @@ public void testOneServer() throws CacheException, InterruptedException { for (Object key : entries.keySet()) { RegionEntry internalRegionEntry = entries.getEntry(key); VersionTag tag = internalRegionEntry.getVersionStamp().asVersionTag(); - getLogWriter().info("Entry version tag on server1:" + tag); + LogWriterUtils.getLogWriter().info("Entry version tag on server1:" + tag); versions.add(key + " " + tag); } } @@ -3732,7 +3739,7 @@ public void testOneServer() throws CacheException, InterruptedException { }); // Let client be updated with all keys. - pause(1000); + Wait.pause(1000); actualRAVersions = (List<String>) client1.invoke(new SerializableCallable(title+"client2 versions collection") { @@ -3754,10 +3761,10 @@ public void testOneServer() throws CacheException, InterruptedException { } }); - getLogWriter().info(Arrays.toString(expectedRAVersions.toArray())); + LogWriterUtils.getLogWriter().info(Arrays.toString(expectedRAVersions.toArray())); assertEquals(numberOfEntries*2, actualRAVersions.size()); - getLogWriter().info(Arrays.toString(actualRAVersions.toArray())); + LogWriterUtils.getLogWriter().info(Arrays.toString(actualRAVersions.toArray())); for (String keyTag : expectedRAVersions) { if (!actualRAVersions.contains(keyTag)) { @@ -3784,7 +3791,7 @@ public void testOneServer() throws CacheException, InterruptedException { final int serverPort1 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); final int serverPort2 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); - final String serverHost = getServerHostName(server1.getHost()); + final String serverHost = NetworkUtils.getServerHostName(server1.getHost()); // set notifyBySubscription=true to test register interest createBridgeServer(server1, regionName, serverPort1, false, 0, null); @@ -3818,7 +3825,7 @@ public void testOneServer() throws CacheException, InterruptedException { for (Object key : entries.keySet()) { RegionEntry internalRegionEntry = entries.getEntry(key); VersionTag tag = internalRegionEntry.getVersionStamp().asVersionTag(); - getLogWriter().info("Entry version tag on client:" + tag); + LogWriterUtils.getLogWriter().info("Entry version tag on client:" + tag); versions.add(tag); } @@ -3846,9 +3853,9 @@ public void testOneServer() throws CacheException, InterruptedException { }); assertEquals(numberOfEntries*2, client1Versions.size()); - getLogWriter().info(Arrays.toString(client1Versions.toArray())); + LogWriterUtils.getLogWriter().info(Arrays.toString(client1Versions.toArray())); - getLogWriter().info(Arrays.toString(client2Versions.toArray())); + LogWriterUtils.getLogWriter().info(Arrays.toString(client2Versions.toArray())); for (VersionTag tag : client2Versions) { tag.setMemberID(null); @@ -3865,7 +3872,7 @@ public void testOneServer() throws CacheException, InterruptedException { public void run2() throws CacheException { // Create DS Properties config = new Properties(); - config.setProperty("locators", "localhost["+getDUnitLocatorPort()+"]"); + config.setProperty("locators", "localhost["+DistributedTestUtils.getDUnitLocatorPort()+"]"); getSystem(config); // Create Region @@ -3919,9 +3926,9 @@ public void testOneServer() throws CacheException, InterruptedException { } try { int retPort = startBridgeServer(serverPort); - getLogWriter().info("Cache Server Started:"+retPort+":"+serverPort); + LogWriterUtils.getLogWriter().info("Cache Server Started:"+retPort+":"+serverPort); } catch (Exception e) { - fail("While starting CacheServer", e); + Assert.fail("While starting CacheServer", e); } } }); @@ -3946,7 +3953,7 @@ public void testOneServer() throws CacheException, InterruptedException { try { getCache(); - addExpectedException("java.net.ConnectException||java.net.SocketException"); + IgnoredException.addIgnoredException("java.net.ConnectException||java.net.SocketException"); if (readTimeOut>0) { PoolFactory pf = PoolManager.createFactory(); for(int i=0; i<serverPorts.length; i++) { @@ -3966,7 +3973,7 @@ public void testOneServer() throws CacheException, InterruptedException { assertNotNull(getRootRegion().getSubregion(regionName)); } catch (CacheException ex) { - fail("While creating Region on Edge", ex); + Assert.fail("While creating Region on Edge", ex); } } }); @@ -4175,7 +4182,7 @@ public void testOneServer() throws CacheException, InterruptedException { localregion.put(key, newValue); num_updates ++; } - getLogWriter().info("CQListener:TestObject:" + key + ":" + newValue); + LogWriterUtils.getLogWriter().info("CQListener:TestObject:" + key + ":" + newValue); } public void close() { @@ -4241,7 +4248,7 @@ public void testOneServer() throws CacheException, InterruptedException { if (closeCacheAtItem != -1 && sc.num_create_event >= closeCacheAtItem) { closeCacheAsync(vm); } - getLogWriter().fine( + LogWriterUtils.getLogWriter().fine( "MyListener:afterCreate " + event.getKey() + ":" + event.getNewValue()+":num_create_event="+sc.num_create_event + ":eventID="+((EntryEventImpl)event).getEventId()); @@ -4262,7 +4269,7 @@ public void testOneServer() throws CacheException, InterruptedException { if (event.getKey().toString().startsWith("testEndPointSwitch")) { num_testEndPointSwitch++; if (num_testEndPointSwitch == testEndPointSwitchNumber) { - getLogWriter().info("testEndPointSwitch received expected events"); + LogWriterUtils.getLogWriter().info("testEndPointSwitch received expected events"); synchronized(lockObject3) { lockObject3.notify(); } @@ -4271,7 +4278,7 @@ public void testOneServer() throws CacheException, InterruptedException { if (event.getKey().toString().startsWith("testHADRFailOver")) { num_testHADRFailOver++; if (num_testHADRFailOver == thousandEntries*2) { - getLogWriter().info("testHADRFailOver received expected events"); + LogWriterUtils.getLogWriter().info("testHADRFailOver received expected events"); synchronized(lockObject4) { lockObject4.notify(); } @@ -4281,7 +4288,7 @@ public void testOneServer() throws CacheException, InterruptedException { public void afterUpdate(EntryEvent event) { sc.num_update_event++; - getLogWriter().fine( + LogWriterUtils.getLogWriter().fine( "MyListener:afterUpdate " + event.getKey() + ":" + event.getNewValue()+":"+event.getOldValue() +":num_update_event="+sc.num_update_event @@ -4304,7 +4311,7 @@ public void testOneServer() throws CacheException, InterruptedException { if (event.getOldValue() !=null) { num_oldValueInAfterUpdate++; if (num_oldValueInAfterUpdate == numberOfEntries) { - getLogWriter().info("received expected OldValue events"); + LogWriterUtils.getLogWriter().info("received expected OldValue events"); synchronized(lockObject) { lockObject.notify(); } @@ -4315,7 +4322,7 @@ public void testOneServer() throws CacheException, InterruptedException { public void afterInvalidate(EntryEvent event) { sc.num_invalidate_event++; - getLogWriter() + LogWriterUtils.getLogWriter() .info("local invalidate is triggered for " + event.getKey()+":num_invalidte_event="+sc.num_invalidate_event); } @@ -4324,7 +4331,7 @@ public void testOneServer() throws CacheException, InterruptedException { if (event.getOperation().isRemoveAll()) { assertEquals("removeAllCallback", event.getCallbackArgument()); } - getLogWriter() + LogWriterUtils.getLogWriter() .info("local destroy is triggered for " + event.getKey()+":num_invalidte_event="+sc.num_destroy_event); } } @@ -4353,7 +4360,7 @@ public void testOneServer() throws CacheException, InterruptedException { if (exceptionAtItem != -1 && num_created >= exceptionAtItem) { throw new CacheWriterException("Triggered exception as planned, created "+num_created+" keys."); } - getLogWriter() + LogWriterUtils.getLogWriter() .info( "MyWriter:beforeCreate " + event.getKey() + ":" + event.getNewValue() + "num_created=" + num_created); @@ -4374,7 +4381,7 @@ public void testOneServer() throws CacheException, InterruptedException { } public void beforeUpdate(EntryEvent event) { - getLogWriter() + LogWriterUtils.getLogWriter() .info( "MyWriter:beforeUpdate " + event.getKey() + ":" + event.getNewValue()); @@ -4398,7 +4405,7 @@ public void testOneServer() throws CacheException, InterruptedException { if (exceptionAtItem != -1 && num_destroyed >= exceptionAtItem) { throw new CacheWriterException("Triggered exception as planned, destroyed "+num_destroyed+" keys."); } - getLogWriter().info("MyWriter:beforeDestroy " + event.getKey() + ":" + "num_destroyed=" + num_destroyed); + LogWriterUtils.getLogWriter().info("MyWriter:beforeDestroy " + event.getKey() + ":" + "num_destroyed=" + num_destroyed); if (event.getOperation().isRemoveAll()) { assertEquals("removeAllCallback", event.getCallbackArgument()); }