ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ivasilin...@apache.org
Subject [05/23] incubator-ignite git commit: #ignite-1086: change test.
Date Mon, 20 Jul 2015 15:05:21 GMT
#ignite-1086: change test.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f8d1e90e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f8d1e90e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f8d1e90e

Branch: refs/heads/ignite-1087
Commit: f8d1e90e942ffc996b18a6c46f96ec090b27ba61
Parents: 84233f2
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Mon Jul 6 10:59:44 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Mon Jul 6 10:59:44 2015 +0300

----------------------------------------------------------------------
 .../TcpDiscoveryNodeConsistentIdSelfTest.java   | 24 +++++++++++++++-----
 1 file changed, 18 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f8d1e90e/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryNodeConsistentIdSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryNodeConsistentIdSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryNodeConsistentIdSelfTest.java
index 411e85d..d159d72 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryNodeConsistentIdSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryNodeConsistentIdSelfTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.spi.discovery.tcp;
 
+import org.apache.ignite.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.spi.discovery.tcp.internal.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
@@ -43,7 +44,7 @@ public class TcpDiscoveryNodeConsistentIdSelfTest extends GridCommonAbstractTest
 
     /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
-        startGrids(2);
+        startGrids(1);
     }
 
     /** {@inheritDoc} */
@@ -56,13 +57,24 @@ public class TcpDiscoveryNodeConsistentIdSelfTest extends GridCommonAbstractTest
      */
     public void testConsistentId() throws Exception {
         Object id0 = grid(0).localNode().consistentId();
-        Object id1 = grid(1).localNode().consistentId();
 
-        stopAllGrids();
+        int port0 = getDiscoveryPort(grid(0));
+
+        for (int i = 0; i < 10; ++i) {
+            stopAllGrids();
+
+            startGrids(1);
 
-        startGrids(2);
+            if (port0 == getDiscoveryPort(grid(0)))
+                assertEquals(id0, grid(0).localNode().consistentId());
+        }
+    }
 
-        assertEquals(id0, grid(0).localNode().consistentId());
-        assertEquals(id1, grid(1).localNode().consistentId());
+    /**
+     * @param ignite Ignite.
+     * @return Discovery port.
+     */
+    private int getDiscoveryPort(Ignite ignite) {
+        return ((TcpDiscoveryNode) ignite.cluster().localNode()).discoveryPort();
     }
 }


Mime
View raw message