You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by se...@apache.org on 2015/05/02 17:48:52 UTC
[29/50] incubator-ignite git commit: Test renamed
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-709_2
Commit: ee5bae9ed9b7fe328ba216b52a6b2e297881ddb8
Parents: 38dee89
Author: agura <ag...@gridgain.com>
Authored: Thu Apr 30 12:04:56 2015 +0300
Committer: agura <ag...@gridgain.com>
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<Integer, String> store = new CacheStoreAdapter<Integer, String>() {
+ @Override public void loadCache(IgniteBiInClosure<Integer, String> 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<? extends Integer, ? extends String> 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<Ignite> f = new IgniteInClosure<Ignite>() {
+ @Override public void apply(Ignite grid) {
+ try (IgniteDataStreamer<Integer, String> 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<Ignite>() {
+ @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<Ignite> f) throws Exception {
+ Ignite g0 = startGrid(0);
+
+ IgniteInternalFuture fut = GridTestUtils.runAsync(new Callable<Ignite>() {
+ @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<Integer, String> 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<Integer, String> store = new CacheStoreAdapter<Integer, String>() {
- @Override public void loadCache(IgniteBiInClosure<Integer, String> 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<? extends Integer, ? extends String> 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<Ignite> f = new IgniteInClosure<Ignite>() {
- @Override public void apply(Ignite grid) {
- try (IgniteDataStreamer<Integer, String> 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<Ignite>() {
- @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<Ignite> f) throws Exception {
- Ignite g0 = startGrid(0);
-
- IgniteInternalFuture fut = GridTestUtils.runAsync(new Callable<Ignite>() {
- @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<Integer, String> 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));