Repository: incubator-ignite Updated Branches: refs/heads/ignite-286 f19cb584d -> 739365d14
#ignite-286: add query 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/739365d1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/739365d1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/739365d1 Branch: refs/heads/ignite-286 Commit: 739365d14d6d8ab978da5dbf698cf6c6c3199795 Parents: f19cb58 Author: ivasilinets <[email protected]> Authored: Mon Apr 27 18:18:30 2015 +0300 Committer: ivasilinets <[email protected]> Committed: Mon Apr 27 18:18:30 2015 +0300 ---------------------------------------------------------------------- ...eQueryMultiThreadedOffHeapTiredSelfTest.java | 37 ++++++++++++++++++++ .../IgniteCacheQueryMultiThreadedSelfTest.java | 29 ++++++++++++--- .../IgniteCacheQuerySelfTestSuite.java | 1 + 3 files changed, 62 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/739365d1/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedOffHeapTiredSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedOffHeapTiredSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedOffHeapTiredSelfTest.java new file mode 100644 index 0000000..8b09d0f --- /dev/null +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedOffHeapTiredSelfTest.java @@ -0,0 +1,37 @@ +/* + * 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; + +import org.apache.ignite.cache.*; +import org.apache.ignite.configuration.*; + +/** + * Test queries in off-heap tired mode. + */ +public class IgniteCacheQueryMultiThreadedOffHeapTiredSelfTest extends IgniteCacheQueryMultiThreadedSelfTest { + /** {@inheritDoc} */ + @Override protected CacheConfiguration cacheConfiguration() { + CacheConfiguration ccfg = super.cacheConfiguration(); + + ccfg.setCacheMode(CacheMode.REPLICATED); + ccfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED); + ccfg.setOffHeapMaxMemory(0); + + return ccfg; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/739365d1/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java index 66e2470..a716bff 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java @@ -86,6 +86,17 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes cfg.setSwapSpaceSpi(new FileSwapSpaceSpi()); cfg.setMarshaller(new OptimizedMarshaller(false)); + cfg.setCacheConfiguration(cacheConfiguration()); + + GridQueryProcessor.idxCls = FakeIndexing.class; + + return cfg; + } + + /** + * @return Cache configuration. + */ + protected CacheConfiguration cacheConfiguration() { CacheConfiguration<?,?> cacheCfg = defaultCacheConfiguration(); cacheCfg.setCacheMode(PARTITIONED); @@ -106,11 +117,7 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes if (offheapEnabled()) cacheCfg.setOffHeapMaxMemory(evictsEnabled() ? 1000 : 0); // Small offheap for evictions. - cfg.setCacheConfiguration(cacheCfg); - - GridQueryProcessor.idxCls = FakeIndexing.class; - - return cfg; + return cacheCfg; } /** @@ -235,6 +242,9 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes final IgniteCache<Integer, String> c = g.cache(null); final IgniteCache<Integer, Long> cl = g.cache(null); + if (c.getConfiguration(CacheConfiguration.class).getMemoryMode() == CacheMemoryMode.OFFHEAP_TIERED) + return; + assertEquals(0, g.cache(null).localSize()); assertEquals(0, c.query(new SqlQuery(String.class, "1 = 1")).getAll().size()); assertEquals(0, cl.query(new SqlQuery(Long.class, "1 = 1")).getAll().size()); @@ -307,6 +317,9 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes final IgniteCache<Integer, Long> c = g.cache(null); final IgniteCache<Integer, String> c1 = g.cache(null); + if (c.getConfiguration(CacheConfiguration.class).getMemoryMode() == CacheMemoryMode.OFFHEAP_TIERED) + return; + assertEquals(0, g.cache(null).localSize()); assertEquals(0, c1.query(new SqlQuery(String.class, "1 = 1")).getAll().size()); assertEquals(0, c.query(new SqlQuery(Long.class, "1 = 1")).getAll().size()); @@ -379,6 +392,9 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes // Put test values into cache. final IgniteCache<Integer, Object> c = g.cache(null); + if (c.getConfiguration(CacheConfiguration.class).getMemoryMode() == CacheMemoryMode.OFFHEAP_TIERED) + return; + assertEquals(0, g.cache(null).size()); assertEquals(0, c.query(new SqlQuery(Object.class, "1 = 1")).getAll().size()); @@ -450,6 +466,9 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes // Put test values into cache. final IgniteCache<Integer, TestValue> c = g.cache(null); + if (c.getConfiguration(CacheConfiguration.class).getMemoryMode() == CacheMemoryMode.OFFHEAP_TIERED) + return; + assertEquals(0, g.cache(null).localSize()); assertEquals(0, c.query(new SqlQuery(TestValue.class, "1 = 1")).getAll().size()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/739365d1/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java index ce05980..04f5cb1 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java +++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java @@ -59,6 +59,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite { suite.addTestSuite(IgniteCacheLargeResultSelfTest.class); suite.addTestSuite(GridCacheQueryInternalKeysSelfTest.class); suite.addTestSuite(IgniteCacheQueryMultiThreadedSelfTest.class); + suite.addTestSuite(IgniteCacheQueryMultiThreadedOffHeapTiredSelfTest.class); suite.addTestSuite(IgniteCacheQueryEvictsMultiThreadedSelfTest.class); suite.addTestSuite(IgniteCacheQueryOffheapMultiThreadedSelfTest.class); suite.addTestSuite(IgniteCacheQueryOffheapEvictsMultiThreadedSelfTest.class);
