IGNITE-2509: Added one more tests to ensure that all is fine.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cfffa2c5 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cfffa2c5 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cfffa2c5 Branch: refs/heads/ignite-1786 Commit: cfffa2c591a9a8bec793ed84f108c782de56d180 Parents: e6b5087 Author: vozerov-gridgain <[email protected]> Authored: Mon Feb 15 12:53:43 2016 +0300 Committer: vozerov-gridgain <[email protected]> Committed: Mon Feb 15 12:53:43 2016 +0300 ---------------------------------------------------------------------- .../GridCacheOffHeapValuesEvictionSelfTest.java | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/cfffa2c5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapValuesEvictionSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapValuesEvictionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapValuesEvictionSelfTest.java index 0efd89b..a3cc785 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapValuesEvictionSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapValuesEvictionSelfTest.java @@ -25,6 +25,7 @@ import org.apache.ignite.IgniteCache; import org.apache.ignite.cache.CacheMemoryMode; import org.apache.ignite.cache.CachePeekMode; import org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy; +import org.apache.ignite.cache.eviction.lru.LruEvictionPolicy; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.testframework.GridTestUtils; @@ -50,6 +51,31 @@ public class GridCacheOffHeapValuesEvictionSelfTest extends GridCacheAbstractSel } /** + * Test single evict with OFFHEAP_VALUES mode. + * + * @throws Exception If failed. + */ + public void testSingleEvictOffHeap() throws Exception { + CacheConfiguration<Integer, Object> ccfg = cacheConfiguration(grid(0).name()); + ccfg.setName("testSingleEvictOffHeap"); + ccfg.setMemoryMode(CacheMemoryMode.OFFHEAP_VALUES); + ccfg.setSwapEnabled(false); + + LruEvictionPolicy plc = new LruEvictionPolicy(); + plc.setMaxMemorySize(200); + + ccfg.setEvictionPolicy(plc); + + final IgniteCache<Integer, Object> cache = grid(0).getOrCreateCache(ccfg); + + cache.put(1, new byte[150]); + cache.put(2, new byte[150]); + cache.put(3, new byte[150]); + + assert cache.size() == 1; + } + + /** * @throws Exception If failed. */ public void testPutValuesOffHeap() throws Exception {
