From fa7662e7fbc410a5064815f16838e0ef91b0683b Mon Sep 17 00:00:00 2001 From: Alexey Platonov Date: Wed, 7 Nov 2018 14:53:58 +0300 Subject: [PATCH 1/2] init commit --- .../IgniteCacheAbstractQuerySelfTest.java | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java index 0f7fe3ac9d7d4..65275e14f6f4c 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java @@ -940,10 +940,10 @@ private void assertEnumType(final List> enumObject * * @throws Exception In case of error. */ - public void _testObjectQueryWithSwap() throws Exception { - fail("http://atlassian.gridgain.com/jira/browse/GG-11216"); - - IgniteCache cache = jcache(Integer.class, ObjectValue.class); + public void testObjectQueryWithSwap() throws Exception { + CacheConfiguration config = new CacheConfiguration(cacheConfiguration()); + config.setOnheapCacheEnabled(true); + IgniteCache cache = jcache(ignite(), config, Integer.class, ObjectValue.class); boolean partitioned = cache.getConfiguration(CacheConfiguration.class).getCacheMode() == PARTITIONED; @@ -956,16 +956,14 @@ public void _testObjectQueryWithSwap() throws Exception { IgniteCache c = g.cache(cache.getName()); for (int i = 0; i < cnt; i++) { - if (i % 2 == 0) { - assertNotNull(c.localPeek(i, CachePeekMode.ONHEAP)); + assertNotNull(c.localPeek(i, CachePeekMode.ONHEAP)); - c.localEvict(Collections.singleton(i)); // Swap. + c.localEvict(Collections.singleton(i)); // Swap. - if (!partitioned || g.affinity(cache.getName()).mapKeyToNode(i).isLocal()) { - ObjectValue peekVal = c.localPeek(i, CachePeekMode.ONHEAP); + if (!partitioned || g.affinity(cache.getName()).mapKeyToNode(i).isLocal()) { + ObjectValue peekVal = c.localPeek(i, CachePeekMode.ONHEAP); - assertNull("Non-null value for peek [key=" + i + ", val=" + peekVal + ']', peekVal); - } + assertNull("Non-null value for peek [key=" + i + ", val=" + peekVal + ']', peekVal); } } } From 945e822417acc043029ab80605d4a88ddfc1b91e Mon Sep 17 00:00:00 2001 From: Alexey Platonov Date: Fri, 9 Nov 2018 11:58:35 +0300 Subject: [PATCH 2/2] remove tests dependencies --- .../cache/IgniteCacheAbstractQuerySelfTest.java | 10 ++++++++-- .../IgniteCacheReplicatedQuerySelfTest.java | 17 ++--------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java index 65275e14f6f4c..72cef3106e799 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java @@ -266,7 +266,7 @@ protected Ignite ignite() { super.afterTest(); for(String cacheName : ignite().cacheNames()) - ignite().cache(cacheName).removeAll(); + ignite().cache(cacheName).destroy(); } /** {@inheritDoc} */ @@ -625,7 +625,13 @@ public void testSelectQuery() throws Exception { * @throws Exception In case of error. */ public void testSimpleCustomTableName() throws Exception { - final IgniteCache cache = ignite().cache(DEFAULT_CACHE_NAME); + CacheConfiguration cacheConf = new CacheConfiguration<>(cacheConfiguration()) + .setName(DEFAULT_CACHE_NAME) + .setQueryEntities(Arrays.asList( + new QueryEntity(Integer.class, Type1.class), + new QueryEntity(Integer.class, Type2.class) + )); + final IgniteCache cache = ignite().getOrCreateCache(cacheConf); cache.put(10, new Type1(1, "Type1 record #1")); cache.put(20, new Type1(2, "Type1 record #2")); diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedQuerySelfTest.java index 13942c2ede3d4..f741ef22c00c5 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedQuerySelfTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/IgniteCacheReplicatedQuerySelfTest.java @@ -101,8 +101,8 @@ public class IgniteCacheReplicatedQuerySelfTest extends IgniteCacheAbstractQuery } /** {@inheritDoc} */ - @Override protected void beforeTestsStarted() throws Exception { - super.beforeTestsStarted(); + @Override protected void beforeTest() throws Exception { + super.beforeTest(); ignite1 = grid(0); ignite2 = grid(1); @@ -113,19 +113,6 @@ public class IgniteCacheReplicatedQuerySelfTest extends IgniteCacheAbstractQuery cache3 = jcache(ignite3, CacheKey.class, CacheValue.class); } - /** {@inheritDoc} */ - @Override protected void afterTestsStopped() throws Exception { - super.afterTestsStopped(); - - ignite1 = null; - ignite2 = null; - ignite3 = null; - - cache1 = null; - cache2 = null; - cache3 = null; - } - /** * @throws Exception If failed. */