ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [50/50] [abbrv] ignite git commit: ignite-4929
Date Wed, 19 Apr 2017 08:46:31 GMT
ignite-4929


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

Branch: refs/heads/ignite-4929
Commit: c31405a0540ce4d75d2de98a2745e0572c69ccd0
Parents: 89ece2e
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Apr 19 11:41:55 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed Apr 19 11:41:55 2017 +0300

----------------------------------------------------------------------
 .../cache/IgniteOnePhaseCommitInvokeTest.java   |  2 +
 .../IgniteCachePutRetryAbstractSelfTest.java    | 25 +--------
 ...gniteCachePutRetryTransactionalSelfTest.java |  2 +-
 .../testframework/junits/GridAbstractTest.java  |  5 +-
 .../junits/common/GridCommonAbstractTest.java   | 57 ++++++++++++++++++++
 5 files changed, 64 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c31405a0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitInvokeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitInvokeTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitInvokeTest.java
index aab1d3d..601c067 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitInvokeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitInvokeTest.java
@@ -177,6 +177,8 @@ public class IgniteOnePhaseCommitInvokeTest extends GridCommonAbstractTest
{
 
             checkCacheData(F.asMap(1, expVal), CACHE_NAME);
         }
+
+        checkOnePhaseCommitReturnValuesCleaned(-1);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/c31405a0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
index ca55a47..abec33c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
@@ -443,13 +443,13 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
     private void checkInternalCleanup() throws Exception{
         checkNoAtomicFutures();
 
-        checkOnePhaseCommitReturnValuesCleaned();
+        checkOnePhaseCommitReturnValuesCleaned(GRID_CNT);
     }
 
     /**
      * @throws Exception If failed.
      */
-    void checkNoAtomicFutures() throws Exception {
+    private void checkNoAtomicFutures() throws Exception {
         for (int i = 0; i < GRID_CNT; i++) {
             final IgniteKernal ignite = (IgniteKernal)grid(i);
 
@@ -468,27 +468,6 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
     /**
      * @throws Exception If failed.
      */
-    void checkOnePhaseCommitReturnValuesCleaned() throws Exception {
-        U.sleep(DEFERRED_ONE_PHASE_COMMIT_ACK_REQUEST_TIMEOUT);
-
-        for (int i = 0; i < GRID_CNT; i++) {
-            IgniteKernal ignite = (IgniteKernal)grid(i);
-
-            IgniteTxManager tm = ignite.context().cache().context().tm();
-
-            Map completedVersHashMap = U.field(tm, "completedVersHashMap");
-
-            for (Object o : completedVersHashMap.values()) {
-                assertTrue("completedVersHashMap contains" + o.getClass() + " instead of
boolean. " +
-                    "These values should be replaced by boolean after onePhaseCommit finished.
" +
-                    "[node=" + i + "]", o instanceof Boolean);
-            }
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
     public void testFailsWithNoRetries() throws Exception {
         checkFailsWithNoRetries(false);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c31405a0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryTransactionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryTransactionalSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryTransactionalSelfTest.java
index b439bcc..8e4b3a4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryTransactionalSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryTransactionalSelfTest.java
@@ -260,7 +260,7 @@ public class IgniteCachePutRetryTransactionalSelfTest extends IgniteCachePutRetr
             fut2.get();
         }
 
-        checkOnePhaseCommitReturnValuesCleaned();
+        checkOnePhaseCommitReturnValuesCleaned(GRID_CNT);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/c31405a0/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 8d8a873..8a7150d 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
@@ -2024,10 +2024,9 @@ public abstract class GridAbstractTest extends TestCase {
     }
 
     /**
-     *
-     * @throws IgniteInterruptedCheckedException
+     * @throws IgniteInterruptedCheckedException If interrupted.
      */
-    public void awaitTopologyChange() throws IgniteInterruptedCheckedException {
+    private void awaitTopologyChange() throws IgniteInterruptedCheckedException {
         for (Ignite g : G.allGrids()) {
             final GridKernalContext ctx = ((IgniteKernal)g).context();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c31405a0/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index e6383b4..a2be286 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -80,7 +80,9 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.Gri
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
 import org.apache.ignite.internal.processors.cache.local.GridLocalCache;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager;
 import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.G;
 import org.apache.ignite.internal.util.typedef.PA;
@@ -1565,4 +1567,59 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest
{
             }
         }
     }
+
+    /**
+     * @param nodesCnt Expected nodes number or {@code -1} to use all nodes.
+     * @throws Exception If failed.
+     */
+    protected final void checkOnePhaseCommitReturnValuesCleaned(final int nodesCnt) throws
Exception {
+        final List<Ignite> nodes;
+
+        if (nodesCnt == -1) {
+            nodes = G.allGrids();
+
+            assertTrue(nodes.size() > 0);
+        }
+        else {
+            nodes = new ArrayList<>(nodesCnt);
+
+            for (int i = 0; i < nodesCnt; i++)
+                nodes.add(grid(i));
+        }
+
+        GridTestUtils.waitForCondition(new GridAbsPredicate() {
+            @Override public boolean apply() {
+                for (Ignite node : nodes) {
+                    Map completedVersHashMap = completedTxsMap(node);
+
+                    for (Object o : completedVersHashMap.values()) {
+                        if (!(o instanceof Boolean))
+                            return false;
+                    }
+                }
+
+                return true;
+            }
+        }, 5000);
+
+        for (Ignite node : nodes) {
+            Map completedVersHashMap = completedTxsMap(node);
+
+            for (Object o : completedVersHashMap.values()) {
+                assertTrue("completedVersHashMap contains " + o.getClass().getName() + "
instead of boolean. " +
+                    "These values should be replaced by boolean after onePhaseCommit finished.
" +
+                    "[node=" + node.name() + "]", o instanceof Boolean);
+            }
+        }
+    }
+
+    /**
+     * @param ignite Node.
+     * @return Completed txs map.
+     */
+    private Map completedTxsMap(Ignite ignite) {
+        IgniteTxManager tm = ((IgniteKernal)ignite).context().cache().context().tm();
+
+        return U.field(tm, "completedVersHashMap");
+    }
 }


Mime
View raw message