Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 17E761834E for ; Mon, 14 Sep 2015 09:11:11 +0000 (UTC) Received: (qmail 91334 invoked by uid 500); 14 Sep 2015 09:11:11 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 91256 invoked by uid 500); 14 Sep 2015 09:11:11 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 91077 invoked by uid 99); 14 Sep 2015 09:11:10 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Sep 2015 09:11:10 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id ADE1ADFF72; Mon, 14 Sep 2015 09:11:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.apache.org Date: Mon, 14 Sep 2015 09:11:24 -0000 Message-Id: <7d0fcafd5b7d4745bedeec11fc15814b@git.apache.org> In-Reply-To: <93660438cc884caa8c543c487ce83d04@git.apache.org> References: <93660438cc884caa8c543c487ce83d04@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [15/28] 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-971 Commit: 82ca43176610ff543102b049c26a9f79add098ef Parents: 70ad5ba Author: Anton Vinogradov Authored: Fri Sep 11 13:51:22 2015 +0300 Committer: Anton Vinogradov 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 cache1 = ignite1.cache(cacheName); IgniteCache 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) {