Repository: ignite
Updated Branches:
  refs/heads/ignite-5075 605377ca5 -> 54b693585


IGNITE-5075 tests


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/54b69358
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/54b69358
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/54b69358

Branch: refs/heads/ignite-5075
Commit: 54b693585fb816300abc2526baaa017a770635e0
Parents: 605377c
Author: sboikov <[email protected]>
Authored: Tue Jun 6 11:54:52 2017 +0300
Committer: sboikov <[email protected]>
Committed: Tue Jun 6 11:54:52 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/IgniteCacheGroupsTest.java | 555 ++++++++++++++++++-
 ...ologyValidatorAbstractTxCacheGroupsTest.java | 126 +++++
 ...opologyValidatorCacheGroupsAbstractTest.java | 131 +++++
 ...torNearPartitionedAtomicCacheGroupsTest.java |  31 ++
 ...lidatorNearPartitionedTxCacheGroupsTest.java |  31 ++
 ...lidatorPartitionedAtomicCacheGroupsTest.java |  45 ++
 ...gyValidatorPartitionedTxCacheGroupsTest.java |  31 ++
 ...alidatorReplicatedAtomicCacheGroupsTest.java |  45 ++
 ...ogyValidatorReplicatedTxCacheGroupsTest.java |  31 ++
 ...eCacheGroupsPartitionLossPolicySelfTest.java | 355 ++++++++++++
 .../testsuites/IgniteCacheTestSuite5.java       |   2 +
 .../IgniteTopologyValidatorTestSuite.java       |  14 +
 .../IgniteCacheGroupsCompareQueryTest.java      |  45 ++
 ...teCacheGroupsSqlDistributedJoinSelfTest.java |  30 +
 ...roupsSqlSegmentedIndexMultiNodeSelfTest.java |  28 +
 ...iteCacheGroupsSqlSegmentedIndexSelfTest.java |  37 ++
 .../query/IgniteSqlDistributedJoinSelfTest.java |   2 +-
 .../query/h2/sql/BaseH2CompareQueryTest.java    |  35 +-
 .../IgniteCacheQuerySelfTestSuite2.java         |   9 +
 19 files changed, 1562 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
index 4e030ac..78d4e0a 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsTest.java
@@ -17,9 +17,11 @@
 
 package org.apache.ignite.internal.processors.cache;
 
+import com.google.common.collect.Sets;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
@@ -41,6 +43,7 @@ import java.util.concurrent.locks.Lock;
 import javax.cache.Cache;
 import javax.cache.CacheException;
 import javax.cache.configuration.Factory;
+import javax.cache.configuration.FactoryBuilder;
 import javax.cache.event.CacheEntryEvent;
 import javax.cache.event.CacheEntryUpdatedListener;
 import javax.cache.integration.CacheLoaderException;
@@ -81,9 +84,12 @@ import 
org.apache.ignite.internal.processors.platform.cache.expiry.PlatformExpir
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
 import org.apache.ignite.internal.util.lang.GridIterator;
 import org.apache.ignite.internal.util.lang.GridPlainCallable;
+import org.apache.ignite.internal.util.lang.gridfunc.ContainsPredicate;
+import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.PA;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiInClosure;
 import org.apache.ignite.lang.IgniteBiPredicate;
 import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.lang.IgniteInClosure;
