# IGNITE-709 Return test with server nodes only.

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

Branch: refs/heads/ignite-23
Commit: 9856334d106c9481ff53c90ab096b74b5ccfb81d
Parents: 3e18e6b
Author: sevdokimov <sevdoki...@gridgain.com>
Authored: Wed May 20 20:59:06 2015 +0300
Committer: sevdokimov <sevdoki...@gridgain.com>
Committed: Wed May 20 20:59:56 2015 +0300

----------------------------------------------------------------------
 .../GridDiscoveryManagerAliveCacheSelfTest.java | 33 +++++++++++++++++---
 1 file changed, 28 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9856334d/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
index da1e1d7..dce7d4b 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
@@ -64,6 +64,9 @@ public class GridDiscoveryManagerAliveCacheSelfTest extends 
GridCommonAbstractTe
     private volatile CountDownLatch latch;
 
     /** */
+    private boolean clientMode;
+
+    /** */
     private final IgnitePredicate<Event> lsnr = new IgnitePredicate<Event>() {
         @Override public boolean apply(Event evt) {
             assertNotNull("Topology lost nodes before stopTempNodes() was 
called.", latch);
@@ -88,10 +91,10 @@ public class GridDiscoveryManagerAliveCacheSelfTest extends 
GridCommonAbstractTe
 
         TcpDiscoverySpiAdapter disc;
 
-        if (((gridName.charAt(gridName.length() - 1) - '0') & 1) == 0)
-            disc = new TcpDiscoverySpi();
-        else
+        if (clientMode && ((gridName.charAt(gridName.length() - 1) - '0') & 1) 
!= 0)
             disc = new TcpClientDiscoverySpi();
+        else
+            disc = new TcpDiscoverySpi();
 
         disc.setIpFinder(IP_FINDER);
 
@@ -121,9 +124,9 @@ public class GridDiscoveryManagerAliveCacheSelfTest extends 
GridCommonAbstractTe
     }
 
     /**
-     * @throws Exception If failed.
+     *
      */
-    public void testAlives() throws Exception {
+    private void doTestAlive() throws Exception {
         for (int i = 0; i < ITERATIONS; i++) {
             info("Performing iteration: " + i);
 
@@ -146,6 +149,24 @@ public class GridDiscoveryManagerAliveCacheSelfTest 
extends GridCommonAbstractTe
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testAlives() throws Exception {
+        clientMode = false;
+
+        doTestAlive();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testAlivesClient() throws Exception {
+        clientMode = true;
+
+        doTestAlive();
+    }
+
+    /**
      * Waits while topology on all nodes became equals to the expected size.
      *
      * @param nodesCnt Expected nodes count.
@@ -159,6 +180,8 @@ public class GridDiscoveryManagerAliveCacheSelfTest extends 
GridCommonAbstractTe
             if (g.configuration().getDiscoverySpi() instanceof 
TcpClientDiscoverySpi)
                 
((TcpClientDiscoverySpi)g.configuration().getDiscoverySpi()).waitForMessagePrecessed();
 
+            Thread.sleep(500);
+
             while (g.cluster().nodes().size() != nodesCnt)
                 Thread.sleep(10);
         }

Reply via email to