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 5B95117A80 for ; Thu, 30 Apr 2015 15:15:22 +0000 (UTC) Received: (qmail 56816 invoked by uid 500); 30 Apr 2015 15:15:22 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 56780 invoked by uid 500); 30 Apr 2015 15:15:22 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 56730 invoked by uid 99); 30 Apr 2015 15:15:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Apr 2015 15:15:22 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [54.164.171.186] (HELO mx1-us-east.apache.org) (54.164.171.186) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Apr 2015 15:15:16 +0000 Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with SMTP id F21794735A for ; Thu, 30 Apr 2015 15:14:46 +0000 (UTC) Received: (qmail 54715 invoked by uid 99); 30 Apr 2015 15:14:46 -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, 30 Apr 2015 15:14:46 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5ACB8E3A5D; Thu, 30 Apr 2015 15:14:46 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.incubator.apache.org Date: Thu, 30 Apr 2015 15:14:58 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [13/25] incubator-ignite git commit: Test renamed X-Virus-Checked: Checked by ClamAV on apache.org Test renamed Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ee5bae9e Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ee5bae9e Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ee5bae9e Branch: refs/heads/ignite-732 Commit: ee5bae9ed9b7fe328ba216b52a6b2e297881ddb8 Parents: 38dee89 Author: agura Authored: Thu Apr 30 12:04:56 2015 +0300 Committer: agura Committed: Thu Apr 30 12:04:56 2015 +0300 ---------------------------------------------------------------------- ...CacheLoadingConcurrentGridStartSelfTest.java | 154 +++++++++++++++++++ ...GridCacheLoadingConcurrentGridStartTest.java | 154 ------------------- .../ignite/testsuites/IgniteCacheTestSuite.java | 2 +- 3 files changed, 155 insertions(+), 155 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ee5bae9e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java new file mode 100644 index 0000000..74273d1 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java @@ -0,0 +1,154 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.cache.distributed; + +import org.apache.ignite.*; +import org.apache.ignite.cache.*; +import org.apache.ignite.cache.store.*; +import org.apache.ignite.configuration.*; +import org.apache.ignite.internal.*; +import org.apache.ignite.lang.*; +import org.apache.ignite.testframework.*; +import org.apache.ignite.testframework.junits.common.*; +import org.jetbrains.annotations.*; + +import javax.cache.*; +import javax.cache.configuration.*; +import javax.cache.integration.*; +import java.util.concurrent.*; + +import static org.apache.ignite.cache.CacheMode.*; + +/** + * Tests for cache data loading during simultaneous grids start. + */ +public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractTest { + /** Grids count */ + private static int GRIDS_CNT = 5; + + /** Keys count */ + private static int KEYS_CNT = 1_000_000; + + /** {@inheritDoc} */ + @SuppressWarnings("unchecked") + @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(gridName); + + CacheConfiguration ccfg = new CacheConfiguration(); + + ccfg.setCacheMode(PARTITIONED); + + ccfg.setBackups(1); + + CacheStore store = new CacheStoreAdapter() { + @Override public void loadCache(IgniteBiInClosure f, Object... args) { + for (int i = 0; i < KEYS_CNT; i++) + f.apply(i, Integer.toString(i)); + } + + @Nullable @Override public String load(Integer i) throws CacheLoaderException { + return null; + } + + @Override public void write(Cache.Entry entry) throws CacheWriterException { + // No-op. + } + + @Override public void delete(Object o) throws CacheWriterException { + // No-op. + } + }; + + ccfg.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(store)); + + cfg.setCacheConfiguration(ccfg); + + return cfg; + } + + /** {@inheritDoc} */ + @Override protected void afterTest() throws Exception { + stopAllGrids(); + } + + /** + * @throws Exception if failed + */ + public void testLoadCacheWithDataStreamer() throws Exception { + IgniteInClosure f = new IgniteInClosure() { + @Override public void apply(Ignite grid) { + try (IgniteDataStreamer dataStreamer = grid.dataStreamer(null)) { + for (int i = 0; i < KEYS_CNT; i++) + dataStreamer.addData(i, Integer.toString(i)); + } + } + }; + + loadCache(f); + } + + /** + * @throws Exception if failed + */ + public void testLoadCacheFromStore() throws Exception { + loadCache(new IgniteInClosure() { + @Override public void apply(Ignite grid) { + grid.cache(null).loadCache(null); + } + }); + } + + /** + * Loads cache using closure and asserts cache size. + * + * @param f cache loading closure + * @throws Exception if failed + */ + private void loadCache(IgniteInClosure f) throws Exception { + Ignite g0 = startGrid(0); + + IgniteInternalFuture fut = GridTestUtils.runAsync(new Callable() { + @Override public Ignite call() throws Exception { + return startGridsMultiThreaded(1, GRIDS_CNT - 1); + } + }); + + try { + f.apply(g0); + } + finally { + fut.get(); + } + + assertCacheSize(); + } + + /** Asserts cache size. */ + private void assertCacheSize() { + IgniteCache cache = grid(0).cache(null); + + assertEquals(KEYS_CNT, cache.size(CachePeekMode.PRIMARY)); + + int total = 0; + + for (int i = 0; i < GRIDS_CNT; i++) + total += grid(i).cache(null).localSize(CachePeekMode.PRIMARY); + + assertEquals(KEYS_CNT, total); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ee5bae9e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLoadingConcurrentGridStartTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLoadingConcurrentGridStartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLoadingConcurrentGridStartTest.java deleted file mode 100644 index 2f9bb96..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLoadingConcurrentGridStartTest.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.cache.distributed; - -import org.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cache.store.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.testframework.*; -import org.apache.ignite.testframework.junits.common.*; -import org.jetbrains.annotations.*; - -import javax.cache.*; -import javax.cache.configuration.*; -import javax.cache.integration.*; -import java.util.concurrent.*; - -import static org.apache.ignite.cache.CacheMode.*; - -/** - * Tests for cache data loading during simultaneous grids start. - */ -public class GridCacheLoadingConcurrentGridStartTest extends GridCommonAbstractTest { - /** Grids count */ - private static int GRIDS_CNT = 5; - - /** Keys count */ - private static int KEYS_CNT = 1_000_000; - - /** {@inheritDoc} */ - @SuppressWarnings("unchecked") - @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { - IgniteConfiguration cfg = super.getConfiguration(gridName); - - CacheConfiguration ccfg = new CacheConfiguration(); - - ccfg.setCacheMode(PARTITIONED); - - ccfg.setBackups(1); - - CacheStore store = new CacheStoreAdapter() { - @Override public void loadCache(IgniteBiInClosure f, Object... args) { - for (int i = 0; i < KEYS_CNT; i++) - f.apply(i, Integer.toString(i)); - } - - @Nullable @Override public String load(Integer i) throws CacheLoaderException { - return null; - } - - @Override public void write(Cache.Entry entry) throws CacheWriterException { - // No-op. - } - - @Override public void delete(Object o) throws CacheWriterException { - // No-op. - } - }; - - ccfg.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(store)); - - cfg.setCacheConfiguration(ccfg); - - return cfg; - } - - /** {@inheritDoc} */ - @Override protected void afterTest() throws Exception { - stopAllGrids(); - } - - /** - * @throws Exception if failed - */ - public void testLoadCacheWithDataStreamer() throws Exception { - IgniteInClosure f = new IgniteInClosure() { - @Override public void apply(Ignite grid) { - try (IgniteDataStreamer dataStreamer = grid.dataStreamer(null)) { - for (int i = 0; i < KEYS_CNT; i++) - dataStreamer.addData(i, Integer.toString(i)); - } - } - }; - - loadCache(f); - } - - /** - * @throws Exception if failed - */ - public void testLoadCacheFromStore() throws Exception { - loadCache(new IgniteInClosure() { - @Override public void apply(Ignite grid) { - grid.cache(null).loadCache(null); - } - }); - } - - /** - * Loads cache using closure and asserts cache size. - * - * @param f cache loading closure - * @throws Exception if failed - */ - private void loadCache(IgniteInClosure f) throws Exception { - Ignite g0 = startGrid(0); - - IgniteInternalFuture fut = GridTestUtils.runAsync(new Callable() { - @Override public Ignite call() throws Exception { - return startGridsMultiThreaded(1, GRIDS_CNT - 1); - } - }); - - try { - f.apply(g0); - } - finally { - fut.get(); - } - - assertCacheSize(); - } - - /** Asserts cache size. */ - private void assertCacheSize() { - IgniteCache cache = grid(0).cache(null); - - assertEquals(KEYS_CNT, cache.size(CachePeekMode.PRIMARY)); - - int total = 0; - - for (int i = 0; i < GRIDS_CNT; i++) - total += grid(i).cache(null).localSize(CachePeekMode.PRIMARY); - - assertEquals(KEYS_CNT, total); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ee5bae9e/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java index 6f954cd..bb019ae 100644 --- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java +++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java @@ -224,7 +224,7 @@ public class IgniteCacheTestSuite extends TestSuite { suite.addTest(new TestSuite(GridCacheDhtPreloadUnloadSelfTest.class)); suite.addTest(new TestSuite(GridCachePartitionedAffinityFilterSelfTest.class)); suite.addTest(new TestSuite(GridCachePartitionedPreloadLifecycleSelfTest.class)); - suite.addTest(new TestSuite(GridCacheLoadingConcurrentGridStartTest.class)); + suite.addTest(new TestSuite(CacheLoadingConcurrentGridStartSelfTest.class)); suite.addTest(new TestSuite(GridCacheDhtPreloadDelayedSelfTest.class)); suite.addTest(new TestSuite(GridPartitionedBackupLoadSelfTest.class)); suite.addTest(new TestSuite(GridCachePartitionedLoadCacheSelfTest.class));