@@ -93,6 +99,7 @@ import 
org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
+import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -126,6 +133,9 @@ public class IgniteCacheGroupsTest extends 
GridCommonAbstractTest {
     private static final String CACHE2 = "cache2";
 
     /** */
+    private static final int ASYNC_TIMEOUT = 5000;
+
+    /** */
     private boolean client;
 
     /** */
@@ -1978,20 +1988,48 @@ public class IgniteCacheGroupsTest extends 
GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     private void cacheApiTest(IgniteCache cache) throws Exception {
-        cachePutAllGetAll(cache);
+        cachePutAllGetAllContainsAll(cache);
+
+        cachePutAllGetAllContainsAllAsync(cache);
 
         cachePutRemove(cache);
 
-        cachePutGet(cache);
+        cachePutRemoveAsync(cache);
+
+        cachePutGetContains(cache);
+
+        cachePutGetContainsAsync(cache);
 
         cachePutGetAndPut(cache);
 
+        cachePutGetAndPutAsync(cache);
+
+        cachePutGetAndRemove(cache);
+
+        cachePutGetAndRemoveAsync(cache);
+
+        cachePutGetAndReplace(cache);
+
+        cachePutGetAndReplaceAsync(cache);
+
+        cachePutIfAbsent(cache);
+
+        cachePutIfAbsentAsync(cache);
+
+        cachePutGetAndPutIfAbsent(cache);
+
+        cachePutGetAndPutIfAbsentAsync(cache);
+
         cacheQuery(cache);
 
         cacheInvokeAll(cache);
 
         cacheInvoke(cache);
 
+        cacheInvokeAllAsync(cache);
+
+        cacheInvokeAsync(cache);
+
         cacheDataStreamer(cache);
     }
 
@@ -2009,7 +2047,7 @@ public class IgniteCacheGroupsTest extends 
GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     private void cacheDataStreamer(final IgniteCache cache) throws Exception {
-        final int keys = 1000;
+        final int keys = 400;
         final int loaders = 4;
 
         final Integer[] data = generateData(keys * loaders);
@@ -2063,8 +2101,10 @@ public class IgniteCacheGroupsTest extends 
GridCommonAbstractTest {
     /**
      * @param cache Cache.
      */
-    private void cachePutAllGetAll(IgniteCache cache) {
-        Map<Integer, Integer> data = generateDataMap(1000);
+    private void cachePutAllGetAllContainsAll(IgniteCache cache) {
+        int keys = 100;
+
+        Map<Integer, Integer> data = generateDataMap(keys);
 
         cache.putAll(data);
 
@@ -2072,9 +2112,32 @@ public class IgniteCacheGroupsTest extends 
GridCommonAbstractTest {
 
         assertEquals(data.size(), data0.size());
 
-        for (Map.Entry<Integer, Integer> entry : data.entrySet()) {
+        for (Map.Entry<Integer, Integer> entry : data.entrySet())
             assertEquals(entry.getValue(), data0.get(entry.getKey()));
-        }
+
+        assertTrue(cache.containsKeys(data.keySet()));
+
+        tearDown(cache);
+    }
+
+    /**
+     * @param cache Cache.
+     */
+    private void cachePutAllGetAllContainsAllAsync(IgniteCache cache) {
+        int keys = 100;
+
+        Map<Integer, Integer> data = generateDataMap(keys);
+
+        cache.putAllAsync(data).get(ASYNC_TIMEOUT);
+
+        Map data0 = (Map)cache.getAllAsync(data.keySet()).get(ASYNC_TIMEOUT);
+
+        assertEquals(data.size(), data0.size());
+
+        for (Map.Entry<Integer, Integer> entry : data.entrySet())
+            assertEquals(entry.getValue(), data0.get(entry.getKey()));
+
+        
assertTrue((Boolean)cache.containsKeysAsync(data.keySet()).get(ASYNC_TIMEOUT));
 
         tearDown(cache);
     }
@@ -2100,7 +2163,25 @@ public class IgniteCacheGroupsTest extends 
GridCommonAbstractTest {
     /**
      * @param cache Cache.
      */
-    private void cachePutGet(IgniteCache cache) {
+    private void cachePutRemoveAsync(IgniteCache cache) {
+        Random rnd = ThreadLocalRandom.current();
+
+        Integer key = rnd.nextInt();
+        Integer val = rnd.nextInt();
+
+        cache.putAsync(key, val).get(ASYNC_TIMEOUT);
+
+        assertTrue((Boolean)cache.removeAsync(key).get(ASYNC_TIMEOUT));
+
+        assertNull(cache.get(key));
+
+        tearDown(cache);
+    }
+
+    /**
+     * @param cache Cache.
+     */
+    private void cachePutGetContains(IgniteCache cache) {
         Random rnd = ThreadLocalRandom.current();
 
         Integer key = rnd.nextInt();
@@ -2112,6 +2193,42 @@ public class IgniteCacheGroupsTest extends 
GridCommonAbstractTest {
 
         assertEquals(val, val0);
 
+        assertTrue(cache.containsKey(key));
+
+        Integer key2 = rnd.nextInt();
+
+        while (key2.equals(key))
+            key2 = rnd.nextInt();
+
+        assertFalse(cache.containsKey(key2));
+
+        tearDown(cache);
+    }
+
+    /**
+     * @param cache Cache.
+     */
+    private void cachePutGetContainsAsync(IgniteCache cache) {
+        Random rnd = ThreadLocalRandom.current();
+
+        Integer key = rnd.nextInt();
+        Integer val = rnd.nextInt();
+
+        cache.putAsync(key, val).get(ASYNC_TIMEOUT);
+
+        Object val0 = cache.getAsync(key).get(ASYNC_TIMEOUT);
+
+        assertEquals(val, val0);
+
+        assertTrue((Boolean)cache.containsKeyAsync(key).get(ASYNC_TIMEOUT));
+
+        Integer key2 = rnd.nextInt();
+
+        while (key2.equals(key))
+            key2 = rnd.nextInt();
+
+        assertFalse((Boolean)cache.containsKeyAsync(key2).get(ASYNC_TIMEOUT));
+
         tearDown(cache);
     }
 
@@ -2141,8 +2258,239 @@ public class IgniteCacheGroupsTest extends 
GridCommonAbstractTest {
     /**
      * @param cache Cache.
      */
+    private void cachePutGetAndPutAsync(IgniteCache cache) {
+        Random rnd = ThreadLocalRandom.current();
+
+        Integer key = rnd.nextInt();
+        Integer val1 = rnd.nextInt();
+        Integer val2 = rnd.nextInt();
+
+        cache.put(key, val1);
+
+        Object val0 = cache.getAndPutAsync(key, val2).get(ASYNC_TIMEOUT);
+
+        assertEquals(val1, val0);
+
+        val0 = cache.get(key);
+
+        assertEquals(val2, val0);
+
+        tearDown(cache);
+    }
+
+    /**
+     * @param cache Cache.
+     */
+    private void cachePutGetAndReplace(IgniteCache cache) {
+        Random rnd = ThreadLocalRandom.current();
+
+        Integer key = rnd.nextInt();
+        Integer val1 = rnd.nextInt();
+        Integer val2 = rnd.nextInt();
+
+        Object val0 = cache.getAndReplace(key, val1);
+
+        assertEquals(null, val0);
+
+        val0 = cache.get(key);
+
+        assertEquals(null, val0);
+
+        cache.put(key, val1);
+
+        val0 = cache.getAndReplace(key, val2);
+
+        assertEquals(val1, val0);
+
+        val0 = cache.get(key);
+
+        assertEquals(val2, val0);
+
+        tearDown(cache);
+    }
+
+    /**
+     * @param cache Cache.
+     */
+    private void cachePutGetAndReplaceAsync(IgniteCache cache) {
+        Random rnd = ThreadLocalRandom.current();
+
+        Integer key = rnd.nextInt();
+        Integer val1 = rnd.nextInt();
+        Integer val2 = rnd.nextInt();
+
+        Object val0 = cache.getAndReplaceAsync(key, val1).get(ASYNC_TIMEOUT);
+
+        assertEquals(null, val0);
+
+        val0 = cache.get(key);
+
+        assertEquals(null, val0);
+
+        cache.put(key, val1);
+
+        val0 = cache.getAndReplaceAsync(key, val2).get(ASYNC_TIMEOUT);
+
+        assertEquals(val1, val0);
+
+        val0 = cache.get(key);
+
+        assertEquals(val2, val0);
+
+        tearDown(cache);
+    }
+
+    /**
+     * @param cache Cache.
+     */
+    private void cachePutGetAndRemove(IgniteCache cache) {
+        Random rnd = ThreadLocalRandom.current();
+
+        Integer key = rnd.nextInt();
+        Integer val = rnd.nextInt();
+
+
+        cache.put(key, val);
+
+        Object val0 = cache.getAndRemove(key);
+
+        assertEquals(val, val0);
+
+        val0 = cache.get(key);
+
+        assertNull(val0);
+
+        tearDown(cache);
+    }
+
+    /**
+     * @param cache Cache.
+     */
+    private void cachePutGetAndRemoveAsync(IgniteCache cache) {
+        Random rnd = ThreadLocalRandom.current();
+
+        Integer key = rnd.nextInt();
+        Integer val = rnd.nextInt();
+
+
+        cache.put(key, val);
+
+        Object val0 = cache.getAndRemoveAsync(key).get(ASYNC_TIMEOUT);
+
+        assertEquals(val, val0);
+
+        val0 = cache.get(key);
+
+        assertNull(val0);
+
+        tearDown(cache);
+    }
+
+    /**
+     * @param cache Cache.
+     */
+    private void cachePutIfAbsent(IgniteCache cache) {
+        Random rnd = ThreadLocalRandom.current();
+
+        Integer key = rnd.nextInt();
+        Integer val1 = rnd.nextInt();
+        Integer val2 = rnd.nextInt();
+
+
+        assertTrue(cache.putIfAbsent(key, val1));
+
+        Object val0 = cache.get(key);
+
+        assertEquals(val1, val0);
+
+        assertFalse(cache.putIfAbsent(key, val2));
+
+        val0 = cache.get(key);
+
+        assertEquals(val1, val0);
+
+        tearDown(cache);
+    }
+
+    /**
+     * @param cache Cache.
+     */
+    private void cachePutIfAbsentAsync(IgniteCache cache) {
+        Random rnd = ThreadLocalRandom.current();
+
+        Integer key = rnd.nextInt();
+        Integer val1 = rnd.nextInt();
+        Integer val2 = rnd.nextInt();
+
+
+        assertTrue((Boolean)cache.putIfAbsentAsync(key, 
val1).get(ASYNC_TIMEOUT));
+
+        Object val0 = cache.get(key);
+
+        assertEquals(val1, val0);
+
+        assertFalse((Boolean)cache.putIfAbsentAsync(key, 
val2).get(ASYNC_TIMEOUT));
+
+        val0 = cache.get(key);
+
+        assertEquals(val1, val0);
+
+        tearDown(cache);
+    }
+
+    /**
+     * @param cache Cache.
+     */
+    private void cachePutGetAndPutIfAbsent(IgniteCache cache) {
+        Random rnd = ThreadLocalRandom.current();
+
+        Integer key = rnd.nextInt();
+        Integer val1 = rnd.nextInt();
+        Integer val2 = rnd.nextInt();
+
+        cache.put(key, val1);
+
+        Object val0 = cache.getAndPutIfAbsent(key, val2);
+
+        assertEquals(val1, val0);
+
+        val0 = cache.get(key);
+
+        assertEquals(val1, val0);
+
+        tearDown(cache);
+    }
+
+    /**
+     * @param cache Cache.
+     */
+    private void cachePutGetAndPutIfAbsentAsync(IgniteCache cache) {
+        Random rnd = ThreadLocalRandom.current();
+
+        Integer key = rnd.nextInt();
+        Integer val1 = rnd.nextInt();
+        Integer val2 = rnd.nextInt();
+
+        cache.put(key, val1);
+
+        Object val0 = cache.getAndPutIfAbsentAsync(key, 
val2).get(ASYNC_TIMEOUT);
+
+        assertEquals(val1, val0);
+
+        val0 = cache.get(key);
+
+        assertEquals(val1, val0);
+
+        tearDown(cache);
+    }
+
+    /**
+     * @param cache Cache.
+     */
     private void cacheQuery(IgniteCache cache) {
-        Map<Integer, Integer> data = generateDataMap(1000);
+        int keys = 100;
+
+        Map<Integer, Integer> data = generateDataMap(keys);
 
         cache.putAll(data);
 
@@ -2168,7 +2516,7 @@ public class IgniteCacheGroupsTest extends 
GridCommonAbstractTest {
      * @param cache Cache.
      */
     private void cacheInvokeAll(IgniteCache cache) {
-        int keys = 1000;
+        int keys = 100;
         Map<Integer, Integer> data = generateDataMap(keys);
 
         cache.putAll(data);
@@ -2224,6 +2572,137 @@ public class IgniteCacheGroupsTest extends 
GridCommonAbstractTest {
     }
 
     /**
+     * @param cache Cache.
+     */
+    private void cacheInvokeAllAsync(IgniteCache cache) {
+        int keys = 100;
+        Map<Integer, Integer> data = generateDataMap(keys);
+
+        cache.putAll(data);
+
+        Random rnd = ThreadLocalRandom.current();
+
+        int one = rnd.nextInt();
+        int two = rnd.nextInt();
+
+        Object res0 = cache.invokeAllAsync(data.keySet(), new 
CacheEntryProcessor<Integer, Integer, Integer>() {
+            @Override public Integer process(MutableEntry<Integer, Integer> 
entry,
+                Object... arguments) throws EntryProcessorException {
+                Object expected = ((Map)arguments[0]).get(entry.getKey());
+
+                assertEquals(expected, entry.getValue());
+
+                // Some calculation.
+                return (Integer)arguments[1] + (Integer)arguments[2];
+            }
+        }, data, one, two).get(ASYNC_TIMEOUT);
+
+        Map<Integer, CacheInvokeResult<Integer>> res = (Map<Integer, 
CacheInvokeResult<Integer>>)res0;
+
+        assertEquals(keys, res.size());
+        assertEquals(one + two, (Object)res.get(0).get());
+
+        tearDown(cache);
+    }
+
+    /**
+     * @param cache Cache.
+     */
+    private void cacheInvokeAsync(IgniteCache cache) {
+        Random rnd = ThreadLocalRandom.current();
+
+        Integer key = rnd.nextInt();
+        Integer val = rnd.nextInt();
+
+        cache.put(key, val);
+
+        int one = rnd.nextInt();
+        int two = rnd.nextInt();
+
+        Object res = cache.invokeAsync(key, new CacheEntryProcessor<Integer, 
Integer, Integer>() {
+            @Override public Integer process(MutableEntry<Integer, Integer> 
entry, Object... arguments) throws EntryProcessorException {
+                assertEquals(arguments[0], entry.getValue());
+
+                // Some calculation.
+                return (Integer)arguments[1] + (Integer)arguments[2];
+            }
+        }, val, one, two).get(ASYNC_TIMEOUT);
+
+        assertEquals(one + two, res);
+
+        tearDown(cache);
+    }
+
+
+    public void testLoadCacheAtomicPartitioned() throws Exception {
+        loadCache(PARTITIONED, ATOMIC);
+    }
+
+    public void testLoadCacheAtomicReplicated() throws Exception {
+        loadCache(REPLICATED, ATOMIC);
+    }
+
+    public void testLoadCacheTxPartitioned() throws Exception {
+        loadCache(PARTITIONED, TRANSACTIONAL);
+    }
+
+    public void testLoadCacheTxReplicated() throws Exception {
+        loadCache(REPLICATED, TRANSACTIONAL);
+    }
+
+    public void testLoadCacheAtomicLocal() throws Exception {
+        loadCache(LOCAL, ATOMIC);
+    }
+
+    public void testLoadCacheTxLocal() throws Exception {
+        loadCache(LOCAL, TRANSACTIONAL);
+    }
+
+    /**
+     * @param cacheMode Cache mode.
+     * @param atomicityMode Atomicity mode.
+     * @throws Exception If failed.
+     */
+    private void loadCache(CacheMode cacheMode, CacheAtomicityMode 
atomicityMode) throws Exception {
+        int keys = 100;
+
+        boolean local = cacheMode == LOCAL;
+
+        Map<Integer, Integer> data1 = generateDataMap(keys);
+        Map<Integer, Integer> data2 = generateDataMap(keys);
+
+        Factory<? extends CacheStore<Integer, Integer>> fctr1 =
+            FactoryBuilder.factoryOf(new MapBasedStore<>(data1));
+
+        Factory<? extends CacheStore<Integer, Integer>> fctr2 =
+            FactoryBuilder.factoryOf(new MapBasedStore<>(data2));
+
+
+        CacheConfiguration ccfg1 = cacheConfiguration(GROUP1, CACHE1, 
cacheMode, atomicityMode, 1, false)
+            .setCacheStoreFactory(fctr1);
+
+        CacheConfiguration ccfg2 = cacheConfiguration(GROUP1, CACHE2, 
cacheMode, atomicityMode, 1, false)
+            .setCacheStoreFactory(fctr2);
+
+        Ignite node = startGrids(local ? 1 : 4);
+
+        node.createCaches(F.asList(ccfg1, ccfg2));
+
+        IgniteCache<Integer, Integer> cache1 = node.cache(CACHE1);
+        IgniteCache<Integer, Integer> cache2 = node.cache(CACHE2);
+
+        cache1.loadCache(null);
+
+        checkCacheData(data1, CACHE1);
+
+        assertEquals(0, cache2.size());
+
+        cache2.loadCache(null);
+
+        checkCacheData(data2, CACHE2);
+    }
+
+    /**
      * @throws Exception If failed.
      */
     public void testConcurrentOperationsSameKeys() throws Exception {
@@ -3763,4 +4242,60 @@ public class IgniteCacheGroupsTest extends 
GridCommonAbstractTest {
 
         return null;
     }
+
+    /**
+     *
+     */
+    static class MapBasedStore<K,V> implements CacheStore<K,V>, Serializable {
+        private final Map<K,V> src;
+
+        /**
+         * @param src Source map.
+         */
+        MapBasedStore(Map<K, V> src) {
+            this.src = src;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void loadCache(IgniteBiInClosure<K, V> clo, @Nullable 
Object... args) throws CacheLoaderException {
+            for (Map.Entry<K, V> e : src.entrySet())
+                clo.apply(e.getKey(), e.getValue());
+        }
+
+        /** {@inheritDoc} */
+        @Override public void sessionEnd(boolean commit) throws 
CacheWriterException {
+            // No-op
+        }
+
+        /** {@inheritDoc} */
+        @Override public V load(K key) throws CacheLoaderException {
+            return src.get(key);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Map<K, V> loadAll(Iterable<? extends K> keys) throws 
CacheLoaderException {
+            return F.view(src, new ContainsPredicate<>(Sets.newHashSet(keys)));
+        }
+
+        /** {@inheritDoc} */
+        @Override public void write(Cache.Entry<? extends K, ? extends V> 
entry) throws CacheWriterException {
+            throw new UnsupportedOperationException();
+        }
+
+        /** {@inheritDoc} */
+        @Override
+        public void writeAll(Collection<Cache.Entry<? extends K, ? extends V>> 
entries) throws CacheWriterException {
+            throw new UnsupportedOperationException();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void delete(Object key) throws CacheWriterException {
+            throw new UnsupportedOperationException();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void deleteAll(Collection<?> keys) throws 
CacheWriterException {
+            throw new UnsupportedOperationException();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheGroupsTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheGroupsTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheGroupsTest.java
new file mode 100644
index 0000000..06f1922
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheGroupsTest.java
@@ -0,0 +1,126 @@
+/*
+ *  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.CacheAtomicityMode;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.transactions.Transaction;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
+import static 
org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static 
org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
+
+/**
+ * Topology validator test
+ */
+public abstract class IgniteTopologyValidatorAbstractTxCacheGroupsTest
+    extends IgniteTopologyValidatorCacheGroupsAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return TRANSACTIONAL;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected NearCacheConfiguration nearConfiguration() {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testTopologyValidator() throws Exception {
+        try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, 
REPEATABLE_READ)) {
+            putValid(CACHE_NAME_1);
+            putValid(CACHE_NAME_3);
+            commitFailed(tx);
+        }
+
+        assertEmpty(CACHE_NAME_1); // rolled back
+        assertEmpty(CACHE_NAME_3); // rolled back
+
+        try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, 
REPEATABLE_READ)) {
+            putInvalid(CACHE_NAME_1);
+        }
+
+        try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, 
REPEATABLE_READ)) {
+            putInvalid(CACHE_NAME_3);
+        }
+
+        try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, 
REPEATABLE_READ)) {
+            putValid(DEFAULT_CACHE_NAME);
+            putInvalid(CACHE_NAME_1);
+        }
+
+        assertEmpty(DEFAULT_CACHE_NAME); // rolled back
+
+        startGrid(1);
+
+        try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, 
REPEATABLE_READ)) {
+            putValid(CACHE_NAME_1);
+            putValid(CACHE_NAME_3);
+            tx.commit();
+        }
+
+        remove(CACHE_NAME_1);
+        remove(CACHE_NAME_3);
+
+        try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, 
REPEATABLE_READ)) {
+            putValid(CACHE_NAME_1);
+            putValid(CACHE_NAME_3);
+            tx.commit();
+        }
+
+        remove(CACHE_NAME_1);
+        remove(CACHE_NAME_3);
+
+        startGrid(2);
+
+        try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, 
REPEATABLE_READ)) {
+            putValid(CACHE_NAME_3);
+            putInvalid(CACHE_NAME_1);
+        }
+
+        assertEmpty(CACHE_NAME_3); // rolled back
+
+        try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, 
REPEATABLE_READ)) {
+            putValid(CACHE_NAME_1);
+            putValid(CACHE_NAME_3);
+            commitFailed(tx);
+        }
+
+        assertEmpty(CACHE_NAME_1); // rolled back
+        assertEmpty(CACHE_NAME_3); // rolled back
+
+        try (Transaction tx = grid(0).transactions().txStart(OPTIMISTIC, 
REPEATABLE_READ)) {
+            putValid(DEFAULT_CACHE_NAME);
+            putValid(CACHE_NAME_3);
+            tx.commit();
+        }
+
+        remove(DEFAULT_CACHE_NAME);
+        remove(CACHE_NAME_3);
+
+        try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, 
REPEATABLE_READ)) {
+            putValid(DEFAULT_CACHE_NAME);
+            putValid(CACHE_NAME_3);
+            tx.commit();
+        }
+
+        remove(DEFAULT_CACHE_NAME);
+        remove(CACHE_NAME_3);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorCacheGroupsAbstractTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorCacheGroupsAbstractTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorCacheGroupsAbstractTest.java
new file mode 100644
index 0000000..3070d9d
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorCacheGroupsAbstractTest.java
@@ -0,0 +1,131 @@
+/*
+ * 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 java.util.Collection;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.TopologyValidator;
+import org.apache.ignite.internal.util.typedef.F;
+
+/**
+ *
+ */
+public abstract class IgniteTopologyValidatorCacheGroupsAbstractTest extends 
IgniteTopologyValidatorAbstractCacheTest {
+    /** group name 1. */
+    protected static final String GROUP_1 = "group1";
+
+    /** group name 2. */
+    protected static final String GROUP_2 = "group2";
+
+    /** cache name 3. */
+    protected static String CACHE_NAME_3 = "cache3";
+
+    /** cache name 4. */
+    protected static String CACHE_NAME_4 = "cache4";
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String 
igniteInstanceName) throws Exception {
+        IgniteConfiguration icfg = super.getConfiguration(igniteInstanceName);
+
+        CacheConfiguration[] ccfgs = icfg.getCacheConfiguration();
+
+        TopologyValidator val1 = new TopologyValidator() {
+            @Override public boolean validate(Collection<ClusterNode> nodes) {
+                return nodes.size() == 2;
+            }
+        };
+
+        TopologyValidator val2 = new TopologyValidator() {
+            @Override public boolean validate(Collection<ClusterNode> nodes) {
+                return nodes.size() >= 2;
+            }
+        };
+
+        for (CacheConfiguration ccfg : ccfgs) {
+            if (CACHE_NAME_1.equals(ccfg.getName()) || 
CACHE_NAME_2.equals(ccfg.getName()))
+                ccfg.setGroupName(GROUP_1).setTopologyValidator(val1);
+        }
+
+        CacheConfiguration ccfg3 = cacheConfiguration(igniteInstanceName)
+            .setName(CACHE_NAME_3)
+            .setGroupName(GROUP_2)
+            .setTopologyValidator(val2);
+
+        CacheConfiguration ccfg4 = cacheConfiguration(igniteInstanceName)
+            .setName(CACHE_NAME_4)
+            .setGroupName(GROUP_2)
+            .setTopologyValidator(val2);
+
+        return icfg.setCacheConfiguration(F.concat(ccfgs, ccfg3, ccfg4));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTopologyValidator() throws Exception {
+        putValid(DEFAULT_CACHE_NAME);
+        remove(DEFAULT_CACHE_NAME);
+
+        putInvalid(CACHE_NAME_1);
+        removeInvalid(CACHE_NAME_1);
+
+        putInvalid(CACHE_NAME_2);
+        removeInvalid(CACHE_NAME_2);
+
+        putInvalid(CACHE_NAME_3);
+        removeInvalid(CACHE_NAME_3);
+
+        putInvalid(CACHE_NAME_4);
+        removeInvalid(CACHE_NAME_4);
+
+        startGrid(1);
+
+        putValid(DEFAULT_CACHE_NAME);
+        remove(DEFAULT_CACHE_NAME);
+
+        putValid(CACHE_NAME_1);
+
+        putValid(CACHE_NAME_2);
+        remove(CACHE_NAME_2);
+
+        putValid(CACHE_NAME_3);
+
+        putValid(CACHE_NAME_4);
+        remove(CACHE_NAME_4);
+
+        startGrid(2);
+
+        putValid(DEFAULT_CACHE_NAME);
+        remove(DEFAULT_CACHE_NAME);
+
+        getInvalid(CACHE_NAME_1);
+        putInvalid(CACHE_NAME_1);
+        removeInvalid(CACHE_NAME_1);
+
+        putInvalid(CACHE_NAME_2);
+        removeInvalid(CACHE_NAME_2);
+
+        remove(CACHE_NAME_3);
+        putValid(CACHE_NAME_3);
+
+        putValid(CACHE_NAME_4);
+        remove(CACHE_NAME_4);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorNearPartitionedAtomicCacheGroupsTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorNearPartitionedAtomicCacheGroupsTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorNearPartitionedAtomicCacheGroupsTest.java
new file mode 100644
index 0000000..185c18f
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorNearPartitionedAtomicCacheGroupsTest.java
@@ -0,0 +1,31 @@
+/*
+ *  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.configuration.NearCacheConfiguration;
+
+/**
+ * Topology validator test.
+ */
+public class IgniteTopologyValidatorNearPartitionedAtomicCacheGroupsTest 
extends
+    IgniteTopologyValidatorPartitionedAtomicCacheGroupsTest {
+    /** {@inheritDoc} */
+    @Override protected NearCacheConfiguration nearConfiguration() {
+        return new NearCacheConfiguration();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorNearPartitionedTxCacheGroupsTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorNearPartitionedTxCacheGroupsTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorNearPartitionedTxCacheGroupsTest.java
new file mode 100644
index 0000000..acfad80
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorNearPartitionedTxCacheGroupsTest.java
@@ -0,0 +1,31 @@
+/*
+ *  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.configuration.NearCacheConfiguration;
+
+/**
+ * Topology validator test.
+ */
+public class IgniteTopologyValidatorNearPartitionedTxCacheGroupsTest extends
+    IgniteTopologyValidatorPartitionedTxCacheGroupsTest {
+    /** {@inheritDoc} */
+    @Override protected NearCacheConfiguration nearConfiguration() {
+        return new NearCacheConfiguration();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorPartitionedAtomicCacheGroupsTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorPartitionedAtomicCacheGroupsTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorPartitionedAtomicCacheGroupsTest.java
new file mode 100644
index 0000000..f063a74
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorPartitionedAtomicCacheGroupsTest.java
@@ -0,0 +1,45 @@
+/*
+ *  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.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+
+/**
+ * Topology validator test.
+ */
+public class IgniteTopologyValidatorPartitionedAtomicCacheGroupsTest extends
+    IgniteTopologyValidatorCacheGroupsAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.PARTITIONED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return ATOMIC;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected NearCacheConfiguration nearConfiguration() {
+        return null;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorPartitionedTxCacheGroupsTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorPartitionedTxCacheGroupsTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorPartitionedTxCacheGroupsTest.java
new file mode 100644
index 0000000..d39d00d
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorPartitionedTxCacheGroupsTest.java
@@ -0,0 +1,31 @@
+/*
+ *  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.CacheMode;
+
+/**
+ * Topology validator test.
+ */
+public class IgniteTopologyValidatorPartitionedTxCacheGroupsTest extends
+    IgniteTopologyValidatorAbstractTxCacheGroupsTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.PARTITIONED;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorReplicatedAtomicCacheGroupsTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorReplicatedAtomicCacheGroupsTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorReplicatedAtomicCacheGroupsTest.java
new file mode 100644
index 0000000..d7993e0
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorReplicatedAtomicCacheGroupsTest.java
@@ -0,0 +1,45 @@
+/*
+ *  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.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+
+/**
+ * Topology validator test.
+ */
+public class IgniteTopologyValidatorReplicatedAtomicCacheGroupsTest extends
+    IgniteTopologyValidatorCacheGroupsAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.REPLICATED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return ATOMIC;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected NearCacheConfiguration nearConfiguration() {
+        return null;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorReplicatedTxCacheGroupsTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorReplicatedTxCacheGroupsTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorReplicatedTxCacheGroupsTest.java
new file mode 100644
index 0000000..26628f3
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorReplicatedTxCacheGroupsTest.java
@@ -0,0 +1,31 @@
+/*
+ *  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.CacheMode;
+
+/**
+ * Topology validator test.
+ */
+public class IgniteTopologyValidatorReplicatedTxCacheGroupsTest extends
+    IgniteTopologyValidatorAbstractTxCacheGroupsTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.REPLICATED;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGroupsPartitionLossPolicySelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGroupsPartitionLossPolicySelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGroupsPartitionLossPolicySelfTest.java
new file mode 100644
index 0000000..1862553
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGroupsPartitionLossPolicySelfTest.java
@@ -0,0 +1,355 @@
+/*
+ * 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.distributed;
+
+import java.util.Collection;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.TimeUnit;
+import javax.cache.CacheException;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.PartitionLossPolicy;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.events.CacheRebalancingEvent;
+import org.apache.ignite.events.Event;
+import org.apache.ignite.events.EventType;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.P1;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ *
+ */
+public class IgniteCacheGroupsPartitionLossPolicySelfTest extends 
GridCommonAbstractTest {
+    /** */
+    private static final TcpDiscoveryIpFinder ipFinder = new 
TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    private boolean client;
+
+    /** */
+    private PartitionLossPolicy partLossPlc;
+
+    /** */
+    private static final String GROUP_NAME = "group";
+
+    /** */
+    private static final String CACHE_1 = "cache1";
+
+    /** */
+    private static final String CACHE_2 = "cache2";
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+        cfg.setClientMode(client);
+
+        CacheConfiguration ccfg1 = new CacheConfiguration(CACHE_1)
+            .setGroupName(GROUP_NAME)
+            .setCacheMode(PARTITIONED)
+            .setBackups(0)
+            .setWriteSynchronizationMode(FULL_SYNC)
+            .setPartitionLossPolicy(partLossPlc)
+            .setAffinity(new RendezvousAffinityFunction(false, 32));
+
+        CacheConfiguration ccfg2 = new CacheConfiguration(ccfg1)
+            .setName(CACHE_2);
+
+        cfg.setCacheConfiguration(ccfg1, ccfg2);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testReadOnlySafe() throws Exception {
+        partLossPlc = PartitionLossPolicy.READ_ONLY_SAFE;
+
+        checkLostPartition(false, true);
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testReadOnlyAll() throws Exception {
+        partLossPlc = PartitionLossPolicy.READ_ONLY_ALL;
+
+        checkLostPartition(false, false);
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testReadWriteSafe() throws Exception {
+        partLossPlc = PartitionLossPolicy.READ_WRITE_SAFE;
+
+        checkLostPartition(true, true);
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testReadWriteAll() throws Exception {
+        partLossPlc = PartitionLossPolicy.READ_WRITE_ALL;
+
+        checkLostPartition(true, false);
+    }
+
+    /**
+     * @throws Exception if failed.
+     */
+    public void testIgnore() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-5078";);
+
+        prepareTopology();
+
+        String cacheName = ThreadLocalRandom.current().nextBoolean() ? CACHE_1 
: CACHE_2;
+
+        for (Ignite ig : G.allGrids()) {
+            IgniteCache<Integer, Integer> cache = ig.cache(cacheName);
+
+            Collection<Integer> lost = cache.lostPartitions();
+
+            assertTrue("[grid=" + ig.name() + ", lost=" + lost.toString() + 
']', lost.isEmpty());
+
+            int parts = ig.affinity(cacheName).partitions();
+
+            for (int i = 0; i < parts; i++) {
+                cache.get(i);
+
+                cache.put(i, i);
+            }
+        }
+    }
+
+    /**
+     * @param canWrite {@code True} if writes are allowed.
+     * @param safe {@code True} if lost partition should trigger exception.
+     * @throws Exception if failed.
+     */
+    private void checkLostPartition(boolean canWrite, boolean safe) throws 
Exception {
+        assert partLossPlc != null;
+
+        String cacheName = ThreadLocalRandom.current().nextBoolean() ? CACHE_1 
: CACHE_2;
+
+        int part = prepareTopology();
+
+        for (Ignite ig : G.allGrids()) {
+            info("Checking node: " + ig.cluster().localNode().id());
+
+            verifyCacheOps(cacheName, canWrite, safe, part, ig);
+
+            IgniteCache<Integer, Integer> cache = ig.cache(cacheName);
+
+            // Check we can read and write to lost partition in recovery mode.
+            IgniteCache<Integer, Integer> recoverCache = 
cache.withPartitionRecover();
+
+            for (int lostPart : recoverCache.lostPartitions()) {
+                recoverCache.get(lostPart);
+                recoverCache.put(lostPart, lostPart);
+            }
+
+            // Check that writing in recover mode does not clear partition 
state.
+            verifyCacheOps(cacheName, canWrite, safe, part, ig);
+        }
+
+        // Check that partition state does not change after we start a new 
node.
+        IgniteEx grd = startGrid(3);
+
+        info("Newly started node: " + grd.cluster().localNode().id());
+
+        for (Ignite ig : G.allGrids())
+            verifyCacheOps(cacheName, canWrite, safe, part, ig);
+
+        ignite(0).resetLostPartitions(F.asList(CACHE_1, CACHE_2));
+
+        awaitPartitionMapExchange(true, true, null);
+
+        for (Ignite ig : G.allGrids()) {
+            IgniteCache<Integer, Integer> cache = ig.cache(cacheName);
+
+            assertTrue(cache.lostPartitions().isEmpty());
+
+            int parts = ig.affinity(cacheName).partitions();
+
+            for (int i = 0; i < parts; i++) {
+                cache.get(i);
+
+                cache.put(i, i);
+            }
+        }
+    }
+
+    /**
+     *
+     * @param canWrite {@code True} if writes are allowed.
+     * @param safe {@code True} if lost partition should trigger exception.
+     * @param part Lost partition ID.
+     * @param ig Ignite instance.
+     */
+    private void verifyCacheOps(String cacheName, boolean canWrite, boolean 
safe, int part, Ignite ig) {
+        IgniteCache<Integer, Integer> cache = ig.cache(cacheName);
+
+        Collection<Integer> lost = cache.lostPartitions();
+
+        assertTrue("Failed to find expected lost partition [exp=" + part + ", 
lost=" + lost + ']',
+            lost.contains(part));
+
+        int parts = ig.affinity(cacheName).partitions();
+
+        // Check read.
+        for (int i = 0; i < parts; i++) {
+            try {
+                Integer actual = cache.get(i);
+
+                if (cache.lostPartitions().contains(i)) {
+                    if (safe)
+                        fail("Reading from a lost partition should have 
failed: " + i);
+                    // else we could have read anything.
+                }
+                else
+                    assertEquals((Integer)i, actual);
+            }
+            catch (CacheException e) {
+                assertTrue("Read exception should only be triggered in safe 
mode: " + e, safe);
+                assertTrue("Read exception should only be triggered for a lost 
partition " +
+                    "[ex=" + e + ", part=" + i + ']', 
cache.lostPartitions().contains(i));
+            }
+        }
+
+        // Check write.
+        for (int i = 0; i < parts; i++) {
+            try {
+                cache.put(i, i);
+
+                assertTrue("Write in read-only mode should be forbidden: " + 
i, canWrite);
+
+                if (cache.lostPartitions().contains(i))
+                    assertFalse("Writing to a lost partition should have 
failed: " + i, safe);
+            }
+            catch (CacheException e) {
+                if (canWrite) {
+                    assertTrue("Write exception should only be triggered in 
safe mode: " + e, safe);
+                    assertTrue("Write exception should only be triggered for a 
lost partition: " + e,
+                        cache.lostPartitions().contains(i));
+                }
+                // else expected exception regardless of partition.
+            }
+        }
+    }
+
+    /**
+     * @return Lost partition ID.
+     * @throws Exception If failed.
+     */
+    private int prepareTopology() throws Exception {
+        startGrids(4);
+
+        final String cacheName = ThreadLocalRandom.current().nextBoolean() ? 
CACHE_1 : CACHE_2;
+
+        Affinity<Object> aff = ignite(0).affinity(cacheName);
+
+        for (int i = 0; i < aff.partitions(); i++) {
+            ignite(0).cache(CACHE_1).put(i, i);
+            ignite(0).cache(CACHE_2).put(i, i);
+        }
+
+        client = true;
+
+        startGrid(4);
+
+        client = false;
+
+        for (int i = 0; i < 5; i++)
+            info(">>> Node [idx=" + i + ", nodeId=" + 
ignite(i).cluster().localNode().id() + ']');
+
+        awaitPartitionMapExchange();
+
+        ClusterNode killNode = ignite(3).cluster().localNode();
+
+        int part = -1;
+
+        for (int i = 0; i < aff.partitions(); i++) {
+            if (aff.isPrimary(killNode, i)) {
+                part = i;
+
+                break;
+            }
+        }
+
+        if (part == -1)
+            throw new IllegalStateException("No partition on node: " + 
killNode);
+
+        final CountDownLatch[] partLost = new CountDownLatch[3];
+
+        // Check events.
+        for (int i = 0; i < 3; i++) {
+            final CountDownLatch latch = new CountDownLatch(1);
+            partLost[i] = latch;
+
+            final int part0 = part;
+
+            grid(i).events().localListen(new P1<Event>() {
+                @Override public boolean apply(Event evt) {
+                    assert evt.type() == 
EventType.EVT_CACHE_REBALANCE_PART_DATA_LOST;
+
+                    CacheRebalancingEvent cacheEvt = 
(CacheRebalancingEvent)evt;
+
+                    if (cacheEvt.partition() == part0 && F.eq(cacheName, 
cacheEvt.cacheName())) {
+                        latch.countDown();
+
+                        // Auto-unsubscribe.
+                        return false;
+                    }
+
+                    return true;
+                }
+            }, EventType.EVT_CACHE_REBALANCE_PART_DATA_LOST);
+        }
+
+        ignite(3).close();
+
+        for (CountDownLatch latch : partLost)
+            assertTrue("Failed to wait for partition LOST event", 
latch.await(10, TimeUnit.SECONDS));
+
+        return part;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
index 7baea2e..18b9258 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
@@ -37,6 +37,7 @@ import 
org.apache.ignite.internal.processors.cache.PartitionsExchangeOnDiscovery
 import 
org.apache.ignite.internal.processors.cache.distributed.CacheLateAffinityAssignmentNodeJoinValidationTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.CacheLateAffinityAssignmentTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.IgniteActiveOnStartNodeJoinValidationSelfTest;
+import 
org.apache.ignite.internal.processors.cache.distributed.IgniteCacheGroupsPartitionLossPolicySelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.IgniteCachePartitionLossPolicySelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.IgniteCacheTxIteratorSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.dht.atomic.IgniteCacheAtomicProtocolTest;
@@ -73,6 +74,7 @@ public class IgniteCacheTestSuite5 extends TestSuite {
         suite.addTestSuite(ClusterStatePartitionedSelfTest.class);
         suite.addTestSuite(ClusterStateReplicatedSelfTest.class);
         suite.addTestSuite(IgniteCachePartitionLossPolicySelfTest.class);
+        suite.addTestSuite(IgniteCacheGroupsPartitionLossPolicySelfTest.class);
 
         suite.addTestSuite(CacheRebalancingSelfTest.class);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteTopologyValidatorTestSuite.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteTopologyValidatorTestSuite.java
 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteTopologyValidatorTestSuite.java
index 58c754e..1c9b852 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteTopologyValidatorTestSuite.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteTopologyValidatorTestSuite.java
@@ -19,11 +19,17 @@ package org.apache.ignite.testsuites;
 
 import junit.framework.TestSuite;
 import 
org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorGridSplitCacheTest;
+import 
org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorNearPartitionedAtomicCacheGroupsTest;
 import 
org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorNearPartitionedAtomicCacheTest;
+import 
org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorNearPartitionedTxCacheGroupsTest;
 import 
org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorNearPartitionedTxCacheTest;
+import 
org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorPartitionedAtomicCacheGroupsTest;
 import 
org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorPartitionedAtomicCacheTest;
+import 
org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorPartitionedTxCacheGroupsTest;
 import 
org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorPartitionedTxCacheTest;
+import 
org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorReplicatedAtomicCacheGroupsTest;
 import 
org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorReplicatedAtomicCacheTest;
+import 
org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorReplicatedTxCacheGroupsTest;
 import 
org.apache.ignite.internal.processors.cache.IgniteTopologyValidatorReplicatedTxCacheTest;
 
 /**
@@ -43,6 +49,14 @@ public class IgniteTopologyValidatorTestSuite extends 
TestSuite {
         suite.addTest(new 
TestSuite(IgniteTopologyValidatorPartitionedTxCacheTest.class));
         suite.addTest(new 
TestSuite(IgniteTopologyValidatorReplicatedAtomicCacheTest.class));
         suite.addTest(new 
TestSuite(IgniteTopologyValidatorReplicatedTxCacheTest.class));
+
+        suite.addTest(new 
TestSuite(IgniteTopologyValidatorNearPartitionedAtomicCacheGroupsTest.class));
+        suite.addTest(new 
TestSuite(IgniteTopologyValidatorNearPartitionedTxCacheGroupsTest.class));
+        suite.addTest(new 
TestSuite(IgniteTopologyValidatorPartitionedAtomicCacheGroupsTest.class));
+        suite.addTest(new 
TestSuite(IgniteTopologyValidatorPartitionedTxCacheGroupsTest.class));
+        suite.addTest(new 
TestSuite(IgniteTopologyValidatorReplicatedAtomicCacheGroupsTest.class));
+        suite.addTest(new 
TestSuite(IgniteTopologyValidatorReplicatedTxCacheGroupsTest.class));
+
         suite.addTest(new 
TestSuite(IgniteTopologyValidatorGridSplitCacheTest.class));
 
         return suite;

http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteCacheGroupsCompareQueryTest.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteCacheGroupsCompareQueryTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteCacheGroupsCompareQueryTest.java
new file mode 100644
index 0000000..5875ee1
--- /dev/null
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteCacheGroupsCompareQueryTest.java
@@ -0,0 +1,45 @@
+/*
+ * 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.query;
+
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import 
org.apache.ignite.internal.processors.query.h2.sql.BaseH2CompareQueryTest;
+
+/**
+ *
+ */
+public class IgniteCacheGroupsCompareQueryTest extends BaseH2CompareQueryTest {
+    /**
+     * Creates new cache configuration.
+     *
+     * @param name Cache name.
+     * @param mode Cache mode.
+     * @param clsK Key class.
+     * @param clsV Value class.
+     * @return Cache configuration.
+     */
+    @Override protected CacheConfiguration cacheConfiguration(String name, 
CacheMode mode, Class<?> clsK, Class<?> clsV) {
+        CacheConfiguration<?,?> cc = super.cacheConfiguration(name, mode, 
clsK, clsV);
+
+        if (ORG.equals(name) || PERS.equals(name) || PURCH.equals(name))
+            cc.setGroupName("group");
+
+        return cc;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteCacheGroupsSqlDistributedJoinSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteCacheGroupsSqlDistributedJoinSelfTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteCacheGroupsSqlDistributedJoinSelfTest.java
new file mode 100644
index 0000000..452c6cf
--- /dev/null
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteCacheGroupsSqlDistributedJoinSelfTest.java
@@ -0,0 +1,30 @@
+/*
+ * 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.query;
+
+import org.apache.ignite.configuration.CacheConfiguration;
+
+/**
+ *
+ */
+public class IgniteCacheGroupsSqlDistributedJoinSelfTest extends 
IgniteSqlDistributedJoinSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheConfiguration cacheConfig(String name, boolean 
partitioned, Class<?>[] idxTypes) {
+        return super.cacheConfig(name, partitioned, 
idxTypes).setGroupName("group");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteCacheGroupsSqlSegmentedIndexMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteCacheGroupsSqlSegmentedIndexMultiNodeSelfTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteCacheGroupsSqlSegmentedIndexMultiNodeSelfTest.java
new file mode 100644
index 0000000..6e535f1
--- /dev/null
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteCacheGroupsSqlSegmentedIndexMultiNodeSelfTest.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.query;
+
+/**
+ *
+ */
+public class IgniteCacheGroupsSqlSegmentedIndexMultiNodeSelfTest extends 
IgniteCacheGroupsSqlSegmentedIndexSelfTest {
+    /** {@inheritDoc} */
+    @Override protected int nodesCount() {
+        return 4;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteCacheGroupsSqlSegmentedIndexSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteCacheGroupsSqlSegmentedIndexSelfTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteCacheGroupsSqlSegmentedIndexSelfTest.java
new file mode 100644
index 0000000..c0a4fb2
--- /dev/null
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteCacheGroupsSqlSegmentedIndexSelfTest.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.query;
+
+import org.apache.ignite.configuration.CacheConfiguration;
+
+/**
+ *
+ */
+public class IgniteCacheGroupsSqlSegmentedIndexSelfTest extends 
IgniteSqlSegmentedIndexSelfTest {
+    /** {@inheritDoc} */
+    @Override protected <K, V> CacheConfiguration<K, V> cacheConfig(String 
name, boolean partitioned, Class<?>... idxTypes) {
+        return super.<K, V>cacheConfig(name, partitioned, 
idxTypes).setGroupName("group");
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Override public void testSegmentedPartitionedWithReplicated() throws 
Exception {
+        log.info("Test is ignored");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlDistributedJoinSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlDistributedJoinSelfTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlDistributedJoinSelfTest.java
index aad4cfb..93fcdb3 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlDistributedJoinSelfTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlDistributedJoinSelfTest.java
@@ -77,7 +77,7 @@ public class IgniteSqlDistributedJoinSelfTest extends 
GridCommonAbstractTest {
      * @param idxTypes Indexed types.
      * @return Cache configuration.
      */
-    private static CacheConfiguration cacheConfig(String name, boolean 
partitioned, Class<?>... idxTypes) {
+    protected CacheConfiguration cacheConfig(String name, boolean partitioned, 
Class<?>... idxTypes) {
         return new CacheConfiguration(DEFAULT_CACHE_NAME)
             .setName(name)
             .setCacheMode(partitioned ? CacheMode.PARTITIONED : 
CacheMode.REPLICATED)

http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/BaseH2CompareQueryTest.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/BaseH2CompareQueryTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/BaseH2CompareQueryTest.java
index 9a3f64d..f9d25d6 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/BaseH2CompareQueryTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/BaseH2CompareQueryTest.java
@@ -60,6 +60,21 @@ public class BaseH2CompareQueryTest extends 
AbstractH2CompareQueryTest {
     /** Purchase count. */
     public static final int PURCH_CNT = PROD_CNT * 5;
 
+    /** */
+    protected static final String ORG = "org";
+
+    /** */
+    protected static final String PERS = "pers";
+
+    /** */
+    protected static final String PURCH = "purch";
+
+    /** */
+    protected static final String PROD = "prod";
+
+    /** */
+    protected static final String ADDR = "addr";
+
     /** Cache org. */
     private static IgniteCache<Integer, Organization> cacheOrg;
 
@@ -80,11 +95,11 @@ public class BaseH2CompareQueryTest extends 
AbstractH2CompareQueryTest {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
         cfg.setCacheConfiguration(
-            cacheConfiguration("org", CacheMode.PARTITIONED, Integer.class, 
Organization.class),
-            cacheConfiguration("pers", CacheMode.PARTITIONED, 
AffinityKey.class, Person.class),
-            cacheConfiguration("purch", CacheMode.PARTITIONED, 
AffinityKey.class, Purchase.class),
-            cacheConfiguration("prod", CacheMode.REPLICATED, Integer.class, 
Product.class),
-            cacheConfiguration("addr", CacheMode.REPLICATED, Integer.class, 
Address.class));
+            cacheConfiguration(ORG, CacheMode.PARTITIONED, Integer.class, 
Organization.class),
+            cacheConfiguration(PERS, CacheMode.PARTITIONED, AffinityKey.class, 
Person.class),
+            cacheConfiguration(PURCH, CacheMode.PARTITIONED, 
AffinityKey.class, Purchase.class),
+            cacheConfiguration(PROD, CacheMode.REPLICATED, Integer.class, 
Product.class),
+            cacheConfiguration(ADDR, CacheMode.REPLICATED, Integer.class, 
Address.class));
 
         return cfg;
     }
@@ -103,11 +118,11 @@ public class BaseH2CompareQueryTest extends 
AbstractH2CompareQueryTest {
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override protected void createCaches() {
-        cacheOrg = jcache(ignite, cacheConfiguration("org", 
CacheMode.PARTITIONED, Integer.class, Organization.class), "org", 
Integer.class, Organization.class);
-        cachePers = ignite.cache("pers");
-        cachePurch = ignite.cache("purch");
-        cacheProd = ignite.cache("prod");
-        cacheAddr = ignite.cache("addr");
+        cacheOrg = jcache(ignite, cacheConfiguration(ORG, 
CacheMode.PARTITIONED, Integer.class, Organization.class), ORG, Integer.class, 
Organization.class);
+        cachePers = ignite.cache(PERS);
+        cachePurch = ignite.cache(PURCH);
+        cacheProd = ignite.cache(PROD);
+        cacheAddr = ignite.cache(ADDR);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/54b69358/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
 
b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
index 5085cd5..4d82bf9 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
@@ -34,6 +34,10 @@ import 
org.apache.ignite.internal.processors.cache.index.DynamicIndexPartitioned
 import 
org.apache.ignite.internal.processors.cache.index.DynamicIndexPartitionedTransactionalConcurrentSelfTest;
 import 
org.apache.ignite.internal.processors.cache.index.DynamicIndexReplicatedAtomicConcurrentSelfTest;
 import 
org.apache.ignite.internal.processors.cache.index.DynamicIndexReplicatedTransactionalConcurrentSelfTest;
+import 
org.apache.ignite.internal.processors.query.IgniteCacheGroupsCompareQueryTest;
+import 
org.apache.ignite.internal.processors.query.IgniteCacheGroupsSqlDistributedJoinSelfTest;
+import 
org.apache.ignite.internal.processors.query.IgniteCacheGroupsSqlSegmentedIndexMultiNodeSelfTest;
+import 
org.apache.ignite.internal.processors.query.IgniteCacheGroupsSqlSegmentedIndexSelfTest;
 import org.apache.ignite.testframework.IgniteTestSuite;
 
 /**
@@ -69,6 +73,11 @@ public class IgniteCacheQuerySelfTestSuite2 extends 
TestSuite {
         
suite.addTestSuite(IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.class);
         suite.addTestSuite(IgniteCacheObjectKeyIndexingSelfTest.class);
 
+        suite.addTestSuite(IgniteCacheGroupsCompareQueryTest.class);
+        suite.addTestSuite(IgniteCacheGroupsSqlSegmentedIndexSelfTest.class);
+        
suite.addTestSuite(IgniteCacheGroupsSqlSegmentedIndexMultiNodeSelfTest.class);
+        suite.addTestSuite(IgniteCacheGroupsSqlDistributedJoinSelfTest.class);
+
         return suite;
     }
 }

Reply via email to