Repository: incubator-ignite Updated Branches: refs/heads/ignite-45 39547027e -> 2fd6e2608
IGNITE-45 - Fixing tests. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/932c6069 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/932c6069 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/932c6069 Branch: refs/heads/ignite-45 Commit: 932c6069e481ef2bb834742bf18bea140df2947a Parents: 3954702 Author: Alexey Goncharuk <agoncha...@gridgain.com> Authored: Thu Mar 19 14:25:33 2015 -0700 Committer: Alexey Goncharuk <agoncha...@gridgain.com> Committed: Thu Mar 19 14:25:33 2015 -0700 ---------------------------------------------------------------------- .../distributed/near/GridNearAtomicCache.java | 2 +- .../IgniteCacheAtomicNearPeekModesTest.java | 28 ++++++++++++++++++++ .../cache/IgniteCachePeekModesAbstractTest.java | 26 +++++++++--------- .../cache/IgniteCacheTxNearPeekModesTest.java | 28 ++++++++++++++++++++ .../ignite/testsuites/IgniteCacheTestSuite.java | 2 ++ 5 files changed, 71 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/932c6069/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java index adc9d7b..1160935 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearAtomicCache.java @@ -117,7 +117,7 @@ public class GridNearAtomicCache<K, V> extends GridNearCacheAdapter<K, V> { if (ver == null) ver = res.nearVersion(); - assert ver != null; + assert ver != null : "Failed to find version [req=" + req + ", res=" + res + ']'; int nearValIdx = 0; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/932c6069/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicNearPeekModesTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicNearPeekModesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicNearPeekModesTest.java new file mode 100644 index 0000000..a48b9a2 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAtomicNearPeekModesTest.java @@ -0,0 +1,28 @@ +/* + * 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; + +/** + * Tests peek modes with NEAR cache. + */ +public class IgniteCacheAtomicNearPeekModesTest extends IgniteCacheAtomicPeekModesTest { + /** {@inheritDoc} */ + @Override protected boolean hasNearCache() { + return true; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/932c6069/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java index a0ebc87..a740532 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java @@ -31,7 +31,6 @@ import org.apache.ignite.spi.swapspace.file.*; import javax.cache.*; import java.util.*; -import static org.apache.ignite.cache.CacheDistributionMode.*; import static org.apache.ignite.cache.CacheMode.*; import static org.apache.ignite.cache.CachePeekMode.*; @@ -65,6 +64,13 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra return null; } + /** + * @return Has near cache flag. + */ + protected boolean hasNearCache() { + return false; + } + /** {@inheritDoc} */ @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception { CacheConfiguration ccfg = super.cacheConfiguration(gridName); @@ -75,7 +81,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra ccfg.setBackups(1); - if (gridName.equals(getTestGridName(0))) + if (hasNearCache()) ccfg.setNearConfiguration(new NearCacheConfiguration()); ccfg.setEvictionPolicy(new CacheFifoEvictionPolicy(HEAP_ENTRIES)); @@ -161,9 +167,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra cache0.put(key, val); - boolean hasNearCache = nodeIdx == 0 ; - - if (hasNearCache) { + if (hasNearCache()) { assertEquals(val, cache0.localPeek(key, NEAR)); assertEquals(val, cache0.localPeek(key, ALL)); } @@ -498,9 +502,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra for (Integer key : keys) cache0.put(key, String.valueOf(key)); - boolean hasNearCache = nodeIdx == 0 ; - - if (hasNearCache) { + if (hasNearCache()) { assertEquals(PUT_KEYS, cache0.localSize()); assertEquals(PUT_KEYS, cache0.localSize(ALL)); assertEquals(PUT_KEYS, cache0.localSize(NEAR)); @@ -572,9 +574,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra assertEquals(PUT_KEYS - 1, cache0.localSize(BACKUP)); } else { - boolean hasNearCache = nodeIdx == 0; - - if (hasNearCache) + if (hasNearCache()) assertEquals(PUT_KEYS - 1, cache0.localSize()); else assertEquals(0, cache0.localSize()); @@ -1062,9 +1062,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra log.info("Keys [near=" + nearKeys + ", primary=" + primaryKeys + ", backup=" + backupKeys + ']'); - boolean hasNearCache = nodeIdx == 0 && cacheMode() == PARTITIONED; - - if (hasNearCache) { + if (hasNearCache()) { checkLocalEntries(cache0.localEntries(), nearKeys, primaryKeys, backupKeys); checkLocalEntries(cache0.localEntries(ALL), nearKeys, primaryKeys, backupKeys); checkLocalEntries(cache0.localEntries(NEAR), nearKeys); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/932c6069/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java new file mode 100644 index 0000000..8fba0c7 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxNearPeekModesTest.java @@ -0,0 +1,28 @@ +/* + * 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; + +/** + * Tests peek modes with near tx cache. + */ +public class IgniteCacheTxNearPeekModesTest extends IgniteCacheTxPeekModesTest { + /** {@inheritDoc} */ + @Override protected boolean hasNearCache() { + return true; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/932c6069/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 9966c30..cf4fcb8 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 @@ -388,9 +388,11 @@ public class IgniteCacheTestSuite extends TestSuite { suite.addTestSuite(IgniteCacheTxLocalNoWriteThroughTest.class); suite.addTestSuite(IgniteCacheAtomicPeekModesTest.class); + suite.addTestSuite(IgniteCacheAtomicNearPeekModesTest.class); suite.addTestSuite(IgniteCacheAtomicReplicatedPeekModesTest.class); suite.addTestSuite(IgniteCacheAtomicLocalPeekModesTest.class); suite.addTestSuite(IgniteCacheTxPeekModesTest.class); + suite.addTestSuite(IgniteCacheTxNearPeekModesTest.class); suite.addTestSuite(IgniteCacheTxLocalPeekModesTest.class); suite.addTestSuite(IgniteCacheTxReplicatedPeekModesTest.class);