Repository: ignite
Updated Branches:
  refs/heads/ignite-1758 af2b46cf6 -> 74793b123


ignite-1758 debug


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

Branch: refs/heads/ignite-1758
Commit: 74793b12392f4ec51467ebe26d6b93522518e793
Parents: af2b46c
Author: sboikov <sboi...@gridgain.com>
Authored: Wed Nov 4 14:49:06 2015 +0300
Committer: sboikov <sboi...@gridgain.com>
Committed: Wed Nov 4 14:49:06 2015 +0300

----------------------------------------------------------------------
 .../tcp/TcpDiscoveryMultiThreadedTest.java      | 148 +++++++++++--------
 .../ignite/testsuites/IgniteSpiTestSuite.java   |  33 +----
 2 files changed, 88 insertions(+), 93 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/74793b12/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
index 55474dc..a6fd9a1 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
@@ -161,7 +161,7 @@ public class TcpDiscoveryMultiThreadedTest extends 
GridCommonAbstractTest {
     /**
      * @throws Exception If any error occurs.
      */
-    public void testMultiThreadedClientsRestart() throws Exception {
+    public void _testMultiThreadedClientsRestart() throws Exception {
         final AtomicBoolean done = new AtomicBoolean();
 
         try {
@@ -209,9 +209,25 @@ public class TcpDiscoveryMultiThreadedTest extends 
GridCommonAbstractTest {
     /**
      * @throws Exception If any error occurs.
      */
-    public void testMultiThreadedClientsServersRestart() throws Throwable {
+    public void _testMultiThreadedClientsServersRestart() throws Throwable {
         fail("https://issues.apache.org/jira/browse/IGNITE-1123";);
 
+        multiThreadedClientsServersRestart(GRID_CNT, CLIENT_GRID_CNT);
+    }
+
+    /**
+     * @throws Exception If any error occurs.
+     */
+    public void testMultiThreadedServersRestart() throws Throwable {
+        multiThreadedClientsServersRestart(GRID_CNT * 2, 0);
+    }
+
+    /**
+     * @param srvs Number of servers.
+     * @param clients Number of clients.
+     * @throws Exception If any error occurs.
+     */
+    private void multiThreadedClientsServersRestart(int srvs, int clients) 
throws Throwable {
         final AtomicBoolean done = new AtomicBoolean();
 
         try {
@@ -219,91 +235,95 @@ public class TcpDiscoveryMultiThreadedTest extends 
GridCommonAbstractTest {
 
             info("Test timeout: " + (getTestTimeout() / (60 * 1000)) + " 
min.");
 
-            startGridsMultiThreaded(GRID_CNT);
+            startGridsMultiThreaded(srvs);
 
-            clientFlagGlobal = true;
-
-            startGridsMultiThreaded(GRID_CNT, CLIENT_GRID_CNT);
+            IgniteInternalFuture<?> clientFut = null;
 
             final AtomicReference<Throwable> error = new AtomicReference<>();
 
-            final BlockingQueue<Integer> clientStopIdxs = new 
LinkedBlockingQueue<>();
+            if (clients > 0) {
+                clientFlagGlobal = true;
 
-            for (int i = GRID_CNT; i < GRID_CNT + CLIENT_GRID_CNT; i++)
-                clientStopIdxs.add(i);
+                startGridsMultiThreaded(srvs, clients);
 
-            final AtomicInteger clientStartIdx = new AtomicInteger(9000);
-
-            IgniteInternalFuture<?> fut1 = multithreadedAsync(
-                new Callable<Object>() {
-                    @Override public Object call() throws Exception {
-                        try {
-                            clientFlagPerThread.set(true);
+                final BlockingQueue<Integer> clientStopIdxs = new 
LinkedBlockingQueue<>();
 
-                            while (!done.get() && error.get() == null) {
-                                Integer stopIdx = clientStopIdxs.take();
+                for (int i = srvs; i < srvs + clients; i++)
+                    clientStopIdxs.add(i);
 
-                                log.info("Stop client: " + stopIdx);
+                final AtomicInteger clientStartIdx = new AtomicInteger(9000);
 
-                                stopGrid(stopIdx);
+                clientFut = multithreadedAsync(
+                    new Callable<Object>() {
+                        @Override public Object call() throws Exception {
+                            try {
+                                clientFlagPerThread.set(true);
 
                                 while (!done.get() && error.get() == null) {
-                                    // Generate unique name to simplify 
debugging.
-                                    int startIdx = 
clientStartIdx.getAndIncrement();
+                                    Integer stopIdx = clientStopIdxs.take();
 
-                                    log.info("Start client: " + startIdx);
+                                    log.info("Stop client: " + stopIdx);
 
-                                    UUID id = UUID.randomUUID();
+                                    stopGrid(stopIdx);
 
-                                    nodeId.set(id);
+                                    while (!done.get() && error.get() == null) 
{
+                                        // Generate unique name to simplify 
debugging.
+                                        int startIdx = 
clientStartIdx.getAndIncrement();
 
-                                    try {
-                                        Ignite ignite = startGrid(startIdx);
+                                        log.info("Start client: " + startIdx);
 
-                                        
assertTrue(ignite.configuration().isClientMode());
+                                        UUID id = UUID.randomUUID();
 
-                                        clientStopIdxs.add(startIdx);
+                                        nodeId.set(id);
 
-                                        break;
-                                    }
-                                    catch (Exception e) {
-                                        if (X.hasCause(e, 
IgniteClientDisconnectedCheckedException.class) ||
-                                            X.hasCause(e, 
IgniteClientDisconnectedException.class))
-                                            log.info("Client disconnected: " + 
e);
-                                        else if (X.hasCause(e, 
ClusterTopologyCheckedException.class))
-                                            log.info("Client failed to start: 
" + e);
-                                        else {
-                                            if (failedNodes.contains(id) && 
X.hasCause(e, IgniteSpiException.class))
-                                                log.info("Client failed: " + 
e);
-                                            else
-                                                throw e;
+                                        try {
+                                            Ignite ignite = 
startGrid(startIdx);
+
+                                            
assertTrue(ignite.configuration().isClientMode());
+
+                                            clientStopIdxs.add(startIdx);
+
+                                            break;
+                                        }
+                                        catch (Exception e) {
+                                            if (X.hasCause(e, 
IgniteClientDisconnectedCheckedException.class) ||
+                                                X.hasCause(e, 
IgniteClientDisconnectedException.class))
+                                                log.info("Client disconnected: 
" + e);
+                                            else if (X.hasCause(e, 
ClusterTopologyCheckedException.class))
+                                                log.info("Client failed to 
start: " + e);
+                                            else {
+                                                if (failedNodes.contains(id) 
&& X.hasCause(e, IgniteSpiException.class))
+                                                    log.info("Client failed: " 
+ e);
+                                                else
+                                                    throw e;
+                                            }
                                         }
                                     }
                                 }
                             }
-                        }
-                        catch (Throwable e) {
-                            log.error("Unexpected error: " + e, e);
+                            catch (Throwable e) {
+                                log.error("Unexpected error: " + e, e);
 
-                            error.compareAndSet(null, e);
+                                error.compareAndSet(null, e);
+
+                                return null;
+                            }
 
                             return null;
                         }
-
-                        return null;
-                    }
-                },
-                CLIENT_GRID_CNT,
-                "client-restart");
+                    },
+                    clients,
+                    "client-restart");
+            }
 
             final BlockingQueue<Integer> srvStopIdxs = new 
LinkedBlockingQueue<>();
 
-            for (int i = 0; i < GRID_CNT; i++)
+            for (int i = 0; i < srvs; i++)
                 srvStopIdxs.add(i);
 
-            final AtomicInteger srvStartIdx = new AtomicInteger(GRID_CNT + 
CLIENT_GRID_CNT);
+            final AtomicInteger srvStartIdx = new AtomicInteger(srvs + 
clients);
 
-            IgniteInternalFuture<?> fut2 = multithreadedAsync(
+            IgniteInternalFuture<?> srvFut = multithreadedAsync(
                 new Callable<Object>() {
                     @Override public Object call() throws Exception {
                         try {
@@ -339,7 +359,7 @@ public class TcpDiscoveryMultiThreadedTest extends 
GridCommonAbstractTest {
                         return null;
                     }
                 },
-                GRID_CNT - 1,
+                srvs - 1,
                 "server-restart");
 
             final long timeToExec = getTestTimeout() - 60_000;
@@ -356,8 +376,10 @@ public class TcpDiscoveryMultiThreadedTest extends 
GridCommonAbstractTest {
 
                     done.set(true);
 
-                    fut1.cancel();
-                    fut2.cancel();
+                    if (clientFut != null)
+                        clientFut.cancel();
+
+                    srvFut.cancel();
 
                     throw err;
                 }
@@ -367,8 +389,10 @@ public class TcpDiscoveryMultiThreadedTest extends 
GridCommonAbstractTest {
 
             done.set(true);
 
-            fut1.get();
-            fut2.get();
+            if (clientFut != null)
+                clientFut.get();
+
+            srvFut.get();
         }
         finally {
             done.set(true);
@@ -378,7 +402,7 @@ public class TcpDiscoveryMultiThreadedTest extends 
GridCommonAbstractTest {
     /**
      * @throws Exception If any error occurs.
      */
-    public void testTopologyVersion() throws Exception {
+    public void _testTopologyVersion() throws Exception {
         clientFlagGlobal = false;
 
         startGridsMultiThreaded(GRID_CNT);
@@ -402,7 +426,7 @@ public class TcpDiscoveryMultiThreadedTest extends 
GridCommonAbstractTest {
     /**
      * @throws Exception If any error occurs.
      */
-    public void testMultipleStartOnCoordinatorStop() throws Exception{
+    public void _testMultipleStartOnCoordinatorStop() throws Exception{
         for (int k = 0; k < 3; k++) {
             log.info("Iteration: " + k);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/74793b12/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiTestSuite.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiTestSuite.java
 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiTestSuite.java
index fc4023a..02c32ec 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiTestSuite.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiTestSuite.java
@@ -19,6 +19,7 @@ package org.apache.ignite.testsuites;
 
 import junit.framework.TestSuite;
 import org.apache.ignite.internal.managers.GridNoopManagerSelfTest;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoveryMultiThreadedTest;
 
 /**
  * Grid SPI test suite.
@@ -31,38 +32,8 @@ public class IgniteSpiTestSuite extends TestSuite {
     public static TestSuite suite() throws Exception {
         TestSuite suite = new TestSuite("Ignite SPIs Test Suite");
 
-        // Failover.
-        suite.addTest(IgniteSpiFailoverSelfTestSuite.suite());
 
-        // Collision.
-        suite.addTest(IgniteSpiCollisionSelfTestSuite.suite());
-
-        // Event storage.
-        suite.addTest(IgniteSpiEventStorageSelfTestSuite.suite());
-
-        // Load Balancing.
-        suite.addTest(IgniteSpiLoadBalancingSelfTestSuite.suite());
-
-        // Swap space.
-        suite.addTest(IgniteSpiSwapSpaceSelfTestSuite.suite());
-
-        // Checkpoints.
-        suite.addTest(IgniteSpiCheckpointSelfTestSuite.suite());
-
-        // Deployment
-        suite.addTest(IgniteSpiDeploymentSelfTestSuite.suite());
-
-        // Discovery.
-        suite.addTest(IgniteSpiDiscoverySelfTestSuite.suite());
-
-        // Communication.
-        suite.addTest(IgniteSpiCommunicationSelfTestSuite.suite());
-
-        // Indexing.
-        suite.addTest(IgniteSpiIndexingSelfTestSuite.suite());
-
-        // All other tests.
-        suite.addTestSuite(GridNoopManagerSelfTest.class);
+        suite.addTest(new TestSuite(TcpDiscoveryMultiThreadedTest.class));
 
         return suite;
     }

Reply via email to