Repository: ignite Updated Branches: refs/heads/ignite-971-1 606c023bf -> ccb3f3619
ignite-971 Fix swap/unswap. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ccb3f361 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ccb3f361 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ccb3f361 Branch: refs/heads/ignite-971-1 Commit: ccb3f3619ddd08451ebd1f637db99a65a58c85af Parents: 606c023 Author: sboikov <[email protected]> Authored: Mon Sep 7 17:30:46 2015 +0300 Committer: sboikov <[email protected]> Committed: Mon Sep 7 17:30:46 2015 +0300 ---------------------------------------------------------------------- .../cache/CacheSwapUnswapGetTest.java | 42 +++++++++++++++----- 1 file changed, 32 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/ccb3f361/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSwapUnswapGetTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSwapUnswapGetTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSwapUnswapGetTest.java index f44397d..271d8b1 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSwapUnswapGetTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSwapUnswapGetTest.java @@ -25,6 +25,7 @@ import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.cache.CacheAtomicityMode; +import org.apache.ignite.cache.CacheMemoryMode; import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; @@ -65,19 +66,25 @@ public class CacheSwapUnswapGetTest extends GridCommonAbstractTest { /** * @param atomicityMode Cache atomicity mode. + * @param memMode Cache memory mode. * @param swap {@code True} if swap enabled. * @return Cache configuration. */ - private CacheConfiguration<Integer, String> cacheConfiguration(CacheAtomicityMode atomicityMode, boolean swap) { + private CacheConfiguration<Integer, String> cacheConfiguration(CacheAtomicityMode atomicityMode, + CacheMemoryMode memMode, + boolean swap) { CacheConfiguration<Integer, String> ccfg = new CacheConfiguration<>(); ccfg.setAtomicityMode(atomicityMode); ccfg.setWriteSynchronizationMode(FULL_SYNC); + ccfg.setMemoryMode(memMode); - LruEvictionPolicy plc = new LruEvictionPolicy(); - plc.setMaxSize(100); + if (memMode == CacheMemoryMode.ONHEAP_TIERED) { + LruEvictionPolicy plc = new LruEvictionPolicy(); + plc.setMaxSize(100); - ccfg.setEvictionPolicy(plc); + ccfg.setEvictionPolicy(plc); + } if (swap) { ccfg.setSwapEnabled(true); @@ -112,23 +119,38 @@ public class CacheSwapUnswapGetTest extends GridCommonAbstractTest { /** * @throws Exception If failed. */ - public void testTxCacheOffheap() throws Exception { - swapUnswap(TRANSACTIONAL, false); + public void testTxCacheOffheapEvict() throws Exception { + swapUnswap(TRANSACTIONAL, CacheMemoryMode.ONHEAP_TIERED, false); + } + + /** + * @throws Exception If failed. + */ + public void testTxCacheOffheapTiered() throws Exception { + swapUnswap(TRANSACTIONAL, CacheMemoryMode.OFFHEAP_TIERED, false); + } + + /** + * @throws Exception If failed. + */ + public void testAtomicCacheOffheapEvict() throws Exception { + swapUnswap(ATOMIC, CacheMemoryMode.ONHEAP_TIERED, false); } /** * @throws Exception If failed. */ - public void testAtomicCacheOffheap() throws Exception { - swapUnswap(ATOMIC, false); + public void testAtomicCacheOffheapTiered() throws Exception { + swapUnswap(ATOMIC, CacheMemoryMode.OFFHEAP_TIERED, false); } /** * @param atomicityMode Cache atomicity mode. + * @param memMode Cache memory mode. * @param swap {@code True} if swap enabled. * @throws Exception If failed. */ - private void swapUnswap(CacheAtomicityMode atomicityMode, boolean swap) throws Exception { + private void swapUnswap(CacheAtomicityMode atomicityMode, CacheMemoryMode memMode, boolean swap) throws Exception { log.info("Start test [mode=" + atomicityMode + ", swap=" + swap + ']'); int threadCnt = 20; @@ -143,7 +165,7 @@ public class CacheSwapUnswapGetTest extends GridCommonAbstractTest { g.destroyCache(null); - final IgniteCache<Integer, String> cache = g.createCache(cacheConfiguration(atomicityMode, swap)); + final IgniteCache<Integer, String> cache = g.createCache(cacheConfiguration(atomicityMode, memMode, swap)); try { IgniteInternalFuture<?> fut = multithreadedAsync(new CAX() {
