IGNITE-10050 Fixed unmuted test

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

Branch: refs/heads/ignite-627
Commit: 664fb93da2cd753a92e4f70e7e06d40281d23e7e
Parents: 9dc6d08
Author: Alexey Goncharuk <alexey.goncha...@gmail.com>
Authored: Wed Dec 19 15:10:46 2018 +0300
Committer: Alexey Goncharuk <alexey.goncha...@gmail.com>
Committed: Wed Dec 19 15:11:07 2018 +0300

----------------------------------------------------------------------
 .../cache/ClusterStateAbstractTest.java         | 56 +++++++++++---------
 1 file changed, 30 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/664fb93d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ClusterStateAbstractTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ClusterStateAbstractTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ClusterStateAbstractTest.java
index 059c38c..fc8d2f2 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ClusterStateAbstractTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/ClusterStateAbstractTest.java
@@ -122,14 +122,14 @@ public abstract class ClusterStateAbstractTest extends 
GridCommonAbstractTest {
 
         forbidden.clear();
 
-        grid(0).active(true);
+        grid(0).cluster().active(true);
 
         IgniteCache<Object, Object> cache2 = grid(0).createCache(new 
CacheConfiguration<>("cache2"));
 
         for (int k = 0; k < ENTRY_CNT; k++)
             cache2.put(k, k);
 
-        grid(0).active(false);
+        grid(0).cluster().active(false);
 
         checkInactive(GRID_CNT);
 
@@ -152,7 +152,7 @@ public abstract class ClusterStateAbstractTest extends 
GridCommonAbstractTest {
 
         forbidden.clear();
 
-        grid(0).active(true);
+        grid(0).cluster().active(true);
 
         awaitPartitionMapExchange();
 
@@ -163,7 +163,7 @@ public abstract class ClusterStateAbstractTest extends 
GridCommonAbstractTest {
 
         for (int g = 0; g < GRID_CNT; g++) {
             // Tests that state changes are propagated to existing and new 
nodes.
-            assertTrue(grid(g).active());
+            assertTrue(grid(g).cluster().active());
 
             IgniteCache<Object, Object> cache0 = grid(g).cache(CACHE_NAME);
 
@@ -196,12 +196,12 @@ public abstract class ClusterStateAbstractTest extends 
GridCommonAbstractTest {
                 assertEquals(k,  cache0.get(k));
         }
 
-        grid(0).active(false);
+        grid(0).cluster().active(false);
 
         GridTestUtils.waitForCondition(new GridAbsPredicate() {
             @Override public boolean apply() {
                 for (int g = 0; g < GRID_CNT; g++) {
-                    if (grid(g).active())
+                    if (grid(g).cluster().active())
                         return false;
                 }
 
@@ -240,7 +240,7 @@ public abstract class ClusterStateAbstractTest extends 
GridCommonAbstractTest {
 
         forbidden.clear();
 
-        cl.active(true);
+        cl.cluster().active(true);
 
         awaitPartitionMapExchange();
 
@@ -251,7 +251,7 @@ public abstract class ClusterStateAbstractTest extends 
GridCommonAbstractTest {
 
         for (int g = 0; g < GRID_CNT + 1; g++) {
             // Tests that state changes are propagated to existing and new 
nodes.
-            assertTrue(grid(g).active());
+            assertTrue(grid(g).cluster().active());
 
             IgniteCache<Object, Object> cache0 = grid(g).cache(CACHE_NAME);
 
@@ -259,12 +259,12 @@ public abstract class ClusterStateAbstractTest extends 
GridCommonAbstractTest {
                 assertEquals(k,  cache0.get(k));
         }
 
-        cl.active(false);
+        cl.cluster().active(false);
 
         GridTestUtils.waitForCondition(new GridAbsPredicate() {
             @Override public boolean apply() {
                 for (int g = 0; g < GRID_CNT + 1; g++) {
-                    if (grid(g).active())
+                    if (grid(g).cluster().active())
                         return false;
                 }
 
@@ -288,16 +288,20 @@ public abstract class ClusterStateAbstractTest extends 
GridCommonAbstractTest {
 
         lock.lock();
 
-        GridTestUtils.assertThrowsAnyCause(log, new Callable<Object>() {
-            @Override public Object call() throws Exception {
-                grid(0).active(false);
-
-                return null;
-            }
-        }, IgniteException.class,
-            "Failed to deactivate cluster (must invoke the method outside of 
an active transaction or lock).");
+        try {
+            //noinspection ThrowableNotThrown
+            GridTestUtils.assertThrowsAnyCause(log, new Callable<Object>() {
+                @Override public Object call() {
+                    grid(0).cluster().active(false);
 
-        lock.unlock();
+                    return null;
+                }
+            }, IgniteException.class,
+                "Failed to deactivate cluster (must invoke the method outside 
of an active transaction).");
+        }
+        finally {
+            lock.unlock();
+        }
     }
 
     /**
@@ -316,25 +320,25 @@ public abstract class ClusterStateAbstractTest extends 
GridCommonAbstractTest {
     }
 
     /**
-     * @throws Exception if failed.
      */
     private void deactivateWithPendingTransaction(TransactionConcurrency 
concurrency,
-        TransactionIsolation isolation) throws Exception {
+        TransactionIsolation isolation) {
         final Ignite ignite0 = grid(0);
 
         final IgniteCache<Object, Object> cache0 = ignite0.cache(CACHE_NAME);
 
-        try (Transaction tx = ignite0.transactions().txStart(concurrency, 
isolation)) {
+        try (Transaction ignore = ignite0.transactions().txStart(concurrency, 
isolation)) {
             cache0.put(1, "1");
 
+            //noinspection ThrowableNotThrown
             GridTestUtils.assertThrowsAnyCause(log, new Callable<Object>() {
-                @Override public Object call() throws Exception {
-                    grid(0).active(false);
+                @Override public Object call() {
+                    grid(0).cluster().active(false);
 
                     return null;
                 }
             }, IgniteException.class,
-                "Failed to deactivate cluster (must invoke the method outside 
of an active transaction or lock).");
+                "Failed to deactivate cluster (must invoke the method outside 
of an active transaction).");
         }
 
         assertNull(cache0.get(1));
@@ -346,7 +350,7 @@ public abstract class ClusterStateAbstractTest extends 
GridCommonAbstractTest {
      */
     private void checkInactive(int cnt) {
         for (int g = 0; g < cnt; g++)
-            assertFalse(grid(g).active());
+            assertFalse(grid(g).cluster().active());
     }
 
     /**

Reply via email to