Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 636E4200B32 for ; Tue, 24 May 2016 20:53:48 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 623DC160A38; Tue, 24 May 2016 18:53:48 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8D181160A36 for ; Tue, 24 May 2016 20:53:47 +0200 (CEST) Received: (qmail 8479 invoked by uid 500); 24 May 2016 18:53:46 -0000 Mailing-List: contact commits-help@geode.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.incubator.apache.org Delivered-To: mailing list commits@geode.incubator.apache.org Received: (qmail 8453 invoked by uid 99); 24 May 2016 18:53:46 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 May 2016 18:53:46 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 562FC18060C for ; Tue, 24 May 2016 18:53:46 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.221 X-Spam-Level: X-Spam-Status: No, score=-3.221 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id ftsXwdaL6XaJ for ; Tue, 24 May 2016 18:53:44 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with SMTP id 59A7660D7C for ; Tue, 24 May 2016 18:53:43 +0000 (UTC) Received: (qmail 7421 invoked by uid 99); 24 May 2016 18:53:42 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 May 2016 18:53:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8CB0BE97D5; Tue, 24 May 2016 18:53:42 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sai_boorlagadda@apache.org To: commits@geode.incubator.apache.org Date: Tue, 24 May 2016 18:54:09 -0000 Message-Id: In-Reply-To: <5a31d59ae60d443ea8b3494d800eb9be@git.apache.org> References: <5a31d59ae60d443ea8b3494d800eb9be@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [28/55] [abbrv] incubator-geode git commit: GEODE-596: change test to start servers on port 0 archived-at: Tue, 24 May 2016 18:53:48 -0000 GEODE-596: change test to start servers on port 0 Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/6c53d4f8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/6c53d4f8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/6c53d4f8 Branch: refs/heads/feature/GEODE-1153 Commit: 6c53d4f840abb874d2cb9d50f499acf50db61943 Parents: 2c148ca Author: Darrel Schneider Authored: Mon May 9 15:08:28 2016 -0700 Committer: Darrel Schneider Committed: Mon May 9 15:11:59 2016 -0700 ---------------------------------------------------------------------- .../MemoryThresholdsOffHeapDUnitTest.java | 54 ++++++++------------ 1 file changed, 20 insertions(+), 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/6c53d4f8/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsOffHeapDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsOffHeapDUnitTest.java index be6b266..9216788 100644 --- a/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsOffHeapDUnitTest.java +++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsOffHeapDUnitTest.java @@ -143,14 +143,11 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase { final VM server1 = host.getVM(0); final VM server2 = host.getVM(1); - final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2); - final int port1 = ports[0]; - final int port2 = ports[1]; final String regionName = "offHeapEventDelivery"; - startCacheServer(server1, port1, 0f, 0f, + startCacheServer(server1, 0f, 0f, regionName, false/*createPR*/, false/*notifyBySubscription*/, 0); - startCacheServer(server2, port2, 70f, 90f, + startCacheServer(server2, 70f, 90f, regionName, false/*createPR*/, false/*notifyBySubscription*/, 0); registerTestMemoryThresholdListener(server1); @@ -245,10 +242,9 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase { final String regionName = "offHeapDisabledThresholds"; - //set port to 0 in-order for system to pickup a random port. - startCacheServer(server1, 0, 0f, 0f, + startCacheServer(server1, 0f, 0f, regionName, false/*createPR*/, false/*notifyBySubscription*/, 0); - startCacheServer(server2, 0, 0f, 0f, + startCacheServer(server2, 0f, 0f, regionName, false/*createPR*/, false/*notifyBySubscription*/, 0); registerTestMemoryThresholdListener(server1); @@ -358,14 +354,11 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase { final VM server2 = host.getVM(1); final VM client = host.getVM(2); - final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2); - final int port1 = ports[0]; - final int port2 = ports[1]; final String regionName = "offHeapDRRemoteClientPutReject"; - startCacheServer(server1, port1, 0f, 0f, + final int port1 = startCacheServer(server1, 0f, 0f, regionName, false/*createPR*/, false/*notifyBySubscription*/, 0); - startCacheServer(server2, port2, 0f, 90f, + startCacheServer(server2, 0f, 90f, regionName, false/*createPR*/, false/*notifyBySubscription*/, 0); startClient(client, server1, port1, regionName); @@ -437,9 +430,9 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase { final String regionName = "offHeapDRRemotePutRejection"; //set port to 0 in-order for system to pickup a random port. - startCacheServer(server1, 0, 0f, 0f, + startCacheServer(server1, 0f, 0f, regionName, false/*createPR*/, false/*notifyBySubscription*/, 0); - startCacheServer(server2, 0, 0f, 90f, + startCacheServer(server2, 0f, 90f, regionName, false/*createPR*/, false/*notifyBySubscription*/, 0); registerTestMemoryThresholdListener(server1); @@ -729,7 +722,6 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase { prRemotePutRejection(false, true, false); } - @Category(FlakyTest.class) // GEODE-596: BindException, random ports public void testPR_RemotePutRejectionCacheClose() throws Exception { prRemotePutRejection(true, false, false); } @@ -746,7 +738,7 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase { prRemotePutRejection(true, false, true); } - @Category(FlakyTest.class) // GEODE-500: random ports, time sensitive, memory sensitive and GC dependent, waitForCriterions + @Category(FlakyTest.class) // GEODE-500: time sensitive, memory sensitive and GC dependent, waitForCriterions public void testPR_RemotePutRejectionWithTx() throws Exception { prRemotePutRejection(false, false, true); } @@ -759,15 +751,14 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase { servers[1] = host.getVM(2); servers[2] = host.getVM(3); - final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(3); final String regionName = "offHeapPRRemotePutRejection"; final int redundancy = 1; - startCacheServer(servers[0], ports[0], 0f, 90f, + startCacheServer(servers[0], 0f, 90f, regionName, true/*createPR*/, false/*notifyBySubscription*/, redundancy); - startCacheServer(servers[1], ports[1], 0f, 90f, + startCacheServer(servers[1], 0f, 90f, regionName, true/*createPR*/, false/*notifyBySubscription*/, redundancy); - startCacheServer(servers[2], ports[2], 0f, 90f, + startCacheServer(servers[2], 0f, 90f, regionName, true/*createPR*/, false/*notifyBySubscription*/, redundancy); accessor.invoke(new SerializableCallable() { public Object call() throws Exception { @@ -1272,15 +1263,11 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase { final VM server2 = host.getVM(1); final VM server3 = host.getVM(2); - final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(3); - final int port1 = ports[0]; - final int port2 = ports[1]; - final int port3 = ports[2]; final String regionName = "testEventOrder"; - startCacheServer(server1, port1, 0f, 0f, + startCacheServer(server1, 0f, 0f, regionName, false/*createPR*/, false/*notifyBySubscription*/, 0); - startCacheServer(server2, port2, 0f, 0f, + startCacheServer(server2, 0f, 0f, regionName, false/*createPR*/, false/*notifyBySubscription*/, 0); verifyProfiles(server1, 2); @@ -1295,7 +1282,7 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase { verifyProfiles(server1, 1); - startCacheServer(server3, port3, 0f, 0f, + startCacheServer(server3, 0f, 0f, regionName, false/*createPR*/, false/*notifyBySubscription*/, 0); verifyProfiles(server1, 2); @@ -1391,8 +1378,7 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase { final Object bigKey = -1; final Object smallKey = -2; - final int port = AvailablePortHelper.getRandomAvailableTCPPort(); - startCacheServer(server, port, 0f, 90f, + final int port = startCacheServer(server, 0f, 90f, regionName, createPR, false, 0); startClient(client, server, port, regionName); doPuts(client, regionName, false/*catchServerException*/, @@ -1604,11 +1590,11 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase { }); } - private void startCacheServer(VM server, final int port, + private int startCacheServer(VM server, final float evictionThreshold, final float criticalThreshold, final String regionName, final boolean createPR, final boolean notifyBySubscription, final int prRedundancy) throws Exception { - server.invoke(new SerializableCallable() { + return (Integer)server.invoke(new SerializableCallable() { public Object call() throws Exception { getSystem(getOffHeapProperties()); GemFireCacheImpl cache = (GemFireCacheImpl)getCache(); @@ -1636,10 +1622,10 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase { assertTrue(region instanceof DistributedRegion); } CacheServer cacheServer = getCache().addCacheServer(); - cacheServer.setPort(port); + cacheServer.setPort(0); cacheServer.setNotifyBySubscription(notifyBySubscription); cacheServer.start(); - return null; + return cacheServer.getPort(); } }); }