ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sevdoki...@apache.org
Subject [1/3] incubator-ignite git commit: # IGNITE-709 Improve nodeId generation in tests.
Date Sat, 02 May 2015 14:54:06 GMT
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 <sergey.evdokimov@jetbrains.com>
Authored: Sat May 2 17:03:46 2015 +0300
Committer: sevdokimov <sergey.evdokimov@jetbrains.com>
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);


Mime
View raw message