Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 20DCA200C1E for ; Thu, 12 Jan 2017 09:01:30 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 1FBB0160B4C; Thu, 12 Jan 2017 08:01:30 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1A2AE160B56 for ; Thu, 12 Jan 2017 09:01:28 +0100 (CET) Received: (qmail 47837 invoked by uid 500); 12 Jan 2017 08:01:28 -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 47286 invoked by uid 99); 12 Jan 2017 08:01:28 -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; Thu, 12 Jan 2017 08:01:28 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D6652E0165; Thu, 12 Jan 2017 08:01:27 +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: Thu, 12 Jan 2017 08:01:45 -0000 Message-Id: <448167ab751c4cfeadae9f4f62009ead@git.apache.org> In-Reply-To: <9025058b02e745d39e6cc0a83fb992d9@git.apache.org> References: <9025058b02e745d39e6cc0a83fb992d9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [19/24] ignite git commit: ignite-gg-8.0.2.ea2 ClusterStateAbstractTest fix test archived-at: Thu, 12 Jan 2017 08:01:30 -0000 ignite-gg-8.0.2.ea2 ClusterStateAbstractTest fix test Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6c6cbd32 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6c6cbd32 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6c6cbd32 Branch: refs/heads/ignite-gg-11810 Commit: 6c6cbd327d67c05278a3617a0cfc4b0f90e0bffc Parents: f5fd34e Author: Dmitriy Govorukhin Authored: Wed Jan 11 11:23:33 2017 +0300 Committer: Dmitriy Govorukhin Committed: Wed Jan 11 11:23:33 2017 +0300 ---------------------------------------------------------------------- .../cluster/GridClusterStateProcessor.java | 6 ++- .../cache/ClusterStateAbstractTest.java | 45 ++++++++++---------- .../internal/websession/WebSessionSelfTest.java | 4 ++ 3 files changed, 30 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/6c6cbd32/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java index d60243b..fa6910d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java @@ -449,12 +449,14 @@ public class GridClusterStateProcessor extends GridProcessorAdapter { for (CacheConfiguration cfg : cfgs) { if (CU.isSystemCache(cfg.getName())) - sharedCtx.pageStore().initializeForCache(cfg); + if (sharedCtx.pageStore() != null) + sharedCtx.pageStore().initializeForCache(cfg); } for (CacheConfiguration cfg : cfgs) { if (!CU.isSystemCache(cfg.getName())) - sharedCtx.pageStore().initializeForCache(cfg); + if (sharedCtx.pageStore() != null) + sharedCtx.pageStore().initializeForCache(cfg); } sharedCtx.database().onActivate(ctx); http://git-wip-us.apache.org/repos/asf/ignite/blob/6c6cbd32/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 7969426..a454270 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 @@ -19,11 +19,10 @@ package org.apache.ignite.internal.processors.cache; import java.util.Collection; -import java.util.concurrent.Callable; +import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.Lock; -import javax.cache.CacheException; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteException; @@ -120,20 +119,20 @@ public abstract class ClusterStateAbstractTest extends GridCommonAbstractTest { startGrids(GRID_CNT); - IgniteCache cache2 = grid(0).createCache(new CacheConfiguration<>("cache2")); - - checkInactive("cache2", GRID_CNT); + checkInactive(GRID_CNT); forbidden.clear(); grid(0).active(true); + IgniteCache cache2 = grid(0).createCache(new CacheConfiguration<>("cache2")); + for (int k = 0; k < ENTRY_CNT; k++) cache2.put(k, k); grid(0).active(false); - checkInactive("cache2", GRID_CNT); + checkInactive(GRID_CNT); stopAllGrids(); } @@ -281,8 +280,12 @@ public abstract class ClusterStateAbstractTest extends GridCommonAbstractTest { * @throws Exception If fails. */ public void testDeactivationWithPendingLock() throws Exception { + fail("Safe way for deactivate cluster must be implemented."); + startGrids(GRID_CNT); + final CountDownLatch finishedLatch = new CountDownLatch(1); + Lock lock = grid(0).cache(CACHE_NAME).lock(1); IgniteInternalFuture fut; @@ -293,6 +296,8 @@ public abstract class ClusterStateAbstractTest extends GridCommonAbstractTest { fut = multithreadedAsync(new Runnable() { @Override public void run() { grid(1).active(false); + + finishedLatch.countDown(); } }, 1); @@ -322,6 +327,8 @@ public abstract class ClusterStateAbstractTest extends GridCommonAbstractTest { fut.get(getTestTimeout(), TimeUnit.MILLISECONDS); checkInactive(GRID_CNT); + + finishedLatch.await(); } /** @@ -330,8 +337,12 @@ public abstract class ClusterStateAbstractTest extends GridCommonAbstractTest { * @throws Exception If fails. */ public void testDeactivationWithPendingTransaction() throws Exception { + fail("Safe way for deactivate cluster must be implemented."); + startGrids(GRID_CNT); + final CountDownLatch finishedLatch = new CountDownLatch(1); + final Ignite ignite0 = grid(0); final IgniteCache cache0 = ignite0.cache(CACHE_NAME); @@ -344,6 +355,8 @@ public abstract class ClusterStateAbstractTest extends GridCommonAbstractTest { fut = multithreadedAsync(new Runnable() { @Override public void run() { ignite0.active(false); + + finishedLatch.countDown(); } }, 1); @@ -379,30 +392,16 @@ public abstract class ClusterStateAbstractTest extends GridCommonAbstractTest { for (int g = 0; g < GRID_CNT; g++) assertEquals(2, grid(g).cache(CACHE_NAME).get(1)); - } - /** - * - */ - private void checkInactive(int cnt) { - checkInactive(CACHE_NAME, cnt); + finishedLatch.await(); } /** * */ - private void checkInactive(String cacheName, int cnt) { - for (int g = 0; g < cnt; g++) { + private void checkInactive(int cnt) { + for (int g = 0; g < cnt; g++) assertFalse(grid(g).active()); - - final IgniteCache cache0 = grid(g).cache(cacheName); - - GridTestUtils.assertThrows(log, new Callable() { - @Override public Object call() throws Exception { - return cache0.get("testKey"); - } - }, CacheException.class, null); - } } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/6c6cbd32/modules/web/src/test/java/org/apache/ignite/internal/websession/WebSessionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/web/src/test/java/org/apache/ignite/internal/websession/WebSessionSelfTest.java b/modules/web/src/test/java/org/apache/ignite/internal/websession/WebSessionSelfTest.java index bfa12a2..67eedcf 100644 --- a/modules/web/src/test/java/org/apache/ignite/internal/websession/WebSessionSelfTest.java +++ b/modules/web/src/test/java/org/apache/ignite/internal/websession/WebSessionSelfTest.java @@ -200,6 +200,10 @@ public class WebSessionSelfTest extends GridCommonAbstractTest { } } + /** + * @param reqMarker Request marker. + * @param sesId Session id. + */ private String sendRequestAndCheckMarker(String reqMarker, String sesId) throws IOException, IgniteCheckedException { URLConnection conn = new URL("http://localhost:" + TEST_JETTY_PORT + "/ignitetest/test?marker=" + reqMarker).openConnection();