You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2015/09/15 01:12:51 UTC

[10/41] ignite git commit: ignite-1028 (cherry picked from commit e4d7ae0)

ignite-1028
(cherry picked from commit e4d7ae0)


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

Branch: refs/heads/ignite-1400
Commit: 82ca43176610ff543102b049c26a9f79add098ef
Parents: 70ad5ba
Author: Anton Vinogradov <av...@apache.org>
Authored: Fri Sep 11 13:51:22 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Fri Sep 11 14:02:31 2015 +0300

----------------------------------------------------------------------
 .../cache/GridCacheP2PUndeploySelfTest.java     | 26 ++++++++++++--------
 1 file changed, 16 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/82ca4317/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java
index 2c8c748..92c5340 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheP2PUndeploySelfTest.java
@@ -28,6 +28,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.processors.cache.distributed.GridCacheModuloAffinityFunction;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -36,6 +37,7 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi;
+import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -201,7 +203,7 @@ public class GridCacheP2PUndeploySelfTest extends GridCommonAbstractTest {
      * @param cacheName Cache name.
      * @throws Exception If failed.
      */
-    private void checkP2PUndeploy(String cacheName) throws Exception {
+    private void checkP2PUndeploy(final String cacheName) throws Exception {
         assert !F.isEmpty(cacheName);
 
         ClassLoader ldr = getExternalClassLoader();
@@ -210,7 +212,7 @@ public class GridCacheP2PUndeploySelfTest extends GridCommonAbstractTest {
 
         try {
             Ignite ignite1 = startGrid(1);
-            IgniteKernal grid2 = (IgniteKernal)startGrid(2);
+            final IgniteKernal grid2 = (IgniteKernal)startGrid(2);
 
             IgniteCache<Integer, Object> cache1 = ignite1.cache(cacheName);
             IgniteCache<Integer, Object> cache2 = grid2.cache(cacheName);
@@ -237,20 +239,24 @@ public class GridCacheP2PUndeploySelfTest extends GridCommonAbstractTest {
 
             cache2.localEvict(ImmutableSet.of(2, 3, 4));
 
-            U.sleep(100); //Time to store entries to disk.
-
-            long swapSize = size(cacheName, grid2);
-
-            info("Swap size: " + swapSize);
-
-            assert swapSize > 0;
+            //Wait until entries stored to disk.
+            GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                @Override public boolean apply() {
+                    try {
+                        return size(cacheName, grid2) > 0;
+                    }
+                    catch (IgniteCheckedException e) {
+                        throw new AssertionError(e);
+                    }
+                }
+            }, 5000);
 
             stopGrid(1);
 
             assert waitCacheEmpty(cache2, 10000);
 
             for (int i = 0; i < 3; i++) {
-                swapSize = size(cacheName, grid2);
+                long swapSize = size(cacheName, grid2);
 
                 if (swapSize > 0) {
                     if (i < 2) {