ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [7/8] incubator-ignite git commit: # ignite-648: fix tests
Date Thu, 02 Jul 2015 17:40:56 GMT
# ignite-648: fix 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/f53094f4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f53094f4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f53094f4

Branch: refs/heads/ignite-648-failover
Commit: f53094f454ef33b584969fc911d2cdc4e9ebc6a0
Parents: 37fca3b
Author: ashutak <ashutak@gridgain.com>
Authored: Thu Jul 2 20:27:24 2015 +0300
Committer: ashutak <ashutak@gridgain.com>
Committed: Thu Jul 2 20:27:24 2015 +0300

----------------------------------------------------------------------
 ...eAtomicNearOnlyMultiNodeFullApiSelfTest.java |  3 ++
 .../near/GridCacheNearTxMultiNodeSelfTest.java  | 13 +++---
 .../testframework/junits/GridAbstractTest.java  | 44 ++++++++++++--------
 .../junits/multijvm/IgniteProcessProxy.java     | 18 ++++++++
 4 files changed, 56 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f53094f4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
index ac93adb..20146b8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
@@ -114,6 +114,9 @@ public class GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest extends GridCacheNe
 
     /** {@inheritDoc} */
     @Override public void testEvictExpired() throws Exception {
+        if (isMultiJvm())
+            fail("https://issues.apache.org/jira/browse/IGNITE-648");
+
         IgniteCache<String, Integer> cache = jcache();
 
         String key = primaryKeysForCache(cache, 1).get(0);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f53094f4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java
index ef0ab48..e39a2ef 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java
@@ -88,6 +88,9 @@ public class GridCacheNearTxMultiNodeSelfTest extends GridCommonAbstractTest
{
      */
     @SuppressWarnings( {"unchecked"})
     public void testTxCleanup() throws Exception {
+        if (isMultiJvm())
+            fail("https://issues.apache.org/jira/browse/IGNITE-648");
+
         backups = 1;
 
         Ignite ignite = startGrids(GRID_CNT);
@@ -104,9 +107,9 @@ public class GridCacheNearTxMultiNodeSelfTest extends GridCommonAbstractTest
{
             assert backupNode != otherNode;
             assert priNode != otherNode;
 
-            Ignite priIgnite = G.ignite(priNode.id());
-            Ignite backupIgnite = G.ignite(backupNode.id());
-            Ignite otherIgnite = G.ignite(otherNode.id());
+            final Ignite priIgnite = grid(priNode);
+            Ignite backupIgnite = grid(backupNode);
+            Ignite otherIgnite = grid(otherNode);
 
             List<Ignite> ignites = F.asList(otherIgnite, priIgnite, backupIgnite);
 
@@ -152,8 +155,8 @@ public class GridCacheNearTxMultiNodeSelfTest extends GridCommonAbstractTest
{
                 tx.close();
             }
 
-            G.stop(priIgnite.name(), true);
-            G.stop(backupIgnite.name(), true);
+            stopGrid(priIgnite.name(), true);
+            stopGrid(backupIgnite.name(), true);
 
             Ignite newIgnite = startGrid(GRID_CNT);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f53094f4/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 2a48fe6..732af54 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
@@ -572,6 +572,9 @@ public abstract class GridAbstractTest extends TestCase {
      * @throws Exception If failed.
      */
     protected final Ignite startGridsMultiThreaded(int init, int cnt) throws Exception {
+        if (isMultiJvm())
+            fail("https://issues.apache.org/jira/browse/IGNITE-648");
+
         assert init >= 0;
         assert cnt > 0;
 
@@ -746,13 +749,16 @@ public abstract class GridAbstractTest extends TestCase {
     @SuppressWarnings({"deprecation"})
     protected void stopGrid(@Nullable String gridName, boolean cancel) {
         try {
-            Ignite ignite = G.ignite(gridName);
+            Ignite ignite = grid(gridName);
 
             assert ignite != null : "Ignite returned null grid for name: " + gridName;
 
             info(">>> Stopping grid [name=" + ignite.name() + ", id=" + ignite.cluster().localNode().id()
+ ']');
 
-            G.stop(gridName, cancel);
+            if (!isMultiJvmAndNodeIsRemote(gridName))
+                G.stop(gridName, cancel);
+            else
+                IgniteProcessProxy.stop(gridName, cancel);
         }
         catch (IllegalStateException ignored) {
             // Ignore error if grid already stopped.
@@ -775,25 +781,29 @@ public abstract class GridAbstractTest extends TestCase {
      * @param cancel Cancel flag.
      */
     protected void stopAllGrids(boolean cancel) {
-        IgniteProcessProxy.killAll(); // In multi jvm case.
-
-        Collection<Ignite> clients = new ArrayList<>();
-        Collection<Ignite> srvs = new ArrayList<>();
+        try {
+            Collection<Ignite> clients = new ArrayList<>();
+            Collection<Ignite> srvs = new ArrayList<>();
+
+            for (Ignite g : G.allGrids()) {
+                if (g.configuration().getDiscoverySpi().isClientMode())
+                    clients.add(g);
+                else
+                    srvs.add(g);
+            }
 
-        for (Ignite g : G.allGrids()) {
-            if (g.configuration().getDiscoverySpi().isClientMode())
-                clients.add(g);
-            else
-                srvs.add(g);
-        }
+            for (Ignite g : clients)
+                stopGrid(g.name(), cancel);
 
-        for (Ignite g : clients)
-            stopGrid(g.name(), cancel);
+            for (Ignite g : srvs)
+                stopGrid(g.name(), cancel);
 
-        for (Ignite g : srvs)
-            stopGrid(g.name(), cancel);
+            assert G.allGrids().isEmpty();
+        }
+        finally {
+            IgniteProcessProxy.killAll(); // In multi jvm case.
+        }
 
-        assert G.allGrids().isEmpty();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f53094f4/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
index 7c1769a..7ac652a 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
@@ -151,6 +151,24 @@ public class IgniteProcessProxy implements IgniteEx {
     }
 
     /**
+     * @param gridName Grid name.
+     * @param cancel Cacnel flag.
+     */
+    public static void stop(final String gridName, final boolean cancel) {
+        IgniteProcessProxy proxy = gridProxies.get(gridName);
+
+        if (proxy != null) {
+            proxy.remoteCompute().run(new IgniteRunnable() {
+                @Override public void run() {
+                    G.stop(gridName, cancel);
+                }
+            });
+
+            gridProxies.remove(gridName, proxy);
+        }
+    }
+
+    /**
      * For usage in closures.
      *
      * @return Ignite instance.


Mime
View raw message