http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalWithGroupFullApiSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalWithGroupFullApiSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalWithGroupFullApiSelfTest.java
new file mode 100644
index 0000000..867a2de
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalWithGroupFullApiSelfTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.local;
+
+import org.apache.ignite.configuration.CacheConfiguration;
+
+/**
+ *
+ */
+public class GridCacheLocalWithGroupFullApiSelfTest extends 
GridCacheLocalFullApiSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheConfiguration cacheConfiguration(String 
igniteInstanceName) throws Exception {
+        CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName);
+
+        ccfg.setGroupName("group1");
+
+        return ccfg;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryConcurrentPartitionUpdateTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryConcurrentPartitionUpdateTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryConcurrentPartitionUpdateTest.java
index 9c7c836..6c74f79 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryConcurrentPartitionUpdateTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryConcurrentPartitionUpdateTest.java
@@ -35,6 +35,7 @@ import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -78,52 +79,74 @@ public class 
CacheContinuousQueryConcurrentPartitionUpdateTest extends GridCommo
      * @throws Exception If failed.
      */
     public void testConcurrentUpdatePartitionAtomic() throws Exception {
-        concurrentUpdatePartition(ATOMIC);
+        concurrentUpdatePartition(ATOMIC, false);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testConcurrentUpdatePartitionTx() throws Exception {
-        concurrentUpdatePartition(TRANSACTIONAL);
+        concurrentUpdatePartition(TRANSACTIONAL, false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testConcurrentUpdatePartitionAtomicCacheGroup() throws 
Exception {
+        concurrentUpdatePartition(ATOMIC, true);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testConcurrentUpdatePartitionTxCacheGroup() throws Exception {
+        concurrentUpdatePartition(TRANSACTIONAL, true);
     }
 
     /**
      * @param atomicityMode Cache atomicity mode.
+     * @param cacheGrp {@code True} if test cache multiple caches in the same 
group.
      * @throws Exception If failed.
      */
-    private void concurrentUpdatePartition(CacheAtomicityMode atomicityMode) 
throws Exception {
+    private void concurrentUpdatePartition(CacheAtomicityMode atomicityMode, 
boolean cacheGrp) throws Exception {
         Ignite srv = startGrid(0);
 
         client = true;
 
         Ignite client = startGrid(1);
 
-        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+        List<AtomicInteger> cntrs = new ArrayList<>();
+        List<String> caches = new ArrayList<>();
 
-        ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicityMode(atomicityMode);
+        if (cacheGrp) {
+            for (int i = 0; i < 3; i++) {
+                CacheConfiguration<Object, Object> ccfg = new 
CacheConfiguration<>(DEFAULT_CACHE_NAME + i);
 
-        IgniteCache clientCache = client.createCache(ccfg);
+                ccfg.setGroupName("testGroup");
+                ccfg.setWriteSynchronizationMode(FULL_SYNC);
+                ccfg.setAtomicityMode(atomicityMode);
 
-        final AtomicInteger evtCnt = new AtomicInteger();
+                IgniteCache<Object, Object> cache = client.createCache(ccfg);
 
-        ContinuousQuery<Object, Object> qry = new ContinuousQuery<>();
-
-        qry.setLocalListener(new CacheEntryUpdatedListener<Object, Object>() {
-            @Override public void onUpdated(Iterable<CacheEntryEvent<?, ?>> 
evts) {
-                for (CacheEntryEvent evt : evts) {
-                    assertNotNull(evt.getKey());
-                    assertNotNull(evt.getValue());
+                caches.add(cache.getName());
 
-                    evtCnt.incrementAndGet();
-                }
+                cntrs.add(startListener(cache).get1());
             }
-        });
+        }
+        else {
+            CacheConfiguration<Object, Object> ccfg = new 
CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
-        clientCache.query(qry);
+            ccfg.setWriteSynchronizationMode(FULL_SYNC);
+            ccfg.setAtomicityMode(atomicityMode);
 
-        Affinity<Integer> aff = srv.affinity(DEFAULT_CACHE_NAME);
+            IgniteCache<Object, Object> cache = client.createCache(ccfg);
+
+            caches.add(cache.getName());
+
+            cntrs.add(startListener(cache).get1());
+        }
+
+        Affinity<Integer> aff = srv.affinity(caches.get(0));
 
         final List<Integer> keys = new ArrayList<>();
 
@@ -143,7 +166,10 @@ public class 
CacheContinuousQueryConcurrentPartitionUpdateTest extends GridCommo
         final int THREADS = 10;
         final int UPDATES = 1000;
 
-        final IgniteCache<Object, Object> srvCache = 
srv.cache(DEFAULT_CACHE_NAME);
+        final List<IgniteCache<Object, Object>> srvCaches = new ArrayList<>();
+
+        for (String cacheName : caches)
+            srvCaches.add(srv.cache(cacheName));
 
         for (int i = 0; i < 15; i++) {
             log.info("Iteration: " + i);
@@ -152,60 +178,124 @@ public class 
CacheContinuousQueryConcurrentPartitionUpdateTest extends GridCommo
                 @Override public Void call() throws Exception {
                     ThreadLocalRandom rnd = ThreadLocalRandom.current();
 
-                    for (int i = 0; i < UPDATES; i++)
-                        srvCache.put(keys.get(rnd.nextInt(KEYS)), i);
+                    for (int i = 0; i < UPDATES; i++) {
+                        for (int c = 0; c < srvCaches.size(); c++)
+                            srvCaches.get(c).put(keys.get(rnd.nextInt(KEYS)), 
i);
+                    }
 
                     return null;
                 }
             }, THREADS, "update");
 
-            GridTestUtils.waitForCondition(new GridAbsPredicate() {
-                @Override public boolean apply() {
-                    log.info("Events: " + evtCnt.get());
+            for (final AtomicInteger evtCnt : cntrs) {
+                GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                    @Override public boolean apply() {
+                        log.info("Events: " + evtCnt.get());
 
-                    return evtCnt.get() >= THREADS * UPDATES;
-                }
-            }, 5000);
+                        return evtCnt.get() >= THREADS * UPDATES;
+                    }
+                }, 5000);
 
-            assertEquals(THREADS * UPDATES, evtCnt.get());
+                assertEquals(THREADS * UPDATES, evtCnt.get());
 
-            evtCnt.set(0);
+                evtCnt.set(0);
+            }
         }
     }
 
     /**
+     * @param cache Cache.
+     * @return Event counter.
+     */
+    private T2<AtomicInteger, QueryCursor> startListener(IgniteCache<Object, 
Object> cache) {
+        final AtomicInteger evtCnt = new AtomicInteger();
+
+        ContinuousQuery<Object, Object> qry = new ContinuousQuery<>();
+
+        qry.setLocalListener(new CacheEntryUpdatedListener<Object, Object>() {
+            @Override public void onUpdated(Iterable<CacheEntryEvent<?, ?>> 
evts) {
+                for (CacheEntryEvent evt : evts) {
+                    assertNotNull(evt.getKey());
+                    assertNotNull(evt.getValue());
+
+                    if ((Integer)evt.getValue() >= 0)
+                        evtCnt.incrementAndGet();
+                }
+            }
+        });
+
+        QueryCursor cur = cache.query(qry);
+
+        return new T2<>(evtCnt, cur);
+    }
+
+    /**
      * @throws Exception If failed.
      */
     public void testConcurrentUpdatesAndQueryStartAtomic() throws Exception {
-        concurrentUpdatesAndQueryStart(ATOMIC);
+        concurrentUpdatesAndQueryStart(ATOMIC, false);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testConcurrentUpdatesAndQueryStartTx() throws Exception {
-        concurrentUpdatesAndQueryStart(TRANSACTIONAL);
+        concurrentUpdatesAndQueryStart(TRANSACTIONAL, false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void _testConcurrentUpdatesAndQueryStartAtomicCacheGroup() throws 
Exception {
+        concurrentUpdatesAndQueryStart(ATOMIC, true);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void _testConcurrentUpdatesAndQueryStartTxCacheGroup() throws 
Exception {
+        concurrentUpdatesAndQueryStart(TRANSACTIONAL, true);
     }
 
     /**
      * @param atomicityMode Cache atomicity mode.
+     * @param cacheGrp {@code True} if test cache multiple caches in the same 
group.
      * @throws Exception If failed.
      */
-    private void concurrentUpdatesAndQueryStart(CacheAtomicityMode 
atomicityMode) throws Exception {
+    private void concurrentUpdatesAndQueryStart(CacheAtomicityMode 
atomicityMode, boolean cacheGrp) throws Exception {
         Ignite srv = startGrid(0);
 
         client = true;
 
         Ignite client = startGrid(1);
 
-        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
+        List<String> caches = new ArrayList<>();
+
+        if (cacheGrp) {
+            for (int i = 0; i < 3; i++) {
+                CacheConfiguration ccfg = new 
CacheConfiguration(DEFAULT_CACHE_NAME + i);
 
-        ccfg.setWriteSynchronizationMode(FULL_SYNC);
-        ccfg.setAtomicityMode(atomicityMode);
+                ccfg.setGroupName("testGroup");
+                ccfg.setWriteSynchronizationMode(FULL_SYNC);
+                ccfg.setAtomicityMode(atomicityMode);
 
-        IgniteCache clientCache = client.createCache(ccfg);
+                IgniteCache cache = client.createCache(ccfg);
 
-        Affinity<Integer> aff = srv.affinity(DEFAULT_CACHE_NAME);
+                caches.add(cache.getName());
+            }
+        }
+        else {
+            CacheConfiguration ccfg = new 
CacheConfiguration(DEFAULT_CACHE_NAME);
+
+            ccfg.setWriteSynchronizationMode(FULL_SYNC);
+            ccfg.setAtomicityMode(atomicityMode);
+
+            IgniteCache cache = client.createCache(ccfg);
+
+            caches.add(cache.getName());
+        }
+
+        Affinity<Integer> aff = srv.affinity(caches.get(0));
 
         final List<Integer> keys = new ArrayList<>();
 
@@ -225,38 +315,27 @@ public class 
CacheContinuousQueryConcurrentPartitionUpdateTest extends GridCommo
         final int THREADS = 10;
         final int UPDATES = 1000;
 
-        for (int i = 0; i < 5; i++) {
-            log.info("Iteration: " + i);
-
-            ContinuousQuery<Object, Object> qry = new ContinuousQuery<>();
-
-            final AtomicInteger evtCnt = new AtomicInteger();
-
-            qry.setLocalListener(new CacheEntryUpdatedListener<Object, 
Object>() {
-                @Override public void onUpdated(Iterable<CacheEntryEvent<?, 
?>> evts) {
-                    for (CacheEntryEvent evt : evts) {
-                        assertNotNull(evt.getKey());
-                        assertNotNull(evt.getValue());
+        final List<IgniteCache<Object, Object>> srvCaches = new ArrayList<>();
 
-                        if ((Integer)evt.getValue() >= 0)
-                            evtCnt.incrementAndGet();
-                    }
-                }
-            });
-
-            QueryCursor cur;
+        for (String cacheName : caches)
+            srvCaches.add(srv.cache(cacheName));
 
-            final IgniteCache<Object, Object> srvCache = 
srv.cache(DEFAULT_CACHE_NAME);
+        for (int i = 0; i < 5; i++) {
+            log.info("Iteration: " + i);
 
             final AtomicBoolean stop = new AtomicBoolean();
 
+            List<T2<AtomicInteger, QueryCursor> > qrys = new ArrayList<>();
+
             try {
                 IgniteInternalFuture fut = 
GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
                     @Override public Void call() throws Exception {
                         ThreadLocalRandom rnd = ThreadLocalRandom.current();
 
-                        while (!stop.get())
-                            srvCache.put(keys.get(rnd.nextInt(KEYS)), 
rnd.nextInt(100) - 200);
+                        while (!stop.get()) {
+                            for (IgniteCache<Object, Object> srvCache : 
srvCaches)
+                                srvCache.put(keys.get(rnd.nextInt(KEYS)), 
rnd.nextInt(100) - 200);
+                        }
 
                         return null;
                     }
@@ -264,7 +343,8 @@ public class 
CacheContinuousQueryConcurrentPartitionUpdateTest extends GridCommo
 
                 U.sleep(1000);
 
-                cur = clientCache.query(qry);
+                for (String cache : caches)
+                    qrys.add(startListener(client.cache(cache)));
 
                 U.sleep(1000);
 
@@ -280,25 +360,30 @@ public class 
CacheContinuousQueryConcurrentPartitionUpdateTest extends GridCommo
                 @Override public Void call() throws Exception {
                     ThreadLocalRandom rnd = ThreadLocalRandom.current();
 
-                    for (int i = 0; i < UPDATES; i++)
-                        srvCache.put(keys.get(rnd.nextInt(KEYS)), i);
+                    for (int i = 0; i < UPDATES; i++) {
+                        for (IgniteCache<Object, Object> srvCache : srvCaches)
+                            srvCache.put(keys.get(rnd.nextInt(KEYS)), i);
+                    }
 
                     return null;
                 }
             }, THREADS, "update");
 
+            for (T2<AtomicInteger, QueryCursor>  qry : qrys) {
+                final AtomicInteger evtCnt = qry.get1();
 
-            GridTestUtils.waitForCondition(new GridAbsPredicate() {
-                @Override public boolean apply() {
-                    log.info("Events: " + evtCnt.get());
+                GridTestUtils.waitForCondition(new GridAbsPredicate() {
+                    @Override public boolean apply() {
+                        log.info("Events: " + evtCnt.get());
 
-                    return evtCnt.get() >= THREADS * UPDATES;
-                }
-            }, 5000);
+                        return evtCnt.get() >= THREADS * UPDATES;
+                    }
+                }, 5000);
 
-            assertEquals(THREADS * UPDATES, evtCnt.get());
+                assertEquals(THREADS * UPDATES, qry.get1().get());
 
-            cur.close();
+                qry.get2().close();
+            }
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
index 2fb7fcb..54791d7 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryFailoverAbstractSelfTest.java
@@ -2243,13 +2243,11 @@ public abstract class 
CacheContinuousQueryFailoverAbstractSelfTest extends GridC
      * @throws Exception If failed.
      */
     public void testNoEventLossOnTopologyChange() throws Exception {
-        final int stableNodeCnt = 1;
-
         final int batchLoadSize = 2000;
 
         final int restartCycles = 5;
 
-        Ignite qryClient = startGridsMultiThreaded(stableNodeCnt);
+        Ignite qryClient = startGrid(0);
 
         final CacheEventListener4 lsnr = new 
CacheEventListener4(atomicityMode() == CacheAtomicityMode.ATOMIC);
 
@@ -2282,7 +2280,7 @@ public abstract class 
CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
                 log.info("Batch loaded. Iteration: " + iteration);
 
-                final long expCnt = putCnt * stableNodeCnt + ignoredDupEvts;
+                final long expCnt = putCnt + ignoredDupEvts;
 
                 GridTestUtils.waitForCondition(new GridAbsPredicate() {
                     @Override public boolean apply() {
@@ -2316,7 +2314,6 @@ public abstract class 
CacheContinuousQueryFailoverAbstractSelfTest extends GridC
                     String msg = sb.toString();
 
                     // In atomic mode CQ can receive duplicate update events 
if update retried after fails.
-                    // E.g. topology change
                     if (atomicityMode() == CacheAtomicityMode.ATOMIC && 
msg.isEmpty() && cnt > expCnt)
                         ignoredDupEvts += cnt - expCnt;
                     else

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxOptimisticDeadlockDetectionTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxOptimisticDeadlockDetectionTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxOptimisticDeadlockDetectionTest.java
index b48c4ba..1573576 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxOptimisticDeadlockDetectionTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxOptimisticDeadlockDetectionTest.java
@@ -399,7 +399,7 @@ public class TxOptimisticDeadlockDetectionTest extends 
GridCommonAbstractTest {
 
                 KeyCacheObject keyCacheObj = 
intCache.context().toCacheKeyObject(key0);
 
-                GridCacheMapEntry entry = map.getEntry(keyCacheObj);
+                GridCacheMapEntry entry = map.getEntry(intCache.context(), 
keyCacheObj);
 
                 if (entry != null)
                     assertNull("Entry still has locks " + entry, 
entry.mvccAllLocal());

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionTest.java
index bc297a2..61f7125 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionTest.java
@@ -408,7 +408,7 @@ public class TxPessimisticDeadlockDetectionTest extends 
GridCommonAbstractTest {
 
                 KeyCacheObject keyCacheObj = 
intCache.context().toCacheKeyObject(key0);
 
-                GridCacheMapEntry entry = map.getEntry(keyCacheObj);
+                GridCacheMapEntry entry = map.getEntry(intCache.context(), 
keyCacheObj);
 
                 if (entry != null)
                     assertNull("Entry still has locks " + entry, 
entry.mvccAllLocal());

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
 
b/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
index 2096179..44a075e 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/loadtests/hashmap/GridCacheTestContext.java
@@ -79,14 +79,11 @@ public class GridCacheTestContext<K, V> extends 
GridCacheContext<K, V> {
                 null
             ),
             defaultCacheConfiguration(),
+            null,
             CacheType.USER,
             AffinityTopologyVersion.ZERO,
-            UUID.randomUUID(),
             true,
             true,
-            null,
-            null,
-            null,
             new GridCacheEventManager(),
             new CacheOsStoreManager(null, new CacheConfiguration()),
             new GridCacheEvictionManager(),
@@ -95,7 +92,6 @@ public class GridCacheTestContext<K, V> extends 
GridCacheContext<K, V> {
             new CacheDataStructuresManager(),
             new GridCacheTtlManager(),
             new GridOsCacheDrManager(),
-            null,
             new CacheOsConflictResolutionManager<K, V>(),
             new CachePluginManager(ctx, new CacheConfiguration()),
             new GridCacheAffinityManager()

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java
index 25ff2fd..4a6b765 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/spi/communication/GridCacheMessageSelfTest.java
@@ -216,6 +216,16 @@ public class GridCacheMessageSelfTest extends 
GridCommonAbstractTest {
         }
 
         /** {@inheritDoc} */
+        @Override public int handlerId() {
+            return 0;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean cacheGroupMessage() {
+            return false;
+        }
+
+        /** {@inheritDoc} */
         @Override public boolean addDeploymentInfo() {
             return false;
         }
@@ -311,6 +321,16 @@ public class GridCacheMessageSelfTest extends 
GridCommonAbstractTest {
         }
 
         /** {@inheritDoc} */
+        @Override public int handlerId() {
+            return 0;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean cacheGroupMessage() {
+            return false;
+        }
+
+        /** {@inheritDoc} */
         @Override public boolean addDeploymentInfo() {
             return false;
         }
@@ -434,6 +454,16 @@ public class GridCacheMessageSelfTest extends 
GridCommonAbstractTest {
         }
 
         /** {@inheritDoc} */
+        @Override public int handlerId() {
+            return 0;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean cacheGroupMessage() {
+            return false;
+        }
+
+        /** {@inheritDoc} */
         @Override public boolean addDeploymentInfo() {
             return false;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
 
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
index 1f096e4..a5a2401 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java
@@ -68,6 +68,7 @@ import org.apache.ignite.internal.binary.BinaryContext;
 import org.apache.ignite.internal.binary.BinaryEnumCache;
 import org.apache.ignite.internal.binary.BinaryMarshaller;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheGroupContext;
 import 
org.apache.ignite.internal.processors.resource.GridSpringResourceContext;
 import org.apache.ignite.internal.util.GridClassLoaderCache;
 import org.apache.ignite.internal.util.GridTestClockTimer;
@@ -2117,6 +2118,22 @@ public abstract class GridAbstractTest extends TestCase {
     }
 
     /**
+     * @param node Node.
+     * @param cacheName Cache name.
+     * @return Cache group ID for given cache name.
+     */
+    protected final int groupIdForCache(Ignite node, String cacheName) {
+        for (CacheGroupContext grp : 
((IgniteKernal)node).context().cache().cacheGroups()) {
+            if (grp.hasCache(cacheName))
+                return grp.groupId();
+        }
+
+        fail("Failed to find group for cache: " + cacheName);
+
+        return 0;
+    }
+
+    /**
      *
      */
     private static interface WriteReplaceOwner {

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
 
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
index cf68c3c..306e298 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/common/GridCommonAbstractTest.java
@@ -65,6 +65,8 @@ import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import 
org.apache.ignite.internal.processors.affinity.GridAffinityFunctionContextImpl;
+import org.apache.ignite.internal.processors.cache.CacheGroupDescriptor;
+import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
 import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.GridCacheExplicitLockSpan;
@@ -1731,4 +1733,66 @@ public abstract class GridCommonAbstractTest extends 
GridAbstractTest {
 
         return U.field(tm, "completedVersHashMap");
     }
+
+    /**
+     *
+     */
+    protected final void checkCacheDiscoveryDataConsistent() {
+        Map<Integer, CacheGroupDescriptor> cacheGrps = null;
+        Map<String, DynamicCacheDescriptor> caches = null;
+
+        for (Ignite node : G.allGrids()) {
+            Map<Integer, CacheGroupDescriptor> cacheGrps0 =
+                ((IgniteKernal)node).context().cache().cacheGroupDescriptors();
+            Map<String, DynamicCacheDescriptor> caches0 =
+                ((IgniteKernal)node).context().cache().cacheDescriptors();
+
+            assertNotNull(cacheGrps0);
+            assertNotNull(caches0);
+
+            if (cacheGrps == null) {
+                cacheGrps = cacheGrps0;
+                caches = caches0;
+            }
+            else {
+                assertEquals(cacheGrps.size(), cacheGrps0.size());
+
+                for (Map.Entry<Integer, CacheGroupDescriptor> e : 
cacheGrps.entrySet()) {
+                    CacheGroupDescriptor desc = e.getValue();
+                    CacheGroupDescriptor desc0 = cacheGrps0.get(e.getKey());
+
+                    assertNotNull(desc0);
+                    checkGroupDescriptorsData(desc, desc0);
+                }
+
+                for (Map.Entry<String, DynamicCacheDescriptor> e : 
caches.entrySet()) {
+                    DynamicCacheDescriptor desc = e.getValue();
+                    DynamicCacheDescriptor desc0 = caches.get(e.getKey());
+
+                    assertNotNull(desc0);
+                    assertEquals(desc.deploymentId(), desc0.deploymentId());
+                    assertEquals(desc.receivedFrom(), desc0.receivedFrom());
+                    assertEquals(desc.startTopologyVersion(), 
desc0.startTopologyVersion());
+                    assertEquals(desc.cacheConfiguration().getName(), 
desc0.cacheConfiguration().getName());
+                    assertEquals(desc.cacheConfiguration().getGroupName(), 
desc0.cacheConfiguration().getGroupName());
+                    checkGroupDescriptorsData(desc.groupDescriptor(), 
desc0.groupDescriptor());
+                }
+            }
+        }
+    }
+
+    /**
+     * @param desc First descriptor.
+     * @param desc0 Second descriptor.
+     */
+    private void checkGroupDescriptorsData(CacheGroupDescriptor desc, 
CacheGroupDescriptor desc0) {
+        assertEquals(desc.groupName(), desc0.groupName());
+        assertEquals(desc.sharedGroup(), desc0.sharedGroup());
+        assertEquals(desc.deploymentId(), desc0.deploymentId());
+        assertEquals(desc.receivedFrom(), desc0.receivedFrom());
+        assertEquals(desc.startTopologyVersion(), 
desc0.startTopologyVersion());
+        assertEquals(desc.config().getName(), desc0.config().getName());
+        assertEquals(desc.config().getGroupName(), 
desc0.config().getGroupName());
+        assertEquals(desc.caches(), desc0.caches());
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java
 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java
index 710b2a1..11a4a10 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheFullApiSelfTestSuite.java
@@ -28,6 +28,7 @@ import 
org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePart
 import 
org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionedNearDisabledFullApiSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionedNearDisabledMultiNodeFullApiSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionedNearDisabledMultiNodeP2PDisabledFullApiSelfTest;
+import 
org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionedNearDisabledMultiNodeWithGroupFullApiSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionedNearDisabledOnheapFullApiSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.dht.GridCachePartitionedNearDisabledOnheapMultiNodeFullApiSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.near.CachePartitionedMultiNodeLongTxTimeoutFullApiTest;
@@ -38,7 +39,9 @@ import 
org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAto
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicLateAffDisabledMultiNodeFullApiSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicMultiNodeFullApiSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicMultiNodeP2PDisabledFullApiSelfTest;
+import 
org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicMultiNodeWithGroupFullApiSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearEnabledMultiNodeFullApiSelfTest;
+import 
org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearEnabledMultiNodeWithGroupFullApiSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicNearOnlyMultiNodeP2PDisabledFullApiSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridCacheAtomicOnheapFullApiSelfTest;
@@ -58,6 +61,7 @@ import 
org.apache.ignite.internal.processors.cache.distributed.near.GridCachePar
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMultiNodeCounterSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMultiNodeFullApiSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMultiNodeP2PDisabledFullApiSelfTest;
+import 
org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedMultiNodeWithGroupFullApiSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedNearOnlyNoPrimaryFullApiSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedOnheapFullApiSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedOnheapMultiNodeFullApiSelfTest;
@@ -71,8 +75,10 @@ import 
org.apache.ignite.internal.processors.cache.distributed.replicated.GridCa
 import 
org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedMultiNodeP2PDisabledFullApiSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedNearOnlyMultiNodeFullApiSelfTest;
 import 
org.apache.ignite.internal.processors.cache.local.GridCacheLocalAtomicFullApiSelfTest;
+import 
org.apache.ignite.internal.processors.cache.local.GridCacheLocalAtomicWithGroupFullApiSelfTest;
 import 
org.apache.ignite.internal.processors.cache.local.GridCacheLocalFullApiMultithreadedSelfTest;
 import 
org.apache.ignite.internal.processors.cache.local.GridCacheLocalFullApiSelfTest;
+import 
org.apache.ignite.internal.processors.cache.local.GridCacheLocalWithGroupFullApiSelfTest;
 
 /**
  * Test suite for cache API.
@@ -161,6 +167,13 @@ public class IgniteCacheFullApiSelfTestSuite extends 
TestSuite {
         // Other.
         suite.addTestSuite(GridCacheClearSelfTest.class);
 
+        suite.addTestSuite(GridCacheLocalWithGroupFullApiSelfTest.class);
+        suite.addTestSuite(GridCacheLocalAtomicWithGroupFullApiSelfTest.class);
+        
suite.addTestSuite(GridCacheAtomicMultiNodeWithGroupFullApiSelfTest.class);
+        
suite.addTestSuite(GridCacheAtomicNearEnabledMultiNodeWithGroupFullApiSelfTest.class);
+        
suite.addTestSuite(GridCachePartitionedMultiNodeWithGroupFullApiSelfTest.class);
+        
suite.addTestSuite(GridCachePartitionedNearDisabledMultiNodeWithGroupFullApiSelfTest.class);
+
         return suite;
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
index 222ac30..f0c0c5a 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite3.java
@@ -32,6 +32,7 @@ import 
org.apache.ignite.internal.processors.cache.GridCacheValueConsistencyTran
 import 
org.apache.ignite.internal.processors.cache.GridCacheValueConsistencyTransactionalSelfTest;
 import org.apache.ignite.internal.processors.cache.GridCacheVersionSelfTest;
 import 
org.apache.ignite.internal.processors.cache.GridCacheVersionTopologyChangeTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheGroupsTest;
 import 
org.apache.ignite.internal.processors.cache.IgniteCacheInterceptorSelfTestSuite;
 import 
org.apache.ignite.internal.processors.cache.IgniteCacheScanPredicateDeploymentSelfTest;
 import 
org.apache.ignite.internal.processors.cache.distributed.CacheAsyncOperationsTest;
@@ -195,6 +196,8 @@ public class IgniteCacheTestSuite3 extends TestSuite {
 
         suite.addTestSuite(CacheAsyncOperationsTest.class);
 
+        suite.addTestSuite(IgniteCacheGroupsTest.class);
+
         return suite;
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/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/db85d166/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/db85d166/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java
index 7caf354..0440615 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2PkHashIndex.java
@@ -108,7 +108,7 @@ public class H2PkHashIndex extends GridH2IndexBase {
             List<GridCursor<? extends CacheDataRow>> cursors = new 
ArrayList<>();
 
             for (IgniteCacheOffheapManager.CacheDataStore store : 
cctx.offheap().cacheDataStores())
-                cursors.add(store.cursor(lowerObj, upperObj));
+                cursors.add(store.cursor(cctx.cacheId(), lowerObj, upperObj));
 
             return new H2Cursor(new CompositeGridCursor<>(cursors.iterator()), 
p);
         }
@@ -126,7 +126,7 @@ public class H2PkHashIndex extends GridH2IndexBase {
     @Override public GridH2Row findOne(GridH2Row row) {
         try {
             for (IgniteCacheOffheapManager.CacheDataStore store : 
cctx.offheap().cacheDataStores()) {
-                CacheDataRow found = store.find(row.key);
+                CacheDataRow found = store.find(cctx, row.key);
 
                 if (found != null)
                     tbl.rowDescriptor().createRow(row.key(), row.partition(), 
row.value(), row.version(), 0);

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowFactory.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowFactory.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowFactory.java
index 2024c36..86b2749 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowFactory.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2RowFactory.java
@@ -59,7 +59,7 @@ public class H2RowFactory {
 
         final CacheDataRowAdapter rowBuilder = new CacheDataRowAdapter(link);
 
-        rowBuilder.initFromLink(cctx, CacheDataRowAdapter.RowData.FULL);
+        rowBuilder.initFromLink(cctx.group(), 
CacheDataRowAdapter.RowData.FULL);
 
         GridH2Row row;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java
index f673717..f2b8bad 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2Tree.java
@@ -63,7 +63,7 @@ public abstract class H2Tree extends BPlusTree<SearchRow, 
GridH2Row> {
     /**
      * @param name Tree name.
      * @param reuseList Reuse list.
-     * @param cacheId Cache ID.
+     * @param grpId Cache group ID.
      * @param pageMem Page memory.
      * @param wal Write ahead log manager.
      * @param rowStore Row data store.
@@ -74,7 +74,7 @@ public abstract class H2Tree extends BPlusTree<SearchRow, 
GridH2Row> {
     protected H2Tree(
         String name,
         ReuseList reuseList,
-        int cacheId,
+        int grpId,
         PageMemory pageMem,
         IgniteWriteAheadLogManager wal,
         AtomicLong globalRmvId,
@@ -85,7 +85,7 @@ public abstract class H2Tree extends BPlusTree<SearchRow, 
GridH2Row> {
         List<InlineIndexHelper> inlineIdxs,
         int inlineSize
     ) throws IgniteCheckedException {
-        super(name, cacheId, pageMem, wal, globalRmvId, metaPageId, reuseList);
+        super(name, grpId, pageMem, wal, globalRmvId, metaPageId, reuseList);
 
         if (!initNew) {
             // Page is ready - read inline size from it.

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
index c1c1d9c..0cfb6a0 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
@@ -100,8 +100,6 @@ public class H2TreeIndex extends GridH2IndexBase {
         name = BPlusTree.treeName(name, "H2Tree");
 
         if (cctx.affinityNode()) {
-            IgniteCacheDatabaseSharedManager dbMgr = cctx.shared().database();
-
             inlineIdxs = getAvailableInlineColumns(cols);
 
             segments = new H2Tree[segmentsCnt];
@@ -110,8 +108,9 @@ public class H2TreeIndex extends GridH2IndexBase {
                 RootPage page = getMetaPage(name, i);
 
                 segments[i] = new H2Tree(
-                    name,cctx.offheap().reuseListForIndex(name),
-                    cctx.cacheId(),
+                    name,
+                    cctx.offheap().reuseListForIndex(name),
+                    cctx.groupId(),
                     cctx.memoryPolicy().pageMemory(),
                     cctx.shared().wal(),
                     cctx.offheap().globalRemoveId(),

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
index fb2129b..060636b 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
@@ -171,7 +171,7 @@ public class DdlStatementsProcessor {
                     ccfg.setSqlSchema(cmd.schemaName());
 
                     SchemaOperationException err =
-                        QueryUtils.checkQueryEntityConflicts(ccfg, 
ctx.cache().cacheDescriptors());
+                        QueryUtils.checkQueryEntityConflicts(ccfg, 
ctx.cache().cacheDescriptors().values());
 
                     if (err != null)
                         throw err;

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index f05fa5b..b85fa61 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -1026,12 +1026,12 @@ public class GridReduceQueryExecutor {
     }
 
     /**
-     * @param cacheName Cache name.
+     * @param grpId Cache group ID.
      * @param topVer Topology version.
      * @return Collection of data nodes.
      */
-    private Collection<ClusterNode> dataNodes(String cacheName, 
AffinityTopologyVersion topVer) {
-        Collection<ClusterNode> res = 
ctx.discovery().cacheAffinityNodes(cacheName, topVer);
+    private Collection<ClusterNode> dataNodes(int grpId, 
AffinityTopologyVersion topVer) {
+        Collection<ClusterNode> res = 
ctx.discovery().cacheGroupAffinityNodes(grpId, topVer);
 
         return res != null ? res : Collections.<ClusterNode>emptySet();
     }
@@ -1047,7 +1047,7 @@ public class GridReduceQueryExecutor {
 
         String cacheName = cctx.name();
 
-        Set<ClusterNode> dataNodes = new HashSet<>(dataNodes(cacheName, NONE));
+        Set<ClusterNode> dataNodes = new HashSet<>(dataNodes(cctx.groupId(), 
NONE));
 
         if (dataNodes.isEmpty())
             throw new CacheException("Failed to find data nodes for cache: " + 
cacheName);
@@ -1110,7 +1110,7 @@ public class GridReduceQueryExecutor {
 
                     continue;
                 }
-                else if (!F.isEmpty(dataNodes(cctx.name(), NONE)))
+                else if (!F.isEmpty(dataNodes(cctx.groupId(), NONE)))
                     return null; // Retry.
 
                 throw new CacheException("Failed to find data nodes [cache=" + 
cctx.name() + ", part=" + p + "]");
@@ -1139,7 +1139,7 @@ public class GridReduceQueryExecutor {
                         continue; // Skip unmapped partitions.
 
                     if (F.isEmpty(owners)) {
-                        if (!F.isEmpty(dataNodes(extraCctx.name(), NONE)))
+                        if (!F.isEmpty(dataNodes(extraCctx.groupId(), NONE)))
                             return null; // Retry.
 
                         throw new CacheException("Failed to find data nodes 
[cache=" + extraCctx.name() +

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsSqlTest.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsSqlTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsSqlTest.java
new file mode 100644
index 0000000..a7c81fd
--- /dev/null
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGroupsSqlTest.java
@@ -0,0 +1,312 @@
+/*
+ * 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.io.Serializable;
+import java.util.List;
+import java.util.concurrent.Callable;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.binary.AffinityKey;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.S;
+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.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.transactions.Transaction;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheMode.REPLICATED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+
+/**
+ *
+ */
+public class IgniteCacheGroupsSqlTest extends GridCommonAbstractTest {
+    /** */
+    private static final TcpDiscoveryIpFinder ipFinder = new 
TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    private static final String GROUP1 = "grp1";
+
+    /** */
+    private static final String GROUP2 = "grp2";
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        startGridsMultiThreaded(3);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+
+        super.afterTest();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSqlQuery() throws Exception {
+        Ignite node = ignite(0);
+
+        IgniteCache c1 = node.createCache(personCacheConfiguration(GROUP1, 
"c1"));
+        IgniteCache c2 = node.createCache(personCacheConfiguration(GROUP1, 
"c2"));
+
+        SqlFieldsQuery qry = new SqlFieldsQuery("select name from Person where 
name=?");
+        qry.setArgs("p1");
+
+        assertEquals(0, c1.query(qry).getAll().size());
+        assertEquals(0, c2.query(qry).getAll().size());
+
+        c1.put(1, new Person("p1"));
+
+        assertEquals(1, c1.query(qry).getAll().size());
+        assertEquals(0, c2.query(qry).getAll().size());
+
+        c2.put(2, new Person("p1"));
+
+        assertEquals(1, c1.query(qry).getAll().size());
+        assertEquals(1, c2.query(qry).getAll().size());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testJoinQuery1() throws Exception {
+        joinQuery(GROUP1, GROUP2, REPLICATED, PARTITIONED, TRANSACTIONAL, 
TRANSACTIONAL);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testJoinQuery2() throws Exception {
+        GridTestUtils.assertThrows(log, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                joinQuery(GROUP1, GROUP1, REPLICATED, PARTITIONED, 
TRANSACTIONAL, TRANSACTIONAL);
+                return null;
+            }
+        }, IgniteCheckedException.class, "Cache mode mismatch for caches 
related to the same group");
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testJoinQuery3() throws Exception {
+        joinQuery(GROUP1, GROUP1, PARTITIONED, PARTITIONED, TRANSACTIONAL, 
ATOMIC);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testJoinQuery4() throws Exception {
+        joinQuery(GROUP1, GROUP1, REPLICATED, REPLICATED, ATOMIC, 
TRANSACTIONAL);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testJoinQuery5() throws Exception {
+        joinQuery(GROUP1, null, REPLICATED, PARTITIONED, TRANSACTIONAL, 
TRANSACTIONAL);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testJoinQuery6() throws Exception {
+        joinQuery(GROUP1, null, PARTITIONED, PARTITIONED, TRANSACTIONAL, 
ATOMIC);
+    }
+
+    /**
+     * @param grp1 First cache group.
+     * @param grp2 Second cache group.
+     * @param cm1 First cache mode.
+     * @param cm2 Second cache mode.
+     * @param cam1 First cache atomicity mode.
+     * @param cam2 Second cache atomicity mode.
+     * @throws Exception If failed.
+     */
+    private void joinQuery(String grp1, String grp2, CacheMode cm1,
+        CacheMode cm2, CacheAtomicityMode cam1, CacheAtomicityMode cam2) 
throws Exception {
+        int keys = 1000;
+        int accsPerPerson = 4;
+
+        Ignite srv0 = ignite(0);
+
+        IgniteCache pers = srv0.createCache(personCacheConfiguration(grp1, 
"pers")
+            .setAffinity(new RendezvousAffinityFunction().setPartitions(10))
+            .setCacheMode(cm1)
+            .setAtomicityMode(cam1));
+
+        IgniteCache acc = srv0.createCache(accountCacheConfiguration(grp2, 
"acc")
+            .setAffinity(new RendezvousAffinityFunction().setPartitions(10))
+            .setCacheMode(cm2)
+            .setAtomicityMode(cam2));
+
+        try(Transaction tx = cam1 == TRANSACTIONAL || cam2 == TRANSACTIONAL ? 
srv0.transactions().txStart() : null) {
+            for (int i = 0; i < keys; i++) {
+
+                int pKey = i - (i % accsPerPerson);
+
+                if (i % accsPerPerson == 0)
+                    pers.put(pKey, new Person("pers-" + pKey));
+
+
+                acc.put(new AffinityKey(i, pKey), new Account(pKey, "acc-" + 
i));
+            }
+
+            if (tx != null)
+                tx.commit();
+        }
+
+        Ignite node = ignite(2);
+
+        SqlFieldsQuery qry = new SqlFieldsQuery(
+            "select p._key as p_key, p.name, a._key as a_key, a.personId, 
a.attr \n" +
+            "from \"pers\".Person p inner join \"acc\".Account a \n" +
+            "on (p._key = a.personId)");
+
+        IgniteCache<Object, Object> cache = node.cache("acc");
+
+        List<List<?>> res = cache.query(qry).getAll();
+
+        assertEquals(keys, res.size());
+
+        for (List<?> row : res)
+            assertEquals(row.get(0), row.get(3));
+    }
+
+    /**
+     * @param grpName Group name.
+     * @param cacheName Cache name.
+     * @return Person cache configuration.
+     */
+    private CacheConfiguration personCacheConfiguration(String grpName, String 
cacheName) {
+        QueryEntity entity = new QueryEntity();
+
+        entity.setKeyType(Integer.class.getName());
+        entity.setValueType(Person.class.getName());
+        entity.addQueryField("name", String.class.getName(), null);
+
+        return cacheConfiguration(grpName, cacheName, entity);
+    }
+
+    /**
+     * @param grpName Group name.
+     * @param cacheName Cache name.
+     * @return Account cache configuration.
+     */
+    private CacheConfiguration accountCacheConfiguration(String grpName, 
String cacheName) {
+        QueryEntity entity = new QueryEntity();
+
+        entity.setKeyType(AffinityKey.class.getName());
+        entity.setValueType(Account.class.getName());
+        entity.addQueryField("personId", Integer.class.getName(), null);
+        entity.addQueryField("attr", String.class.getName(), null);
+        entity.setIndexes(F.asList(new QueryIndex("personId")));
+
+        return cacheConfiguration(grpName, cacheName, entity);
+    }
+
+    /**
+     * @param grpName Group name.
+     * @param cacheName Cache name.
+     * @param queryEntity Query entity.
+     * @return Cache configuration.
+     */
+    private CacheConfiguration cacheConfiguration(String grpName, String 
cacheName, QueryEntity queryEntity) {
+        CacheConfiguration ccfg = new CacheConfiguration();
+
+        ccfg.setWriteSynchronizationMode(FULL_SYNC);
+        ccfg.setGroupName(grpName);
+        ccfg.setName(cacheName);
+
+        ccfg.setQueryEntities(F.asList(queryEntity));
+
+        return ccfg;
+    }
+
+    /**
+     *
+     */
+    private static class Person implements Serializable {
+        /** */
+        String name;
+
+        /**
+         * @param name Name.
+         */
+        public Person(String name) {
+            this.name = name;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(Person.class, this);
+        }
+    }
+
+    /**
+     *
+     */
+    private static class Account implements Serializable {
+        /** */
+        Integer personId;
+
+        /** */
+        String attr;
+
+        /**
+         * @param personId Person ID.
+         * @param attr Attribute (some data).
+         */
+        public Account(Integer personId, String attr) {
+            this.personId = personId;
+            this.attr = attr;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(Account.class, this);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoClassQuerySelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoClassQuerySelfTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoClassQuerySelfTest.java
index b03e948..50d6de4 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoClassQuerySelfTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNoClassQuerySelfTest.java
@@ -20,13 +20,10 @@ package org.apache.ignite.internal.processors.cache;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.LinkedHashMap;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.cache.CacheAtomicityMode;
 import org.apache.ignite.cache.QueryEntity;
 import org.apache.ignite.cache.QueryIndex;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.NearCacheConfiguration;
 import org.apache.ignite.internal.binary.BinaryMarshaller;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
@@ -44,23 +41,6 @@ public class IgniteCacheNoClassQuerySelfTest extends 
GridCommonAbstractTest {
     /** */
     private static final TcpDiscoveryIpFinder ipFinder = new 
TcpDiscoveryVmIpFinder(true);
 
-    /** */
-    protected Ignite ignite;
-
-    /**
-     * @return Atomicity mode.
-     */
-    protected CacheAtomicityMode atomicityMode() {
-        return TRANSACTIONAL;
-    }
-
-    /**
-     * @return Distribution.
-     */
-    protected NearCacheConfiguration nearCacheConfiguration() {
-        return new NearCacheConfiguration();
-    }
-
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override protected IgniteConfiguration getConfiguration(String 
igniteInstanceName) throws Exception {

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/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/db85d166/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/db85d166/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/db85d166/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/db85d166/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/db85d166/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/db85d166/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;
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
 
b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
index 0f4a418..794ec4d 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheWithIndexingTestSuite.java
@@ -30,6 +30,7 @@ import 
org.apache.ignite.internal.processors.cache.GridCacheOffheapIndexEntryEvi
 import 
org.apache.ignite.internal.processors.cache.GridCacheOffheapIndexGetSelfTest;
 import 
org.apache.ignite.internal.processors.cache.GridIndexingWithNoopSwapSelfTest;
 import 
org.apache.ignite.internal.processors.cache.IgniteCacheConfigurationPrimitiveTypesSelfTest;
+import org.apache.ignite.internal.processors.cache.IgniteCacheGroupsSqlTest;
 import 
org.apache.ignite.internal.processors.cache.IgniteCacheStarvationOnRebalanceTest;
 import 
org.apache.ignite.internal.processors.cache.IgniteClientReconnectQueriesTest;
 import 
org.apache.ignite.internal.processors.cache.ttl.CacheTtlAtomicLocalSelfTest;
@@ -72,6 +73,8 @@ public class IgniteCacheWithIndexingTestSuite extends 
TestSuite {
 
         suite.addTestSuite(ClientReconnectAfterClusterRestartTest.class);
 
+        suite.addTestSuite(IgniteCacheGroupsSqlTest.class);
+
         return suite;
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
----------------------------------------------------------------------
diff --git 
a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
index 11f9472..3ba39c1 100644
--- 
a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
+++ 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
@@ -21,11 +21,13 @@ import com.beust.jcommander.Parameter;
 import org.apache.ignite.cache.CacheWriteSynchronizationMode;
 import org.apache.ignite.configuration.MemoryConfiguration;
 import org.apache.ignite.internal.util.tostring.GridToStringBuilder;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
 
 import java.util.ArrayList;
 import java.util.List;
+import org.jetbrains.annotations.Nullable;
 
 /**
  * Input arguments for Ignite benchmarks.
@@ -82,7 +84,8 @@ public class IgniteBenchmarkArguments {
 
     /** */
     @Parameter(names = {"-r", "--range"}, description = "Key range")
-    public int range = 1_000_000;
+    @GridToStringInclude
+    private int range = 1_000_000;
 
     /** */
     @Parameter(names = {"-sf", "--scaleFactor"}, description = "Scale factor")
@@ -194,6 +197,14 @@ public class IgniteBenchmarkArguments {
     @Parameter(names = {"-ps", "--pageSize"}, description = "Page size")
     private int pageSize = MemoryConfiguration.DFLT_PAGE_SIZE;
 
+    /** */
+    @Parameter(names = {"-cg", "--cacheGrp"}, description = "Cache group for 
caches")
+    private String cacheGrp;
+
+    /** */
+    @Parameter(names = {"-cc", "--cachesCnt"}, description = "Number of caches 
to create")
+    private int cachesCnt = 1;
+
     /**
      * @return List of enabled load test operations.
      */
@@ -475,6 +486,20 @@ public class IgniteBenchmarkArguments {
     }
 
     /**
+     * @return Name of cache group to be set for caches.
+     */
+    @Nullable public String cacheGroup() {
+        return cacheGrp;
+    }
+
+    /**
+     * @return Number of caches to create.
+     */
+    public int cachesCount() {
+        return cachesCnt;
+    }
+
+    /**
      * @return Description.
      */
     public String description() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/db85d166/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
----------------------------------------------------------------------
diff --git 
a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
index 6e25fc4..1f947de 100644
--- 
a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
+++ 
b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
@@ -112,6 +112,9 @@ public class IgniteNode implements BenchmarkServer {
                     cc.setNearConfiguration(nearCfg);
                 }
 
+                if (args.cacheGroup() != null)
+                    cc.setGroupName(args.cacheGroup());
+
                 cc.setWriteSynchronizationMode(args.syncMode());
 
                 cc.setBackups(args.backups());

Reply via email to