ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: # ignite-648: jps logs and increase sleep
Date Wed, 01 Jul 2015 12:40:28 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-648-failover ad074f526 -> 3f5ca4c37


# ignite-648: jps logs and increase sleep


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

Branch: refs/heads/ignite-648-failover
Commit: 3f5ca4c375137620fd5c3906a4b772ec770794ee
Parents: ad074f5
Author: ashutak <ashutak@gridgain.com>
Authored: Wed Jul 1 15:41:15 2015 +0300
Committer: ashutak <ashutak@gridgain.com>
Committed: Wed Jul 1 15:41:15 2015 +0300

----------------------------------------------------------------------
 .../testframework/junits/GridAbstractTest.java  | 13 +----
 .../junits/multijvm/IgniteNodeRunner.java       | 53 +++++++++++---------
 .../IgniteCacheFailoverMJTestSuite.java         | 37 +++++++-------
 3 files changed, 51 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3f5ca4c3/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index d9818e5..c5412bd 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -791,20 +791,9 @@ public abstract class GridAbstractTest extends TestCase {
         for (Ignite g : srvs)
             stopGrid(g.name(), cancel);
 
-        if (isMultiJvm()) {
-//            IgniteProcessProxy.killAll(); // In multi jvm case.
-            try {
-                Thread.sleep(1_000);
-            }
-            catch (InterruptedException e) {
-                e.printStackTrace(); // TODO implement.
-            }
-
+        if (isMultiJvm())
             IgniteNodeRunner.killAll();
 
-            IgniteNodeRunner.jps();
-        }
-
         assert G.allGrids().isEmpty();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3f5ca4c3/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
index 1bbd2b2..24a6618 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteNodeRunner.java
@@ -125,9 +125,12 @@ public class IgniteNodeRunner {
      * Kill all Jvm runned by {#link IgniteNodeRunner}. Works based on jps command.
      *
      * @return List of killed process ids.
-     * @throws Exception If exception.
      */
     public static List<Integer> killAll() {
+        jps();
+
+        List<Integer> res = new ArrayList<>();
+
         try {
             // TODO delete logging.
             X.println(">>>>> IgniteNodeRunner.killAll");
@@ -136,56 +139,60 @@ public class IgniteNodeRunner {
 
             Set<Integer> jvms = monitoredHost.activeVms();
 
-            List<Integer> res = new ArrayList<>();
-
-            for (Integer jvmId : jvms) {
+            for (Integer pid : jvms) {
                 try {
-                    MonitoredVm vm = monitoredHost.getMonitoredVm(new VmIdentifier("//" +
jvmId + "?mode=r"), 0);
+                    MonitoredVm vm = monitoredHost.getMonitoredVm(new VmIdentifier("//" +
pid + "?mode=r"), 0);
 
                     if (IgniteNodeRunner.class.getName().equals(MonitoredVmUtil.mainClass(vm,
true))) {
                         Process killProc = U.isWindows() ?
-                            Runtime.getRuntime().exec(new String[] {"taskkill", "/pid", jvmId.toString(),
"/f", "/t"}) :
-                            Runtime.getRuntime().exec(new String[] {"kill", "-9", jvmId.toString()});
+                            Runtime.getRuntime().exec(new String[] {"taskkill", "/pid", pid.toString(),
"/f", "/t"}) :
+                            Runtime.getRuntime().exec(new String[] {"kill", "-9", pid.toString()});
 
                         killProc.waitFor();
 
-                        res.add(jvmId);
+                        res.add(pid);
+
+                        X.println(IgniteNodeRunner.class.getSimpleName() + " process was
killed: " + pid);
                     }
                 }
                 catch (Exception e) {
                     // Print stack trace just for information.
-                    X.printerrln("Could not kill IgniteNodeRunner java process. Jvm pid =
" + jvmId, e);
+                    X.printerrln("Could not kill " + IgniteNodeRunner.class.getSimpleName()
+ " java process. " +
+                        "Jvm pid = " + pid, e);
                 }
             }
-
-            return res;
         }
         catch (Exception e) {
             // Print stack trace just for information.
-            X.printerrln("Could not kill IgniteNodeRunner java processes.", e);
+            X.printerrln("Could not kill " + IgniteNodeRunner.class.getSimpleName() + " java
processes.", e);
+        }
 
-            return Collections.emptyList();
+        jps();
+
+        try {
+            Thread.sleep(15_000);
         }
+        catch (InterruptedException e) {
+            e.printStackTrace(); // TODO implement.
+        }
+
+        jps();
+
+        return res;
     }
 
     /**
-     * Kill all Jvm runned by {#link IgniteNodeRunner}. Works based on jps command.
-     *
-     * @return List of killed process ids.
-     * @throws Exception If exception.
+     * Jps.
      */
     // TODO delete this method.
     public static void jps() {
         try {
-            // TODO delete logging.
             X.println(">>>>> IgniteNodeRunner.jps");
 
             MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost(new HostIdentifier("localhost"));
 
             Set<Integer> jvms = monitoredHost.activeVms();
 
-            List<Integer> res = new ArrayList<>();
-
             for (Integer jvmId : jvms) {
                 try {
                     MonitoredVm vm = monitoredHost.getMonitoredVm(new VmIdentifier("//" +
jvmId + "?mode=r"), 0);
@@ -194,15 +201,15 @@ public class IgniteNodeRunner {
 
                     X.println(">>>>> " + jvmId + ' ' + name);
                 }
-                catch (Exception e) {
+                catch (Exception ignore) {
                     // Print stack trace just for information.
-                    X.printerrln(">>>>> Could not PRINT IgniteNodeRunner java
process. Jvm pid = " + jvmId, e);
+                    X.printerr(">>>>> " + jvmId + " Could not get process
information.");
                 }
             }
         }
         catch (Exception e) {
             // Print stack trace just for information.
-            X.printerrln(">>>>> Could not PRINT IgniteNodeRunner java processes.",
e);
+            X.printerrln(">>>>> Could not print java processes.", e);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3f5ca4c3/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverMJTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverMJTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverMJTestSuite.java
index 6ffaa8a..b6d60e7 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverMJTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFailoverMJTestSuite.java
@@ -18,7 +18,10 @@
 package org.apache.ignite.testsuites;
 
 import junit.framework.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
 import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.*;
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
+import org.apache.ignite.internal.processors.cache.distributed.replicated.*;
 
 /**
  * Test suite.
@@ -34,23 +37,23 @@ public class IgniteCacheFailoverMJTestSuite extends TestSuite {
         // Failure consistency tests.
         suite.addTestSuite(GridCacheAtomicRemoveFailureMJTest.class);
         suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderRemoveFailureMJTest.class);
-//        suite.addTestSuite(GridCacheAtomicClientRemoveFailureMJTest.class);
-//
-//        suite.addTestSuite(GridCacheDhtAtomicRemoveFailureMJTest.class);
-//        suite.addTestSuite(GridCacheDhtRemoveFailureMJTest.class);
-//        suite.addTestSuite(GridCacheDhtClientRemoveFailureMJTest.class);
-//        suite.addTestSuite(GridCacheNearRemoveFailureMJTest.class);
-//        suite.addTestSuite(GridCacheAtomicNearRemoveFailureMJTest.class);
-//        suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderNearRemoveFailureMJTest.class);
-//
-//        // From part 2
-//        suite.addTestSuite(GridCacheAtomicFailoverSelfMJTest.class);
-//        suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderFailoverSelfMJTest.class);
-//        suite.addTestSuite(GridCacheAtomicReplicatedFailoverSelfMJTest.class);
-//
-//        suite.addTestSuite(GridCachePartitionedFailoverSelfMJTest.class);
-//        suite.addTestSuite(GridCacheColocatedFailoverSelfMJTest.class);
-//        suite.addTestSuite(GridCacheReplicatedFailoverSelfMJTest.class);
+        suite.addTestSuite(GridCacheAtomicClientRemoveFailureMJTest.class);
+
+        suite.addTestSuite(GridCacheDhtAtomicRemoveFailureMJTest.class);
+        suite.addTestSuite(GridCacheDhtRemoveFailureMJTest.class);
+        suite.addTestSuite(GridCacheDhtClientRemoveFailureMJTest.class);
+        suite.addTestSuite(GridCacheNearRemoveFailureMJTest.class);
+        suite.addTestSuite(GridCacheAtomicNearRemoveFailureMJTest.class);
+        suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderNearRemoveFailureMJTest.class);
+
+        // From part 2
+        suite.addTestSuite(GridCacheAtomicFailoverSelfMJTest.class);
+        suite.addTestSuite(GridCacheAtomicPrimaryWriteOrderFailoverSelfMJTest.class);
+        suite.addTestSuite(GridCacheAtomicReplicatedFailoverSelfMJTest.class);
+
+        suite.addTestSuite(GridCachePartitionedFailoverSelfMJTest.class);
+        suite.addTestSuite(GridCacheColocatedFailoverSelfMJTest.class);
+        suite.addTestSuite(GridCacheReplicatedFailoverSelfMJTest.class);
 
         return suite;
     }


Mime
View raw message