Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 39ED6179B6 for ; Sat, 2 May 2015 19:31:48 +0000 (UTC) Received: (qmail 95757 invoked by uid 500); 2 May 2015 19:31:48 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 95726 invoked by uid 500); 2 May 2015 19:31:48 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 95717 invoked by uid 99); 2 May 2015 19:31:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 May 2015 19:31:48 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [54.191.145.13] (HELO mx1-us-west.apache.org) (54.191.145.13) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 May 2015 19:31:43 +0000 Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id 1DF6C270D1 for ; Sat, 2 May 2015 18:54:06 +0000 (UTC) Received: (qmail 67965 invoked by uid 99); 2 May 2015 14:54:06 -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; Sat, 02 May 2015 14:54:06 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4D029E17CB; Sat, 2 May 2015 14:54:06 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sevdokimov@apache.org To: commits@ignite.incubator.apache.org Date: Sat, 02 May 2015 14:54:06 -0000 Message-Id: <5317643113834418883d8bb8d0792f24@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] incubator-ignite git commit: # IGNITE-709 Improve nodeId generation in tests. X-Virus-Checked: Checked by ClamAV on apache.org Repository: incubator-ignite Updated Branches: refs/heads/ignite-709_2 71bf90983 -> 4903dcec4 # IGNITE-709 Improve nodeId generation in tests. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e69803bd Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e69803bd Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e69803bd Branch: refs/heads/ignite-709_2 Commit: e69803bddd8b7243ea7359064c0eea178cf2cb2c Parents: 71bf909 Author: sevdokimov Authored: Sat May 2 17:03:46 2015 +0300 Committer: sevdokimov Committed: Sat May 2 17:03:46 2015 +0300 ---------------------------------------------------------------------- .../tcp/TcpClientDiscoverySelfTest.java | 47 +++++++++++++++++--- 1 file changed, 42 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e69803bd/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySelfTest.java index 09cbd97..5811ba0 100644 --- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySelfTest.java @@ -111,6 +111,12 @@ public class TcpClientDiscoverySelfTest extends GridCommonAbstractTest { disco.setIpFinder(ipFinder); cfg.setDiscoverySpi(disco); + + String nodeId = cfg.getNodeId().toString(); + + nodeId = "cc" + nodeId.substring(2); + + cfg.setNodeId(UUID.fromString(nodeId)); } return cfg; @@ -285,7 +291,7 @@ public class TcpClientDiscoverySelfTest extends GridCommonAbstractTest { checkNodes(3, 3); - resetClientIpFinder(2); + setClientRouter(2, 0); srvFailedLatch = new CountDownLatch(2); clientFailedLatch = new CountDownLatch(3); @@ -303,6 +309,32 @@ public class TcpClientDiscoverySelfTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ + public void testClientSegmentation() throws Exception { + clientsPerSrv = 1; + + startServerNodes(3); + startClientNodes(3); + + checkNodes(3, 3); + +// setClientRouter(2, 2); + + srvFailedLatch = new CountDownLatch(2 + 2); + clientFailedLatch = new CountDownLatch(2 + 2); + + attachListeners(2, 2); + + failServer(2); + + await(srvFailedLatch); + await(clientFailedLatch); + + checkNodes(2, 2); + } + + /** + * @throws Exception If failed. + */ public void testClientNodeJoinOneServer() throws Exception { startServerNodes(1); @@ -317,6 +349,11 @@ public class TcpClientDiscoverySelfTest extends GridCommonAbstractTest { checkNodes(1, 1); } + /** {@inheritDoc} */ + @Override protected long getTestTimeout() { + return Long.MAX_VALUE; + } + /** * @throws Exception If failed. */ @@ -473,16 +510,16 @@ public class TcpClientDiscoverySelfTest extends GridCommonAbstractTest { } /** - * @param idx Index. + * @param clientIdx Index. * @throws Exception In case of error. */ - private void resetClientIpFinder(int idx) throws Exception { + private void setClientRouter(int clientIdx, int srvIdx) throws Exception { TcpClientDiscoverySpi disco = - (TcpClientDiscoverySpi)G.ignite("client-" + idx).configuration().getDiscoverySpi(); + (TcpClientDiscoverySpi)G.ignite("client-" + clientIdx).configuration().getDiscoverySpi(); TcpDiscoveryVmIpFinder ipFinder = (TcpDiscoveryVmIpFinder)disco.getIpFinder(); - String addr = IP_FINDER.getRegisteredAddresses().iterator().next().toString(); + String addr = new ArrayList<>(IP_FINDER.getRegisteredAddresses()).get(srvIdx).toString(); if (addr.startsWith("/")) addr = addr.substring(1);