You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/04/26 17:38:10 UTC

[01/51] [abbrv] ignite git commit: ignite-1794 Refactored hibernate modules, switched to hibernate 5.1

Repository: ignite
Updated Branches:
  refs/heads/ignite-5075-cacheStart c73e1c90b -> 07aa9bbe2


http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListenerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListenerSelfTest.java b/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListenerSelfTest.java
deleted file mode 100644
index c4d6120..0000000
--- a/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListenerSelfTest.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * 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.cache.store.hibernate;
-
-import java.io.Serializable;
-import java.util.Map;
-import javax.cache.Cache;
-import javax.cache.configuration.Factory;
-import javax.cache.integration.CacheLoaderException;
-import javax.cache.integration.CacheWriterException;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import org.apache.ignite.cache.store.CacheStore;
-import org.apache.ignite.cache.store.CacheStoreAdapter;
-import org.apache.ignite.cache.store.CacheStoreSession;
-import org.apache.ignite.cache.store.CacheStoreSessionListener;
-import org.apache.ignite.cache.store.CacheStoreSessionListenerAbstractSelfTest;
-import org.apache.ignite.cache.store.jdbc.CacheJdbcStoreSessionListener;
-import org.apache.ignite.lang.IgniteBiInClosure;
-import org.apache.ignite.resources.CacheStoreSessionResource;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.cfg.Configuration;
-
-/**
- * Tests for {@link CacheJdbcStoreSessionListener}.
- */
-public class CacheHibernateStoreSessionListenerSelfTest extends CacheStoreSessionListenerAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected Factory<? extends CacheStore<Integer, Integer>> storeFactory() {
-        return new Factory<CacheStore<Integer, Integer>>() {
-            @Override public CacheStore<Integer, Integer> create() {
-                return new Store();
-            }
-        };
-    }
-
-    /** {@inheritDoc} */
-    @Override protected Factory<CacheStoreSessionListener> sessionListenerFactory() {
-        return new Factory<CacheStoreSessionListener>() {
-            @Override public CacheStoreSessionListener create() {
-                CacheHibernateStoreSessionListener lsnr = new CacheHibernateStoreSessionListener();
-
-                SessionFactory sesFactory = new Configuration().
-                    setProperty("hibernate.connection.url", URL).
-                    addAnnotatedClass(Table1.class).
-                    addAnnotatedClass(Table2.class).
-                    buildSessionFactory();
-
-                lsnr.setSessionFactory(sesFactory);
-
-                return lsnr;
-            }
-        };
-    }
-
-    /**
-     */
-    private static class Store extends CacheStoreAdapter<Integer, Integer> {
-        /** */
-        private static String SES_CONN_KEY = "ses_conn";
-
-        /** */
-        @CacheStoreSessionResource
-        private CacheStoreSession ses;
-
-        /** {@inheritDoc} */
-        @Override public void loadCache(IgniteBiInClosure<Integer, Integer> clo, Object... args) {
-            loadCacheCnt.incrementAndGet();
-
-            checkSession();
-        }
-
-        /** {@inheritDoc} */
-        @Override public Integer load(Integer key) throws CacheLoaderException {
-            loadCnt.incrementAndGet();
-
-            checkSession();
-
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void write(Cache.Entry<? extends Integer, ? extends Integer> entry)
-            throws CacheWriterException {
-            writeCnt.incrementAndGet();
-
-            checkSession();
-
-            if (write.get()) {
-                Session hibSes = ses.attachment();
-
-                switch (ses.cacheName()) {
-                    case "cache1":
-                        hibSes.save(new Table1(entry.getKey(), entry.getValue()));
-
-                        break;
-
-                    case "cache2":
-                        if (fail.get())
-                            throw new CacheWriterException("Expected failure.");
-
-                        hibSes.save(new Table2(entry.getKey(), entry.getValue()));
-
-                        break;
-
-                    default:
-                        throw new CacheWriterException("Wring cache: " + ses.cacheName());
-                }
-            }
-        }
-
-        /** {@inheritDoc} */
-        @Override public void delete(Object key) throws CacheWriterException {
-            deleteCnt.incrementAndGet();
-
-            checkSession();
-        }
-
-        /** {@inheritDoc} */
-        @Override public void sessionEnd(boolean commit) {
-            assertNull(ses.attachment());
-        }
-
-        /**
-         */
-        private void checkSession() {
-            Session hibSes = ses.attachment();
-
-            assertNotNull(hibSes);
-
-            assertTrue(hibSes.isOpen());
-
-            Transaction tx = hibSes.getTransaction();
-
-            assertNotNull(tx);
-
-            if (ses.isWithinTransaction())
-                assertTrue(tx.isActive());
-            else
-                assertFalse(tx.isActive());
-
-            verifySameInstance(hibSes);
-        }
-
-        /**
-         * @param hibSes Session.
-         */
-        private void verifySameInstance(Session hibSes) {
-            Map<String, Session> props = ses.properties();
-
-            Session sesConn = props.get(SES_CONN_KEY);
-
-            if (sesConn == null)
-                props.put(SES_CONN_KEY, hibSes);
-            else {
-                assertSame(hibSes, sesConn);
-
-                reuseCnt.incrementAndGet();
-            }
-        }
-    }
-
-    /**
-     */
-    @Entity
-    @Table(name = "Table1")
-    private static class Table1 implements Serializable {
-        /** */
-        @Id
-        @GeneratedValue(strategy = GenerationType.IDENTITY)
-        @Column(name = "id")
-        private Integer id;
-
-        /** */
-        @Column(name = "key")
-        private int key;
-
-        /** */
-        @Column(name = "value")
-        private int value;
-
-        /**
-         * @param key Key.
-         * @param value Value.
-         */
-        private Table1(int key, int value) {
-            this.key = key;
-            this.value = value;
-        }
-    }
-
-    /**
-     */
-    @Entity
-    @Table(name = "Table2")
-    private static class Table2 implements Serializable {
-        /** */
-        @Id
-        @GeneratedValue(strategy = GenerationType.IDENTITY)
-        @Column(name = "id")
-        private Integer id;
-
-        /** */
-        @Column(name = "key")
-        private int key;
-
-        /** */
-        @Column(name = "value")
-        private int value;
-
-        /**
-         * @param key Key.
-         * @param value Value.
-         */
-        private Table2(int key, int value) {
-            this.key = key;
-            this.value = value;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml b/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml
deleted file mode 100644
index 3822b31..0000000
--- a/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-
-<!DOCTYPE hibernate-configuration PUBLIC
-        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
-        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
-
-<hibernate-configuration>
-    <session-factory>
-        <!-- Show SQL. -->
-        <property name="show_sql">true</property>
-
-        <!-- Database connection settings (private in-memory database). -->
-        <property name="connection.url">jdbc:h2:mem:example;DB_CLOSE_DELAY=-1</property>
-
-        <!-- Only validate the database schema on startup in production mode. -->
-        <property name="hbm2ddl.auto">update</property>
-
-        <!-- H2 dialect. -->
-        <property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property>
-
-        <!-- Mappings. -->
-        <mapping resource="org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml"/>
-    </session-factory>
-</hibernate-configuration>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/package-info.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/package-info.java b/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/package-info.java
deleted file mode 100644
index 8af9886..0000000
--- a/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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 description. -->
- * Contains internal tests or test related classes and interfaces.
- */
-package org.apache.ignite.cache.store.hibernate;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernate5TestSuite.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernate5TestSuite.java b/modules/hibernate5/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernate5TestSuite.java
deleted file mode 100644
index d539511..0000000
--- a/modules/hibernate5/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernate5TestSuite.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.testsuites;
-
-import junit.framework.TestSuite;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
-import org.apache.ignite.testframework.config.GridTestProperties;
-
-/**
- *
- */
-public class IgniteBinaryHibernate5TestSuite extends TestSuite {
-    /**
-     * @return Test suite.
-     * @throws Exception If failed.
-     */
-    public static TestSuite suite() throws Exception {
-        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
-
-        return IgniteHibernate5TestSuite.suite();
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/test/java/org/apache/ignite/testsuites/IgniteHibernate5TestSuite.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/test/java/org/apache/ignite/testsuites/IgniteHibernate5TestSuite.java b/modules/hibernate5/src/test/java/org/apache/ignite/testsuites/IgniteHibernate5TestSuite.java
deleted file mode 100644
index 3d7c4ee..0000000
--- a/modules/hibernate5/src/test/java/org/apache/ignite/testsuites/IgniteHibernate5TestSuite.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.testsuites;
-
-import junit.framework.TestSuite;
-import org.apache.ignite.cache.hibernate.HibernateL2CacheConfigurationSelfTest;
-import org.apache.ignite.cache.hibernate.HibernateL2CacheSelfTest;
-import org.apache.ignite.cache.hibernate.HibernateL2CacheTransactionalSelfTest;
-import org.apache.ignite.cache.hibernate.HibernateL2CacheTransactionalUseSyncSelfTest;
-import org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreNodeRestartTest;
-import org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreSelfTest;
-import org.apache.ignite.cache.store.hibernate.CacheHibernateStoreFactorySelfTest;
-import org.apache.ignite.cache.store.hibernate.CacheHibernateStoreSessionListenerSelfTest;
-
-/**
- * Hibernate integration tests.
- */
-public class IgniteHibernate5TestSuite extends TestSuite {
-    /**
-     * @return Test suite.
-     * @throws Exception Thrown in case of the failure.
-     */
-    public static TestSuite suite() throws Exception {
-        TestSuite suite = new TestSuite("Hibernate5 Integration Test Suite");
-
-        // Hibernate L2 cache.
-        suite.addTestSuite(HibernateL2CacheSelfTest.class);
-        suite.addTestSuite(HibernateL2CacheTransactionalSelfTest.class);
-        suite.addTestSuite(HibernateL2CacheTransactionalUseSyncSelfTest.class);
-        suite.addTestSuite(HibernateL2CacheConfigurationSelfTest.class);
-
-        suite.addTestSuite(CacheHibernateBlobStoreSelfTest.class);
-
-        suite.addTestSuite(CacheHibernateBlobStoreNodeRestartTest.class);
-
-        suite.addTestSuite(CacheHibernateStoreSessionListenerSelfTest.class);
-
-        suite.addTestSuite(CacheHibernateStoreFactorySelfTest.class);
-
-        return suite;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/osgi-karaf/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/modules/osgi-karaf/src/main/resources/features.xml b/modules/osgi-karaf/src/main/resources/features.xml
index f6bdf2b..9846d97 100644
--- a/modules/osgi-karaf/src/main/resources/features.xml
+++ b/modules/osgi-karaf/src/main/resources/features.xml
@@ -110,7 +110,7 @@
             NOTE: Take into account that certain parts of Hibernate are offered under the LGPL license.]]>
         </details>
         <feature>hibernate</feature>
-        <bundle start="true">mvn:org.apache.ignite/ignite-hibernate/${project.version}</bundle>
+        <bundle start="true">mvn:org.apache.ignite/ignite-hibernate_4.2/${project.version}</bundle>
     </feature>
 
     <feature name="ignite-indexing" version="${project.version}" description="Apache Ignite :: Indexing">

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e1bb73e..8a05342 100644
--- a/pom.xml
+++ b/pom.xml
@@ -91,6 +91,7 @@
         <module>modules/flink</module>
         <module>modules/kubernetes</module>
         <module>modules/zeromq</module>
+        <module>modules/hibernate-core</module>
     </modules>
 
     <profiles>
@@ -100,8 +101,8 @@
                 <module>examples</module>
                 <module>modules/benchmarks</module>
                 <module>modules/geospatial</module>
-                <module>modules/hibernate5</module>
-                <module>modules/hibernate</module>
+                <module>modules/hibernate-4.2</module>
+                <module>modules/hibernate-5.1</module>
                 <module>modules/schedule</module>
                 <module>modules/web-console/web-agent</module>
                 <module>modules/yardstick</module>
@@ -197,8 +198,8 @@
         <profile>
             <id>lgpl</id>
             <modules>
-                <module>modules/hibernate</module>
-                <module>modules/hibernate5</module>
+                <module>modules/hibernate-4.2</module>
+                <module>modules/hibernate-5.1</module>
                 <module>modules/geospatial</module>
                 <module>modules/schedule</module>
             </modules>


[31/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerAbstractTest.java
index fe3da2b..6e98eea 100644
--- a/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerAbstractTest.java
@@ -132,13 +132,13 @@ public abstract class GridMarshallerAbstractTest extends GridCommonAbstractTest
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration namedCache = new CacheConfiguration();
+        CacheConfiguration namedCache = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         namedCache.setName(CACHE_NAME);
         namedCache.setAtomicityMode(TRANSACTIONAL);
 
         cfg.setMarshaller(marshaller());
-        cfg.setCacheConfiguration(new CacheConfiguration(), namedCache);
+        cfg.setCacheConfiguration(new CacheConfiguration(DEFAULT_CACHE_NAME), namedCache);
 
         return cfg;
     }
@@ -158,7 +158,7 @@ public abstract class GridMarshallerAbstractTest extends GridCommonAbstractTest
      * @throws Exception If failed.
      */
     public void testDefaultCache() throws Exception {
-        IgniteCache<String, String> cache = grid().cache(null);
+        IgniteCache<String, String> cache = grid().cache(DEFAULT_CACHE_NAME);
 
         cache.put("key", "val");
 
@@ -178,7 +178,7 @@ public abstract class GridMarshallerAbstractTest extends GridCommonAbstractTest
 
         IgniteCache<String, String> cache0 = (IgniteCache<String, String>)outBean.getObjectField();
 
-        assertNull(cache0.getName());
+        assertEquals(DEFAULT_CACHE_NAME, cache0.getName());
         assertEquals("val", cache0.get("key"));
 
         outBean.checkNullResources();
@@ -707,7 +707,7 @@ public abstract class GridMarshallerAbstractTest extends GridCommonAbstractTest
                 }
             }, EVTS_CACHE);
 
-            grid().cache(null).put(1, 1);
+            grid().cache(DEFAULT_CACHE_NAME).put(1, 1);
 
             GridMarshallerTestBean inBean = newTestBean(evts);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
index 540daa2..a5a35c1 100644
--- a/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
+++ b/modules/core/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
@@ -110,6 +110,9 @@ public class PlatformComputeEchoTask extends ComputeTaskAdapter<Integer, Object>
     /** Type: ignite uuid. */
     private static final int TYPE_IGNITE_UUID = 22;
 
+    /** Default cache name. */
+    public static final String DEFAULT_CACHE_NAME = "default";
+
     /** {@inheritDoc} */
     @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
         @Nullable Integer arg) {
@@ -200,7 +203,7 @@ public class PlatformComputeEchoTask extends ComputeTaskAdapter<Integer, Object>
                     return PlatformComputeEnum.BAR;
 
                 case TYPE_ENUM_FROM_CACHE:
-                    return ignite.cache(null).get(TYPE_ENUM_FROM_CACHE);
+                    return ignite.cache(DEFAULT_CACHE_NAME).get(TYPE_ENUM_FROM_CACHE);
 
                 case TYPE_ENUM_ARRAY:
                     return new PlatformComputeEnum[] {
@@ -210,10 +213,10 @@ public class PlatformComputeEchoTask extends ComputeTaskAdapter<Integer, Object>
                     };
 
                 case TYPE_ENUM_ARRAY_FROM_CACHE:
-                    return ignite.cache(null).get(TYPE_ENUM_ARRAY_FROM_CACHE);
+                    return ignite.cache(DEFAULT_CACHE_NAME).get(TYPE_ENUM_ARRAY_FROM_CACHE);
 
                 case TYPE_ENUM_FIELD:
-                    IgniteCache<Integer, BinaryObject> cache = ignite.cache(null).withKeepBinary();
+                    IgniteCache<Integer, BinaryObject> cache = ignite.cache(DEFAULT_CACHE_NAME).withKeepBinary();
                     BinaryObject obj = cache.get(TYPE_ENUM_FIELD);
                     BinaryObject val = obj.field("interopEnum");
 
@@ -223,7 +226,7 @@ public class PlatformComputeEchoTask extends ComputeTaskAdapter<Integer, Object>
                     return new AffinityKey<>("interopAffinityKey");
 
                 case TYPE_IGNITE_UUID:
-                    return ignite.cache(null).get(TYPE_IGNITE_UUID);
+                    return ignite.cache(DEFAULT_CACHE_NAME).get(TYPE_IGNITE_UUID);
 
                 default:
                     throw new IgniteException("Unknown type: " + type);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/platform/PlatformSqlQueryTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformSqlQueryTask.java b/modules/core/src/test/java/org/apache/ignite/platform/PlatformSqlQueryTask.java
index 41d83aa..c839f81 100644
--- a/modules/core/src/test/java/org/apache/ignite/platform/PlatformSqlQueryTask.java
+++ b/modules/core/src/test/java/org/apache/ignite/platform/PlatformSqlQueryTask.java
@@ -90,7 +90,7 @@ public class PlatformSqlQueryTask extends ComputeTaskAdapter<String, Object> {
 
         /** {@inheritDoc} */
         @Nullable @Override public Object execute() {
-            IgniteCache<Integer, PlatformComputeBinarizable> cache = ignite.cache(null);
+            IgniteCache<Integer, PlatformComputeBinarizable> cache = ignite.cache("default");
 
             SqlQuery<Integer, PlatformComputeBinarizable> qry = new SqlQuery<>("PlatformComputeBinarizable", arg);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/spi/checkpoint/cache/CacheCheckpointSpiSecondCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/checkpoint/cache/CacheCheckpointSpiSecondCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/checkpoint/cache/CacheCheckpointSpiSecondCacheSelfTest.java
index 797743a..4397783 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/checkpoint/cache/CacheCheckpointSpiSecondCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/checkpoint/cache/CacheCheckpointSpiSecondCacheSelfTest.java
@@ -35,9 +35,6 @@ public class CacheCheckpointSpiSecondCacheSelfTest extends GridCommonAbstractTes
     /** IP finder. */
     private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
 
-    /** Data cache name. */
-    private static final String DATA_CACHE = null;
-
     /** Checkpoints cache name. */
     private static final String CP_CACHE = "checkpoints";
 
@@ -58,7 +55,7 @@ public class CacheCheckpointSpiSecondCacheSelfTest extends GridCommonAbstractTes
 
         CacheConfiguration cacheCfg1 = defaultCacheConfiguration();
 
-        cacheCfg1.setName(DATA_CACHE);
+        cacheCfg1.setName(DEFAULT_CACHE_NAME);
         cacheCfg1.setCacheMode(REPLICATED);
         cacheCfg1.setWriteSynchronizationMode(FULL_SYNC);
 
@@ -83,7 +80,7 @@ public class CacheCheckpointSpiSecondCacheSelfTest extends GridCommonAbstractTes
      * @throws Exception If failed.
      */
     public void testSecondCachePutRemove() throws Exception {
-        IgniteCache<Integer, Integer> data = grid().cache(DATA_CACHE);
+        IgniteCache<Integer, Integer> data = grid().cache(DEFAULT_CACHE_NAME);
         IgniteCache<Integer, String> cp = grid().cache(CP_CACHE);
 
         data.put(1, 1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/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 e429c45..25ff2fd 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
@@ -100,7 +100,7 @@ public class GridCacheMessageSelfTest extends GridCommonAbstractTest {
 
         cfg.setIncludeEventTypes((int[])null);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(CacheMode.PARTITIONED);
         ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridCacheDhtLockBackupSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridCacheDhtLockBackupSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridCacheDhtLockBackupSelfTest.java
index 272e349..951971d 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridCacheDhtLockBackupSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridCacheDhtLockBackupSelfTest.java
@@ -110,15 +110,15 @@ public class GridCacheDhtLockBackupSelfTest extends GridCommonAbstractTest {
 
         Ignite ignite2 = startGridWithSpi(2, new TestCommunicationSpi(GridNearUnlockRequest.class, 1000));
 
-        if (!ignite1.affinity(null).mapKeyToNode(kv).id().equals(ignite1.cluster().localNode().id())) {
+        if (!ignite1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(kv).id().equals(ignite1.cluster().localNode().id())) {
             Ignite tmp = ignite1;
             ignite1 = ignite2;
             ignite2 = tmp;
         }
 
         // Now, grid1 is always primary node for key 1.
-        final IgniteCache<Integer, String> cache1 = ignite1.cache(null);
-        final IgniteCache<Integer, String> cache2 = ignite2.cache(null);
+        final IgniteCache<Integer, String> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
+        final IgniteCache<Integer, String> cache2 = ignite2.cache(DEFAULT_CACHE_NAME);
 
         info(">>> Primary: " + ignite1.cluster().localNode().id());
         info(">>>  Backup: " + ignite2.cluster().localNode().id());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/IgniteClientReconnectMassiveShutdownTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/IgniteClientReconnectMassiveShutdownTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/IgniteClientReconnectMassiveShutdownTest.java
index 50e5093..2878110 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/IgniteClientReconnectMassiveShutdownTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/IgniteClientReconnectMassiveShutdownTest.java
@@ -133,7 +133,7 @@ public class IgniteClientReconnectMassiveShutdownTest extends GridCommonAbstract
 
         assertTrue(client.configuration().isClientMode());
 
-        final CacheConfiguration<String, Integer> cfg = new CacheConfiguration<>();
+        final CacheConfiguration<String, Integer> cfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cfg.setCacheMode(PARTITIONED);
         cfg.setAtomicityMode(TRANSACTIONAL);
@@ -302,7 +302,7 @@ public class IgniteClientReconnectMassiveShutdownTest extends GridCommonAbstract
                 Object val = cache.get(key);
 
                 for (int i = srvsToKill; i < GRID_CNT; i++)
-                    assertEquals(val, ignite(i).cache(null).get(key));
+                    assertEquals(val, ignite(i).cache(DEFAULT_CACHE_NAME).get(key));
             }
         }
         finally {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
index 0d08b76..70d5078 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoveryMultiThreadedTest.java
@@ -513,7 +513,7 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
 
             IgniteInternalFuture<?> fut1 = GridTestUtils.runAsync(new Callable<Void>() {
                 @Override public Void call() throws Exception {
-                    CacheConfiguration ccfg = new CacheConfiguration();
+                    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
                     Ignite ignite = ignite(START_NODES - 1);
 
@@ -544,7 +544,7 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
 
                         log.info("Started node: " + ignite.name());
 
-                        IgniteCache<Object, Object> cache = ignite.getOrCreateCache((String)null);
+                        IgniteCache<Object, Object> cache = ignite.getOrCreateCache(DEFAULT_CACHE_NAME);
 
                         ContinuousQuery<Object, Object> qry = new ContinuousQuery<>();
 
@@ -601,7 +601,7 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
 
             startGrids(START_NODES);
 
-            ignite(0).createCache(new CacheConfiguration<>());
+            ignite(0).createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
 
             final AtomicInteger startIdx = new AtomicInteger(START_NODES);
 
@@ -622,7 +622,7 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
 
                     log.info("Started node: " + ignite.name());
 
-                    IgniteCache<Object, Object> cache = ignite.getOrCreateCache((String)null);
+                    IgniteCache<Object, Object> cache = ignite.getOrCreateCache(DEFAULT_CACHE_NAME);
 
                     for (int i = 0; i < 10; i++) {
                         ContinuousQuery<Object, Object> qry = new ContinuousQuery<>();
@@ -664,7 +664,7 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
 
         Ignite ignite = startGrid(0);
 
-        ignite.getOrCreateCache(new CacheConfiguration<>());
+        ignite.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
 
         final long stopTime = System.currentTimeMillis() + 60_000;
 
@@ -674,7 +674,7 @@ public class TcpDiscoveryMultiThreadedTest extends GridCommonAbstractTest {
                     while (System.currentTimeMillis() < stopTime) {
                         Ignite ignite = startGrid(idx + 1);
 
-                        IgniteCache<Object, Object> cache = ignite.cache(null);
+                        IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                         int qryCnt = ThreadLocalRandom.current().nextInt(10) + 1;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
index f8f9baf..641c7d1 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
@@ -1346,7 +1346,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
 
         IgniteInternalFuture<?> fut2 = GridTestUtils.runAsync(new Callable<Void>() {
             @Override public Void call() throws Exception {
-                CacheConfiguration ccfg = new CacheConfiguration();
+                CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
                 ccfg.setName(CACHE_NAME);
 
@@ -1616,7 +1616,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
             @Override public Void call() throws Exception {
                 log.info("Create test cache");
 
-                CacheConfiguration ccfg = new CacheConfiguration();
+                CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
                 ccfg.setName(CACHE_NAME);
 
@@ -1753,7 +1753,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
 
             waitNodeStop(ignite0.name());
 
-            ignite1.getOrCreateCache(new CacheConfiguration<>()).put(1, 1);
+            ignite1.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME)).put(1, 1);
 
             startGrid(2);
 
@@ -1909,9 +1909,9 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
 
             startGrid(1);
 
-            ignite0.createCache(new CacheConfiguration<>()); // Send custom message.
+            ignite0.createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME)); // Send custom message.
 
-            ignite0.destroyCache(null); // Send custom message.
+            ignite0.destroyCache(DEFAULT_CACHE_NAME); // Send custom message.
 
             stopGrid(1);
 
@@ -2025,7 +2025,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
             for (int i = 0; i < ccfgs.length; i++) {
                 CacheConfiguration ccfg = new CacheConfiguration();
 
-                ccfg.setName(i == 0 ? null : ("static-cache-" + i));
+                ccfg.setName(i == 0 ? DEFAULT_CACHE_NAME : ("static-cache-" + i));
 
                 ccfgs[i] = ccfg;
             }
@@ -2048,7 +2048,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
 
             assertTrue(clientNode.configuration().isClientMode());
 
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
             ccfg.setName("c1");
 
             clientNode.createCache(ccfg);
@@ -2103,7 +2103,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
         int cntr = 0;
 
         for (Ignite ignite : allNodes) {
-            CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+            CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
             ccfg.setName("cache-" + cntr++);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
index eed99f6..42bea62 100644
--- a/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/stream/socket/SocketStreamerSelfTest.java
@@ -276,11 +276,11 @@ public class SocketStreamerSelfTest extends GridCommonAbstractTest {
 
         Ignite ignite = grid(0);
 
-        IgniteCache<Integer, String> cache = ignite.cache(null);
+        IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         cache.clear();
 
-        try (IgniteDataStreamer<Integer, String> stmr = ignite.dataStreamer(null)) {
+        try (IgniteDataStreamer<Integer, String> stmr = ignite.dataStreamer(DEFAULT_CACHE_NAME)) {
             stmr.allowOverwrite(true);
             stmr.autoFlushFrequency(10);
 
@@ -330,7 +330,7 @@ public class SocketStreamerSelfTest extends GridCommonAbstractTest {
                 }
             };
 
-            ignite.events(ignite.cluster().forCacheNodes(null)).remoteListen(locLsnr, null, EVT_CACHE_OBJECT_PUT);
+            ignite.events(ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME)).remoteListen(locLsnr, null, EVT_CACHE_OBJECT_PUT);
 
             sockStmr.start();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
index eb3bbe0..1a821a1 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java
@@ -1136,7 +1136,7 @@ public final class GridTestUtils {
      * @return Cache context.
      */
     public static <K, V> GridCacheContext<K, V> cacheContext(IgniteCache<K, V> cache) {
-        return ((IgniteKernal)cache.unwrap(Ignite.class)).<K, V>internalCache().context();
+        return ((IgniteKernal)cache.unwrap(Ignite.class)).<K, V>internalCache(cache.getName()).context();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/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 d080b54..c800cfb 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
@@ -148,6 +148,9 @@ public abstract class GridAbstractTest extends TestCase {
     private static final transient Map<Class<?>, TestCounters> tests = new ConcurrentHashMap<>();
 
     /** */
+    protected static final String DEFAULT_CACHE_NAME = "default";
+
+    /** */
     private transient boolean startGrid;
 
     /** */
@@ -1517,7 +1520,7 @@ public abstract class GridAbstractTest extends TestCase {
      * @return New cache configuration with modified defaults.
      */
     public static CacheConfiguration defaultCacheConfiguration() {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setStartSize(1024);
         cfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/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 e6b30e0..cf68c3c 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
@@ -100,6 +100,7 @@ import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
 import org.apache.ignite.transactions.TransactionRollbackException;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.cache.CacheMode.LOCAL;
@@ -133,7 +134,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
      * @return Cache.
      */
     protected <K, V> IgniteCache<K, V> jcache(int idx) {
-        return grid(idx).cache(null);
+        return grid(idx).cache(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -176,7 +177,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
     @SuppressWarnings("unchecked")
     protected <K, V> IgniteCache<K, V> jcache(Ignite ig,
         CacheConfiguration ccfg,
-        String name,
+        @NotNull String name,
         Class<K> clsK,
         Class<V> clsV) {
         CacheConfiguration<K, V> cc = new CacheConfiguration<>(ccfg);
@@ -198,7 +199,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
     @SuppressWarnings("unchecked")
     protected <K, V> IgniteCache<K, V> jcache(Ignite ig,
         CacheConfiguration ccfg,
-        String name) {
+        @NotNull String name) {
         CacheConfiguration<K, V> cc = new CacheConfiguration<>(ccfg);
         cc.setName(name);
 
@@ -219,7 +220,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
      * @return Cache.
      */
     protected <K, V> GridCacheAdapter<K, V> internalCache(int idx) {
-        return ((IgniteKernal)grid(idx)).internalCache(null);
+        return ((IgniteKernal)grid(idx)).internalCache(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -264,7 +265,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
      * @return Cache.
      */
     protected <K, V> IgniteCache<K, V> jcache() {
-        return grid().cache(null);
+        return grid().cache(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -285,7 +286,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
      * @return Cache.
      */
     protected <K, V> GridLocalCache<K, V> local() {
-        return (GridLocalCache<K, V>)((IgniteKernal)grid()).<K, V>internalCache();
+        return (GridLocalCache<K, V>)((IgniteKernal)grid()).<K, V>internalCache(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -432,7 +433,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
      * @return Near cache.
      */
     protected <K, V> GridNearCacheAdapter<K, V> near() {
-        return ((IgniteKernal)grid()).<K, V>internalCache().context().near();
+        return ((IgniteKernal)grid()).<K, V>internalCache(DEFAULT_CACHE_NAME).context().near();
     }
 
     /**
@@ -440,7 +441,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
      * @return Near cache.
      */
     protected <K, V> GridNearCacheAdapter<K, V> near(int idx) {
-        return ((IgniteKernal)grid(idx)).<K, V>internalCache().context().near();
+        return ((IgniteKernal)grid(idx)).<K, V>internalCache(DEFAULT_CACHE_NAME).context().near();
     }
 
     /**
@@ -448,7 +449,7 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
      * @return Colocated cache.
      */
     protected <K, V> GridDhtColocatedCache<K, V> colocated(int idx) {
-        return (GridDhtColocatedCache<K, V>)((IgniteKernal)grid(idx)).<K, V>internalCache();
+        return (GridDhtColocatedCache<K, V>)((IgniteKernal)grid(idx)).<K, V>internalCache(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -1409,13 +1410,13 @@ public abstract class GridCommonAbstractTest extends GridAbstractTest {
 
         assertFalse("There are no alive nodes.", F.isEmpty(allGrids));
 
-        Affinity<Integer> aff = allGrids.get(0).affinity(null);
+        Affinity<Integer> aff = allGrids.get(0).affinity(DEFAULT_CACHE_NAME);
 
         Collection<ClusterNode> nodes = aff.mapKeyToPrimaryAndBackups(key);
 
         for (Ignite ignite : allGrids) {
             if (!nodes.contains(ignite.cluster().localNode()))
-                return ignite.cache(null);
+                return ignite.cache(DEFAULT_CACHE_NAME);
         }
 
         fail();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteClusterProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteClusterProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteClusterProcessProxy.java
index 969d02b..582744a 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteClusterProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteClusterProcessProxy.java
@@ -36,6 +36,7 @@ import org.apache.ignite.lang.IgniteCallable;
 import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.resources.IgniteInstanceResource;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -69,7 +70,7 @@ public class IgniteClusterProcessProxy implements IgniteClusterEx {
     }
 
     /** {@inheritDoc} */
-    @Override public ClusterGroup forIgfsMetadataDataNodes(@Nullable String igfsName, @Nullable String metaCacheName) {
+    @Override public ClusterGroup forIgfsMetadataDataNodes(String igfsName, @Nullable String metaCacheName) {
         throw new UnsupportedOperationException("Operation is not supported yet.");
     }
 
@@ -224,17 +225,17 @@ public class IgniteClusterProcessProxy implements IgniteClusterEx {
     }
 
     /** {@inheritDoc} */
-    @Override public ClusterGroup forCacheNodes(String cacheName) {
+    @Override public ClusterGroup forCacheNodes(@NotNull String cacheName) {
         throw new UnsupportedOperationException("Operation is not supported yet.");
     }
 
     /** {@inheritDoc} */
-    @Override public ClusterGroup forDataNodes(String cacheName) {
+    @Override public ClusterGroup forDataNodes(@NotNull String cacheName) {
         throw new UnsupportedOperationException("Operation is not supported yet.");
     }
 
     /** {@inheritDoc} */
-    @Override public ClusterGroup forClientNodes(String cacheName) {
+    @Override public ClusterGroup forClientNodes(@NotNull String cacheName) {
         throw new UnsupportedOperationException("Operation is not supported yet.");
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
index dc76852..26c86dc 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java
@@ -356,11 +356,6 @@ public class IgniteProcessProxy implements IgniteEx {
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public <K, V> IgniteInternalCache<K, V> cachex() {
-        throw new UnsupportedOperationException("Operation isn't supported yet.");
-    }
-
-    /** {@inheritDoc} */
     @Override public Collection<IgniteInternalCache<?, ?>> cachesx(
         @Nullable IgnitePredicate<? super IgniteInternalCache<?, ?>>... p) {
         throw new UnsupportedOperationException("Operation isn't supported yet.");

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/testframework/test/ParametersTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/test/ParametersTest.java b/modules/core/src/test/java/org/apache/ignite/testframework/test/ParametersTest.java
index 2870b06..736db12 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/test/ParametersTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/test/ParametersTest.java
@@ -29,6 +29,9 @@ import org.apache.ignite.testframework.configvariations.Parameters;
  * Test.
  */
 public class ParametersTest extends TestCase {
+    /** */
+    private static final String DEFAULT_CACHE_NAME = "default";
+
     /**
      * @throws Exception If failed.
      */
@@ -40,7 +43,7 @@ public class ParametersTest extends TestCase {
         Set<CacheMode> res = new HashSet<>();
 
         for (ConfigParameter<CacheConfiguration> modeApplier : modes) {
-            CacheConfiguration cfg = new CacheConfiguration();
+            CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             modeApplier.apply(cfg);
 
@@ -71,7 +74,7 @@ public class ParametersTest extends TestCase {
         for (int i = 1; i < cfgParam.length; i++) {
             ConfigParameter<CacheConfiguration> modeApplier = cfgParam[i];
 
-            CacheConfiguration cfg = new CacheConfiguration();
+            CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             modeApplier.apply(cfg);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestTask1.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestTask1.java b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestTask1.java
index 84c1da7..4870d64 100644
--- a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestTask1.java
+++ b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestTask1.java
@@ -50,7 +50,7 @@ public class CacheDeploymentTestTask1 extends ComputeTaskAdapter<ClusterNode, Ob
                     X.println("Executing CacheDeploymentTestTask1 job on node " +
                         ignite.cluster().localNode().id());
 
-                    IgniteCache<String, CacheDeploymentTestValue> cache = ignite.cache(null);
+                    IgniteCache<String, CacheDeploymentTestValue> cache = ignite.cache("default");
 
                     for (int i = 0; i < PUT_CNT; i++)
                         cache.put("1" + i, new CacheDeploymentTestValue());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestTask3.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestTask3.java b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestTask3.java
index 7317905..b6ca1fa 100644
--- a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestTask3.java
+++ b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestTask3.java
@@ -49,7 +49,7 @@ public class CacheDeploymentTestTask3 extends ComputeTaskAdapter<T2<ClusterNode,
                         X.println("Executing CacheDeploymentTestTask3 job on node " +
                                 ignite.cluster().localNode().id());
 
-                        ignite.<String, CacheDeploymentTestValue>cache(null).put(val,
+                        ignite.<String, CacheDeploymentTestValue>cache("default").put(val,
                                 new CacheDeploymentTestValue());
 
                         return null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/GridP2PContinuousDeploymentTask1.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/GridP2PContinuousDeploymentTask1.java b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/GridP2PContinuousDeploymentTask1.java
index d32e305..0e651f3 100644
--- a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/GridP2PContinuousDeploymentTask1.java
+++ b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/GridP2PContinuousDeploymentTask1.java
@@ -42,7 +42,7 @@ public class GridP2PContinuousDeploymentTask1 extends ComputeTaskSplitAdapter<Ob
             @Override public Object execute() {
                 X.println(">>> Executing GridP2PContinuousDeploymentTask1 job.");
 
-                ignite.cache(null).put("key", new TestUserResource());
+                ignite.cache("default").put("key", new TestUserResource());
 
                 return null;
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/cache/CacheNoValueClassOnServerTestClient.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/cache/CacheNoValueClassOnServerTestClient.java b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/cache/CacheNoValueClassOnServerTestClient.java
index c1f3ff6..156d750 100644
--- a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/cache/CacheNoValueClassOnServerTestClient.java
+++ b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/cache/CacheNoValueClassOnServerTestClient.java
@@ -36,7 +36,7 @@ public class CacheNoValueClassOnServerTestClient extends NoValueClassOnServerAbs
 
     /** {@inheritDoc} */
     @Override protected void runTest() throws Exception {
-        IgniteCache<Integer, Person> cache = ignite.cache(null);
+        IgniteCache<Integer, Person> cache = ignite.cache("default");
 
         for (int i = 0; i < 100; i++)
             cache.put(i, new Person("name-" + i));

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/flink/src/test/java/org/apache/ignite/sink/flink/FlinkIgniteSinkSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/flink/src/test/java/org/apache/ignite/sink/flink/FlinkIgniteSinkSelfTest.java b/modules/flink/src/test/java/org/apache/ignite/sink/flink/FlinkIgniteSinkSelfTest.java
index 596dea7..93851ca 100644
--- a/modules/flink/src/test/java/org/apache/ignite/sink/flink/FlinkIgniteSinkSelfTest.java
+++ b/modules/flink/src/test/java/org/apache/ignite/sink/flink/FlinkIgniteSinkSelfTest.java
@@ -151,7 +151,7 @@ public class FlinkIgniteSinkSelfTest extends GridCommonAbstractTest {
         // Listen to cache PUT events and expect as many as messages as test data items.
         CacheListener listener = new CacheListener();
 
-        ignite.events(ignite.cluster().forCacheNodes(null)).localListen(listener, EVT_CACHE_OBJECT_PUT);
+        ignite.events(ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME)).localListen(listener, EVT_CACHE_OBJECT_PUT);
 
         return listener;
     }
@@ -162,7 +162,7 @@ public class FlinkIgniteSinkSelfTest extends GridCommonAbstractTest {
      * @param listener Cache listener.
      */
     private void unsubscribeToPutEvents(CacheListener listener) {
-        ignite.events(ignite.cluster().forCacheNodes(null)).stopLocalListen(listener, EVT_CACHE_OBJECT_PUT);
+        ignite.events(ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME)).stopLocalListen(listener, EVT_CACHE_OBJECT_PUT);
     }
 
     /** Listener. */

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
index 2a83941..ddba4cc 100644
--- a/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
+++ b/modules/geospatial/src/test/java/org/apache/ignite/internal/processors/query/h2/H2IndexingAbstractGeoSelfTest.java
@@ -39,6 +39,7 @@ import org.apache.ignite.internal.util.GridStringBuilder;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.testframework.GridTestUtils;
+import org.jetbrains.annotations.NotNull;
 
 import javax.cache.Cache;
 import java.io.Serializable;
@@ -212,7 +213,7 @@ public abstract class H2IndexingAbstractGeoSelfTest extends GridCacheAbstractSel
      * @param valCls Value class.
      * @return Cache configuration.
      */
-    private <K, V> CacheConfiguration<K, V> cacheConfig(String name, boolean partitioned, Class<?> keyCls,
+    private <K, V> CacheConfiguration<K, V> cacheConfig(@NotNull String name, boolean partitioned, Class<?> keyCls,
         Class<?> valCls) throws Exception {
         CacheConfiguration<K, V> ccfg = new CacheConfiguration<K, V>(name)
             .setName(name)

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopAbstractSelfTest.java b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopAbstractSelfTest.java
index eb8caa2..44403c2 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopAbstractSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/impl/HadoopAbstractSelfTest.java
@@ -176,7 +176,7 @@ public abstract class HadoopAbstractSelfTest extends GridCommonAbstractTest {
      * @return IGFS meta cache configuration.
      */
     public CacheConfiguration metaCacheConfiguration() {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setCacheMode(REPLICATED);
         cfg.setAtomicityMode(TRANSACTIONAL);
@@ -189,7 +189,7 @@ public abstract class HadoopAbstractSelfTest extends GridCommonAbstractTest {
      * @return IGFS data cache configuration.
      */
     protected CacheConfiguration dataCacheConfiguration() {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setCacheMode(PARTITIONED);
         cfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java
index cb179c4..bde0845 100644
--- a/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java
+++ b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java
@@ -120,7 +120,7 @@ public class HibernateL2CacheConfigurationSelfTest extends GridCommonAbstractTes
      * @return Cache configuration.
      */
     private CacheConfiguration cacheConfiguration(String cacheName) {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setName(cacheName);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java
index 7ac790c..1700409 100644
--- a/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java
+++ b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java
@@ -435,7 +435,7 @@ public class HibernateL2CacheSelfTest extends GridCommonAbstractTest {
      * @return Cache configuration for {@link GeneralDataRegion}.
      */
     private CacheConfiguration generalRegionConfiguration(String regionName) {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setName(regionName);
 
@@ -457,7 +457,7 @@ public class HibernateL2CacheSelfTest extends GridCommonAbstractTest {
      * @return Cache configuration for {@link TransactionalDataRegion}.
      */
     protected CacheConfiguration transactionalRegionConfiguration(String regionName) {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setName(regionName);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
index f6c8a2d..0dab22c 100644
--- a/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
+++ b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
@@ -99,7 +99,7 @@ public class CacheHibernateStoreFactorySelfTest extends GridCommonAbstractTest {
      * @return Cache configuration with store.
      */
     private CacheConfiguration<Integer, String> cacheConfiguration() {
-        CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         CacheHibernateBlobStoreFactory<Integer, String> factory = new CacheHibernateBlobStoreFactory();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
index 7d4f280..a329f2b 100644
--- a/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
+++ b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
@@ -99,7 +99,7 @@ public class CacheHibernateStoreFactorySelfTest extends GridCommonAbstractTest {
      * @return Cache configuration with store.
      */
     private CacheConfiguration<Integer, String> cacheConfiguration() {
-        CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         CacheHibernateBlobStoreFactory<Integer, String> factory = new CacheHibernateBlobStoreFactory();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 83fb1f2..f7466a8 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -431,7 +431,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
      * @param space Space.
      * @return Connection.
      */
-    public Connection connectionForSpace(@Nullable String space) {
+    public Connection connectionForSpace(String space) {
         try {
             return connectionForThread(schema(space));
         }
@@ -639,7 +639,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
     }
 
     /** {@inheritDoc} */
-    @Override public void store(@Nullable String spaceName,
+    @Override public void store(String spaceName,
         String typeName,
         KeyCacheObject k,
         int partId,
@@ -695,7 +695,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
     }
 
     /** {@inheritDoc} */
-    @Override public void remove(@Nullable String spaceName,
+    @Override public void remove(String spaceName,
         GridQueryTypeDescriptor type,
         KeyCacheObject key,
         int partId,
@@ -788,7 +788,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
     }
 
     /** {@inheritDoc} */
-    @Override public void dynamicIndexCreate(@Nullable final String spaceName, final String tblName,
+    @Override public void dynamicIndexCreate(final String spaceName, final String tblName,
         final QueryIndexDescriptorImpl idxDesc, boolean ifNotExists, SchemaIndexCacheVisitor cacheVisitor)
         throws IgniteCheckedException {
         // Locate table.
@@ -845,7 +845,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
 
     /** {@inheritDoc} */
     @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
-    @Override public void dynamicIndexDrop(@Nullable final String spaceName, String idxName, boolean ifExists)
+    @Override public void dynamicIndexDrop(final String spaceName, String idxName, boolean ifExists)
         throws IgniteCheckedException{
         String schemaName = schema(spaceName);
 
@@ -983,7 +983,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
 
     @SuppressWarnings("unchecked")
     @Override public <K, V> GridCloseableIterator<IgniteBiTuple<K, V>> queryLocalText(
-        @Nullable String spaceName, String qry, String typeName,
+        String spaceName, String qry, String typeName,
         IndexingQueryFilter filters) throws IgniteCheckedException {
         TableDescriptor tbl = tableDescriptor(typeName, spaceName);
 
@@ -1005,7 +1005,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
     }
 
     /** {@inheritDoc} */
-    @Override public void unregisterType(@Nullable String spaceName, String typeName)
+    @Override public void unregisterType(String spaceName, String typeName)
         throws IgniteCheckedException {
         TableDescriptor tbl = tableDescriptor(typeName, spaceName);
 
@@ -1027,7 +1027,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
      * @throws IgniteCheckedException If failed.
      */
     @SuppressWarnings("unchecked")
-    public GridQueryFieldsResult queryLocalSqlFields(@Nullable final String spaceName, final String qry,
+    public GridQueryFieldsResult queryLocalSqlFields(final String spaceName, final String qry,
         @Nullable final Collection<Object> params, final IndexingQueryFilter filter, boolean enforceJoinOrder,
         final int timeout, final GridQueryCancel cancel)
         throws IgniteCheckedException {
@@ -1092,7 +1092,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
     }
 
     /** {@inheritDoc} */
-    @Override public long streamUpdateQuery(@Nullable String spaceName, String qry,
+    @Override public long streamUpdateQuery(String spaceName, String qry,
         @Nullable Object[] params, IgniteDataStreamer<?, ?> streamer) throws IgniteCheckedException {
         final Connection conn = connectionForSpace(spaceName);
 
@@ -1435,7 +1435,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
      * @return Queried rows.
      * @throws IgniteCheckedException If failed.
      */
-    public <K, V> GridCloseableIterator<IgniteBiTuple<K, V>> queryLocalSql(@Nullable String spaceName,
+    public <K, V> GridCloseableIterator<IgniteBiTuple<K, V>> queryLocalSql(String spaceName,
         final String qry, String alias, @Nullable final Collection<Object> params, String type,
         final IndexingQueryFilter filter, GridQueryCancel cancel) throws IgniteCheckedException {
         final TableDescriptor tbl = tableDescriptor(type, spaceName);
@@ -1843,7 +1843,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
      * @param type Type description.
      * @throws IgniteCheckedException In case of error.
      */
-    @Override public boolean registerType(@Nullable String spaceName, GridQueryTypeDescriptor type)
+    @Override public boolean registerType(String spaceName, GridQueryTypeDescriptor type)
         throws IgniteCheckedException {
         validateTypeDescriptor(type);
 
@@ -2053,7 +2053,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
      * @param space Space name.
      * @return Table descriptor.
      */
-    @Nullable private TableDescriptor tableDescriptor(String type, @Nullable String space) {
+    @Nullable private TableDescriptor tableDescriptor(String type, String space) {
         Schema s = schemas.get(schema(space));
 
         if (s == null)
@@ -2083,7 +2083,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
      * @param space Space name. {@code null} would be converted to an empty string.
      * @return Schema name. Should not be null since we should not fail for an invalid space name.
      */
-    private String schema(@Nullable String space) {
+    private String schema(String space) {
         return emptyIfNull(space2schema.get(emptyIfNull(space)));
     }
 
@@ -2127,7 +2127,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
      * @param type Type descriptor.
      * @throws IgniteCheckedException If failed.
      */
-    @Override public void rebuildIndexesFromHash(@Nullable String spaceName,
+    @Override public void rebuildIndexesFromHash(String spaceName,
         GridQueryTypeDescriptor type) throws IgniteCheckedException {
         TableDescriptor tbl = tableDescriptor(type.name(), spaceName);
 
@@ -2186,7 +2186,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
     }
 
     /** {@inheritDoc} */
-    @Override public void markForRebuildFromHash(@Nullable String spaceName, GridQueryTypeDescriptor type) {
+    @Override public void markForRebuildFromHash(String spaceName, GridQueryTypeDescriptor type) {
         TableDescriptor tbl = tableDescriptor(type.name(), spaceName);
 
         if (tbl == null)
@@ -2205,7 +2205,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
      * @return Size.
      * @throws IgniteCheckedException If failed or {@code -1} if the type is unknown.
      */
-    long size(@Nullable String spaceName, String typeName) throws IgniteCheckedException {
+    long size(String spaceName, String typeName) throws IgniteCheckedException {
         TableDescriptor tbl = tableDescriptor(typeName, spaceName);
 
         if (tbl == null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinarySerializationQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinarySerializationQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinarySerializationQuerySelfTest.java
index 2b2e9de..4b3c881 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinarySerializationQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/BinarySerializationQuerySelfTest.java
@@ -107,9 +107,8 @@ public class BinarySerializationQuerySelfTest extends GridCommonAbstractTest {
             cfg.setBinaryConfiguration(binCfg);
         }
 
-        CacheConfiguration cacheCfg = new CacheConfiguration();
+        CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
-        cacheCfg.setName(null);
         cacheCfg.setCacheMode(CacheMode.PARTITIONED);
         cacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
         cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
@@ -129,7 +128,7 @@ public class BinarySerializationQuerySelfTest extends GridCommonAbstractTest {
 
         ignite = Ignition.start(cfg);
 
-        cache = ignite.cache(null);
+        cache = ignite.cache(DEFAULT_CACHE_NAME);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheBinaryKeyConcurrentQueryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheBinaryKeyConcurrentQueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheBinaryKeyConcurrentQueryTest.java
index 4c75140..0cc593b 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheBinaryKeyConcurrentQueryTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheBinaryKeyConcurrentQueryTest.java
@@ -223,7 +223,7 @@ public class CacheBinaryKeyConcurrentQueryTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     private CacheConfiguration cacheConfiguration(String name, CacheAtomicityMode atomicityMode) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(name);
         ccfg.setCacheMode(PARTITIONED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIndexStreamerTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIndexStreamerTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIndexStreamerTest.java
index d5065e1..dda7eed 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIndexStreamerTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheIndexStreamerTest.java
@@ -87,7 +87,7 @@ public class CacheIndexStreamerTest extends GridCommonAbstractTest {
                     ThreadLocalRandom rnd = ThreadLocalRandom.current();
 
                     while (!stop.get()) {
-                        try (IgniteDataStreamer<Integer, String> streamer = ignite.dataStreamer(null)) {
+                        try (IgniteDataStreamer<Integer, String> streamer = ignite.dataStreamer(DEFAULT_CACHE_NAME)) {
                             for (int i = 0; i < 1; i++)
                                 streamer.addData(rnd.nextInt(KEYS), String.valueOf(i));
                         }
@@ -134,7 +134,7 @@ public class CacheIndexStreamerTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     private CacheConfiguration cacheConfiguration(CacheAtomicityMode atomicityMode) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapBatchIndexingBaseTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapBatchIndexingBaseTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapBatchIndexingBaseTest.java
index 41b6c83..370fca3 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapBatchIndexingBaseTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapBatchIndexingBaseTest.java
@@ -90,7 +90,7 @@ public abstract class CacheOffheapBatchIndexingBaseTest extends GridCommonAbstra
      * @return Cache configuration.
      */
     protected CacheConfiguration<Object, Object> cacheConfiguration(Class<?>[] indexedTypes) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(ATOMIC);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheOperationsWithExpirationTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheOperationsWithExpirationTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheOperationsWithExpirationTest.java
index 90d2f6e..4cd6960 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheOperationsWithExpirationTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheOperationsWithExpirationTest.java
@@ -57,7 +57,7 @@ public class CacheOperationsWithExpirationTest extends GridCommonAbstractTest {
     private CacheConfiguration<String, TestIndexedType> cacheConfiguration(CacheAtomicityMode atomicityMode,
         long offheapMem,
         boolean idx) {
-        CacheConfiguration<String, TestIndexedType> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<String, TestIndexedType> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setBackups(1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryBuildValueTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryBuildValueTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryBuildValueTest.java
index ae80721..0adad26 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryBuildValueTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryBuildValueTest.java
@@ -54,7 +54,7 @@ public class CacheQueryBuildValueTest extends GridCommonAbstractTest {
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
 
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         QueryEntity entity = new QueryEntity();
         entity.setKeyType(Integer.class.getName());
@@ -109,7 +109,7 @@ public class CacheQueryBuildValueTest extends GridCommonAbstractTest {
     public void testBuilderAndQuery() throws Exception {
         Ignite node = ignite(0);
 
-        final IgniteCache<Object, Object> cache = node.cache(null);
+        final IgniteCache<Object, Object> cache = node.cache(DEFAULT_CACHE_NAME);
 
         IgniteBinary binary = node.binary();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryEvictDataLostTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryEvictDataLostTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryEvictDataLostTest.java
index 7b79c72..728c8d0 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryEvictDataLostTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryEvictDataLostTest.java
@@ -48,7 +48,7 @@ public class CacheQueryEvictDataLostTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration() throws Exception {
         IgniteConfiguration cfg = super.getConfiguration();
 
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setName("cache-1");
         ccfg.setEvictionPolicy(new LruEvictionPolicy(10));

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryFilterExpiredTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryFilterExpiredTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryFilterExpiredTest.java
index 80122a2..47c87fa 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryFilterExpiredTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryFilterExpiredTest.java
@@ -74,7 +74,7 @@ public class CacheQueryFilterExpiredTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     private void checkFilterExpired(Ignite ignite, CacheAtomicityMode atomicityMode, boolean eagerTtl) throws Exception {
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setEagerTtl(eagerTtl);
         ccfg.setIndexedTypes(Integer.class, Integer.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheRandomOperationsMultithreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheRandomOperationsMultithreadedTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheRandomOperationsMultithreadedTest.java
index 4240441..084b6d5 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheRandomOperationsMultithreadedTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheRandomOperationsMultithreadedTest.java
@@ -340,7 +340,7 @@ public class CacheRandomOperationsMultithreadedTest extends GridCommonAbstractTe
         CacheAtomicityMode atomicityMode,
         @Nullable  EvictionPolicy<Object, Object> evictionPlc,
         boolean indexing) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
index 6989314..999b1ad 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheScanPartitionQueryFallbackSelfTest.java
@@ -237,12 +237,12 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
                     @Override public Object call() throws Exception {
                         int nodeId = nodeIdx.getAndIncrement();
 
-                        IgniteCache<Integer, Integer> cache = grid(nodeId).cache(null);
+                        IgniteCache<Integer, Integer> cache = grid(nodeId).cache(DEFAULT_CACHE_NAME);
 
                         int cntr = 0;
 
                         while (!done.get()) {
-                            int part = ThreadLocalRandom.current().nextInt(ignite(nodeId).affinity(null).partitions());
+                            int part = ThreadLocalRandom.current().nextInt(ignite(nodeId).affinity(DEFAULT_CACHE_NAME).partitions());
 
                             if (cntr++ % 100 == 0)
                                 info("Running query [node=" + nodeId + ", part=" + part + ']');
@@ -314,12 +314,12 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
                     @Override public Object call() throws Exception {
                         int nodeId = nodeIdx.getAndIncrement();
 
-                        IgniteCache<Integer, Integer> cache = grid(nodeId).cache(null);
+                        IgniteCache<Integer, Integer> cache = grid(nodeId).cache(DEFAULT_CACHE_NAME);
 
                         int cntr = 0;
 
                         while (!done.get()) {
-                            int part = ThreadLocalRandom.current().nextInt(ignite(nodeId).affinity(null).partitions());
+                            int part = ThreadLocalRandom.current().nextInt(ignite(nodeId).affinity(DEFAULT_CACHE_NAME).partitions());
 
                             if (cntr++ % 100 == 0)
                                 info("Running query [node=" + nodeId + ", part=" + part + ']');
@@ -356,7 +356,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
      */
     protected IgniteCacheProxy<Integer, Integer> fillCache(Ignite ignite) {
         IgniteCacheProxy<Integer, Integer> cache =
-            (IgniteCacheProxy<Integer, Integer>)ignite.<Integer, Integer>cache(null);
+            (IgniteCacheProxy<Integer, Integer>)ignite.<Integer, Integer>cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < KEYS_CNT; i++) {
             cache.put(i, i);
@@ -440,7 +440,7 @@ public class CacheScanPartitionQueryFallbackSelfTest extends GridCommonAbstractT
      * @return Local partitions.
      */
     private Set<Integer> localPartitions(Ignite ignite) {
-        GridCacheContext cctx = ((IgniteCacheProxy)ignite.cache(null)).context();
+        GridCacheContext cctx = ((IgniteCacheProxy)ignite.cache(DEFAULT_CACHE_NAME)).context();
 
         Collection<GridDhtLocalPartition> owningParts = F.view(cctx.topology().localPartitions(),
             new IgnitePredicate<GridDhtLocalPartition>() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java
index a067770..f30c52c 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheSqlQueryValueCopySelfTest.java
@@ -58,7 +58,7 @@ public class CacheSqlQueryValueCopySelfTest extends GridCommonAbstractTest {
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
 
-        CacheConfiguration<Integer, Value> cc = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Value> cc = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cc.setCopyOnRead(true);
         cc.setIndexedTypes(Integer.class, Value.class);
@@ -78,7 +78,7 @@ public class CacheSqlQueryValueCopySelfTest extends GridCommonAbstractTest {
 
     /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
-        IgniteCache<Integer, Value> cache = grid(0).cache(null);
+        IgniteCache<Integer, Value> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < KEYS; i++)
             cache.put(i, new Value(i, "before-" + i));
@@ -86,7 +86,7 @@ public class CacheSqlQueryValueCopySelfTest extends GridCommonAbstractTest {
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-        IgniteCache<Integer, Value> cache = grid(0).cache(null);
+        IgniteCache<Integer, Value> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.removeAll();
 
@@ -107,7 +107,7 @@ public class CacheSqlQueryValueCopySelfTest extends GridCommonAbstractTest {
      */
     public void testTwoStepSqlClientQuery() throws Exception {
         try (Ignite client = startGrid("client")) {
-            IgniteCache<Integer, Value> cache = client.cache(null);
+            IgniteCache<Integer, Value> cache = client.cache(DEFAULT_CACHE_NAME);
 
             List<Cache.Entry<Integer, Value>> all = cache.query(
                 new SqlQuery<Integer, Value>(Value.class, "select * from Value")).getAll();
@@ -136,7 +136,7 @@ public class CacheSqlQueryValueCopySelfTest extends GridCommonAbstractTest {
      * Test two step query without local reduce phase.
      */
     public void testTwoStepSkipReduceSqlQuery() {
-        IgniteCache<Integer, Value> cache = grid(0).cache(null);
+        IgniteCache<Integer, Value> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         List<Cache.Entry<Integer, Value>> all = cache.query(
             new SqlQuery<Integer, Value>(Value.class, "select * from Value").setPageSize(3)).getAll();
@@ -153,7 +153,7 @@ public class CacheSqlQueryValueCopySelfTest extends GridCommonAbstractTest {
      * Test two step query value copy.
      */
     public void testTwoStepReduceSqlQuery() {
-        IgniteCache<Integer, Value> cache = grid(0).cache(null);
+        IgniteCache<Integer, Value> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         QueryCursor<List<?>> qry = cache.query(new SqlFieldsQuery("select _val from Value order by _key"));
 
@@ -171,7 +171,7 @@ public class CacheSqlQueryValueCopySelfTest extends GridCommonAbstractTest {
      * Tests local sql query.
      */
     public void testLocalSqlQuery() {
-        IgniteCache<Integer, Value> cache = grid(0).cache(null);
+        IgniteCache<Integer, Value> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         SqlQuery<Integer, Value> qry = new SqlQuery<>(Value.class.getSimpleName(), "select * from Value");
         qry.setLocal(true);
@@ -190,7 +190,7 @@ public class CacheSqlQueryValueCopySelfTest extends GridCommonAbstractTest {
      * Tests local sql query.
      */
     public void testLocalSqlFieldsQuery() {
-        IgniteCache<Integer, Value> cache = grid(0).cache(null);
+        IgniteCache<Integer, Value> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         QueryCursor<List<?>> cur = cache.query(new SqlFieldsQuery("select _val from Value").setLocal(true));
 
@@ -215,7 +215,7 @@ public class CacheSqlQueryValueCopySelfTest extends GridCommonAbstractTest {
                 try {
                     log.info(">>> Query started");
 
-                    grid(0).cache(null).query(qry).getAll();
+                    grid(0).cache(DEFAULT_CACHE_NAME).query(qry).getAll();
 
                     log.info(">>> Query finished");
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapSelfTest.java
index 8d91a57..ee17a33 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapSelfTest.java
@@ -17,7 +17,6 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import javax.cache.Cache;
@@ -26,7 +25,6 @@ import org.apache.ignite.cache.CachePeekMode;
 import org.apache.ignite.cache.query.annotations.QuerySqlField;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.util.typedef.internal.CU;
 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;
@@ -88,7 +86,7 @@ public class GridCacheOffHeapSelfTest extends GridCommonAbstractTest {
 
             grid(0);
 
-            IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+            IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < 100; i++) {
                 info("Putting: " + i);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapIndexEntryEvictTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapIndexEntryEvictTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapIndexEntryEvictTest.java
index d64aa7c..33df513 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapIndexEntryEvictTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapIndexEntryEvictTest.java
@@ -86,7 +86,7 @@ public class GridCacheOffheapIndexEntryEvictTest extends GridCommonAbstractTest
      * @throws Exception If failed.
      */
     public void testQueryWhenLocked() throws Exception {
-        IgniteCache<Integer, TestValue> cache = grid(0).cache(null);
+        IgniteCache<Integer, TestValue> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         List<Lock> locks = new ArrayList<>();
 
@@ -120,7 +120,7 @@ public class GridCacheOffheapIndexEntryEvictTest extends GridCommonAbstractTest
     public void testUpdates() throws Exception {
         final int ENTRIES = 500;
 
-        IgniteCache<Integer, TestValue> cache = grid(0).cache(null);
+        IgniteCache<Integer, TestValue> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < ENTRIES; i++) {
             for (int j = 0; j < 3; j++) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQuerySimpleBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQuerySimpleBenchmark.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQuerySimpleBenchmark.java
index 17ee024..cc1a484 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQuerySimpleBenchmark.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQuerySimpleBenchmark.java
@@ -61,7 +61,7 @@ public class GridCacheQuerySimpleBenchmark extends GridCommonAbstractTest {
 
         c.setDiscoverySpi(disco);
 
-        CacheConfiguration<?,?> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<?,?> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setName("offheap-cache");
         ccfg.setCacheMode(CacheMode.PARTITIONED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridIndexingWithNoopSwapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridIndexingWithNoopSwapSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridIndexingWithNoopSwapSelfTest.java
index d16e8bb..570a1b0 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridIndexingWithNoopSwapSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridIndexingWithNoopSwapSelfTest.java
@@ -93,7 +93,7 @@ public class GridIndexingWithNoopSwapSelfTest extends GridCommonAbstractTest {
 
     /** @throws Exception If failed. */
     public void testQuery() throws Exception {
-        IgniteCache<Integer, ObjectValue> cache = ignite.cache(null);
+        IgniteCache<Integer, ObjectValue> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         int cnt = 10;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectFieldsQuerySelfTest.java
index dad5135..6c34373 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectFieldsQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectFieldsQuerySelfTest.java
@@ -90,7 +90,6 @@ public class IgniteBinaryObjectFieldsQuerySelfTest extends GridCommonAbstractTes
     protected CacheConfiguration cache(CacheMode cacheMode, CacheAtomicityMode atomicity) throws Exception {
         CacheConfiguration cache = defaultCacheConfiguration();
 
-        cache.setName(null);
         cache.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
         cache.setRebalanceMode(CacheRebalanceMode.SYNC);
         cache.setCacheMode(cacheMode);
@@ -198,7 +197,7 @@ public class IgniteBinaryObjectFieldsQuerySelfTest extends GridCommonAbstractTes
             }
         }
         finally {
-            grid(3).destroyCache(null);
+            grid(3).destroyCache(DEFAULT_CACHE_NAME);
         }
     }
 
@@ -233,7 +232,7 @@ public class IgniteBinaryObjectFieldsQuerySelfTest extends GridCommonAbstractTes
             ScanQuery<BinaryObject, BinaryObject> scanQry = new ScanQuery<>(new PersonKeyFilter(max));
 
             QueryCursor<Cache.Entry<BinaryObject, BinaryObject>> curs = grid(GRID_CNT - 1)
-                .cache(null).withKeepBinary().query(scanQry);
+                .cache(DEFAULT_CACHE_NAME).withKeepBinary().query(scanQry);
 
             List<Cache.Entry<BinaryObject, BinaryObject>> records = curs.getAll();
 
@@ -248,8 +247,8 @@ public class IgniteBinaryObjectFieldsQuerySelfTest extends GridCommonAbstractTes
             }
         }
         finally {
-            grid(GRID_CNT - 1).cache(null).removeAll();
-            grid(GRID_CNT - 1).destroyCache(null);
+            grid(GRID_CNT - 1).cache(DEFAULT_CACHE_NAME).removeAll();
+            grid(GRID_CNT - 1).destroyCache(DEFAULT_CACHE_NAME);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java
index c845496..19d3206 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java
@@ -106,7 +106,7 @@ public class IgniteBinaryObjectQueryArgumentsTest extends GridCommonAbstractTest
      * @return Cache config.
      */
     protected CacheConfiguration getCacheConfiguration(final String cacheName) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
 
         QueryEntity person = new QueryEntity();
@@ -164,7 +164,7 @@ public class IgniteBinaryObjectQueryArgumentsTest extends GridCommonAbstractTest
      */
     @SuppressWarnings("unchecked")
     private CacheConfiguration getCacheConfiguration(final String cacheName, final Class<?> key, final Class<?> val) {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setName(cacheName);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryWrappedObjectFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryWrappedObjectFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryWrappedObjectFieldsQuerySelfTest.java
index 923d601..bff725c 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryWrappedObjectFieldsQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryWrappedObjectFieldsQuerySelfTest.java
@@ -20,7 +20,8 @@ package org.apache.ignite.internal.processors.cache;
  * Tests that server nodes do not need class definitions to execute queries.
  * Used internal class.
  */
-public class IgniteBinaryWrappedObjectFieldsQuerySelfTest extends IgniteBinaryObjectFieldsQuerySelfTest {
+public class
+IgniteBinaryWrappedObjectFieldsQuerySelfTest extends IgniteBinaryObjectFieldsQuerySelfTest {
     /** {@inheritDoc} */
     protected String getPersonClassName() {
         return "org.apache.ignite.tests.p2p.cache.PersonWrapper$Person";

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
index fed8980..c27747c 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
@@ -345,7 +345,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
                     assert String.class.getName().equals(fields.get("_KEY"));
                     assert String.class.getName().equals(fields.get("_VAL"));
                 }
-                else if (meta.cacheName() == null)
+                else if (DEFAULT_CACHE_NAME.equals(meta.cacheName()))
                     assertTrue("Invalid types size", types.isEmpty());
                 else
                     fail("Unknown cache: " + meta.cacheName());


[25/51] [abbrv] ignite git commit: IGNITE-5088: Fixed OSGI test build instructions.

Posted by sb...@apache.org.
IGNITE-5088: Fixed OSGI test build instructions.


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

Branch: refs/heads/ignite-5075-cacheStart
Commit: 34a5ae3c052f5de836f9b7434492711de41826d0
Parents: 6998785
Author: devozerov <vo...@gridgain.com>
Authored: Wed Apr 26 17:19:19 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Apr 26 17:19:19 2017 +0300

----------------------------------------------------------------------
 modules/osgi/README.txt | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/34a5ae3c/modules/osgi/README.txt
----------------------------------------------------------------------
diff --git a/modules/osgi/README.txt b/modules/osgi/README.txt
index 35b133d..7e46032 100644
--- a/modules/osgi/README.txt
+++ b/modules/osgi/README.txt
@@ -43,12 +43,7 @@ Bundles are provisioned into the container via mvn: URLs. For this to work, you
 top directory of the Ignite source tree, including the install goal, which provisions the modules into your local
 Maven repository:
 
-   mvn clean install -Plgpl
-
-Neither compiling and running the tests, nor generating Javadocs are necessary. To disable these steps,
-use these switches:
-
-   -DskipTests -Dmaven.test.skip=true -Dmaven.javadoc.skip=true
+   mvn clean install -Plgpl -Dmaven.javadoc.skip=true
 
 You may then run the OSGi test suite:
 


[10/51] [abbrv] ignite git commit: ignite-1794 Refactored hibernate modules, switched to hibernate 5.1

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListenerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListenerSelfTest.java b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListenerSelfTest.java
new file mode 100644
index 0000000..0010425
--- /dev/null
+++ b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListenerSelfTest.java
@@ -0,0 +1,242 @@
+/*
+ * 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.cache.store.hibernate;
+
+import java.io.Serializable;
+import java.util.Map;
+import javax.cache.Cache;
+import javax.cache.configuration.Factory;
+import javax.cache.integration.CacheLoaderException;
+import javax.cache.integration.CacheWriterException;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.cache.store.CacheStoreAdapter;
+import org.apache.ignite.cache.store.CacheStoreSession;
+import org.apache.ignite.cache.store.CacheStoreSessionListener;
+import org.apache.ignite.cache.store.CacheStoreSessionListenerAbstractSelfTest;
+import org.apache.ignite.cache.store.jdbc.CacheJdbcStoreSessionListener;
+import org.apache.ignite.lang.IgniteBiInClosure;
+import org.apache.ignite.resources.CacheStoreSessionResource;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.resource.transaction.spi.TransactionStatus;
+
+/**
+ * Tests for {@link CacheJdbcStoreSessionListener}.
+ */
+public class CacheHibernateStoreSessionListenerSelfTest extends CacheStoreSessionListenerAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected Factory<? extends CacheStore<Integer, Integer>> storeFactory() {
+        return new Factory<CacheStore<Integer, Integer>>() {
+            @Override public CacheStore<Integer, Integer> create() {
+                return new Store();
+            }
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override protected Factory<CacheStoreSessionListener> sessionListenerFactory() {
+        return new Factory<CacheStoreSessionListener>() {
+            @Override public CacheStoreSessionListener create() {
+                CacheHibernateStoreSessionListener lsnr = new CacheHibernateStoreSessionListener();
+
+                SessionFactory sesFactory = new Configuration().
+                    setProperty("hibernate.connection.url", URL).
+                    addAnnotatedClass(Table1.class).
+                    addAnnotatedClass(Table2.class).
+                    buildSessionFactory();
+
+                lsnr.setSessionFactory(sesFactory);
+
+                return lsnr;
+            }
+        };
+    }
+
+    /**
+     */
+    private static class Store extends CacheStoreAdapter<Integer, Integer> {
+        /** */
+        private static String SES_CONN_KEY = "ses_conn";
+
+        /** */
+        @CacheStoreSessionResource
+        private CacheStoreSession ses;
+
+        /** {@inheritDoc} */
+        @Override public void loadCache(IgniteBiInClosure<Integer, Integer> clo, Object... args) {
+            loadCacheCnt.incrementAndGet();
+
+            checkSession();
+        }
+
+        /** {@inheritDoc} */
+        @Override public Integer load(Integer key) throws CacheLoaderException {
+            loadCnt.incrementAndGet();
+
+            checkSession();
+
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void write(Cache.Entry<? extends Integer, ? extends Integer> entry)
+            throws CacheWriterException {
+            writeCnt.incrementAndGet();
+
+            checkSession();
+
+            if (write.get()) {
+                Session hibSes = ses.attachment();
+
+                switch (ses.cacheName()) {
+                    case "cache1":
+                        hibSes.save(new Table1(entry.getKey(), entry.getValue()));
+
+                        break;
+
+                    case "cache2":
+                        if (fail.get())
+                            throw new CacheWriterException("Expected failure.");
+
+                        hibSes.save(new Table2(entry.getKey(), entry.getValue()));
+
+                        break;
+
+                    default:
+                        throw new CacheWriterException("Wring cache: " + ses.cacheName());
+                }
+            }
+        }
+
+        /** {@inheritDoc} */
+        @Override public void delete(Object key) throws CacheWriterException {
+            deleteCnt.incrementAndGet();
+
+            checkSession();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void sessionEnd(boolean commit) {
+            assertNull(ses.attachment());
+        }
+
+        /**
+         */
+        private void checkSession() {
+            Session hibSes = ses.attachment();
+
+            assertNotNull(hibSes);
+
+            assertTrue(hibSes.isOpen());
+
+            Transaction tx = hibSes.getTransaction();
+
+            assertNotNull(tx);
+
+            if (ses.isWithinTransaction())
+                assertEquals(TransactionStatus.ACTIVE, tx.getStatus());
+            else
+                assertFalse("Unexpected status: " + tx.getStatus(), tx.getStatus() == TransactionStatus.ACTIVE);
+
+            verifySameInstance(hibSes);
+        }
+
+        /**
+         * @param hibSes Session.
+         */
+        private void verifySameInstance(Session hibSes) {
+            Map<String, Session> props = ses.properties();
+
+            Session sesConn = props.get(SES_CONN_KEY);
+
+            if (sesConn == null)
+                props.put(SES_CONN_KEY, hibSes);
+            else {
+                assertSame(hibSes, sesConn);
+
+                reuseCnt.incrementAndGet();
+            }
+        }
+    }
+
+    /**
+     */
+    @Entity
+    @Table(name = "Table1")
+    private static class Table1 implements Serializable {
+        /** */
+        @Id
+        @GeneratedValue(strategy = GenerationType.IDENTITY)
+        @Column(name = "id")
+        private Integer id;
+
+        /** */
+        @Column(name = "key")
+        private int key;
+
+        /** */
+        @Column(name = "value")
+        private int value;
+
+        /**
+         * @param key Key.
+         * @param value Value.
+         */
+        private Table1(int key, int value) {
+            this.key = key;
+            this.value = value;
+        }
+    }
+
+    /**
+     */
+    @Entity
+    @Table(name = "Table2")
+    private static class Table2 implements Serializable {
+        /** */
+        @Id
+        @GeneratedValue(strategy = GenerationType.IDENTITY)
+        @Column(name = "id")
+        private Integer id;
+
+        /** */
+        @Column(name = "key")
+        private int key;
+
+        /** */
+        @Column(name = "value")
+        private int value;
+
+        /**
+         * @param key Key.
+         * @param value Value.
+         */
+        private Table2(int key, int value) {
+            this.key = key;
+            this.value = value;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml
new file mode 100644
index 0000000..3822b31
--- /dev/null
+++ b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+
+<!DOCTYPE hibernate-configuration PUBLIC
+        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+    <session-factory>
+        <!-- Show SQL. -->
+        <property name="show_sql">true</property>
+
+        <!-- Database connection settings (private in-memory database). -->
+        <property name="connection.url">jdbc:h2:mem:example;DB_CLOSE_DELAY=-1</property>
+
+        <!-- Only validate the database schema on startup in production mode. -->
+        <property name="hbm2ddl.auto">update</property>
+
+        <!-- H2 dialect. -->
+        <property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property>
+
+        <!-- Mappings. -->
+        <mapping resource="org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml"/>
+    </session-factory>
+</hibernate-configuration>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/package-info.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/package-info.java b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/package-info.java
new file mode 100644
index 0000000..8af9886
--- /dev/null
+++ b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains internal tests or test related classes and interfaces.
+ */
+package org.apache.ignite.cache.store.hibernate;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernate5TestSuite.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernate5TestSuite.java b/modules/hibernate-5.1/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernate5TestSuite.java
new file mode 100644
index 0000000..d539511
--- /dev/null
+++ b/modules/hibernate-5.1/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernate5TestSuite.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.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.testframework.config.GridTestProperties;
+
+/**
+ *
+ */
+public class IgniteBinaryHibernate5TestSuite extends TestSuite {
+    /**
+     * @return Test suite.
+     * @throws Exception If failed.
+     */
+    public static TestSuite suite() throws Exception {
+        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
+
+        return IgniteHibernate5TestSuite.suite();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/test/java/org/apache/ignite/testsuites/IgniteHibernate5TestSuite.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/test/java/org/apache/ignite/testsuites/IgniteHibernate5TestSuite.java b/modules/hibernate-5.1/src/test/java/org/apache/ignite/testsuites/IgniteHibernate5TestSuite.java
new file mode 100644
index 0000000..3d7c4ee
--- /dev/null
+++ b/modules/hibernate-5.1/src/test/java/org/apache/ignite/testsuites/IgniteHibernate5TestSuite.java
@@ -0,0 +1,57 @@
+/*
+ * 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.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.cache.hibernate.HibernateL2CacheConfigurationSelfTest;
+import org.apache.ignite.cache.hibernate.HibernateL2CacheSelfTest;
+import org.apache.ignite.cache.hibernate.HibernateL2CacheTransactionalSelfTest;
+import org.apache.ignite.cache.hibernate.HibernateL2CacheTransactionalUseSyncSelfTest;
+import org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreNodeRestartTest;
+import org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreSelfTest;
+import org.apache.ignite.cache.store.hibernate.CacheHibernateStoreFactorySelfTest;
+import org.apache.ignite.cache.store.hibernate.CacheHibernateStoreSessionListenerSelfTest;
+
+/**
+ * Hibernate integration tests.
+ */
+public class IgniteHibernate5TestSuite extends TestSuite {
+    /**
+     * @return Test suite.
+     * @throws Exception Thrown in case of the failure.
+     */
+    public static TestSuite suite() throws Exception {
+        TestSuite suite = new TestSuite("Hibernate5 Integration Test Suite");
+
+        // Hibernate L2 cache.
+        suite.addTestSuite(HibernateL2CacheSelfTest.class);
+        suite.addTestSuite(HibernateL2CacheTransactionalSelfTest.class);
+        suite.addTestSuite(HibernateL2CacheTransactionalUseSyncSelfTest.class);
+        suite.addTestSuite(HibernateL2CacheConfigurationSelfTest.class);
+
+        suite.addTestSuite(CacheHibernateBlobStoreSelfTest.class);
+
+        suite.addTestSuite(CacheHibernateBlobStoreNodeRestartTest.class);
+
+        suite.addTestSuite(CacheHibernateStoreSessionListenerSelfTest.class);
+
+        suite.addTestSuite(CacheHibernateStoreFactorySelfTest.class);
+
+        return suite;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate-core/pom.xml b/modules/hibernate-core/pom.xml
new file mode 100644
index 0000000..91ec68b
--- /dev/null
+++ b/modules/hibernate-core/pom.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<!--
+    POM file.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.ignite</groupId>
+        <artifactId>ignite-parent</artifactId>
+        <version>1</version>
+        <relativePath>../../parent</relativePath>
+    </parent>
+
+    <artifactId>ignite-hibernate-core</artifactId>
+    <version>2.0.0-SNAPSHOT</version>
+    <url>http://ignite.apache.org</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-jta</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <testResources>
+            <testResource>
+                <directory>src/main/java</directory>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                </excludes>
+            </testResource>
+            <testResource>
+                <directory>src/test/java</directory>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                </excludes>
+            </testResource>
+        </testResources>
+
+        <plugins>
+            <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyAdapter.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyAdapter.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyAdapter.java
new file mode 100644
index 0000000..557b018
--- /dev/null
+++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyAdapter.java
@@ -0,0 +1,340 @@
+/*
+ * 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.cache.hibernate;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Common interface used to implement Hibernate L2 cache access strategies.
+ * <p>
+ * The expected sequences of steps related to various CRUD operations executed by Hibernate are:
+ * <p>
+ * Insert:
+ * <ul>
+ *     <li>Start DB transaction.</li>
+ *     <li>Execute database insert.</li>
+ *     <li>Call {@link HibernateAccessStrategyAdapter#insert}.</li>
+ *     <li>Commit DB transaction.</li>
+ *     <li>Call {@link HibernateAccessStrategyAdapter#afterInsert}.</li>
+ * </ul>
+ * In case if some step fails and DB transaction is rolled back then
+ * {@link HibernateAccessStrategyAdapter#afterInsert} is not called.
+ * <p>
+ * Update:
+ * <ul>
+ *     <li>Start DB transaction.</li>
+ *     <li>Call {@link HibernateAccessStrategyAdapter#lock}.</li>
+ *     <li>Execute database update.</li>
+ *     <li>Call {@link HibernateAccessStrategyAdapter#update}.</li>
+ *     <li>Commit DB transaction.</li>
+ *     <li>Call {@link HibernateAccessStrategyAdapter#afterUpdate}.</li>
+ * </ul>
+ * In case if {@link HibernateAccessStrategyAdapter#lock} was called, but some other step fails and DB
+ * transaction is rolled back then {@link HibernateAccessStrategyAdapter#unlock} is called for all locked keys.
+ * <p>
+ * Delete:
+ * <ul>
+ *     <li>Start DB transaction.</li>
+ *     <li>Call {@link HibernateAccessStrategyAdapter#lock} for removing key.</li>
+ *     <li>Execute database delete.</li>
+ *     <li>Call {@link HibernateAccessStrategyAdapter#remove}.</li>
+ *     <li>Commit DB transaction.</li>
+ *     <li>Call {@link HibernateAccessStrategyAdapter#unlock}.</li>
+ * </ul>
+ * In case if {@link HibernateAccessStrategyAdapter#lock} was called, but some other step fails and DB
+ * transaction is rolled back then {@link HibernateAccessStrategyAdapter#unlock} is called for all locked keys.
+ * <p>
+ * In case if custom SQL update query is executed Hibernate clears entire cache region,
+ * for this case operations sequence is:
+ * <ul>
+ *     <li>Start DB transaction.</li>
+ *     <li>Call {@link HibernateAccessStrategyAdapter#lockRegion}.</li>
+ *     <li>Execute database query.</li>
+ *     <li>Call {@link HibernateAccessStrategyAdapter#removeAll}.</li>
+ *     <li>Commit DB transaction.</li>
+ *     <li>Call {@link HibernateAccessStrategyAdapter#unlockRegion}.</li>
+ * </ul>
+ */
+public abstract class HibernateAccessStrategyAdapter {
+    /** */
+    protected final HibernateCacheProxy cache;
+
+    /** */
+    private final HibernateExceptionConverter eConverter;
+
+    /** Grid. */
+    protected final Ignite ignite;
+
+    /** */
+    protected final IgniteLogger log;
+
+    /**
+     * @param ignite Node.
+     * @param cache Cache.
+     * @param eConverter Exception converter.
+     */
+    protected HibernateAccessStrategyAdapter(Ignite ignite,
+        HibernateCacheProxy cache,
+        HibernateExceptionConverter eConverter) {
+        this.cache = cache;
+        this.ignite = ignite;
+        this.eConverter = eConverter;
+
+        log = ignite.log().getLogger(getClass());
+    }
+
+    /**
+     * @param e Exception.
+     * @return Runtime exception to be thrown.
+     */
+    final RuntimeException convertException(Exception e) {
+        return eConverter.convert(e);
+    }
+
+    /**
+     * @param key Key.
+     * @return Cached value.
+     */
+    @Nullable public Object get(Object key) {
+        try {
+            return cache.get(key);
+        }
+        catch (IgniteCheckedException e) {
+            throw convertException(e);
+        }
+    }
+
+    /**
+     * @param key Key.
+     * @param val Value.
+     * @param minimalPutOverride MinimalPut flag
+     */
+    public void putFromLoad(Object key, Object val, boolean minimalPutOverride) {
+        putFromLoad(key, val);
+    }
+
+    /**
+     * Puts in cache value loaded from the database.
+     *
+     * @param key Key.
+     * @param val Value.
+     */
+    public void putFromLoad(Object key, Object val) {
+        try {
+            cache.put(key, val);
+        }
+        catch (IgniteCheckedException e) {
+            throw convertException(e);
+        }
+    }
+
+    /**
+     * Called during database transaction execution before Hibernate attempts to update or remove given key.
+     *
+     * @param key Key.
+     */
+    public abstract void lock(Object key);
+
+    /**
+     * Called after Hibernate failed to update or successfully removed given key.
+     *
+     * @param key Key.
+     */
+    public abstract void unlock(Object key);
+
+    /**
+     * Called after Hibernate updated object in the database but before transaction completed.
+     *
+     * @param key Key.
+     * @param val Value.
+     * @return {@code True} if operation updated cache.
+     */
+    public abstract boolean update(Object key, Object val);
+
+    /**
+     * Called after Hibernate updated object in the database and transaction successfully completed.
+     *
+     * @param key Key.
+     * @param val Value.
+     * @return {@code True} if operation updated cache.
+     */
+    public abstract boolean afterUpdate(Object key, Object val);
+
+    /**
+     * Called after Hibernate inserted object in the database but before transaction completed.
+     *
+     * @param key Key.
+     * @param val Value.
+     * @return {@code True} if operation updated cache.
+     */
+    public abstract boolean insert(Object key, Object val);
+
+    /**
+     * Called after Hibernate inserted object in the database and transaction successfully completed.
+     *
+     * @param key Key.
+     * @param val Value.
+     * @return {@code True} if operation updated cache.
+     */
+    public abstract boolean afterInsert(Object key, Object val);
+
+    /**
+     * Called after Hibernate removed object from database but before transaction completed.
+     *
+     * @param key Key,
+     */
+    public abstract void remove(Object key);
+
+    /**
+     * Called to remove object from cache without regard to transaction.
+     *
+     * @param key Key.
+     */
+    public void evict(Object key) {
+        evict(ignite, cache, key);
+    }
+
+    /**
+     * Called to remove all data from cache without regard to transaction.
+     */
+    public void evictAll() {
+        try {
+            evictAll(cache);
+        }
+        catch (IgniteCheckedException e) {
+            throw convertException(e);
+        }
+    }
+
+    /**
+     * Called during database transaction execution to clear entire cache region after
+     * Hibernate executed database update, but before transaction completed.
+     */
+    public final void removeAll() {
+        evictAll();
+    }
+
+    /**
+     * Called during database transaction execution before Hibernate executed
+     * update operation which should invalidate entire cache region.
+     */
+    public void lockRegion() {
+        // No-op.
+    }
+
+    /**
+     * Called after transaction clearing entire cache region completed.
+     */
+    public void unlockRegion() {
+        // No-op.
+    }
+
+    /**
+     * Called to remove object from cache without regard to transaction.
+     *
+     * @param ignite Grid.
+     * @param cache Cache.
+     * @param key Key.
+     */
+    public static void evict(Ignite ignite, HibernateCacheProxy cache, Object key) {
+        key = cache.keyTransformer().transform(key);
+
+        ignite.compute(ignite.cluster()).call(new ClearKeyCallable(key, cache.name()));
+    }
+
+    /**
+     * Called to remove all data from cache without regard to transaction.
+     *
+     * @param cache Cache.
+     * @throws IgniteCheckedException If failed.
+     */
+    public static void evictAll(IgniteInternalCache<Object, Object> cache) throws IgniteCheckedException {
+        cache.clear();
+    }
+
+    /**
+     * Callable invalidates given key.
+     */
+    private static class ClearKeyCallable implements IgniteCallable<Void>, Externalizable {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** */
+        @IgniteInstanceResource
+        private Ignite ignite;
+
+        /** */
+        private Object key;
+
+        /** */
+        private String cacheName;
+
+        /**
+         * Empty constructor required by {@link Externalizable}.
+         */
+        public ClearKeyCallable() {
+            // No-op.
+        }
+
+        /**
+         * @param key Key to clear.
+         * @param cacheName Cache name.
+         */
+        private ClearKeyCallable(Object key, String cacheName) {
+            this.key = key;
+            this.cacheName = cacheName;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Void call() throws IgniteCheckedException {
+            IgniteInternalCache<Object, Object> cache = ((IgniteKernal)ignite).getCache(cacheName);
+
+            assert cache != null;
+
+            cache.clearLocally(key);
+
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void writeExternal(ObjectOutput out) throws IOException {
+            out.writeObject(key);
+
+            U.writeString(out, cacheName);
+        }
+
+        /** {@inheritDoc} */
+        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+            key = in.readObject();
+
+            cacheName = U.readString(in);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyFactory.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyFactory.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyFactory.java
new file mode 100644
index 0000000..0226c1c
--- /dev/null
+++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyFactory.java
@@ -0,0 +1,235 @@
+/*
+ * 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.cache.hibernate;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.configuration.TransactionConfiguration;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.apache.ignite.internal.util.typedef.G;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+
+/**
+ * Access strategy factory.
+ */
+public class HibernateAccessStrategyFactory {
+    /** */
+    private final HibernateKeyTransformer keyTransformer;
+
+    /** */
+    private final HibernateExceptionConverter eConverter;
+
+    /**
+     * Hibernate L2 cache grid name property name.
+     *
+     * @deprecated Use {@link #IGNITE_INSTANCE_NAME_PROPERTY}.
+     *      If {@link #IGNITE_INSTANCE_NAME_PROPERTY} is specified it takes precedence.
+     */
+    @Deprecated
+    public static final String GRID_NAME_PROPERTY = "org.apache.ignite.hibernate.grid_name";
+
+    /** Hibernate L2 cache Ignite instance name property name. */
+    public static final String IGNITE_INSTANCE_NAME_PROPERTY = "org.apache.ignite.hibernate.ignite_instance_name";
+
+    /** Default cache property name. */
+    public static final String DFLT_CACHE_NAME_PROPERTY = "org.apache.ignite.hibernate.default_cache";
+
+    /** Property prefix used to specify region name to cache name mapping. */
+    public static final String REGION_CACHE_PROPERTY = "org.apache.ignite.hibernate.region_cache.";
+
+    /** */
+    public static final String DFLT_ACCESS_TYPE_PROPERTY = "org.apache.ignite.hibernate.default_access_type";
+
+    /** */
+    public static final String GRID_CONFIG_PROPERTY = "org.apache.ignite.hibernate.grid_config";
+
+    /** Grid providing caches. */
+    private Ignite ignite;
+
+    /** Default cache. */
+    private HibernateCacheProxy dfltCache;
+
+    /** Region name to cache name mapping. */
+    private final Map<String, String> regionCaches = new HashMap<>();
+
+    /** */
+    private final ThreadLocal threadLoc = new ThreadLocal();
+
+    /** */
+    private final ConcurrentHashMap<String, ThreadLocal> threadLocMap = new ConcurrentHashMap<>();
+
+    /**
+     * @param keyTransformer Key transformer.
+     * @param eConverter Exception converter.
+     */
+    HibernateAccessStrategyFactory(HibernateKeyTransformer keyTransformer, HibernateExceptionConverter eConverter) {
+        this.keyTransformer = keyTransformer;
+        this.eConverter = eConverter;
+    }
+
+    /**
+     * @param props Properties.
+     */
+    public void start(Properties props)  {
+        String gridCfg = props.getProperty(GRID_CONFIG_PROPERTY);
+        String igniteInstanceName = props.getProperty(IGNITE_INSTANCE_NAME_PROPERTY);
+
+        if (igniteInstanceName == null)
+            igniteInstanceName = props.getProperty(GRID_NAME_PROPERTY);
+
+        if (gridCfg != null) {
+            try {
+                ignite = G.start(gridCfg);
+            }
+            catch (IgniteException e) {
+                throw eConverter.convert(e);
+            }
+        }
+        else
+            ignite = Ignition.ignite(igniteInstanceName);
+
+        for (Map.Entry<Object, Object> prop : props.entrySet()) {
+            String key = prop.getKey().toString();
+
+            if (key.startsWith(REGION_CACHE_PROPERTY)) {
+                String regionName = key.substring(REGION_CACHE_PROPERTY.length());
+
+                String cacheName = prop.getValue().toString();
+
+                if (((IgniteKernal)ignite).getCache(cacheName) == null)
+                    throw new IllegalArgumentException("Cache '" + cacheName + "' specified for region '" + regionName + "' " +
+                        "is not configured.");
+
+                regionCaches.put(regionName, cacheName);
+            }
+        }
+
+        String dfltCacheName = props.getProperty(DFLT_CACHE_NAME_PROPERTY);
+
+        if (dfltCacheName != null) {
+            IgniteInternalCache<Object, Object> dfltCache = ((IgniteKernal)ignite).getCache(dfltCacheName);
+
+            if (dfltCache == null)
+                throw new IllegalArgumentException("Cache specified as default is not configured: " + dfltCacheName);
+
+            this.dfltCache = new HibernateCacheProxy(dfltCache, keyTransformer);
+        }
+
+        IgniteLogger log = ignite.log().getLogger(getClass());
+
+        if (log.isDebugEnabled())
+            log.debug("HibernateRegionFactory started [igniteInstanceName=" + igniteInstanceName + ']');
+    }
+
+    /**
+     * @return Ignite node.
+     */
+    public Ignite node() {
+        return ignite;
+    }
+
+    /**
+     * @param regionName L2 cache region name.
+     * @return Cache for given region.
+     */
+    HibernateCacheProxy regionCache(String regionName) {
+        String cacheName = regionCaches.get(regionName);
+
+        if (cacheName == null) {
+            if (dfltCache != null)
+                return dfltCache;
+
+            cacheName = regionName;
+        }
+
+        IgniteInternalCache<Object, Object> cache = ((IgniteKernal)ignite).getCache(cacheName);
+
+        if (cache == null)
+            throw new IllegalArgumentException("Cache '" + cacheName + "' for region '" + regionName + "' is not configured.");
+
+        return new HibernateCacheProxy(cache, keyTransformer);
+    }
+
+    /**
+     * @param cache Cache.
+     * @return Access strategy implementation.
+     */
+    HibernateAccessStrategyAdapter createReadOnlyStrategy(HibernateCacheProxy cache) {
+        return new HibernateReadOnlyAccessStrategy(ignite, cache, eConverter);
+    }
+
+    /**
+     * @param cache Cache.
+     * @return Access strategy implementation.
+     */
+    HibernateAccessStrategyAdapter createNonStrictReadWriteStrategy(HibernateCacheProxy cache) {
+        ThreadLocal threadLoc = threadLocMap.get(cache.name());
+
+        if (threadLoc == null) {
+            ThreadLocal old = threadLocMap.putIfAbsent(cache.name(), threadLoc = new ThreadLocal());
+
+            if (old != null)
+                threadLoc = old;
+        }
+
+        return new HibernateNonStrictAccessStrategy(ignite, cache, threadLoc, eConverter);
+    }
+
+    /**
+     * @param cache Cache.
+     * @return Access strategy implementation.
+     */
+    HibernateAccessStrategyAdapter createReadWriteStrategy(HibernateCacheProxy cache) {
+        if (cache.configuration().getAtomicityMode() != TRANSACTIONAL)
+            throw new IllegalArgumentException("Hibernate READ-WRITE access strategy must have Ignite cache with " +
+                "'TRANSACTIONAL' atomicity mode: " + cache.name());
+
+        return new HibernateReadWriteAccessStrategy(ignite, cache, threadLoc, eConverter);
+    }
+
+    /**
+     * @param cache Cache.
+     * @return Access strategy implementation.
+     */
+    HibernateAccessStrategyAdapter createTransactionalStrategy(HibernateCacheProxy cache) {
+        if (cache.configuration().getAtomicityMode() != TRANSACTIONAL)
+            throw new IllegalArgumentException("Hibernate TRANSACTIONAL access strategy must have Ignite cache with " +
+                "'TRANSACTIONAL' atomicity mode: " + cache.name());
+
+        TransactionConfiguration txCfg = ignite.configuration().getTransactionConfiguration();
+
+        if (txCfg == null ||
+            (txCfg.getTxManagerFactory() == null
+                && txCfg.getTxManagerLookupClassName() == null
+                && cache.configuration().getTransactionManagerLookupClassName() == null)) {
+            throw new IllegalArgumentException("Hibernate TRANSACTIONAL access strategy must have Ignite with " +
+                "Factory<TransactionManager> configured (see IgniteConfiguration." +
+                "getTransactionConfiguration().setTxManagerFactory()): " + cache.name());
+        }
+
+        return new HibernateTransactionalAccessStrategy(ignite, cache, eConverter);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
new file mode 100644
index 0000000..3d439dd
--- /dev/null
+++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
@@ -0,0 +1,801 @@
+/*
+ * 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.cache.hibernate;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import javax.cache.Cache;
+import javax.cache.expiry.ExpiryPolicy;
+import javax.cache.processor.EntryProcessor;
+import javax.cache.processor.EntryProcessorResult;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheEntry;
+import org.apache.ignite.cache.CacheMetrics;
+import org.apache.ignite.cache.CachePeekMode;
+import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterGroup;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.IgniteCacheExpiryPolicy;
+import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
+import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.mxbean.CacheMetricsMXBean;
+import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Hibernate cache proxy used to substitute hibernate keys with ignite keys.
+ */
+public class HibernateCacheProxy implements IgniteInternalCache<Object, Object> {
+    /** Delegate. */
+    private final IgniteInternalCache<Object, Object> delegate;
+
+    /** Transformer. */
+    private final HibernateKeyTransformer keyTransformer;
+
+    /**
+     * @param delegate Delegate.
+     * @param keyTransformer Key keyTransformer.
+     */
+    HibernateCacheProxy(
+        IgniteInternalCache<Object, Object> delegate,
+        HibernateKeyTransformer keyTransformer
+    ) {
+        assert delegate != null;
+        assert keyTransformer != null;
+
+        this.delegate = delegate;
+        this.keyTransformer = keyTransformer;
+    }
+
+    /**
+     * @return HibernateKeyTransformer
+     */
+    public HibernateKeyTransformer keyTransformer(){
+        return keyTransformer;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return delegate.name();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean skipStore() {
+        return delegate.skipStore();
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalCache setSkipStore(boolean skipStore) {
+        return delegate.setSkipStore(skipStore);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isEmpty() {
+        return delegate.isEmpty();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean containsKey(Object key) {
+        return delegate.containsKey(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Boolean> containsKeyAsync(Object key) {
+        return delegate.containsKeyAsync(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean containsKeys(Collection keys) {
+        return delegate.containsKey(transform(keys));
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Boolean> containsKeysAsync(Collection keys) {
+        return delegate.containsKeysAsync(transform(keys));
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public Object localPeek(
+        Object key,
+        CachePeekMode[] peekModes,
+        @Nullable IgniteCacheExpiryPolicy plc
+    ) throws IgniteCheckedException {
+        return delegate.localPeek(keyTransformer.transform(key), peekModes, plc);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Iterable<Cache.Entry<Object, Object>> localEntries(
+        CachePeekMode[] peekModes
+    ) throws IgniteCheckedException {
+        return delegate.localEntries(peekModes);
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public Object get(Object key) throws IgniteCheckedException {
+        return delegate.get(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public CacheEntry getEntry(Object key) throws IgniteCheckedException {
+        return delegate.getEntry(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture getAsync(Object key) {
+        return delegate.getAsync(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<CacheEntry<Object, Object>> getEntryAsync(Object key) {
+        return delegate.getEntryAsync(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Map getAll(@Nullable Collection keys) throws IgniteCheckedException {
+        return delegate.getAll(transform(keys));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Collection<CacheEntry<Object, Object>> getEntries(
+        @Nullable Collection keys) throws IgniteCheckedException {
+        return delegate.getEntries(transform(keys));
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Map<Object, Object>> getAllAsync(@Nullable Collection keys) {
+        return delegate.getAllAsync(transform(keys));
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Collection<CacheEntry<Object,Object>>> getEntriesAsync(
+        @Nullable Collection keys
+    ) {
+        return delegate.getEntriesAsync(transform(keys));
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public Object getAndPut(Object key, Object val) throws IgniteCheckedException {
+        return delegate.getAndPut(keyTransformer.transform(key), val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture getAndPutAsync(Object key, Object val) {
+        return delegate.getAndPutAsync(keyTransformer.transform(key), val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean put(Object key, Object val) throws IgniteCheckedException {
+        return delegate.put(keyTransformer.transform(key), val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Boolean> putAsync(Object key, Object val) {
+        return delegate.putAsync(keyTransformer.transform(key), val);
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public Object getAndPutIfAbsent(Object key, Object val) throws IgniteCheckedException {
+        return delegate.getAndPutIfAbsent(keyTransformer.transform(key), val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture getAndPutIfAbsentAsync(Object key, Object val) {
+        return delegate.getAndPutIfAbsentAsync(keyTransformer.transform(key), val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean putIfAbsent(Object key, Object val) throws IgniteCheckedException {
+        return delegate.putIfAbsent(keyTransformer.transform(key), val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Boolean> putIfAbsentAsync(Object key, Object val) {
+        return delegate.putIfAbsentAsync(keyTransformer.transform(key), val);
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public Object getAndReplace(Object key, Object val) throws IgniteCheckedException {
+        return delegate.getAndReplace(keyTransformer.transform(key), val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture getAndReplaceAsync(Object key, Object val) {
+        return delegate.getAndReplaceAsync(keyTransformer.transform(key), val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean replace(Object key, Object val) throws IgniteCheckedException {
+        return delegate.replace(keyTransformer.transform(key), val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Boolean> replaceAsync(Object key, Object val) {
+        return delegate.replaceAsync(keyTransformer.transform(key), val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean replace(Object key, Object oldVal, Object newVal) throws IgniteCheckedException {
+        return delegate.replace(keyTransformer.transform(key), oldVal, newVal);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Boolean> replaceAsync(Object key, Object oldVal, Object newVal) {
+        return delegate.replaceAsync(keyTransformer.transform(key), oldVal, newVal);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void putAll(@Nullable Map m) throws IgniteCheckedException {
+        delegate.putAll(transform(m));
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<?> putAllAsync(@Nullable Map m) {
+        return delegate.putAllAsync(transform(m));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Set keySet() {
+        return delegate.keySet();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Set keySetx() {
+        return delegate.keySetx();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Set primaryKeySet() {
+        return delegate.primaryKeySet();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Iterable values() {
+        return delegate.values();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Set<Cache.Entry<Object, Object>> entrySet() {
+        return delegate.entrySet();
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public Set<Cache.Entry<Object,Object>> entrySet(int part) {
+        return delegate.entrySet(part);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Set<Cache.Entry<Object, Object>> entrySetx(CacheEntryPredicate... filter) {
+        return delegate.entrySetx(filter);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Transaction txStart(
+        TransactionConcurrency concurrency,
+        TransactionIsolation isolation
+    ) {
+        return delegate.txStart(concurrency, isolation);
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridNearTxLocal txStartEx(
+        TransactionConcurrency concurrency,
+        TransactionIsolation isolation
+    ) {
+        return delegate.txStartEx(concurrency, isolation);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Transaction txStart(
+        TransactionConcurrency concurrency,
+        TransactionIsolation isolation,
+        long timeout,
+        int txSize
+    ) {
+        return delegate.txStart(concurrency, isolation, timeout, txSize);
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public GridNearTxLocal tx() {
+        return delegate.tx();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean evict(Object key) {
+        return delegate.evict(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void evictAll(@Nullable Collection keys) {
+        delegate.evictAll(transform(keys));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clearLocally(boolean srv, boolean near, boolean readers) {
+        delegate.clearLocally(srv, near, readers);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean clearLocally(Object key) {
+        return delegate.clearLocally(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clearLocallyAll(Set keys, boolean srv, boolean near, boolean readers) {
+        delegate.clearLocallyAll((Set<?>)transform(keys), srv, near, readers);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clear(Object key) throws IgniteCheckedException {
+        delegate.clear(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clearAll(Set keys) throws IgniteCheckedException {
+        delegate.clearAll((Set<?>)transform(keys));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clear() throws IgniteCheckedException {
+        delegate.clear();
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<?> clearAsync() {
+        return delegate.clearAsync();
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<?> clearAsync(Object key) {
+        return delegate.clearAsync(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<?> clearAllAsync(Set keys) {
+        return delegate.clearAllAsync((Set<?>)transform(keys));
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public Object getAndRemove(Object key) throws IgniteCheckedException {
+        return delegate.getAndRemove(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture getAndRemoveAsync(Object key) {
+        return delegate.getAndRemoveAsync(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean remove(Object key) throws IgniteCheckedException {
+        return delegate.remove(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Boolean> removeAsync(Object key) {
+        return delegate.removeAsync(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean remove(Object key, Object val) throws IgniteCheckedException {
+        return delegate.remove(keyTransformer.transform(key), val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Boolean> removeAsync(Object key, Object val) {
+        return delegate.removeAsync(keyTransformer.transform(key), val);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void removeAll(@Nullable Collection keys) throws IgniteCheckedException {
+        delegate.removeAll(transform(keys));
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<?> removeAllAsync(@Nullable Collection keys) {
+        return delegate.removeAllAsync(transform(keys));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void removeAll() throws IgniteCheckedException {
+        delegate.removeAll();
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<?> removeAllAsync() {
+        return delegate.removeAllAsync();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean lock(Object key, long timeout) throws IgniteCheckedException {
+        return delegate.lock(keyTransformer.transform(key), timeout);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Boolean> lockAsync(Object key, long timeout) {
+        return delegate.lockAsync(keyTransformer.transform(key), timeout);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean lockAll(@Nullable Collection keys, long timeout) throws IgniteCheckedException {
+        return delegate.lockAll(transform(keys), timeout);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Boolean> lockAllAsync(@Nullable Collection keys, long timeout) {
+        return delegate.lockAllAsync(transform(keys), timeout);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void unlock(Object key) throws IgniteCheckedException {
+        delegate.unlock(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void unlockAll(@Nullable Collection keys) throws IgniteCheckedException {
+        delegate.unlockAll(transform(keys));
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isLocked(Object key) {
+        return delegate.isLocked(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isLockedByThread(Object key) {
+        return delegate.isLockedByThread(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size() {
+        return delegate.size();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long sizeLong() {
+        return delegate.sizeLong();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int localSize(CachePeekMode[] peekModes) throws IgniteCheckedException {
+        return delegate.localSize(peekModes);
+    }
+
+    /** {@inheritDoc} */
+    @Override public long localSizeLong(CachePeekMode[] peekModes) throws IgniteCheckedException {
+        return delegate.localSizeLong(peekModes);
+    }
+
+    /** {@inheritDoc} */
+    @Override public long localSizeLong(int partition, CachePeekMode[] peekModes) throws IgniteCheckedException {
+        return delegate.localSizeLong(partition, peekModes);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int size(CachePeekMode[] peekModes) throws IgniteCheckedException {
+        return delegate.size(peekModes);
+    }
+
+    /** {@inheritDoc} */
+    @Override public long sizeLong(CachePeekMode[] peekModes) throws IgniteCheckedException {
+        return delegate.sizeLong(peekModes);
+    }
+
+    /** {@inheritDoc} */
+    @Override public long sizeLong(int partition, CachePeekMode[] peekModes) throws IgniteCheckedException {
+        return delegate.sizeLong(partition, peekModes);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Integer> sizeAsync(CachePeekMode[] peekModes) {
+        return delegate.sizeAsync(peekModes);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Long> sizeLongAsync(CachePeekMode[] peekModes) {
+        return delegate.sizeLongAsync(peekModes);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Long> sizeLongAsync(int partition, CachePeekMode[] peekModes) {
+        return delegate.sizeLongAsync(partition, peekModes);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int nearSize() {
+        return delegate.nearSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int primarySize() {
+        return delegate.primarySize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long primarySizeLong() {
+        return delegate.primarySizeLong();
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheConfiguration configuration() {
+        return delegate.configuration();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Affinity affinity() {
+        return delegate.affinity();
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheMetrics clusterMetrics() {
+        return delegate.clusterMetrics();
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheMetrics clusterMetrics(ClusterGroup grp) {
+        return delegate.clusterMetrics(grp);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheMetrics localMetrics() {
+        return delegate.localMetrics();
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheMetricsMXBean clusterMxBean() {
+        return delegate.clusterMxBean();
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheMetricsMXBean localMxBean() {
+        return delegate.localMxBean();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long offHeapEntriesCount() {
+        return delegate.offHeapEntriesCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long offHeapAllocatedSize() {
+        return delegate.offHeapAllocatedSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<?> rebalance() {
+        return delegate.rebalance();
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalCache forSubjectId(UUID subjId) {
+        return delegate.forSubjectId(subjId);
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public Object getForcePrimary(Object key) throws IgniteCheckedException {
+        return delegate.getForcePrimary(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture getForcePrimaryAsync(Object key) {
+        return delegate.getForcePrimaryAsync(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Map getAllOutTx(Set keys) throws IgniteCheckedException {
+        return delegate.getAllOutTx((Set<?>)transform(keys));
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Map<Object, Object>> getAllOutTxAsync(Set keys) {
+        return delegate.getAllOutTxAsync((Set<?>)transform(keys));
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isIgfsDataCache() {
+        return delegate.isIgfsDataCache();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long igfsDataSpaceUsed() {
+        return delegate.igfsDataSpaceUsed();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isMongoDataCache() {
+        return delegate.isMongoDataCache();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isMongoMetaCache() {
+        return delegate.isMongoMetaCache();
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public ExpiryPolicy expiry() {
+        return delegate.expiry();
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalCache withExpiryPolicy(ExpiryPolicy plc) {
+        return delegate.withExpiryPolicy(plc);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalCache withNoRetries() {
+        return delegate.withNoRetries();
+    }
+
+    /** {@inheritDoc} */
+    @Override public GridCacheContext context() {
+        return delegate.context();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void localLoadCache(
+        @Nullable IgniteBiPredicate p,
+        @Nullable Object... args
+    ) throws IgniteCheckedException {
+        delegate.localLoadCache(p, args);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<?> localLoadCacheAsync(
+        @Nullable IgniteBiPredicate p,
+        @Nullable Object... args
+    ) {
+        return delegate.localLoadCacheAsync(p, args);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Object getTopologySafe(Object key) throws IgniteCheckedException {
+        return delegate.getTopologySafe(keyTransformer.transform(key));
+    }
+
+    /** {@inheritDoc} */
+    @Override public Collection<Integer> lostPartitions() {
+        return delegate.lostPartitions();
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public EntryProcessorResult invoke(
+        @Nullable AffinityTopologyVersion topVer,
+        Object key,
+        EntryProcessor entryProcessor,
+        Object... args
+    ) throws IgniteCheckedException {
+        return delegate.invoke(topVer, key, entryProcessor, args);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Map> invokeAllAsync(Map map, Object... args) {
+        return delegate.invokeAllAsync(map, args);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Map invokeAll(Map map, Object... args) throws IgniteCheckedException {
+        return delegate.invokeAll(map, args);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<Map> invokeAllAsync(Set keys, EntryProcessor entryProcessor, Object... args) {
+        return delegate.invokeAllAsync((Set<?>)transform(keys), entryProcessor, args);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Map invokeAll(Set keys, EntryProcessor entryProcessor, Object... args) throws IgniteCheckedException {
+        return delegate.invokeAll((Set<?>)transform(keys), entryProcessor, args);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<EntryProcessorResult> invokeAsync(
+        Object key,
+        EntryProcessor entryProcessor,
+        Object... args
+    ) {
+        return delegate.invokeAsync(keyTransformer.transform(key), entryProcessor, args);
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public EntryProcessorResult invoke(
+        Object key,
+        EntryProcessor entryProcessor,
+        Object... args
+    ) throws IgniteCheckedException {
+        return delegate.invoke(keyTransformer.transform(key), entryProcessor, args);
+    }
+
+    /** {@inheritDoc} */
+    @Override public Iterator<Cache.Entry<Object,Object>> scanIterator(
+        boolean keepBinary,
+        @Nullable IgniteBiPredicate p
+    ) throws IgniteCheckedException {
+        return delegate.scanIterator(keepBinary, p);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<?> removeAllConflictAsync(Map drMap) throws IgniteCheckedException {
+        return delegate.removeAllConflictAsync(drMap);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void removeAllConflict(Map drMap) throws IgniteCheckedException {
+        delegate.removeAllConflictAsync(drMap);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalFuture<?> putAllConflictAsync(Map drMap) throws IgniteCheckedException {
+        return delegate.putAllConflictAsync(drMap);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void putAllConflict(Map drMap) throws IgniteCheckedException {
+        delegate.putAllConflict(drMap);
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalCache keepBinary() {
+        return delegate.keepBinary();
+    }
+
+    /** {@inheritDoc} */
+    @Override public IgniteInternalCache cache() {
+        return delegate.cache();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Iterator iterator() {
+        return delegate.iterator();
+    }
+
+    /**
+     * @param keys Keys.
+     */
+    private Collection<Object> transform(Collection<Object> keys) {
+        Collection<Object> res = new LinkedList<>();
+
+        for (Object o : keys)
+            res.add(keyTransformer.transform(o));
+
+        return res;
+    }
+
+    /**
+     * @param map Map.
+     */
+    private Map<Object, Object> transform(Map<Object, Object> map) {
+        Map<Object, Object> res = new HashMap<>();
+
+        Set<Map.Entry<Object, Object>> ents = map.entrySet();
+
+        for (Map.Entry<Object, Object> e : ents)
+            res.put(keyTransformer.transform(e.getKey()), e.getValue());
+
+        return res;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateExceptionConverter.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateExceptionConverter.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateExceptionConverter.java
new file mode 100644
index 0000000..110bec5
--- /dev/null
+++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateExceptionConverter.java
@@ -0,0 +1,29 @@
+/*
+ * 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.cache.hibernate;
+
+/**
+ * Converts Ignite errors into Hibernate runtime exceptions.
+ */
+public interface HibernateExceptionConverter {
+    /**
+     * @param e Exception.
+     * @return Converted exception.
+     */
+    public RuntimeException convert(Exception e);
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyTransformer.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyTransformer.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyTransformer.java
new file mode 100644
index 0000000..97fc0e9
--- /dev/null
+++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyTransformer.java
@@ -0,0 +1,29 @@
+/*
+ * 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.cache.hibernate;
+
+/**
+ * An interface for transforming hibernate keys to Ignite keys.
+ */
+public interface HibernateKeyTransformer {
+    /**
+     * @param key Hibernate key.
+     * @return Transformed key.
+     */
+    public Object transform(Object key);
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateNonStrictAccessStrategy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateNonStrictAccessStrategy.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateNonStrictAccessStrategy.java
new file mode 100644
index 0000000..06c6f3d
--- /dev/null
+++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateNonStrictAccessStrategy.java
@@ -0,0 +1,230 @@
+/*
+ * 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.cache.hibernate;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.util.GridLeanSet;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * Implementation of NONSTRICT_READ_WRITE cache access strategy.
+ * <p>
+ * Configuration of L2 cache and per-entity cache access strategy can be set in the
+ * Hibernate configuration file:
+ * <pre name="code" class="xml">
+ * &lt;hibernate-configuration&gt;
+ *     &lt;!-- Enable L2 cache. --&gt;
+ *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
+ *
+ *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
+ *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
+ *
+ *     &lt;!-- Specify entity. --&gt;
+ *     &lt;mapping class="com.example.Entity"/&gt;
+ *
+ *     &lt;!-- Enable L2 cache with nonstrict-read-write access strategy for entity. --&gt;
+ *     &lt;class-cache class="com.example.Entity" usage="nonstrict-read-write"/&gt;
+ * &lt;/hibernate-configuration&gt;
+ * </pre>
+ * Also cache access strategy can be set using annotations:
+ * <pre name="code" class="java">
+ * &#064;javax.persistence.Entity
+ * &#064;javax.persistence.Cacheable
+ * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+ * public class Entity { ... }
+ * </pre>
+ */
+public class HibernateNonStrictAccessStrategy extends HibernateAccessStrategyAdapter {
+    /** */
+    private final ThreadLocal<WriteContext> writeCtx;
+
+    /**
+     * @param ignite Grid.
+     * @param cache Cache.
+     * @param writeCtx Thread local instance used to track updates done during one Hibernate transaction.
+     * @param eConverter Exception converter.
+     */
+    HibernateNonStrictAccessStrategy(Ignite ignite,
+        HibernateCacheProxy cache,
+        ThreadLocal writeCtx,
+        HibernateExceptionConverter eConverter) {
+        super(ignite, cache, eConverter);
+
+        this.writeCtx = (ThreadLocal<WriteContext>)writeCtx;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void lock(Object key) {
+        WriteContext ctx = writeCtx.get();
+
+        if (ctx == null)
+            writeCtx.set(ctx = new WriteContext());
+
+        ctx.locked(key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void unlock(Object key) {
+        try {
+            WriteContext ctx = writeCtx.get();
+
+            if (ctx != null && ctx.unlocked(key)) {
+                writeCtx.remove();
+
+                ctx.updateCache(cache);
+            }
+        }
+        catch (IgniteCheckedException e) {
+            throw convertException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean update(Object key, Object val) {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean afterUpdate(Object key, Object val) {
+        WriteContext ctx = writeCtx.get();
+
+        if (ctx != null) {
+            ctx.updated(key, val);
+
+            unlock(key);
+
+            return true;
+        }
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean insert(Object key, Object val) {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean afterInsert(Object key, Object val) {
+        try {
+            cache.put(key, val);
+
+            return true;
+        }
+        catch (IgniteCheckedException e) {
+            throw convertException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void remove(Object key) {
+        WriteContext ctx = writeCtx.get();
+
+        if (ctx != null)
+            ctx.removed(key);
+    }
+
+    /**
+     * Information about updates done during single database transaction.
+     */
+    @SuppressWarnings("TypeMayBeWeakened")
+    private static class WriteContext {
+        /** */
+        @GridToStringInclude
+        private Map<Object, Object> updates;
+
+        /** */
+        @GridToStringInclude
+        private Set<Object> rmvs;
+
+        /** */
+        @GridToStringInclude
+        private Set<Object> locked = new GridLeanSet<>();
+
+        /**
+         * Marks key as locked.
+         *
+         * @param key Key.
+         */
+        void locked(Object key) {
+            locked.add(key);
+        }
+
+        /**
+         * Marks key as unlocked.
+         *
+         * @param key Key.
+         * @return {@code True} if last locked key was unlocked.
+         */
+        boolean unlocked(Object key) {
+            locked.remove(key);
+
+            return locked.isEmpty();
+        }
+
+        /**
+         * Marks key as updated.
+         *
+         * @param key Key.
+         * @param val Value.
+         */
+        void updated(Object key, Object val) {
+            if (updates == null)
+                updates = new LinkedHashMap<>();
+
+            updates.put(key, val);
+        }
+
+        /**
+         * Marks key as removed.
+         *
+         * @param key Key.
+         */
+        void removed(Object key) {
+            if (rmvs == null)
+                rmvs = new GridLeanSet<>();
+
+            rmvs.add(key);
+        }
+
+        /**
+         * Updates cache.
+         *
+         * @param cache Cache.
+         * @throws IgniteCheckedException If failed.
+         */
+        void updateCache(HibernateCacheProxy cache) throws IgniteCheckedException {
+            if (!F.isEmpty(rmvs))
+                cache.removeAll(rmvs);
+
+            if (!F.isEmpty(updates))
+                cache.putAll(updates);
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(WriteContext.class, this);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadOnlyAccessStrategy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadOnlyAccessStrategy.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadOnlyAccessStrategy.java
new file mode 100644
index 0000000..a0957fd
--- /dev/null
+++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadOnlyAccessStrategy.java
@@ -0,0 +1,105 @@
+/*
+ * 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.cache.hibernate;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+
+/**
+ * Implementation of READ_ONLY cache access strategy.
+ * <p>
+ * Configuration of L2 cache and per-entity cache access strategy can be set in the
+ * Hibernate configuration file:
+ * <pre name="code" class="xml">
+ * &lt;hibernate-configuration&gt;
+ *     &lt;!-- Enable L2 cache. --&gt;
+ *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
+ *
+ *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
+ *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
+ *
+ *     &lt;!-- Specify entity. --&gt;
+ *     &lt;mapping class="com.example.Entity"/&gt;
+ *
+ *     &lt;!-- Enable L2 cache with read-only access strategy for entity. --&gt;
+ *     &lt;class-cache class="com.example.Entity" usage="read-only"/&gt;
+ * &lt;/hibernate-configuration&gt;
+ * </pre>
+ * Also cache access strategy can be set using annotations:
+ * <pre name="code" class="java">
+ * &#064;javax.persistence.Entity
+ * &#064;javax.persistence.Cacheable
+ * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
+ * public class Entity { ... }
+ * </pre>
+ *
+ */
+public class HibernateReadOnlyAccessStrategy extends HibernateAccessStrategyAdapter {
+    /**
+     * @param ignite Node.
+     * @param cache Cache.
+     * @param eConverter Exception converter.
+     */
+    public HibernateReadOnlyAccessStrategy(Ignite ignite,
+        HibernateCacheProxy cache,
+        HibernateExceptionConverter eConverter) {
+        super(ignite, cache, eConverter);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean insert(Object key, Object val) {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean afterInsert(Object key, Object val) {
+        try {
+            cache.put(key, val);
+
+            return true;
+        }
+        catch (IgniteCheckedException e) {
+            throw convertException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void lock(Object key) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void unlock(Object key) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void remove(Object key) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean update(Object key, Object val) {
+        throw new UnsupportedOperationException("Updates are not supported for read-only access strategy.");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean afterUpdate(Object key, Object val) {
+        throw new UnsupportedOperationException("Updates are not supported for read-only access strategy.");
+    }
+}
\ No newline at end of file


[39/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java
index 0588139..c3e3e88 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartNoExchangeTimeoutTest.java
@@ -41,7 +41,7 @@ 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.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.NotNull;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -244,7 +244,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst
 
         assertEquals(1L, ignite0.localNode().order());
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setNodeFilter(new TestFilterExcludeOldest());
 
@@ -256,11 +256,11 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst
 
         assertTrue(client.configuration().isClientMode());
 
-        assertNotNull(client.getOrCreateCache((String)null));
+        assertNotNull(client.getOrCreateCache(DEFAULT_CACHE_NAME));
 
         awaitPartitionMapExchange();
 
-        checkCache(null);
+        checkCache(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -271,7 +271,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst
 
         assertEquals(1L, ignite0.localNode().order());
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setNodeFilter(new TestFilterIncludeNode(3));
 
@@ -281,11 +281,11 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst
 
         IgniteEx ingite1 = grid(1);
 
-        assertNotNull(ingite1.getOrCreateCache((String)null));
+        assertNotNull(ingite1.getOrCreateCache(DEFAULT_CACHE_NAME));
 
         awaitPartitionMapExchange();
 
-        checkCache(null);
+        checkCache(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -296,7 +296,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst
 
         assertEquals(1L, ignite0.localNode().order());
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setNodeFilter(new TestFilterIncludeNode(3));
 
@@ -308,17 +308,17 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst
 
         assertTrue(client.configuration().isClientMode());
 
-        assertNotNull(client.getOrCreateCache((String)null));
+        assertNotNull(client.getOrCreateCache(DEFAULT_CACHE_NAME));
 
         awaitPartitionMapExchange();
 
-        checkCache(null);
+        checkCache(DEFAULT_CACHE_NAME);
     }
 
     /**
      * @param name Cache name.
      */
-    private void checkCache(@Nullable String name) {
+    private void checkCache(@NotNull String name) {
         int key = 0;
 
         for (Ignite ignite : G.allGrids()) {
@@ -343,7 +343,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst
         List<CacheConfiguration> res = new ArrayList<>();
 
         {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             ccfg.setName("cache-1");
             ccfg.setAtomicityMode(ATOMIC);
@@ -354,7 +354,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst
         }
 
         {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             ccfg.setName("cache-2");
             ccfg.setAtomicityMode(ATOMIC);
@@ -365,7 +365,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst
         }
 
         {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             ccfg.setName("cache-3");
             ccfg.setAtomicityMode(ATOMIC);
@@ -376,7 +376,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst
         }
 
         {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             ccfg.setName("cache-4");
             ccfg.setAtomicityMode(TRANSACTIONAL);
@@ -387,7 +387,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst
         }
 
         {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             ccfg.setName("cache-5");
             ccfg.setAtomicityMode(TRANSACTIONAL);
@@ -398,7 +398,7 @@ public class IgniteDynamicCacheStartNoExchangeTimeoutTest extends GridCommonAbst
         }
 
         {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             ccfg.setName("cache-4");
             ccfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
index 82674c6..4a34a1d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
@@ -114,7 +114,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
 
         cfg.setUserAttributes(F.asMap(TEST_ATTRIBUTE_NAME, testAttribute));
 
-        CacheConfiguration cacheCfg = new CacheConfiguration();
+        CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cacheCfg.setCacheMode(CacheMode.REPLICATED);
 
@@ -156,7 +156,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
 
         GridTestUtils.runMultiThreaded(new Callable<Object>() {
             @Override public Object call() throws Exception {
-                CacheConfiguration ccfg = new CacheConfiguration();
+                CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
                 ccfg.setName(DYNAMIC_CACHE_NAME);
 
@@ -220,7 +220,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
 
         GridTestUtils.runMultiThreaded(new Callable<Object>() {
             @Override public Object call() throws Exception {
-                CacheConfiguration ccfg = new CacheConfiguration();
+                CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
                 ccfg.setName(DYNAMIC_CACHE_NAME);
 
@@ -313,7 +313,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
     private void checkStartStopCacheSimple(CacheAtomicityMode mode) throws Exception {
         final IgniteEx kernal = grid(0);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
         ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
         ccfg.setAtomicityMode(mode);
 
@@ -374,7 +374,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
         List<CacheConfiguration> ccfgList = new ArrayList<>();
 
         for (int i = 0; i < cacheCnt; i++) {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
             ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
             ccfg.setAtomicityMode(mode);
             ccfg.setName(DYNAMIC_CACHE_NAME + Integer.toString(i));
@@ -450,7 +450,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
     public void testStartStopCacheAddNode() throws Exception {
         final IgniteEx kernal = grid(0);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
         ccfg.setCacheMode(CacheMode.REPLICATED);
         ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
 
@@ -508,7 +508,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
 
             final IgniteEx kernal = grid(0);
 
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
             ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
 
             ccfg.setName(DYNAMIC_CACHE_NAME);
@@ -572,7 +572,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
             @Override public Object call() throws Exception {
                 final Ignite kernal = grid(0);
 
-                CacheConfiguration ccfg = new CacheConfiguration();
+                CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
                 ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
 
                 // Cache is already configured, should fail.
@@ -593,14 +593,14 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
             @Override public Object call() throws Exception {
                 final Ignite kernal = grid(0);
 
-                CacheConfiguration ccfgDynamic = new CacheConfiguration();
+                CacheConfiguration ccfgDynamic = new CacheConfiguration(DEFAULT_CACHE_NAME);
                 ccfgDynamic.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
 
                 ccfgDynamic.setName(DYNAMIC_CACHE_NAME);
 
                 ccfgDynamic.setNodeFilter(NODE_FILTER);
 
-                CacheConfiguration ccfgStatic = new CacheConfiguration();
+                CacheConfiguration ccfgStatic = new CacheConfiguration(DEFAULT_CACHE_NAME);
                 ccfgStatic.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
 
                 // Cache is already configured, should fail.
@@ -626,7 +626,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
 
             final IgniteEx kernal = grid(0);
 
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
             ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
 
             ccfg.setName(DYNAMIC_CACHE_NAME);
@@ -669,7 +669,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
 
             final IgniteEx kernal = grid(0);
 
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
             ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
 
             ccfg.setName(DYNAMIC_CACHE_NAME);
@@ -711,7 +711,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
 
             final IgniteEx kernal = grid(0);
 
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
             ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
 
             ccfg.setName(DYNAMIC_CACHE_NAME);
@@ -749,7 +749,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testEvents() throws Exception {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setName(DYNAMIC_CACHE_NAME);
         cfg.setCacheMode(CacheMode.REPLICATED);
@@ -817,7 +817,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
 
             Ignite ig = startGrid(nodeCount());
 
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             ccfg.setName(DYNAMIC_CACHE_NAME);
             ccfg.setCacheMode(CacheMode.PARTITIONED);
@@ -856,7 +856,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
     /** {@inheritDoc} */
     public void testGetOrCreate() throws Exception {
         try {
-            final CacheConfiguration cfg = new CacheConfiguration();
+            final CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             cfg.setName(DYNAMIC_CACHE_NAME);
             cfg.setNodeFilter(NODE_FILTER);
@@ -922,7 +922,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
             final Collection<CacheConfiguration> ccfgs = new ArrayList<>();
 
             for (int i = 0; i < cacheCnt; i++) {
-                final CacheConfiguration cfg = new CacheConfiguration();
+                final CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
                 cfg.setName(DYNAMIC_CACHE_NAME + Integer.toString(i));
                 cfg.setNodeFilter(NODE_FILTER);
@@ -1316,7 +1316,7 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
 
                 Thread.currentThread().setName("start-stop-" + ignite.name());
 
-                CacheConfiguration ccfg = new CacheConfiguration();
+                CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
                 ccfg.setName("testStartStop");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartStopConcurrentTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartStopConcurrentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartStopConcurrentTest.java
index a841aa0..3adb73f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartStopConcurrentTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartStopConcurrentTest.java
@@ -80,7 +80,7 @@ public class IgniteDynamicCacheStartStopConcurrentTest extends GridCommonAbstrac
                 @Override public void apply(Integer idx) {
                     Ignite ignite = ignite(idx);
 
-                    ignite.getOrCreateCache(new CacheConfiguration<>());
+                    ignite.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
                 }
             }, NODES, "cache-thread");
 
@@ -88,7 +88,7 @@ public class IgniteDynamicCacheStartStopConcurrentTest extends GridCommonAbstrac
 
             checkTopologyVersion(new AffinityTopologyVersion(NODES, minorVer));
 
-            ignite(0).compute().affinityRun((String)null, 1, new IgniteRunnable() {
+            ignite(0).compute().affinityRun(DEFAULT_CACHE_NAME, 1, new IgniteRunnable() {
                 @Override public void run() {
                     // No-op.
                 }
@@ -98,7 +98,7 @@ public class IgniteDynamicCacheStartStopConcurrentTest extends GridCommonAbstrac
                 @Override public void apply(Integer idx) {
                     Ignite ignite = ignite(idx);
 
-                    ignite.destroyCache(null);
+                    ignite.destroyCache(DEFAULT_CACHE_NAME);
                 }
             }, NODES, "cache-thread");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java
index 284fcef..9176cbd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicClientCacheStartSelfTest.java
@@ -79,9 +79,9 @@ public class IgniteDynamicClientCacheStartSelfTest extends GridCommonAbstractTes
      * @throws Exception If failed.
      */
     public void testConfiguredCacheOnClientNode() throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
-        final String cacheName = null;
+        final String cacheName = DEFAULT_CACHE_NAME;
 
         Ignite ignite0 = startGrid(0);
 
@@ -93,7 +93,7 @@ public class IgniteDynamicClientCacheStartSelfTest extends GridCommonAbstractTes
 
         checkCache(ignite1, cacheName, false, false);
 
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setNearConfiguration(new NearCacheConfiguration());
 
@@ -124,9 +124,9 @@ public class IgniteDynamicClientCacheStartSelfTest extends GridCommonAbstractTes
      * @throws Exception If failed.
      */
     public void testNearCacheStartError() throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
-        final String cacheName = null;
+        final String cacheName = DEFAULT_CACHE_NAME;
 
         Ignite ignite0 = startGrid(0);
 
@@ -163,11 +163,11 @@ public class IgniteDynamicClientCacheStartSelfTest extends GridCommonAbstractTes
      * @throws Exception If failed.
      */
     public void testReplicatedCacheClient() throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(REPLICATED);
 
-        final String cacheName = null;
+        final String cacheName = DEFAULT_CACHE_NAME;
 
         Ignite ignite0 = startGrid(0);
 
@@ -196,13 +196,13 @@ public class IgniteDynamicClientCacheStartSelfTest extends GridCommonAbstractTes
      * @throws Exception If failed.
      */
     public void testReplicatedWithNearCacheClient() throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setNearConfiguration(new NearCacheConfiguration());
 
         ccfg.setCacheMode(REPLICATED);
 
-        final String cacheName = null;
+        final String cacheName = DEFAULT_CACHE_NAME;
 
         Ignite ignite0 = startGrid(0);
 
@@ -239,17 +239,17 @@ public class IgniteDynamicClientCacheStartSelfTest extends GridCommonAbstractTes
 
         client = false;
 
-        ignite0.createCache(new CacheConfiguration<>());
+        ignite0.createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
 
-        clientNode.cache(null);
+        clientNode.cache(DEFAULT_CACHE_NAME);
 
-        clientNode.cache(null).close();
+        clientNode.cache(DEFAULT_CACHE_NAME).close();
 
-        clientNode.cache(null);
+        clientNode.cache(DEFAULT_CACHE_NAME);
 
         startGrid(2);
 
-        checkCache(clientNode, null, false, false);
+        checkCache(clientNode, DEFAULT_CACHE_NAME, false, false);
     }
 
     /**
@@ -275,7 +275,7 @@ public class IgniteDynamicClientCacheStartSelfTest extends GridCommonAbstractTes
 
         Ignite ignite1 = startGrid(1);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setNodeFilter(new CachePredicate(F.asList(ignite0.name())));
 
@@ -284,18 +284,18 @@ public class IgniteDynamicClientCacheStartSelfTest extends GridCommonAbstractTes
         else {
             ignite1.createCache(ccfg);
 
-            assertNull(((IgniteKernal)ignite0).context().cache().internalCache(null));
+            assertNull(((IgniteKernal)ignite0).context().cache().internalCache(DEFAULT_CACHE_NAME));
         }
 
-        assertNotNull(ignite0.cache(null));
+        assertNotNull(ignite0.cache(DEFAULT_CACHE_NAME));
 
-        ignite0.cache(null).close();
+        ignite0.cache(DEFAULT_CACHE_NAME).close();
 
-        assertNotNull(ignite0.cache(null));
+        assertNotNull(ignite0.cache(DEFAULT_CACHE_NAME));
 
         startGrid(2);
 
-        checkCache(ignite0, null, false, false);
+        checkCache(ignite0, DEFAULT_CACHE_NAME, false, false);
     }
 
     /**
@@ -321,9 +321,9 @@ public class IgniteDynamicClientCacheStartSelfTest extends GridCommonAbstractTes
             assertEquals(near, disco.cacheNearNode(node, cacheName));
 
             if (srv)
-                assertTrue(ignite0.affinity(null).primaryPartitions(node).length > 0);
+                assertTrue(ignite0.affinity(DEFAULT_CACHE_NAME).primaryPartitions(node).length > 0);
             else
-                assertEquals(0, ignite0.affinity(null).primaryPartitions(node).length);
+                assertEquals(0, ignite0.affinity(DEFAULT_CACHE_NAME).primaryPartitions(node).length);
         }
 
         assertNotNull(ignite.cache(cacheName));

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteExchangeFutureHistoryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteExchangeFutureHistoryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteExchangeFutureHistoryTest.java
index 6e4bdf9..a5930c9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteExchangeFutureHistoryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteExchangeFutureHistoryTest.java
@@ -56,7 +56,7 @@ public class IgniteExchangeFutureHistoryTest extends IgniteCacheAbstractTest {
      * @throws Exception If failed.
      */
     public void testExchangeFutures() throws Exception {
-        GridCachePartitionExchangeManager mgr = ((IgniteKernal)grid(0)).internalCache().context().shared().exchange();
+        GridCachePartitionExchangeManager mgr = ((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME).context().shared().exchange();
 
         for (int i = 1; i <= 10; i++) {
             startGrid(i);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClassNameConflictTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClassNameConflictTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClassNameConflictTest.java
index 9f98a90..d2a304d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClassNameConflictTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClassNameConflictTest.java
@@ -81,7 +81,7 @@ public class IgniteMarshallerCacheClassNameConflictTest extends GridCommonAbstra
 
         cfg.setDiscoverySpi(disco);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(REPLICATED);
         ccfg.setRebalanceMode(SYNC);
@@ -127,7 +127,7 @@ public class IgniteMarshallerCacheClassNameConflictTest extends GridCommonAbstra
                         break;
                 }
 
-                Ignition.localIgnite().cache(null).put(1, aOrg1);
+                Ignition.localIgnite().cache(DEFAULT_CACHE_NAME).put(1, aOrg1);
             }
         });
 
@@ -148,7 +148,7 @@ public class IgniteMarshallerCacheClassNameConflictTest extends GridCommonAbstra
                         break;
                 }
 
-                Ignition.localIgnite().cache(null).put(2, bOrg2);
+                Ignition.localIgnite().cache(DEFAULT_CACHE_NAME).put(2, bOrg2);
             }
         });
         startLatch.countDown();
@@ -163,7 +163,7 @@ public class IgniteMarshallerCacheClassNameConflictTest extends GridCommonAbstra
 
         Ignite ignite = startGrid(2);
 
-        int cacheSize = ignite.cache(null).size(CachePeekMode.PRIMARY);
+        int cacheSize = ignite.cache(DEFAULT_CACHE_NAME).size(CachePeekMode.PRIMARY);
 
         assertTrue("Expected cache size 1 but was " + cacheSize, cacheSize == 1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClientRequestsMappingOnMissTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClientRequestsMappingOnMissTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClientRequestsMappingOnMissTest.java
index 362d6a1..f5f2512 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClientRequestsMappingOnMissTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheClientRequestsMappingOnMissTest.java
@@ -79,7 +79,7 @@ public class IgniteMarshallerCacheClientRequestsMappingOnMissTest extends GridCo
 
         cfg.setDiscoverySpi(disco);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(REPLICATED);
         ccfg.setRebalanceMode(SYNC);
@@ -119,13 +119,13 @@ public class IgniteMarshallerCacheClientRequestsMappingOnMissTest extends GridCo
 
         Organization org = new Organization(1, "Microsoft", "One Microsoft Way Redmond, WA 98052-6399, USA");
 
-        srv1.cache(null).put(1, org);
+        srv1.cache(DEFAULT_CACHE_NAME).put(1, org);
 
         clientMode = true;
 
         Ignite cl1 = startGrid(1);
 
-        cl1.cache(null).get(1);
+        cl1.cache(DEFAULT_CACHE_NAME).get(1);
 
         String clsName = Organization.class.getName();
 
@@ -164,14 +164,14 @@ public class IgniteMarshallerCacheClientRequestsMappingOnMissTest extends GridCo
 
         replaceWithCountingMappingRequestListener(((GridKernalContext)U.field(srv3, "ctx")).io());
 
-        srv3.cache(null).put(
+        srv3.cache(DEFAULT_CACHE_NAME).put(
             1, new Organization(1, "Microsoft", "One Microsoft Way Redmond, WA 98052-6399, USA"));
 
         clientMode = true;
 
         Ignite cl1 = startGrid(4);
 
-        cl1.cache(null).get(1);
+        cl1.cache(DEFAULT_CACHE_NAME).get(1);
 
         int result = mappingReqsCounter.get();
 
@@ -197,14 +197,14 @@ public class IgniteMarshallerCacheClientRequestsMappingOnMissTest extends GridCo
 
         replaceWithCountingMappingRequestListener(((GridKernalContext)U.field(srv3, "ctx")).io());
 
-        srv3.cache(null).put(
+        srv3.cache(DEFAULT_CACHE_NAME).put(
             1, new Organization(1, "Microsoft", "One Microsoft Way Redmond, WA 98052-6399, USA"));
 
         clientMode = true;
 
         Ignite cl1 = startGrid(4);
 
-        cl1.cache(null).get(1);
+        cl1.cache(DEFAULT_CACHE_NAME).get(1);
 
         nodeStopLatch.await(5_000, TimeUnit.MILLISECONDS);
 
@@ -233,14 +233,14 @@ public class IgniteMarshallerCacheClientRequestsMappingOnMissTest extends GridCo
 
         replaceWithCountingMappingRequestListener(((GridKernalContext)U.field(srv3, "ctx")).io());
 
-        srv3.cache(null).put(
+        srv3.cache(DEFAULT_CACHE_NAME).put(
             1, new Organization(1, "Microsoft", "One Microsoft Way Redmond, WA 98052-6399, USA"));
 
         clientMode = true;
 
         Ignite cl1 = startGrid(4);
 
-        cl1.cache(null).get(1);
+        cl1.cache(DEFAULT_CACHE_NAME).get(1);
 
         nodeStopLatch.await(5_000, TimeUnit.MILLISECONDS);
 
@@ -270,7 +270,7 @@ public class IgniteMarshallerCacheClientRequestsMappingOnMissTest extends GridCo
         replaceWithStoppingMappingRequestListener(
             ((GridKernalContext)U.field(srv3, "ctx")).io(), 2, nodeStopLatch);
 
-        srv3.cache(null).put(
+        srv3.cache(DEFAULT_CACHE_NAME).put(
             1, new Organization(1, "Microsoft", "One Microsoft Way Redmond, WA 98052-6399, USA"));
 
         clientMode = true;
@@ -278,7 +278,7 @@ public class IgniteMarshallerCacheClientRequestsMappingOnMissTest extends GridCo
         Ignite cl1 = startGrid(4);
 
         try {
-            cl1.cache(null).get(1);
+            cl1.cache(DEFAULT_CACHE_NAME).get(1);
         }
         catch (Exception e) {
             e.printStackTrace();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheConcurrentReadWriteTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheConcurrentReadWriteTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheConcurrentReadWriteTest.java
index dff710c..4e477f2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheConcurrentReadWriteTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteMarshallerCacheConcurrentReadWriteTest.java
@@ -54,7 +54,7 @@ public class IgniteMarshallerCacheConcurrentReadWriteTest extends GridCommonAbst
 
         ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(REPLICATED);
         ccfg.setRebalanceMode(SYNC);
@@ -104,7 +104,7 @@ public class IgniteMarshallerCacheConcurrentReadWriteTest extends GridCommonAbst
             dataBytes.put(i, ignite.configuration().getMarshaller().marshal(obj));
         }
 
-        ignite.cache(null).putAll(data);
+        ignite.cache(DEFAULT_CACHE_NAME).putAll(data);
 
         stopGrid(0);
 
@@ -119,7 +119,7 @@ public class IgniteMarshallerCacheConcurrentReadWriteTest extends GridCommonAbst
 
                     Ignite ignite = startGrid(node);
 
-                    IgniteCache<Object, Object> cache = ignite.cache(null);
+                    IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                     for (Map.Entry<Integer, byte[]> e : dataBytes.entrySet()) {
                         Object obj = ignite.configuration().getMarshaller().unmarshal(e.getValue(), null);
@@ -127,7 +127,7 @@ public class IgniteMarshallerCacheConcurrentReadWriteTest extends GridCommonAbst
                         cache.put(e.getKey(), obj);
                     }
 
-                    ignite.cache(null).getAll(dataBytes.keySet());
+                    ignite.cache(DEFAULT_CACHE_NAME).getAll(dataBytes.keySet());
 
                     return null;
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearSelfTest.java
index f993a89..55323bb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearSelfTest.java
@@ -75,7 +75,7 @@ public class IgniteOnePhaseCommitNearSelfTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     protected CacheConfiguration cacheConfiguration(String igniteInstanceName) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setBackups(backups);
         ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
@@ -98,7 +98,7 @@ public class IgniteOnePhaseCommitNearSelfTest extends GridCommonAbstractTest {
 
             int key = generateNearKey();
 
-            IgniteCache<Object, Object> cache = ignite(0).cache(null);
+            IgniteCache<Object, Object> cache = ignite(0).cache(DEFAULT_CACHE_NAME);
 
             checkKey(ignite(0).transactions(), cache, key);
         }
@@ -143,7 +143,7 @@ public class IgniteOnePhaseCommitNearSelfTest extends GridCommonAbstractTest {
             @Override public boolean apply() {
                 try {
                     for (int i = 0; i < GRID_CNT; i++) {
-                        GridCacheAdapter<Object, Object> cache = ((IgniteKernal)ignite(i)).internalCache();
+                        GridCacheAdapter<Object, Object> cache = ((IgniteKernal)ignite(i)).internalCache(DEFAULT_CACHE_NAME);
 
                         GridCacheEntryEx entry = cache.peekEx(key);
 
@@ -202,7 +202,7 @@ public class IgniteOnePhaseCommitNearSelfTest extends GridCommonAbstractTest {
      * @return Key.
      */
     protected int generateNearKey() {
-        Affinity<Object> aff = ignite(0).affinity(null);
+        Affinity<Object> aff = ignite(0).affinity(DEFAULT_CACHE_NAME);
 
         int key = 0;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java
index 6d8079c..56a4381 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllLargeBatchSelfTest.java
@@ -159,7 +159,7 @@ public class IgnitePutAllLargeBatchSelfTest extends GridCommonAbstractTest {
         awaitPartitionMapExchange();
 
         try {
-            IgniteCache<Object, Object> cache = grid(0).cache(null);
+            IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             int keyCnt = 200;
 
@@ -169,7 +169,7 @@ public class IgnitePutAllLargeBatchSelfTest extends GridCommonAbstractTest {
             // Create readers if near cache is enabled.
             for (int g = 1; g < 2; g++) {
                 for (int i = 30; i < 70; i++)
-                    ((IgniteKernal)grid(g)).getCache(null).get(i);
+                    ((IgniteKernal)grid(g)).getCache(DEFAULT_CACHE_NAME).get(i);
             }
 
             info(">>> Starting test tx.");
@@ -191,7 +191,7 @@ public class IgnitePutAllLargeBatchSelfTest extends GridCommonAbstractTest {
             for (int g = 0; g < GRID_CNT; g++) {
                 IgniteKernal k = (IgniteKernal)grid(g);
 
-                GridCacheAdapter<Object, Object> cacheAdapter = k.context().cache().internalCache();
+                GridCacheAdapter<Object, Object> cacheAdapter = k.context().cache().internalCache(DEFAULT_CACHE_NAME);
 
                 assertEquals(0, cacheAdapter.context().tm().idMapSize());
 
@@ -218,12 +218,12 @@ public class IgnitePutAllLargeBatchSelfTest extends GridCommonAbstractTest {
             }
 
             for (int g = 0; g < GRID_CNT; g++) {
-                IgniteCache<Object, Object> checkCache =grid(g).cache(null);
+                IgniteCache<Object, Object> checkCache =grid(g).cache(DEFAULT_CACHE_NAME);
 
                 ClusterNode checkNode = grid(g).localNode();
 
                 for (int i = 0; i < keyCnt; i++) {
-                    if (grid(g).affinity(null).isPrimaryOrBackup(checkNode, i))
+                    if (grid(g).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(checkNode, i))
                         assertEquals(i * i, checkCache.localPeek(i, CachePeekMode.PRIMARY, CachePeekMode.BACKUP));
                 }
             }
@@ -284,7 +284,7 @@ public class IgnitePutAllLargeBatchSelfTest extends GridCommonAbstractTest {
         try {
             Map<Integer, Integer> checkMap = new HashMap<>();
 
-            IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+            IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             for (int r = 0; r < 3; r++) {
                 for (int i = 0; i < 10; i++) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllUpdateNonPreloadedPartitionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllUpdateNonPreloadedPartitionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllUpdateNonPreloadedPartitionSelfTest.java
index 7a51bc0..2503e21 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllUpdateNonPreloadedPartitionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgnitePutAllUpdateNonPreloadedPartitionSelfTest.java
@@ -77,11 +77,11 @@ public class IgnitePutAllUpdateNonPreloadedPartitionSelfTest extends GridCommonA
 
         try {
             for (int i = 0; i < GRID_CNT - 1; i++)
-                grid(i).cache(null).rebalance().get();
+                grid(i).cache(DEFAULT_CACHE_NAME).rebalance().get();
 
             startGrid(GRID_CNT - 1);
 
-            IgniteCache<Object, Object> cache = grid(0).cache(null);
+            IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             final int keyCnt = 100;
 
@@ -99,7 +99,7 @@ public class IgnitePutAllUpdateNonPreloadedPartitionSelfTest extends GridCommonA
             for (int g = 0; g < GRID_CNT; g++) {
                 IgniteKernal k = (IgniteKernal)grid(g);
 
-                GridCacheAdapter<Object, Object> cacheAdapter = k.context().cache().internalCache();
+                GridCacheAdapter<Object, Object> cacheAdapter = k.context().cache().internalCache(DEFAULT_CACHE_NAME);
 
                 assertEquals(0, cacheAdapter.context().tm().idMapSize());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java
index 54584f1..782b333 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStartCacheInTransactionSelfTest.java
@@ -52,7 +52,7 @@ public class IgniteStartCacheInTransactionSelfTest extends GridCommonAbstractTes
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(atomicityMode());
         ccfg.setBackups(1);
@@ -101,7 +101,7 @@ public class IgniteStartCacheInTransactionSelfTest extends GridCommonAbstractTes
         final String val = "val";
 
         try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)){
-            ignite.cache(null).put(key, val);
+            ignite.cache(DEFAULT_CACHE_NAME).put(key, val);
 
             GridTestUtils.assertThrows(log, new Callable<Object>() {
                 @Override public Object call() throws Exception {
@@ -125,7 +125,7 @@ public class IgniteStartCacheInTransactionSelfTest extends GridCommonAbstractTes
         final String val = "val";
 
         try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)){
-            ignite.cache(null).put(key, val);
+            ignite.cache(DEFAULT_CACHE_NAME).put(key, val);
 
             GridTestUtils.assertThrows(log, new Callable<Object>() {
                 @Override public Object call() throws Exception {
@@ -149,7 +149,7 @@ public class IgniteStartCacheInTransactionSelfTest extends GridCommonAbstractTes
         final String val = "val";
 
         try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)){
-            ignite.cache(null).put(key, val);
+            ignite.cache(DEFAULT_CACHE_NAME).put(key, val);
 
             GridTestUtils.assertThrows(log, new Callable<Object>() {
                 @Override public Object call() throws Exception {
@@ -173,7 +173,7 @@ public class IgniteStartCacheInTransactionSelfTest extends GridCommonAbstractTes
         final String val = "val";
 
         try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)){
-            ignite.cache(null).put(key, val);
+            ignite.cache(DEFAULT_CACHE_NAME).put(key, val);
 
             GridTestUtils.assertThrows(log, new Callable<Object>() {
                 @Override public Object call() throws Exception {
@@ -197,7 +197,7 @@ public class IgniteStartCacheInTransactionSelfTest extends GridCommonAbstractTes
         final String val = "val";
 
         try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)){
-            ignite.cache(null).put(key, val);
+            ignite.cache(DEFAULT_CACHE_NAME).put(key, val);
 
             GridTestUtils.assertThrows(log, new Callable<Object>() {
                 @Override public Object call() throws Exception {
@@ -221,11 +221,11 @@ public class IgniteStartCacheInTransactionSelfTest extends GridCommonAbstractTes
         final String val = "val";
 
         try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)){
-            ignite.cache(null).put(key, val);
+            ignite.cache(DEFAULT_CACHE_NAME).put(key, val);
 
             GridTestUtils.assertThrows(log, new Callable<Object>() {
                 @Override public Object call() throws Exception {
-                    ignite.destroyCache(null);
+                    ignite.destroyCache(DEFAULT_CACHE_NAME);
 
                     return null;
                 }
@@ -246,7 +246,7 @@ public class IgniteStartCacheInTransactionSelfTest extends GridCommonAbstractTes
 
         final String key = "key";
 
-        Lock lock = ignite.cache(null).lock(key);
+        Lock lock = ignite.cache(DEFAULT_CACHE_NAME).lock(key);
 
         lock.lock();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStaticCacheStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStaticCacheStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStaticCacheStartSelfTest.java
index ab872ee..0c64a79 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStaticCacheStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteStaticCacheStartSelfTest.java
@@ -41,7 +41,7 @@ public class IgniteStaticCacheStartSelfTest extends GridCommonAbstractTest {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
         if (hasCache) {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             ccfg.setCacheMode(CacheMode.PARTITIONED);
             ccfg.setBackups(1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractCacheTest.java
index eee6dda..f94babe 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractCacheTest.java
@@ -61,19 +61,18 @@ public abstract class IgniteTopologyValidatorAbstractCacheTest extends IgniteCac
         iCfg.setCacheConfiguration(cCfg0, cCfg1, cCfg2);
 
         for (CacheConfiguration cCfg : iCfg.getCacheConfiguration()) {
-            if (cCfg.getName() != null)
-                if (cCfg.getName().equals(CACHE_NAME_1))
-                    cCfg.setTopologyValidator(new TopologyValidator() {
-                        @Override public boolean validate(Collection<ClusterNode> nodes) {
-                            return nodes.size() == 2;
-                        }
-                    });
-                else if (cCfg.getName().equals(CACHE_NAME_2))
-                    cCfg.setTopologyValidator(new TopologyValidator() {
-                        @Override public boolean validate(Collection<ClusterNode> nodes) {
-                            return nodes.size() >= 2;
-                        }
-                    });
+            if (cCfg.getName().equals(CACHE_NAME_1))
+                cCfg.setTopologyValidator(new TopologyValidator() {
+                    @Override public boolean validate(Collection<ClusterNode> nodes) {
+                        return nodes.size() == 2;
+                    }
+                });
+            else if (cCfg.getName().equals(CACHE_NAME_2))
+                cCfg.setTopologyValidator(new TopologyValidator() {
+                    @Override public boolean validate(Collection<ClusterNode> nodes) {
+                        return nodes.size() >= 2;
+                    }
+                });
         }
 
         return iCfg;
@@ -181,8 +180,8 @@ public abstract class IgniteTopologyValidatorAbstractCacheTest extends IgniteCac
     /** topology validator test. */
     public void testTopologyValidator() throws Exception {
 
-        putValid(null);
-        remove(null);
+        putValid(DEFAULT_CACHE_NAME);
+        remove(DEFAULT_CACHE_NAME);
 
         putInvalid(CACHE_NAME_1);
         removeInvalid(CACHE_NAME_1);
@@ -192,8 +191,8 @@ public abstract class IgniteTopologyValidatorAbstractCacheTest extends IgniteCac
 
         startGrid(1);
 
-        putValid(null);
-        remove(null);
+        putValid(DEFAULT_CACHE_NAME);
+        remove(DEFAULT_CACHE_NAME);
 
         putValid(CACHE_NAME_1);
 
@@ -202,8 +201,8 @@ public abstract class IgniteTopologyValidatorAbstractCacheTest extends IgniteCac
 
         startGrid(2);
 
-        putValid(null);
-        remove(null);
+        putValid(DEFAULT_CACHE_NAME);
+        remove(DEFAULT_CACHE_NAME);
 
         getInvalid(CACHE_NAME_1);
         putInvalid(CACHE_NAME_1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheTest.java
index fd386bb..7949c50 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorAbstractTxCacheTest.java
@@ -53,21 +53,21 @@ public abstract class IgniteTopologyValidatorAbstractTxCacheTest extends IgniteT
 
         try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.OPTIMISTIC, TransactionIsolation.REPEATABLE_READ)) {
             putValid(CACHE_NAME_1);
-            putValid(null);
+            putValid(DEFAULT_CACHE_NAME);
             putValid(CACHE_NAME_2);
             commitFailed(tx);
         }
 
-        assertEmpty(null); // rolled back
+        assertEmpty(DEFAULT_CACHE_NAME); // rolled back
         assertEmpty(CACHE_NAME_1); // rolled back
         assertEmpty(CACHE_NAME_2); // rolled back
 
         try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)) {
-            putValid(null);
+            putValid(DEFAULT_CACHE_NAME);
             putInvalid(CACHE_NAME_1);
         }
 
-        assertEmpty(null); // rolled back
+        assertEmpty(DEFAULT_CACHE_NAME); // rolled back
         assertEmpty(CACHE_NAME_1); // rolled back
 
         startGrid(1);
@@ -89,11 +89,11 @@ public abstract class IgniteTopologyValidatorAbstractTxCacheTest extends IgniteT
         startGrid(2);
 
         try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)) {
-            putValid(null);
+            putValid(DEFAULT_CACHE_NAME);
             putInvalid(CACHE_NAME_1);
         }
 
-        assertEmpty(null); // rolled back
+        assertEmpty(DEFAULT_CACHE_NAME); // rolled back
         assertEmpty(CACHE_NAME_1); // rolled back
 
         try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.OPTIMISTIC, TransactionIsolation.REPEATABLE_READ)) {
@@ -106,21 +106,21 @@ public abstract class IgniteTopologyValidatorAbstractTxCacheTest extends IgniteT
         }
 
         try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.OPTIMISTIC, TransactionIsolation.REPEATABLE_READ)) {
-            putValid(null);
+            putValid(DEFAULT_CACHE_NAME);
             putValid(CACHE_NAME_2);
             tx.commit();
         }
 
-        remove(null);
+        remove(DEFAULT_CACHE_NAME);
         remove(CACHE_NAME_2);
 
         try (Transaction tx = grid(0).transactions().txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ)) {
-            putValid(null);
+            putValid(DEFAULT_CACHE_NAME);
             putValid(CACHE_NAME_2);
             tx.commit();
         }
 
-        remove(null);
+        remove(DEFAULT_CACHE_NAME);
         remove(CACHE_NAME_2);
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java
index 3f9ed55..fd77309 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTopologyValidatorGridSplitCacheTest.java
@@ -90,7 +90,7 @@ public class IgniteTopologyValidatorGridSplitCacheTest extends GridCommonAbstrac
                 CacheConfiguration[] ccfgs = new CacheConfiguration[CACHES_CNT];
 
                 for (int cnt = 0; cnt < CACHES_CNT; cnt++) {
-                    CacheConfiguration ccfg = new CacheConfiguration();
+                    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
                     ccfg.setName(testCacheName(cnt));
                     ccfg.setCacheMode(PARTITIONED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java
index 694101c..5340f63 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxAbstractTest.java
@@ -187,7 +187,7 @@ abstract class IgniteTxAbstractTest extends GridCommonAbstractTest {
                         int part = aff.partition(key);
 
                         debug("Key affinity [key=" + key + ", partition=" + part + ", affinity=" +
-                            U.toShortString(ignite(gridIdx).affinity(null).mapPartitionToPrimaryAndBackups(part)) + ']');
+                            U.toShortString(ignite(gridIdx).affinity(DEFAULT_CACHE_NAME).mapPartitionToPrimaryAndBackups(part)) + ']');
                     }
 
                     String val = Integer.toString(key);
@@ -253,7 +253,7 @@ abstract class IgniteTxAbstractTest extends GridCommonAbstractTest {
         if (printMemoryStats()) {
             if (cntr.getAndIncrement() % 100 == 0)
                 // Print transaction memory stats.
-                ((IgniteKernal)grid(gridIdx)).internalCache().context().tm().printMemoryStats();
+                ((IgniteKernal)grid(gridIdx)).internalCache(DEFAULT_CACHE_NAME).context().tm().printMemoryStats();
         }
     }
 
@@ -295,7 +295,7 @@ abstract class IgniteTxAbstractTest extends GridCommonAbstractTest {
                         int part = aff.partition(key);
 
                         debug("Key affinity [key=" + key + ", partition=" + part + ", affinity=" +
-                            U.toShortString(ignite(gridIdx).affinity(null).mapPartitionToPrimaryAndBackups(part)) + ']');
+                            U.toShortString(ignite(gridIdx).affinity(DEFAULT_CACHE_NAME).mapPartitionToPrimaryAndBackups(part)) + ']');
                     }
 
                     String val = Integer.toString(key);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConcurrentGetAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConcurrentGetAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConcurrentGetAbstractTest.java
index 04f0c99..5fb0766 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConcurrentGetAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConcurrentGetAbstractTest.java
@@ -72,7 +72,7 @@ public abstract class IgniteTxConcurrentGetAbstractTest extends GridCommonAbstra
      * @return Near cache.
      */
     GridNearCacheAdapter<String, Integer> near(Ignite g) {
-        return (GridNearCacheAdapter<String, Integer>)((IgniteKernal)g).<String, Integer>internalCache();
+        return (GridNearCacheAdapter<String, Integer>)((IgniteKernal)g).<String, Integer>internalCache(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -94,7 +94,7 @@ public abstract class IgniteTxConcurrentGetAbstractTest extends GridCommonAbstra
 
         final Ignite ignite = grid();
 
-        ignite.cache(null).put(key, "val");
+        ignite.cache(DEFAULT_CACHE_NAME).put(key, "val");
 
         GridCacheEntryEx dhtEntry = dht(ignite).peekEx(key);
 
@@ -128,7 +128,7 @@ public abstract class IgniteTxConcurrentGetAbstractTest extends GridCommonAbstra
                 info("DHT entry [hash=" + System.identityHashCode(dhtEntry) + ", xid=" + tx.xid() +
                     ", entry=" + dhtEntry + ']');
 
-            String val = ignite.<String, String>cache(null).get(key);
+            String val = ignite.<String, String>cache(DEFAULT_CACHE_NAME).get(key);
 
             assertNotNull(val);
             assertEquals("val", val);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConfigCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConfigCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConfigCacheSelfTest.java
index 4fd4989..5c3aa81 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConfigCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConfigCacheSelfTest.java
@@ -75,7 +75,7 @@ public class IgniteTxConfigCacheSelfTest extends GridCommonAbstractTest {
 
         cfg.setCommunicationSpi(commSpi);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME);
 
         ccfg.setAtomicityMode(atomicityMode());
         ccfg.setBackups(1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
index c60d718..1d27524 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
@@ -116,7 +116,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
         }
 
         for (int key = 0; key <= lastKey; key++)
-            grid(0).cache(null).remove(key);
+            grid(0).cache(DEFAULT_CACHE_NAME).remove(key);
 
         assertEquals(0, jcache(0).size(CachePeekMode.ALL));
     }
@@ -315,7 +315,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
 
         info("Test transaction [concurrency=" + concurrency + ", isolation=" + isolation + ']');
 
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         if (putBefore) {
             TestIndexingSpi.forceFail(false);
@@ -338,7 +338,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
         // Execute get from all nodes to create readers for near cache.
         for (int i = 0; i < gridCount(); i++) {
             for (Integer key : keys)
-                grid(i).cache(null).get(key);
+                grid(i).cache(DEFAULT_CACHE_NAME).get(key);
         }
 
         TestIndexingSpi.forceFail(true);
@@ -368,7 +368,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
             checkUnlocked(key);
 
         for (int i = 0; i < gridCount(); i++)
-            assertEquals(0, ((IgniteKernal)ignite(0)).internalCache(null).context().tm().idMapSize());
+            assertEquals(0, ((IgniteKernal)ignite(0)).internalCache(DEFAULT_CACHE_NAME).context().tm().idMapSize());
     }
 
     /**
@@ -390,7 +390,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
                 @Override public boolean apply() {
                     IgniteKernal grid = (IgniteKernal)grid(idx);
 
-                    GridCacheAdapter cache = grid.internalCache(null);
+                    GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
                     GridCacheEntryEx entry = cache.peekEx(key);
 
@@ -449,12 +449,12 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
 
             info("Put key: " + key);
 
-            grid(0).cache(null).put(key, 1);
+            grid(0).cache(DEFAULT_CACHE_NAME).put(key, 1);
         }
 
         // Execute get from all nodes to create readers for near cache.
         for (int i = 0; i < gridCount(); i++)
-            grid(i).cache(null).get(key);
+            grid(i).cache(DEFAULT_CACHE_NAME).get(key);
 
         TestIndexingSpi.forceFail(true);
 
@@ -462,7 +462,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
 
         GridTestUtils.assertThrows(log, new Callable<Void>() {
             @Override public Void call() throws Exception {
-                grid(0).cache(null).put(key, 2);
+                grid(0).cache(DEFAULT_CACHE_NAME).put(key, 2);
 
                 return null;
             }
@@ -482,12 +482,12 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
 
             info("Put key: " + key);
 
-            grid(0).cache(null).put(key, 1);
+            grid(0).cache(DEFAULT_CACHE_NAME).put(key, 1);
         }
 
         // Execute get from all nodes to create readers for near cache.
         for (int i = 0; i < gridCount(); i++)
-            grid(i).cache(null).get(key);
+            grid(i).cache(DEFAULT_CACHE_NAME).get(key);
 
         TestIndexingSpi.forceFail(true);
 
@@ -495,7 +495,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
 
         Throwable e = GridTestUtils.assertThrows(log, new Callable<Void>() {
             @Override public Void call() throws Exception {
-                grid(0).<Integer, Integer>cache(null).invoke(key, new EntryProcessor<Integer, Integer, Void>() {
+                grid(0).<Integer, Integer>cache(DEFAULT_CACHE_NAME).invoke(key, new EntryProcessor<Integer, Integer, Void>() {
                     @Override public Void process(MutableEntry<Integer, Integer> e, Object... args) {
                         e.setValue(2);
 
@@ -530,13 +530,13 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
 
             info("Put data: " + m);
 
-            grid(0).cache(null).putAll(m);
+            grid(0).cache(DEFAULT_CACHE_NAME).putAll(m);
         }
 
         // Execute get from all nodes to create readers for near cache.
         for (int i = 0; i < gridCount(); i++) {
             for (Integer key : keys)
-                grid(i).cache(null).get(key);
+                grid(i).cache(DEFAULT_CACHE_NAME).get(key);
         }
 
         TestIndexingSpi.forceFail(true);
@@ -550,7 +550,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
 
         GridTestUtils.assertThrows(log, new Callable<Void>() {
             @Override public Void call() throws Exception {
-                grid(0).cache(null).putAll(m);
+                grid(0).cache(DEFAULT_CACHE_NAME).putAll(m);
 
                 return null;
             }
@@ -571,12 +571,12 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
 
             info("Put key: " + key);
 
-            grid(0).cache(null).put(key, 1);
+            grid(0).cache(DEFAULT_CACHE_NAME).put(key, 1);
         }
 
         // Execute get from all nodes to create readers for near cache.
         for (int i = 0; i < gridCount(); i++)
-            grid(i).cache(null).get(key);
+            grid(i).cache(DEFAULT_CACHE_NAME).get(key);
 
         TestIndexingSpi.forceFail(true);
 
@@ -584,7 +584,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
 
         GridTestUtils.assertThrows(log, new Callable<Void>() {
             @Override public Void call() throws Exception {
-                grid(0).cache(null).remove(key);
+                grid(0).cache(DEFAULT_CACHE_NAME).remove(key);
 
                 return null;
             }
@@ -601,7 +601,7 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
      * @return Key.
      */
     private Integer keyForNode(ClusterNode node, int type) {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         if (cache.getConfiguration(CacheConfiguration.class).getCacheMode() == LOCAL)
             return ++lastKey;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiNodeAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiNodeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiNodeAbstractTest.java
index b170ac3..3df934f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiNodeAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiNodeAbstractTest.java
@@ -118,7 +118,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
      */
     @SuppressWarnings("unchecked")
     private static UUID primaryId(Ignite ignite, Object key) {
-        Affinity aff = ignite.affinity(null);
+        Affinity aff = ignite.affinity(DEFAULT_CACHE_NAME);
 
         Collection<ClusterNode> affNodes = aff.mapPartitionToPrimaryAndBackups(aff.partition(key));
 
@@ -138,7 +138,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
         Ignite g = G.ignite(nodeId);
 
         GridDhtCacheAdapter<Object, Integer> dht =
-            ((IgniteKernal)g).<Object, Integer>internalCache().context().near().dht();
+            ((IgniteKernal)g).<Object, Integer>internalCache(DEFAULT_CACHE_NAME).context().near().dht();
 
         return dht.peekEx(key);
     }
@@ -151,7 +151,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
     @Nullable private static GridCacheEntryEx nearEntry(UUID nodeId, Object key) {
         Ignite g = G.ignite(nodeId);
 
-        GridNearCacheAdapter<Object, Integer> near = ((IgniteKernal)g).<Object, Integer>internalCache().context().near();
+        GridNearCacheAdapter<Object, Integer> near = ((IgniteKernal)g).<Object, Integer>internalCache(DEFAULT_CACHE_NAME).context().near();
 
         return near.peekEx(key);
     }
@@ -165,7 +165,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
      */
     @SuppressWarnings("unchecked")
     private void onItemNear(boolean putCntr, Ignite ignite, String itemKey, int retry) {
-        IgniteCache<String, Integer> cache = ignite.cache(null);
+        IgniteCache<String, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         UUID locId = ignite.cluster().localNode().id();
         UUID itemPrimaryId = primaryId(ignite, itemKey);
@@ -216,7 +216,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
      */
     @SuppressWarnings("unchecked")
     private void onItemPrimary(boolean putCntr, Ignite ignite, String itemKey, int retry) {
-        IgniteCache<String, Integer> cache = ignite.cache(null);
+        IgniteCache<String, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         UUID locId = ignite.cluster().localNode().id();
         UUID itemPrimaryId = primaryId(ignite, itemKey);
@@ -269,7 +269,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
      */
     @SuppressWarnings("unchecked")
     private void onRemoveItemQueried(boolean putCntr, Ignite ignite, int retry) throws IgniteCheckedException {
-        IgniteCache<String, Integer> cache = ignite.cache(null);
+        IgniteCache<String, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         UUID locId = ignite.cluster().localNode().id();
         UUID cntrPrimaryId = primaryId(ignite, RMVD_CNTR_KEY);
@@ -358,7 +358,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
      */
     @SuppressWarnings("unchecked")
     private void onRemoveItemSimple(boolean putCntr, Ignite ignite, int retry) {
-        IgniteCache<String, Integer> cache = ignite.cache(null);
+        IgniteCache<String, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         UUID locId = ignite.cluster().localNode().id();
         UUID cntrPrimaryId = primaryId(ignite, RMVD_CNTR_KEY);
@@ -465,7 +465,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
             onRemoveItemQueried(putCntr, ignite, i);
 
             if (i % 50 == 0)
-                ((IgniteKernal) ignite).internalCache().context().tm().printMemoryStats();
+                ((IgniteKernal) ignite).internalCache(DEFAULT_CACHE_NAME).context().tm().printMemoryStats();
         }
     }
 
@@ -500,7 +500,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
         startGrids(GRID_CNT);
 
         try {
-            grid(0).cache(null).put(CNTR_KEY, 0);
+            grid(0).cache(DEFAULT_CACHE_NAME).put(CNTR_KEY, 0);
 
             grid(0).compute().call(new PutOneEntryInTxJob());
         }
@@ -520,13 +520,13 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
         startGrids(GRID_CNT);
 
         try {
-            grid(0).cache(null).put(CNTR_KEY, 0);
+            grid(0).cache(DEFAULT_CACHE_NAME).put(CNTR_KEY, 0);
 
             grid(0).compute().call(new PutTwoEntriesInTxJob());
 
             printCounter();
 
-            assertEquals(GRID_CNT * RETRIES, grid(0).cache(null).get(CNTR_KEY));
+            assertEquals(GRID_CNT * RETRIES, grid(0).cache(DEFAULT_CACHE_NAME).get(CNTR_KEY));
         }
         finally {
             stopAllGrids();
@@ -547,7 +547,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
 
         try {
             // Initialize.
-            grid(0).cache(null).put(CNTR_KEY, 0);
+            grid(0).cache(DEFAULT_CACHE_NAME).put(CNTR_KEY, 0);
 
             for (int i = 0; i < GRID_CNT; i++) {
                 final int gridId = i;
@@ -585,7 +585,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
         Collection<Thread> threads = new LinkedList<>();
 
         try {
-            grid(0).cache(null).put(CNTR_KEY, 0);
+            grid(0).cache(DEFAULT_CACHE_NAME).put(CNTR_KEY, 0);
 
             for (int i = 0; i < GRID_CNT; i++) {
                 final int gridId = i;
@@ -605,7 +605,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
 
             printCounter();
 
-            assertEquals(GRID_CNT * RETRIES, grid(0).cache(null).get(CNTR_KEY));
+            assertEquals(GRID_CNT * RETRIES, grid(0).cache(DEFAULT_CACHE_NAME).get(CNTR_KEY));
         }
         finally {
             stopAllGrids();
@@ -623,7 +623,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
         startGrids(GRID_CNT);
 
         try {
-            IgniteCache<String, Integer> cache = grid(0).cache(null);
+            IgniteCache<String, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             cache.put(RMVD_CNTR_KEY, 0);
 
@@ -632,7 +632,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
 
             for (int i = 0; i < RETRIES; i++)
                 for (int j = 0; j < GRID_CNT; j++)
-                    assertEquals(i, grid(j).cache(null).get(String.valueOf(i)));
+                    assertEquals(i, grid(j).cache(DEFAULT_CACHE_NAME).get(String.valueOf(i)));
 
             Collection<Cache.Entry<String, Integer>> entries =
                 cache.query(new SqlQuery<String, Integer>(Integer.class, " _val >= 0")).getAll();
@@ -645,9 +645,9 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
 
             for (int i = 0; i < GRID_CNT * RETRIES; i++)
                 for (int ii = 0; ii < GRID_CNT; ii++)
-                    assertEquals(null, grid(ii).cache(null).get(Integer.toString(i)));
+                    assertEquals(null, grid(ii).cache(DEFAULT_CACHE_NAME).get(Integer.toString(i)));
 
-            assertEquals(-GRID_CNT * RETRIES, grid(0).cache(null).localPeek(RMVD_CNTR_KEY, CachePeekMode.ONHEAP));
+            assertEquals(-GRID_CNT * RETRIES, grid(0).cache(DEFAULT_CACHE_NAME).localPeek(RMVD_CNTR_KEY, CachePeekMode.ONHEAP));
         }
         finally {
             stopAllGrids();
@@ -663,7 +663,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
         startGrids(GRID_CNT);
 
         try {
-            IgniteCache<String, Integer> cache = grid(0).cache(null);
+            IgniteCache<String, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             cache.put(RMVD_CNTR_KEY, 0);
 
@@ -672,7 +672,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
 
             for (int i = 0; i < RETRIES; i++)
                 for (int j = 0; j < GRID_CNT; j++)
-                    assertEquals(i, grid(j).cache(null).get(Integer.toString(i)));
+                    assertEquals(i, grid(j).cache(DEFAULT_CACHE_NAME).get(Integer.toString(i)));
 
             Collection<Cache.Entry<String, Integer>> entries =
                 cache.query(new SqlQuery<String, Integer>(Integer.class, " _val >= 0")).getAll();
@@ -686,14 +686,14 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
             // Check using cache.
             for (int i = 0; i < GRID_CNT * RETRIES; i++)
                 for (int ii = 0; ii < GRID_CNT; ii++)
-                    assertEquals(null, grid(ii).cache(null).get(Integer.toString(i)));
+                    assertEquals(null, grid(ii).cache(DEFAULT_CACHE_NAME).get(Integer.toString(i)));
 
             // Check using query.
             entries = cache.query(new SqlQuery<String, Integer>(Integer.class, " _val >= 0")).getAll();
 
             assertTrue(entries.isEmpty());
 
-            assertEquals(-GRID_CNT * RETRIES, grid(0).cache(null).localPeek(RMVD_CNTR_KEY, CachePeekMode.ONHEAP));
+            assertEquals(-GRID_CNT * RETRIES, grid(0).cache(DEFAULT_CACHE_NAME).localPeek(RMVD_CNTR_KEY, CachePeekMode.ONHEAP));
         }
         finally {
             stopAllGrids();
@@ -713,7 +713,7 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
         try {
             startGrids(GRID_CNT);
 
-            IgniteCache<String, Integer> cache = grid(0).cache(null);
+            IgniteCache<String, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             // Store counter.
             cache.getAndPut(RMVD_CNTR_KEY, 0);
@@ -723,11 +723,11 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
                 cache.getAndPut(String.valueOf(i), i);
 
             for (int j = 0; j < GRID_CNT; j++)
-                assertEquals(0, grid(j).cache(null).get(RMVD_CNTR_KEY));
+                assertEquals(0, grid(j).cache(DEFAULT_CACHE_NAME).get(RMVD_CNTR_KEY));
 
             for (int i = 1; i <= RETRIES; i++)
                 for (int j = 0; j < GRID_CNT; j++)
-                    assertEquals(i, grid(j).cache(null).get(String.valueOf(i)));
+                    assertEquals(i, grid(j).cache(DEFAULT_CACHE_NAME).get(String.valueOf(i)));
 
             SqlQuery<String, Integer> qry = new SqlQuery<>(Integer.class, "_val >= 0");
 
@@ -779,9 +779,9 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
             for (int i = 0; i < GRID_CNT * RETRIES; i++)
                 for (int ii = 0; ii < GRID_CNT; ii++)
                     assertEquals("Got invalid value from cache [gridIdx=" + ii + ", key=" + i + ']',
-                        null, grid(ii).cache(null).get(Integer.toString(i)));
+                        null, grid(ii).cache(DEFAULT_CACHE_NAME).get(Integer.toString(i)));
 
-            assertEquals(-GRID_CNT * RETRIES, grid(0).cache(null).localPeek(RMVD_CNTR_KEY, CachePeekMode.ONHEAP));
+            assertEquals(-GRID_CNT * RETRIES, grid(0).cache(DEFAULT_CACHE_NAME).localPeek(RMVD_CNTR_KEY, CachePeekMode.ONHEAP));
         }
         finally {
             stopAllGrids();
@@ -793,8 +793,8 @@ public abstract class IgniteTxMultiNodeAbstractTest extends GridCommonAbstractTe
      */
     private void printCounter() {
         info("***");
-        info("*** Peeked counter: " + grid(0).cache(null).localPeek(CNTR_KEY, CachePeekMode.ONHEAP));
-        info("*** Got counter: " + grid(0).cache(null).get(CNTR_KEY));
+        info("*** Peeked counter: " + grid(0).cache(DEFAULT_CACHE_NAME).localPeek(CNTR_KEY, CachePeekMode.ONHEAP));
+        info("*** Got counter: " + grid(0).cache(DEFAULT_CACHE_NAME).get(CNTR_KEY));
         info("***");
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiThreadedAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiThreadedAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiThreadedAbstractTest.java
index 07e30e8..5a1a1db 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiThreadedAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxMultiThreadedAbstractTest.java
@@ -219,7 +219,7 @@ public abstract class IgniteTxMultiThreadedAbstractTest extends IgniteTxAbstract
      * @throws Exception If failed.
      */
     public void testOptimisticSerializableConsistency() throws Exception {
-        final IgniteCache<Integer, Long> cache = grid(0).cache(null);
+        final IgniteCache<Integer, Long> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         final int THREADS = 3;
 
@@ -310,7 +310,7 @@ public abstract class IgniteTxMultiThreadedAbstractTest extends IgniteTxAbstract
             }
 
             for (int i = 0; i < gridCount(); i++)
-                assertEquals(total, grid(i).cache(null).get(key));
+                assertEquals(total, grid(i).cache(DEFAULT_CACHE_NAME).get(key));
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxReentryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxReentryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxReentryAbstractSelfTest.java
index 74555d2..39066a2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxReentryAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxReentryAbstractSelfTest.java
@@ -102,7 +102,7 @@ public abstract class IgniteTxReentryAbstractSelfTest extends GridCommonAbstract
         startGridsMultiThreaded(gridCount(), true);
 
         try {
-            IgniteCache<Object, Object> cache = grid(0).cache(null);
+            IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             // Find test key.
             int key = testKey();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java
index 47471f9..872fe77 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxStoreExceptionAbstractSelfTest.java
@@ -302,7 +302,7 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb
 
         info("Test transaction [concurrency=" + concurrency + ", isolation=" + isolation + ']');
 
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         if (putBefore) {
             store.forceFail(false);
@@ -325,7 +325,7 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb
         // Execute get from all nodes to create readers for near cache.
         for (int i = 0; i < gridCount(); i++) {
             for (Integer key : keys)
-                grid(i).cache(null).get(key);
+                grid(i).cache(DEFAULT_CACHE_NAME).get(key);
         }
 
         store.forceFail(true);
@@ -368,7 +368,7 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb
         for (int i = 0; i < gridCount(); i++) {
             IgniteKernal grid = (IgniteKernal)grid(i);
 
-            GridCacheAdapter cache = grid.internalCache(null);
+            GridCacheAdapter cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
             GridCacheMapEntry entry = cache.map().getEntry(cache.context().toCacheKeyObject(key));
 
@@ -398,7 +398,7 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb
         }
 
         for (int i = 0; i < gridCount(); i++)
-            assertEquals("Unexpected value for grid " + i, putBefore ? 1 : null, grid(i).cache(null).get(key));
+            assertEquals("Unexpected value for grid " + i, putBefore ? 1 : null, grid(i).cache(DEFAULT_CACHE_NAME).get(key));
     }
 
     /**
@@ -412,12 +412,12 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb
 
             info("Put key: " + key);
 
-            grid(0).cache(null).put(key, 1);
+            grid(0).cache(DEFAULT_CACHE_NAME).put(key, 1);
         }
 
         // Execute get from all nodes to create readers for near cache.
         for (int i = 0; i < gridCount(); i++)
-            grid(i).cache(null).get(key);
+            grid(i).cache(DEFAULT_CACHE_NAME).get(key);
 
         store.forceFail(true);
 
@@ -425,7 +425,7 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb
 
         GridTestUtils.assertThrows(log, new Callable<Void>() {
             @Override public Void call() throws Exception {
-                grid(0).cache(null).put(key, 2);
+                grid(0).cache(DEFAULT_CACHE_NAME).put(key, 2);
 
                 return null;
             }
@@ -445,12 +445,12 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb
 
             info("Put key: " + key);
 
-            grid(0).cache(null).put(key, 1);
+            grid(0).cache(DEFAULT_CACHE_NAME).put(key, 1);
         }
 
         // Execute get from all nodes to create readers for near cache.
         for (int i = 0; i < gridCount(); i++)
-            grid(i).cache(null).get(key);
+            grid(i).cache(DEFAULT_CACHE_NAME).get(key);
 
         store.forceFail(true);
 
@@ -458,7 +458,7 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb
 
         Throwable e = GridTestUtils.assertThrows(log, new Callable<Void>() {
             @Override public Void call() throws Exception {
-                grid(0).<Integer, Integer>cache(null).invoke(key, new EntryProcessor<Integer, Integer, Void>() {
+                grid(0).<Integer, Integer>cache(DEFAULT_CACHE_NAME).invoke(key, new EntryProcessor<Integer, Integer, Void>() {
                     @Override public Void process(MutableEntry<Integer, Integer> e, Object... args) {
                         e.setValue(2);
 
@@ -493,13 +493,13 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb
 
             info("Put data: " + m);
 
-            grid(0).cache(null).putAll(m);
+            grid(0).cache(DEFAULT_CACHE_NAME).putAll(m);
         }
 
         // Execute get from all nodes to create readers for near cache.
         for (int i = 0; i < gridCount(); i++) {
             for (Integer key : keys)
-                grid(i).cache(null).get(key);
+                grid(i).cache(DEFAULT_CACHE_NAME).get(key);
         }
 
         store.forceFail(true);
@@ -513,7 +513,7 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb
 
         GridTestUtils.assertThrows(log, new Callable<Void>() {
             @Override public Void call() throws Exception {
-                grid(0).cache(null).putAll(m);
+                grid(0).cache(DEFAULT_CACHE_NAME).putAll(m);
 
                 return null;
             }
@@ -534,12 +534,12 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb
 
             info("Put key: " + key);
 
-            grid(0).cache(null).put(key, 1);
+            grid(0).cache(DEFAULT_CACHE_NAME).put(key, 1);
         }
 
         // Execute get from all nodes to create readers for near cache.
         for (int i = 0; i < gridCount(); i++)
-            grid(i).cache(null).get(key);
+            grid(i).cache(DEFAULT_CACHE_NAME).get(key);
 
         store.forceFail(true);
 
@@ -547,7 +547,7 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb
 
         GridTestUtils.assertThrows(log, new Callable<Void>() {
             @Override public Void call() throws Exception {
-                grid(0).cache(null).remove(key);
+                grid(0).cache(DEFAULT_CACHE_NAME).remove(key);
 
                 return null;
             }
@@ -564,7 +564,7 @@ public abstract class IgniteTxStoreExceptionAbstractSelfTest extends GridCacheAb
      * @return Key.
      */
     private Integer keyForNode(ClusterNode node, int type) {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         if (cache.getConfiguration(CacheConfiguration.class).getCacheMode() == LOCAL)
             return ++lastKey;


[40/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytesPreloadingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytesPreloadingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytesPreloadingSelfTest.java
index 44adc84..e32d8aa 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytesPreloadingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueBytesPreloadingSelfTest.java
@@ -46,7 +46,7 @@ public class GridCacheValueBytesPreloadingSelfTest extends GridCommonAbstractTes
      * @throws Exception If failed.
      */
     protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -81,27 +81,27 @@ public class GridCacheValueBytesPreloadingSelfTest extends GridCommonAbstractTes
         byte[] val = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
 
         for (int i = 0; i < keyCnt; i++)
-            grid(0).cache(null).put(String.valueOf(i), val);
+            grid(0).cache(DEFAULT_CACHE_NAME).put(String.valueOf(i), val);
 
         for (int i = 0; i < keyCnt; i++)
-            grid(0).cache(null).get(String.valueOf(i));
+            grid(0).cache(DEFAULT_CACHE_NAME).get(String.valueOf(i));
 
         startGrid(1);
 
 // TODO: GG-11148 check if evict/promote make sense.
 //        if (memMode == ONHEAP_TIERED) {
 //            for (int i = 0; i < keyCnt; i++)
-//                grid(0).cache(null).localEvict(Collections.<Object>singleton(String.valueOf(i)));
+//                grid(0).cache(DEFAULT_CACHE_NAME).localEvict(Collections.<Object>singleton(String.valueOf(i)));
 //
 //            for (int i = 0; i < keyCnt; i++)
-//                grid(0).cache(null).localPromote(Collections.singleton(String.valueOf(i)));
+//                grid(0).cache(DEFAULT_CACHE_NAME).localPromote(Collections.singleton(String.valueOf(i)));
 //        }
 
         startGrid(2);
 
         for (int g = 0; g < 3; g++) {
             for (int i = 0; i < keyCnt; i++) {
-                byte[] o = (byte[])grid(g).cache(null).get(String.valueOf(i));
+                byte[] o = (byte[])grid(g).cache(DEFAULT_CACHE_NAME).get(String.valueOf(i));
 
                 assertTrue("Got invalid value [val=" + Arrays.toString(val) + ", actual=" + Arrays.toString(o) + ']',
                     Arrays.equals(val, o));

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java
index 8de9748..3c5fe0e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheValueConsistencyAbstractSelfTest.java
@@ -115,7 +115,7 @@ public abstract class GridCacheValueConsistencyAbstractSelfTest extends GridCach
             for (int i = 0; i < keyCnt; i++) {
                 String key = "key" + i;
 
-                if (ignite(0).affinity(null).mapKeyToPrimaryAndBackups(key).contains(locNode)) {
+                if (ignite(0).affinity(DEFAULT_CACHE_NAME).mapKeyToPrimaryAndBackups(key).contains(locNode)) {
                     info("Node is reported as affinity node for key [key=" + key + ", nodeId=" + locNode.id() + ']');
 
                     assertEquals((Integer)i, cache0.localPeek(key));
@@ -175,7 +175,7 @@ public abstract class GridCacheValueConsistencyAbstractSelfTest extends GridCach
             for (int i = 0; i < keyCnt; i++) {
                 String key = "key" + i;
 
-                if (ignite(0).affinity(null).mapKeyToPrimaryAndBackups(key).contains(grid(g).localNode())) {
+                if (ignite(0).affinity(DEFAULT_CACHE_NAME).mapKeyToPrimaryAndBackups(key).contains(grid(g).localNode())) {
                     info("Node is reported as affinity node for key [key=" + key + ", nodeId=" + locNode.id() + ']');
 
                     assertEquals((Integer)i, cache0.localPeek(key));
@@ -240,7 +240,7 @@ public abstract class GridCacheValueConsistencyAbstractSelfTest extends GridCach
 
                     Ignite ignite = grid(g);
 
-                    IgniteCache<Object, Object> cache = ignite.cache(null);
+                    IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                     log.info("Update thread: " + ignite.name());
 
@@ -305,7 +305,7 @@ public abstract class GridCacheValueConsistencyAbstractSelfTest extends GridCach
 
                     Ignite ignite = grid(g);
 
-                    IgniteCache<Object, Object> cache = ignite.cache(null);
+                    IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                     int k = rnd.nextInt(range);
 
@@ -334,7 +334,7 @@ public abstract class GridCacheValueConsistencyAbstractSelfTest extends GridCach
         int present = 0;
         int absent = 0;
 
-        Affinity<Integer> aff = ignite(0).affinity(null);
+        Affinity<Integer> aff = ignite(0).affinity(DEFAULT_CACHE_NAME);
 
         boolean invalidVal = false;
 
@@ -344,7 +344,7 @@ public abstract class GridCacheValueConsistencyAbstractSelfTest extends GridCach
             for (int g = 0; g < gridCount(); g++) {
                 Ignite ignite = grid(g);
 
-                Long val = (Long)ignite.cache(null).localPeek(i);
+                Long val = (Long)ignite.cache(DEFAULT_CACHE_NAME).localPeek(i);
 
                 if (firstVal == null && val != null)
                     firstVal = val;
@@ -397,7 +397,7 @@ public abstract class GridCacheValueConsistencyAbstractSelfTest extends GridCach
             boolean primary = aff.isPrimary(ignite.cluster().localNode(), key);
             boolean backup = aff.isBackup(ignite.cluster().localNode(), key);
 
-            Object val = ignite.cache(null).localPeek(key);
+            Object val = ignite.cache(DEFAULT_CACHE_NAME).localPeek(key);
 
             log.error("Node value [key=" + key +
                 ", val=" + val +

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
index abb1464..25817a1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVariableTopologySelfTest.java
@@ -130,7 +130,7 @@ public class GridCacheVariableTopologySelfTest extends GridCommonAbstractTest {
             @SuppressWarnings({"BusyWait"})
             @Override public void applyx() {
                 while (cnt++ < txCnt && !done.get()) {
-                    IgniteCache<Object, Object> cache = grid(0).cache(null);
+                    IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
                     if (cnt % logMod == 0)
                         info("Starting transaction: " + cnt);
@@ -177,7 +177,7 @@ public class GridCacheVariableTopologySelfTest extends GridCommonAbstractTest {
         GridFuture<?> debugFut = GridTestUtils.runMultiThreadedAsync(new Runnable() {
             @SuppressWarnings({"UnusedDeclaration"})
             @Override public void run() {
-                Cache<Object, Object> cache = ((IgniteKernal)grid(0)).cache(null);
+                Cache<Object, Object> cache = ((IgniteKernal)grid(0)).cache(DEFAULT_CACHE_NAME);
 
                 try {
                     Thread.sleep(15000);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java
index 1d602c9..0fd3fb9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionMultinodeTest.java
@@ -192,7 +192,7 @@ public class GridCacheVersionMultinodeTest extends GridCacheAbstractSelfTest {
         for (int i = 0; i < gridCount(); i++) {
             IgniteKernal grid = (IgniteKernal)grid(i);
 
-            GridCacheAdapter<Object, Object> cache = grid.context().cache().internalCache();
+            GridCacheAdapter<Object, Object> cache = grid.context().cache().internalCache(DEFAULT_CACHE_NAME);
 
             GridCacheEntryEx e;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java
index 9101fc7..85963d2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheVersionTopologyChangeTest.java
@@ -226,7 +226,7 @@ public class GridCacheVersionTopologyChangeTest extends GridCommonAbstractTest {
         CacheAtomicityMode atomicityMode,
         AffinityFunction aff,
         int backups) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setBackups(backups);
         ccfg.setName(name);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridProjectionForCachesOnDaemonNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridProjectionForCachesOnDaemonNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridProjectionForCachesOnDaemonNodeSelfTest.java
index 382e8c9..1e26fd2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridProjectionForCachesOnDaemonNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridProjectionForCachesOnDaemonNodeSelfTest.java
@@ -83,24 +83,24 @@ public class GridProjectionForCachesOnDaemonNodeSelfTest extends GridCommonAbstr
 
     /** {@inheritDoc} */
     protected void beforeTest() throws Exception {
-        ignite.getOrCreateCache((String)null);
+        ignite.getOrCreateCache(DEFAULT_CACHE_NAME);
     }
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-        ignite.cache(null).destroy();
+        ignite.cache(DEFAULT_CACHE_NAME).destroy();
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testForDataNodes() throws Exception {
-        ClusterGroup grp = ignite.cluster().forDataNodes(null);
+        ClusterGroup grp = ignite.cluster().forDataNodes(DEFAULT_CACHE_NAME);
 
         assertFalse(grp.nodes().isEmpty());
 
         try {
-            daemon.cluster().forDataNodes(null);
+            daemon.cluster().forDataNodes(DEFAULT_CACHE_NAME);
         }
         catch (IllegalStateException ignored) {
             return;
@@ -113,12 +113,12 @@ public class GridProjectionForCachesOnDaemonNodeSelfTest extends GridCommonAbstr
      * @throws Exception If failed.
      */
     public void testForClientNodes() throws Exception {
-        ClusterGroup grp = ignite.cluster().forClientNodes(null);
+        ClusterGroup grp = ignite.cluster().forClientNodes(DEFAULT_CACHE_NAME);
 
         assertTrue(grp.nodes().isEmpty());
 
         try {
-            daemon.cluster().forClientNodes(null);
+            daemon.cluster().forClientNodes(DEFAULT_CACHE_NAME);
         }
         catch (IllegalStateException ignored) {
             return;
@@ -131,12 +131,12 @@ public class GridProjectionForCachesOnDaemonNodeSelfTest extends GridCommonAbstr
      * @throws Exception If failed.
      */
     public void testForCacheNodes() throws Exception {
-        ClusterGroup grp = ignite.cluster().forCacheNodes(null);
+        ClusterGroup grp = ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME);
 
         assertFalse(grp.nodes().isEmpty());
 
         try {
-            daemon.cluster().forCacheNodes(null);
+            daemon.cluster().forCacheNodes(DEFAULT_CACHE_NAME);
         }
         catch (IllegalStateException ignored) {
             return;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java
index dc357f1..257ca77 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractStopBusySelfTest.java
@@ -51,6 +51,7 @@ 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.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
@@ -357,7 +358,7 @@ public abstract class IgniteCacheAbstractStopBusySelfTest extends GridCommonAbst
      * @throws Exception In case of error.
      */
     @SuppressWarnings("unchecked")
-    private CacheConfiguration cacheConfiguration(@Nullable String cacheName) throws Exception {
+    private CacheConfiguration cacheConfiguration(@NotNull String cacheName) throws Exception {
         CacheConfiguration cfg = defaultCacheConfiguration();
 
         cfg.setCacheMode(cacheMode());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
index 5133f61..c5cb715 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
@@ -216,7 +216,7 @@ public abstract class IgniteCacheAbstractTest extends GridCommonAbstractTest {
      * @return Cache.
      */
     protected <K, V> IgniteCache<K, V> jcache(int idx) {
-        return grid(idx).cache(null);
+        return grid(idx).cache(DEFAULT_CACHE_NAME);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryEntryProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryEntryProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryEntryProcessorSelfTest.java
index 17895c5..5aef9a8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryEntryProcessorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheBinaryEntryProcessorSelfTest.java
@@ -82,7 +82,7 @@ public class IgniteCacheBinaryEntryProcessorSelfTest extends GridCommonAbstractT
      * @return Cache configuration.
      */
     private CacheConfiguration<Integer, TestValue> cacheConfiguration(CacheMode cacheMode, CacheAtomicityMode atomicityMode) {
-        CacheConfiguration<Integer, TestValue> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, TestValue> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(cacheMode);
         ccfg.setAtomicityMode(atomicityMode);
@@ -152,7 +152,7 @@ public class IgniteCacheBinaryEntryProcessorSelfTest extends GridCommonAbstractT
             }
 
             for (int g = 0; g < NODES; g++) {
-                IgniteCache<Integer, TestValue> nodeCache = ignite(g).cache(null);
+                IgniteCache<Integer, TestValue> nodeCache = ignite(g).cache(DEFAULT_CACHE_NAME);
                 IgniteCache<Integer, BinaryObject> nodeBinaryCache = nodeCache.withKeepBinary();
 
                 for (int i = 0; i < 100; i++) {
@@ -172,7 +172,7 @@ public class IgniteCacheBinaryEntryProcessorSelfTest extends GridCommonAbstractT
             }
         }
         finally {
-            client.destroyCache(null);
+            client.destroyCache(DEFAULT_CACHE_NAME);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationDefaultTemplateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationDefaultTemplateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationDefaultTemplateTest.java
index b5ca684..c1af11e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationDefaultTemplateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationDefaultTemplateTest.java
@@ -39,7 +39,7 @@ public class IgniteCacheConfigurationDefaultTemplateTest extends GridCommonAbstr
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
 
-        CacheConfiguration templateCfg = new CacheConfiguration();
+        CacheConfiguration templateCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         templateCfg.setName("org.apache.ignite.template*");
         templateCfg.setBackups(3);
@@ -66,11 +66,11 @@ public class IgniteCacheConfigurationDefaultTemplateTest extends GridCommonAbstr
 
         checkDefaultTemplate(ignite, "org.apache.ignite.templat");
 
-        checkDefaultTemplate(ignite, null);
+        checkDefaultTemplate(ignite, DEFAULT_CACHE_NAME);
 
         checkGetOrCreate(ignite, "org.apache.ignite.template", 3);
 
-        CacheConfiguration templateCfg = new CacheConfiguration();
+        CacheConfiguration templateCfg = new CacheConfiguration("*");
 
         templateCfg.setBackups(4);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationTemplateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationTemplateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationTemplateTest.java
index ff0a764..cad629d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationTemplateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationTemplateTest.java
@@ -67,17 +67,17 @@ public class IgniteCacheConfigurationTemplateTest extends GridCommonAbstractTest
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder).setForceServerMode(true);
 
         if (addTemplate) {
-            CacheConfiguration dfltCfg = new CacheConfiguration();
+            CacheConfiguration dfltCfg = new CacheConfiguration("*");
 
             dfltCfg.setAtomicityMode(TRANSACTIONAL);
             dfltCfg.setBackups(2);
 
-            CacheConfiguration templateCfg1 = new CacheConfiguration();
+            CacheConfiguration templateCfg1 = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             templateCfg1.setName(TEMPLATE1);
             templateCfg1.setBackups(3);
 
-            CacheConfiguration templateCfg2 = new CacheConfiguration();
+            CacheConfiguration templateCfg2 = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             templateCfg2.setName(TEMPLATE2);
             templateCfg2.setBackups(4);
@@ -133,7 +133,7 @@ public class IgniteCacheConfigurationTemplateTest extends GridCommonAbstractTest
         assertNotNull(ignite2.cache("org.apache.ignite1"));
         assertNotNull(ignite2.cache("org.apache1"));
 
-        CacheConfiguration template1 = new CacheConfiguration();
+        CacheConfiguration template1 = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         template1.setName(TEMPLATE3);
         template1.setBackups(5);
@@ -199,7 +199,7 @@ public class IgniteCacheConfigurationTemplateTest extends GridCommonAbstractTest
         checkGetOrCreate(ignite2, "org.apache.ignite.cache2", 3);
         checkGetOrCreate(ignite2, "org.apache2", 2);
 
-        CacheConfiguration template1 = new CacheConfiguration();
+        CacheConfiguration template1 = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         template1.setName(TEMPLATE3);
         template1.setBackups(5);
@@ -217,7 +217,7 @@ public class IgniteCacheConfigurationTemplateTest extends GridCommonAbstractTest
         checkNoTemplateCaches(4);
 
         // Template with non-wildcard name.
-        CacheConfiguration template2 = new CacheConfiguration();
+        CacheConfiguration template2 = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         template2.setName("org.apache.ignite");
         template2.setBackups(6);
@@ -228,19 +228,6 @@ public class IgniteCacheConfigurationTemplateTest extends GridCommonAbstractTest
         checkGetOrCreate(ignite1, "org.apache.ignite", 6);
         checkGetOrCreate(ignite2, "org.apache.ignite", 6);
         checkGetOrCreate(ignite3, "org.apache.ignite", 6);
-
-        // Test name '*'.
-        CacheConfiguration template3 = new CacheConfiguration();
-
-        template3.setName("*");
-        template3.setBackups(7);
-
-        ignite1.addCacheConfiguration(template3);
-
-        checkGetOrCreate(ignite0, "x", 7);
-        checkGetOrCreate(ignite1, "x", 7);
-        checkGetOrCreate(ignite2, "x", 7);
-        checkGetOrCreate(ignite3, "x", 7);
     }
 
     /**
@@ -294,7 +281,7 @@ public class IgniteCacheConfigurationTemplateTest extends GridCommonAbstractTest
 
                     log.info("Add configuration using node: " + ignite.name());
 
-                    CacheConfiguration cfg = new CacheConfiguration();
+                    CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
                     cfg.setName("org.apache.ignite" + iter + "*");
 
@@ -345,7 +332,7 @@ public class IgniteCacheConfigurationTemplateTest extends GridCommonAbstractTest
         for (int i = 0; i < GRID_CNT; i++) {
             Ignite ignite = ignite(i);
 
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             ccfg.setName("cfg-" + i);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java
index d070ac7..bba779f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCopyOnReadDisabledAbstractTest.java
@@ -47,7 +47,7 @@ public abstract class IgniteCacheCopyOnReadDisabledAbstractTest extends GridCach
      * @throws Exception If failed.
      */
     public void testCopyOnReadDisabled() throws Exception {
-        IgniteCache<TestKey, TestValue> cache = ignite(0).cache(null);
+        IgniteCache<TestKey, TestValue> cache = ignite(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < 100; i++) {
             TestKey key = new TestKey(i);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDynamicStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDynamicStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDynamicStopSelfTest.java
index c92ea9e..5628c4d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDynamicStopSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDynamicStopSelfTest.java
@@ -67,7 +67,7 @@ public class IgniteCacheDynamicStopSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void checkStopStartCacheWithDataLoader(final boolean allowOverwrite) throws Exception {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(CacheMode.PARTITIONED);
 
@@ -79,7 +79,7 @@ public class IgniteCacheDynamicStopSelfTest extends GridCommonAbstractTest {
             /** {@inheritDoc} */
             @Override public Object call() throws Exception {
                 while (!stop.get()) {
-                    try (IgniteDataStreamer<Integer, Integer> str = ignite(0).dataStreamer(null)) {
+                    try (IgniteDataStreamer<Integer, Integer> str = ignite(0).dataStreamer(DEFAULT_CACHE_NAME)) {
                         str.allowOverwrite(allowOverwrite);
 
                         int i = 0;
@@ -119,7 +119,7 @@ public class IgniteCacheDynamicStopSelfTest extends GridCommonAbstractTest {
         try {
             Thread.sleep(500);
 
-            ignite(0).destroyCache(null);
+            ignite(0).destroyCache(DEFAULT_CACHE_NAME);
 
             Thread.sleep(500);
 
@@ -135,11 +135,11 @@ public class IgniteCacheDynamicStopSelfTest extends GridCommonAbstractTest {
 
         int cnt = 0;
 
-        for (Cache.Entry<Object, Object> ignored : ignite(0).cache(null))
+        for (Cache.Entry<Object, Object> ignored : ignite(0).cache(DEFAULT_CACHE_NAME))
             cnt++;
 
         info(">>> cnt=" + cnt);
 
-        ignite(0).destroyCache(null);
+        ignite(0).destroyCache(DEFAULT_CACHE_NAME);
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
index ef2f156..bcf46fd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerAbstractTest.java
@@ -369,7 +369,7 @@ public abstract class IgniteCacheEntryListenerAbstractTest extends IgniteCacheAb
 
             Map<Integer, Integer> vals = new HashMap<>();
 
-            for (Integer key : nearKeys(grid.cache(null), 100, 1_000_000))
+            for (Integer key : nearKeys(grid.cache(DEFAULT_CACHE_NAME), 100, 1_000_000))
                 vals.put(key, 1);
 
             final AtomicBoolean done = new AtomicBoolean();
@@ -633,7 +633,7 @@ public abstract class IgniteCacheEntryListenerAbstractTest extends IgniteCacheAb
         try {
             awaitPartitionMapExchange();
 
-            IgniteCache<Object, Object> cache = grid.cache(null);
+            IgniteCache<Object, Object> cache = grid.cache(DEFAULT_CACHE_NAME);
 
             Integer key = Integer.MAX_VALUE;
 
@@ -657,7 +657,7 @@ public abstract class IgniteCacheEntryListenerAbstractTest extends IgniteCacheAb
         try {
             awaitPartitionMapExchange();
 
-            IgniteCache<Object, Object> cache = grid.cache(null);
+            IgniteCache<Object, Object> cache = grid.cache(DEFAULT_CACHE_NAME);
 
             log.info("Check filter for listener in configuration.");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerExpiredEventsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerExpiredEventsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerExpiredEventsTest.java
index c0e1a76..c767188 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerExpiredEventsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryListenerExpiredEventsTest.java
@@ -145,7 +145,7 @@ public class IgniteCacheEntryListenerExpiredEventsTest extends GridCommonAbstrac
     private CacheConfiguration<Object, Object> cacheConfiguration(
         CacheMode cacheMode,
         CacheAtomicityMode atomicityMode) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorCallTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorCallTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorCallTest.java
index 9a84473..cd4a78f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorCallTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorCallTest.java
@@ -108,7 +108,7 @@ public class IgniteCacheEntryProcessorCallTest extends GridCommonAbstractTest {
      */
     public void testEntryProcessorCall() throws Exception {
         {
-            CacheConfiguration<Integer, TestValue> ccfg = new CacheConfiguration<>();
+            CacheConfiguration<Integer, TestValue> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
             ccfg.setBackups(1);
             ccfg.setWriteSynchronizationMode(FULL_SYNC);
             ccfg.setAtomicityMode(ATOMIC);
@@ -117,7 +117,7 @@ public class IgniteCacheEntryProcessorCallTest extends GridCommonAbstractTest {
         }
 
         {
-            CacheConfiguration<Integer, TestValue> ccfg = new CacheConfiguration<>();
+            CacheConfiguration<Integer, TestValue> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
             ccfg.setBackups(0);
             ccfg.setWriteSynchronizationMode(FULL_SYNC);
             ccfg.setAtomicityMode(ATOMIC);
@@ -126,7 +126,7 @@ public class IgniteCacheEntryProcessorCallTest extends GridCommonAbstractTest {
         }
 
         {
-            CacheConfiguration<Integer, TestValue> ccfg = new CacheConfiguration<>();
+            CacheConfiguration<Integer, TestValue> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
             ccfg.setBackups(1);
             ccfg.setWriteSynchronizationMode(FULL_SYNC);
             ccfg.setAtomicityMode(TRANSACTIONAL);
@@ -135,7 +135,7 @@ public class IgniteCacheEntryProcessorCallTest extends GridCommonAbstractTest {
         }
 
         {
-            CacheConfiguration<Integer, TestValue> ccfg = new CacheConfiguration<>();
+            CacheConfiguration<Integer, TestValue> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
             ccfg.setBackups(0);
             ccfg.setWriteSynchronizationMode(FULL_SYNC);
             ccfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java
index e21353d..ec98294 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheEntryProcessorNodeJoinTest.java
@@ -91,7 +91,7 @@ public class IgniteCacheEntryProcessorNodeJoinTest extends GridCommonAbstractTes
      * @return Cache configuration.
      */
     private CacheConfiguration cacheConfiguration() {
-        CacheConfiguration cache = new CacheConfiguration();
+        CacheConfiguration cache = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cache.setCacheMode(PARTITIONED);
         cache.setAtomicityMode(atomicityMode());
@@ -142,7 +142,7 @@ public class IgniteCacheEntryProcessorNodeJoinTest extends GridCommonAbstractTes
         // TODO: IGNITE-1525 (test fails with one-phase commit).
         boolean createCache = atomicityMode() == TRANSACTIONAL;
 
-        String cacheName = null;
+        String cacheName = DEFAULT_CACHE_NAME;
 
         if (createCache) {
             CacheConfiguration ccfg = cacheConfiguration();
@@ -229,7 +229,7 @@ public class IgniteCacheEntryProcessorNodeJoinTest extends GridCommonAbstractTes
             }, 1, "starter");
 
             try {
-                checkIncrement(null, invokeAll, null, null);
+                checkIncrement(DEFAULT_CACHE_NAME, invokeAll, null, null);
             }
             finally {
                 stop.set(true);
@@ -239,7 +239,7 @@ public class IgniteCacheEntryProcessorNodeJoinTest extends GridCommonAbstractTes
 
             for (int i = 0; i < KEYS; i++) {
                 for (int g = 0; g < GRID_CNT + started; g++) {
-                    Set<String> vals = ignite(g).<String, Set<String>>cache(null).get("set-" + i);
+                    Set<String> vals = ignite(g).<String, Set<String>>cache(DEFAULT_CACHE_NAME).get("set-" + i);
 
                     assertNotNull(vals);
                     assertEquals(INCREMENTS, vals.size());
@@ -333,7 +333,7 @@ public class IgniteCacheEntryProcessorNodeJoinTest extends GridCommonAbstractTes
             final AtomicBoolean done = new AtomicBoolean(false);
 
             for (int i = 0; i < keys; i++)
-                ignite(0).cache(null).put(i, 0);
+                ignite(0).cache(DEFAULT_CACHE_NAME).put(i, 0);
 
             IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Runnable() {
                 @Override public void run() {
@@ -363,7 +363,7 @@ public class IgniteCacheEntryProcessorNodeJoinTest extends GridCommonAbstractTes
 
                     for (int i = 0; i < keys; i++)
                         assertTrue("Failed [key=" + i + ", oldVal=" + updVal+ ']',
-                            ignite(0).cache(null).replace(i, updVal, updVal + 1));
+                            ignite(0).cache(DEFAULT_CACHE_NAME).replace(i, updVal, updVal + 1));
 
                     updVal++;
                 }
@@ -374,9 +374,9 @@ public class IgniteCacheEntryProcessorNodeJoinTest extends GridCommonAbstractTes
 
             for (int i = 0; i < keys; i++) {
                 for (int g = 0; g < GRID_CNT + started; g++) {
-                    Integer val = ignite(g).<Integer, Integer>cache(null).get(i);
+                    Integer val = ignite(g).<Integer, Integer>cache(DEFAULT_CACHE_NAME).get(i);
 
-                    GridCacheEntryEx entry = ((IgniteKernal)grid(g)).internalCache(null).peekEx(i);
+                    GridCacheEntryEx entry = ((IgniteKernal)grid(g)).internalCache(DEFAULT_CACHE_NAME).peekEx(i);
 
                     if (updVal != val)
                         info("Invalid value for grid [g=" + g + ", entry=" + entry + ']');

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheExpireAndUpdateConsistencyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheExpireAndUpdateConsistencyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheExpireAndUpdateConsistencyTest.java
index 18570a6..bd8d44e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheExpireAndUpdateConsistencyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheExpireAndUpdateConsistencyTest.java
@@ -334,7 +334,7 @@ public class IgniteCacheExpireAndUpdateConsistencyTest extends GridCommonAbstrac
      * @return Cache configuration.
      */
     private CacheConfiguration<TestKey, TestValue> cacheConfiguration(CacheAtomicityMode atomicityMode, int backups) {
-        CacheConfiguration<TestKey, TestValue> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<TestKey, TestValue> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(atomicityMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGetCustomCollectionsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGetCustomCollectionsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGetCustomCollectionsSelfTest.java
index 3263024..9e6fd5a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGetCustomCollectionsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheGetCustomCollectionsSelfTest.java
@@ -46,7 +46,7 @@ public class IgniteCacheGetCustomCollectionsSelfTest extends GridCommonAbstractT
 
         cfg.setMarshaller(null);
 
-        final CacheConfiguration<String, MyMap> mapCacheConfig = new CacheConfiguration<>();
+        final CacheConfiguration<String, MyMap> mapCacheConfig = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         mapCacheConfig.setCacheMode(CacheMode.PARTITIONED);
         mapCacheConfig.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheIncrementTxTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheIncrementTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheIncrementTxTest.java
index d7e05f7..f6341ec 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheIncrementTxTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheIncrementTxTest.java
@@ -132,7 +132,7 @@ public class IgniteCacheIncrementTxTest extends GridCommonAbstractTest {
 
                     Ignite ignite = startGrid(node);
 
-                    IgniteCache<Integer, Integer> cache = ignite.cache(null);
+                    IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                     for (int i = 0; i < 1000; i++)
                         incrementTx(ignite, cache, incMap);
@@ -172,7 +172,7 @@ public class IgniteCacheIncrementTxTest extends GridCommonAbstractTest {
                     checkCache(NODES + START_NODES - (i + 1), incMap);
 
                     for (int n = 0; n < SRVS; n++)
-                        ignite(n).cache(null).rebalance().get();
+                        ignite(n).cache(DEFAULT_CACHE_NAME).rebalance().get();
                 }
             }
             else {
@@ -201,7 +201,7 @@ public class IgniteCacheIncrementTxTest extends GridCommonAbstractTest {
         assertEquals(expNodes, nodes.size());
 
         for (Ignite node : nodes) {
-            IgniteCache<Integer, Integer> cache = node.cache(null);
+            IgniteCache<Integer, Integer> cache = node.cache(DEFAULT_CACHE_NAME);
 
             for (Map.Entry<Integer, AtomicInteger> e : incMap.entrySet())
                 assertEquals((Integer)e.getValue().get(), cache.get(e.getKey()));
@@ -227,7 +227,7 @@ public class IgniteCacheIncrementTxTest extends GridCommonAbstractTest {
 
                 Thread.currentThread().setName("update-" + ignite.name());
 
-                IgniteCache<Integer, Integer> cache = ignite.cache(null);
+                IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                 while (!fut.isDone())
                     incrementTx(ignite, cache, incMap);
@@ -288,7 +288,7 @@ public class IgniteCacheIncrementTxTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     private CacheConfiguration cacheConfiguration(int backups) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(TRANSACTIONAL);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
index a476a3b..b8fc800 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeAbstractTest.java
@@ -541,7 +541,7 @@ public abstract class IgniteCacheInvokeAbstractTest extends IgniteCacheAbstractT
                 Object val = cache.localPeek(key);
 
                 if (val == null)
-                    assertFalse(ignite(0).affinity(null).isPrimaryOrBackup(ignite(i).cluster().localNode(), key));
+                    assertFalse(ignite(0).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(ignite(i).cluster().localNode(), key));
                 else
                     assertEquals("Unexpected value for grid " + i, expVal, val);
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java
index c74039c..1caf157 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInvokeReadThroughAbstractTest.java
@@ -329,7 +329,7 @@ public abstract class IgniteCacheInvokeReadThroughAbstractTest extends GridCommo
         CacheAtomicityMode atomicityMode,
         int backups,
         boolean nearCache) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setReadThrough(true);
         ccfg.setWriteThrough(true);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLoadRebalanceEvictionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLoadRebalanceEvictionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLoadRebalanceEvictionSelfTest.java
index 3c50043..d545d09 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLoadRebalanceEvictionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLoadRebalanceEvictionSelfTest.java
@@ -73,7 +73,7 @@ public class IgniteCacheLoadRebalanceEvictionSelfTest extends GridCommonAbstract
         LruEvictionPolicy evictionPolicy = new LruEvictionPolicy<>();
         evictionPolicy.setMaxSize(LRU_MAX_SIZE);
 
-        CacheConfiguration<String, byte[]> cacheCfg = new CacheConfiguration<>();
+        CacheConfiguration<String, byte[]> cacheCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         cacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
         cacheCfg.setCacheMode(CacheMode.PARTITIONED);
         cacheCfg.setBackups(1);
@@ -105,7 +105,7 @@ public class IgniteCacheLoadRebalanceEvictionSelfTest extends GridCommonAbstract
 
             futs.add(GridTestUtils.runAsync(new Callable<Object>() {
                 @Override public Object call() throws Exception {
-                    ig.cache(null).localLoadCache(null);
+                    ig.cache(DEFAULT_CACHE_NAME).localLoadCache(null);
 
                     return null;
                 }
@@ -119,7 +119,7 @@ public class IgniteCacheLoadRebalanceEvictionSelfTest extends GridCommonAbstract
             for (int i = 0; i < gridCnt; i++) {
                 IgniteEx grid = grid(i);
 
-                final IgniteCache<Object, Object> cache = grid.cache(null);
+                final IgniteCache<Object, Object> cache = grid.cache(DEFAULT_CACHE_NAME);
 
                 GridTestUtils.waitForCondition(new PA() {
                     @Override public boolean apply() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java
index 76667c5..ca9d15b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheManyAsyncOperationsTest.java
@@ -74,7 +74,7 @@ public class IgniteCacheManyAsyncOperationsTest extends IgniteCacheAbstractTest
         try (Ignite client = startGrid(gridCount())) {
             assertTrue(client.configuration().isClientMode());
 
-            IgniteCache<Object, Object> cache = client.cache(null);
+            IgniteCache<Object, Object> cache = client.cache(DEFAULT_CACHE_NAME);
 
             final int ASYNC_OPS = cache.getConfiguration(CacheConfiguration.class).getMaxConcurrentAsyncOperations();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheObjectPutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheObjectPutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheObjectPutSelfTest.java
index 83c278f..11e81c2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheObjectPutSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheObjectPutSelfTest.java
@@ -37,7 +37,7 @@ public class IgniteCacheObjectPutSelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(CACHE_NAME);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingRebalanceErrorTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingRebalanceErrorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingRebalanceErrorTest.java
index 40b2cfd..28fc31c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingRebalanceErrorTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheP2pUnmarshallingRebalanceErrorTest.java
@@ -60,9 +60,9 @@ public class IgniteCacheP2pUnmarshallingRebalanceErrorTest extends IgniteCacheP2
 
         startGrid(10); // Custom rebalanceDelay set at cfg.
 
-        Affinity<Object> aff = affinity(grid(10).cache(null));
+        Affinity<Object> aff = affinity(grid(10).cache(DEFAULT_CACHE_NAME));
 
-        GridCacheContext cctx = grid(10).context().cache().cache(null).context();
+        GridCacheContext cctx = grid(10).context().cache().cache(DEFAULT_CACHE_NAME).context();
 
         List<List<ClusterNode>> affAssign =
             cctx.affinity().assignment(cctx.affinity().affinityTopologyVersion()).idealAssignment();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePartitionMapUpdateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePartitionMapUpdateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePartitionMapUpdateTest.java
index a193a07..87549cf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePartitionMapUpdateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePartitionMapUpdateTest.java
@@ -69,14 +69,14 @@ public class IgniteCachePartitionMapUpdateTest extends GridCommonAbstractTest {
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
 
-        CacheConfiguration ccfg1 = new CacheConfiguration();
+        CacheConfiguration ccfg1 = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg1.setName(CACHE1);
         ccfg1.setCacheMode(PARTITIONED);
         ccfg1.setBackups(1);
         ccfg1.setNodeFilter(new AttributeFilter(CACHE1_ATTR));
 
-        CacheConfiguration ccfg2 = new CacheConfiguration();
+        CacheConfiguration ccfg2 = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg2.setName(CACHE2);
         ccfg2.setCacheMode(PARTITIONED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
index 8681be2..81c0799 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePeekModesAbstractTest.java
@@ -189,7 +189,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
                 assertNull(cache0.localPeek(key, BACKUP));
             }
 
-            Affinity<Integer> aff = ignite(0).affinity(null);
+            Affinity<Integer> aff = ignite(0).affinity(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < gridCount(); i++) {
                 if (i == nodeIdx)
@@ -246,7 +246,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
             Ignite ignite = ignite(nodeIdx);
 
             GridCacheAdapter<Integer, String> internalCache =
-                ((IgniteKernal)ignite).context().cache().internalCache();
+                ((IgniteKernal)ignite).context().cache().internalCache(DEFAULT_CACHE_NAME);
 
             CacheObjectContext coctx = internalCache.context().cacheObjectContext();
 
@@ -687,7 +687,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
 
             checkPrimarySize(PUT_KEYS);
 
-            Affinity<Integer> aff = ignite(0).affinity(null);
+            Affinity<Integer> aff = ignite(0).affinity(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < gridCount(); i++) {
                 if (i == nodeIdx)
@@ -761,7 +761,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
                 int partSize = 0;
 
                 for (Integer key : keys){
-                    int keyPart = ignite(nodeIdx).affinity(null).partition(key);
+                    int keyPart = ignite(nodeIdx).affinity(DEFAULT_CACHE_NAME).partition(key);
                     if (keyPart == part)
                         partSize++;
                 }
@@ -791,7 +791,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
                 int partSize = 0;
 
                 for (Integer key :keys){
-                    int keyPart = ignite(nodeIdx).affinity(null).partition(key);
+                    int keyPart = ignite(nodeIdx).affinity(DEFAULT_CACHE_NAME).partition(key);
                     if(keyPart == part)
                         partSize++;
                 }
@@ -831,7 +831,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
 
             checkPrimarySize(PUT_KEYS);
 
-            Affinity<Integer> aff = ignite(0).affinity(null);
+            Affinity<Integer> aff = ignite(0).affinity(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < gridCount(); i++) {
                 if (i == nodeIdx)
@@ -930,14 +930,14 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
 
         assertNotNull(it);
 
-        Affinity aff = ignite(nodeIdx).affinity(null);
+        Affinity aff = ignite(nodeIdx).affinity(DEFAULT_CACHE_NAME);
 
         ClusterNode node = ignite(nodeIdx).cluster().localNode();
 
         List<Integer> primary = new ArrayList<>();
         List<Integer> backups = new ArrayList<>();
 
-        CacheObjectContext coctx = ((IgniteEx)ignite(nodeIdx)).context().cache().internalCache()
+        CacheObjectContext coctx = ((IgniteEx)ignite(nodeIdx)).context().cache().internalCache(DEFAULT_CACHE_NAME)
             .context().cacheObjectContext();
 
         while (it.hasNext()) {
@@ -971,7 +971,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
      */
     private T2<List<Integer>, List<Integer>> offheapKeys(int nodeIdx) {
         GridCacheAdapter<Integer, String> internalCache =
-            ((IgniteKernal)ignite(nodeIdx)).context().cache().internalCache();
+            ((IgniteKernal)ignite(nodeIdx)).context().cache().internalCache(DEFAULT_CACHE_NAME);
 
 // TODO GG-11148.
         Iterator<Map.Entry<Integer, String>> offheapIt = Collections.EMPTY_MAP.entrySet().iterator();
@@ -980,7 +980,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
 //        else
 //            offheapIt = internalCache.context().swap().lazyOffHeapIterator(false);
 
-        Affinity aff = ignite(nodeIdx).affinity(null);
+        Affinity aff = ignite(nodeIdx).affinity(DEFAULT_CACHE_NAME);
 
         ClusterNode node = ignite(nodeIdx).cluster().localNode();
 
@@ -1018,7 +1018,7 @@ public abstract class IgniteCachePeekModesAbstractTest extends IgniteCacheAbstra
      * @return Tuple with number of primary and backup keys (one or both will be zero).
      */
     private T2<Integer, Integer> offheapKeysCount(int nodeIdx, int part) throws IgniteCheckedException {
-        GridCacheContext ctx = ((IgniteEx)ignite(nodeIdx)).context().cache().internalCache().context();
+        GridCacheContext ctx = ((IgniteEx)ignite(nodeIdx)).context().cache().internalCache(DEFAULT_CACHE_NAME).context();
         // Swap and offheap are disabled for near cache.
         IgniteCacheOffheapManager offheapManager = ctx.isNear() ? ctx.near().dht().context().offheap() : ctx.offheap();
         //First count entries...

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java
index 8550e2c..381a044 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheReadThroughStoreCallTest.java
@@ -214,7 +214,7 @@ public class IgniteCacheReadThroughStoreCallTest extends GridCommonAbstractTest
     protected CacheConfiguration<Object, Object> cacheConfiguration(CacheMode cacheMode,
         CacheAtomicityMode atomicityMode,
         int backups) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setReadThrough(true);
         ccfg.setWriteThrough(true);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheScanPredicateDeploymentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheScanPredicateDeploymentSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheScanPredicateDeploymentSelfTest.java
index 0aaff8d..37f0879 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheScanPredicateDeploymentSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheScanPredicateDeploymentSelfTest.java
@@ -93,7 +93,7 @@ public class IgniteCacheScanPredicateDeploymentSelfTest extends GridCommonAbstra
         awaitPartitionMapExchange();
 
         try {
-            IgniteCache<Object, Object> cache = grid(3).cache(null);
+            IgniteCache<Object, Object> cache = grid(3).cache(DEFAULT_CACHE_NAME);
 
             // It is important that there are no too many keys.
             for (int i = 0; i < 1; i++)

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSerializationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSerializationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSerializationSelfTest.java
index 2eba073..06d82e2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSerializationSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSerializationSelfTest.java
@@ -77,7 +77,7 @@ public class IgniteCacheSerializationSelfTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     private CacheConfiguration<Integer, Integer> cacheConfiguration(CacheMode cacheMode, CacheAtomicityMode atomicityMode) {
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(cacheMode);
         ccfg.setAtomicityMode(atomicityMode);
@@ -106,7 +106,7 @@ public class IgniteCacheSerializationSelfTest extends GridCommonAbstractTest {
             });
         }
         finally {
-            client.destroyCache(null);
+            client.destroyCache(DEFAULT_CACHE_NAME);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartStopLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartStopLoadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartStopLoadTest.java
index f80ebc6..7cb9861 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartStopLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStartStopLoadTest.java
@@ -91,7 +91,7 @@ public class IgniteCacheStartStopLoadTest extends GridCommonAbstractTest {
 
             GridTestUtils.runMultiThreaded(new Callable<Object>() {
                 @Override public Object call() throws Exception {
-                    CacheConfiguration ccfg = new CacheConfiguration();
+                    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
                     ccfg.setName(CACHE_NAMES[idx.getAndIncrement()]);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreCollectionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreCollectionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreCollectionTest.java
index f2c55e2..0aa007c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreCollectionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreCollectionTest.java
@@ -47,12 +47,12 @@ public class IgniteCacheStoreCollectionTest extends GridCommonAbstractTest {
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
 
-        CacheConfiguration<Object, Object> ccfg1 = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg1 = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         ccfg1.setName("cache1");
         ccfg1.setAtomicityMode(ATOMIC);
         ccfg1.setWriteSynchronizationMode(FULL_SYNC);
 
-        CacheConfiguration<Object, Object> ccfg2 = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg2 = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         ccfg2.setName("cache2");
         ccfg2.setAtomicityMode(TRANSACTIONAL);
         ccfg2.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java
index 224d1fe..eceb9d2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStoreValueAbstractTest.java
@@ -125,9 +125,9 @@ public abstract class IgniteCacheStoreValueAbstractTest extends IgniteCacheAbstr
 
         startGrids();
 
-        IgniteCache<TestKey, TestValue> cache = grid(0).cache(null);
+        IgniteCache<TestKey, TestValue> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
-        Affinity<Object> aff = grid(0).affinity(null);
+        Affinity<Object> aff = grid(0).affinity(DEFAULT_CACHE_NAME);
 
         final List<WeakReference<Object>> refs = new ArrayList<>();
 
@@ -142,7 +142,7 @@ public abstract class IgniteCacheStoreValueAbstractTest extends IgniteCacheAbstr
             checkNoValue(aff, key);
 
             for (int g = 0; g < gridCount(); g++)
-                assertNotNull(grid(g).cache(null).get(key));
+                assertNotNull(grid(g).cache(DEFAULT_CACHE_NAME).get(key));
 
             checkNoValue(aff, key);
 
@@ -159,16 +159,16 @@ public abstract class IgniteCacheStoreValueAbstractTest extends IgniteCacheAbstr
             checkNoValue(aff, key);
 
             for (int g = 0; g < gridCount(); g++)
-                assertNotNull(grid(g).cache(null).get(key));
+                assertNotNull(grid(g).cache(DEFAULT_CACHE_NAME).get(key));
 
             checkNoValue(aff, key);
 
             cache.remove(key);
 
             for (int g = 0; g < gridCount(); g++)
-                assertNull(grid(g).cache(null).get(key));
+                assertNull(grid(g).cache(DEFAULT_CACHE_NAME).get(key));
 
-            try (IgniteDataStreamer<TestKey, TestValue> streamer  = grid(0).dataStreamer(null)) {
+            try (IgniteDataStreamer<TestKey, TestValue> streamer  = grid(0).dataStreamer(DEFAULT_CACHE_NAME)) {
                 streamer.addData(key, val);
             }
 
@@ -176,7 +176,7 @@ public abstract class IgniteCacheStoreValueAbstractTest extends IgniteCacheAbstr
 
             cache.remove(key);
 
-            try (IgniteDataStreamer<TestKey, TestValue> streamer  = grid(0).dataStreamer(null)) {
+            try (IgniteDataStreamer<TestKey, TestValue> streamer  = grid(0).dataStreamer(DEFAULT_CACHE_NAME)) {
                 streamer.allowOverwrite(true);
 
                 streamer.addData(key, val);
@@ -202,7 +202,7 @@ public abstract class IgniteCacheStoreValueAbstractTest extends IgniteCacheAbstr
         checkNoValue(aff, key);
 
         for (int g = 0; g < gridCount(); g++)
-            assertNotNull(grid(g).cache(null).get(key));
+            assertNotNull(grid(g).cache(DEFAULT_CACHE_NAME).get(key));
 
         checkNoValue(aff, key);
 
@@ -294,9 +294,9 @@ public abstract class IgniteCacheStoreValueAbstractTest extends IgniteCacheAbstr
 
         startGrids();
 
-        IgniteCache<TestKey, TestValue> cache = grid(0).cache(null);
+        IgniteCache<TestKey, TestValue> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
-        Affinity<Object> aff = grid(0).affinity(null);
+        Affinity<Object> aff = grid(0).affinity(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < 100; i++) {
             TestKey key = new TestKey(i);
@@ -307,7 +307,7 @@ public abstract class IgniteCacheStoreValueAbstractTest extends IgniteCacheAbstr
             checkHasValue(aff, key);
 
             for (int g = 0; g < gridCount(); g++)
-                assertNotNull(grid(g).cache(null).get(key));
+                assertNotNull(grid(g).cache(DEFAULT_CACHE_NAME).get(key));
 
             checkHasValue(aff, key);
 
@@ -324,16 +324,16 @@ public abstract class IgniteCacheStoreValueAbstractTest extends IgniteCacheAbstr
             checkHasValue(aff, key);
 
             for (int g = 0; g < gridCount(); g++)
-                assertNotNull(grid(g).cache(null).get(key));
+                assertNotNull(grid(g).cache(DEFAULT_CACHE_NAME).get(key));
 
             checkHasValue(aff, key);
 
             cache.remove(key);
 
             for (int g = 0; g < gridCount(); g++)
-                assertNull(grid(g).cache(null).get(key));
+                assertNull(grid(g).cache(DEFAULT_CACHE_NAME).get(key));
 
-            try (IgniteDataStreamer<TestKey, TestValue> streamer  = grid(0).dataStreamer(null)) {
+            try (IgniteDataStreamer<TestKey, TestValue> streamer  = grid(0).dataStreamer(DEFAULT_CACHE_NAME)) {
                 streamer.addData(key, val);
             }
 
@@ -341,7 +341,7 @@ public abstract class IgniteCacheStoreValueAbstractTest extends IgniteCacheAbstr
 
             cache.remove(key);
 
-            try (IgniteDataStreamer<TestKey, TestValue> streamer  = grid(0).dataStreamer(null)) {
+            try (IgniteDataStreamer<TestKey, TestValue> streamer  = grid(0).dataStreamer(DEFAULT_CACHE_NAME)) {
                 streamer.allowOverwrite(true);
 
                 streamer.addData(key, val);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPreloadNoWriteTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPreloadNoWriteTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPreloadNoWriteTest.java
index c1f08ac..ebd0a96 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPreloadNoWriteTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheTxPreloadNoWriteTest.java
@@ -57,7 +57,7 @@ public class IgniteCacheTxPreloadNoWriteTest extends GridCommonAbstractTest {
 
         cfg.setDiscoverySpi(disco);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(REPLICATED);
         ccfg.setAtomicityMode(TRANSACTIONAL);
@@ -98,18 +98,18 @@ public class IgniteCacheTxPreloadNoWriteTest extends GridCommonAbstractTest {
     private void txNoWrite(boolean commit) throws Exception {
         Ignite ignite0 = startGrid(0);
 
-        Affinity<Integer> aff = ignite0.affinity(null);
+        Affinity<Integer> aff = ignite0.affinity(DEFAULT_CACHE_NAME);
 
-        IgniteCache<Integer, Object> cache0 = ignite0.cache(null);
+        IgniteCache<Integer, Object> cache0 = ignite0.cache(DEFAULT_CACHE_NAME);
 
-        try (IgniteDataStreamer<Integer, Object> streamer = ignite0.dataStreamer(null)) {
+        try (IgniteDataStreamer<Integer, Object> streamer = ignite0.dataStreamer(DEFAULT_CACHE_NAME)) {
             for (int i = 0; i < 1000; i++)
                 streamer.addData(i + 10000, new byte[1024]);
         }
 
         Ignite ignite1 = startGrid(1);
 
-        Integer key = primaryKey(ignite1.cache(null));
+        Integer key = primaryKey(ignite1.cache(DEFAULT_CACHE_NAME));
 
         // Want test scenario when ignite1 is new primary node, but ignite0 is still partition owner.
         assertTrue(aff.isPrimary(ignite1.cluster().localNode(), key));
@@ -121,7 +121,7 @@ public class IgniteCacheTxPreloadNoWriteTest extends GridCommonAbstractTest {
                 tx.commit();
         }
 
-        GridCacheAdapter cacheAdapter = ((IgniteKernal)ignite(0)).context().cache().internalCache();
+        GridCacheAdapter cacheAdapter = ((IgniteKernal)ignite(0)).context().cache().internalCache(DEFAULT_CACHE_NAME);
 
         // Check all transactions are finished.
         assertEquals(0, cacheAdapter.context().tm().idMapSize());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientAffinityAssignmentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientAffinityAssignmentSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientAffinityAssignmentSelfTest.java
index 09d1099..0a7a680 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientAffinityAssignmentSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientAffinityAssignmentSelfTest.java
@@ -54,7 +54,7 @@ public class IgniteClientAffinityAssignmentSelfTest extends GridCommonAbstractTe
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
 
         if (cache) {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             ccfg.setCacheMode(CacheMode.PARTITIONED);
             ccfg.setBackups(1);
@@ -98,15 +98,15 @@ public class IgniteClientAffinityAssignmentSelfTest extends GridCommonAbstractTe
 
             GridTestUtils.assertThrows(log, new Callable<Object>() {
                 @Override public Object call() throws Exception {
-                    ((IgniteKernal)ignite3).getCache(null);
+                    ((IgniteKernal)ignite3).getCache(DEFAULT_CACHE_NAME);
 
                     return null;
                 }
             }, IllegalArgumentException.class, null);
 
-            assertNotNull(ignite3.cache(null)); // Start client cache.
+            assertNotNull(ignite3.cache(DEFAULT_CACHE_NAME)); // Start client cache.
 
-            ((IgniteKernal)ignite3).getCache(null);
+            ((IgniteKernal)ignite3).getCache(DEFAULT_CACHE_NAME);
 
             checkAffinity(topVer++);
 
@@ -114,15 +114,15 @@ public class IgniteClientAffinityAssignmentSelfTest extends GridCommonAbstractTe
 
             GridTestUtils.assertThrows(log, new Callable<Object>() {
                 @Override public Object call() throws Exception {
-                    ((IgniteKernal)ignite4).getCache(null);
+                    ((IgniteKernal)ignite4).getCache(DEFAULT_CACHE_NAME);
 
                     return null;
                 }
             }, IllegalArgumentException.class, null);
 
-            assertNotNull(ignite4.cache(null)); // Start client cache.
+            assertNotNull(ignite4.cache(DEFAULT_CACHE_NAME)); // Start client cache.
 
-            ((IgniteKernal)ignite4).getCache(null);
+            ((IgniteKernal)ignite4).getCache(DEFAULT_CACHE_NAME);
 
             checkAffinity(topVer++);
 
@@ -130,7 +130,7 @@ public class IgniteClientAffinityAssignmentSelfTest extends GridCommonAbstractTe
 
             GridTestUtils.assertThrows(log, new Callable<Object>() {
                 @Override public Object call() throws Exception {
-                    ((IgniteKernal)ignite5).getCache(null);
+                    ((IgniteKernal)ignite5).getCache(DEFAULT_CACHE_NAME);
 
                     return null;
                 }
@@ -162,14 +162,14 @@ public class IgniteClientAffinityAssignmentSelfTest extends GridCommonAbstractTe
     private void checkAffinity(long topVer) throws Exception {
         awaitTopology(topVer);
 
-        Affinity<Object> aff = grid(0).affinity(null);
+        Affinity<Object> aff = grid(0).affinity(DEFAULT_CACHE_NAME);
 
         for (Ignite grid : Ignition.allGrids()) {
             try {
                 if (grid.cluster().localNode().id().equals(grid(0).localNode().id()))
                     continue;
 
-                Affinity<Object> checkAff = grid.affinity(null);
+                Affinity<Object> checkAff = grid.affinity(DEFAULT_CACHE_NAME);
 
                 for (int p = 0; p < PARTS; p++)
                     assertEquals(aff.mapPartitionToPrimaryAndBackups(p), checkAff.mapPartitionToPrimaryAndBackups(p));
@@ -186,7 +186,7 @@ public class IgniteClientAffinityAssignmentSelfTest extends GridCommonAbstractTe
      */
     private void awaitTopology(final long topVer) throws Exception {
         for (Ignite grid : Ignition.allGrids()) {
-            final GridCacheAdapter cache = ((IgniteKernal)grid).internalCache(null);
+            final GridCacheAdapter cache = ((IgniteKernal)grid).internalCache(DEFAULT_CACHE_NAME);
 
             if (cache == null)
                 continue;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDaemonNodeMarshallerCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDaemonNodeMarshallerCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDaemonNodeMarshallerCacheTest.java
index 96c65e3..fdf5350 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDaemonNodeMarshallerCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDaemonNodeMarshallerCacheTest.java
@@ -121,7 +121,7 @@ public class IgniteDaemonNodeMarshallerCacheTest extends GridCommonAbstractTest
 
         Ignite ignite2 = startGrid(nodeIdx);
 
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setRebalanceMode(SYNC);
         ccfg.setCacheMode(REPLICATED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheAndNodeStop.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheAndNodeStop.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheAndNodeStop.java
index 1033fe1..50f45a7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheAndNodeStop.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheAndNodeStop.java
@@ -62,7 +62,7 @@ public class IgniteDynamicCacheAndNodeStop extends GridCommonAbstractTest {
 
             startGrid(1);
 
-            final  CacheConfiguration ccfg = new CacheConfiguration();
+            final  CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             ignite.createCache(ccfg);
 
@@ -72,7 +72,7 @@ public class IgniteDynamicCacheAndNodeStop extends GridCommonAbstractTest {
                 @Override public Object call() throws Exception {
                     barrier.await();
 
-                    ignite.destroyCache(null);
+                    ignite.destroyCache(DEFAULT_CACHE_NAME);
 
                     return null;
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java
index aa6166f..53c1cb2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheFilterTest.java
@@ -53,7 +53,7 @@ public class IgniteDynamicCacheFilterTest extends GridCommonAbstractTest {
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
         ccfg.setCacheMode(REPLICATED);
@@ -89,7 +89,7 @@ public class IgniteDynamicCacheFilterTest extends GridCommonAbstractTest {
 
         Ignite ignite0 = startGrid(0);
 
-        IgniteCache<Integer, Integer> cache0 = ignite0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = ignite0.cache(DEFAULT_CACHE_NAME);
 
         assertNotNull(cache0);
 
@@ -99,7 +99,7 @@ public class IgniteDynamicCacheFilterTest extends GridCommonAbstractTest {
 
         Ignite ignite1 = startGrid(1);
 
-        IgniteCache<Integer, Integer> cache1 = ignite1.cache(null);
+        IgniteCache<Integer, Integer> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
 
         assertNotNull(cache1);
 
@@ -107,7 +107,7 @@ public class IgniteDynamicCacheFilterTest extends GridCommonAbstractTest {
 
         Ignite ignite2 = startGrid(2);
 
-        IgniteCache<Integer, Integer> cache2 = ignite2.cache(null);
+        IgniteCache<Integer, Integer> cache2 = ignite2.cache(DEFAULT_CACHE_NAME);
 
         assertNotNull(cache2);
 
@@ -115,7 +115,7 @@ public class IgniteDynamicCacheFilterTest extends GridCommonAbstractTest {
 
         Ignite ignite3 = startGrid(3);
 
-        IgniteCache<Integer, Integer> cache3 = ignite3.cache(null);
+        IgniteCache<Integer, Integer> cache3 = ignite3.cache(DEFAULT_CACHE_NAME);
 
         assertNotNull(cache3);
 


[20/51] [abbrv] ignite git commit: ignite-4799 TcpDiscoverySpi: removed missedHeartbeats properties, heartbeatFrequency (instead use IgiteConfiguration.metricsUpdateFrequency). Added IgiteConfiguration.clientFailureDetectionTimeout.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
deleted file mode 100644
index 0ae253a..0000000
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * 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.spi.discovery.tcp.messages;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.UUID;
-import org.apache.ignite.cache.CacheMetrics;
-import org.apache.ignite.cluster.ClusterMetrics;
-import org.apache.ignite.internal.ClusterMetricsSnapshot;
-import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-import org.apache.ignite.internal.util.typedef.C1;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.T2;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-
-/**
- * Heartbeat message.
- * <p>
- * It is sent by coordinator node across the ring once a configured period.
- * Message makes two passes:
- * <ol>
- *      <li>During first pass, all nodes add their metrics to the message and
- *          update local metrics with metrics currently present in the message.</li>
- *      <li>During second pass, all nodes update all metrics present in the message
- *          and remove their own metrics from the message.</li>
- * </ol>
- * When message reaches coordinator second time it is discarded (it finishes the
- * second pass).
- */
-@TcpDiscoveryRedirectToClient
-public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Map to store nodes metrics. */
-    @GridToStringExclude
-    private final Map<UUID, MetricsSet> metrics = new HashMap<>();
-
-    /** Client node IDs. */
-    private final Collection<UUID> clientNodeIds = new HashSet<>();
-
-    /** Cahce metrics by node. */
-    @GridToStringExclude
-    private final Map<UUID, Map<Integer, CacheMetrics>> cacheMetrics = new HashMap<>();
-
-    /**
-     * Constructor.
-     *
-     * @param creatorNodeId Creator node.
-     */
-    public TcpDiscoveryHeartbeatMessage(UUID creatorNodeId) {
-        super(creatorNodeId);
-    }
-
-    /**
-     * Sets metrics for particular node.
-     *
-     * @param nodeId Node ID.
-     * @param metrics Node metrics.
-     */
-    public void setMetrics(UUID nodeId, ClusterMetrics metrics) {
-        assert nodeId != null;
-        assert metrics != null;
-        assert !this.metrics.containsKey(nodeId);
-
-        this.metrics.put(nodeId, new MetricsSet(metrics));
-    }
-
-    /**
-     * Sets cache metrics for particular node.
-     *
-     * @param nodeId Node ID.
-     * @param metrics Node cache metrics.
-     */
-    public void setCacheMetrics(UUID nodeId, Map<Integer, CacheMetrics> metrics) {
-        assert nodeId != null;
-        assert metrics != null;
-        assert !this.cacheMetrics.containsKey(nodeId);
-
-        if (!F.isEmpty(metrics))
-            this.cacheMetrics.put(nodeId, metrics);
-    }
-
-    /**
-     * Sets metrics for a client node.
-     *
-     * @param nodeId Server node ID.
-     * @param clientNodeId Client node ID.
-     * @param metrics Node metrics.
-     */
-    public void setClientMetrics(UUID nodeId, UUID clientNodeId, ClusterMetrics metrics) {
-        assert nodeId != null;
-        assert clientNodeId != null;
-        assert metrics != null;
-        assert this.metrics.containsKey(nodeId);
-
-        this.metrics.get(nodeId).addClientMetrics(clientNodeId, metrics);
-    }
-
-    /**
-     * Removes metrics for particular node from the message.
-     *
-     * @param nodeId Node ID.
-     */
-    public void removeMetrics(UUID nodeId) {
-        assert nodeId != null;
-
-        metrics.remove(nodeId);
-    }
-
-    /**
-     * Removes cache metrics for particular node from the message.
-     *
-     * @param nodeId Node ID.
-     */
-    public void removeCacheMetrics(UUID nodeId) {
-        assert nodeId != null;
-
-        cacheMetrics.remove(nodeId);
-    }
-
-    /**
-     * Gets metrics map.
-     *
-     * @return Metrics map.
-     */
-    public Map<UUID, MetricsSet> metrics() {
-        return metrics;
-    }
-
-    /**
-     * Gets cache metrics map.
-     *
-     * @return Cache metrics map.
-     */
-    public Map<UUID, Map<Integer, CacheMetrics>> cacheMetrics() {
-        return cacheMetrics;
-    }
-
-    /**
-     * @return {@code True} if this message contains metrics.
-     */
-    public boolean hasMetrics() {
-        return !metrics.isEmpty();
-    }
-
-    /**
-     * @return {@code True} this message contains cache metrics.
-     */
-    public boolean hasCacheMetrics() {
-        return !cacheMetrics.isEmpty();
-    }
-
-    /**
-     * @return {@code True} if this message contains metrics.
-     */
-    public boolean hasMetrics(UUID nodeId) {
-        assert nodeId != null;
-
-        return metrics.get(nodeId) != null;
-    }
-
-    /**
-     * @param nodeId Node ID.
-     *
-     * @return {@code True} if this message contains cache metrics for particular node.
-     */
-    public boolean hasCacheMetrics(UUID nodeId) {
-        assert nodeId != null;
-
-        return cacheMetrics.get(nodeId) != null;
-    }
-
-    /**
-     * Gets client node IDs for  particular node.
-     *
-     * @return Client node IDs.
-     */
-    public Collection<UUID> clientNodeIds() {
-        return clientNodeIds;
-    }
-
-    /**
-     * Adds client node ID.
-     *
-     * @param clientNodeId Client node ID.
-     */
-    public void addClientNodeId(UUID clientNodeId) {
-        clientNodeIds.add(clientNodeId);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean traceLogLevel() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean highPriority() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(TcpDiscoveryHeartbeatMessage.class, this, "super", super.toString());
-    }
-
-    /**
-     * @param nodeId Node ID.
-     * @param metrics Metrics.
-     * @return Serialized metrics.
-     */
-    private static byte[] serializeMetrics(UUID nodeId, ClusterMetrics metrics) {
-        assert nodeId != null;
-        assert metrics != null;
-
-        byte[] buf = new byte[16 + ClusterMetricsSnapshot.METRICS_SIZE];
-
-        U.longToBytes(nodeId.getMostSignificantBits(), buf, 0);
-        U.longToBytes(nodeId.getLeastSignificantBits(), buf, 8);
-
-        ClusterMetricsSnapshot.serialize(buf, 16, metrics);
-
-        return buf;
-    }
-
-    /**
-     */
-    @SuppressWarnings("PublicInnerClass")
-    public static class MetricsSet implements Externalizable {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** Metrics. */
-        private byte[] metrics;
-
-        /** Client metrics. */
-        private Collection<byte[]> clientMetrics;
-
-        /**
-         */
-        public MetricsSet() {
-            // No-op.
-        }
-
-        /**
-         * @param metrics Metrics.
-         */
-        public MetricsSet(ClusterMetrics metrics) {
-            assert metrics != null;
-
-            this.metrics = ClusterMetricsSnapshot.serialize(metrics);
-        }
-
-        /**
-         * @return Deserialized metrics.
-         */
-        public ClusterMetrics metrics() {
-            return ClusterMetricsSnapshot.deserialize(metrics, 0);
-        }
-
-        /**
-         * @return Client metrics.
-         */
-        public Collection<T2<UUID, ClusterMetrics>> clientMetrics() {
-            return F.viewReadOnly(clientMetrics, new C1<byte[], T2<UUID, ClusterMetrics>>() {
-                @Override public T2<UUID, ClusterMetrics> apply(byte[] bytes) {
-                    UUID nodeId = new UUID(U.bytesToLong(bytes, 0), U.bytesToLong(bytes, 8));
-
-                    return new T2<>(nodeId, ClusterMetricsSnapshot.deserialize(bytes, 16));
-                }
-            });
-        }
-
-        /**
-         * @param nodeId Client node ID.
-         * @param metrics Client metrics.
-         */
-        private void addClientMetrics(UUID nodeId, ClusterMetrics metrics) {
-            assert nodeId != null;
-            assert metrics != null;
-
-            if (clientMetrics == null)
-                clientMetrics = new ArrayList<>();
-
-            clientMetrics.add(serializeMetrics(nodeId, metrics));
-        }
-
-        /** {@inheritDoc} */
-        @Override public void writeExternal(ObjectOutput out) throws IOException {
-            U.writeByteArray(out, metrics);
-
-            out.writeInt(clientMetrics != null ? clientMetrics.size() : -1);
-
-            if (clientMetrics != null) {
-                for (byte[] arr : clientMetrics)
-                    U.writeByteArray(out, arr);
-            }
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-            metrics = U.readByteArray(in);
-
-            int clientMetricsSize = in.readInt();
-
-            if (clientMetricsSize >= 0) {
-                clientMetrics = new ArrayList<>(clientMetricsSize);
-
-                for (int i = 0; i < clientMetricsSize; i++)
-                    clientMetrics.add(U.readByteArray(in));
-            }
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryMetricsUpdateMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryMetricsUpdateMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryMetricsUpdateMessage.java
new file mode 100644
index 0000000..9bf33cf
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryMetricsUpdateMessage.java
@@ -0,0 +1,338 @@
+/*
+ * 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.spi.discovery.tcp.messages;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.ignite.cache.CacheMetrics;
+import org.apache.ignite.cluster.ClusterMetrics;
+import org.apache.ignite.internal.ClusterMetricsSnapshot;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.C1;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+/**
+ * Metrics update message.
+ * <p>
+ * It is sent by coordinator node across the ring once a configured period.
+ * Message makes two passes:
+ * <ol>
+ *      <li>During first pass, all nodes add their metrics to the message and
+ *          update local metrics with metrics currently present in the message.</li>
+ *      <li>During second pass, all nodes update all metrics present in the message
+ *          and remove their own metrics from the message.</li>
+ * </ol>
+ * When message reaches coordinator second time it is discarded (it finishes the
+ * second pass).
+ */
+@TcpDiscoveryRedirectToClient
+public class TcpDiscoveryMetricsUpdateMessage extends TcpDiscoveryAbstractMessage {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Map to store nodes metrics. */
+    @GridToStringExclude
+    private final Map<UUID, MetricsSet> metrics = new HashMap<>();
+
+    /** Client node IDs. */
+    private final Collection<UUID> clientNodeIds = new HashSet<>();
+
+    /** Cahce metrics by node. */
+    @GridToStringExclude
+    private final Map<UUID, Map<Integer, CacheMetrics>> cacheMetrics = new HashMap<>();
+
+    /**
+     * Constructor.
+     *
+     * @param creatorNodeId Creator node.
+     */
+    public TcpDiscoveryMetricsUpdateMessage(UUID creatorNodeId) {
+        super(creatorNodeId);
+    }
+
+    /**
+     * Sets metrics for particular node.
+     *
+     * @param nodeId Node ID.
+     * @param metrics Node metrics.
+     */
+    public void setMetrics(UUID nodeId, ClusterMetrics metrics) {
+        assert nodeId != null;
+        assert metrics != null;
+        assert !this.metrics.containsKey(nodeId);
+
+        this.metrics.put(nodeId, new MetricsSet(metrics));
+    }
+
+    /**
+     * Sets cache metrics for particular node.
+     *
+     * @param nodeId Node ID.
+     * @param metrics Node cache metrics.
+     */
+    public void setCacheMetrics(UUID nodeId, Map<Integer, CacheMetrics> metrics) {
+        assert nodeId != null;
+        assert metrics != null;
+        assert !this.cacheMetrics.containsKey(nodeId);
+
+        if (!F.isEmpty(metrics))
+            this.cacheMetrics.put(nodeId, metrics);
+    }
+
+    /**
+     * Sets metrics for a client node.
+     *
+     * @param nodeId Server node ID.
+     * @param clientNodeId Client node ID.
+     * @param metrics Node metrics.
+     */
+    public void setClientMetrics(UUID nodeId, UUID clientNodeId, ClusterMetrics metrics) {
+        assert nodeId != null;
+        assert clientNodeId != null;
+        assert metrics != null;
+        assert this.metrics.containsKey(nodeId);
+
+        this.metrics.get(nodeId).addClientMetrics(clientNodeId, metrics);
+    }
+
+    /**
+     * Removes metrics for particular node from the message.
+     *
+     * @param nodeId Node ID.
+     */
+    public void removeMetrics(UUID nodeId) {
+        assert nodeId != null;
+
+        metrics.remove(nodeId);
+    }
+
+    /**
+     * Removes cache metrics for particular node from the message.
+     *
+     * @param nodeId Node ID.
+     */
+    public void removeCacheMetrics(UUID nodeId) {
+        assert nodeId != null;
+
+        cacheMetrics.remove(nodeId);
+    }
+
+    /**
+     * Gets metrics map.
+     *
+     * @return Metrics map.
+     */
+    public Map<UUID, MetricsSet> metrics() {
+        return metrics;
+    }
+
+    /**
+     * Gets cache metrics map.
+     *
+     * @return Cache metrics map.
+     */
+    public Map<UUID, Map<Integer, CacheMetrics>> cacheMetrics() {
+        return cacheMetrics;
+    }
+
+    /**
+     * @return {@code True} if this message contains metrics.
+     */
+    public boolean hasMetrics() {
+        return !metrics.isEmpty();
+    }
+
+    /**
+     * @return {@code True} this message contains cache metrics.
+     */
+    public boolean hasCacheMetrics() {
+        return !cacheMetrics.isEmpty();
+    }
+
+    /**
+     * @return {@code True} if this message contains metrics.
+     */
+    public boolean hasMetrics(UUID nodeId) {
+        assert nodeId != null;
+
+        return metrics.get(nodeId) != null;
+    }
+
+    /**
+     * @param nodeId Node ID.
+     *
+     * @return {@code True} if this message contains cache metrics for particular node.
+     */
+    public boolean hasCacheMetrics(UUID nodeId) {
+        assert nodeId != null;
+
+        return cacheMetrics.get(nodeId) != null;
+    }
+
+    /**
+     * Gets client node IDs for  particular node.
+     *
+     * @return Client node IDs.
+     */
+    public Collection<UUID> clientNodeIds() {
+        return clientNodeIds;
+    }
+
+    /**
+     * Adds client node ID.
+     *
+     * @param clientNodeId Client node ID.
+     */
+    public void addClientNodeId(UUID clientNodeId) {
+        clientNodeIds.add(clientNodeId);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean traceLogLevel() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean highPriority() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(TcpDiscoveryMetricsUpdateMessage.class, this, "super", super.toString());
+    }
+
+    /**
+     * @param nodeId Node ID.
+     * @param metrics Metrics.
+     * @return Serialized metrics.
+     */
+    private static byte[] serializeMetrics(UUID nodeId, ClusterMetrics metrics) {
+        assert nodeId != null;
+        assert metrics != null;
+
+        byte[] buf = new byte[16 + ClusterMetricsSnapshot.METRICS_SIZE];
+
+        U.longToBytes(nodeId.getMostSignificantBits(), buf, 0);
+        U.longToBytes(nodeId.getLeastSignificantBits(), buf, 8);
+
+        ClusterMetricsSnapshot.serialize(buf, 16, metrics);
+
+        return buf;
+    }
+
+    /**
+     */
+    @SuppressWarnings("PublicInnerClass")
+    public static class MetricsSet implements Externalizable {
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        /** Metrics. */
+        private byte[] metrics;
+
+        /** Client metrics. */
+        private Collection<byte[]> clientMetrics;
+
+        /**
+         */
+        public MetricsSet() {
+            // No-op.
+        }
+
+        /**
+         * @param metrics Metrics.
+         */
+        public MetricsSet(ClusterMetrics metrics) {
+            assert metrics != null;
+
+            this.metrics = ClusterMetricsSnapshot.serialize(metrics);
+        }
+
+        /**
+         * @return Deserialized metrics.
+         */
+        public ClusterMetrics metrics() {
+            return ClusterMetricsSnapshot.deserialize(metrics, 0);
+        }
+
+        /**
+         * @return Client metrics.
+         */
+        public Collection<T2<UUID, ClusterMetrics>> clientMetrics() {
+            return F.viewReadOnly(clientMetrics, new C1<byte[], T2<UUID, ClusterMetrics>>() {
+                @Override public T2<UUID, ClusterMetrics> apply(byte[] bytes) {
+                    UUID nodeId = new UUID(U.bytesToLong(bytes, 0), U.bytesToLong(bytes, 8));
+
+                    return new T2<>(nodeId, ClusterMetricsSnapshot.deserialize(bytes, 16));
+                }
+            });
+        }
+
+        /**
+         * @param nodeId Client node ID.
+         * @param metrics Client metrics.
+         */
+        private void addClientMetrics(UUID nodeId, ClusterMetrics metrics) {
+            assert nodeId != null;
+            assert metrics != null;
+
+            if (clientMetrics == null)
+                clientMetrics = new ArrayList<>();
+
+            clientMetrics.add(serializeMetrics(nodeId, metrics));
+        }
+
+        /** {@inheritDoc} */
+        @Override public void writeExternal(ObjectOutput out) throws IOException {
+            U.writeByteArray(out, metrics);
+
+            out.writeInt(clientMetrics != null ? clientMetrics.size() : -1);
+
+            if (clientMetrics != null) {
+                for (byte[] arr : clientMetrics)
+                    U.writeByteArray(out, arr);
+            }
+        }
+
+        /** {@inheritDoc} */
+        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+            metrics = U.readByteArray(in);
+
+            int clientMetricsSize = in.readInt();
+
+            if (clientMetricsSize >= 0) {
+                clientMetrics = new ArrayList<>(clientMetricsSize);
+
+                for (int i = 0; i < clientMetricsSize; i++)
+                    clientMetrics.add(U.readByteArray(in));
+            }
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpi.java
index cfd4fc7..1a3a7fe 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpi.java
@@ -97,13 +97,13 @@ import static org.apache.ignite.events.EventType.EVT_TASK_FINISHED;
  * You should tune these values based on the level of accuracy needed vs. the additional memory
  * that would be required for storing metrics.
  * <p>
- * You should also keep in mind that metrics for remote nodes are delayed (usually by the
- * heartbeat frequency). So if it is acceptable in your environment, set the heartbeat frequency
- * to be more inline with job execution time. Generally, the more often heartbeats between nodes
+ * You should also keep in mind that metrics for remote nodes are delayed (usually by the metrics
+ * update frequency). So if it is acceptable in your environment, set the metrics update frequency
+ * to be more inline with job execution time. Generally, the more often metrics update between nodes
  * are exchanged, the more precise the metrics are. However, you should keep in mind that if
- * heartbeats are exchanged too often then it may create unnecessary traffic in the network.
- * Heartbeats (or metrics update frequency) can be configured via underlying
- * {@link org.apache.ignite.spi.discovery.DiscoverySpi} used in your grid.
+ * metrics update are exchanged too often then it may create unnecessary traffic in the network.
+ * Metrics update frequency can be configured via underlying
+ * {@link org.apache.ignite.configuration.IgniteConfiguration} used in your grid.
  * <p>
  * Here is an example of how probing can be implemented to use
  * number of active and waiting jobs as probing mechanism:

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index 2cc83a4..bc1e534 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -1962,7 +1962,7 @@ org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage
 org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAuthFailedMessage
 org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCheckFailedMessage
 org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientAckResponse
-org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientHeartbeatMessage
+org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientMetricsUpdateMessage
 org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientPingRequest
 org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientPingResponse
 org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientReconnectMessage
@@ -1972,9 +1972,9 @@ org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryDiscardMessage
 org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryDuplicateIdMessage
 org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryHandshakeRequest
 org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryHandshakeResponse
-org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryHeartbeatMessage
-org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryHeartbeatMessage$MetricsSet
-org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryHeartbeatMessage$MetricsSet$1
+org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryMetricsUpdateMessage
+org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryMetricsUpdateMessage$MetricsSet
+org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryMetricsUpdateMessage$MetricsSet$1
 org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryJoinRequestMessage
 org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryLoopbackProblemMessage
 org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeAddFinishedMessage

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/config/load/dsi-load-base.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/load/dsi-load-base.xml b/modules/core/src/test/config/load/dsi-load-base.xml
index c57b5e0..7d7f2ba 100644
--- a/modules/core/src/test/config/load/dsi-load-base.xml
+++ b/modules/core/src/test/config/load/dsi-load-base.xml
@@ -48,10 +48,11 @@
 
                 <property name="ackTimeout" value="4000"/>
                 <property name="socketTimeout" value="4000"/>
-                <property name="heartbeatFrequency" value="6000"/>
             </bean>
         </property>
 
+        <property name="metricsUpdateFrequency" value="6000"/>
+
         <property name="lifecycleBeans" ref="lifecycleBeans"/>
 
         <property name="peerClassLoadingEnabled" value="false"/>

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/config/load/merge-sort-base.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/load/merge-sort-base.xml b/modules/core/src/test/config/load/merge-sort-base.xml
index aba0108..44b26bb 100644
--- a/modules/core/src/test/config/load/merge-sort-base.xml
+++ b/modules/core/src/test/config/load/merge-sort-base.xml
@@ -68,6 +68,10 @@
 
         <property name="peerClassLoadingThreadPoolSize" value="100"/>
 
+        <property name="metricsUpdateFrequency" value="10000"/>
+
+        <property name="failureDetectionTimeout" value="60000"/>
+
         <!-- Discovery SPI configuration. -->
         <property name="discoverySpi">
             <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
@@ -75,9 +79,6 @@
                 <property name="socketTimeout" value="5000"/>
                 <property name="ackTimeout" value="5000"/>
 
-                <property name="heartbeatFrequency" value="10000"/>
-                <property name="maxMissedHeartbeats" value="6"/>
-
                 <property name="statisticsPrintFrequency" value="60000"/>
 
                 <property name="ipFinder">

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/config/streamer/spring-streamer-base.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/streamer/spring-streamer-base.xml b/modules/core/src/test/config/streamer/spring-streamer-base.xml
index 746dd95..ddb96a7 100644
--- a/modules/core/src/test/config/streamer/spring-streamer-base.xml
+++ b/modules/core/src/test/config/streamer/spring-streamer-base.xml
@@ -66,12 +66,13 @@
             <constructor-arg value="127.0.0.1"/>
         </bean>
 
+        <property name="failureDetectionTimeout" value="45000"/>
+        <property name="metricsUpdateFrequency" value="15000"/>
+
         <bean id="discoSpi" class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
             <property name="ackTimeout" value="5000"/>
             <property name="socketTimeout" value="5000"/>
             <property name="reconnectCount" value="5"/>
-            <property name="heartbeatFrequency" value="15000"/>
-            <property name="maxMissedHeartbeats" value="3"/>
 
             <property name="ipFinder">
                 <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/GridTestJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/GridTestJob.java b/modules/core/src/test/java/org/apache/ignite/GridTestJob.java
index a4dbe53..3750585 100644
--- a/modules/core/src/test/java/org/apache/ignite/GridTestJob.java
+++ b/modules/core/src/test/java/org/apache/ignite/GridTestJob.java
@@ -20,6 +20,8 @@ package org.apache.ignite;
 import org.apache.ignite.compute.ComputeJobAdapter;
 import org.apache.ignite.resources.LoggerResource;
 
+import java.util.concurrent.CountDownLatch;
+
 /**
  * Test job.
  */
@@ -28,6 +30,8 @@ public class GridTestJob extends ComputeJobAdapter {
     @LoggerResource
     private IgniteLogger log;
 
+    CountDownLatch latch;
+
     /** */
     public GridTestJob() {
         // No-op.
@@ -40,10 +44,25 @@ public class GridTestJob extends ComputeJobAdapter {
         super(arg);
     }
 
+    /**
+     * @param arg Job argument.
+     */
+    public GridTestJob(String arg, CountDownLatch latch) {
+        super(arg);
+        this.latch = latch;
+    }
+
     /** {@inheritDoc} */
     @Override public String execute() {
         if (log.isDebugEnabled())
             log.debug("Executing job [job=" + this + ", arg=" + argument(0) + ']');
+        if (latch != null) {
+            try {
+                latch.await();
+            } catch (InterruptedException e) {
+                // Nothing to do
+            }
+        }
 
         return argument(0);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/GridTestTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/GridTestTask.java b/modules/core/src/test/java/org/apache/ignite/GridTestTask.java
index dbe34c6..8dc0569 100644
--- a/modules/core/src/test/java/org/apache/ignite/GridTestTask.java
+++ b/modules/core/src/test/java/org/apache/ignite/GridTestTask.java
@@ -20,6 +20,8 @@ package org.apache.ignite;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.concurrent.CountDownLatch;
+
 import org.apache.ignite.compute.ComputeJob;
 import org.apache.ignite.compute.ComputeJobResult;
 import org.apache.ignite.compute.ComputeTaskSplitAdapter;
@@ -33,6 +35,20 @@ public class GridTestTask extends ComputeTaskSplitAdapter<Object, Object> {
     @LoggerResource
     private IgniteLogger log;
 
+    /**
+     * Optional latch to wait for
+     */
+    CountDownLatch latch;
+
+    public GridTestTask (CountDownLatch latch) {
+        super();
+        this.latch = latch;
+    }
+
+    public GridTestTask() {
+        super();
+    }
+
     /** {@inheritDoc} */
     @Override public Collection<? extends ComputeJob> split(int gridSize, Object arg) {
         if (log.isDebugEnabled())
@@ -41,7 +57,7 @@ public class GridTestTask extends ComputeTaskSplitAdapter<Object, Object> {
         Collection<ComputeJob> refs = new ArrayList<>(gridSize);
 
         for (int i = 0; i < gridSize; i++)
-            refs.add(new GridTestJob(arg.toString() + i + 1));
+            refs.add(new GridTestJob(arg.toString() + i + 1, latch));
 
         return refs;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
index dafc41f..d204a39 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
@@ -87,7 +87,7 @@ public class ClusterNodeMetricsSelfTest extends GridCommonAbstractTest {
         cfg.setDiscoverySpi(spi);
 
         cfg.setCacheConfiguration();
-        cfg.setMetricsUpdateFrequency(0);
+        cfg.setMetricsUpdateFrequency(500);
 
         CacheConfiguration<Integer, Object> ccfg = defaultCacheConfiguration();
         ccfg.setName(CACHE_NAME);
@@ -173,16 +173,18 @@ public class ClusterNodeMetricsSelfTest extends GridCommonAbstractTest {
     public void testSingleTaskMetrics() throws Exception {
         Ignite ignite = grid();
 
-        ignite.compute().execute(new GridTestTask(), "testArg");
+        final CountDownLatch taskLatch = new CountDownLatch(2);
+        ignite.compute().executeAsync(new GridTestTask(taskLatch), "testArg");
 
         // Let metrics update twice.
-        final CountDownLatch latch = new CountDownLatch(2);
 
+        final CountDownLatch latch = new CountDownLatch(3);
         ignite.events().localListen(new IgnitePredicate<Event>() {
             @Override public boolean apply(Event evt) {
                 assert evt.type() == EVT_NODE_METRICS_UPDATED;
 
                 latch.countDown();
+                taskLatch.countDown();
 
                 return true;
             }
@@ -203,7 +205,7 @@ public class ClusterNodeMetricsSelfTest extends GridCommonAbstractTest {
         assert metrics.getAverageWaitingJobs() == 0;
         assert metrics.getCurrentActiveJobs() == 0;
         assert metrics.getCurrentCancelledJobs() == 0;
-        assert metrics.getCurrentJobExecuteTime() == 0;
+        assert metrics.getCurrentJobExecuteTime() > 0;
         assert metrics.getCurrentJobWaitTime() == 0;
         assert metrics.getCurrentWaitingJobs() == 0;
         assert metrics.getMaximumActiveJobs() == 1;

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityMappedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityMappedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityMappedTest.java
index f6f641b..7535228 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityMappedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityMappedTest.java
@@ -54,10 +54,13 @@ public class GridAffinityMappedTest extends GridCommonAbstractTest {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
         TcpDiscoverySpi disco = new TcpDiscoverySpi();
-        disco.setMaxMissedHeartbeats(Integer.MAX_VALUE);
+
         disco.setIpFinder(ipFinder);
+
         cfg.setDiscoverySpi(disco);
 
+        cfg.setFailureDetectionTimeout(Integer.MAX_VALUE);
+
         if (igniteInstanceName.endsWith("1"))
             cfg.setCacheConfiguration(); // Empty cache configuration.
         else {

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityP2PSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityP2PSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityP2PSelfTest.java
index 4e4586f..216c50e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityP2PSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityP2PSelfTest.java
@@ -85,11 +85,12 @@ public class GridAffinityP2PSelfTest extends GridCommonAbstractTest {
 
         TcpDiscoverySpi disco = new TcpDiscoverySpi();
 
-        disco.setMaxMissedHeartbeats(Integer.MAX_VALUE);
         disco.setIpFinder(ipFinder);
 
         c.setDiscoverySpi(disco);
 
+        c.setFailureDetectionTimeout(Integer.MAX_VALUE);
+
         c.setDeploymentMode(depMode);
 
         if (igniteInstanceName.endsWith("1"))

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinitySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinitySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridAffinitySelfTest.java
index d2df1be..92933f9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinitySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridAffinitySelfTest.java
@@ -49,11 +49,12 @@ public class GridAffinitySelfTest extends GridCommonAbstractTest {
 
         TcpDiscoverySpi disco = new TcpDiscoverySpi();
 
-        disco.setMaxMissedHeartbeats(Integer.MAX_VALUE);
         disco.setIpFinder(IP_FINDER);
 
         cfg.setDiscoverySpi(disco);
 
+        cfg.setFailureDetectionTimeout(Integer.MAX_VALUE);
+
         if (igniteInstanceName.endsWith("1"))
             cfg.setClientMode(true);
         else {

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/GridCancelledJobsMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridCancelledJobsMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridCancelledJobsMetricsSelfTest.java
index 39677c5..a5d60cc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridCancelledJobsMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridCancelledJobsMetricsSelfTest.java
@@ -72,7 +72,7 @@ public class GridCancelledJobsMetricsSelfTest extends GridCommonAbstractTest {
 
         assert discoSpi instanceof TcpDiscoverySpi;
 
-        ((TcpDiscoverySpi)discoSpi).setHeartbeatFrequency(500);
+        cfg.setMetricsUpdateFrequency(500);
 
         return cfg;
     }
@@ -221,4 +221,4 @@ public class GridCancelledJobsMetricsSelfTest extends GridCommonAbstractTest {
                 tmp.onExternalCollision();
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java
index 4d503bd..79dc81a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridFailFastNodeFailureDetectionSelfTest.java
@@ -49,7 +49,6 @@ public class GridFailFastNodeFailureDetectionSelfTest extends GridCommonAbstract
         TcpDiscoverySpi disco = new TcpDiscoverySpi();
 
         disco.setIpFinder(IP_FINDER);
-        disco.setHeartbeatFrequency(10_000);
 
         // Set parameters for fast ping failure.
         disco.setSocketTimeout(100);
@@ -57,6 +56,7 @@ public class GridFailFastNodeFailureDetectionSelfTest extends GridCommonAbstract
         disco.setReconnectCount(2);
 
         cfg.setDiscoverySpi(disco);
+        cfg.setMetricsUpdateFrequency(10_000);
 
         return cfg;
     }
@@ -129,4 +129,4 @@ public class GridFailFastNodeFailureDetectionSelfTest extends GridCommonAbstract
 
         U.invoke(comm.getClass(), comm, "simulateNodeFailure");
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/GridJobCollisionCancelSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridJobCollisionCancelSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridJobCollisionCancelSelfTest.java
index c213464..80b5599 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridJobCollisionCancelSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridJobCollisionCancelSelfTest.java
@@ -102,7 +102,7 @@ public class GridJobCollisionCancelSelfTest extends GridCommonAbstractTest {
                 // Should be exactly the same as Jobs number.
                 assert cancelCnt <= SPLIT_COUNT : "Invalid cancel count: " + cancelCnt;
 
-                // One per start and one per stop and some that come with heartbeats.
+                // One per start and one per stop and some that come with metrics update.
                 assert colResolutionCnt > SPLIT_COUNT + 1:
                     "Invalid collision resolution count: " + colResolutionCnt;
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
index f0c50eb..1847303 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
@@ -101,15 +101,15 @@ public class GridDiscoveryManagerAliveCacheSelfTest extends GridCommonAbstractTe
         if (clientMode && ((igniteInstanceName.charAt(igniteInstanceName.length() - 1) - '0') & 1) != 0)
             cfg.setClientMode(true);
         else
-            disc.setMaxMissedClientHeartbeats(50);
+            cfg.setClientFailureDetectionTimeout(50000);
 
-        disc.setHeartbeatFrequency(500);
         disc.setIpFinder(IP_FINDER);
         disc.setAckTimeout(1000);
         disc.setSocketTimeout(1000);
 
         cfg.setCacheConfiguration(cCfg);
         cfg.setDiscoverySpi(disc);
+        cfg.setMetricsUpdateFrequency(500);
 
         return cfg;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
index ccb879e..57a2420 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
@@ -78,13 +78,13 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
         cfg.setNetworkTimeout(60_000);
+        cfg.setMetricsUpdateFrequency(30_000);
 
         TcpDiscoverySpi discoSpi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
 
         discoSpi.setSocketTimeout(30_000);
         discoSpi.setAckTimeout(30_000);
         discoSpi.setNetworkTimeout(60_000);
-        discoSpi.setHeartbeatFrequency(30_000);
         discoSpi.setReconnectCount(2);
 
         ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
@@ -386,4 +386,4 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac
     private IgniteCache<String,Integer> cache(Ignite g) {
         return g.cache(null);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
index 95f8bb8..c40d44d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
@@ -201,9 +201,9 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+        cfg.setFailureDetectionTimeout(Integer.MAX_VALUE);
 
-        disco.setMaxMissedHeartbeats(Integer.MAX_VALUE);
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
 
         disco.setIpFinder(ipFinder);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManagerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManagerSelfTest.java
index 47b9473..957828c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManagerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManagerSelfTest.java
@@ -51,10 +51,11 @@ public class GridCacheMvccManagerSelfTest extends GridCommonAbstractTest {
 
         TcpDiscoverySpi disco = new TcpDiscoverySpi();
 
-        disco.setMaxMissedHeartbeats(Integer.MAX_VALUE);
         disco.setIpFinder(ipFinder);
 
         cfg.setDiscoverySpi(disco);
+
+        cfg.setFailureDetectionTimeout(Integer.MAX_VALUE);
         cfg.setCacheConfiguration(cacheConfiguration());
 
         return cfg;

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
index 688e1cc..5133f61 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractTest.java
@@ -93,17 +93,17 @@ public abstract class IgniteCacheAbstractTest extends GridCommonAbstractTest {
 
         TcpDiscoverySpi disco = new TcpDiscoverySpi().setForceServerMode(true);
 
-        disco.setMaxMissedHeartbeats(Integer.MAX_VALUE);
-
         disco.setIpFinder(ipFinder);
 
         if (isDebug())
             disco.setAckTimeout(Integer.MAX_VALUE);
 
-        MemoryEventStorageSpi eventSpi = new MemoryEventStorageSpi();
-        eventSpi.setExpireCount(100);
+        MemoryEventStorageSpi evtSpi = new MemoryEventStorageSpi();
+        evtSpi.setExpireCount(100);
+
+        cfg.setFailureDetectionTimeout(Integer.MAX_VALUE);
 
-        cfg.setEventStorageSpi(eventSpi);
+        cfg.setEventStorageSpi(evtSpi);
 
         cfg.setDiscoverySpi(disco);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataUpdatesFlowTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataUpdatesFlowTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataUpdatesFlowTest.java
index b76279d..e0fc205 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataUpdatesFlowTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataUpdatesFlowTest.java
@@ -147,9 +147,9 @@ public class BinaryMetadataUpdatesFlowTest extends GridCommonAbstractTest {
                 }
             };
 
-            discoSpi.setHeartbeatFrequency(1000);
-
             cfg.setDiscoverySpi(discoSpi);
+
+            cfg.setMetricsUpdateFrequency(1000);
         }
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
index c68c8d0..9c24073 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
@@ -158,11 +158,12 @@ public class CacheLateAffinityAssignmentTest extends GridCommonAbstractTest {
 
         discoSpi.setForceServerMode(forceSrvMode);
         discoSpi.setIpFinder(ipFinder);
-        discoSpi.setMaxMissedClientHeartbeats(100);
         discoSpi.setNetworkTimeout(60_000);
 
         cfg.setDiscoverySpi(discoSpi);
 
+        cfg.setClientFailureDetectionTimeout(100000);
+
         CacheConfiguration[] ccfg;
 
         if (cacheC != null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
index e11e198..cd475fe 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
@@ -87,10 +87,9 @@ public abstract class GridCacheNodeFailureAbstractTest extends GridCommonAbstrac
 
         TcpDiscoverySpi disco = new TcpDiscoverySpi();
 
-        disco.setMaxMissedHeartbeats(Integer.MAX_VALUE);
-
         disco.setIpFinder(ipFinder);
 
+        c.setFailureDetectionTimeout(Integer.MAX_VALUE);
         c.setDiscoverySpi(disco);
 
         c.setDeploymentMode(DeploymentMode.SHARED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
index aaacd2d..6d7ec90 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
@@ -67,8 +67,8 @@ public class IgniteCache150ClientsTest extends GridCommonAbstractTest {
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setJoinTimeout(0);
-        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setMaxMissedClientHeartbeats(200);
 
+        cfg.setClientFailureDetectionTimeout(200000);
         cfg.setClientMode(!igniteInstanceName.equals(getTestIgniteInstanceName(0)));
 
         CacheConfiguration[] ccfgs = new CacheConfiguration[CACHES];

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheNearRestartRollbackSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheNearRestartRollbackSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheNearRestartRollbackSelfTest.java
index bbbcfd7..907922c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheNearRestartRollbackSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheNearRestartRollbackSelfTest.java
@@ -71,8 +71,8 @@ public class IgniteCacheNearRestartRollbackSelfTest extends GridCommonAbstractTe
         TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
 
         discoSpi.setIpFinder(IP_FINDER);
-        discoSpi.setMaxMissedClientHeartbeats(50);
 
+        cfg.setClientFailureDetectionTimeout(50000);
         cfg.setDiscoverySpi(discoSpi);
 
         cfg.setCacheConfiguration(cacheConfiguration(igniteInstanceName));

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxSingleThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxSingleThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxSingleThreadedSelfTest.java
index ba9f9e4..644fabd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxSingleThreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxSingleThreadedSelfTest.java
@@ -64,8 +64,8 @@ public class GridCacheColocatedTxSingleThreadedSelfTest extends IgniteTxSingleTh
         TcpDiscoverySpi spi = new TcpDiscoverySpi();
 
         spi.setIpFinder(ipFinder);
-        spi.setMaxMissedHeartbeats(Integer.MAX_VALUE);
 
+        c.setFailureDetectionTimeout(Integer.MAX_VALUE);
         c.setDiscoverySpi(spi);
 
         c.setCacheConfiguration(cc);

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java
index b9afd65..3bdce46 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java
@@ -93,8 +93,8 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest {
         TcpDiscoverySpi disco = new TcpDiscoverySpi();
 
         disco.setIpFinder(ipFinder);
-        disco.setMaxMissedHeartbeats(Integer.MAX_VALUE);
 
+        c.setFailureDetectionTimeout(Integer.MAX_VALUE);
         c.setDiscoverySpi(disco);
         c.setCacheConfiguration(cc);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java
index f223c9b..af7aff4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java
@@ -66,8 +66,8 @@ public class GridCacheDhtPreloadMessageCountTest extends GridCommonAbstractTest
         TcpDiscoverySpi disco = new TcpDiscoverySpi();
 
         disco.setIpFinder(ipFinder);
-        disco.setMaxMissedHeartbeats(Integer.MAX_VALUE);
 
+        c.setFailureDetectionTimeout(Integer.MAX_VALUE);
         c.setDiscoverySpi(disco);
         c.setCacheConfiguration(cc);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
index 591858a..6fdb354 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
@@ -82,7 +82,7 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
         cfg.setConsistentId(gridName);
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
-        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setMaxMissedClientHeartbeats(1000);
+        cfg.setClientFailureDetectionTimeout(Integer.MAX_VALUE);
 
         TestRecordingCommunicationSpi commSpi = new TestRecordingCommunicationSpi();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java
index d041ae2..61cc580 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java
@@ -82,8 +82,8 @@ public class GridCacheNearMultiGetSelfTest extends GridCommonAbstractTest {
         TcpDiscoverySpi spi = new TcpDiscoverySpi();
 
         spi.setIpFinder(ipFinder);
-        spi.setMaxMissedHeartbeats(Integer.MAX_VALUE);
 
+        c.setFailureDetectionTimeout(Integer.MAX_VALUE);
         c.setDiscoverySpi(spi);
 
         c.setCacheConfiguration(cc);

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
index e4ed64b..a6b8d79 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
@@ -106,8 +106,8 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
         TcpDiscoverySpi spi = new TcpDiscoverySpi();
 
         spi.setIpFinder(ipFinder);
-        spi.setMaxMissedHeartbeats(Integer.MAX_VALUE);
 
+        cfg.setFailureDetectionTimeout(Integer.MAX_VALUE);
         cfg.setDiscoverySpi(spi);
 
         CacheConfiguration cacheCfg = defaultCacheConfiguration();

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSingleThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSingleThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSingleThreadedSelfTest.java
index 62e11a7..ef472a1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSingleThreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSingleThreadedSelfTest.java
@@ -63,8 +63,8 @@ public class GridCachePartitionedTxSingleThreadedSelfTest extends IgniteTxSingle
         TcpDiscoverySpi spi = new TcpDiscoverySpi();
 
         spi.setIpFinder(ipFinder);
-        spi.setMaxMissedHeartbeats(Integer.MAX_VALUE);
 
+        c.setFailureDetectionTimeout(Integer.MAX_VALUE);
         c.setDiscoverySpi(spi);
 
         c.setCacheConfiguration(cc);

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java
index 62adb77..7349a4e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/IndexingSpiQuerySelfTest.java
@@ -74,12 +74,12 @@ public class IndexingSpiQuerySelfTest extends TestCase {
         TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
         TcpDiscoverySpi disco = new TcpDiscoverySpi();
 
-        disco.setMaxMissedHeartbeats(Integer.MAX_VALUE);
-
         disco.setIpFinder(ipFinder);
 
         cfg.setDiscoverySpi(disco);
 
+        cfg.setFailureDetectionTimeout(Integer.MAX_VALUE);
+
         return cfg;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceClientNodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceClientNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceClientNodeTest.java
index 08f2709..1d6cbae 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceClientNodeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceClientNodeTest.java
@@ -42,10 +42,11 @@ public class GridServiceClientNodeTest extends GridCommonAbstractTest {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
-        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setMaxMissedClientHeartbeats(30);
-        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setHeartbeatFrequency(1000);
+
+        cfg.setClientFailureDetectionTimeout(30000);
 
         cfg.setClientMode(client);
+        cfg.setMetricsUpdateFrequency(1000);
 
         return cfg;
     }
@@ -150,4 +151,4 @@ public class GridServiceClientNodeTest extends GridCommonAbstractTest {
 
         assertTrue(latch.await(5000, TimeUnit.MILLISECONDS));
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesAbstractLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesAbstractLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesAbstractLoadTest.java
index 6fb7cdf..fedb4ac 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesAbstractLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesAbstractLoadTest.java
@@ -41,11 +41,6 @@ public abstract class GridSingleSplitsNewNodesAbstractLoadTest extends GridCommo
      */
     protected abstract DiscoverySpi getDiscoverySpi(IgniteConfiguration cfg);
 
-    /**
-     * @return Discovery spi heartbeat frequency.
-     */
-    protected abstract int getHeartbeatFrequency();
-
     /** {@inheritDoc} */
     @SuppressWarnings("ConstantConditions")
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
@@ -120,11 +115,11 @@ public abstract class GridSingleSplitsNewNodesAbstractLoadTest extends GridCommo
 
                                 startGrid(idx);
 
-                                Thread.sleep(getHeartbeatFrequency() * 3);
+                                Thread.sleep(grid(idx).configuration().getMetricsUpdateFrequency() * 3);
 
                                 stopGrid(idx);
 
-                                Thread.sleep(getHeartbeatFrequency() * 3);
+                                Thread.sleep(grid(idx).configuration().getMetricsUpdateFrequency() * 3);
                             }
                         }
                         catch (Throwable e) {
@@ -175,4 +170,4 @@ public abstract class GridSingleSplitsNewNodesAbstractLoadTest extends GridCommo
             G.stop(getTestIgniteInstanceName(), false);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesMulticastLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesMulticastLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesMulticastLoadTest.java
index 6d2c7aa..77142dc 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesMulticastLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/direct/newnodes/GridSingleSplitsNewNodesMulticastLoadTest.java
@@ -33,13 +33,6 @@ public class GridSingleSplitsNewNodesMulticastLoadTest extends GridSingleSplitsN
 
         assert discoSpi instanceof TcpDiscoverySpi : "Wrong default SPI implementation.";
 
-        ((TcpDiscoverySpi)discoSpi).setHeartbeatFrequency(getHeartbeatFrequency());
-
         return discoSpi;
     }
-
-    /** {@inheritDoc} */
-    @Override protected int getHeartbeatFrequency() {
-        return 3000;
-    }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/p2p/GridP2PSameClassLoaderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/p2p/GridP2PSameClassLoaderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/p2p/GridP2PSameClassLoaderSelfTest.java
index a126b4b..d2878e0 100644
--- a/modules/core/src/test/java/org/apache/ignite/p2p/GridP2PSameClassLoaderSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/p2p/GridP2PSameClassLoaderSelfTest.java
@@ -71,8 +71,8 @@ public class GridP2PSameClassLoaderSelfTest extends GridCommonAbstractTest {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
         cfg.setDeploymentMode(depMode);
+        cfg.setMetricsUpdateFrequency(500);
 
-        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setHeartbeatFrequency(500);
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(FINDER);
 
         cfg.setCacheConfiguration();

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
index daa3ec0..fa1a2ae 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
@@ -219,11 +219,11 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi> extends Gri
     }
 
     /**
-     * Tests whether local node heartbeats cause METRICS_UPDATE event.
+     * Tests whether local node metrics update cause METRICS_UPDATE event.
      *
      * @throws Exception If test failed.
      */
-    public void testLocalHeartbeat() throws Exception {
+    public void testLocalMetricsUpdate() throws Exception {
         AtomicInteger[] locUpdCnts = new AtomicInteger[getSpiCount()];
 
         int i = 0;
@@ -231,7 +231,7 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi> extends Gri
         for (final DiscoverySpi spi : spis) {
             final AtomicInteger spiCnt = new AtomicInteger(0);
 
-            DiscoverySpiListener locHeartbeatLsnr = new DiscoverySpiListener() {
+            DiscoverySpiListener locMetricsUpdateLsnr = new DiscoverySpiListener() {
                 /** {@inheritDoc} */
                 @Override public void onLocalNodeInitialized(ClusterNode locNode) {
                     // No-op.
@@ -249,17 +249,16 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi> extends Gri
 
             locUpdCnts[i] = spiCnt;
 
-            spi.setListener(locHeartbeatLsnr);
+            spi.setListener(locMetricsUpdateLsnr);
 
             i++;
         }
 
-        // Sleep fro 3 Heartbeats.
+        // Sleep for 3 metrics update.
         Thread.sleep(getMaxDiscoveryTime() * 3);
 
-        for (AtomicInteger cnt : locUpdCnts) {
-            assert cnt.get() > 1 : "One of the SPIs did not get at least 2 METRICS_UPDATE events from local node";
-        }
+        for (AtomicInteger cnt : locUpdCnts)
+            assertTrue("One of the SPIs did not get at least 2 METRICS_UPDATE events from local node", cnt.get() > 1);
     }
 
     /**
@@ -491,9 +490,9 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi> extends Gri
         }
 
         for (IgniteTestResources rscrs : spiRsrcs) {
-            MBeanServer mBeanServer = rscrs.getMBeanServer();
+            MBeanServer mBeanSrv = rscrs.getMBeanServer();
 
-            mBeanServer.unregisterMBean(new ObjectName(HTTP_ADAPTOR_MBEAN_NAME));
+            mBeanSrv.unregisterMBean(new ObjectName(HTTP_ADAPTOR_MBEAN_NAME));
 
             rscrs.stopThreads();
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.java
index a0545f5..689ac72 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiFailureTimeoutSelfTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.spi.discovery.tcp;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStream;
 import java.net.Socket;
 import java.net.SocketTimeoutException;
 import java.util.ArrayList;
@@ -28,15 +29,18 @@ import java.util.UUID;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.events.DiscoveryEvent;
 import org.apache.ignite.events.Event;
 import org.apache.ignite.internal.util.typedef.G;
 import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryPingRequest;
 import org.jetbrains.annotations.Nullable;
 
@@ -53,8 +57,14 @@ public class TcpClientDiscoverySpiFailureTimeoutSelfTest extends TcpClientDiscov
     private final static long FAILURE_THRESHOLD = 10_000;
 
     /** */
+    private final static long CLIENT_FAILURE_THRESHOLD = 30_000;
+
+    /** Failure detection timeout for nodes configuration. */
     private static long failureThreshold = FAILURE_THRESHOLD;
 
+    /** Client failure detection timeout for nodes configuration. */
+    private static long clientFailureThreshold = CLIENT_FAILURE_THRESHOLD;
+
     /** */
     private static boolean useTestSpi;
 
@@ -64,6 +74,11 @@ public class TcpClientDiscoverySpiFailureTimeoutSelfTest extends TcpClientDiscov
     }
 
     /** {@inheritDoc} */
+    @Override protected long clientFailureDetectionTimeout() {
+        return clientFailureThreshold;
+    }
+
+    /** {@inheritDoc} */
     @Override protected long failureDetectionTimeout() {
         return failureThreshold;
     }
@@ -74,6 +89,11 @@ public class TcpClientDiscoverySpiFailureTimeoutSelfTest extends TcpClientDiscov
     }
 
     /** {@inheritDoc} */
+    @Override protected long awaitClientTime() {
+        return clientFailureDetectionTimeout() + FAILURE_AWAIT_TIME;
+    }
+
+    /** {@inheritDoc} */
     @Override protected TcpDiscoverySpi getDiscoverySpi() {
         return useTestSpi ? new TestTcpDiscoverySpi2() : super.getDiscoverySpi();
     }
@@ -88,12 +108,12 @@ public class TcpClientDiscoverySpiFailureTimeoutSelfTest extends TcpClientDiscov
         checkNodes(1, 1);
 
         assertTrue(((TcpDiscoverySpi)(G.ignite("server-0").configuration().getDiscoverySpi())).
-                failureDetectionTimeoutEnabled());
+            failureDetectionTimeoutEnabled());
         assertEquals(failureDetectionTimeout(),
             ((TcpDiscoverySpi)(G.ignite("server-0").configuration().getDiscoverySpi())).failureDetectionTimeout());
 
         assertTrue(((TcpDiscoverySpi)(G.ignite("client-0").configuration().getDiscoverySpi())).
-                failureDetectionTimeoutEnabled());
+            failureDetectionTimeoutEnabled());
         assertEquals(failureDetectionTimeout(),
             ((TcpDiscoverySpi)(G.ignite("client-0").configuration().getDiscoverySpi())).failureDetectionTimeout());
     }
@@ -127,6 +147,123 @@ public class TcpClientDiscoverySpiFailureTimeoutSelfTest extends TcpClientDiscov
     }
 
     /**
+     * Test failure detection time between server and client if client fail with failure detection.
+     *
+     * @throws Exception in case of error.
+     */
+    public void testFailureTimeoutServerClient() throws Exception {
+        failureThreshold = 3000;
+        clientFailureThreshold = 2000;
+
+        try {
+            startServerNodes(1);
+
+            startClientNodes(1);
+
+            checkNodes(1, 1);
+
+            Ignite srvNode = G.ignite("server-0");
+            final TcpDiscoverySpi srvSpi = (TcpDiscoverySpi) srvNode.configuration().getDiscoverySpi();
+
+            Ignite clientNode = G.ignite("client-0");
+            final TcpDiscoverySpi clientSpi = (TcpDiscoverySpi)clientNode.configuration().getDiscoverySpi();
+
+            long failureTime = U.currentTimeMillis();
+
+            final long[] failureDetectTime = new long[1];
+            final CountDownLatch latch = new CountDownLatch(1);
+
+            clientSpi.simulateNodeFailure();
+
+            srvNode.events().localListen(new IgnitePredicate<Event>() {
+                @Override public boolean apply(Event evt) {
+                    failureDetectTime[0] = U.currentTimeMillis();
+
+                    latch.countDown();
+
+                    return true;
+                }
+            }, EVT_NODE_FAILED);
+
+            assertTrue("Can't get node failure event", latch.await(15000, TimeUnit.MILLISECONDS));
+
+            long detectTime = failureDetectTime[0] - failureTime;
+
+            assertTrue("Client node failure detected too fast: " + detectTime + "ms",
+                detectTime > clientFailureThreshold - 200);
+            assertTrue("Client node failure detected too slow:  " + detectTime + "ms",
+                detectTime < clientFailureThreshold + 5000);
+        }
+        finally {
+            failureThreshold = FAILURE_THRESHOLD;
+            clientFailureThreshold = CLIENT_FAILURE_THRESHOLD;
+        }
+    }
+
+    /**
+     * Test failure detection time between servers with failure detection.
+     *
+     * @throws Exception in case of error.
+     */
+    public void testFailureTimeout3Server() throws Exception {
+        failureThreshold = 1000;
+        clientFailureThreshold = 10000;
+        useTestSpi = true;
+
+        try {
+            startServerNodes(3);
+
+            checkNodes(3, 0);
+
+            Ignite srv0 = G.ignite("server-0");
+            final TestTcpDiscoverySpi2 spi0 = (TestTcpDiscoverySpi2)srv0.configuration().getDiscoverySpi();
+
+            final Ignite srv1 = G.ignite("server-1");
+            final TestTcpDiscoverySpi2 spi1 = (TestTcpDiscoverySpi2)srv1.configuration().getDiscoverySpi();
+
+            Ignite srv2 = G.ignite("server-2");
+            final TestTcpDiscoverySpi2 spi2 = (TestTcpDiscoverySpi2)srv2.configuration().getDiscoverySpi();
+
+            long failureTime = U.currentTimeMillis();
+
+            final AtomicLong failureDetectTime = new AtomicLong();
+            final CountDownLatch latch = new CountDownLatch(2);
+
+            spi1.writeToSocketDelay = 2000;
+
+            for (Ignite srv : new Ignite[]{srv0, srv2}) {
+                srv.events().localListen(new IgnitePredicate<Event>() {
+                    @Override public boolean apply(Event evt) {
+                        DiscoveryEvent evt0 = (DiscoveryEvent)evt;
+
+                        assertEquals(srv1.cluster().localNode().id(), evt0.eventNode().id());
+
+                        failureDetectTime.compareAndSet(0, U.currentTimeMillis());
+
+                        latch.countDown();
+
+                        return true;
+                    }
+                }, EVT_NODE_FAILED);
+            }
+
+            assertTrue("Can't get node failure event", latch.await(15000, TimeUnit.MILLISECONDS));
+
+            long detectTime = failureDetectTime.get() - failureTime;
+
+            assertTrue("Server node failure detected too fast: " + detectTime + "ms",
+                detectTime > failureThreshold - 100);
+            assertTrue("Server node failure detected too slow:  " + detectTime + "ms",
+                detectTime < clientFailureThreshold);
+        }
+        finally {
+            failureThreshold = FAILURE_THRESHOLD;
+            clientFailureThreshold = CLIENT_FAILURE_THRESHOLD;
+            useTestSpi = false;
+        }
+    }
+
+    /**
      * @throws Exception in case of error.
      */
     private void checkFailureThresholdWorkability() throws Exception {
@@ -288,15 +425,114 @@ public class TcpClientDiscoverySpiFailureTimeoutSelfTest extends TcpClientDiscov
      */
     private static class TestTcpDiscoverySpi2 extends TcpDiscoverySpi {
         /** */
-        private long readDelay;
+        private volatile long readDelay;
+
+        private volatile long writeToSocketDelay;
 
         /** */
         private Exception err;
 
+        /**  */
+        @Override protected void writeToSocket(
+            Socket sock,
+            TcpDiscoveryAbstractMessage msg,
+            byte[] data,
+            long timeout
+        ) throws IOException {
+            if (writeToSocketDelay > 0) {
+                try {
+                    U.dumpStack(log, "Before sleep [msg=" + msg +
+                        ", arrLen=" + (data != null ? data.length : "n/a") + ']');
+
+                    Thread.sleep(writeToSocketDelay);
+                }
+                catch (InterruptedException e) {
+                    // Nothing to do.
+                }
+            }
+
+            if (sock.getSoTimeout() >= writeToSocketDelay)
+                super.writeToSocket(sock, msg, data, timeout);
+            else
+                throw new SocketTimeoutException("Write to socket delay timeout exception.");
+        }
+
+        /**  */
+        @Override protected void writeToSocket(Socket sock,
+            OutputStream out,
+            TcpDiscoveryAbstractMessage msg,
+            long timeout) throws IOException, IgniteCheckedException {
+            if (writeToSocketDelay > 0) {
+                try {
+                    U.dumpStack(log, "Before sleep [msg=" + msg + ']');
+
+                    Thread.sleep(writeToSocketDelay);
+                }
+                catch (InterruptedException e) {
+                    // Nothing to do.
+                }
+            }
+
+            if (sock.getSoTimeout() >= writeToSocketDelay)
+                super.writeToSocket(sock, out, msg, timeout);
+            else
+                throw new SocketTimeoutException("Write to socket delay timeout exception.");
+        }
+
+        /**  */
+        @Override protected void writeToSocket(
+            Socket sock,
+            TcpDiscoveryAbstractMessage msg,
+            long timeout
+        ) throws IOException, IgniteCheckedException {
+            if (writeToSocketDelay > 0) {
+                try {
+                    U.dumpStack(log, "Before sleep [msg=" + msg + ']');
+
+                    Thread.sleep(writeToSocketDelay);
+                }
+                catch (InterruptedException e) {
+                    // Nothing to do.
+                }
+            }
+
+            if (sock.getSoTimeout() >= writeToSocketDelay)
+                super.writeToSocket(sock, msg, timeout);
+            else
+                throw new SocketTimeoutException("Write to socket delay timeout exception.");
+        }
+
+        /**  */
+        @Override protected void writeToSocket(
+            TcpDiscoveryAbstractMessage msg,
+            Socket sock,
+            int res,
+            long timeout
+        ) throws IOException {
+            if (writeToSocketDelay > 0) {
+                try {
+                    U.dumpStack(log, "Before sleep [msg=" + msg + ']');
+
+                    Thread.sleep(writeToSocketDelay);
+                }
+                catch (InterruptedException e) {
+                    // Nothing to do.
+                }
+            }
+
+            if (sock.getSoTimeout() >= writeToSocketDelay)
+                super.writeToSocket(msg, sock, res, timeout);
+            else
+                throw new SocketTimeoutException("Write to socket delay timeout exception.");
+        }
+
         /** {@inheritDoc} */
         @Override protected <T> T readMessage(Socket sock, @Nullable InputStream in, long timeout)
             throws IOException, IgniteCheckedException {
-            if (readDelay < failureDetectionTimeout()) {
+            long currTimeout = getLocalNode().isClient() ?
+                clientFailureDetectionTimeout() : failureDetectionTimeout();
+
+            if (readDelay < currTimeout) {
                 try {
                     return super.readMessage(sock, in, timeout);
                 }
@@ -329,6 +565,7 @@ public class TcpClientDiscoverySpiFailureTimeoutSelfTest extends TcpClientDiscov
          */
         private void reset() {
             readDelay = 0;
+            writeToSocketDelay = 0;
             err = null;
         }
     }


[41/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMissingCommitVersionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMissingCommitVersionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMissingCommitVersionSelfTest.java
index f3d2434..a6f2022 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMissingCommitVersionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMissingCommitVersionSelfTest.java
@@ -65,7 +65,7 @@ public class GridCacheMissingCommitVersionSelfTest extends GridCommonAbstractTes
 
         cfg.setDiscoverySpi(discoSpi);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMixedPartitionExchangeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMixedPartitionExchangeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMixedPartitionExchangeSelfTest.java
index 91a1e67..f6f4751 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMixedPartitionExchangeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMixedPartitionExchangeSelfTest.java
@@ -105,7 +105,7 @@ public class GridCacheMixedPartitionExchangeSelfTest extends GridCommonAbstractT
 
                         int key = rnd.nextInt(keys);
 
-                        IgniteCache<Integer, Integer> prj = grid(g).cache(null);
+                        IgniteCache<Integer, Integer> prj = grid(g).cache(DEFAULT_CACHE_NAME);
 
                         try {
                             try (Transaction tx = grid(g).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
@@ -157,7 +157,7 @@ public class GridCacheMixedPartitionExchangeSelfTest extends GridCommonAbstractT
             for (int i = 0; i < 4; i++) {
                 IgniteKernal grid = (IgniteKernal)grid(i);
 
-                GridCacheContext<Object, Object> cctx = grid.internalCache(null).context();
+                GridCacheContext<Object, Object> cctx = grid.internalCache(DEFAULT_CACHE_NAME).context();
 
                 IgniteInternalFuture<AffinityTopologyVersion> verFut = cctx.affinity().affinityReadyFuture(topVer);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultiUpdateLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultiUpdateLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultiUpdateLockSelfTest.java
index 9cff139..367d8ac 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultiUpdateLockSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultiUpdateLockSelfTest.java
@@ -112,7 +112,7 @@ public class GridCacheMultiUpdateLockSelfTest extends GridCommonAbstractTest {
         try {
             IgniteKernal g = (IgniteKernal)grid(0);
 
-            GridCacheContext<Object, Object> cctx = g.internalCache().context();
+            GridCacheContext<Object, Object> cctx = g.internalCache(DEFAULT_CACHE_NAME).context();
 
             GridDhtCacheAdapter cache = nearEnabled ? cctx.near().dht() : cctx.colocated();
 
@@ -133,7 +133,7 @@ public class GridCacheMultiUpdateLockSelfTest extends GridCommonAbstractTest {
 
                         started.set(true);
 
-                        IgniteCache<Object, Object> c = g4.cache(null);
+                        IgniteCache<Object, Object> c = g4.cache(DEFAULT_CACHE_NAME);
 
                         info(">>>> Checking tx in new grid.");
 
@@ -154,7 +154,7 @@ public class GridCacheMultiUpdateLockSelfTest extends GridCommonAbstractTest {
                 assertFalse(started.get());
 
                 // Check we can proceed with transactions.
-                IgniteCache<Object, Object> cache0 = g.cache(null);
+                IgniteCache<Object, Object> cache0 = g.cache(DEFAULT_CACHE_NAME);
 
                 info(">>>> Checking tx commit.");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java
index e11afb2..800f4ba 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateAbstractSelfTest.java
@@ -75,7 +75,7 @@ public abstract class GridCacheMultinodeUpdateAbstractSelfTest extends GridCache
      * @throws Exception If failed.
      */
     public void testInvoke() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         final Integer key = primaryKey(cache);
 
@@ -95,7 +95,7 @@ public abstract class GridCacheMultinodeUpdateAbstractSelfTest extends GridCache
                 @Override public Void call() throws Exception {
                     int idx = gridIdx.incrementAndGet() - 1;
 
-                    final IgniteCache<Integer, Integer> cache = grid(idx).cache(null);
+                    final IgniteCache<Integer, Integer> cache = grid(idx).cache(DEFAULT_CACHE_NAME);
 
                     for (int i = 0; i < ITERATIONS_PER_THREAD && !failed; i++)
                         cache.invoke(key, new IncProcessor());
@@ -109,7 +109,7 @@ public abstract class GridCacheMultinodeUpdateAbstractSelfTest extends GridCache
             expVal += ITERATIONS_PER_THREAD * THREADS;
 
             for (int j = 0; j < gridCount(); j++) {
-                Integer val = (Integer)grid(j).cache(null).get(key);
+                Integer val = (Integer)grid(j).cache(DEFAULT_CACHE_NAME).get(key);
 
                 assertEquals("Unexpected value for grid " + j, expVal, val);
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccFlagsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccFlagsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccFlagsTest.java
index 827b0a5..c6b797a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccFlagsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccFlagsTest.java
@@ -67,7 +67,7 @@ public class GridCacheMvccFlagsTest extends GridCommonAbstractTest {
      *
      */
     public void testAllTrueFlags() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -108,7 +108,7 @@ public class GridCacheMvccFlagsTest extends GridCommonAbstractTest {
      *
      */
     public void testAllFalseFlags() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManagerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManagerSelfTest.java
index 957828c..993a1cf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManagerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManagerSelfTest.java
@@ -101,7 +101,7 @@ public class GridCacheMvccManagerSelfTest extends GridCommonAbstractTest {
         try {
             Ignite ignite = startGridsMultiThreaded(gridCnt);
 
-            IgniteCache<Integer, Integer> cache = ignite.cache(null);
+            IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             Transaction tx = ignite.transactions().txStart();
 
@@ -110,8 +110,8 @@ public class GridCacheMvccManagerSelfTest extends GridCommonAbstractTest {
             tx.commit();
 
             for (int i = 0; i < gridCnt; i++) {
-                assert ((IgniteKernal)grid(i)).internalCache().context().mvcc().localCandidates().isEmpty();
-                assert ((IgniteKernal)grid(i)).internalCache().context().mvcc().remoteCandidates().isEmpty();
+                assert ((IgniteKernal)grid(i)).internalCache(DEFAULT_CACHE_NAME).context().mvcc().localCandidates().isEmpty();
+                assert ((IgniteKernal)grid(i)).internalCache(DEFAULT_CACHE_NAME).context().mvcc().remoteCandidates().isEmpty();
             }
         }
         finally {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccPartitionedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccPartitionedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccPartitionedSelfTest.java
index 0c53fee..119002c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccPartitionedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccPartitionedSelfTest.java
@@ -89,7 +89,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
      * Tests remote candidates.
      */
     public void testNearLocalsWithPending() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -123,7 +123,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
      * Tests remote candidates.
      */
     public void testNearLocalsWithCommitted() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -156,7 +156,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
      * Tests remote candidates.
      */
     public void testNearLocalsWithRolledback() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -189,7 +189,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
      * Tests remote candidates.
      */
     public void testNearLocals() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -219,7 +219,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
      * Tests remote candidates.
      */
     public void testNearLocalsWithOwned() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -258,7 +258,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testAddPendingRemote0() throws Exception {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -290,7 +290,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testAddPendingRemote1() throws Exception {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -333,7 +333,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testAddPendingRemote2() throws Exception {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -377,7 +377,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
      * Tests salvageRemote method
      */
     public void testSalvageRemote() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -435,7 +435,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testNearRemoteConsistentOrdering0() throws Exception {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -473,7 +473,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testNearRemoteConsistentOrdering1() throws Exception {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -518,7 +518,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testNearRemoteConsistentOrdering2() throws Exception {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -563,7 +563,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testNearRemoteConsistentOrdering3() throws Exception {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -602,7 +602,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testSerializableReadLocksAdd() throws Exception {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheVersion serOrder1 = new GridCacheVersion(0, 10, 1);
         GridCacheVersion serOrder2 = new GridCacheVersion(0, 20, 1);
@@ -679,7 +679,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testSerializableReadLocksAssign() throws Exception {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheVersion serOrder1 = new GridCacheVersion(0, 10, 1);
         GridCacheVersion serOrder2 = new GridCacheVersion(0, 20, 1);
@@ -829,7 +829,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     private void checkNonSerializableConflict() throws Exception {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         UUID nodeId = UUID.randomUUID();
 
@@ -875,7 +875,7 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     private void checkSerializableAdd(boolean incVer) throws Exception {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         UUID nodeId = UUID.randomUUID();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java
index e15a20f..6f52cce 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java
@@ -84,7 +84,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testMarshalUnmarshalCandidate() throws Exception {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx parent = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -116,7 +116,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      * Tests remote candidates.
      */
     public void testRemotes() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -267,7 +267,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      * Tests that orderOwned does not reorder owned locks.
      */
     public void testNearRemoteWithOwned() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -309,7 +309,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      * Tests that orderOwned does not reorder owned locks.
      */
     public void testNearRemoteWithOwned1() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -355,7 +355,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      * Tests that orderOwned does not reorder owned locks.
      */
     public void testNearRemoteWithOwned2() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -403,7 +403,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      * Tests remote candidates.
      */
     public void testLocal() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -477,7 +477,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      * Tests assignment of local candidates when remote exist.
      */
     public void testLocalWithRemote() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -513,7 +513,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      *
      */
     public void testCompletedWithBaseInTheMiddle() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -566,7 +566,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      *
      */
     public void testCompletedWithCompletedBaseInTheMiddle() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -608,7 +608,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      *
      */
     public void testCompletedTwiceWithBaseInTheMiddle() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -654,7 +654,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      *
      */
     public void testCompletedWithBaseInTheMiddleNoChange() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -693,7 +693,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      *
      */
     public void testCompletedWithBaseInTheBeginning() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -735,7 +735,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      * This case should never happen, nevertheless we need to test for it.
      */
     public void testCompletedWithBaseInTheBeginningNoChange() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -774,7 +774,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      * This case should never happen, nevertheless we need to test for it.
      */
     public void testCompletedWithBaseInTheEndNoChange() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -813,7 +813,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      *
      */
     public void testCompletedWithBaseNotPresentInTheMiddle() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -854,7 +854,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      *
      */
     public void testCompletedWithBaseNotPresentInTheMiddleNoChange() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -889,7 +889,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      *
      */
     public void testCompletedWithBaseNotPresentInTheBeginning() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -930,7 +930,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      *
      */
     public void testCompletedWithBaseNotPresentInTheBeginningNoChange() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -971,7 +971,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      *
      */
     public void testCompletedWithBaseNotPresentInTheEndNoChange() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -1008,7 +1008,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      * Test local and remote candidates together.
      */
     public void testLocalAndRemote() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
 
@@ -1136,7 +1136,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
     public void testMultipleLocalAndRemoteLocks1() throws Exception {
         UUID nodeId = UUID.randomUUID();
 
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheContext<String, String> ctx = cache.context();
 
@@ -1207,7 +1207,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      * @throws Exception If test failed.
      */
     public void testMultipleLocalAndRemoteLocks2() throws Exception {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheContext<String, String> ctx = cache.context();
 
@@ -1294,7 +1294,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      * @throws Exception If test failed.
      */
     public void testMultipleLocalLocks() throws Exception {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheContext<String, String> ctx = cache.context();
 
@@ -1335,7 +1335,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      */
     @SuppressWarnings({"ObjectEquality"})
     public void testUsedCandidates() throws Exception {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheContext<String, String> ctx = cache.context();
 
@@ -1402,7 +1402,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
     public void testReverseOrder1() {
         UUID id = UUID.randomUUID();
 
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheContext<String, String> ctx = cache.context();
 
@@ -1455,7 +1455,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
     public void testReverseOrder2() throws Exception {
         UUID id = UUID.randomUUID();
 
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheContext<String, String> ctx = cache.context();
 
@@ -1515,7 +1515,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testReverseOrder3() throws Exception {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheContext<String, String> ctx = cache.context();
 
@@ -1565,7 +1565,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
     public void testReverseOrder4() throws Exception {
         UUID id = UUID.randomUUID();
 
-        GridCacheAdapter<String, String> cache = grid.internalCache();
+        GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
         GridCacheContext<String, String> ctx = cache.context();
 
@@ -1634,7 +1634,7 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
         multithreaded(new Runnable() {
             @Override public void run() {
                 for (GridCacheMvccCandidate cand : cands) {
-                    boolean b = grid.<String, String>internalCache().context().mvcc().addNext(ctx, cand);
+                    boolean b = grid.<String, String>internalCache(DEFAULT_CACHE_NAME).context().mvcc().addNext(ctx, cand);
 
                     assert b;
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheNestedTxAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheNestedTxAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheNestedTxAbstractTest.java
index 3bee4d7..e93fd1e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheNestedTxAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheNestedTxAbstractTest.java
@@ -91,9 +91,9 @@ public class GridCacheNestedTxAbstractTest extends GridCommonAbstractTest {
         super.afterTest();
 
         for (int i = 0; i < GRID_CNT; i++) {
-            grid(i).cache(null).removeAll();
+            grid(i).cache(DEFAULT_CACHE_NAME).removeAll();
 
-            assert grid(i).cache(null).localSize() == 0;
+            assert grid(i).cache(DEFAULT_CACHE_NAME).localSize() == 0;
         }
     }
 
@@ -111,7 +111,7 @@ public class GridCacheNestedTxAbstractTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testTwoTx() throws Exception {
-        final IgniteCache<String, Integer> c = grid(0).cache(null);
+        final IgniteCache<String, Integer> c = grid(0).cache(DEFAULT_CACHE_NAME);
 
         GridKernalContext ctx = ((IgniteKernal)grid(0)).context();
 
@@ -142,7 +142,7 @@ public class GridCacheNestedTxAbstractTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testLockAndTx() throws Exception {
-        final IgniteCache<String, Integer> c = grid(0).cache(null);
+        final IgniteCache<String, Integer> c = grid(0).cache(DEFAULT_CACHE_NAME);
 
         Collection<Thread> threads = new LinkedList<>();
 
@@ -218,9 +218,9 @@ public class GridCacheNestedTxAbstractTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testLockAndTx1() throws Exception {
-        final IgniteCache<String, Integer> c = grid(0).cache(null);
+        final IgniteCache<String, Integer> c = grid(0).cache(DEFAULT_CACHE_NAME);
 
-        final IgniteCache<Integer, Integer> c1 = grid(0).cache(null);
+        final IgniteCache<Integer, Integer> c1 = grid(0).cache(DEFAULT_CACHE_NAME);
 
         Collection<Thread> threads = new LinkedList<>();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheObjectToStringSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheObjectToStringSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheObjectToStringSelfTest.java
index 54a3aa9..33b7033 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheObjectToStringSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheObjectToStringSelfTest.java
@@ -157,13 +157,13 @@ public class GridCacheObjectToStringSelfTest extends GridCommonAbstractTest {
         Ignite g = startGrid(0);
 
         try {
-            IgniteCache<Object, Object> cache = g.cache(null);
+            IgniteCache<Object, Object> cache = g.cache(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < 10; i++)
                 cache.put(i, i);
 
             for (int i = 0; i < 10; i++) {
-                GridCacheEntryEx entry = ((IgniteKernal)g).context().cache().internalCache().peekEx(i);
+                GridCacheEntryEx entry = ((IgniteKernal)g).context().cache().internalCache(DEFAULT_CACHE_NAME).peekEx(i);
 
                 if (entry != null)
                     assertFalse("Entry is locked after implicit transaction commit: " + entry, entry.lockedByAny());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest.java
index 469f662..afc41ff 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest.java
@@ -46,7 +46,7 @@ public abstract class GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest extend
 
     /** {@inheritDoc} */
     @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(atomicityMode());
         ccfg.setCacheMode(PARTITIONED);
@@ -83,7 +83,7 @@ public abstract class GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest extend
      * @throws Exception If failed.
      */
     private void testTransform(final Integer key) throws Exception {
-        final IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        final IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.put(key, 0);
 
@@ -104,7 +104,7 @@ public abstract class GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest extend
         }, THREADS, "transform");
 
         for (int i = 0; i < gridCount(); i++) {
-            Integer val = (Integer)grid(i).cache(null).get(key);
+            Integer val = (Integer)grid(i).cache(DEFAULT_CACHE_NAME).get(key);
 
             assertEquals("Unexpected value for grid " + i, (Integer)(ITERATIONS_PER_THREAD * THREADS), val);
         }
@@ -127,7 +127,7 @@ public abstract class GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest extend
      * @throws Exception If failed.
      */
     private void testPut(final Integer key) throws Exception {
-        final IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        final IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.put(key, 0);
 
@@ -150,7 +150,7 @@ public abstract class GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest extend
         }, THREADS, "put");
 
         for (int i = 0; i < gridCount(); i++) {
-            Integer val = (Integer)grid(i).cache(null).get(key);
+            Integer val = (Integer)grid(i).cache(DEFAULT_CACHE_NAME).get(key);
 
             assertNotNull("Unexpected value for grid " + i, val);
         }
@@ -173,7 +173,7 @@ public abstract class GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest extend
      * @throws Exception If failed.
      */
     private void testPutxIfAbsent(final Integer key) throws Exception {
-        final IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        final IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.put(key, 0);
 
@@ -194,7 +194,7 @@ public abstract class GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest extend
         }, THREADS, "putxIfAbsent");
 
         for (int i = 0; i < gridCount(); i++) {
-            Integer val = (Integer)grid(i).cache(null).get(key);
+            Integer val = (Integer)grid(i).cache(DEFAULT_CACHE_NAME).get(key);
 
             assertEquals("Unexpected value for grid " + i, (Integer)0, val);
         }
@@ -217,7 +217,7 @@ public abstract class GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest extend
      * @throws Exception If failed.
      */
     private void testPutGet(final Integer key) throws Exception {
-        final IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        final IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.put(key, 0);
 
@@ -266,7 +266,7 @@ public abstract class GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest extend
         getFut.get();
 
         for (int i = 0; i < gridCount(); i++) {
-            Integer val = (Integer)grid(i).cache(null).get(key);
+            Integer val = (Integer)grid(i).cache(DEFAULT_CACHE_NAME).get(key);
 
             assertNotNull("Unexpected value for grid " + i, val);
         }
@@ -280,7 +280,7 @@ public abstract class GridCacheOffHeapMultiThreadedUpdateAbstractSelfTest extend
         Integer key0 = null;
 
         for (int i = 0; i < 10_000; i++) {
-            if (grid(0).affinity(null).isPrimary(grid(idx).localNode(), i)) {
+            if (grid(0).affinity(DEFAULT_CACHE_NAME).isPrimary(grid(idx).localNode(), i)) {
                 key0 = i;
 
                 break;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateSelfTest.java
index 6e2e91f..40e2e23 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapMultiThreadedUpdateSelfTest.java
@@ -63,7 +63,7 @@ public class GridCacheOffHeapMultiThreadedUpdateSelfTest extends GridCacheOffHea
      * @throws Exception If failed.
      */
     private void testTransformTx(final Integer key, final TransactionConcurrency txConcurrency) throws Exception {
-        final IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        final IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.put(key, 0);
 
@@ -90,7 +90,7 @@ public class GridCacheOffHeapMultiThreadedUpdateSelfTest extends GridCacheOffHea
         }, THREADS, "transform");
 
         for (int i = 0; i < gridCount(); i++) {
-            Integer val = (Integer)grid(i).cache(null).get(key);
+            Integer val = (Integer)grid(i).cache(DEFAULT_CACHE_NAME).get(key);
 
             if (txConcurrency == PESSIMISTIC)
                 assertEquals("Unexpected value for grid " + i, (Integer)(ITERATIONS_PER_THREAD * THREADS), val);
@@ -100,7 +100,7 @@ public class GridCacheOffHeapMultiThreadedUpdateSelfTest extends GridCacheOffHea
 
         if (failed) {
             for (int g = 0; g < gridCount(); g++)
-                info("Value for cache [g=" + g + ", val=" + grid(g).cache(null).get(key) + ']');
+                info("Value for cache [g=" + g + ", val=" + grid(g).cache(DEFAULT_CACHE_NAME).get(key) + ']');
 
             assertFalse(failed);
         }
@@ -134,7 +134,7 @@ public class GridCacheOffHeapMultiThreadedUpdateSelfTest extends GridCacheOffHea
      * @throws Exception If failed.
      */
     private void testPutTx(final Integer key, final TransactionConcurrency txConcurrency) throws Exception {
-        final IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        final IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.put(key, 0);
 
@@ -161,7 +161,7 @@ public class GridCacheOffHeapMultiThreadedUpdateSelfTest extends GridCacheOffHea
         }, THREADS, "put");
 
         for (int i = 0; i < gridCount(); i++) {
-            Integer val = (Integer)grid(i).cache(null).get(key);
+            Integer val = (Integer)grid(i).cache(DEFAULT_CACHE_NAME).get(key);
 
             assertNotNull("Unexpected value for grid " + i, val);
         }
@@ -195,7 +195,7 @@ public class GridCacheOffHeapMultiThreadedUpdateSelfTest extends GridCacheOffHea
      * @throws Exception If failed.
      */
     private void testPutxIfAbsentTx(final Integer key, final TransactionConcurrency txConcurrency) throws Exception {
-        final IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        final IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.put(key, 0);
 
@@ -220,7 +220,7 @@ public class GridCacheOffHeapMultiThreadedUpdateSelfTest extends GridCacheOffHea
         }, THREADS, "putxIfAbsent");
 
         for (int i = 0; i < gridCount(); i++) {
-            Integer val = (Integer)grid(i).cache(null).get(key);
+            Integer val = (Integer)grid(i).cache(DEFAULT_CACHE_NAME).get(key);
 
             assertEquals("Unexpected value for grid " + i, (Integer)0, val);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapUpdateSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapUpdateSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapUpdateSelfTest.java
index 2b82407..b8f6858 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapUpdateSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffheapUpdateSelfTest.java
@@ -42,7 +42,7 @@ public class GridCacheOffheapUpdateSelfTest extends GridCommonAbstractTest {
 
         cfg.setPeerClassLoadingEnabled(false);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(CacheMode.PARTITIONED);
         ccfg.setNearConfiguration(null);
@@ -60,14 +60,14 @@ public class GridCacheOffheapUpdateSelfTest extends GridCommonAbstractTest {
         try {
             Ignite ignite = startGrids(2);
 
-            IgniteCache<Object, Object> rmtCache = ignite.cache(null);
+            IgniteCache<Object, Object> rmtCache = ignite.cache(DEFAULT_CACHE_NAME);
 
             int key = 0;
 
-            while (!ignite.affinity(null).isPrimary(grid(1).localNode(), key))
+            while (!ignite.affinity(DEFAULT_CACHE_NAME).isPrimary(grid(1).localNode(), key))
                 key++;
 
-            IgniteCache<Object, Object> locCache = grid(1).cache(null);
+            IgniteCache<Object, Object> locCache = grid(1).cache(DEFAULT_CACHE_NAME);
 
             try (Transaction tx = grid(1).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
                 locCache.putIfAbsent(key, 0);
@@ -103,7 +103,7 @@ public class GridCacheOffheapUpdateSelfTest extends GridCommonAbstractTest {
         try {
             Ignite grid = startGrid(0);
 
-            IgniteCache<Object, Object> cache = grid.cache(null);
+            IgniteCache<Object, Object> cache = grid.cache(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < 30; i++)
                 cache.put(i, 0);
@@ -113,7 +113,7 @@ public class GridCacheOffheapUpdateSelfTest extends GridCommonAbstractTest {
             awaitPartitionMapExchange();
 
             for (int i = 0; i < 30; i++)
-                grid(1).cache(null).put(i, 10);
+                grid(1).cache(DEFAULT_CACHE_NAME).put(i, 10);
 
             // Find a key that does not belong to started node anymore.
             int key = 0;
@@ -121,7 +121,7 @@ public class GridCacheOffheapUpdateSelfTest extends GridCommonAbstractTest {
             ClusterNode locNode = grid.cluster().localNode();
 
             for (;key < 30; key++) {
-                if (!grid.affinity(null).isPrimary(locNode, key) && !grid.affinity(null).isBackup(locNode, key))
+                if (!grid.affinity(DEFAULT_CACHE_NAME).isPrimary(locNode, key) && !grid.affinity(DEFAULT_CACHE_NAME).isBackup(locNode, key))
                     break;
             }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedGetSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedGetSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedGetSelfTest.java
index 81f22d1..308f2b4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedGetSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedGetSelfTest.java
@@ -116,9 +116,9 @@ public class GridCachePartitionedGetSelfTest extends GridCommonAbstractTest {
      */
     public void testGetFromPrimaryNode() throws Exception {
         for (int i = 0; i < GRID_CNT; i++) {
-            IgniteCache<String, Integer> c = grid(i).cache(null);
+            IgniteCache<String, Integer> c = grid(i).cache(DEFAULT_CACHE_NAME);
 
-            if (grid(i).affinity(null).isPrimary(grid(i).localNode(), KEY)) {
+            if (grid(i).affinity(DEFAULT_CACHE_NAME).isPrimary(grid(i).localNode(), KEY)) {
                 info("Primary node: " + grid(i).localNode().id());
 
                 c.get(KEY);
@@ -135,9 +135,9 @@ public class GridCachePartitionedGetSelfTest extends GridCommonAbstractTest {
      */
     public void testGetFromBackupNode() throws Exception {
         for (int i = 0; i < GRID_CNT; i++) {
-            IgniteCache<String, Integer> c = grid(i).cache(null);
+            IgniteCache<String, Integer> c = grid(i).cache(DEFAULT_CACHE_NAME);
 
-            if (grid(i).affinity(null).isBackup(grid(i).localNode(), KEY)) {
+            if (grid(i).affinity(DEFAULT_CACHE_NAME).isBackup(grid(i).localNode(), KEY)) {
                 info("Backup node: " + grid(i).localNode().id());
 
                 Integer val = c.get(KEY);
@@ -166,9 +166,9 @@ public class GridCachePartitionedGetSelfTest extends GridCommonAbstractTest {
      */
     public void testGetFromNearNode() throws Exception {
         for (int i = 0; i < GRID_CNT; i++) {
-            IgniteCache<String, Integer> c = grid(i).cache(null);
+            IgniteCache<String, Integer> c = grid(i).cache(DEFAULT_CACHE_NAME);
 
-            if (!grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), KEY)) {
+            if (!grid(i).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid(i).localNode(), KEY)) {
                 info("Near node: " + grid(i).localNode().id());
 
                 Integer val = c.get(KEY);
@@ -214,11 +214,11 @@ public class GridCachePartitionedGetSelfTest extends GridCommonAbstractTest {
         for (int i = 0; i < GRID_CNT; i++) {
             Ignite g = grid(i);
 
-            if (grid(i).affinity(null).isPrimary(grid(i).localNode(), KEY)) {
+            if (grid(i).affinity(DEFAULT_CACHE_NAME).isPrimary(grid(i).localNode(), KEY)) {
                 info("Primary node: " + g.cluster().localNode().id());
 
                 // Put value.
-                g.cache(null).put(KEY, VAL);
+                g.cache(DEFAULT_CACHE_NAME).put(KEY, VAL);
 
                 // Register listener.
                 ((IgniteKernal)g).context().io().addMessageListener(

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedProjectionAffinitySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedProjectionAffinitySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedProjectionAffinitySelfTest.java
index a0be3a4..7f589fe 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedProjectionAffinitySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePartitionedProjectionAffinitySelfTest.java
@@ -88,7 +88,7 @@ public class GridCachePartitionedProjectionAffinitySelfTest extends GridCommonAb
         Ignite g1 = grid(1);
 
         for (int i = 0; i < 100; i++)
-            assertEquals(g0.affinity(null).mapKeyToNode(i).id(), g1.affinity(null).mapKeyToNode(i).id());
+            assertEquals(g0.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(i).id(), g1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(i).id());
     }
 
     /** @throws Exception If failed. */
@@ -105,13 +105,13 @@ public class GridCachePartitionedProjectionAffinitySelfTest extends GridCommonAb
             g1.cluster().forNodeIds(F.asList(g0.cluster().localNode().id(), g1.cluster().localNode().id()));
 
         for (int i = 0; i < 100; i++)
-            assertEquals(g0Pinned.ignite().affinity(null).mapKeyToNode(i).id(),
-                g01Pinned.ignite().affinity(null).mapKeyToNode(i).id());
+            assertEquals(g0Pinned.ignite().affinity(DEFAULT_CACHE_NAME).mapKeyToNode(i).id(),
+                g01Pinned.ignite().affinity(DEFAULT_CACHE_NAME).mapKeyToNode(i).id());
     }
 
     /** @throws Exception If failed. */
     @SuppressWarnings("BusyWait")
     private void waitTopologyUpdate() throws Exception {
-        GridTestUtils.waitTopologyUpdate(null, BACKUPS, log());
+        GridTestUtils.waitTopologyUpdate(DEFAULT_CACHE_NAME, BACKUPS, log());
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
index 02023ff..f134852 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePreloadingEvictionsSelfTest.java
@@ -105,7 +105,7 @@ public class GridCachePreloadingEvictionsSelfTest extends GridCommonAbstractTest
         try {
             final Ignite ignite1 = startGrid(1);
 
-            final IgniteCache<Integer, Object> cache1 = ignite1.cache(null);
+            final IgniteCache<Integer, Object> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < 5000; i++)
                 cache1.put(i, VALUE + i);
@@ -129,7 +129,7 @@ public class GridCachePreloadingEvictionsSelfTest extends GridCommonAbstractTest
                             Cache.Entry<Integer, Object> entry = cache1.getEntry(i);
 
                             if (entry != null)
-                                ignite1.cache(null).localEvict(Collections.<Object>singleton(entry.getKey()));
+                                ignite1.cache(DEFAULT_CACHE_NAME).localEvict(Collections.<Object>singleton(entry.getKey()));
                             else
                                 info("Entry is null.");
                         }
@@ -197,8 +197,8 @@ public class GridCachePreloadingEvictionsSelfTest extends GridCommonAbstractTest
 
         assertTrue(GridTestUtils.waitForCondition(new PA() {
             @Override public boolean apply() {
-                int size1 = ignite1.cache(null).localSize(CachePeekMode.ONHEAP);
-                return size1 != oldSize && size1 == ignite2.cache(null).localSize(CachePeekMode.ONHEAP);
+                int size1 = ignite1.cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.ONHEAP);
+                return size1 != oldSize && size1 == ignite2.cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.ONHEAP);
             }
         }, getTestTimeout()));
 
@@ -210,7 +210,7 @@ public class GridCachePreloadingEvictionsSelfTest extends GridCommonAbstractTest
      * @return Random entry from cache.
      */
     @Nullable private Cache.Entry<Integer, Object> randomEntry(Ignite g) {
-        return g.<Integer, Object>cache(null).iterator().next();
+        return g.<Integer, Object>cache(DEFAULT_CACHE_NAME).iterator().next();
     }
 
     /**
@@ -222,8 +222,8 @@ public class GridCachePreloadingEvictionsSelfTest extends GridCommonAbstractTest
         IgniteKernal g1 = (IgniteKernal) ignite1;
         IgniteKernal g2 = (IgniteKernal) ignite2;
 
-        GridCacheAdapter<Integer, Object> cache1 = g1.internalCache();
-        GridCacheAdapter<Integer, Object> cache2 = g2.internalCache();
+        GridCacheAdapter<Integer, Object> cache1 = g1.internalCache(DEFAULT_CACHE_NAME);
+        GridCacheAdapter<Integer, Object> cache2 = g2.internalCache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < 3; i++) {
             if (cache1.size(ALL_PEEK_MODES) != cache2.size(ALL_PEEK_MODES)) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexingDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexingDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexingDisabledSelfTest.java
index d7b0bda..1696d3a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexingDisabledSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexingDisabledSelfTest.java
@@ -50,7 +50,7 @@ public class GridCacheQueryIndexingDisabledSelfTest extends GridCacheAbstractSel
      * @param c Closure.
      */
     private void doTest(Callable<Object> c) {
-        GridTestUtils.assertThrows(log, c, CacheException.class, "Indexing is disabled for cache: null");
+        GridTestUtils.assertThrows(log, c, CacheException.class, "Indexing is disabled for cache: default");
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java
index d67c01b..288e572 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryInternalKeysSelfTest.java
@@ -70,7 +70,7 @@ public class GridCacheQueryInternalKeysSelfTest extends GridCacheAbstractSelfTes
     @SuppressWarnings("unchecked")
     public void testInternalKeysPreloading() throws Exception {
         try {
-            IgniteCache<Object, Object> cache = grid(0).cache(null);
+            IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < ENTRY_CNT; i++)
                 cache.put(new GridCacheQueueHeaderKey("queue" + i), 1);
@@ -80,7 +80,7 @@ public class GridCacheQueryInternalKeysSelfTest extends GridCacheAbstractSelfTes
             for (int i = 0; i < ENTRY_CNT; i++) {
                 GridCacheQueueHeaderKey internalKey = new GridCacheQueueHeaderKey("queue" + i);
 
-                Collection<ClusterNode> nodes = grid(0).affinity(null).mapKeyToPrimaryAndBackups(internalKey);
+                Collection<ClusterNode> nodes = grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToPrimaryAndBackups(internalKey);
 
                 for (ClusterNode n : nodes) {
                     Ignite g = findGridForNodeId(n.id());
@@ -88,7 +88,7 @@ public class GridCacheQueryInternalKeysSelfTest extends GridCacheAbstractSelfTes
                     assertNotNull(g);
 
                     assertTrue("Affinity node doesn't contain internal key [key=" + internalKey + ", node=" + n + ']',
-                        ((GridNearCacheAdapter)((IgniteKernal)g).internalCache()).dht().containsKey(internalKey));
+                        ((GridNearCacheAdapter)((IgniteKernal)g).internalCache(DEFAULT_CACHE_NAME)).dht().containsKey(internalKey));
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java
index 42bba79..e6a40a6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReferenceCleanupSelfTest.java
@@ -315,7 +315,7 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest {
                 Ignite g = startGrid();
 
                 try {
-                    IgniteCache<Integer, TestValue> cache = g.cache(null);
+                    IgniteCache<Integer, TestValue> cache = g.cache(DEFAULT_CACHE_NAME);
 
                     refs.add(new WeakReference<Object>(cacheContext(cache)));
 
@@ -356,7 +356,7 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest {
                 Ignite g = startGrid();
 
                 try {
-                    IgniteCache<Integer, TestValue> cache = g.cache(null);
+                    IgniteCache<Integer, TestValue> cache = g.cache(DEFAULT_CACHE_NAME);
 
                     refs.add(new WeakReference<Object>(cacheContext(cache)));
 
@@ -389,7 +389,7 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest {
                 Ignite g = startGrid();
 
                 try {
-                    IgniteCache<Integer, TestValue> cache = g.cache(null);
+                    IgniteCache<Integer, TestValue> cache = g.cache(DEFAULT_CACHE_NAME);
 
                     refs.add(new WeakReference<Object>(cacheContext(cache)));
 
@@ -429,7 +429,7 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest {
                 Ignite g = startGrid();
 
                 try {
-                    IgniteCache<Integer, TestValue> cache = g.cache(null);
+                    IgniteCache<Integer, TestValue> cache = g.cache(DEFAULT_CACHE_NAME);
 
                     refs.add(new WeakReference<Object>(cacheContext(cache)));
 
@@ -466,7 +466,7 @@ public class GridCacheReferenceCleanupSelfTest extends GridCommonAbstractTest {
                 Ignite g = startGrid();
 
                 try {
-                    IgniteCache<Integer, TestValue> cache = g.cache(null);
+                    IgniteCache<Integer, TestValue> cache = g.cache(DEFAULT_CACHE_NAME);
 
                     refs.add(new WeakReference<Object>(cacheContext(cache)));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReplicatedSynchronousCommitTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReplicatedSynchronousCommitTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReplicatedSynchronousCommitTest.java
index 10d75ce..f2e4f32 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReplicatedSynchronousCommitTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReplicatedSynchronousCommitTest.java
@@ -107,7 +107,7 @@ public class GridCacheReplicatedSynchronousCommitTest extends GridCommonAbstract
         try {
             Ignite firstIgnite = startGrid("1");
 
-            IgniteCache<Integer, String> firstCache = firstIgnite.cache(null);
+            IgniteCache<Integer, String> firstCache = firstIgnite.cache(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < ADDITION_CACHE_NUMBER; i++)
                 startGrid(String.valueOf(i + 2));
@@ -137,8 +137,8 @@ public class GridCacheReplicatedSynchronousCommitTest extends GridCommonAbstract
 
             Ignite ignite3 = startGrid("3");
 
-            IgniteCache<Integer, String> cache1 = ignite1.cache(null);
-            IgniteCache<Integer, String> cache3 = ignite3.cache(null);
+            IgniteCache<Integer, String> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
+            IgniteCache<Integer, String> cache3 = ignite3.cache(DEFAULT_CACHE_NAME);
 
             IgniteInternalFuture<?> fut = multithreadedAsync(
                 new Callable<Object>() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java
index 77b1c01..1b06e00 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReturnValueTransferSelfTest.java
@@ -56,7 +56,7 @@ public class GridCacheReturnValueTransferSelfTest extends GridCommonAbstractTest
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setBackups(backups);
         ccfg.setCacheMode(PARTITIONED);
@@ -117,7 +117,7 @@ public class GridCacheReturnValueTransferSelfTest extends GridCommonAbstractTest
             failDeserialization = false;
 
             // Get client grid.
-            IgniteCache<Integer, TestObject> cache = grid(2).cache(null);
+            IgniteCache<Integer, TestObject> cache = grid(2).cache(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < 100; i++)
                 cache.put(i, new TestObject());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStopSelfTest.java
index 890e005..9ccb12a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStopSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStopSelfTest.java
@@ -73,7 +73,7 @@ public class GridCacheStopSelfTest extends GridCommonAbstractTest {
 
         cfg.setDiscoverySpi(disc);
 
-        CacheConfiguration ccfg  = new CacheConfiguration();
+        CacheConfiguration ccfg  = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(replicated ? REPLICATED : PARTITIONED);
 
@@ -153,7 +153,7 @@ public class GridCacheStopSelfTest extends GridCommonAbstractTest {
 
                         IgniteKernal node = (IgniteKernal)ignite(idx % 3 + 1);
 
-                        IgniteCache<Integer, Integer> cache = node.cache(null);
+                        IgniteCache<Integer, Integer> cache = node.cache(DEFAULT_CACHE_NAME);
 
                         while (true) {
                             try {
@@ -173,7 +173,7 @@ public class GridCacheStopSelfTest extends GridCommonAbstractTest {
                     @Override public Void call() throws Exception {
                         IgniteKernal node = (IgniteKernal)ignite(0);
 
-                        IgniteCache<Integer, Integer> cache = node.cache(null);
+                        IgniteCache<Integer, Integer> cache = node.cache(DEFAULT_CACHE_NAME);
 
                         while (!fut1.isDone()) {
                             try {
@@ -253,7 +253,7 @@ public class GridCacheStopSelfTest extends GridCommonAbstractTest {
 
             final CountDownLatch readyLatch = new CountDownLatch(PUT_THREADS);
 
-            final IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+            final IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             assertNotNull(cache);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
index 9b08f4d..81a17bb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManagerDeserializationTest.java
@@ -108,6 +108,9 @@ public class GridCacheStoreManagerDeserializationTest extends GridCommonAbstract
     protected CacheConfiguration cacheConfiguration() {
         CacheConfiguration cc = defaultCacheConfiguration();
 
+        // Template
+        cc.setName("*");
+
         cc.setRebalanceMode(SYNC);
 
         cc.setCacheStoreFactory(singletonFactory(store));

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStorePutxSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStorePutxSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStorePutxSelfTest.java
index 40f3070..2175abb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStorePutxSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStorePutxSelfTest.java
@@ -53,7 +53,7 @@ public class GridCacheStorePutxSelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreValueBytesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreValueBytesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreValueBytesSelfTest.java
index 8802422..237ae72 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreValueBytesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheStoreValueBytesSelfTest.java
@@ -80,11 +80,11 @@ public class GridCacheStoreValueBytesSelfTest extends GridCommonAbstractTest {
         Ignite g0 = startGrid(0);
         Ignite g1 = startGrid(1);
 
-        IgniteCache<Integer, String> c = g0.cache(null);
+        IgniteCache<Integer, String> c = g0.cache(DEFAULT_CACHE_NAME);
 
         c.put(1, "Cached value");
 
-        GridCacheEntryEx entry = ((IgniteKernal)g1).internalCache().entryEx(1);
+        GridCacheEntryEx entry = ((IgniteKernal)g1).internalCache(DEFAULT_CACHE_NAME).entryEx(1);
 
         assert entry != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java
index 6979859..261411f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheSwapPreloadSelfTest.java
@@ -102,7 +102,7 @@ public class GridCacheSwapPreloadSelfTest extends GridCommonAbstractTest {
         try {
             startGrid(0);
 
-            IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+            IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             Set<Integer> keys = new HashSet<>();
 
@@ -128,7 +128,7 @@ public class GridCacheSwapPreloadSelfTest extends GridCommonAbstractTest {
 
             startGrid(1);
 
-            int size = grid(1).cache(null).localSize(CachePeekMode.ALL);
+            int size = grid(1).cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.ALL);
 
             info("New node cache size: " + size);
 
@@ -165,7 +165,7 @@ public class GridCacheSwapPreloadSelfTest extends GridCommonAbstractTest {
         try {
             startGrid(0);
 
-            final IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+            final IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             assertNotNull(cache);
 
@@ -207,7 +207,7 @@ public class GridCacheSwapPreloadSelfTest extends GridCommonAbstractTest {
 
             fut = null;
 
-            int size = grid(1).cache(null).localSize(CachePeekMode.PRIMARY, CachePeekMode.BACKUP,
+            int size = grid(1).cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.PRIMARY, CachePeekMode.BACKUP,
                 CachePeekMode.NEAR, CachePeekMode.ONHEAP);
 
             info("New node cache size: " + size);
@@ -217,7 +217,7 @@ public class GridCacheSwapPreloadSelfTest extends GridCommonAbstractTest {
 
                 int next = 0;
 
-                for (IgniteCache.Entry<Integer, Integer> e : grid(1).<Integer, Integer>cache(null).localEntries())
+                for (IgniteCache.Entry<Integer, Integer> e : grid(1).<Integer, Integer>cache(DEFAULT_CACHE_NAME).localEntries())
                     keySet.add(e.getKey());
 
                 for (Integer i : keySet) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTcpClientDiscoveryMultiThreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTcpClientDiscoveryMultiThreadedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTcpClientDiscoveryMultiThreadedTest.java
index 87f58a3..8a2f5d5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTcpClientDiscoveryMultiThreadedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTcpClientDiscoveryMultiThreadedTest.java
@@ -121,7 +121,7 @@ public class GridCacheTcpClientDiscoveryMultiThreadedTest extends GridCacheAbstr
 
             // Explicitly create near cache for even client nodes
             for (int i = srvNodesCnt; i < gridCount(); i++)
-                grid(i).createNearCache(null, new NearCacheConfiguration<>());
+                grid(i).createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration<>());
 
             final AtomicInteger threadsCnt = new AtomicInteger();
 
@@ -134,7 +134,7 @@ public class GridCacheTcpClientDiscoveryMultiThreadedTest extends GridCacheAbstr
 
                             assert node.configuration().isClientMode();
 
-                            IgniteCache<Integer, Integer> cache = node.cache(null);
+                            IgniteCache<Integer, Integer> cache = node.cache(DEFAULT_CACHE_NAME);
 
                             boolean isNearCacheNode = clientIdx % 2 == 0;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.java
index b227364..fcb5261 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTransactionalAbstractMetricsSelfTest.java
@@ -214,7 +214,7 @@ public abstract class GridCacheTransactionalAbstractMetricsSelfTest extends Grid
      */
     private void testCommits(TransactionConcurrency concurrency, TransactionIsolation isolation, boolean put)
         throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < TX_CNT; i++) {
             Transaction tx = grid(0).transactions().txStart(concurrency, isolation);
@@ -231,7 +231,7 @@ public abstract class GridCacheTransactionalAbstractMetricsSelfTest extends Grid
 
         for (int i = 0; i < gridCount(); i++) {
             TransactionMetrics metrics = grid(i).transactions().metrics();
-            CacheMetrics cacheMetrics = grid(i).cache(null).localMetrics();
+            CacheMetrics cacheMetrics = grid(i).cache(DEFAULT_CACHE_NAME).localMetrics();
 
             if (i == 0) {
                 assertEquals(TX_CNT, metrics.txCommits());
@@ -259,7 +259,7 @@ public abstract class GridCacheTransactionalAbstractMetricsSelfTest extends Grid
      */
     private void testRollbacks(TransactionConcurrency concurrency, TransactionIsolation isolation,
         boolean put) throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < TX_CNT; i++) {
             Transaction tx = grid(0).transactions().txStart(concurrency, isolation);
@@ -276,7 +276,7 @@ public abstract class GridCacheTransactionalAbstractMetricsSelfTest extends Grid
 
         for (int i = 0; i < gridCount(); i++) {
             TransactionMetrics metrics = grid(i).transactions().metrics();
-            CacheMetrics cacheMetrics = grid(i).cache(null).localMetrics();
+            CacheMetrics cacheMetrics = grid(i).cache(DEFAULT_CACHE_NAME).localMetrics();
 
             assertEquals(0, metrics.txCommits());
             assertEquals(0, cacheMetrics.getCacheTxCommits());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerEvictionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerEvictionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerEvictionSelfTest.java
index 29ffe87..66ef47c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerEvictionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerEvictionSelfTest.java
@@ -59,7 +59,7 @@ public class GridCacheTtlManagerEvictionSelfTest extends GridCommonAbstractTest
 
         cfg.setDiscoverySpi(discoSpi);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(cacheMode);
         ccfg.setEagerTtl(true);
@@ -104,9 +104,9 @@ public class GridCacheTtlManagerEvictionSelfTest extends GridCommonAbstractTest
         final IgniteKernal g = (IgniteKernal)startGrid(0);
 
         try {
-            final IgniteCache<Object, Object> cache = g.cache(null);
+            final IgniteCache<Object, Object> cache = g.cache(DEFAULT_CACHE_NAME);
 
-            final GridCacheContext<Object, Object> cctx = g.cachex(null).context();
+            final GridCacheContext<Object, Object> cctx = g.cachex(DEFAULT_CACHE_NAME).context();
 
             for (int i = 1; i <= ENTRIES_TO_PUT; i++) {
                 String key = "Some test entry key#" + i;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerLoadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerLoadTest.java
index 4820bd3..1e04cb6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerLoadTest.java
@@ -46,7 +46,7 @@ public class GridCacheTtlManagerLoadTest extends GridCacheTtlManagerSelfTest {
 
             IgniteInternalFuture<?> fut = multithreadedAsync(new Callable<Object>() {
                 @Override public Object call() throws Exception {
-                    IgniteCache<Object,Object> cache = g.cache(null).
+                    IgniteCache<Object,Object> cache = g.cache(DEFAULT_CACHE_NAME).
                         withExpiryPolicy(new TouchedExpiryPolicy(new Duration(MILLISECONDS, 1000)));
 
                     long key = 0;
@@ -61,7 +61,7 @@ public class GridCacheTtlManagerLoadTest extends GridCacheTtlManagerSelfTest {
                 }
             }, 1);
 
-            GridCacheTtlManager ttlMgr = g.internalCache().context().ttl();
+            GridCacheTtlManager ttlMgr = g.internalCache(DEFAULT_CACHE_NAME).context().ttl();
 
             for (int i = 0; i < 300; i++) {
                 U.sleep(1000);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerNotificationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerNotificationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerNotificationTest.java
index 519e975..d25b2af 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerNotificationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerNotificationTest.java
@@ -71,7 +71,7 @@ public class GridCacheTtlManagerNotificationTest extends GridCommonAbstractTest
 
         CacheConfiguration[] ccfgs = new CacheConfiguration[CACHES_CNT + 1];
 
-        ccfgs[0] = createCacheConfiguration(null);
+        ccfgs[0] = createCacheConfiguration(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < CACHES_CNT; i++)
             ccfgs[i + 1] = createCacheConfiguration(CACHE_PREFIX + i);
@@ -86,7 +86,7 @@ public class GridCacheTtlManagerNotificationTest extends GridCommonAbstractTest
      * @return Cache configuration.
      */
     private CacheConfiguration createCacheConfiguration(String name) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(cacheMode);
         ccfg.setEagerTtl(true);
@@ -112,7 +112,7 @@ public class GridCacheTtlManagerNotificationTest extends GridCommonAbstractTest
 
             final String key = "key";
 
-            IgniteCache<Object, Object> cache = g.cache(null);
+            IgniteCache<Object, Object> cache = g.cache(DEFAULT_CACHE_NAME);
 
             ExpiryPolicy plc1 = new CreatedExpiryPolicy(new Duration(MILLISECONDS, 100_000));
 
@@ -141,7 +141,7 @@ public class GridCacheTtlManagerNotificationTest extends GridCommonAbstractTest
         final int cnt = 1_000;
 
         try (final Ignite g = startGrid(0)) {
-            final IgniteCache<Object, Object> cache = g.cache(null);
+            final IgniteCache<Object, Object> cache = g.cache(DEFAULT_CACHE_NAME);
 
             g.events().localListen(new IgnitePredicate<Event>() {
                 @Override public boolean apply(Event evt) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerSelfTest.java
index b26d2b7..18c0b32 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManagerSelfTest.java
@@ -56,7 +56,7 @@ public class GridCacheTtlManagerSelfTest extends GridCommonAbstractTest {
 
         cfg.setDiscoverySpi(discoSpi);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(cacheMode);
         ccfg.setEagerTtl(true);
@@ -99,20 +99,20 @@ public class GridCacheTtlManagerSelfTest extends GridCommonAbstractTest {
         try {
             final String key = "key";
 
-            g.cache(null).withExpiryPolicy(
+            g.cache(DEFAULT_CACHE_NAME).withExpiryPolicy(
                     new TouchedExpiryPolicy(new Duration(MILLISECONDS, 1000))).put(key, 1);
 
-            assertEquals(1, g.cache(null).get(key));
+            assertEquals(1, g.cache(DEFAULT_CACHE_NAME).get(key));
 
             U.sleep(1100);
 
             GridTestUtils.retryAssert(log, 10, 100, new CAX() {
                 @Override public void applyx() {
                     // Check that no more entries left in the map.
-                    assertNull(g.cache(null).get(key));
+                    assertNull(g.cache(DEFAULT_CACHE_NAME).get(key));
 
-                    if (!g.internalCache().context().deferredDelete())
-                        assertNull(g.internalCache().map().getEntry(g.internalCache().context().toCacheKeyObject(key)));
+                    if (!g.internalCache(DEFAULT_CACHE_NAME).context().deferredDelete())
+                        assertNull(g.internalCache(DEFAULT_CACHE_NAME).map().getEntry(g.internalCache(DEFAULT_CACHE_NAME).context().toCacheKeyObject(key)));
                 }
             });
         }


[45/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java
index 7ddd4ad..034a26a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java
@@ -38,6 +38,7 @@ import org.apache.ignite.internal.cluster.ClusterGroupAdapter;
 import org.apache.ignite.internal.managers.deployment.GridDeployment;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteCallable;
 import org.apache.ignite.lang.IgniteClosure;
@@ -136,7 +137,9 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
     }
 
     /** {@inheritDoc} */
-    @Override public void affinityRun(@Nullable String cacheName, Object affKey, IgniteRunnable job) {
+    @Override public void affinityRun(String cacheName, Object affKey, IgniteRunnable job) {
+        CU.validateCacheName(cacheName);
+
         try {
             saveOrGet(affinityRunAsync0(cacheName, affKey, job));
         }
@@ -146,8 +149,10 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteFuture<Void> affinityRunAsync(@Nullable String cacheName, Object affKey,
+    @Override public IgniteFuture<Void> affinityRunAsync(String cacheName, Object affKey,
         IgniteRunnable job) throws IgniteException {
+        CU.validateCacheName(cacheName);
+
         return (IgniteFuture<Void>)createFuture(affinityRunAsync0(cacheName, affKey, job));
     }
 
@@ -159,7 +164,7 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
      * @param job Job.
      * @return Internal future.
      */
-    private IgniteInternalFuture<?> affinityRunAsync0(@Nullable String cacheName, Object affKey, IgniteRunnable job) {
+    private IgniteInternalFuture<?> affinityRunAsync0(String cacheName, Object affKey, IgniteRunnable job) {
         A.notNull(affKey, "affKey");
         A.notNull(job, "job");
 
@@ -186,6 +191,8 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
 
     /** {@inheritDoc} */
     @Override public void affinityRun(@NotNull Collection<String> cacheNames, Object affKey, IgniteRunnable job) {
+        CU.validateCacheNames(cacheNames);
+
         try {
             saveOrGet(affinityRunAsync0(cacheNames, affKey, job));
         }
@@ -197,6 +204,8 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
     /** {@inheritDoc} */
     @Override public IgniteFuture<Void> affinityRunAsync(@NotNull Collection<String> cacheNames, Object affKey,
         IgniteRunnable job) throws IgniteException {
+        CU.validateCacheNames(cacheNames);
+
         return (IgniteFuture<Void>)createFuture(affinityRunAsync0(cacheNames, affKey, job));
     }
 
@@ -239,6 +248,8 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
 
     /** {@inheritDoc} */
     @Override public void affinityRun(@NotNull Collection<String> cacheNames, int partId, IgniteRunnable job) {
+        CU.validateCacheNames(cacheNames);
+
         try {
             saveOrGet(affinityRunAsync0(cacheNames, partId, job));
         }
@@ -250,6 +261,8 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
     /** {@inheritDoc} */
     @Override public IgniteFuture<Void> affinityRunAsync(@NotNull Collection<String> cacheNames, int partId,
         IgniteRunnable job) throws IgniteException {
+        CU.validateCacheNames(cacheNames);
+
         return (IgniteFuture<Void>)createFuture(affinityRunAsync0(cacheNames, partId, job));
     }
 
@@ -281,7 +294,9 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
     }
 
     /** {@inheritDoc} */
-    @Override public <R> R affinityCall(@Nullable String cacheName, Object affKey, IgniteCallable<R> job) {
+    @Override public <R> R affinityCall(String cacheName, Object affKey, IgniteCallable<R> job) {
+        CU.validateCacheName(cacheName);
+
         try {
             return saveOrGet(affinityCallAsync0(cacheName, affKey, job));
         }
@@ -291,8 +306,10 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
     }
 
     /** {@inheritDoc} */
-    @Override public <R> IgniteFuture<R> affinityCallAsync(@Nullable String cacheName, Object affKey,
+    @Override public <R> IgniteFuture<R> affinityCallAsync(String cacheName, Object affKey,
         IgniteCallable<R> job) throws IgniteException {
+        CU.validateCacheName(cacheName);
+
         return createFuture(affinityCallAsync0(cacheName, affKey, job));
     }
 
@@ -304,7 +321,7 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
      * @param job Job.
      * @return Internal future.
      */
-    private <R> IgniteInternalFuture<R> affinityCallAsync0(@Nullable String cacheName, Object affKey,
+    private <R> IgniteInternalFuture<R> affinityCallAsync0(String cacheName, Object affKey,
         IgniteCallable<R> job) {
         A.notNull(affKey, "affKey");
         A.notNull(job, "job");
@@ -332,6 +349,8 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
 
     /** {@inheritDoc} */
     @Override public <R> R affinityCall(@NotNull Collection<String> cacheNames, Object affKey, IgniteCallable<R> job) {
+        CU.validateCacheNames(cacheNames);
+
         try {
             return saveOrGet(affinityCallAsync0(cacheNames, affKey, job));
         }
@@ -343,6 +362,8 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
     /** {@inheritDoc} */
     @Override public <R> IgniteFuture<R> affinityCallAsync(@NotNull Collection<String> cacheNames, Object affKey,
         IgniteCallable<R> job) throws IgniteException {
+        CU.validateCacheNames(cacheNames);
+
         return createFuture(affinityCallAsync0(cacheNames, affKey, job));
     }
 
@@ -385,6 +406,8 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
 
     /** {@inheritDoc} */
     @Override public <R> R affinityCall(@NotNull Collection<String> cacheNames, int partId, IgniteCallable<R> job) {
+        CU.validateCacheNames(cacheNames);
+
         try {
             return saveOrGet(affinityCallAsync0(cacheNames, partId, job));
         }
@@ -396,6 +419,8 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
     /** {@inheritDoc} */
     @Override public <R> IgniteFuture<R> affinityCallAsync(@NotNull Collection<String> cacheNames, int partId,
         IgniteCallable<R> job) throws IgniteException {
+        CU.validateCacheNames(cacheNames);
+
         return createFuture(affinityCallAsync0(cacheNames, partId, job));
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
index 164839e..421d6f9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
@@ -48,17 +48,7 @@ public interface IgniteEx extends Ignite {
      * @param name Cache name.
      * @return Cache instance for given name or <tt>null</tt> if one does not exist.
      */
-    @Nullable public <K, V> IgniteInternalCache<K, V> cachex(@Nullable String name);
-
-    /**
-     * Gets default cache instance if one is configured or <tt>null</tt> otherwise returning even non-public caches.
-     * The {@link IgniteInternalCache#name()} method on default instance returns <tt>null</tt>.
-     *
-     * @param <K> Key type.
-     * @param <V> Value type.
-     * @return Default cache instance.
-     */
-    @Nullable public <K, V> IgniteInternalCache<K, V> cachex();
+    @Nullable public <K, V> IgniteInternalCache<K, V> cachex(String name);
 
     /**
      * Gets configured cache instance that satisfy all provided predicates including non-public caches. If no

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 12a7af6..f0bf29b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -2283,27 +2283,14 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     /**
      * USED ONLY FOR TESTING.
      *
-     * @param <K> Key type.
-     * @param <V> Value type.
-     * @return Internal cache instance.
-     */
-    /*@java.test.only*/
-    public <K, V> GridCacheAdapter<K, V> internalCache() {
-        checkClusterState();
-
-        return internalCache(null);
-    }
-
-    /**
-     * USED ONLY FOR TESTING.
-     *
      * @param name Cache name.
      * @param <K>  Key type.
      * @param <V>  Value type.
      * @return Internal cache instance.
      */
     /*@java.test.only*/
-    public <K, V> GridCacheAdapter<K, V> internalCache(@Nullable String name) {
+    public <K, V> GridCacheAdapter<K, V> internalCache(String name) {
+        CU.validateCacheName(name);
         checkClusterState();
 
         return ctx.cache().internalCache(name);
@@ -2690,7 +2677,9 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
      * @param name Cache name.
      * @return Cache.
      */
-    public <K, V> IgniteInternalCache<K, V> getCache(@Nullable String name) {
+    public <K, V> IgniteInternalCache<K, V> getCache(String name) {
+        CU.validateCacheName(name);
+
         guard();
 
         try {
@@ -2704,7 +2693,9 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     }
 
     /** {@inheritDoc} */
-    @Override public <K, V> IgniteCache<K, V> cache(@Nullable String name) {
+    @Override public <K, V> IgniteCache<K, V> cache(String name) {
+        CU.validateCacheName(name);
+
         guard();
 
         try {
@@ -2723,6 +2714,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     /** {@inheritDoc} */
     @Override public <K, V> IgniteCache<K, V> createCache(CacheConfiguration<K, V> cacheCfg) {
         A.notNull(cacheCfg, "cacheCfg");
+        CU.validateCacheName(cacheCfg.getName());
 
         guard();
 
@@ -2750,6 +2742,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     /** {@inheritDoc} */
     @Override public Collection<IgniteCache> createCaches(Collection<CacheConfiguration> cacheCfgs) {
         A.notNull(cacheCfgs, "cacheCfgs");
+        CU.validateConfigurationCacheNames(cacheCfgs);
 
         guard();
 
@@ -2775,6 +2768,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
 
     /** {@inheritDoc} */
     @Override public <K, V> IgniteCache<K, V> createCache(String cacheName) {
+        CU.validateCacheName(cacheName);
+
         guard();
 
         try {
@@ -2795,6 +2790,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     /** {@inheritDoc} */
     @Override public <K, V> IgniteCache<K, V> getOrCreateCache(CacheConfiguration<K, V> cacheCfg) {
         A.notNull(cacheCfg, "cacheCfg");
+        CU.validateCacheName(cacheCfg.getName());
 
         guard();
 
@@ -2823,6 +2819,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     /** {@inheritDoc} */
     @Override public Collection<IgniteCache> getOrCreateCaches(Collection<CacheConfiguration> cacheCfgs) {
         A.notNull(cacheCfgs, "cacheCfgs");
+        CU.validateConfigurationCacheNames(cacheCfgs);
 
         guard();
 
@@ -2852,6 +2849,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
         NearCacheConfiguration<K, V> nearCfg
     ) {
         A.notNull(cacheCfg, "cacheCfg");
+        CU.validateCacheName(cacheCfg.getName());
         A.notNull(nearCfg, "nearCfg");
 
         guard();
@@ -2880,6 +2878,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     @Override public <K, V> IgniteCache<K, V> getOrCreateCache(CacheConfiguration<K, V> cacheCfg,
         NearCacheConfiguration<K, V> nearCfg) {
         A.notNull(cacheCfg, "cacheCfg");
+        CU.validateCacheName(cacheCfg.getName());
         A.notNull(nearCfg, "nearCfg");
 
         guard();
@@ -2920,6 +2919,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
 
     /** {@inheritDoc} */
     @Override public <K, V> IgniteCache<K, V> createNearCache(String cacheName, NearCacheConfiguration<K, V> nearCfg) {
+        CU.validateCacheName(cacheName);
         A.notNull(nearCfg, "nearCfg");
 
         guard();
@@ -2949,8 +2949,9 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     }
 
     /** {@inheritDoc} */
-    @Override public <K, V> IgniteCache<K, V> getOrCreateNearCache(@Nullable String cacheName,
+    @Override public <K, V> IgniteCache<K, V> getOrCreateNearCache(String cacheName,
         NearCacheConfiguration<K, V> nearCfg) {
+        CU.validateCacheName(cacheName);
         A.notNull(nearCfg, "nearCfg");
 
         guard();
@@ -3005,6 +3006,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
 
     /** {@inheritDoc} */
     @Override public void destroyCache(String cacheName) {
+        CU.validateCacheName(cacheName);
+
         IgniteInternalFuture stopFut = destroyCacheAsync(cacheName, true);
 
         try {
@@ -3017,6 +3020,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
 
     /** {@inheritDoc} */
     @Override public void destroyCaches(Collection<String> cacheNames) {
+        CU.validateCacheNames(cacheNames);
+
         IgniteInternalFuture stopFut = destroyCachesAsync(cacheNames, true);
 
         try {
@@ -3033,6 +3038,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
      * @return Ignite future.
      */
     public IgniteInternalFuture<?> destroyCacheAsync(String cacheName, boolean checkThreadTx) {
+        CU.validateCacheName(cacheName);
+
         guard();
 
         try {
@@ -3051,6 +3058,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
      * @return Ignite future.
      */
     public IgniteInternalFuture<?> destroyCachesAsync(Collection<String> cacheNames, boolean checkThreadTx) {
+        CU.validateCacheNames(cacheNames);
+
         guard();
 
         try {
@@ -3063,6 +3072,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
 
     /** {@inheritDoc} */
     @Override public <K, V> IgniteCache<K, V> getOrCreateCache(String cacheName) {
+        CU.validateCacheName(cacheName);
+
         guard();
 
         try {
@@ -3087,6 +3098,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
      * @return Future that will be completed when cache is deployed.
      */
     public IgniteInternalFuture<?> getOrCreateCacheAsync(String cacheName, boolean checkThreadTx) {
+        CU.validateCacheName(cacheName);
+
         guard();
 
         try {
@@ -3105,6 +3118,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     /** {@inheritDoc} */
     @Override public <K, V> void addCacheConfiguration(CacheConfiguration<K, V> cacheCfg) {
         A.notNull(cacheCfg, "cacheCfg");
+        CU.validateCacheName(cacheCfg.getName());
 
         guard();
 
@@ -3166,27 +3180,15 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     }
 
     /** {@inheritDoc} */
-    @Override public <K, V> IgniteInternalCache<K, V> cachex(@Nullable String name) {
-        guard();
-
-        try {
-            checkClusterState();
+    @Override public <K, V> IgniteInternalCache<K, V> cachex(String name) {
+        CU.validateCacheName(name);
 
-            return ctx.cache().cache(name);
-        }
-        finally {
-            unguard();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public <K, V> IgniteInternalCache<K, V> cachex() {
         guard();
 
         try {
             checkClusterState();
 
-            return ctx.cache().cache();
+            return ctx.cache().cache(name);
         }
         finally {
             unguard();
@@ -3209,7 +3211,9 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     }
 
     /** {@inheritDoc} */
-    @Override public <K, V> IgniteDataStreamer<K, V> dataStreamer(@Nullable String cacheName) {
+    @Override public <K, V> IgniteDataStreamer<K, V> dataStreamer(String cacheName) {
+        CU.validateCacheName(cacheName);
+
         guard();
 
         try {
@@ -3337,8 +3341,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
         Ignition.stop(igniteInstanceName, true);
     }
 
-    /** {@inheritDoc} */
     @Override public <K> Affinity<K> affinity(String cacheName) {
+        CU.validateCacheName(cacheName);
         checkClusterState();
 
         GridCacheAdapter<K, ?> cache = ctx.cache().internalCache(cacheName);
@@ -3378,6 +3382,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
 
     /** {@inheritDoc} */
     @Override public void resetLostPartitions(Collection<String> cacheNames) {
+        CU.validateCacheNames(cacheNames);
+
         guard();
 
         try {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
index 75c9a71..73bf224 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupAdapter.java
@@ -54,6 +54,7 @@ import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
 import org.apache.ignite.internal.processors.igfs.IgfsNodePredicate;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgnitePredicate;
 import org.apache.ignite.resources.IgniteInstanceResource;
@@ -576,36 +577,46 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
     }
 
     /** {@inheritDoc} */
-    @Override public final ClusterGroup forCacheNodes(@Nullable String cacheName) {
+    @Override public final ClusterGroup forCacheNodes(String cacheName) {
+        CU.validateCacheName(cacheName);
+
         checkDaemon();
 
         return forPredicate(new CachesFilter(cacheName, true, true, true));
     }
 
     /** {@inheritDoc} */
-    @Override public final ClusterGroup forDataNodes(@Nullable String cacheName) {
+    @Override public final ClusterGroup forDataNodes(String cacheName) {
+        CU.validateCacheName(cacheName);
+
         checkDaemon();
 
         return forPredicate(new CachesFilter(cacheName, true, false, false));
     }
 
     /** {@inheritDoc} */
-    @Override public final ClusterGroup forClientNodes(@Nullable String cacheName) {
+    @Override public final ClusterGroup forClientNodes(String cacheName) {
+        CU.validateCacheName(cacheName);
+
         checkDaemon();
 
         return forPredicate(new CachesFilter(cacheName, false, true, true));
     }
 
     /** {@inheritDoc} */
-    @Override public ClusterGroup forCacheNodes(@Nullable String cacheName, boolean affNodes, boolean nearNodes,
+    @Override public ClusterGroup forCacheNodes(String cacheName, boolean affNodes, boolean nearNodes,
         boolean clientNodes) {
+        CU.validateCacheName(cacheName);
+
         checkDaemon();
 
         return forPredicate(new CachesFilter(cacheName, affNodes, nearNodes, clientNodes));
     }
 
     /** {@inheritDoc} */
-    @Override public ClusterGroup forIgfsMetadataDataNodes(@Nullable String igfsName, @Nullable String metaCacheName) {
+    @Override public ClusterGroup forIgfsMetadataDataNodes(String igfsName, String metaCacheName) {
+        assert metaCacheName != null;
+
         return forPredicate(new IgfsNodePredicate(igfsName)).forDataNodes(metaCacheName);
     }
 
@@ -764,7 +775,7 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable {
         /**
          * @param cacheName Cache name.
          */
-        private CachesFilter(@Nullable String cacheName, boolean affNodes, boolean nearNodes, boolean clients) {
+        private CachesFilter(String cacheName, boolean affNodes, boolean nearNodes, boolean clients) {
             this.cacheName = cacheName;
             this.affNodes = affNodes;
             this.nearNodes = nearNodes;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupEx.java b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupEx.java
index 21533a0..f597818 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/ClusterGroupEx.java
@@ -40,8 +40,7 @@ public interface ClusterGroupEx extends ClusterGroup {
      * @param clientNodes Flag to include client nodes.
      * @return Cluster group.
      */
-    public ClusterGroup forCacheNodes(@Nullable String cacheName, boolean affNodes, boolean nearNodes,
-        boolean clientNodes);
+    public ClusterGroup forCacheNodes(String cacheName, boolean affNodes, boolean nearNodes, boolean clientNodes);
 
     /**
      * Create projection for IGFS server nodes.
@@ -50,5 +49,5 @@ public interface ClusterGroupEx extends ClusterGroup {
      * @param metaCacheName Metadata cache name.
      * @return Cluster group.
      */
-    public ClusterGroup forIgfsMetadataDataNodes(@Nullable String igfsName, @Nullable String metaCacheName);
+    public ClusterGroup forIgfsMetadataDataNodes(String igfsName, String metaCacheName);
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
index e8e20ed..e1b9f64 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
@@ -26,7 +26,6 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.UUID;
 import java.util.concurrent.ConcurrentMap;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
@@ -56,6 +55,7 @@ import org.apache.ignite.internal.util.lang.GridTuple3;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgnitePredicate;
@@ -85,9 +85,6 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
     /** Time to wait between errors (in milliseconds). */
     private static final long ERROR_WAIT = 500;
 
-    /** Null cache name. */
-    private static final String NULL_NAME = U.id8(UUID.randomUUID());
-
     /** Affinity map. */
     private final ConcurrentMap<AffinityAssignmentKey, IgniteInternalFuture<AffinityInfo>> affMap = new ConcurrentHashMap8<>();
 
@@ -151,7 +148,7 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
      * @return Key partition.
      * @throws IgniteCheckedException If failed.
      */
-    public int partition(@Nullable String cacheName, Object key) throws IgniteCheckedException {
+    public int partition(String cacheName, Object key) throws IgniteCheckedException {
         return partition(cacheName, key, null);
     }
 
@@ -162,9 +159,9 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
      * @return Key partition.
      * @throws IgniteCheckedException If failed.
      */
-    public int partition(@Nullable String cacheName,
-        Object key,
-        @Nullable AffinityInfo aff) throws IgniteCheckedException {
+    public int partition(String cacheName, Object key, @Nullable AffinityInfo aff) throws IgniteCheckedException {
+        assert cacheName != null;
+
         if (key instanceof KeyCacheObject) {
             int part = ((KeyCacheObject)key).partition();
 
@@ -182,9 +179,9 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
      * @return Key partition.
      * @throws IgniteCheckedException If failed.
      */
-    public int partition0(@Nullable String cacheName,
-        Object key,
-        @Nullable AffinityInfo aff) throws IgniteCheckedException {
+    public int partition0(String cacheName, Object key, @Nullable AffinityInfo aff) throws IgniteCheckedException {
+        assert cacheName != null;
+
         if (aff == null) {
             aff = affinityCache(cacheName, ctx.discovery().topologyVersionEx());
 
@@ -204,9 +201,10 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
      * @return Picked node.
      * @throws IgniteCheckedException If failed.
      */
-    @Nullable public ClusterNode mapPartitionToNode(@Nullable String cacheName, int partId,
-        AffinityTopologyVersion topVer)
+    @Nullable public ClusterNode mapPartitionToNode(String cacheName, int partId, AffinityTopologyVersion topVer)
         throws IgniteCheckedException {
+        assert cacheName != null;
+
         AffinityInfo affInfo = affinityCache(cacheName, topVer);
 
         return affInfo != null ? F.first(affInfo.assignment().get(partId)) : null;
@@ -221,8 +219,10 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
      * @return Map of nodes to keys.
      * @throws IgniteCheckedException If failed.
      */
-    public <K> Map<ClusterNode, Collection<K>> mapKeysToNodes(@Nullable String cacheName,
-        @Nullable Collection<? extends K> keys) throws IgniteCheckedException {
+    public <K> Map<ClusterNode, Collection<K>> mapKeysToNodes(String cacheName, @Nullable Collection<? extends K> keys)
+        throws IgniteCheckedException {
+        assert cacheName != null;
+
         return keysToNodes(cacheName, keys);
     }
 
@@ -234,7 +234,9 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
      * @return Picked node.
      * @throws IgniteCheckedException If failed.
      */
-    @Nullable public <K> ClusterNode mapKeyToNode(@Nullable String cacheName, K key) throws IgniteCheckedException {
+    @Nullable public <K> ClusterNode mapKeyToNode(String cacheName, K key) throws IgniteCheckedException {
+        assert cacheName != null;
+
         Map<ClusterNode, Collection<K>> map = keysToNodes(cacheName, F.asList(key));
 
         return !F.isEmpty(map) ? F.first(map.keySet()) : null;
@@ -248,8 +250,10 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
      * @return Picked node.
      * @throws IgniteCheckedException If failed.
      */
-    @Nullable public <K> ClusterNode mapKeyToNode(@Nullable String cacheName, K key,
-        AffinityTopologyVersion topVer) throws IgniteCheckedException {
+    @Nullable public <K> ClusterNode mapKeyToNode(String cacheName, K key, AffinityTopologyVersion topVer)
+        throws IgniteCheckedException {
+        assert cacheName != null;
+
         Map<ClusterNode, Collection<K>> map = keysToNodes(cacheName, F.asList(key), topVer);
 
         return map != null ? F.first(map.keySet()) : null;
@@ -264,13 +268,14 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
      * @return Affinity nodes, primary first.
      * @throws IgniteCheckedException If failed.
      */
-    public <K> List<ClusterNode> mapKeyToPrimaryAndBackups(@Nullable String cacheName,
+    public <K> List<ClusterNode> mapKeyToPrimaryAndBackups(String cacheName,
         K key,
         AffinityTopologyVersion topVer)
         throws IgniteCheckedException
     {
-        A.notNull(key, "key");
+        assert cacheName != null;
 
+        A.notNull(key, "key");
         AffinityInfo affInfo = affinityCache(cacheName, topVer);
 
         if (affInfo == null)
@@ -290,7 +295,9 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
      * @throws IgniteCheckedException In case of error.
      */
     @SuppressWarnings("unchecked")
-    @Nullable public Object affinityKey(@Nullable String cacheName, @Nullable Object key) throws IgniteCheckedException {
+    @Nullable public Object affinityKey(String cacheName, @Nullable Object key) throws IgniteCheckedException {
+        assert cacheName != null;
+
         if (key == null)
             return null;
 
@@ -307,15 +314,9 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
      * @return Cache affinity.
      */
     public <K> CacheAffinityProxy<K> affinityProxy(String cacheName) {
-        return new CacheAffinityProxy<>(cacheName);
-    }
+        CU.validateCacheName(cacheName);
 
-    /**
-     * @param cacheName Cache name.
-     * @return Non-null cache name.
-     */
-    private String maskNull(@Nullable String cacheName) {
-        return cacheName == null ? NULL_NAME : cacheName;
+        return new CacheAffinityProxy<>(cacheName);
     }
 
     /**
@@ -353,7 +354,7 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
      * @throws IgniteCheckedException In case of error.
      */
     @SuppressWarnings("ErrorNotRethrown")
-    @Nullable private AffinityInfo affinityCache(@Nullable final String cacheName, AffinityTopologyVersion topVer)
+    @Nullable private AffinityInfo affinityCache(final String cacheName, AffinityTopologyVersion topVer)
         throws IgniteCheckedException {
         AffinityAssignmentKey key = new AffinityAssignmentKey(cacheName, topVer);
 
@@ -469,7 +470,7 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
                     continue;
                 }
 
-                affMap.remove(maskNull(cacheName), fut0);
+                affMap.remove(cacheName, fut0);
 
                 fut0.onDone(new IgniteCheckedException("Failed to get affinity mapping from node: " + n, e));
 
@@ -494,7 +495,7 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
      * @return Affinity cached function.
      * @throws IgniteCheckedException If either local or remote node cannot get deployment for affinity objects.
      */
-    private AffinityInfo affinityInfoFromNode(@Nullable String cacheName, AffinityTopologyVersion topVer, ClusterNode n)
+    private AffinityInfo affinityInfoFromNode(String cacheName, AffinityTopologyVersion topVer, ClusterNode n)
         throws IgniteCheckedException {
         GridTuple3<GridAffinityMessage, GridAffinityMessage, GridAffinityAssignment> t = ctx.closure()
             .callAsyncNoFailover(BROADCAST, affinityJob(cacheName, topVer), F.asList(n), true/*system pool*/, 0).get();
@@ -559,7 +560,7 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
      * @throws IgniteCheckedException In case of error.
      */
     private <K> ClusterNode primary(AffinityInfo aff, K key) throws IgniteCheckedException {
-        int part = partition(null, key, aff);
+        int part = aff.affFunc.partition(aff.affinityKey(key));
 
         Collection<ClusterNode> nodes = aff.assignment.get(part);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 4b79361..a01bac6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -164,9 +164,6 @@ import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isNearE
  */
 @SuppressWarnings({"unchecked", "TypeMayBeWeakened", "deprecation"})
 public class GridCacheProcessor extends GridProcessorAdapter {
-    /** Null cache name. */
-    private static final String NULL_NAME = U.id8(UUID.randomUUID());
-
     /** Shared cache context. */
     private GridCacheSharedContext<?, ?> sharedCtx;
 
@@ -415,6 +412,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         CacheConfiguration cc,
         CacheType cacheType,
         @Nullable CacheStore cfgStore) throws IgniteCheckedException {
+        assertParameter(cc.getName() != null && !cc.getName().isEmpty(), "name is null or empty");
+
         if (cc.getCacheMode() == REPLICATED) {
             if (cc.getNearConfiguration() != null &&
                 ctx.discovery().cacheAffinityNode(ctx.discovery().localNode(), cc.getName())) {
@@ -709,6 +708,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @throws IgniteCheckedException If failed.
      */
     private void registerCache(CacheConfiguration<?, ?> cfg) throws IgniteCheckedException {
+        assert cfg.getName() != null;
+
         cloneCheckSerializable(cfg);
 
         CacheObjectContext cacheObjCtx = ctx.cacheObjects().contextForCache(cfg);
@@ -716,24 +717,18 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         // Initialize defaults.
         initialize(cfg, cacheObjCtx);
 
-        String masked = maskNull(cfg.getName());
+        String cacheName = cfg.getName();
 
         if (cacheDescriptor(cfg.getName()) != null) {
-            String cacheName = cfg.getName();
-
-            if (cacheName != null)
-                throw new IgniteCheckedException("Duplicate cache name found (check configuration and " +
-                    "assign unique name to each cache): " + U.maskName(cacheName));
-            else
-                throw new IgniteCheckedException("Default cache has already been configured (check configuration and " +
-                    "assign unique name to each cache).");
+            throw new IgniteCheckedException("Duplicate cache name found (check configuration and " +
+                "assign unique name to each cache): " + cacheName);
         }
 
         CacheType cacheType;
 
-            if (CU.isUtilityCache(cfg.getName()))
+        if (CU.isUtilityCache(cfg.getName()))
                 cacheType = CacheType.UTILITY;
-            else if (internalCaches.contains(maskNull(cfg.getName())))
+            else if (internalCaches.contains(cfg.getName()))
                 cacheType = CacheType.INTERNAL;
             else
                 cacheType = CacheType.USER;
@@ -776,7 +771,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             if (log.isDebugEnabled())
                 log.debug("Use cache configuration as template: " + cfg);
 
-            registeredTemplates.put(masked, desc);
+            registeredTemplates.put(cacheName, desc);
         }
 
         if (cfg.getName() == null) { // Use cache configuration with null name as template.
@@ -790,7 +785,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             desc0.locallyConfigured(true);
             desc0.staticallyConfigured(true);
 
-            registeredTemplates.put(masked, desc0);
+            registeredTemplates.put(cacheName, desc0);
         }
     }
 
@@ -802,8 +797,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
         if (igfsCfgs != null) {
             for (FileSystemConfiguration igfsCfg : igfsCfgs) {
-                internalCaches.add(maskNull(igfsCfg.getMetaCacheConfiguration().getName()));
-                internalCaches.add(maskNull(igfsCfg.getDataCacheConfiguration().getName()));
+                internalCaches.add(igfsCfg.getMetaCacheConfiguration().getName());
+                internalCaches.add(igfsCfg.getDataCacheConfiguration().getName());
             }
         }
 
@@ -829,6 +824,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                 List<CacheConfiguration> tmpCacheCfg = new ArrayList<>();
 
                 for (CacheConfiguration conf : ctx.config().getCacheConfiguration()) {
+                    assert conf.getName() != null;
+
                     for (DynamicCacheDescriptor desc : cacheDescriptors()) {
                         CacheConfiguration c = desc.cacheConfiguration();
                         IgnitePredicate filter = c.getNodeFilter();
@@ -896,11 +893,11 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
                     String name = ccfg.getName();
 
-                    caches.put(maskNull(name), cache);
+                    caches.put(name, cache);
 
                     startCache(cache, desc.schema());
 
-                    jCacheProxies.put(maskNull(name), new IgniteCacheProxy(ctx, cache, null, false));
+                    jCacheProxies.put(name, new IgniteCacheProxy(ctx, cache, null, false));
                 }
             }
         }
@@ -932,7 +929,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             IgnitePredicate filter = cfg.getNodeFilter();
 
             if (desc.locallyConfigured() || (desc.receivedOnDiscovery() && CU.affinityNode(locNode, filter))) {
-                GridCacheAdapter cache = caches.get(maskNull(cfg.getName()));
+                GridCacheAdapter cache = caches.get(cfg.getName());
 
                 if (cache != null) {
                     if (cfg.getRebalanceMode() == SYNC) {
@@ -1020,14 +1017,14 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      */
     public void stopCaches(boolean cancel){
         for (String cacheName : stopSeq) {
-            GridCacheAdapter<?, ?> cache = stoppedCaches.remove(maskNull(cacheName));
+            GridCacheAdapter<?, ?> cache = stoppedCaches.remove(cacheName);
 
             if (cache != null)
                 stopCache(cache, cancel, false);
         }
 
         for (GridCacheAdapter<?, ?> cache : stoppedCaches.values()) {
-            if (cache == stoppedCaches.remove(maskNull(cache.name())))
+            if (cache == stoppedCaches.remove(cache.name()))
                 stopCache(cache, cancel, false);
         }
 
@@ -1080,10 +1077,10 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         }
 
         for (String cacheName : stopSeq) {
-            GridCacheAdapter<?, ?> cache = caches.remove(maskNull(cacheName));
+            GridCacheAdapter<?, ?> cache = caches.remove(cacheName);
 
             if (cache != null) {
-                stoppedCaches.put(maskNull(cacheName), cache);
+                stoppedCaches.put(cacheName, cache);
 
                 onKernalStop(cache, cancel);
             }
@@ -1149,7 +1146,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             boolean sysCache = CU.isUtilityCache(name) || CU.isAtomicsCache(name);
 
             if (!sysCache) {
-                DynamicCacheDescriptor oldDesc = cachesOnDisconnect.get(maskNull(name));
+                DynamicCacheDescriptor oldDesc = cachesOnDisconnect.get(name);
 
                 assert oldDesc != null : "No descriptor for cache: " + name;
 
@@ -1165,8 +1162,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
                 sharedCtx.removeCacheContext(cache.ctx);
 
-                caches.remove(maskNull(cache.name()));
-                jCacheProxies.remove(maskNull(cache.name()));
+                caches.remove(cache.name());
+                jCacheProxies.remove(cache.name());
 
                 IgniteInternalFuture<?> fut = ctx.closure().runLocalSafe(new Runnable() {
                     @Override public void run() {
@@ -1811,6 +1808,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @return Cache mode.
      */
     public CacheMode cacheMode(String cacheName) {
+        assert cacheName != null;
+
         DynamicCacheDescriptor desc = cacheDescriptor(cacheName);
 
         return desc != null ? desc.cacheConfiguration().getCacheMode() : null;
@@ -1939,7 +1938,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
             sharedCtx.addCacheContext(cacheCtx);
 
-            caches.put(maskNull(cacheCtx.name()), cache);
+            caches.put(cacheCtx.name(), cache);
 
             startCache(cache, schema != null ? schema : new QuerySchema());
 
@@ -1955,7 +1954,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
         if (req.stop() || (req.close() && req.initiatingNodeId().equals(ctx.localNodeId()))) {
             // Break the proxy before exchange future is done.
-            IgniteCacheProxy<?, ?> proxy = jCacheProxies.get(maskNull(req.cacheName()));
+            IgniteCacheProxy<?, ?> proxy = jCacheProxies.get(req.cacheName());
 
             if (proxy != null) {
                 if (req.stop())
@@ -1973,7 +1972,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         assert req.stop() : req;
 
         // Break the proxy before exchange future is done.
-        IgniteCacheProxy<?, ?> proxy = jCacheProxies.remove(maskNull(req.cacheName()));
+        IgniteCacheProxy<?, ?> proxy = jCacheProxies.remove(req.cacheName());
 
         if (proxy != null)
             proxy.gate().onStopped();
@@ -1985,7 +1984,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     private void prepareCacheStop(DynamicCacheChangeRequest req) {
         assert req.stop() || req.close() : req;
 
-        GridCacheAdapter<?, ?> cache = caches.remove(maskNull(req.cacheName()));
+        GridCacheAdapter<?, ?> cache = caches.remove(req.cacheName());
 
         if (cache != null) {
             GridCacheContext<?, ?> ctx = cache.context();
@@ -2021,7 +2020,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                 if (cacheCtx.preloader() != null)
                     cacheCtx.preloader().onInitialExchangeComplete(err);
 
-                String masked = maskNull(cacheCtx.name());
+                String masked = cacheCtx.name();
 
                 jCacheProxies.put(masked, new IgniteCacheProxy(cache.context(), cache, null, false));
             }
@@ -2029,7 +2028,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
         if (!F.isEmpty(reqs) && err == null) {
             for (DynamicCacheChangeRequest req : reqs) {
-                String masked = maskNull(req.cacheName());
+                String masked = req.cacheName();
 
                 if (req.stop()) {
                     stopGateway(req);
@@ -2220,7 +2219,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             UUID nodeId
     ) {
         for (GridCacheAdapter<?, ?> cache : caches.values()) {
-            DynamicCacheDescriptor desc = cachesOnDisconnect.get(maskNull(cache.name()));
+            DynamicCacheDescriptor desc = cachesOnDisconnect.get(cache.name());
 
             if (desc == null)
                 continue;
@@ -2300,7 +2299,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
                     assert ccfg != null : req;
 
-                    DynamicCacheDescriptor existing = registeredTemplates.get(maskNull(req.cacheName()));
+                    DynamicCacheDescriptor existing = registeredTemplates.get(req.cacheName());
 
                     if (existing == null) {
                         DynamicCacheDescriptor desc = new DynamicCacheDescriptor(
@@ -2311,7 +2310,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                                 req.deploymentId(),
                                 req.schema());
 
-                        registeredTemplates.put(maskNull(req.cacheName()), desc);
+                        registeredTemplates.put(req.cacheName(), desc);
                     }
 
                     continue;
@@ -2444,6 +2443,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @return Future that will be completed when cache is deployed.
      */
     public IgniteInternalFuture<?> getOrCreateFromTemplate(String cacheName, boolean checkThreadTx) {
+        assert cacheName != null;
+
         try {
             if (publicJCache(cacheName, false, checkThreadTx) != null) // Cache with given name already started.
                 return new GridFinishedFuture<>();
@@ -2580,6 +2581,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         boolean failIfNotStarted,
         boolean checkThreadTx
     ) {
+        assert cacheName != null;
+
         if (checkThreadTx)
             checkEmptyTransactions();
 
@@ -2610,9 +2613,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @param checkThreadTx If {@code true} checks that current thread does not have active transactions.
      * @return Future that will be completed when all caches are deployed.
      */
-    public IgniteInternalFuture<?> dynamicStartCaches(
-        Collection<CacheConfiguration> ccfgList, boolean failIfExists, boolean checkThreadTx
-    ) {
+    public IgniteInternalFuture<?> dynamicStartCaches(Collection<CacheConfiguration> ccfgList, boolean failIfExists,
+        boolean checkThreadTx) {
         return dynamicStartCaches(ccfgList, CacheType.USER, failIfExists, checkThreadTx);
     }
 
@@ -2675,6 +2677,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @return Future that will be completed when cache is destroyed.
      */
     public IgniteInternalFuture<?> dynamicDestroyCache(String cacheName, boolean checkThreadTx) {
+        assert cacheName != null;
+
         if (checkThreadTx)
             checkEmptyTransactions();
 
@@ -2720,7 +2724,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @return Future that will be completed when cache is closed.
      */
     public IgniteInternalFuture<?> dynamicCloseCache(String cacheName) {
-        IgniteCacheProxy<?, ?> proxy = jCacheProxies.get(maskNull(cacheName));
+        assert cacheName != null;
+
+        IgniteCacheProxy<?, ?> proxy = jCacheProxies.get(cacheName);
 
         if (proxy == null || proxy.proxyClosed())
             return new GridFinishedFuture<>(); // No-op.
@@ -2837,6 +2843,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         boolean needInit
     ) throws IgniteCheckedException {
         assert cfg != null;
+        assert cfg.getName() != null;
 
         cloneCheckSerializable(cfg);
 
@@ -3023,20 +3030,20 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
                 assert ccfg != null : req;
 
-                DynamicCacheDescriptor desc = registeredTemplates.get(maskNull(req.cacheName()));
+                DynamicCacheDescriptor desc = registeredTemplates.get(req.cacheName());
 
                 if (desc == null) {
                     DynamicCacheDescriptor templateDesc = new DynamicCacheDescriptor(ctx, ccfg, req.cacheType(), true,
                         req.deploymentId(), req.schema());
 
-                    DynamicCacheDescriptor old = registeredTemplates.put(maskNull(ccfg.getName()), templateDesc);
+                    DynamicCacheDescriptor old = registeredTemplates.put(ccfg.getName(), templateDesc);
 
                     assert old == null :
                         "Dynamic cache map was concurrently modified [new=" + templateDesc + ", old=" + old + ']';
                 }
 
                 TemplateConfigurationFuture fut =
-                    (TemplateConfigurationFuture)pendingTemplateFuts.get(maskNull(ccfg.getName()));
+                    (TemplateConfigurationFuture)pendingTemplateFuts.get(ccfg.getName());
 
                 if (fut != null && fut.deploymentId().equals(req.deploymentId()))
                     fut.onDone();
@@ -3152,7 +3159,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
                 if (desc != null) {
                     if (req.stop()) {
-                        DynamicCacheDescriptor old = registeredCaches.remove(maskNull(req.cacheName()));
+                        DynamicCacheDescriptor old = registeredCaches.remove(req.cacheName());
 
                         assert old != null : "Dynamic cache map was concurrently modified [req=" + req + ']';
 
@@ -3417,26 +3424,19 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     }
 
     /**
-     * @param <K> type of keys.
-     * @param <V> type of values.
-     * @return Default cache.
-     */
-    public <K, V> IgniteInternalCache<K, V> cache() {
-        return cache(null);
-    }
-
-    /**
      * @param name Cache name.
      * @param <K> type of keys.
      * @param <V> type of values.
      * @return Cache instance for given name.
      */
     @SuppressWarnings("unchecked")
-    public <K, V> IgniteInternalCache<K, V> cache(@Nullable String name) {
+    public <K, V> IgniteInternalCache<K, V> cache(String name) {
+        assert name != null;
+
         if (log.isDebugEnabled())
             log.debug("Getting cache for name: " + name);
 
-        IgniteCacheProxy<K, V> jcache = (IgniteCacheProxy<K, V>)jCacheProxies.get(maskNull(name));
+        IgniteCacheProxy<K, V> jcache = (IgniteCacheProxy<K, V>)jCacheProxies.get(name);
 
         return jcache == null ? null : jcache.internalProxy();
     }
@@ -3447,18 +3447,18 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @throws IgniteCheckedException If failed.
      */
     @SuppressWarnings("unchecked")
-    public <K, V> IgniteInternalCache<K, V> getOrStartCache(@Nullable String name) throws IgniteCheckedException {
+    public <K, V> IgniteInternalCache<K, V> getOrStartCache(String name) throws IgniteCheckedException {
+        assert name != null;
+
         if (log.isDebugEnabled())
             log.debug("Getting cache for name: " + name);
 
-        String masked = maskNull(name);
-
-        IgniteCacheProxy<?, ?> cache = jCacheProxies.get(masked);
+        IgniteCacheProxy<?, ?> cache = jCacheProxies.get(name);
 
         if (cache == null) {
             dynamicStartCache(null, name, null, false, true, true).get();
 
-            cache = jCacheProxies.get(masked);
+            cache = jCacheProxies.get(name);
         }
 
         return cache == null ? null : (IgniteInternalCache<K, V>)cache.internalProxy();
@@ -3524,7 +3524,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @return Cache instance for given name.
      */
     @SuppressWarnings("unchecked")
-    public <K, V> IgniteInternalCache<K, V> publicCache(@Nullable String name) {
+    public <K, V> IgniteInternalCache<K, V> publicCache(String name) {
+        assert name != null;
+
         if (log.isDebugEnabled())
             log.debug("Getting public cache for name: " + name);
 
@@ -3536,7 +3538,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         if (!desc.cacheType().userCache())
             throw new IllegalStateException("Failed to get cache because it is a system cache: " + name);
 
-        IgniteCacheProxy<K, V> jcache = (IgniteCacheProxy<K, V>)jCacheProxies.get(maskNull(name));
+        IgniteCacheProxy<K, V> jcache = (IgniteCacheProxy<K, V>)jCacheProxies.get(name);
 
         if (jcache == null)
             throw new IllegalArgumentException("Cache is not started: " + name);
@@ -3551,7 +3553,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @return Cache instance for given name.
      * @throws IgniteCheckedException If failed.
      */
-    public <K, V> IgniteCacheProxy<K, V> publicJCache(@Nullable String cacheName) throws IgniteCheckedException {
+    public <K, V> IgniteCacheProxy<K, V> publicJCache(String cacheName) throws IgniteCheckedException {
         return publicJCache(cacheName, true, true);
     }
 
@@ -3564,15 +3566,15 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @throws IgniteCheckedException If failed.
      */
     @SuppressWarnings({"unchecked", "ConstantConditions"})
-    @Nullable public <K, V> IgniteCacheProxy<K, V> publicJCache(@Nullable String cacheName,
+    @Nullable public <K, V> IgniteCacheProxy<K, V> publicJCache(String cacheName,
         boolean failIfNotStarted,
         boolean checkThreadTx) throws IgniteCheckedException {
+        assert cacheName != null;
+
         if (log.isDebugEnabled())
             log.debug("Getting public cache for name: " + cacheName);
 
-        String masked = maskNull(cacheName);
-
-        IgniteCacheProxy<?, ?> cache = jCacheProxies.get(masked);
+        IgniteCacheProxy<?, ?> cache = jCacheProxies.get(cacheName);
 
         DynamicCacheDescriptor desc = cacheDescriptor(cacheName);
 
@@ -3582,7 +3584,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         if (cache == null) {
             dynamicStartCache(null, cacheName, null, false, failIfNotStarted, checkThreadTx).get();
 
-            cache = jCacheProxies.get(masked);
+            cache = jCacheProxies.get(cacheName);
         }
 
         return (IgniteCacheProxy<K, V>)cache;
@@ -3595,6 +3597,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @return Cache configuration.
      */
     public CacheConfiguration cacheConfiguration(String name) {
+        assert name != null;
+
         DynamicCacheDescriptor desc = cacheDescriptor(name);
 
         if (desc == null)
@@ -3610,7 +3614,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @return Descriptor.
      */
     public DynamicCacheDescriptor cacheDescriptor(String name) {
-        return registeredCaches.get(maskNull(name));
+        assert name != null;
+
+        return registeredCaches.get(name);
     }
 
     /**
@@ -3621,7 +3627,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @return Old descriptor (if any).
      */
     private DynamicCacheDescriptor cacheDescriptor(String name, DynamicCacheDescriptor desc) {
-        return registeredCaches.put(maskNull(name), desc);
+        assert name != null;
+
+        return registeredCaches.put(name, desc);
     }
 
     /**
@@ -3653,7 +3661,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @throws IgniteCheckedException If failed.
      */
     public void addCacheConfiguration(CacheConfiguration cacheCfg) throws IgniteCheckedException {
-        String masked = maskNull(cacheCfg.getName());
+        assert cacheCfg.getName() != null;
+
+        String masked = cacheCfg.getName();
 
         DynamicCacheDescriptor desc = registeredTemplates.get(masked);
 
@@ -3674,7 +3684,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         TemplateConfigurationFuture fut = new TemplateConfigurationFuture(req.cacheName(), req.deploymentId());
 
         TemplateConfigurationFuture old =
-            (TemplateConfigurationFuture)pendingTemplateFuts.putIfAbsent(maskNull(cacheCfg.getName()), fut);
+            (TemplateConfigurationFuture)pendingTemplateFuts.putIfAbsent(cacheCfg.getName(), fut);
 
         if (old != null)
             fut = old;
@@ -3708,8 +3718,10 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @return Cache instance for given name.
      */
     @SuppressWarnings("unchecked")
-    public <K, V> IgniteCacheProxy<K, V> jcache(@Nullable String name) {
-        IgniteCacheProxy<K, V> cache = (IgniteCacheProxy<K, V>)jCacheProxies.get(maskNull(name));
+    public <K, V> IgniteCacheProxy<K, V> jcache(String name) {
+        assert name != null;
+
+        IgniteCacheProxy<K, V> cache = (IgniteCacheProxy<K, V>)jCacheProxies.get(name);
 
         if (cache == null)
             throw new IllegalArgumentException("Cache is not configured: " + name);
@@ -3732,26 +3744,19 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     }
 
     /**
-     * @param <K> type of keys.
-     * @param <V> type of values.
-     * @return Default cache.
-     */
-    public <K, V> GridCacheAdapter<K, V> internalCache() {
-        return internalCache(null);
-    }
-
-    /**
      * @param name Cache name.
      * @param <K> type of keys.
      * @param <V> type of values.
      * @return Cache instance for given name.
      */
     @SuppressWarnings("unchecked")
-    public <K, V> GridCacheAdapter<K, V> internalCache(@Nullable String name) {
+    public <K, V> GridCacheAdapter<K, V> internalCache(String name) {
+        assert name != null;
+
         if (log.isDebugEnabled())
             log.debug("Getting internal cache adapter: " + name);
 
-        return (GridCacheAdapter<K, V>)caches.get(maskNull(name));
+        return (GridCacheAdapter<K, V>)caches.get(name);
     }
 
     /**
@@ -3780,7 +3785,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
      * @param name Cache name.
      * @return {@code True} if specified cache is system, {@code false} otherwise.
      */
-    public boolean systemCache(@Nullable String name) {
+    public boolean systemCache(String name) {
+        assert name != null;
+
         DynamicCacheDescriptor desc = cacheDescriptor(name);
 
         return desc != null && !desc.cacheType().userCache();
@@ -3850,7 +3857,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     private boolean isMissingQueryCache(DynamicCacheDescriptor desc) {
         CacheConfiguration ccfg = desc.cacheConfiguration();
 
-        return !caches.containsKey(maskNull(ccfg.getName())) && QueryUtils.isEnabled(ccfg);
+        return !caches.containsKey(ccfg.getName()) && QueryUtils.isEnabled(ccfg);
     }
 
     /**
@@ -4141,24 +4148,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     }
 
     /**
-     * @param name Name to mask.
-     * @return Masked name.
-     */
-    private static String maskNull(String name) {
-        return name == null ? NULL_NAME : name;
-    }
-
-    /**
-     * @param name Name to unmask.
-     * @return Unmasked name.
-     */
-    @SuppressWarnings("StringEquality")
-    private static String unmaskNull(String name) {
-        // Intentional identity equality.
-        return name == NULL_NAME ? null : name;
-    }
-
-    /**
      *
      */
     @SuppressWarnings("ExternalizableWithoutPublicNoArgConstructor")
@@ -4244,7 +4233,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         /** {@inheritDoc} */
         @Override public boolean onDone(@Nullable Object res, @Nullable Throwable err) {
             // Make sure to remove future before completion.
-            pendingTemplateFuts.remove(maskNull(cacheName), this);
+            pendingTemplateFuts.remove(cacheName, this);
 
             return super.onDone(res, err);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index df9c7c4..2260a99 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -62,8 +62,6 @@ import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
 import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.distributed.GridDistributedLockCancelledException;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
 import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
@@ -77,6 +75,7 @@ import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.P1;
 import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteClosure;
@@ -1691,4 +1690,31 @@ public class GridCacheUtils {
             ? DEFAULT_TX_CFG
             : cfg.getTransactionConfiguration();
     }
+
+    /**
+     * @param name Cache name.
+     * @throws IllegalArgumentException In case the name is not valid.
+     */
+    public static void validateCacheName(String name) throws IllegalArgumentException {
+        A.ensure(name != null && !name.isEmpty(), "Cache name must not be null or empty.");
+    }
+
+    /**
+     * @param cacheNames Cache names to validate.
+     * @throws IllegalArgumentException In case the name is not valid.
+     */
+    public static void validateCacheNames(Collection<String> cacheNames) throws IllegalArgumentException {
+        for (String name : cacheNames)
+            validateCacheName(name);
+    }
+
+    /**
+     * @param ccfgs Configurations to validate.
+     * @throws IllegalArgumentException In case the name is not valid.
+     */
+    public static void validateConfigurationCacheNames(Collection<CacheConfiguration> ccfgs)
+        throws IllegalArgumentException {
+        for (CacheConfiguration ccfg : ccfgs)
+            validateCacheName(ccfg.getName());
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
index 23f4343..0afba59 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
@@ -24,7 +24,6 @@ import java.util.List;
 import javax.cache.Cache;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteDataStreamer;
-import org.apache.ignite.cache.QueryIndex;
 import org.apache.ignite.cache.query.QueryCursor;
 import org.apache.ignite.cache.query.SqlFieldsQuery;
 import org.apache.ignite.cache.query.SqlQuery;
@@ -34,8 +33,6 @@ import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.processors.cache.database.CacheDataRow;
-import org.apache.ignite.internal.processors.cache.database.tree.BPlusTree;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitor;
 import org.apache.ignite.internal.util.GridSpinBusyLock;
@@ -110,7 +107,7 @@ public interface GridQueryIndexing {
      * @return Query result.
      * @throws IgniteCheckedException If failed.
      */
-    public long streamUpdateQuery(@Nullable final String spaceName, final String qry,
+    public long streamUpdateQuery(final String spaceName, final String qry,
          @Nullable final Object[] params, IgniteDataStreamer<?, ?> streamer) throws IgniteCheckedException;
 
     /**
@@ -135,7 +132,7 @@ public interface GridQueryIndexing {
      * @return Queried rows.
      * @throws IgniteCheckedException If failed.
      */
-    public <K, V> GridCloseableIterator<IgniteBiTuple<K, V>> queryLocalText(@Nullable String spaceName, String qry,
+    public <K, V> GridCloseableIterator<IgniteBiTuple<K, V>> queryLocalText(String spaceName, String qry,
         String typeName, IndexingQueryFilter filter) throws IgniteCheckedException;
 
     /**
@@ -148,7 +145,7 @@ public interface GridQueryIndexing {
      * @param cacheVisitor Cache visitor
      * @throws IgniteCheckedException if failed.
      */
-    public void dynamicIndexCreate(@Nullable String spaceName, String tblName, QueryIndexDescriptorImpl idxDesc,
+    public void dynamicIndexCreate(String spaceName, String tblName, QueryIndexDescriptorImpl idxDesc,
         boolean ifNotExists, SchemaIndexCacheVisitor cacheVisitor) throws IgniteCheckedException;
 
     /**
@@ -160,7 +157,7 @@ public interface GridQueryIndexing {
      * @throws IgniteCheckedException If failed.
      */
     @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
-    public void dynamicIndexDrop(@Nullable String spaceName, String idxName, boolean ifExists)
+    public void dynamicIndexDrop(String spaceName, String idxName, boolean ifExists)
         throws IgniteCheckedException;
 
     /**
@@ -190,7 +187,7 @@ public interface GridQueryIndexing {
      * @throws IgniteCheckedException If failed.
      * @return {@code True} if type was registered, {@code false} if for some reason it was rejected.
      */
-    public boolean registerType(@Nullable String spaceName, GridQueryTypeDescriptor desc) throws IgniteCheckedException;
+    public boolean registerType(String spaceName, GridQueryTypeDescriptor desc) throws IgniteCheckedException;
 
     /**
      * Unregisters type and removes all corresponding data.
@@ -199,7 +196,7 @@ public interface GridQueryIndexing {
      * @param typeName Type name.
      * @throws IgniteCheckedException If failed.
      */
-    public void unregisterType(@Nullable String spaceName, String typeName) throws IgniteCheckedException;
+    public void unregisterType(String spaceName, String typeName) throws IgniteCheckedException;
 
     /**
      * Updates index. Note that key is unique for space, so if space contains multiple indexes
@@ -213,7 +210,7 @@ public interface GridQueryIndexing {
      * @param expirationTime Expiration time or 0 if never expires.
      * @throws IgniteCheckedException If failed.
      */
-    public void store(@Nullable String spaceName,
+    public void store(String spaceName,
         String typeName,
         KeyCacheObject key,
         int partId,
@@ -230,7 +227,7 @@ public interface GridQueryIndexing {
      * @param val Value.
      * @throws IgniteCheckedException If failed.
      */
-    public void remove(@Nullable String spaceName,
+    public void remove(String spaceName,
         GridQueryTypeDescriptor type,
         KeyCacheObject key,
         int partId,
@@ -244,7 +241,7 @@ public interface GridQueryIndexing {
      * @param type Type descriptor.
      * @throws IgniteCheckedException If failed.
      */
-    public void rebuildIndexesFromHash(@Nullable String spaceName,
+    public void rebuildIndexesFromHash(String spaceName,
         GridQueryTypeDescriptor type) throws IgniteCheckedException;
 
     /**
@@ -253,7 +250,7 @@ public interface GridQueryIndexing {
      * @param spaceName Space name.
      * @param type Type descriptor.
      */
-    public void markForRebuildFromHash(@Nullable String spaceName, GridQueryTypeDescriptor type);
+    public void markForRebuildFromHash(String spaceName, GridQueryTypeDescriptor type);
 
     /**
      * Returns backup filter.

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/GridRedisRestCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/GridRedisRestCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/GridRedisRestCommandHandler.java
index 4446bc1..6da9d39 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/GridRedisRestCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/GridRedisRestCommandHandler.java
@@ -38,6 +38,9 @@ import org.jetbrains.annotations.Nullable;
  * Redis command handler done via REST.
  */
 public abstract class GridRedisRestCommandHandler implements GridRedisCommandHandler {
+    /** Used cache name. */
+    protected final static String CACHE_NAME = "default";
+
     /** Logger. */
     protected final IgniteLogger log;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/key/GridRedisDelCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/key/GridRedisDelCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/key/GridRedisDelCommandHandler.java
index 4460108..22d27dc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/key/GridRedisDelCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/key/GridRedisDelCommandHandler.java
@@ -73,6 +73,7 @@ public class GridRedisDelCommandHandler extends GridRedisRestCommandHandler {
         restReq.clientId(msg.clientId());
         restReq.key(msg.key());
         restReq.command(CACHE_REMOVE_ALL);
+        restReq.cacheName(CACHE_NAME);
 
         List<String> keys = msg.auxMKeys();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/key/GridRedisExistsCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/key/GridRedisExistsCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/key/GridRedisExistsCommandHandler.java
index 7402e29..0f8fc13 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/key/GridRedisExistsCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/key/GridRedisExistsCommandHandler.java
@@ -73,6 +73,7 @@ public class GridRedisExistsCommandHandler extends GridRedisRestCommandHandler {
         restReq.clientId(msg.clientId());
         restReq.key(msg.key());
         restReq.command(CACHE_GET_ALL);
+        restReq.cacheName(CACHE_NAME);
 
         List<String> keys = msg.auxMKeys();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/server/GridRedisDbSizeCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/server/GridRedisDbSizeCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/server/GridRedisDbSizeCommandHandler.java
index 071585f..44d6509 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/server/GridRedisDbSizeCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/server/GridRedisDbSizeCommandHandler.java
@@ -68,6 +68,7 @@ public class GridRedisDbSizeCommandHandler extends GridRedisRestCommandHandler {
         restReq.clientId(msg.clientId());
         restReq.key(msg.key());
         restReq.command(CACHE_SIZE);
+        restReq.cacheName(CACHE_NAME);
 
         return restReq;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisAppendCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisAppendCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisAppendCommandHandler.java
index 23304be..af8bf45 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisAppendCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisAppendCommandHandler.java
@@ -81,6 +81,7 @@ public class GridRedisAppendCommandHandler extends GridRedisRestCommandHandler {
         appendReq.key(msg.key());
         appendReq.value(val);
         appendReq.command(CACHE_APPEND);
+        appendReq.cacheName(CACHE_NAME);
 
         Object resp = hnd.handle(appendReq).getResponse();
         if (resp != null && !(boolean)resp) {
@@ -91,6 +92,7 @@ public class GridRedisAppendCommandHandler extends GridRedisRestCommandHandler {
             setReq.key(msg.key());
             setReq.value(val);
             setReq.command(CACHE_PUT);
+            setReq.cacheName(CACHE_NAME);
 
             hnd.handle(setReq);
         }
@@ -98,6 +100,7 @@ public class GridRedisAppendCommandHandler extends GridRedisRestCommandHandler {
         getReq.clientId(msg.clientId());
         getReq.key(msg.key());
         getReq.command(CACHE_GET);
+        getReq.cacheName(CACHE_NAME);
 
         return getReq;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisGetCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisGetCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisGetCommandHandler.java
index cc7008f..e42f37d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisGetCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisGetCommandHandler.java
@@ -78,6 +78,7 @@ public class GridRedisGetCommandHandler extends GridRedisRestCommandHandler {
         restReq.key(msg.key());
 
         restReq.command(CACHE_GET);
+        restReq.cacheName(CACHE_NAME);
 
         return restReq;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisGetRangeCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisGetRangeCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisGetRangeCommandHandler.java
index 4cf4a7f..300e004 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisGetRangeCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisGetRangeCommandHandler.java
@@ -78,6 +78,7 @@ public class GridRedisGetRangeCommandHandler extends GridRedisRestCommandHandler
         getReq.clientId(msg.clientId());
         getReq.key(msg.key());
         getReq.command(CACHE_GET);
+        getReq.cacheName(CACHE_NAME);
 
         return getReq;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisGetSetCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisGetSetCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisGetSetCommandHandler.java
index 434de50..1465781 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisGetSetCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisGetSetCommandHandler.java
@@ -77,6 +77,7 @@ public class GridRedisGetSetCommandHandler extends GridRedisRestCommandHandler {
         restReq.value(msg.aux(VAL_POS));
 
         restReq.command(CACHE_GET_AND_PUT);
+        restReq.cacheName(CACHE_NAME);
 
         return restReq;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisIncrDecrCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisIncrDecrCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisIncrDecrCommandHandler.java
index 7962fe2..78d8180 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisIncrDecrCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisIncrDecrCommandHandler.java
@@ -85,6 +85,7 @@ public class GridRedisIncrDecrCommandHandler extends GridRedisRestCommandHandler
         getReq.clientId(msg.clientId());
         getReq.key(msg.key());
         getReq.command(CACHE_GET);
+        getReq.cacheName(CACHE_NAME);
 
         GridRestResponse getResp = hnd.handle(getReq);
 
@@ -118,6 +119,7 @@ public class GridRedisIncrDecrCommandHandler extends GridRedisRestCommandHandler
             rmReq.clientId(msg.clientId());
             rmReq.key(msg.key());
             rmReq.command(CACHE_REMOVE);
+            rmReq.cacheName(CACHE_NAME);
 
             Object rmResp = hnd.handle(rmReq).getResponse();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisMGetCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisMGetCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisMGetCommandHandler.java
index cacb151..c77dd80 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisMGetCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisMGetCommandHandler.java
@@ -73,6 +73,7 @@ public class GridRedisMGetCommandHandler extends GridRedisRestCommandHandler {
         restReq.clientId(msg.clientId());
         restReq.key(msg.key());
         restReq.command(CACHE_GET_ALL);
+        restReq.cacheName(CACHE_NAME);
 
         List<String> keys = msg.auxMKeys();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisMSetCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisMSetCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisMSetCommandHandler.java
index 7b29546..83cfe07 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisMSetCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisMSetCommandHandler.java
@@ -71,6 +71,7 @@ public class GridRedisMSetCommandHandler extends GridRedisRestCommandHandler {
         restReq.key(msg.key());
 
         restReq.command(CACHE_PUT_ALL);
+        restReq.cacheName(CACHE_NAME);
 
         List<String> els = msg.auxMKeys();
         Map<Object, Object> mset = U.newHashMap(els.size() / 2);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisSetCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisSetCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisSetCommandHandler.java
index 4108721..b391b1b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisSetCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisSetCommandHandler.java
@@ -102,6 +102,7 @@ public class GridRedisSetCommandHandler extends GridRedisRestCommandHandler {
         restReq.key(msg.key());
 
         restReq.command(CACHE_PUT);
+        restReq.cacheName(CACHE_NAME);
 
         restReq.value(msg.aux(VAL_POS));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisSetRangeCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisSetRangeCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisSetRangeCommandHandler.java
index 15f3b56..5c8640b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisSetRangeCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisSetRangeCommandHandler.java
@@ -94,6 +94,7 @@ public class GridRedisSetRangeCommandHandler extends GridRedisRestCommandHandler
         getReq.clientId(msg.clientId());
         getReq.key(msg.key());
         getReq.command(CACHE_GET);
+        getReq.cacheName(CACHE_NAME);
 
         if (val.isEmpty())
             return getReq;
@@ -110,6 +111,7 @@ public class GridRedisSetRangeCommandHandler extends GridRedisRestCommandHandler
         putReq.clientId(msg.clientId());
         putReq.key(msg.key());
         putReq.command(CACHE_PUT);
+        putReq.cacheName(CACHE_NAME);
 
         if (resp == null) {
             byte[] dst = new byte[totalLen];

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisStrlenCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisStrlenCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisStrlenCommandHandler.java
index 17019a6..36d4675 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisStrlenCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/redis/string/GridRedisStrlenCommandHandler.java
@@ -69,6 +69,7 @@ public class GridRedisStrlenCommandHandler extends GridRedisRestCommandHandler {
         restReq.key(msg.key());
 
         restReq.command(CACHE_GET);
+        restReq.cacheName(CACHE_NAME);
 
         return restReq;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java
index c1334e0..7c76038 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/protocols/tcp/GridTcpMemcachedNioListener.java
@@ -63,6 +63,9 @@ import static org.apache.ignite.internal.util.nio.GridNioSessionMetaKey.LAST_FUT
  * Handles memcache requests.
  */
 public class GridTcpMemcachedNioListener extends GridNioServerListenerAdapter<GridMemcachedMessage> {
+    /** Used cache name in case the name was not defined in a request. */
+    private static final String CACHE_NAME = "default";
+
     /** Logger */
     private final IgniteLogger log;
 
@@ -288,7 +291,7 @@ public class GridTcpMemcachedNioListener extends GridNioServerListenerAdapter<Gr
             restReq.command(cmd);
             restReq.clientId(req.clientId());
             restReq.ttl(req.expiration());
-            restReq.cacheName(req.cacheName());
+            restReq.cacheName(req.cacheName() == null ? CACHE_NAME : req.cacheName());
             restReq.key(req.key());
 
             if (cmd == CACHE_REMOVE_ALL) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingQueryFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingQueryFilter.java b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingQueryFilter.java
index 98446ac..935feab 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingQueryFilter.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/indexing/IndexingQueryFilter.java
@@ -30,7 +30,7 @@ public interface IndexingQueryFilter {
      * @param spaceName Space name.
      * @return Predicate or {@code null} if no filtering is needed.
      */
-    @Nullable public <K, V> IgniteBiPredicate<K, V> forSpace(@Nullable String spaceName);
+    @Nullable public <K, V> IgniteBiPredicate<K, V> forSpace(String spaceName);
 
     /**
      * Is the value required for filtering logic?

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/config/discovery-stress.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/discovery-stress.xml b/modules/core/src/test/config/discovery-stress.xml
index 3c5c214..86b2636 100644
--- a/modules/core/src/test/config/discovery-stress.xml
+++ b/modules/core/src/test/config/discovery-stress.xml
@@ -27,9 +27,9 @@
 
         <property name="cacheConfiguration">
             <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                <property name="name" value="default"/>
                 <property name="cacheMode" value="PARTITIONED"/>
                 <property name="rebalanceMode" value="SYNC"/>
-                <property name="swapEnabled" value="false"/>
                 <property name="writeSynchronizationMode" value="FULL_ASYNC"/>
 
                 <property name="evictionPolicy">


[38/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataUpdatesFlowTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataUpdatesFlowTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataUpdatesFlowTest.java
index e0fc205..9ec48cf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataUpdatesFlowTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/BinaryMetadataUpdatesFlowTest.java
@@ -158,7 +158,7 @@ public class BinaryMetadataUpdatesFlowTest extends GridCommonAbstractTest {
 
         cfg.setClientMode(clientMode);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(CacheMode.REPLICATED);
 
@@ -221,14 +221,14 @@ public class BinaryMetadataUpdatesFlowTest extends GridCommonAbstractTest {
 
             IgniteEx client = startGrid(idx);
 
-            client.cache(null).withKeepBinary().query(qry);
+            client.cache(DEFAULT_CACHE_NAME).withKeepBinary().query(qry);
         }
         else {
             applyDiscoveryHook = false;
 
             IgniteEx client = startGrid(idx);
 
-            client.cache(null).withKeepBinary().query(qry);
+            client.cache(DEFAULT_CACHE_NAME).withKeepBinary().query(qry);
         }
     }
 
@@ -292,7 +292,7 @@ public class BinaryMetadataUpdatesFlowTest extends GridCommonAbstractTest {
 
         IgniteEx ignite0 = grid(0);
 
-        IgniteCache<Object, Object> cache0 = ignite0.cache(null);
+        IgniteCache<Object, Object> cache0 = ignite0.cache(DEFAULT_CACHE_NAME);
 
         int cacheEntries = cache0.size(CachePeekMode.PRIMARY);
 
@@ -564,7 +564,7 @@ public class BinaryMetadataUpdatesFlowTest extends GridCommonAbstractTest {
         @Override public Object call() throws Exception {
             START_LATCH.await();
 
-            IgniteCache<Object, Object> cache = ignite.cache(null).withKeepBinary();
+            IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME).withKeepBinary();
 
             while (!updatesQueue.isEmpty()) {
                 BinaryUpdateDescription desc = updatesQueue.poll();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java
index bc9214f..8a2d0bf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java
@@ -100,7 +100,7 @@ public class CacheKeepBinaryWithInterceptorTest extends GridCommonAbstractTest {
             TestInterceptor1.onBeforePut = 0;
             TestInterceptor1.onGet = 0;
 
-            IgniteCache cache = ignite(0).cache(null).withKeepBinary();
+            IgniteCache cache = ignite(0).cache(DEFAULT_CACHE_NAME).withKeepBinary();
 
             cache.put(new TestKey(1), new TestValue(10));
 
@@ -151,7 +151,7 @@ public class CacheKeepBinaryWithInterceptorTest extends GridCommonAbstractTest {
             TestInterceptor2.onBeforePut = 0;
             TestInterceptor2.onGet = 0;
 
-            IgniteCache cache = ignite(0).cache(null).withKeepBinary();
+            IgniteCache cache = ignite(0).cache(DEFAULT_CACHE_NAME).withKeepBinary();
 
             cache.put(1, 10);
 
@@ -195,7 +195,7 @@ public class CacheKeepBinaryWithInterceptorTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     private CacheConfiguration cacheConfiguration(CacheAtomicityMode atomicityMode, boolean testPrimitives) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setInterceptor(testPrimitives ? new TestInterceptor2() : new TestInterceptor1());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryAtomicEntryProcessorDeploymentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryAtomicEntryProcessorDeploymentSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryAtomicEntryProcessorDeploymentSelfTest.java
index c542bd6..596cf54 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryAtomicEntryProcessorDeploymentSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryAtomicEntryProcessorDeploymentSelfTest.java
@@ -30,7 +30,7 @@ public class GridCacheBinaryAtomicEntryProcessorDeploymentSelfTest
     extends GridCacheAtomicEntryProcessorDeploymentSelfTest {
     /** {@inheritDoc} */
     protected IgniteCache getCache() {
-        return grid(1).cache(null).withKeepBinary();
+        return grid(1).cache(DEFAULT_CACHE_NAME).withKeepBinary();
     }
 
     /** {@inheritDoc} */
@@ -90,8 +90,8 @@ public class GridCacheBinaryAtomicEntryProcessorDeploymentSelfTest
             assertTrue(grid(1).configuration().isClientMode());
             assertFalse(grid(0).configuration().isClientMode());
 
-            IgniteCache cache1 = grid(1).cache(null);
-            IgniteCache cache0 = grid(0).cache(null);
+            IgniteCache cache1 = grid(1).cache(DEFAULT_CACHE_NAME);
+            IgniteCache cache0 = grid(0).cache(DEFAULT_CACHE_NAME);
 
             if (withKeepBinary) {
                 cache1 = cache1.withKeepBinary();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectMetadataExchangeMultinodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectMetadataExchangeMultinodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectMetadataExchangeMultinodeTest.java
index 2dcfab8..9370e27 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectMetadataExchangeMultinodeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectMetadataExchangeMultinodeTest.java
@@ -96,7 +96,7 @@ public class GridCacheBinaryObjectMetadataExchangeMultinodeTest extends GridComm
 
         cfg.setClientMode(clientMode);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(CacheMode.REPLICATED);
 
@@ -244,7 +244,7 @@ public class GridCacheBinaryObjectMetadataExchangeMultinodeTest extends GridComm
                     // No-op.
                 }
 
-                Object fieldVal = ((BinaryObject) ignite2.cache(null).withKeepBinary().get(1)).field("f1");
+                Object fieldVal = ((BinaryObject) ignite2.cache(DEFAULT_CACHE_NAME).withKeepBinary().get(1)).field("f1");
 
                 return fieldVal;
             }
@@ -272,7 +272,7 @@ public class GridCacheBinaryObjectMetadataExchangeMultinodeTest extends GridComm
             }
         }).get();
 
-        int fld = ((BinaryObject) ignite0.cache(null).withKeepBinary().get(1)).field(intFieldName);
+        int fld = ((BinaryObject) ignite0.cache(DEFAULT_CACHE_NAME).withKeepBinary().get(1)).field(intFieldName);
 
         assertEquals(fld, 101);
 
@@ -286,7 +286,7 @@ public class GridCacheBinaryObjectMetadataExchangeMultinodeTest extends GridComm
             }
         }).get();
 
-        assertEquals(((BinaryObject)ignite1.cache(null).withKeepBinary().get(2)).field(strFieldName), "str");
+        assertEquals(((BinaryObject)ignite1.cache(DEFAULT_CACHE_NAME).withKeepBinary().get(2)).field(strFieldName), "str");
     }
 
     /**
@@ -317,7 +317,7 @@ public class GridCacheBinaryObjectMetadataExchangeMultinodeTest extends GridComm
 
         String res = client.compute(clientGrp).call(new IgniteCallable<String>() {
             @Override public String call() throws Exception {
-                return ((BinaryObject)client.cache(null).withKeepBinary().get(1)).field("f2");
+                return ((BinaryObject)client.cache(DEFAULT_CACHE_NAME).withKeepBinary().get(1)).field("f2");
             }
         });
 
@@ -349,7 +349,7 @@ public class GridCacheBinaryObjectMetadataExchangeMultinodeTest extends GridComm
 
         client.compute(clientGrp).call(new IgniteCallable<String>() {
             @Override public String call() throws Exception {
-                return ((BinaryObject)client.cache(null).withKeepBinary().get(0)).field("f2");
+                return ((BinaryObject)client.cache(DEFAULT_CACHE_NAME).withKeepBinary().get(0)).field("f2");
             }
         });
 
@@ -436,7 +436,7 @@ public class GridCacheBinaryObjectMetadataExchangeMultinodeTest extends GridComm
     private void addIntField(Ignite ignite, String fieldName, int fieldVal, int cacheIdx) {
         BinaryObjectBuilder builder = ignite.binary().builder(BINARY_TYPE_NAME);
 
-        IgniteCache<Object, Object> cache = ignite.cache(null).withKeepBinary();
+        IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME).withKeepBinary();
 
         builder.setField(fieldName, fieldVal);
 
@@ -454,7 +454,7 @@ public class GridCacheBinaryObjectMetadataExchangeMultinodeTest extends GridComm
     private void addStringField(Ignite ignite, String fieldName, String fieldVal, int cacheIdx) {
         BinaryObjectBuilder builder = ignite.binary().builder(BINARY_TYPE_NAME);
 
-        IgniteCache<Object, Object> cache = ignite.cache(null).withKeepBinary();
+        IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME).withKeepBinary();
 
         builder.setField(fieldName, fieldVal);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectUserClassloaderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectUserClassloaderSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectUserClassloaderSelfTest.java
index 976dd01..40d8d04 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectUserClassloaderSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectUserClassloaderSelfTest.java
@@ -165,8 +165,8 @@ public class GridCacheBinaryObjectUserClassloaderSelfTest extends GridCommonAbst
             Ignite i1 = startGrid(1);
             Ignite i2 = startGrid(2);
 
-            IgniteCache<Integer, Object> cache1 = i1.cache(null);
-            IgniteCache<Integer, Object> cache2 = i2.cache(null);
+            IgniteCache<Integer, Object> cache1 = i1.cache(DEFAULT_CACHE_NAME);
+            IgniteCache<Integer, Object> cache2 = i2.cache(DEFAULT_CACHE_NAME);
 
             ClassLoader ldr = useWrappingLoader ?
                 ((WrappingClassLoader)i1.configuration().getClassLoader()).getParent() :

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractDataStreamerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractDataStreamerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractDataStreamerSelfTest.java
index e11342f..3ad1ec8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractDataStreamerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractDataStreamerSelfTest.java
@@ -53,7 +53,7 @@ public abstract class GridCacheBinaryObjectsAbstractDataStreamerSelfTest extends
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration cacheCfg = new CacheConfiguration();
+        CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cacheCfg.setCacheMode(cacheMode());
         cacheCfg.setAtomicityMode(atomicityMode());
@@ -121,7 +121,7 @@ public abstract class GridCacheBinaryObjectsAbstractDataStreamerSelfTest extends
 
         final LongAdder8 cnt = new LongAdder8();
 
-        try (IgniteDataStreamer<Object, Object> ldr = grid(0).dataStreamer(null)) {
+        try (IgniteDataStreamer<Object, Object> ldr = grid(0).dataStreamer(DEFAULT_CACHE_NAME)) {
             IgniteInternalFuture<?> f = multithreadedAsync(
                 new Callable<Object>() {
                     @Override public Object call() throws Exception {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java
index ad78bad..f1e9dd1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractMultiThreadedSelfTest.java
@@ -67,7 +67,7 @@ public abstract class GridCacheBinaryObjectsAbstractMultiThreadedSelfTest extend
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
 
-        CacheConfiguration cacheCfg = new CacheConfiguration();
+        CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cacheCfg.setCacheMode(cacheMode());
         cacheCfg.setAtomicityMode(atomicityMode());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
index a327dcb..6936da5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryObjectsAbstractSelfTest.java
@@ -145,7 +145,7 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
      */
     @SuppressWarnings("unchecked")
     private CacheConfiguration createCacheConfig() {
-        CacheConfiguration cacheCfg = new CacheConfiguration();
+        CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cacheCfg.setCacheMode(cacheMode());
         cacheCfg.setAtomicityMode(atomicityMode());
@@ -173,7 +173,7 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
         for (int i = 0; i < gridCount(); i++) {
-            GridCacheAdapter<Object, Object> c = ((IgniteKernal)grid(i)).internalCache();
+            GridCacheAdapter<Object, Object> c = ((IgniteKernal)grid(i)).internalCache(DEFAULT_CACHE_NAME);
 
             for (GridCacheEntryEx e : c.map().entries()) {
                 Object key = e.key().value(c.context().cacheObjectContext(), false);
@@ -1007,7 +1007,7 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
         if (atomicityMode() != TRANSACTIONAL)
             return;
 
-        IgniteCache<Integer, TestObject> cache = ignite(0).cache(null);
+        IgniteCache<Integer, TestObject> cache = ignite(0).cache(DEFAULT_CACHE_NAME);
 
         cache.put(0, new TestObject(1));
 
@@ -1100,7 +1100,7 @@ public abstract class GridCacheBinaryObjectsAbstractSelfTest extends GridCommonA
      * @return Cache with keep binary flag.
      */
     private <K, V> IgniteCache<K, V> keepBinaryCache() {
-        return ignite(0).cache(null).withKeepBinary();
+        return ignite(0).cache(DEFAULT_CACHE_NAME).withKeepBinary();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryStoreAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryStoreAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryStoreAbstractSelfTest.java
index 7b5ecc2..b505f38 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryStoreAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheBinaryStoreAbstractSelfTest.java
@@ -67,7 +67,7 @@ public abstract class GridCacheBinaryStoreAbstractSelfTest extends GridCommonAbs
 
         cfg.setMarshaller(new BinaryMarshaller());
 
-        CacheConfiguration cacheCfg = new CacheConfiguration();
+        CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cacheCfg.setCacheStoreFactory(singletonFactory(STORE));
         cacheCfg.setStoreKeepBinary(keepBinaryInStore());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java
index b337614..313aaf9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheClientNodeBinaryObjectMetadataMultinodeTest.java
@@ -65,7 +65,7 @@ public class GridCacheClientNodeBinaryObjectMetadataMultinodeTest extends GridCo
 
         cfg.setMarshaller(new BinaryMarshaller());
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
 
@@ -101,7 +101,7 @@ public class GridCacheClientNodeBinaryObjectMetadataMultinodeTest extends GridCo
                 @Override public Object call() throws Exception {
                     IgniteBinary binaries = ignite(0).binary();
 
-                    IgniteCache<Object, Object> cache = ignite(0).cache(null).withKeepBinary();
+                    IgniteCache<Object, Object> cache = ignite(0).cache(DEFAULT_CACHE_NAME).withKeepBinary();
 
                     ThreadLocalRandom rnd = ThreadLocalRandom.current();
 
@@ -186,7 +186,7 @@ public class GridCacheClientNodeBinaryObjectMetadataMultinodeTest extends GridCo
 
         IgniteBinary binaries = ignite(0).binary();
 
-        IgniteCache<Object, Object> cache = ignite(0).cache(null).withKeepBinary();
+        IgniteCache<Object, Object> cache = ignite(0).cache(DEFAULT_CACHE_NAME).withKeepBinary();
 
         for (int i = 0; i < 1000; i++) {
             BinaryObjectBuilder builder = binaries.builder("type-" + i);
@@ -282,7 +282,7 @@ public class GridCacheClientNodeBinaryObjectMetadataMultinodeTest extends GridCo
 
         IgniteBinary binaries = ignite(1).binary();
 
-        IgniteCache<Object, Object> cache = ignite(1).cache(null).withKeepBinary();
+        IgniteCache<Object, Object> cache = ignite(1).cache(DEFAULT_CACHE_NAME).withKeepBinary();
 
         for (int i = 0; i < 100; i++) {
             BinaryObjectBuilder builder = binaries.builder("type-" + i);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheClientNodeBinaryObjectMetadataTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheClientNodeBinaryObjectMetadataTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheClientNodeBinaryObjectMetadataTest.java
index 93b769b..0316edc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheClientNodeBinaryObjectMetadataTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/GridCacheClientNodeBinaryObjectMetadataTest.java
@@ -103,8 +103,8 @@ public class GridCacheClientNodeBinaryObjectMetadataTest extends GridCacheAbstra
 
         assertFalse(ignite1.configuration().isClientMode());
 
-        Affinity<Object> aff0 = ignite0.affinity(null);
-        Affinity<Object> aff1 = ignite1.affinity(null);
+        Affinity<Object> aff0 = ignite0.affinity(DEFAULT_CACHE_NAME);
+        Affinity<Object> aff1 = ignite1.affinity(DEFAULT_CACHE_NAME);
 
         for (int i = 0 ; i < 100; i++) {
             TestObject1 obj1 = new TestObject1(i, i + 1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/datastreaming/GridDataStreamerImplSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/datastreaming/GridDataStreamerImplSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/datastreaming/GridDataStreamerImplSelfTest.java
index a7346c9..c629871 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/datastreaming/GridDataStreamerImplSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/datastreaming/GridDataStreamerImplSelfTest.java
@@ -110,7 +110,7 @@ public class GridDataStreamerImplSelfTest extends GridCommonAbstractTest {
 
             Ignite g0 = grid(0);
 
-            IgniteDataStreamer<Integer, String> dataLdr = g0.dataStreamer(null);
+            IgniteDataStreamer<Integer, String> dataLdr = g0.dataStreamer(DEFAULT_CACHE_NAME);
 
             Map<Integer, String> map = U.newHashMap(KEYS_COUNT);
 
@@ -128,7 +128,7 @@ public class GridDataStreamerImplSelfTest extends GridCommonAbstractTest {
             // Check several random keys in cache.
             Random rnd = new Random();
 
-            IgniteCache<Integer, String> c0 = g0.cache(null);
+            IgniteCache<Integer, String> c0 = g0.cache(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < 100; i ++) {
                 Integer k = rnd.nextInt(KEYS_COUNT);
@@ -158,7 +158,7 @@ public class GridDataStreamerImplSelfTest extends GridCommonAbstractTest {
 
             Ignite g0 = grid(0);
 
-            IgniteDataStreamer<Integer, TestObject2> dataLdr = g0.dataStreamer(null);
+            IgniteDataStreamer<Integer, TestObject2> dataLdr = g0.dataStreamer(DEFAULT_CACHE_NAME);
 
             dataLdr.perNodeBufferSize(1);
             dataLdr.autoFlushFrequency(1L);
@@ -193,7 +193,7 @@ public class GridDataStreamerImplSelfTest extends GridCommonAbstractTest {
 
             Ignite g0 = grid(0);
 
-            IgniteDataStreamer<Integer, TestObject> dataLdr = g0.dataStreamer(null);
+            IgniteDataStreamer<Integer, TestObject> dataLdr = g0.dataStreamer(DEFAULT_CACHE_NAME);
 
             Map<Integer, TestObject> map = U.newHashMap(KEYS_COUNT);
 
@@ -211,7 +211,7 @@ public class GridDataStreamerImplSelfTest extends GridCommonAbstractTest {
             // Read random keys. Take values as TestObject.
             Random rnd = new Random();
 
-            IgniteCache<Integer, TestObject> c = g0.cache(null);
+            IgniteCache<Integer, TestObject> c = g0.cache(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < 100; i ++) {
                 Integer k = rnd.nextInt(KEYS_COUNT);
@@ -252,7 +252,7 @@ public class GridDataStreamerImplSelfTest extends GridCommonAbstractTest {
 
             Ignite g0 = grid(0);
 
-            IgniteDataStreamer<Integer, BinaryObject> dataLdr = g0.dataStreamer(null);
+            IgniteDataStreamer<Integer, BinaryObject> dataLdr = g0.dataStreamer(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < 500; i++) {
                 BinaryObjectBuilder obj = g0.binary().builder("NoExistedClass");
@@ -265,8 +265,8 @@ public class GridDataStreamerImplSelfTest extends GridCommonAbstractTest {
 
             dataLdr.close(false);
 
-            assertEquals(500, g0.cache(null).size(CachePeekMode.ALL));
-            assertEquals(500, grid(1).cache(null).size(CachePeekMode.ALL));
+            assertEquals(500, g0.cache(DEFAULT_CACHE_NAME).size(CachePeekMode.ALL));
+            assertEquals(500, grid(1).cache(DEFAULT_CACHE_NAME).size(CachePeekMode.ALL));
         }
         finally {
             G.stopAll(true);
@@ -280,11 +280,11 @@ public class GridDataStreamerImplSelfTest extends GridCommonAbstractTest {
      */
     private void checkDistribution(Ignite g) {
         ClusterNode n = g.cluster().localNode();
-        IgniteCache<Object, Object> c = g.cache(null);
+        IgniteCache<Object, Object> c = g.cache(DEFAULT_CACHE_NAME);
 
         // Check that data streamer correctly split data by nodes.
         for (int i = 0; i < KEYS_COUNT; i ++) {
-            if (g.affinity(null).isPrimary(n, i))
+            if (g.affinity(DEFAULT_CACHE_NAME).isPrimary(n, i))
                 assertNotNull(c.localPeek(i));
             else
                 assertNull(c.localPeek(i));

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAbstractExecutionContextTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAbstractExecutionContextTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAbstractExecutionContextTest.java
index 6948a68..10a5912 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAbstractExecutionContextTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAbstractExecutionContextTest.java
@@ -67,7 +67,7 @@ public abstract class IgniteCacheAbstractExecutionContextTest extends IgniteCach
 
         Object val = testClassLdr.loadClass(TEST_VALUE).newInstance();
 
-        IgniteCache<Object, Object> jcache = grid(0).cache(null);
+        IgniteCache<Object, Object> jcache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < ITER_CNT; i++)
             jcache.put(i, val);
@@ -80,7 +80,7 @@ public abstract class IgniteCacheAbstractExecutionContextTest extends IgniteCach
                 assertEquals(testClassLdr, jcache.get(i).getClass().getClassLoader());
             else
                 assertEquals(grid(idx).configuration().getClassLoader(),
-                    grid(idx).cache(null).get(i).getClass().getClassLoader());
+                    grid(idx).cache(DEFAULT_CACHE_NAME).get(i).getClass().getClassLoader());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
index b38f07e..5656138 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAbstractDataStructuresFailoverSelfTest.java
@@ -135,7 +135,7 @@ public abstract class GridCacheAbstractDataStructuresFailoverSelfTest extends Ig
 
         cfg.setAtomicConfiguration(atomicCfg);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(TRANSACTIONAL_CACHE_NAME);
         ccfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
index b82da58..ab04503 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicReferenceApiSelfAbstractTest.java
@@ -144,7 +144,7 @@ public abstract class GridCacheAtomicReferenceApiSelfAbstractTest extends Ignite
     public void testIsolation() throws Exception {
         Ignite ignite = grid(0);
 
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setName("myCache");
         cfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicStampedApiSelfAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicStampedApiSelfAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicStampedApiSelfAbstractTest.java
index 81300e4..b52c913 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicStampedApiSelfAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheAtomicStampedApiSelfAbstractTest.java
@@ -134,7 +134,7 @@ public abstract class GridCacheAtomicStampedApiSelfAbstractTest extends IgniteAt
     public void testIsolation() throws Exception {
         Ignite ignite = grid(0);
 
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setName("MyCache");
         cfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueApiSelfAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueApiSelfAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueApiSelfAbstractTest.java
index 3e7eff9..d4604fe 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueApiSelfAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueApiSelfAbstractTest.java
@@ -784,7 +784,7 @@ public abstract class GridCacheQueueApiSelfAbstractTest extends IgniteCollection
     public void testIsolation() throws Exception {
         Ignite ignite = grid(0);
 
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setName("myCache");
         cfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueCleanupSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueCleanupSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueCleanupSelfTest.java
index 725b226..654e729 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueCleanupSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheQueueCleanupSelfTest.java
@@ -105,7 +105,7 @@ public class GridCacheQueueCleanupSelfTest extends IgniteCollectionAbstractTest
 
         stopGrid(killGridName);
 
-        assertNull(((IgniteKernal)grid).cache(null).dataStructures().queue(QUEUE_NAME1, 0, false, false));
+        assertNull(((IgniteKernal)grid).cache(DEFAULT_CACHE_NAME).dataStructures().queue(QUEUE_NAME1, 0, false, false));
 
         final AtomicBoolean stop = new AtomicBoolean(false);
 
@@ -126,8 +126,8 @@ public class GridCacheQueueCleanupSelfTest extends IgniteCollectionAbstractTest
         fut1.get();
         fut2.get();
 
-        ((IgniteKernal)grid).cache(null).dataStructures().removeQueue(QUEUE_NAME1);
-        ((IgniteKernal)grid).cache(null).dataStructures().removeQueue(QUEUE_NAME2);
+        ((IgniteKernal)grid).cache(DEFAULT_CACHE_NAME).dataStructures().removeQueue(QUEUE_NAME1);
+        ((IgniteKernal)grid).cache(DEFAULT_CACHE_NAME).dataStructures().removeQueue(QUEUE_NAME2);
 
         assertTrue(GridTestUtils.waitForCondition(new PAX() {
             @Override public boolean applyx() {
@@ -136,7 +136,7 @@ public class GridCacheQueueCleanupSelfTest extends IgniteCollectionAbstractTest
                         continue;
 
                     Iterator<GridCacheEntryEx<Object, Object>> entries =
-                        ((GridKernal)grid(i)).context().cache().internalCache().map().allEntries0().iterator();
+                        ((GridKernal)grid(i)).context().cache().internalCache(DEFAULT_CACHE_NAME).map().allEntries0().iterator();
 
                     if (entries.hasNext()) {
                         log.info("Found cache entries, will wait: " + entries.next());
@@ -152,7 +152,7 @@ public class GridCacheQueueCleanupSelfTest extends IgniteCollectionAbstractTest
         startGrid(killGridName);
 
         // Create queue again.
-        queue = ((IgniteKernal)grid).cache(null).dataStructures().queue(QUEUE_NAME1, 0, false, true);
+        queue = ((IgniteKernal)grid).cache(DEFAULT_CACHE_NAME).dataStructures().queue(QUEUE_NAME1, 0, false, true);
         */
 
         assertEquals(0, queue.size());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSequenceApiSelfAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSequenceApiSelfAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSequenceApiSelfAbstractTest.java
index 6439eab..62d7097 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSequenceApiSelfAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSequenceApiSelfAbstractTest.java
@@ -79,7 +79,7 @@ public abstract class GridCacheSequenceApiSelfAbstractTest extends IgniteAtomics
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(TRANSACTIONAL_CACHE_NAME);
         ccfg.setCacheMode(PARTITIONED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
index 5ccb830..517a7ad 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetAbstractSelfTest.java
@@ -963,7 +963,7 @@ public abstract class GridCacheSetAbstractSelfTest extends IgniteCollectionAbstr
 
         Ignite ignite = grid(0);
 
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setName("myCache");
         cfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetFailoverAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetFailoverAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetFailoverAbstractSelfTest.java
index e6e09c7..1e11c06 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetFailoverAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/GridCacheSetFailoverAbstractSelfTest.java
@@ -175,7 +175,7 @@ public abstract class GridCacheSetFailoverAbstractSelfTest extends IgniteCollect
 
             for (int i = 0; i < gridCount(); i++) {
                 Iterator<GridCacheMapEntry> entries =
-                    grid(i).context().cache().internalCache().map().entries().iterator();
+                    grid(i).context().cache().internalCache(DEFAULT_CACHE_NAME).map().entries().iterator();
 
                 while (entries.hasNext()) {
                     GridCacheEntryEx entry = entries.next();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteAtomicLongApiAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteAtomicLongApiAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteAtomicLongApiAbstractSelfTest.java
index 2d19583..fc683f0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteAtomicLongApiAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteAtomicLongApiAbstractSelfTest.java
@@ -47,7 +47,7 @@ public abstract class IgniteAtomicLongApiAbstractSelfTest extends IgniteAtomicsA
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(TRANSACTIONAL_CACHE_NAME);
         ccfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java
index 4714acf..6f3ec2d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteCountDownLatchAbstractSelfTest.java
@@ -89,7 +89,7 @@ public abstract class IgniteCountDownLatchAbstractSelfTest extends IgniteAtomics
     public void testIsolation() throws Exception {
         Ignite ignite = grid(0);
 
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setName("myCache");
         cfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java
index cccb8ab..9e11b2a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteLockAbstractSelfTest.java
@@ -124,7 +124,7 @@ public abstract class IgniteLockAbstractSelfTest extends IgniteAtomicsAbstractTe
     public void testIsolation() throws Exception {
         Ignite ignite = grid(0);
 
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setName("myCache");
         cfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
index c39fdb0..77fcce9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/IgniteSemaphoreAbstractSelfTest.java
@@ -106,7 +106,7 @@ public abstract class IgniteSemaphoreAbstractSelfTest extends IgniteAtomicsAbstr
     public void testIsolation() throws Exception {
         Ignite ignite = grid(0);
 
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setName("myCache");
         cfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicSequenceTxSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicSequenceTxSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicSequenceTxSelfTest.java
index 3de2ee9..19f97bd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicSequenceTxSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedAtomicSequenceTxSelfTest.java
@@ -126,7 +126,7 @@ public class GridCachePartitionedAtomicSequenceTxSelfTest extends GridCommonAbst
     public void testIsolation() {
         IgniteAtomicSequence seq = ignite(0).atomicSequence(SEQ_NAME, 0, true);
 
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         ccfg.setAtomicityMode(TRANSACTIONAL);
 
         IgniteCache<Object, Object> cache = ignite(0).getOrCreateCache(ccfg);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedNodeRestartTxSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedNodeRestartTxSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedNodeRestartTxSelfTest.java
index 726f0fe..bfb7e28 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedNodeRestartTxSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedNodeRestartTxSelfTest.java
@@ -160,14 +160,14 @@ public class GridCachePartitionedNodeRestartTxSelfTest extends GridCommonAbstrac
         for (int i = INIT_GRID_NUM; i < MAX_GRID_NUM; i++) {
             startGrid(i);
 
-            assert PARTITIONED == grid(i).cache(null).getConfiguration(CacheConfiguration.class).getCacheMode();
+            assert PARTITIONED == grid(i).cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getCacheMode();
 
             try (Transaction tx = grid(i).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
-                Integer val = (Integer) grid(i).cache(null).get(key);
+                Integer val = (Integer) grid(i).cache(DEFAULT_CACHE_NAME).get(key);
 
                 assertEquals("Simple check failed for node: " + i, (Integer) i, val);
 
-                grid(i).cache(null).put(key, i + 1);
+                grid(i).cache(DEFAULT_CACHE_NAME).put(key, i + 1);
 
                 tx.commit();
             }
@@ -185,12 +185,12 @@ public class GridCachePartitionedNodeRestartTxSelfTest extends GridCommonAbstrac
         for (int i = INIT_GRID_NUM; i < 20; i++) {
             startGrid(i);
 
-            assert PARTITIONED == grid(i).cache(null).getConfiguration(CacheConfiguration.class).getCacheMode();
+            assert PARTITIONED == grid(i).cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getCacheMode();
 
             try (Transaction tx = grid(i).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
                 GridCacheInternalKey key = new GridCacheInternalKeyImpl(name);
 
-                GridCacheAtomicLongValue atomicVal = ((GridCacheAtomicLongValue) grid(i).cache(null).get(key));
+                GridCacheAtomicLongValue atomicVal = ((GridCacheAtomicLongValue) grid(i).cache(DEFAULT_CACHE_NAME).get(key));
 
                 assertNotNull(atomicVal);
 
@@ -198,7 +198,7 @@ public class GridCachePartitionedNodeRestartTxSelfTest extends GridCommonAbstrac
 
                 atomicVal.set(i + 1);
 
-                grid(i).cache(null).put(key, atomicVal);
+                grid(i).cache(DEFAULT_CACHE_NAME).put(key, atomicVal);
 
                 tx.commit();
             }
@@ -216,7 +216,7 @@ public class GridCachePartitionedNodeRestartTxSelfTest extends GridCommonAbstrac
         for (int i = INIT_GRID_NUM; i < 20; i++) {
             startGrid(i);
 
-            assert PARTITIONED == grid(i).cache(null).getConfiguration(CacheConfiguration.class).getCacheMode();
+            assert PARTITIONED == grid(i).cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getCacheMode();
 
             IgniteAtomicLong atomic = grid(i).atomicLong(name, 0, true);
 
@@ -241,13 +241,13 @@ public class GridCachePartitionedNodeRestartTxSelfTest extends GridCommonAbstrac
             assert startGrid(i) != null;
 
         for (int i = 0; i < INIT_GRID_NUM; i++)
-            assert PARTITIONED == grid(i).cache(null).getConfiguration(CacheConfiguration.class).getCacheMode();
+            assert PARTITIONED == grid(i).cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getCacheMode();
 
         // Init cache data.
 
         try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
             // Put simple value.
-            grid(0).cache(null).put(key, INIT_GRID_NUM);
+            grid(0).cache(DEFAULT_CACHE_NAME).put(key, INIT_GRID_NUM);
 
             tx.commit();
         }
@@ -264,13 +264,13 @@ public class GridCachePartitionedNodeRestartTxSelfTest extends GridCommonAbstrac
             assert startGrid(i) != null;
 
         for (int i = 0; i < INIT_GRID_NUM; i++)
-            assert PARTITIONED == grid(i).cache(null).getConfiguration(CacheConfiguration.class).getCacheMode();
+            assert PARTITIONED == grid(i).cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getCacheMode();
 
         // Init cache data.
 
         try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
             // Put custom data
-            grid(0).cache(null).put(new GridCacheInternalKeyImpl(key), new GridCacheAtomicLongValue(INIT_GRID_NUM));
+            grid(0).cache(DEFAULT_CACHE_NAME).put(new GridCacheInternalKeyImpl(key), new GridCacheAtomicLongValue(INIT_GRID_NUM));
 
             tx.commit();
         }
@@ -289,7 +289,7 @@ public class GridCachePartitionedNodeRestartTxSelfTest extends GridCommonAbstrac
             assert startGrid(i) != null;
 
         for (int i = 0; i < INIT_GRID_NUM; i++)
-            assert PARTITIONED == grid(i).cache(null).getConfiguration(CacheConfiguration.class).getCacheMode();
+            assert PARTITIONED == grid(i).cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getCacheMode();
 
         // Init cache data.
         grid(0).atomicLong(key, 0, true).getAndSet(INIT_GRID_NUM);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueCreateMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueCreateMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueCreateMultiNodeSelfTest.java
index cbfee5a..d77754f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueCreateMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/GridCachePartitionedQueueCreateMultiNodeSelfTest.java
@@ -190,9 +190,9 @@ public class GridCachePartitionedQueueCreateMultiNodeSelfTest extends IgniteColl
                     // If output presents, test passes with greater probability.
                     // info("Start puts.");
 
-                    IgniteCache<Integer, String> cache = ignite.cache(null);
+                    IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
-                    info("Partition: " + ignite.affinity(null).partition(1));
+                    info("Partition: " + ignite.affinity(DEFAULT_CACHE_NAME).partition(1));
 
                     try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
                         // info("Getting value for key 1");

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java
index f2ae9ce..f1377df 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsFailoverAbstractTest.java
@@ -111,7 +111,7 @@ public abstract class CacheAsyncOperationsFailoverAbstractTest extends GridCache
      * @throws Exception If failed.
      */
     public void testAsyncFailover() throws Exception {
-        IgniteCache<TestKey, TestValue> cache = ignite(0).cache(null);
+        IgniteCache<TestKey, TestValue> cache = ignite(0).cache(DEFAULT_CACHE_NAME);
 
         int ops = cache.getConfiguration(CacheConfiguration.class).getMaxConcurrentAsyncOperations();
 
@@ -225,7 +225,7 @@ public abstract class CacheAsyncOperationsFailoverAbstractTest extends GridCache
         });
 
         try {
-            final IgniteCache<TestKey, TestValue> cache = ignite(0).cache(null);
+            final IgniteCache<TestKey, TestValue> cache = ignite(0).cache(DEFAULT_CACHE_NAME);
 
             GridTestUtils.runMultiThreaded(new Callable<Object>() {
                 @Override public Object call() throws Exception {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java
index 06baa09..3b0dbb9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheAsyncOperationsTest.java
@@ -211,7 +211,7 @@ public class CacheAsyncOperationsTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     private CacheConfiguration<Integer, Integer> cacheConfiguration(CacheAtomicityMode atomicityMode) {
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(atomicityMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetFutureHangsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetFutureHangsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetFutureHangsSelfTest.java
index 9ee8d69..1aec352 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetFutureHangsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetFutureHangsSelfTest.java
@@ -140,7 +140,7 @@ public class CacheGetFutureHangsSelfTest extends GridCommonAbstractTest {
                         Set<Integer> keys = F.asSet(1, 2, 3, 4, 5);
 
                         while ((ignite = randomNode()) != null) {
-                            IgniteCache<Object, Object> cache = ignite.get1().cache(null);
+                            IgniteCache<Object, Object> cache = ignite.get1().cache(DEFAULT_CACHE_NAME);
 
                             for (int i = 0; i < 100; i++)
                                 cache.containsKey(ThreadLocalRandom.current().nextInt(100_000));
@@ -164,7 +164,7 @@ public class CacheGetFutureHangsSelfTest extends GridCommonAbstractTest {
                         T2<Ignite, Integer> ignite;
 
                         while ((ignite = randomNode()) != null) {
-                            IgniteCache<Object, Object> cache = ignite.get1().cache(null);
+                            IgniteCache<Object, Object> cache = ignite.get1().cache(DEFAULT_CACHE_NAME);
 
                             for (int i = 0; i < 100; i++)
                                 cache.put(ThreadLocalRandom.current().nextInt(100_000), UUID.randomUUID());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetInsideLockChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetInsideLockChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetInsideLockChangingTopologyTest.java
index e8e997b..bb2a55d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetInsideLockChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheGetInsideLockChangingTopologyTest.java
@@ -106,7 +106,7 @@ public class CacheGetInsideLockChangingTopologyTest extends GridCommonAbstractTe
      * @return Cache configuration.
      */
     private CacheConfiguration cacheConfiguration(String name, CacheAtomicityMode atomicityMode) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(name);
         ccfg.setAtomicityMode(atomicityMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
index 9c24073..f1cdb07 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
@@ -1422,7 +1422,7 @@ public class CacheLateAffinityAssignmentTest extends GridCommonAbstractTest {
                             cacheClosure(rnd, caches, cacheName, srvs, srvIdx);
                         }
                         else
-                            cacheClosure(rnd, caches, null, srvs, srvIdx);
+                            cacheClosure(rnd, caches, DEFAULT_CACHE_NAME, srvs, srvIdx);
 
                         startNode(srvName, ++topVer, false);
 
@@ -1468,7 +1468,7 @@ public class CacheLateAffinityAssignmentTest extends GridCommonAbstractTest {
                             cacheClosure(rnd, caches, cacheName, srvs, srvIdx);
                         }
                         else
-                            cacheClosure(rnd, caches, null, srvs, srvIdx);
+                            cacheClosure(rnd, caches, DEFAULT_CACHE_NAME, srvs, srvIdx);
 
                         startNode(clientName, ++topVer, true);
 
@@ -1573,7 +1573,7 @@ public class CacheLateAffinityAssignmentTest extends GridCommonAbstractTest {
 
         log.info("Start server: " + srvName);
 
-        cacheClosure(rnd, caches, null, srvs, srvIdx);
+        cacheClosure(rnd, caches, DEFAULT_CACHE_NAME, srvs, srvIdx);
 
         startNode(srvName, ++topVer, false);
 
@@ -1938,7 +1938,7 @@ public class CacheLateAffinityAssignmentTest extends GridCommonAbstractTest {
      * @param srvIdx Current servers index.
      */
     private void cacheClosure(Random rnd, List<String> caches, String cacheName, List<String> srvs, int srvIdx) {
-        if (cacheName != null) {
+        if (!DEFAULT_CACHE_NAME.equals(cacheName)) {
             final CacheConfiguration ccfg = randomCacheConfiguration(rnd, cacheName, srvs, srvIdx);
 
             cacheC = new IgniteClosure<String, CacheConfiguration[]>() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java
index 48e4c79..4f1b090 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLoadingConcurrentGridStartSelfTest.java
@@ -83,7 +83,7 @@ public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractT
 
         ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
 
@@ -128,7 +128,7 @@ public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractT
         try {
             IgniteInClosure<Ignite> f = new IgniteInClosure<Ignite>() {
                 @Override public void apply(Ignite grid) {
-                    try (IgniteDataStreamer<Integer, String> dataStreamer = grid.dataStreamer(null)) {
+                    try (IgniteDataStreamer<Integer, String> dataStreamer = grid.dataStreamer(DEFAULT_CACHE_NAME)) {
                         dataStreamer.allowOverwrite(allowOverwrite);
 
                         for (int i = 0; i < KEYS_CNT; i++)
@@ -154,7 +154,7 @@ public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractT
 
         loadCache(new IgniteInClosure<Ignite>() {
             @Override public void apply(Ignite grid) {
-                grid.cache(null).loadCache(null);
+                grid.cache(DEFAULT_CACHE_NAME).loadCache(null);
             }
         });
     }
@@ -261,7 +261,7 @@ public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractT
 
         IgniteInClosure<Ignite> f = new IgniteInClosure<Ignite>() {
             @Override public void apply(Ignite grid) {
-                try (IgniteDataStreamer<Integer, String> dataStreamer = grid.dataStreamer(null)) {
+                try (IgniteDataStreamer<Integer, String> dataStreamer = grid.dataStreamer(DEFAULT_CACHE_NAME)) {
                     dataStreamer.allowOverwrite(allowOverwrite);
 
                     for (int i = 0; i < KEYS_CNT; i++) {
@@ -286,7 +286,7 @@ public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractT
         for (IgniteFuture res : set)
             assertNull(res.get());
 
-        IgniteCache<Integer, String> cache = grid(0).cache(null);
+        IgniteCache<Integer, String> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         long size = cache.size(CachePeekMode.PRIMARY);
 
@@ -303,11 +303,11 @@ public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractT
                         log.info("Missed key info:" +
                             igniteEx.localNode().id() +
                             " primary=" +
-                            ignite.affinity(null).isPrimary(igniteEx.localNode(), i) +
+                            ignite.affinity(DEFAULT_CACHE_NAME).isPrimary(igniteEx.localNode(), i) +
                             " backup=" +
-                            ignite.affinity(null).isBackup(igniteEx.localNode(), i) +
+                            ignite.affinity(DEFAULT_CACHE_NAME).isBackup(igniteEx.localNode(), i) +
                             " local peek=" +
-                            ignite.cache(null).localPeek(i, CachePeekMode.ONHEAP));
+                            ignite.cache(DEFAULT_CACHE_NAME).localPeek(i, CachePeekMode.ONHEAP));
                     }
 
                     for (int j = i; j < i + 10000; j++) {
@@ -353,7 +353,7 @@ public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractT
      * @throws Exception If failed.
      */
     private void assertCacheSize() throws Exception {
-        final IgniteCache<Integer, String> cache = grid(0).cache(null);
+        final IgniteCache<Integer, String> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         GridTestUtils.waitForCondition(new GridAbsPredicate() {
             @Override public boolean apply() {
@@ -371,7 +371,7 @@ public class CacheLoadingConcurrentGridStartSelfTest extends GridCommonAbstractT
         int total = 0;
 
         for (int i = 0; i < GRIDS_CNT; i++)
-            total += grid(i).cache(null).localSize(CachePeekMode.PRIMARY);
+            total += grid(i).cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.PRIMARY);
 
         assertEquals("Data lost.", KEYS_CNT, total);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java
index 677a75d..947754f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLockReleaseNodeLeaveTest.java
@@ -60,7 +60,7 @@ public class CacheLockReleaseNodeLeaveTest extends GridCommonAbstractTest {
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(TRANSACTIONAL);
 
@@ -90,11 +90,11 @@ public class CacheLockReleaseNodeLeaveTest extends GridCommonAbstractTest {
         final Ignite ignite0 = ignite(0);
         final Ignite ignite1 = ignite(1);
 
-        final Integer key = primaryKey(ignite1.cache(null));
+        final Integer key = primaryKey(ignite1.cache(DEFAULT_CACHE_NAME));
 
         IgniteInternalFuture<?> fut1 = GridTestUtils.runAsync(new Callable<Void>() {
             @Override public Void call() throws Exception {
-                Lock lock = ignite0.cache(null).lock(key);
+                Lock lock = ignite0.cache(DEFAULT_CACHE_NAME).lock(key);
 
                 lock.lock();
 
@@ -106,7 +106,7 @@ public class CacheLockReleaseNodeLeaveTest extends GridCommonAbstractTest {
 
         IgniteInternalFuture<?> fut2 = GridTestUtils.runAsync(new Callable<Void>() {
             @Override public Void call() throws Exception {
-                Lock lock = ignite1.cache(null).lock(key);
+                Lock lock = ignite1.cache(DEFAULT_CACHE_NAME).lock(key);
 
                 log.info("Start lock.");
 
@@ -186,13 +186,13 @@ public class CacheLockReleaseNodeLeaveTest extends GridCommonAbstractTest {
         final Ignite ignite0 = ignite(0);
         final Ignite ignite1 = ignite(1);
 
-        final Integer key = primaryKey(ignite1.cache(null));
+        final Integer key = primaryKey(ignite1.cache(DEFAULT_CACHE_NAME));
 
         IgniteInternalFuture<?> fut1 = GridTestUtils.runAsync(new Callable<Void>() {
             @Override public Void call() throws Exception {
                 Transaction tx = ignite0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ);
 
-                ignite0.cache(null).get(key);
+                ignite0.cache(DEFAULT_CACHE_NAME).get(key);
 
                 return null;
             }
@@ -205,7 +205,7 @@ public class CacheLockReleaseNodeLeaveTest extends GridCommonAbstractTest {
                 try (Transaction tx = ignite1.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
                     log.info("Start tx lock.");
 
-                    ignite1.cache(null).get(key);
+                    ignite1.cache(DEFAULT_CACHE_NAME).get(key);
 
                     log.info("Tx locked key.");
 
@@ -233,7 +233,7 @@ public class CacheLockReleaseNodeLeaveTest extends GridCommonAbstractTest {
 
         Ignite ignite1 = startGrid(1);
 
-        Lock lock = ignite1.cache(null).lock("key");
+        Lock lock = ignite1.cache(DEFAULT_CACHE_NAME).lock("key");
         lock.lock();
 
         IgniteInternalFuture<?> fut = GridTestUtils.runAsync(new Callable<Void>() {
@@ -266,7 +266,7 @@ public class CacheLockReleaseNodeLeaveTest extends GridCommonAbstractTest {
 
         Ignite ignite2 = ignite(2);
 
-        lock = ignite2.cache(null).lock("key");
+        lock = ignite2.cache(DEFAULT_CACHE_NAME).lock("key");
         lock.lock();
         lock.unlock();
     }
@@ -281,7 +281,7 @@ public class CacheLockReleaseNodeLeaveTest extends GridCommonAbstractTest {
 
         awaitPartitionMapExchange();
 
-        Lock lock = ignite1.cache(null).lock("key");
+        Lock lock = ignite1.cache(DEFAULT_CACHE_NAME).lock("key");
         lock.lock();
 
         IgniteInternalFuture<?> fut = GridTestUtils.runAsync(new Callable<Void>() {
@@ -300,7 +300,7 @@ public class CacheLockReleaseNodeLeaveTest extends GridCommonAbstractTest {
 
         Ignite ignite2 = ignite(2);
 
-        lock = ignite2.cache(null).lock("key");
+        lock = ignite2.cache(DEFAULT_CACHE_NAME).lock("key");
         lock.lock();
         lock.unlock();
     }
@@ -313,7 +313,7 @@ public class CacheLockReleaseNodeLeaveTest extends GridCommonAbstractTest {
 
         Ignite ignite1 = startGrid(1);
 
-        IgniteCache cache = ignite1.cache(null);
+        IgniteCache cache = ignite1.cache(DEFAULT_CACHE_NAME);
         ignite1.transactions().txStart(PESSIMISTIC, REPEATABLE_READ);
         cache.get(1);
 
@@ -347,7 +347,7 @@ public class CacheLockReleaseNodeLeaveTest extends GridCommonAbstractTest {
 
         Ignite ignite2 = ignite(2);
 
-        cache = ignite2.cache(null);
+        cache = ignite2.cache(DEFAULT_CACHE_NAME);
 
         try (Transaction tx = ignite2.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
             cache.get(1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java
index 1e3f081..9a0fb03 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CachePutAllFailoverAbstractTest.java
@@ -142,7 +142,7 @@ public abstract class CachePutAllFailoverAbstractTest extends GridCacheAbstractS
         });
 
         try {
-            final IgniteCache<TestKey, TestValue> cache = ignite(0).cache(null);
+            final IgniteCache<TestKey, TestValue> cache = ignite(0).cache(DEFAULT_CACHE_NAME);
 
             GridTestUtils.runMultiThreaded(new Callable<Object>() {
                 @Override public Object call() throws Exception {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheTryLockMultithreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheTryLockMultithreadedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheTryLockMultithreadedTest.java
index 8e4dd3d..f2a9e5a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheTryLockMultithreadedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheTryLockMultithreadedTest.java
@@ -55,7 +55,7 @@ public class CacheTryLockMultithreadedTest extends GridCommonAbstractTest {
 
         cfg.setClientMode(client);
 
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(TRANSACTIONAL);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
@@ -92,7 +92,7 @@ public class CacheTryLockMultithreadedTest extends GridCommonAbstractTest {
 
         final Integer key = 1;
 
-        final IgniteCache<Integer, Integer> cache = client.cache(null);
+        final IgniteCache<Integer, Integer> cache = client.cache(DEFAULT_CACHE_NAME);
 
         final long stopTime = System.currentTimeMillis() + 30_000;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractJobExecutionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractJobExecutionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractJobExecutionTest.java
index 6a61fbb..f96014e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractJobExecutionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractJobExecutionTest.java
@@ -79,14 +79,14 @@ public abstract class GridCacheAbstractJobExecutionTest extends GridCommonAbstra
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-        grid(0).cache(null).removeAll();
+        grid(0).cache(DEFAULT_CACHE_NAME).removeAll();
 
         for (int i = 0; i < GRID_CNT; i++) {
             Ignite g = grid(i);
 
-            IgniteCache<String, int[]> c = g.cache(null);
+            IgniteCache<String, int[]> c = g.cache(DEFAULT_CACHE_NAME);
 
-            GridCacheAdapter<Object, Object> cache = ((IgniteEx)g).context().cache().internalCache();
+            GridCacheAdapter<Object, Object> cache = ((IgniteEx)g).context().cache().internalCache(DEFAULT_CACHE_NAME);
 
             info("Node: " + g.cluster().localNode().id());
             info("Entries: " + cache.entries());
@@ -135,7 +135,7 @@ public abstract class GridCacheAbstractJobExecutionTest extends GridCommonAbstra
 
         final String key = "TestKey";
 
-        info("Primary node for test key: " + grid(0).affinity(null).mapKeyToNode(key));
+        info("Primary node for test key: " + grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key));
 
         for (int i = 0; i < jobCnt; i++) {
             futs.add(ignite.compute().applyAsync(new CX1<Integer, Void>() {
@@ -143,7 +143,7 @@ public abstract class GridCacheAbstractJobExecutionTest extends GridCommonAbstra
                 private Ignite ignite;
 
                 @Override public Void applyx(final Integer i) {
-                    IgniteCache<String, int[]> cache = ignite.cache(null);
+                    IgniteCache<String, int[]> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                     try (Transaction tx = ignite.transactions().txStart(concur, isolation)) {
                         int[] arr = cache.get(key);
@@ -177,10 +177,10 @@ public abstract class GridCacheAbstractJobExecutionTest extends GridCommonAbstra
             for (int g = 0; g < GRID_CNT; g++) {
                 info("Will check grid: " + g);
 
-                info("Value: " + grid(i).cache(null).localPeek(key));
+                info("Value: " + grid(i).cache(DEFAULT_CACHE_NAME).localPeek(key));
             }
 
-            IgniteCache<String, int[]> c = grid(i).cache(null);
+            IgniteCache<String, int[]> c = grid(i).cache(DEFAULT_CACHE_NAME);
 
             // Do within transaction to make sure that lock is acquired
             // which means that all previous transactions have committed.

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPartitionedByteArrayValuesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPartitionedByteArrayValuesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPartitionedByteArrayValuesSelfTest.java
index 16ebf7e..4af2571 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPartitionedByteArrayValuesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPartitionedByteArrayValuesSelfTest.java
@@ -46,7 +46,7 @@ public abstract class GridCacheAbstractPartitionedByteArrayValuesSelfTest extend
 
     /** {@inheritDoc} */
     @Override protected CacheConfiguration cacheConfiguration0() {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setCacheMode(PARTITIONED);
         cfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPrimarySyncSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPrimarySyncSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPrimarySyncSelfTest.java
index 35057bb..7fafa3a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPrimarySyncSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractPrimarySyncSelfTest.java
@@ -48,7 +48,7 @@ public abstract class GridCacheAbstractPrimarySyncSelfTest extends GridCommonAbs
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(TRANSACTIONAL);
@@ -91,9 +91,9 @@ public abstract class GridCacheAbstractPrimarySyncSelfTest extends GridCommonAbs
     public void testPrimarySync() throws Exception {
         for (int i = 0; i < GRID_CNT; i++) {
             for (int j = 0; j < GRID_CNT; j++) {
-                IgniteCache<Integer, Integer> cache = grid(j).cache(null);
+                IgniteCache<Integer, Integer> cache = grid(j).cache(DEFAULT_CACHE_NAME);
 
-                if (grid(j).affinity(null).isPrimary(grid(j).localNode(), i)) {
+                if (grid(j).affinity(DEFAULT_CACHE_NAME).isPrimary(grid(j).localNode(), i)) {
                     try (Transaction tx = grid(j).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
                         cache.put(i, i);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java
index cd7e513..e4099ca 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheBasicOpAbstractTest.java
@@ -92,7 +92,7 @@ public abstract class GridCacheBasicOpAbstractTest extends GridCommonAbstractTes
     /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
         for (Ignite g : G.allGrids())
-            g.cache(null).clear();
+            g.cache(DEFAULT_CACHE_NAME).clear();
     }
 
     /**
@@ -105,9 +105,9 @@ public abstract class GridCacheBasicOpAbstractTest extends GridCommonAbstractTes
         CacheEventListener lsnr = new CacheEventListener(latch);
 
         try {
-            IgniteCache<String, String> cache1 = ignite1.cache(null);
-            IgniteCache<String, String> cache2 = ignite2.cache(null);
-            IgniteCache<String, String> cache3 = ignite3.cache(null);
+            IgniteCache<String, String> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
+            IgniteCache<String, String> cache2 = ignite2.cache(DEFAULT_CACHE_NAME);
+            IgniteCache<String, String> cache3 = ignite3.cache(DEFAULT_CACHE_NAME);
 
             ignite1.events().localListen(lsnr, EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_REMOVED);
             ignite2.events().localListen(lsnr, EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_REMOVED);
@@ -180,9 +180,9 @@ public abstract class GridCacheBasicOpAbstractTest extends GridCommonAbstractTes
         CacheEventListener lsnr = new CacheEventListener(latch);
 
         try {
-            IgniteCache<String, String> cache1 = ignite1.cache(null);
-            IgniteCache<String, String> cache2 = ignite2.cache(null);
-            IgniteCache<String, String> cache3 = ignite3.cache(null);
+            IgniteCache<String, String> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
+            IgniteCache<String, String> cache2 = ignite2.cache(DEFAULT_CACHE_NAME);
+            IgniteCache<String, String> cache3 = ignite3.cache(DEFAULT_CACHE_NAME);
 
             ignite1.events().localListen(lsnr, EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_REMOVED);
             ignite2.events().localListen(lsnr, EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_REMOVED);
@@ -260,9 +260,9 @@ public abstract class GridCacheBasicOpAbstractTest extends GridCommonAbstractTes
         IgnitePredicate<Event> lsnr = new CacheEventListener(latch);
 
         try {
-            IgniteCache<String, String> cache1 = ignite1.cache(null);
-            IgniteCache<String, String> cache2 = ignite2.cache(null);
-            IgniteCache<String, String> cache3 = ignite3.cache(null);
+            IgniteCache<String, String> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
+            IgniteCache<String, String> cache2 = ignite2.cache(DEFAULT_CACHE_NAME);
+            IgniteCache<String, String> cache3 = ignite3.cache(DEFAULT_CACHE_NAME);
 
             ignite1.events().localListen(lsnr, EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_REMOVED);
             ignite2.events().localListen(lsnr, EVT_CACHE_OBJECT_PUT, EVT_CACHE_OBJECT_REMOVED);
@@ -329,9 +329,9 @@ public abstract class GridCacheBasicOpAbstractTest extends GridCommonAbstractTes
      * @throws Exception In case of error.
      */
     public void testPutWithExpiration() throws Exception {
-        IgniteCache<String, String> cache1 = ignite1.cache(null);
-        IgniteCache<String, String> cache2 = ignite2.cache(null);
-        IgniteCache<String, String> cache3 = ignite3.cache(null);
+        IgniteCache<String, String> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
+        IgniteCache<String, String> cache2 = ignite2.cache(DEFAULT_CACHE_NAME);
+        IgniteCache<String, String> cache3 = ignite3.cache(DEFAULT_CACHE_NAME);
 
         cache1.put("key", "val");
 


[02/51] [abbrv] ignite git commit: ignite-1794 Refactored hibernate modules, switched to hibernate 5.1

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java b/modules/hibernate5/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java
deleted file mode 100644
index f847c97..0000000
--- a/modules/hibernate5/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java
+++ /dev/null
@@ -1,1948 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
-import javax.persistence.PersistenceException;
-import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
-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.hibernate.ObjectNotFoundException;
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.annotations.NaturalId;
-import org.hibernate.annotations.NaturalIdCache;
-import org.hibernate.boot.Metadata;
-import org.hibernate.boot.MetadataSources;
-import org.hibernate.boot.registry.StandardServiceRegistry;
-import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
-import org.hibernate.cache.spi.GeneralDataRegion;
-import org.hibernate.cache.spi.TransactionalDataRegion;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cfg.Environment;
-import org.hibernate.exception.ConstraintViolationException;
-import org.hibernate.mapping.PersistentClass;
-import org.hibernate.mapping.RootClass;
-import org.hibernate.stat.NaturalIdCacheStatistics;
-import org.hibernate.stat.SecondLevelCacheStatistics;
-
-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.CacheWriteSynchronizationMode.FULL_SYNC;
-import static org.apache.ignite.cache.hibernate.HibernateRegionFactory.DFLT_ACCESS_TYPE_PROPERTY;
-import static org.apache.ignite.cache.hibernate.HibernateRegionFactory.IGNITE_INSTANCE_NAME_PROPERTY;
-import static org.apache.ignite.cache.hibernate.HibernateRegionFactory.REGION_CACHE_PROPERTY;
-import static org.hibernate.cfg.Environment.CACHE_REGION_FACTORY;
-import static org.hibernate.cfg.Environment.GENERATE_STATISTICS;
-import static org.hibernate.cfg.Environment.HBM2DDL_AUTO;
-import static org.hibernate.cfg.Environment.RELEASE_CONNECTIONS;
-import static org.hibernate.cfg.Environment.USE_QUERY_CACHE;
-import static org.hibernate.cfg.Environment.USE_SECOND_LEVEL_CACHE;
-
-/**
- *
- * Tests Hibernate L2 cache.
- */
-public class HibernateL2CacheSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** */
-    public static final String CONNECTION_URL = "jdbc:h2:mem:example;DB_CLOSE_DELAY=-1";
-
-    /** */
-    public static final String ENTITY_NAME = Entity.class.getName();
-
-    /** */
-    public static final String ENTITY2_NAME = Entity2.class.getName();
-
-    /** */
-    public static final String VERSIONED_ENTITY_NAME = VersionedEntity.class.getName();
-
-    /** */
-    public static final String CHILD_ENTITY_NAME = ChildEntity.class.getName();
-
-    /** */
-    public static final String PARENT_ENTITY_NAME = ParentEntity.class.getName();
-
-    /** */
-    public static final String CHILD_COLLECTION_REGION = ENTITY_NAME + ".children";
-
-    /** */
-    public static final String NATURAL_ID_REGION =
-        "org.apache.ignite.cache.hibernate.HibernateL2CacheSelfTest$Entity##NaturalId";
-
-    /** */
-    public static final String NATURAL_ID_REGION2 =
-        "org.apache.ignite.cache.hibernate.HibernateL2CacheSelfTest$Entity2##NaturalId";
-
-    /** */
-    private SessionFactory sesFactory1;
-
-    /** */
-    private SessionFactory sesFactory2;
-
-    /**
-     * First Hibernate test entity.
-     */
-    @javax.persistence.Entity
-    @NaturalIdCache
-    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
-    public static class Entity {
-        /** */
-        private int id;
-
-        /** */
-        private String name;
-
-        /** */
-        private Collection<ChildEntity> children;
-
-        /**
-         * Default constructor required by Hibernate.
-         */
-        public Entity() {
-            // No-op.
-        }
-
-        /**
-         * @param id ID.
-         * @param name Name.
-         */
-        public Entity(int id, String name) {
-            this.id = id;
-            this.name = name;
-        }
-
-        /**
-         * @return ID.
-         */
-        @Id
-        public int getId() {
-            return id;
-        }
-
-        /**
-         * @param id ID.
-         */
-        public void setId(int id) {
-            this.id = id;
-        }
-
-        /**
-         * @return Name.
-         */
-        @NaturalId(mutable = true)
-        public String getName() {
-            return name;
-        }
-
-        /**
-         * @param name Name.
-         */
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        /**
-         * @return Children.
-         */
-        @OneToMany(cascade=javax.persistence.CascadeType.ALL, fetch=FetchType.LAZY)
-        @JoinColumn(name="ENTITY_ID")
-        public Collection<ChildEntity> getChildren() {
-            return children;
-        }
-
-        /**
-         * @param children Children.
-         */
-        public void setChildren(Collection<ChildEntity> children) {
-            this.children = children;
-        }
-    }
-
-    /**
-     * Second Hibernate test entity.
-     */
-    @javax.persistence.Entity
-    @NaturalIdCache
-    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
-    public static class Entity2 {
-        /** */
-        private int id;
-
-        /** */
-        private String name;
-
-        /** */
-        private Collection<ChildEntity> children;
-
-        /**
-         * Default constructor required by Hibernate.
-         */
-        public Entity2() {
-            // No-op.
-        }
-
-        /**
-         * @param id ID.
-         * @param name Name.
-         */
-        public Entity2(int id, String name) {
-            this.id = id;
-            this.name = name;
-        }
-
-        /**
-         * @return ID.
-         */
-        @Id
-        public int getId() {
-            return id;
-        }
-
-        /**
-         * @param id ID.
-         */
-        public void setId(int id) {
-            this.id = id;
-        }
-
-        /**
-         * @return Name.
-         */
-        @NaturalId(mutable = true)
-        public String getName() {
-            return name;
-        }
-
-        /**
-         * @param name Name.
-         */
-        public void setName(String name) {
-            this.name = name;
-        }
-    }
-
-    /**
-     * Hibernate child entity referenced by {@link Entity}.
-     */
-    @javax.persistence.Entity
-    @SuppressWarnings("PublicInnerClass")
-    public static class ChildEntity {
-        /** */
-        private int id;
-
-        /**
-         * Default constructor required by Hibernate.
-         */
-        public ChildEntity() {
-            // No-op.
-        }
-
-        /**
-         * @param id ID.
-         */
-        public ChildEntity(int id) {
-            this.id = id;
-        }
-
-        /**
-         * @return ID.
-         */
-        @Id
-        @GeneratedValue
-        public int getId() {
-            return id;
-        }
-
-        /**
-         * @param id ID.
-         */
-        public void setId(int id) {
-            this.id = id;
-        }
-    }
-
-    /**
-     * Hibernate entity referencing {@link Entity}.
-     */
-    @javax.persistence.Entity
-    @SuppressWarnings("PublicInnerClass")
-    public static class ParentEntity {
-        /** */
-        private int id;
-
-        /** */
-        private Entity entity;
-
-        /**
-         * Default constructor required by Hibernate.
-         */
-        public ParentEntity() {
-            // No-op.
-        }
-
-        /**
-         * @param id ID.
-         * @param entity Referenced entity.
-         */
-        public ParentEntity(int id, Entity entity) {
-            this.id = id;
-            this.entity = entity;
-        }
-
-        /**
-         * @return ID.
-         */
-        @Id
-        public int getId() {
-            return id;
-        }
-
-        /**
-         * @param id ID.
-         */
-        public void setId(int id) {
-            this.id = id;
-        }
-
-        /**
-         * @return Referenced entity.
-         */
-        @OneToOne
-        public Entity getEntity() {
-            return entity;
-        }
-
-        /**
-         * @param entity Referenced entity.
-         */
-        public void setEntity(Entity entity) {
-            this.entity = entity;
-        }
-    }
-
-    /**
-     * Hibernate entity.
-     */
-    @javax.persistence.Entity
-    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
-    public static class VersionedEntity {
-        /** */
-        private int id;
-
-        /** */
-        private long ver;
-
-        /**
-         * Default constructor required by Hibernate.
-         */
-        public VersionedEntity() {
-        }
-
-        /**
-         * @param id ID.
-         */
-        public VersionedEntity(int id) {
-            this.id = id;
-        }
-
-        /**
-         * @return ID.
-         */
-        @Id
-        public int getId() {
-            return id;
-        }
-
-        /**
-         * @param id ID.
-         */
-        public void setId(int id) {
-            this.id = id;
-        }
-
-        /**
-         * @return Version.
-         */
-        @javax.persistence.Version
-        public long getVersion() {
-            return ver;
-        }
-
-        /**
-         * @param ver Version.
-         */
-        public void setVersion(long ver) {
-            this.ver = ver;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
-        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
-
-        discoSpi.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(discoSpi);
-
-        cfg.setCacheConfiguration(generalRegionConfiguration("org.hibernate.cache.spi.UpdateTimestampsCache"),
-            generalRegionConfiguration("org.hibernate.cache.internal.StandardQueryCache"),
-            transactionalRegionConfiguration(ENTITY_NAME),
-            transactionalRegionConfiguration(ENTITY2_NAME),
-            transactionalRegionConfiguration(VERSIONED_ENTITY_NAME),
-            transactionalRegionConfiguration(PARENT_ENTITY_NAME),
-            transactionalRegionConfiguration(CHILD_ENTITY_NAME),
-            transactionalRegionConfiguration(CHILD_COLLECTION_REGION),
-            transactionalRegionConfiguration(NATURAL_ID_REGION),
-            transactionalRegionConfiguration(NATURAL_ID_REGION2));
-
-        return cfg;
-    }
-
-    /**
-     * @param regionName Region name.
-     * @return Cache configuration for {@link GeneralDataRegion}.
-     */
-    private CacheConfiguration generalRegionConfiguration(String regionName) {
-        CacheConfiguration cfg = new CacheConfiguration();
-
-        cfg.setName(regionName);
-
-        cfg.setCacheMode(PARTITIONED);
-
-        cfg.setAtomicityMode(ATOMIC);
-
-        cfg.setWriteSynchronizationMode(FULL_SYNC);
-
-        cfg.setBackups(1);
-
-        cfg.setAffinity(new RendezvousAffinityFunction(false, 10));
-
-        return cfg;
-    }
-
-    /**
-     * @param regionName Region name.
-     * @return Cache configuration for {@link TransactionalDataRegion}.
-     */
-    protected CacheConfiguration transactionalRegionConfiguration(String regionName) {
-        CacheConfiguration cfg = new CacheConfiguration();
-
-        cfg.setName(regionName);
-
-        cfg.setCacheMode(PARTITIONED);
-
-        cfg.setAtomicityMode(TRANSACTIONAL);
-
-        cfg.setWriteSynchronizationMode(FULL_SYNC);
-
-        cfg.setBackups(1);
-
-        cfg.setAffinity(new RendezvousAffinityFunction(false, 10));
-
-        return cfg;
-    }
-
-    /**
-     * @return Hibernate registry builder.
-     */
-    protected StandardServiceRegistryBuilder registryBuilder() {
-        StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
-
-        builder.applySetting("hibernate.connection.url", CONNECTION_URL);
-
-        return builder;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGrids(2);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        cleanup();
-    }
-
-    /**
-     * @return Hibernate L2 cache access types to test.
-     */
-    protected AccessType[] accessTypes() {
-        return new AccessType[]{AccessType.READ_ONLY, AccessType.NONSTRICT_READ_WRITE, AccessType.READ_WRITE};
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCollectionCache() throws Exception {
-        for (AccessType accessType : accessTypes())
-            testCollectionCache(accessType);
-    }
-
-    /**
-     * @param accessType Cache access type.
-     * @throws Exception If failed.
-     */
-    @SuppressWarnings("unchecked")
-    private void testCollectionCache(AccessType accessType) throws Exception {
-        createSessionFactories(accessType);
-
-        Map<Integer, Integer> idToChildCnt = new HashMap<>();
-
-        try {
-            Session ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                for (int i = 0; i < 3; i++) {
-                    Entity e = new Entity(i, "name-" + i);
-
-                    Collection<ChildEntity> children = new ArrayList<>();
-
-                    for (int j = 0; j < 3; j++)
-                        children.add(new ChildEntity());
-
-                    e.setChildren(children);
-
-                    idToChildCnt.put(e.getId(), e.getChildren().size());
-
-                    ses.save(e);
-                }
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            // Load children, this should populate cache.
-
-            ses = sesFactory1.openSession();
-
-            try {
-                List<Entity> list = ses.createCriteria(ENTITY_NAME).list();
-
-                assertEquals(idToChildCnt.size(), list.size());
-
-                for (Entity e : list)
-                    assertEquals((int)idToChildCnt.get(e.getId()), e.getChildren().size());
-            }
-            finally {
-                ses.close();
-            }
-
-            assertCollectionCache(sesFactory2, idToChildCnt, 3, 0);
-            assertCollectionCache(sesFactory1, idToChildCnt, 3, 0);
-
-            if (accessType == AccessType.READ_ONLY)
-                return;
-
-            // Update children for one entity.
-
-            ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                Entity e1 = (Entity)ses.load(Entity.class, 1);
-
-                e1.getChildren().remove(e1.getChildren().iterator().next());
-
-                ses.update(e1);
-
-                idToChildCnt.put(e1.getId(), e1.getChildren().size());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertCollectionCache(sesFactory2, idToChildCnt, 2, 1); // After update collection cache entry is removed.
-            assertCollectionCache(sesFactory1, idToChildCnt, 3, 0); // 'assertCollectionCache' loads children in cache.
-
-            // Update children for the same entity using another SessionFactory.
-
-            ses = sesFactory2.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                Entity e1 = (Entity)ses.load(Entity.class, 1);
-
-                e1.getChildren().remove(e1.getChildren().iterator().next());
-
-                ses.update(e1);
-
-                idToChildCnt.put(e1.getId(), e1.getChildren().size());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertCollectionCache(sesFactory2, idToChildCnt, 2, 1); // After update collection cache entry is removed.
-            assertCollectionCache(sesFactory1, idToChildCnt, 3, 0); // 'assertCollectionCache' loads children in cache.
-        }
-        finally {
-            cleanup();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testEntityCache() throws Exception {
-        for (AccessType accessType : accessTypes())
-            testEntityCache(accessType);
-    }
-
-    /**
-     * @param accessType Cache access type.
-     * @throws Exception If failed.
-     */
-    private void testEntityCache(AccessType accessType) throws Exception {
-        createSessionFactories(accessType);
-
-        Map<Integer, String> idToName = new HashMap<>();
-
-        try {
-            Session ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                for (int i = 0; i < 2; i++) {
-                    String name = "name-" + i;
-
-                    ses.save(new Entity(i, name));
-
-                    idToName.put(i, name);
-                }
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 100);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 100);
-
-            if (accessType == AccessType.READ_ONLY)
-                return;
-
-            ses = sesFactory1.openSession();
-
-            try {
-                // Updates and inserts in single transaction.
-
-                Transaction tx = ses.beginTransaction();
-
-                Entity e0 = (Entity)ses.load(Entity.class, 0);
-
-                e0.setName("name-0-changed1");
-
-                ses.update(e0);
-
-                idToName.put(0, e0.getName());
-
-                ses.save(new Entity(2, "name-2"));
-
-                idToName.put(2, "name-2");
-
-                Entity e1 = (Entity)ses.load(Entity.class, 1);
-
-                e1.setName("name-1-changed1");
-
-                ses.update(e1);
-
-                idToName.put(1, e1.getName());
-
-                ses.save(new Entity(3, "name-3"));
-
-                idToName.put(3, "name-3");
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName);
-
-            ses = sesFactory1.openSession();
-
-            try {
-                // Updates, inserts and deletes in single transaction.
-
-                Transaction tx = ses.beginTransaction();
-
-                ses.save(new Entity(4, "name-4"));
-
-                idToName.put(4, "name-4");
-
-                Entity e0 = (Entity)ses.load(Entity.class, 0);
-
-                e0.setName("name-0-changed2");
-
-                ses.update(e0);
-
-                idToName.put(e0.getId(), e0.getName());
-
-                ses.delete(ses.load(Entity.class, 1));
-
-                idToName.remove(1);
-
-                Entity e2 = (Entity)ses.load(Entity.class, 2);
-
-                e2.setName("name-2-changed1");
-
-                ses.update(e2);
-
-                idToName.put(e2.getId(), e2.getName());
-
-                ses.delete(ses.load(Entity.class, 3));
-
-                idToName.remove(3);
-
-                ses.save(new Entity(5, "name-5"));
-
-                idToName.put(5, "name-5");
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 1, 3);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 1, 3);
-
-            // Try to update the same entity using another SessionFactory.
-
-            ses = sesFactory2.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                Entity e0 = (Entity)ses.load(Entity.class, 0);
-
-                e0.setName("name-0-changed3");
-
-                ses.update(e0);
-
-                idToName.put(e0.getId(), e0.getName());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName);
-        }
-        finally {
-            cleanup();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTwoEntitiesSameCache() throws Exception {
-        for (AccessType accessType : accessTypes())
-            testTwoEntitiesSameCache(accessType);
-    }
-
-    /**
-     * @param accessType Cache access type.
-     * @throws Exception If failed.
-     */
-    private void testTwoEntitiesSameCache(AccessType accessType) throws Exception {
-        createSessionFactories(accessType);
-
-        try {
-            Session ses = sesFactory1.openSession();
-
-            Map<Integer, String> idToName1 = new HashMap<>();
-            Map<Integer, String> idToName2 = new HashMap<>();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                for (int i = 0; i < 2; i++) {
-                    String name = "name-" + i;
-
-                    ses.save(new Entity(i, name));
-                    ses.save(new Entity2(i, name));
-
-                    idToName1.put(i, name);
-                    idToName2.put(i, name);
-                }
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 100);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 100);
-
-            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 100);
-            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 100);
-
-            if (accessType == AccessType.READ_ONLY)
-                return;
-
-            ses = sesFactory1.openSession();
-
-            try {
-                // Updates both entities in single transaction.
-
-                Transaction tx = ses.beginTransaction();
-
-                Entity e = (Entity)ses.load(Entity.class, 0);
-
-                e.setName("name-0-changed1");
-
-                ses.update(e);
-
-                Entity2 e2 = (Entity2)ses.load(Entity2.class, 0);
-
-                e2.setName("name-e2-0-changed1");
-
-                ses.update(e2);
-
-                idToName1.put(0, e.getName());
-                idToName2.put(0, e2.getName());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 100);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 100);
-
-            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 100);
-            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 100);
-
-            ses = sesFactory1.openSession();
-
-            try {
-                // Remove entity1 and insert entity2 in single transaction.
-
-                Transaction tx = ses.beginTransaction();
-
-                Entity e = (Entity)ses.load(Entity.class, 0);
-
-                ses.delete(e);
-
-                Entity2 e2 = new Entity2(2, "name-2");
-
-                ses.save(e2);
-
-                idToName1.remove(0);
-                idToName2.put(2, e2.getName());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 0, 100);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 0, 100);
-
-            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 100);
-            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 100);
-
-            ses = sesFactory1.openSession();
-
-            Transaction tx = ses.beginTransaction();
-
-            try {
-                // Update, remove, insert in single transaction, transaction fails.
-
-                Entity e = (Entity)ses.load(Entity.class, 1);
-
-                e.setName("name-1-changed1");
-
-                ses.update(e); // Valid update.
-
-                ses.save(new Entity(2, "name-2")); // Valid insert.
-
-                ses.delete(ses.load(Entity2.class, 0)); // Valid delete.
-
-                Entity2 e2 = (Entity2)ses.load(Entity2.class, 1);
-
-                e2.setName("name-2");  // Invalid update, not-unique name.
-
-                ses.update(e2);
-
-                tx.commit();
-
-                fail("Commit must fail.");
-            }
-            catch (PersistenceException e) {
-                log.info("Expected exception: " + e);
-
-                tx.rollback();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 0, 2, 100);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 0, 2, 100);
-
-            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 100);
-            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 100);
-
-            ses = sesFactory2.openSession();
-
-            try {
-                // Update, remove, insert in single transaction.
-
-                tx = ses.beginTransaction();
-
-                Entity e = (Entity)ses.load(Entity.class, 1);
-
-                e.setName("name-1-changed1");
-
-                ses.update(e);
-
-                idToName1.put(1, e.getName());
-
-                ses.save(new Entity(2, "name-2"));
-
-                idToName1.put(2, "name-2");
-
-                ses.delete(ses.load(Entity2.class, 0));
-
-                idToName2.remove(0);
-
-                Entity2 e2 = (Entity2)ses.load(Entity2.class, 1);
-
-                e2.setName("name-e2-2-changed");
-
-                ses.update(e2);
-
-                idToName2.put(1, e2.getName());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 0, 100);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 0, 100);
-
-            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 0, 100);
-            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 0, 100);
-        }
-        finally {
-            cleanup();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testVersionedEntity() throws Exception {
-        for (AccessType accessType : accessTypes())
-            testVersionedEntity(accessType);
-    }
-
-    /**
-     * @param accessType Cache access type.
-     * @throws Exception If failed.
-     */
-    private void testVersionedEntity(AccessType accessType) throws Exception {
-        createSessionFactories(accessType);
-
-        try {
-            Session ses = sesFactory1.openSession();
-
-            VersionedEntity e0 = new VersionedEntity(0);
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                ses.save(e0);
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            ses = sesFactory1.openSession();
-
-            long ver;
-
-            try {
-                ver = ((VersionedEntity)ses.load(VersionedEntity.class, 0)).getVersion();
-            }
-            finally {
-                ses.close();
-            }
-
-            SecondLevelCacheStatistics stats1 =
-                sesFactory1.getStatistics().getSecondLevelCacheStatistics(VERSIONED_ENTITY_NAME);
-            SecondLevelCacheStatistics stats2 =
-                sesFactory2.getStatistics().getSecondLevelCacheStatistics(VERSIONED_ENTITY_NAME);
-
-            assertEquals(1, stats1.getElementCountInMemory());
-            assertEquals(1, stats2.getElementCountInMemory());
-
-            ses = sesFactory2.openSession();
-
-            try {
-                assertEquals(ver, ((VersionedEntity)ses.load(VersionedEntity.class, 0)).getVersion());
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEquals(1, stats2.getElementCountInMemory());
-            assertEquals(1, stats2.getHitCount());
-
-            if (accessType == AccessType.READ_ONLY)
-                return;
-
-            e0.setVersion(ver - 1);
-
-            ses = sesFactory1.openSession();
-
-            Transaction tx = ses.beginTransaction();
-
-            try {
-                ses.update(e0);
-
-                tx.commit();
-
-                fail("Commit must fail.");
-            }
-            catch (PersistenceException e) {
-                log.info("Expected exception: " + e);
-            }
-            finally {
-                tx.rollback();
-
-                ses.close();
-            }
-
-            sesFactory1.getStatistics().clear();
-
-            stats1 = sesFactory1.getStatistics().getSecondLevelCacheStatistics(VERSIONED_ENTITY_NAME);
-
-            ses = sesFactory1.openSession();
-
-            try {
-                assertEquals(ver, ((VersionedEntity)ses.load(VersionedEntity.class, 0)).getVersion());
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEquals(1, stats1.getElementCountInMemory());
-            assertEquals(1, stats1.getHitCount());
-            assertEquals(1, stats2.getElementCountInMemory());
-            assertEquals(1, stats2.getHitCount());
-        }
-        finally {
-            cleanup();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testNaturalIdCache() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-1084");
-
-        for (AccessType accessType : accessTypes())
-            testNaturalIdCache(accessType);
-    }
-
-    /**
-     * @param accessType Cache access type.
-     * @throws Exception If failed.
-     */
-    private void testNaturalIdCache(AccessType accessType) throws Exception {
-        createSessionFactories(accessType);
-
-        Map<String, Integer> nameToId = new HashMap<>();
-
-        try {
-            Session ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                for (int i = 0; i < 3; i++) {
-                    String name = "name-" + i;
-
-                    ses.save(new Entity(i, name));
-
-                    nameToId.put(name, i);
-                }
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            ses = sesFactory1.openSession();
-
-            try {
-                for (Map.Entry<String, Integer> e : nameToId.entrySet())
-                    ((Entity)ses.bySimpleNaturalId(Entity.class).load(e.getKey())).getId();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertNaturalIdCache(sesFactory2, nameToId, "name-100");
-            assertNaturalIdCache(sesFactory1, nameToId, "name-100");
-
-            if (accessType == AccessType.READ_ONLY)
-                return;
-
-            // Update naturalId.
-
-            ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                Entity e1 = (Entity)ses.load(Entity.class, 1);
-
-                nameToId.remove(e1.getName());
-
-                e1.setName("name-1-changed1");
-
-                nameToId.put(e1.getName(), e1.getId());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertNaturalIdCache(sesFactory2, nameToId, "name-1");
-            assertNaturalIdCache(sesFactory1, nameToId, "name-1");
-
-            // Update entity using another SessionFactory.
-
-            ses = sesFactory2.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                Entity e1 = (Entity)ses.load(Entity.class, 1);
-
-                nameToId.remove(e1.getName());
-
-                e1.setName("name-1-changed2");
-
-                nameToId.put(e1.getName(), e1.getId());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertNaturalIdCache(sesFactory2, nameToId, "name-1-changed1");
-            assertNaturalIdCache(sesFactory1, nameToId, "name-1-changed1");
-
-            // Try invalid NaturalId update.
-
-            ses = sesFactory1.openSession();
-
-            Transaction tx = ses.beginTransaction();
-
-            try {
-                Entity e1 = (Entity)ses.load(Entity.class, 1);
-
-                e1.setName("name-0"); // Invalid update (duplicated name).
-
-                tx.commit();
-
-                fail("Commit must fail.");
-            }
-            catch (ConstraintViolationException e) {
-                log.info("Expected exception: " + e);
-
-                tx.rollback();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertNaturalIdCache(sesFactory2, nameToId);
-            assertNaturalIdCache(sesFactory1, nameToId);
-
-            // Delete entity.
-
-            ses = sesFactory2.openSession();
-
-            try {
-                tx = ses.beginTransaction();
-
-                Entity e2 = (Entity)ses.load(Entity.class, 2);
-
-                ses.delete(e2);
-
-                nameToId.remove(e2.getName());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertNaturalIdCache(sesFactory2, nameToId, "name-2");
-            assertNaturalIdCache(sesFactory1, nameToId, "name-2");
-        }
-        finally {
-            cleanup();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testEntityCacheTransactionFails() throws Exception {
-        for (AccessType accessType : accessTypes())
-            testEntityCacheTransactionFails(accessType);
-    }
-
-    /**
-     * @param accessType Cache access type.
-     * @throws Exception If failed.
-     */
-    private void testEntityCacheTransactionFails(AccessType accessType) throws Exception {
-        createSessionFactories(accessType);
-
-        Map<Integer, String> idToName = new HashMap<>();
-
-        try {
-            Session ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                for (int i = 0; i < 3; i++) {
-                    String name = "name-" + i;
-
-                    ses.save(new Entity(i, name));
-
-                    idToName.put(i, name);
-                }
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 100);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 100);
-
-            ses = sesFactory1.openSession();
-
-            Transaction tx = ses.beginTransaction();
-
-            try {
-                ses.save(new Entity(3, "name-3")); // Valid insert.
-
-                ses.save(new Entity(0, "name-0")); // Invalid insert (duplicated ID).
-
-                tx.commit();
-
-                fail("Commit must fail.");
-            }
-            catch (PersistenceException e) {
-                log.info("Expected exception: " + e);
-
-                tx.rollback();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 3);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 3);
-
-            if (accessType == AccessType.READ_ONLY)
-                return;
-
-            ses = sesFactory1.openSession();
-
-            tx = ses.beginTransaction();
-
-            try {
-                Entity e0 = (Entity)ses.load(Entity.class, 0);
-                Entity e1 = (Entity)ses.load(Entity.class, 1);
-
-                e0.setName("name-10"); // Valid update.
-                e1.setName("name-2"); // Invalid update (violates unique constraint).
-
-                ses.update(e0);
-                ses.update(e1);
-
-                tx.commit();
-
-                fail("Commit must fail.");
-            }
-            catch (PersistenceException e) {
-                log.info("Expected exception: " + e);
-
-                tx.rollback();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName);
-
-            ses = sesFactory1.openSession();
-
-            try {
-                // Create parent entity referencing Entity with ID = 0.
-
-                tx = ses.beginTransaction();
-
-                ses.save(new ParentEntity(0, (Entity) ses.load(Entity.class, 0)));
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            ses = sesFactory1.openSession();
-
-            tx = ses.beginTransaction();
-
-            try {
-                ses.save(new Entity(3, "name-3")); // Valid insert.
-
-                Entity e1 = (Entity)ses.load(Entity.class, 1);
-
-                e1.setName("name-10"); // Valid update.
-
-                ses.delete(ses.load(Entity.class, 0)); // Invalid delete (there is a parent entity referencing it).
-
-                tx.commit();
-
-                fail("Commit must fail.");
-            }
-            catch (PersistenceException e) {
-                log.info("Expected exception: " + e);
-
-                tx.rollback();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 3);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 3);
-
-            ses = sesFactory1.openSession();
-
-            tx = ses.beginTransaction();
-
-            try {
-                ses.delete(ses.load(Entity.class, 1)); // Valid delete.
-
-                idToName.remove(1);
-
-                ses.delete(ses.load(Entity.class, 0)); // Invalid delete (there is a parent entity referencing it).
-
-                tx.commit();
-
-                fail("Commit must fail.");
-            }
-            catch (PersistenceException e) {
-                log.info("Expected exception: " + e);
-
-                tx.rollback();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName);
-        }
-        finally {
-            cleanup();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testQueryCache() throws Exception {
-        for (AccessType accessType : accessTypes())
-            testQueryCache(accessType);
-    }
-
-    /**
-     * @param accessType Cache access type.
-     * @throws Exception If failed.
-     */
-    private void testQueryCache(AccessType accessType) throws Exception {
-        createSessionFactories(accessType);
-
-        try {
-            Session ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                for (int i = 0; i < 5; i++)
-                    ses.save(new Entity(i, "name-" + i));
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            // Run some queries.
-
-            ses = sesFactory1.openSession();
-
-            try {
-                Query qry1 = ses.createQuery("from " + ENTITY_NAME + " where id > 2");
-
-                qry1.setCacheable(true);
-
-                assertEquals(2, qry1.list().size());
-
-                Query qry2 = ses.createQuery("from " + ENTITY_NAME + " where name = 'name-0'");
-
-                qry2.setCacheable(true);
-
-                assertEquals(1, qry2.list().size());
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEquals(0, sesFactory1.getStatistics().getQueryCacheHitCount());
-            assertEquals(2, sesFactory1.getStatistics().getQueryCacheMissCount());
-            assertEquals(2, sesFactory1.getStatistics().getQueryCachePutCount());
-
-            // Run queries using another SessionFactory.
-
-            ses = sesFactory2.openSession();
-
-            try {
-                Query qry1 = ses.createQuery("from " + ENTITY_NAME + " where id > 2");
-
-                qry1.setCacheable(true);
-
-                assertEquals(2, qry1.list().size());
-
-                Query qry2 = ses.createQuery("from " + ENTITY_NAME + " where name = 'name-0'");
-
-                qry2.setCacheable(true);
-
-                assertEquals(1, qry2.list().size());
-
-                Query qry3 = ses.createQuery("from " + ENTITY_NAME + " where id > 1");
-
-                qry3.setCacheable(true);
-
-                assertEquals(3, qry3.list().size());
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEquals(2, sesFactory2.getStatistics().getQueryCacheHitCount());
-            assertEquals(1, sesFactory2.getStatistics().getQueryCacheMissCount());
-            assertEquals(1, sesFactory2.getStatistics().getQueryCachePutCount());
-
-            // Update entity, it should invalidate query cache.
-
-            ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                ses.save(new Entity(5, "name-5"));
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            // Run queries.
-
-            ses = sesFactory1.openSession();
-
-            sesFactory1.getStatistics().clear();
-
-            try {
-                Query qry1 = ses.createQuery("from " + ENTITY_NAME + " where id > 2");
-
-                qry1.setCacheable(true);
-
-                assertEquals(3, qry1.list().size());
-
-                Query qry2 = ses.createQuery("from " + ENTITY_NAME + " where name = 'name-0'");
-
-                qry2.setCacheable(true);
-
-                assertEquals(1, qry2.list().size());
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEquals(0, sesFactory1.getStatistics().getQueryCacheHitCount());
-            assertEquals(2, sesFactory1.getStatistics().getQueryCacheMissCount());
-            assertEquals(2, sesFactory1.getStatistics().getQueryCachePutCount());
-
-            // Clear query cache using another SessionFactory.
-
-            sesFactory2.getCache().evictDefaultQueryRegion();
-
-            ses = sesFactory1.openSession();
-
-            // Run queries again.
-
-            sesFactory1.getStatistics().clear();
-
-            try {
-                Query qry1 = ses.createQuery("from " + ENTITY_NAME + " where id > 2");
-
-                qry1.setCacheable(true);
-
-                assertEquals(3, qry1.list().size());
-
-                Query qry2 = ses.createQuery("from " + ENTITY_NAME + " where name = 'name-0'");
-
-                qry2.setCacheable(true);
-
-                assertEquals(1, qry2.list().size());
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEquals(0, sesFactory1.getStatistics().getQueryCacheHitCount());
-            assertEquals(2, sesFactory1.getStatistics().getQueryCacheMissCount());
-            assertEquals(2, sesFactory1.getStatistics().getQueryCachePutCount());
-        }
-        finally {
-            cleanup();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRegionClear() throws Exception {
-        for (AccessType accessType : accessTypes())
-            testRegionClear(accessType);
-    }
-
-    /**
-     * @param accessType Cache access type.
-     * @throws Exception If failed.
-     */
-    private void testRegionClear(AccessType accessType) throws Exception {
-        createSessionFactories(accessType);
-
-        try {
-            final int ENTITY_CNT = 100;
-
-            Session ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                for (int i = 0; i < ENTITY_CNT; i++) {
-                    Entity e = new Entity(i, "name-" + i);
-
-                    Collection<ChildEntity> children = new ArrayList<>();
-
-                    for (int j = 0; j < 3; j++)
-                        children.add(new ChildEntity());
-
-                    e.setChildren(children);
-
-                    ses.save(e);
-                }
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            loadEntities(sesFactory2, ENTITY_CNT);
-
-            SecondLevelCacheStatistics stats1 = sesFactory1.getStatistics().getSecondLevelCacheStatistics(ENTITY_NAME);
-            SecondLevelCacheStatistics stats2 = sesFactory2.getStatistics().getSecondLevelCacheStatistics(ENTITY_NAME);
-
-            NaturalIdCacheStatistics idStats1 =
-                sesFactory1.getStatistics().getNaturalIdCacheStatistics(NATURAL_ID_REGION);
-            NaturalIdCacheStatistics idStats2 =
-                sesFactory2.getStatistics().getNaturalIdCacheStatistics(NATURAL_ID_REGION);
-
-            SecondLevelCacheStatistics colStats1 =
-                sesFactory1.getStatistics().getSecondLevelCacheStatistics(CHILD_COLLECTION_REGION);
-            SecondLevelCacheStatistics colStats2 =
-                sesFactory2.getStatistics().getSecondLevelCacheStatistics(CHILD_COLLECTION_REGION);
-
-            assertEquals(ENTITY_CNT, stats1.getElementCountInMemory());
-            assertEquals(ENTITY_CNT, stats2.getElementCountInMemory());
-
-            assertEquals(ENTITY_CNT, idStats1.getElementCountInMemory());
-            assertEquals(ENTITY_CNT, idStats2.getElementCountInMemory());
-
-            assertEquals(ENTITY_CNT, colStats1.getElementCountInMemory());
-            assertEquals(ENTITY_CNT, colStats2.getElementCountInMemory());
-
-            // Test cache is cleared after update query.
-
-            ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                ses.createQuery("delete from " + ENTITY_NAME + " where name='no such name'").executeUpdate();
-
-                ses.createQuery("delete from " + ChildEntity.class.getName() + " where id=-1").executeUpdate();
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEquals(0, stats1.getElementCountInMemory());
-            assertEquals(0, stats2.getElementCountInMemory());
-
-            assertEquals(0, idStats1.getElementCountInMemory());
-            assertEquals(0, idStats2.getElementCountInMemory());
-
-            assertEquals(0, colStats1.getElementCountInMemory());
-            assertEquals(0, colStats2.getElementCountInMemory());
-
-            // Load some data in cache.
-
-            loadEntities(sesFactory1, 10);
-
-            assertEquals(10, stats1.getElementCountInMemory());
-            assertEquals(10, stats2.getElementCountInMemory());
-            assertEquals(10, idStats1.getElementCountInMemory());
-            assertEquals(10, idStats2.getElementCountInMemory());
-
-            // Test evictAll method.
-
-            sesFactory2.getCache().evictEntityRegion(ENTITY_NAME);
-
-            assertEquals(0, stats1.getElementCountInMemory());
-            assertEquals(0, stats2.getElementCountInMemory());
-
-            sesFactory2.getCache().evictNaturalIdRegion(ENTITY_NAME);
-
-            assertEquals(0, idStats1.getElementCountInMemory());
-            assertEquals(0, idStats2.getElementCountInMemory());
-
-            sesFactory2.getCache().evictCollectionRegion(CHILD_COLLECTION_REGION);
-
-            assertEquals(0, colStats1.getElementCountInMemory());
-            assertEquals(0, colStats2.getElementCountInMemory());
-        }
-        finally {
-            cleanup();
-        }
-    }
-
-    /**
-     * @param sesFactory Session factory.
-     * @param nameToId Name-ID mapping.
-     * @param absentNames Absent entities' names.
-     */
-    private void assertNaturalIdCache(SessionFactory sesFactory, Map<String, Integer> nameToId, String... absentNames) {
-        sesFactory.getStatistics().clear();
-
-        NaturalIdCacheStatistics stats =
-            sesFactory.getStatistics().getNaturalIdCacheStatistics(NATURAL_ID_REGION);
-
-        long hitBefore = stats.getHitCount();
-
-        long missBefore = stats.getMissCount();
-
-        final Session ses = sesFactory.openSession();
-
-        try {
-            for (Map.Entry<String, Integer> e : nameToId.entrySet())
-                assertEquals((int)e.getValue(), ((Entity)ses.bySimpleNaturalId(Entity.class).load(e.getKey())).getId());
-
-            for (String name : absentNames)
-                assertNull((ses.bySimpleNaturalId(Entity.class).load(name)));
-
-            assertEquals(nameToId.size() + hitBefore, stats.getHitCount());
-
-            assertEquals(absentNames.length + missBefore, stats.getMissCount());
-        }
-        finally {
-            ses.close();
-        }
-    }
-
-    /**
-     * @param sesFactory Session factory.
-     * @param idToChildCnt Number of children per entity.
-     * @param expHit Expected cache hits.
-     * @param expMiss Expected cache misses.
-     */
-    @SuppressWarnings("unchecked")
-    private void assertCollectionCache(SessionFactory sesFactory, Map<Integer, Integer> idToChildCnt, int expHit,
-        int expMiss) {
-        sesFactory.getStatistics().clear();
-
-        Session ses = sesFactory.openSession();
-
-        try {
-            for(Map.Entry<Integer, Integer> e : idToChildCnt.entrySet()) {
-                Entity entity = (Entity)ses.load(Entity.class, e.getKey());
-
-                assertEquals((int)e.getValue(), entity.getChildren().size());
-            }
-        }
-        finally {
-            ses.close();
-        }
-
-        SecondLevelCacheStatistics stats =
-            sesFactory.getStatistics().getSecondLevelCacheStatistics(CHILD_COLLECTION_REGION);
-
-        assertEquals(expHit, stats.getHitCount());
-
-        assertEquals(expMiss, stats.getMissCount());
-    }
-
-    /**
-     * @param sesFactory Session factory.
-     * @param cnt Number of entities to load.
-     */
-    private void loadEntities(SessionFactory sesFactory, int cnt) {
-        Session ses = sesFactory.openSession();
-
-        try {
-            for (int i = 0; i < cnt; i++) {
-                Entity e = (Entity)ses.load(Entity.class, i);
-
-                assertEquals("name-" + i, e.getName());
-
-                assertFalse(e.getChildren().isEmpty());
-
-                ses.bySimpleNaturalId(Entity.class).load(e.getName());
-            }
-        }
-        finally {
-            ses.close();
-        }
-    }
-
-    /**
-     * @param entityName Entity name.
-     * @param sesFactory Session factory.
-     * @param idToName ID to name mapping.
-     * @param absentIds Absent entities' IDs.
-     */
-    private void assertEntityCache(String entityName, SessionFactory sesFactory, Map<Integer, String> idToName,
-        Integer... absentIds) {
-        assert entityName.equals(ENTITY_NAME) || entityName.equals(ENTITY2_NAME) : entityName;
-
-        sesFactory.getStatistics().clear();
-
-        final Session ses = sesFactory.openSession();
-
-        final boolean entity1 = entityName.equals(ENTITY_NAME);
-
-        try {
-            if (entity1) {
-                for (Map.Entry<Integer, String> e : idToName.entrySet())
-                    assertEquals(e.getValue(), ((Entity)ses.load(Entity.class, e.getKey())).getName());
-            }
-            else {
-                for (Map.Entry<Integer, String> e : idToName.entrySet())
-                    assertEquals(e.getValue(), ((Entity2)ses.load(Entity2.class, e.getKey())).getName());
-            }
-
-            for (final int id : absentIds) {
-                GridTestUtils.assertThrows(log, new Callable<Void>() {
-                    @Override public Void call() throws Exception {
-                        if (entity1)
-                            ((Entity)ses.load(Entity.class, id)).getName();
-                        else
-                            ((Entity2)ses.load(Entity2.class, id)).getName();
-
-                        return null;
-                    }
-                }, ObjectNotFoundException.class, null);
-            }
-
-            SecondLevelCacheStatistics stats = sesFactory.getStatistics().getSecondLevelCacheStatistics(entityName);
-
-            assertEquals(idToName.size(), stats.getHitCount());
-
-            assertEquals(absentIds.length, stats.getMissCount());
-        }
-        finally {
-            ses.close();
-        }
-    }
-
-    /**
-     * Creates session factories.
-     *
-     * @param accessType Cache access type.
-     */
-    private void createSessionFactories(AccessType accessType) {
-        sesFactory1 = startHibernate(accessType, getTestIgniteInstanceName(0));
-
-        sesFactory2 = startHibernate(accessType, getTestIgniteInstanceName(1));
-    }
-
-    /**
-     * Starts Hibernate.
-     *
-     * @param accessType Cache access type.
-     * @param igniteInstanceName Ignite instance name.
-     * @return Session factory.
-     */
-    private SessionFactory startHibernate(org.hibernate.cache.spi.access.AccessType accessType, String igniteInstanceName) {
-        StandardServiceRegistryBuilder builder = registryBuilder();
-
-        builder.applySetting(HBM2DDL_AUTO, "create");
-        builder.applySetting(GENERATE_STATISTICS, "true");
-        builder.applySetting(USE_SECOND_LEVEL_CACHE, "true");
-        builder.applySetting(USE_QUERY_CACHE, "true");
-        builder.applySetting(CACHE_REGION_FACTORY, HibernateRegionFactory.class.getName());
-        builder.applySetting(RELEASE_CONNECTIONS, "on_close");
-        builder.applySetting(IGNITE_INSTANCE_NAME_PROPERTY, igniteInstanceName);
-        // Use the same cache for Entity and Entity2.
-        builder.applySetting(REGION_CACHE_PROPERTY + ENTITY2_NAME, ENTITY_NAME);
-        builder.applySetting(DFLT_ACCESS_TYPE_PROPERTY, accessType.name());
-        builder.applySetting(Environment.DIALECT, "org.hibernate.dialect.H2Dialect");
-        builder.applySetting("hibernate.show_sql", false);
-
-        StandardServiceRegistry srvcRegistry = builder.build();
-
-        MetadataSources metadataSources = new MetadataSources(srvcRegistry);
-
-        for (Class entityClass : getAnnotatedClasses())
-            metadataSources.addAnnotatedClass(entityClass);
-
-        Metadata metadata = metadataSources.buildMetadata();
-
-        for (PersistentClass entityBinding : metadata.getEntityBindings()) {
-            if (!entityBinding.isInherited())
-                ((RootClass)entityBinding).setCacheConcurrencyStrategy(accessType.getExternalName());
-        }
-
-        for (org.hibernate.mapping.Collection collectionBinding : metadata.getCollectionBindings())
-            collectionBinding.setCacheConcurrencyStrategy( accessType.getExternalName() );
-
-        return metadata.buildSessionFactory();
-    }
-
-    /**
-     * @return Entities classes.
-     */
-    private Class[] getAnnotatedClasses() {
-        return new Class[]{Entity.class, Entity2.class, VersionedEntity.class, ChildEntity.class, ParentEntity.class};
-    }
-
-    /**
-     * Closes session factories and clears data from caches.
-     *
-     * @throws Exception If failed.
-     */
-    private void cleanup() throws Exception {
-        if (sesFactory1 != null)
-            sesFactory1.close();
-
-        sesFactory1 = null;
-
-        if (sesFactory2 != null)
-            sesFactory2.close();
-
-        sesFactory2 = null;
-
-        for (IgniteCacheProxy<?, ?> cache : ((IgniteKernal)grid(0)).caches())
-            cache.clear();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java b/modules/hibernate5/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java
deleted file mode 100644
index 5175292..0000000
--- a/modules/hibernate5/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import java.util.Collections;
-import javax.cache.configuration.Factory;
-import javax.transaction.Synchronization;
-import javax.transaction.TransactionManager;
-import javax.transaction.UserTransaction;
-import org.apache.commons.dbcp.managed.BasicManagedDataSource;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.h2.jdbcx.JdbcDataSource;
-import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cfg.Environment;
-import org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl;
-import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
-import org.hibernate.engine.transaction.jta.platform.internal.AbstractJtaPlatform;
-import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform;
-import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl;
-import org.jetbrains.annotations.Nullable;
-import org.objectweb.jotm.Jotm;
-
-/**
- *
- * Tests Hibernate L2 cache with TRANSACTIONAL access mode (Hibernate and Cache are configured
- * to used the same TransactionManager).
- */
-public class HibernateL2CacheTransactionalSelfTest extends HibernateL2CacheSelfTest {
-    /** */
-    private static Jotm jotm;
-
-    /**
-     */
-    private static class TestJtaPlatform extends AbstractJtaPlatform {
-        /** {@inheritDoc} */
-        @Override protected TransactionManager locateTransactionManager() {
-            return jotm.getTransactionManager();
-        }
-
-        /** {@inheritDoc} */
-        @Override protected UserTransaction locateUserTransaction() {
-            return jotm.getUserTransaction();
-        }
-    }
-
-    /**
-     */
-    @SuppressWarnings("PublicInnerClass")
-    public static class TestTmFactory implements Factory<TransactionManager> {
-        /** */
-        private static final long serialVersionUID = 0;
-
-        /** {@inheritDoc} */
-        @Override public TransactionManager create() {
-            return jotm.getTransactionManager();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        jotm = new Jotm(true, false);
-
-        super.beforeTestsStarted();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        super.afterTestsStopped();
-
-        if (jotm != null)
-            jotm.stop();
-
-        jotm = null;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
-        cfg.getTransactionConfiguration().setTxManagerFactory(new TestTmFactory());
-        cfg.getTransactionConfiguration().setUseJtaSynchronization(useJtaSynchronization());
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheConfiguration transactionalRegionConfiguration(String regionName) {
-        CacheConfiguration cfg = super.transactionalRegionConfiguration(regionName);
-
-        cfg.setNearConfiguration(null);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected StandardServiceRegistryBuilder registryBuilder() {
-        StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
-
-        DatasourceConnectionProviderImpl connProvider = new DatasourceConnectionProviderImpl();
-
-        BasicManagedDataSource dataSrc = new BasicManagedDataSource(); // JTA-aware data source.
-
-        dataSrc.setTransactionManager(jotm.getTransactionManager());
-
-        dataSrc.setDefaultAutoCommit(false);
-
-        JdbcDataSource h2DataSrc = new JdbcDataSource();
-
-        h2DataSrc.setURL(CONNECTION_URL);
-
-        dataSrc.setXaDataSourceInstance(h2DataSrc);
-
-        connProvider.setDataSource(dataSrc);
-
-        connProvider.configure(Collections.emptyMap());
-
-        builder.addService(ConnectionProvider.class, connProvider);
-
-        builder.addService(JtaPlatform.class, new TestJtaPlatform());
-
-        builder.applySetting(Environment.TRANSACTION_COORDINATOR_STRATEGY, JtaTransactionCoordinatorBuilderImpl.class.getName());
-
-        return builder;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected AccessType[] accessTypes() {
-        return new AccessType[]{AccessType.TRANSACTIONAL};
-    }
-
-    /**
-     * @return Whether to use {@link Synchronization}.
-     */
-    protected boolean useJtaSynchronization() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.java b/modules/hibernate5/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.java
deleted file mode 100644
index 44899f9..0000000
--- a/modules/hibernate5/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import javax.transaction.Synchronization;
-
-/**
- * Tests Hibernate L2 cache with TRANSACTIONAL access mode and {@link Synchronization}
- * instead of XA resource.
- */
-public class HibernateL2CacheTransactionalUseSyncSelfTest extends HibernateL2CacheTransactionalSelfTest {
-    /** {@inheritDoc} */
-    @Override protected boolean useJtaSynchronization() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java b/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
deleted file mode 100644
index d5496af..0000000
--- a/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.cache.store.hibernate;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.store.CacheStore;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.integration.IgniteCacheStoreNodeRestartAbstractTest;
-
-public class CacheHibernateBlobStoreNodeRestartTest extends IgniteCacheStoreNodeRestartAbstractTest {
-    /** {@inheritDoc} */
-    @Override protected CacheStore getStore() {
-        return new CacheHibernateBlobStore();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return CacheMode.PARTITIONED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return CacheAtomicityMode.ATOMIC;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return null;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreSelfTest.java b/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreSelfTest.java
deleted file mode 100644
index d3d2b52..0000000
--- a/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreSelfTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.cache.store.hibernate;
-
-import java.io.File;
-import java.net.URL;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.testframework.junits.cache.GridAbstractCacheStoreSelfTest;
-import org.hibernate.FlushMode;
-import org.hibernate.Session;
-import org.hibernate.Transaction;
-
-/**
- * Cache store test.
- */
-public class CacheHibernateBlobStoreSelfTest extends
-    GridAbstractCacheStoreSelfTest<CacheHibernateBlobStore<Object, Object>> {
-    /**
-     * @throws Exception If failed.
-     */
-    public CacheHibernateBlobStoreSelfTest() throws Exception {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        super.afterTest();
-
-        Session s = store.session(null);
-
-        if (s == null)
-            return;
-
-        try {
-            s.createQuery("delete from " + CacheHibernateBlobStoreEntry.class.getSimpleName())
-                    .setFlushMode(FlushMode.ALWAYS).executeUpdate();
-
-            Transaction hTx = s.getTransaction();
-
-            if (hTx != null && hTx.isActive())
-                hTx.commit();
-        }
-        finally {
-            s.close();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheHibernateBlobStore<Object, Object> store() {
-        return new CacheHibernateBlobStore<>();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testConfigurationByUrl() throws Exception {
-        URL url = U.resolveIgniteUrl(
-                "modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
-
-        assert url != null;
-
-        store.setHibernateConfigurationPath(url.toString());
-
-        // Store will be implicitly initialized.
-        store.load("key");
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testConfigurationByFile() throws Exception {
-        URL url = U.resolveIgniteUrl(
-                "modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
-
-        assert url != null;
-
-        File file = new File(url.toURI());
-
-        store.setHibernateConfigurationPath(file.getAbsolutePath());
-
-        // Store will be implicitly initialized.
-        store.load("key");
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testConfigurationByResource() throws Exception {
-        store.setHibernateConfigurationPath("/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
-
-        // Store will be implicitly initialized.
-        store.load("key");
-    }
-
-    @Override public void testSimpleMultithreading() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-1757");
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java b/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
deleted file mode 100644
index d158f81..0000000
--- a/modules/hibernate5/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * 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.cache.store.hibernate;
-
-import java.sql.Connection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import javax.naming.NamingException;
-import javax.naming.Reference;
-import javax.persistence.EntityGraph;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceUnitUtil;
-import javax.persistence.Query;
-import javax.persistence.SynchronizationType;
-import javax.persistence.criteria.CriteriaBuilder;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.hibernate.Cache;
-import org.hibernate.HibernateException;
-import org.hibernate.Metamodel;
-import org.hibernate.Session;
-import org.hibernate.SessionBuilder;
-import org.hibernate.SessionFactory;
-import org.hibernate.StatelessSession;
-import org.hibernate.StatelessSessionBuilder;
-import org.hibernate.TypeHelper;
-import org.hibernate.boot.spi.SessionFactoryOptions;
-import org.hibernate.engine.spi.FilterDefinition;
-import org.hibernate.metadata.ClassMetadata;
-import org.hibernate.metadata.CollectionMetadata;
-import org.hibernate.stat.Statistics;
-
-/**
- * Test for Cache jdbc blob store factory.
- */
-public class CacheHibernateStoreFactorySelfTest extends GridCommonAbstractTest {
-    /** Cache name. */
-    private static final String CACHE_NAME = "test";
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCacheConfiguration() throws Exception {
-        try (Ignite ignite1 = startGrid(0)) {
-            IgniteCache<Integer, String> cache1 = ignite1.getOrCreateCache(cacheConfiguration());
-
-            checkStore(cache1);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testXmlConfiguration() throws Exception {
-        try (Ignite ignite = Ignition.start("modules/hibernate/src/test/config/factory-cache.xml")) {
-            try(Ignite ignite1 = Ignition.start("modules/hibernate/src/test/config/factory-cache1.xml")) {
-                checkStore(ignite.<Integer, String>cache(CACHE_NAME), DummySessionFactoryExt.class);
-
-                checkStore(ignite1.<Integer, String>cache(CACHE_NAME), DummySessionFactory.class);
-            }
-        }
-    }
-
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testIncorrectBeanConfiguration() throws Exception {
-        GridTestUtils.assertThrows(log, new Callable<Object>() {
-            @Override public Object call() throws Exception {
-                try(Ignite ignite =
-                    Ignition.start("modules/hibernate/src/test/config/factory-incorrect-store-cache.xml")) {
-                    ignite.cache(CACHE_NAME).getConfiguration(CacheConfiguration.class).
-                            getCacheStoreFactory().create();
-                }
-                return null;
-            }
-        }, IgniteException.class, "Failed to load bean in application context");
-    }
-
-    /**
-     * @return Cache configuration with store.
-     */
-    private CacheConfiguration<Integer, String> cacheConfiguration() {
-        CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
-
-        CacheHibernateBlobStoreFactory<Integer, String> factory = new CacheHibernateBlobStoreFactory();
-
-        factory.setHibernateConfigurationPath("/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
-
-        cfg.setCacheStoreFactory(factory);
-
-        return cfg;
-    }
-
-    /**
-     * @param cache Ignite cache.
-     * @param dataSrcClass Data source class.
-     * @throws Exception If store parameters is not the same as in configuration xml.
-     */
-    private void checkStore(IgniteCache<Integer, String> cache, Class<?> dataSrcClass) throws Exception {
-        CacheHibernateBlobStore store = (CacheHibernateBlobStore)cache
-            .getConfiguration(CacheConfiguration.class).getCacheStoreFactory().create();
-
-        assertEquals(dataSrcClass,
-            GridTestUtils.getFieldValue(store, CacheHibernateBlobStore.class, "sesFactory").getClass());
-    }
-
-    /**
-     * @param cache Ignite cache.
-     * @throws Exception If store parameters is not the same as in configuration xml.
-     */
-    private void checkStore(IgniteCache<Integer, String> cache) throws Exception {
-        CacheHibernateBlobStore store = (CacheHibernateBlobStore)cache.getConfiguration(CacheConfiguration.class)
-            .getCacheStoreFactory().create();
-
-        assertEquals("/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml",
-            GridTestUtils.getFieldValue(store, CacheHibernateBlobStore.class, "hibernateCfgPath"));
-    }
-
-    /**
-     *
-     */
-    public static class DummySessionFactoryExt extends DummySessionFactory {
-        /** */
-        public DummySessionFactoryExt() {
-            // No-op.
-        }
-    }
-
-    /**
-     *
-     */
-    public static class DummySessionFactory implements SessionFactory {
-        /** {@inheritDoc} */
-        @Override public SessionFactoryOptions getSessionFactoryOptions() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public SessionBuilder withOptions() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Session openSession() throws HibernateException {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Session getCurrentSession() throws HibernateException {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public StatelessSessionBuilder withStatelessOptions() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public StatelessSession openStatelessSession() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public StatelessSession openStatelessSession(Connection conn) {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public ClassMetadata getClassMetadata(Class entityCls) {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public ClassMetadata getClassMetadata(String entityName) {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public CollectionMetadata getCollectionMetadata(String roleName) {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Map<String, ClassMetadata> getAllClassMetadata() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Map getAllCollectionMetadata() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Statistics getStatistics() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void close() throws HibernateException {
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean isClosed() {
-            return false;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Cache getCache() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Set getDefinedFilterNames() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public FilterDefinition getFilterDefinition(String filterName) throws HibernateException {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean containsFetchProfileDefinition(String name) {
-            return false;
-        }
-
-        /** {@inheritDoc} */
-        @Override public TypeHelper getTypeHelper() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Reference getReference() throws NamingException {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public EntityManager createEntityManager() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public EntityManager createEntityManager(Map map) {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public EntityManager createEntityManager(SynchronizationType synchronizationType) {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public EntityManager createEntityManager(SynchronizationType synchronizationType, Map map) {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public CriteriaBuilder getCriteriaBuilder() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean isOpen() {
-            return false;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Map<String, Object> getProperties() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public PersistenceUnitUtil getPersistenceUnitUtil() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void addNamedQuery(String s, Query qry) {
-            // No-op.
-        }
-
-        /** {@inheritDoc} */
-        @Override public <T> T unwrap(Class<T> aCls) {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public <T> void addNamedEntityGraph(String s, EntityGraph<T> entityGraph) {
-            // No-op.
-        }
-
-        /** {@inheritDoc} */
-        @Override public <T> List<EntityGraph<? super T>> findEntityGraphsByType(Class<T> entityCls) {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Metamodel getMetamodel() {
-            return null;
-        }
-    }
-}
\ No newline at end of file


[12/51] [abbrv] ignite git commit: ignite-1794 Refactored hibernate modules, switched to hibernate 5.1

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java
new file mode 100644
index 0000000..6e546b0
--- /dev/null
+++ b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java
@@ -0,0 +1,543 @@
+/*
+ * 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.cache.store.hibernate;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicBoolean;
+import javax.cache.integration.CacheLoaderException;
+import javax.cache.integration.CacheWriterException;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.cache.store.CacheStoreAdapter;
+import org.apache.ignite.cache.store.CacheStoreSession;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.marshaller.jdk.JdkMarshaller;
+import org.apache.ignite.resources.CacheStoreSessionResource;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.resources.LoggerResource;
+import org.apache.ignite.transactions.Transaction;
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.SharedSessionContract;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.resource.transaction.spi.TransactionStatus;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * {@link CacheStore} implementation backed by Hibernate. This implementation
+ * stores objects in underlying database in {@code BLOB} format.
+ * <h2 class="header">Configuration</h2>
+ * Either {@link #setSessionFactory(SessionFactory)} or
+ * {@link #setHibernateConfigurationPath(String)} or
+ * {@link #setHibernateProperties(Properties)} should be set.
+ * <p>
+ * If session factory is provided it should contain
+ * {@link CacheHibernateBlobStoreEntry} persistent class (via provided
+ * mapping file {@code GridCacheHibernateStoreEntry.hbm.xml} or by
+ * adding {@link CacheHibernateBlobStoreEntry} to annotated classes
+ * of session factory.
+ * <p>
+ * Path to hibernate configuration may be either an URL or a file path or
+ * a classpath resource. This configuration file should include provided
+ * mapping {@code GridCacheHibernateStoreEntry.hbm.xml} or include annotated
+ * class {@link CacheHibernateBlobStoreEntry}.
+ * <p>
+ * If hibernate properties are provided, mapping
+ * {@code GridCacheHibernateStoreEntry.hbm.xml} is included automatically.
+ * <p>
+ * Use {@link CacheHibernateBlobStoreFactory} factory to pass {@link CacheHibernateBlobStore} to {@link CacheConfiguration}.
+ */
+public class CacheHibernateBlobStore<K, V> extends CacheStoreAdapter<K, V> {
+    /**
+     * Default connection URL
+     * (value is <tt>jdbc:h2:mem:hibernateCacheStore;DB_CLOSE_DELAY=-1;DEFAULT_LOCK_TIMEOUT=5000</tt>).
+     */
+    public static final String DFLT_CONN_URL = "jdbc:h2:mem:hibernateCacheStore;DB_CLOSE_DELAY=-1;" +
+        "DEFAULT_LOCK_TIMEOUT=5000";
+
+    /** Default show SQL property value (value is <tt>true</tt>). */
+    public static final String DFLT_SHOW_SQL = "true";
+
+    /** Default <tt>hibernate.hbm2ddl.auto</tt> property value (value is <tt>true</tt>). */
+    public static final String DFLT_HBM2DDL_AUTO = "update";
+
+    /** Session attribute name. */
+    private static final String ATTR_SES = "HIBERNATE_STORE_SESSION";
+
+    /** Name of Hibarname mapping resource. */
+    private static final String MAPPING_RESOURCE =
+            "org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml";
+
+    /** Marshaller. */
+    private static final Marshaller marsh = new JdkMarshaller();
+
+    /** Init guard. */
+    @GridToStringExclude
+    private final AtomicBoolean initGuard = new AtomicBoolean();
+
+    /** Init latch. */
+    @GridToStringExclude
+    private final CountDownLatch initLatch = new CountDownLatch(1);
+
+    /** Hibernate properties. */
+    @GridToStringExclude
+    private Properties hibernateProps;
+
+    /** Session factory. */
+    @GridToStringExclude
+    private SessionFactory sesFactory;
+
+    /** Path to hibernate configuration file. */
+    private String hibernateCfgPath;
+
+    /** Log. */
+    @LoggerResource
+    private IgniteLogger log;
+
+    /** Auto-injected store session. */
+    @CacheStoreSessionResource
+    private CacheStoreSession ses;
+
+    /** Ignite instance. */
+    @IgniteInstanceResource
+    private Ignite ignite;
+
+    /** {@inheritDoc} */
+    @SuppressWarnings({"unchecked", "RedundantTypeArguments"})
+    @Override public V load(K key) {
+        init();
+
+        Transaction tx = transaction();
+
+        if (log.isDebugEnabled())
+            log.debug("Store load [key=" + key + ", tx=" + tx + ']');
+
+        Session ses = session(tx);
+
+        try {
+            CacheHibernateBlobStoreEntry entry = (CacheHibernateBlobStoreEntry)
+                ses.get(CacheHibernateBlobStoreEntry.class, toBytes(key));
+
+            if (entry == null)
+                return null;
+
+            return fromBytes(entry.getValue());
+        }
+        catch (IgniteCheckedException | HibernateException e) {
+            rollback(ses, tx);
+
+            throw new CacheLoaderException("Failed to load value from cache store with key: " + key, e);
+        }
+        finally {
+            end(ses, tx);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void write(javax.cache.Cache.Entry<? extends K, ? extends V> entry) {
+        init();
+
+        Transaction tx = transaction();
+
+        K key = entry.getKey();
+        V val = entry.getValue();
+
+        if (log.isDebugEnabled())
+            log.debug("Store put [key=" + key + ", val=" + val + ", tx=" + tx + ']');
+
+        if (val == null) {
+            delete(key);
+
+            return;
+        }
+
+        Session ses = session(tx);
+
+        try {
+            CacheHibernateBlobStoreEntry entry0 = new CacheHibernateBlobStoreEntry(toBytes(key), toBytes(val));
+
+            ses.saveOrUpdate(entry0);
+        }
+        catch (IgniteCheckedException | HibernateException e) {
+            rollback(ses, tx);
+
+            throw new CacheWriterException("Failed to put value to cache store [key=" + key + ", val" + val + "]", e);
+        }
+        finally {
+            end(ses, tx);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings({"JpaQueryApiInspection", "JpaQlInspection"})
+    @Override public void delete(Object key) {
+        init();
+
+        Transaction tx = transaction();
+
+        if (log.isDebugEnabled())
+            log.debug("Store remove [key=" + key + ", tx=" + tx + ']');
+
+        Session ses = session(tx);
+
+        try {
+            Object obj = ses.get(CacheHibernateBlobStoreEntry.class, toBytes(key));
+
+            if (obj != null)
+                ses.delete(obj);
+        }
+        catch (IgniteCheckedException | HibernateException e) {
+            rollback(ses, tx);
+
+            throw new CacheWriterException("Failed to remove value from cache store with key: " + key, e);
+        }
+        finally {
+            end(ses, tx);
+        }
+    }
+
+    /**
+     * Rolls back hibernate session.
+     *
+     * @param ses Hibernate session.
+     * @param tx Cache ongoing transaction.
+     */
+    private void rollback(SharedSessionContract ses, Transaction tx) {
+        // Rollback only if there is no cache transaction,
+        // otherwise sessionEnd() will do all required work.
+        if (tx == null) {
+            org.hibernate.Transaction hTx = ses.getTransaction();
+
+            if (hTx != null && hTx.getStatus().canRollback())
+                hTx.rollback();
+        }
+    }
+
+    /**
+     * Ends hibernate session.
+     *
+     * @param ses Hibernate session.
+     * @param tx Cache ongoing transaction.
+     */
+    private void end(Session ses, Transaction tx) {
+        // Commit only if there is no cache transaction,
+        // otherwise sessionEnd() will do all required work.
+        if (tx == null) {
+            org.hibernate.Transaction hTx = ses.getTransaction();
+
+            if (hTx != null && hTx.getStatus() == TransactionStatus.ACTIVE)
+                hTx.commit();
+
+            ses.close();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void sessionEnd(boolean commit) {
+        init();
+
+        Transaction tx = transaction();
+
+        Map<String, Session> props = session().properties();
+
+        Session ses = props.remove(ATTR_SES);
+
+        if (ses != null) {
+            org.hibernate.Transaction hTx = ses.getTransaction();
+
+            if (hTx != null) {
+                try {
+                    if (commit) {
+                        ses.flush();
+
+                        hTx.commit();
+                    }
+                    else
+                        hTx.rollback();
+
+                    if (log.isDebugEnabled())
+                        log.debug("Transaction ended [xid=" + tx.xid() + ", commit=" + commit + ']');
+                }
+                catch (HibernateException e) {
+                    throw new CacheWriterException("Failed to end transaction [xid=" + tx.xid() +
+                        ", commit=" + commit + ']', e);
+                }
+                finally {
+                    ses.close();
+                }
+            }
+        }
+    }
+
+    /**
+     * Gets Hibernate session.
+     *
+     * @param tx Cache transaction.
+     * @return Session.
+     */
+    Session session(@Nullable Transaction tx) {
+        Session ses;
+
+        if (tx != null) {
+            Map<String, Session> props = session().properties();
+
+            ses = props.get(ATTR_SES);
+
+            if (ses == null) {
+                ses = sesFactory.openSession();
+
+                ses.beginTransaction();
+
+                // Store session in transaction metadata, so it can be accessed
+                // for other operations on the same transaction.
+                props.put(ATTR_SES, ses);
+
+                if (log.isDebugEnabled())
+                    log.debug("Hibernate session open [ses=" + ses + ", tx=" + tx.xid() + "]");
+            }
+        }
+        else {
+            ses = sesFactory.openSession();
+
+            ses.beginTransaction();
+        }
+
+        return ses;
+    }
+
+    /**
+     * Sets session factory.
+     *
+     * @param sesFactory Session factory.
+     */
+    public void setSessionFactory(SessionFactory sesFactory) {
+        this.sesFactory = sesFactory;
+    }
+
+    /**
+     * Sets hibernate configuration path.
+     * <p>
+     * This may be either URL or file path or classpath resource.
+     *
+     * @param hibernateCfgPath URL or file path or classpath resource
+     *      pointing to hibernate configuration XML file.
+     */
+    public void setHibernateConfigurationPath(String hibernateCfgPath) {
+        this.hibernateCfgPath = hibernateCfgPath;
+    }
+
+    /**
+     * Sets Hibernate properties.
+     *
+     * @param hibernateProps Hibernate properties.
+     */
+    public void setHibernateProperties(Properties hibernateProps) {
+        this.hibernateProps = hibernateProps;
+    }
+
+    /**
+     * Initializes store.
+     *
+     * @throws IgniteException If failed to initialize.
+     */
+    private void init() throws IgniteException {
+        if (initGuard.compareAndSet(false, true)) {
+            if (log.isDebugEnabled())
+                log.debug("Initializing cache store.");
+
+            try {
+                if (sesFactory != null)
+                    // Session factory has been provided - nothing to do.
+                    return;
+
+                if (!F.isEmpty(hibernateCfgPath)) {
+                    try {
+                        URL url = new URL(hibernateCfgPath);
+
+                        sesFactory = new Configuration().configure(url).buildSessionFactory();
+
+                        if (log.isDebugEnabled())
+                            log.debug("Configured session factory using URL: " + url);
+
+                        // Session factory has been successfully initialized.
+                        return;
+                    }
+                    catch (MalformedURLException e) {
+                        if (log.isDebugEnabled())
+                            log.debug("Caught malformed URL exception: " + e.getMessage());
+                    }
+
+                    // Provided path is not a valid URL. File?
+                    File cfgFile = new File(hibernateCfgPath);
+
+                    if (cfgFile.exists()) {
+                        sesFactory = new Configuration().configure(cfgFile).buildSessionFactory();
+
+                        if (log.isDebugEnabled())
+                            log.debug("Configured session factory using file: " + hibernateCfgPath);
+
+                        // Session factory has been successfully initialized.
+                        return;
+                    }
+
+                    // Provided path is not a file. Classpath resource?
+                    sesFactory = new Configuration().configure(hibernateCfgPath).buildSessionFactory();
+
+                    if (log.isDebugEnabled())
+                        log.debug("Configured session factory using classpath resource: " + hibernateCfgPath);
+                }
+                else {
+                    if (hibernateProps == null) {
+                        U.warn(log, "No Hibernate configuration has been provided for store (will use default).");
+
+                        hibernateProps = new Properties();
+
+                        hibernateProps.setProperty("hibernate.connection.url", DFLT_CONN_URL);
+                        hibernateProps.setProperty("hibernate.show_sql", DFLT_SHOW_SQL);
+                        hibernateProps.setProperty("hibernate.hbm2ddl.auto", DFLT_HBM2DDL_AUTO);
+                    }
+
+                    Configuration cfg = new Configuration();
+
+                    cfg.setProperties(hibernateProps);
+
+                    assert resourceAvailable(MAPPING_RESOURCE) : MAPPING_RESOURCE;
+
+                    cfg.addResource(MAPPING_RESOURCE);
+
+                    sesFactory = cfg.buildSessionFactory();
+
+                    if (log.isDebugEnabled())
+                        log.debug("Configured session factory using properties: " + hibernateProps);
+                }
+            }
+            catch (HibernateException e) {
+                throw new IgniteException("Failed to initialize store.", e);
+            }
+            finally {
+                initLatch.countDown();
+            }
+        }
+        else if (initLatch.getCount() > 0) {
+            try {
+                U.await(initLatch);
+            }
+            catch (IgniteInterruptedCheckedException e) {
+                throw new IgniteException(e);
+            }
+        }
+
+        if (sesFactory == null)
+            throw new IgniteException("Cache store was not properly initialized.");
+    }
+
+    /**
+     * Checks availability of a classpath resource.
+     *
+     * @param name Resource name.
+     * @return {@code true} if resource is available and ready for read, {@code false} otherwise.
+     */
+    private boolean resourceAvailable(String name) {
+        InputStream cfgStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
+
+        if (cfgStream == null) {
+            log.error("Classpath resource not found: " + name);
+
+            return false;
+        }
+
+        try {
+            // Read a single byte to force actual content access by JVM.
+            cfgStream.read();
+
+            return true;
+        }
+        catch (IOException e) {
+            log.error("Failed to read classpath resource: " + name, e);
+
+            return false;
+        }
+        finally {
+            U.close(cfgStream, log);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(CacheHibernateBlobStore.class, this);
+    }
+
+    /**
+     * Serialize object to byte array using marshaller.
+     *
+     * @param obj Object to convert to byte array.
+     * @return Byte array.
+     * @throws IgniteCheckedException If failed to convert.
+     */
+    protected byte[] toBytes(Object obj) throws IgniteCheckedException {
+        return U.marshal(marsh, obj);
+    }
+
+    /**
+     * Deserialize object from byte array using marshaller.
+     *
+     * @param bytes Bytes to deserialize.
+     * @param <X> Result object type.
+     * @return Deserialized object.
+     * @throws IgniteCheckedException If failed.
+     */
+    protected <X> X fromBytes(byte[] bytes) throws IgniteCheckedException {
+        if (bytes == null || bytes.length == 0)
+            return null;
+
+        return U.unmarshal(marsh, bytes, getClass().getClassLoader());
+    }
+
+    /**
+     * @return Current transaction.
+     */
+    @Nullable private Transaction transaction() {
+        CacheStoreSession ses = session();
+
+        return ses != null ? ses.transaction() : null;
+    }
+
+    /**
+     * @return Store session.
+     */
+    private CacheStoreSession session() {
+        return ses;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml
new file mode 100644
index 0000000..5b0be43
--- /dev/null
+++ b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+
+<!DOCTYPE hibernate-mapping PUBLIC
+        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.apache.ignite.examples.datagrid.store" default-access="field">
+    <class name="org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreEntry" table="ENTRIES">
+        <id name="key"/>
+
+        <property name="val"/>
+    </class>
+</hibernate-mapping>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.java b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.java
new file mode 100644
index 0000000..d40c5ef
--- /dev/null
+++ b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.java
@@ -0,0 +1,89 @@
+/*
+ * 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.cache.store.hibernate;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+/**
+ * Entry that is used by {@link CacheHibernateBlobStore} implementation.
+ * <p>
+ * Note that this is a reference implementation for tests only.
+ * When running on production systems use concrete key-value types to
+ * get better performance.
+ */
+@Entity
+@Table(name = "ENTRIES")
+public class CacheHibernateBlobStoreEntry {
+    /** Key (use concrete key type in production). */
+    @Id
+    @Column(length = 65535)
+    private byte[] key;
+
+    /** Value (use concrete value type in production). */
+    @Column(length = 65535)
+    private byte[] val;
+
+    /**
+     * Constructor.
+     */
+    CacheHibernateBlobStoreEntry() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param key Key.
+     * @param val Value.
+     */
+    CacheHibernateBlobStoreEntry(byte[] key, byte[] val) {
+        this.key = key;
+        this.val = val;
+    }
+
+    /**
+     * @return Key.
+     */
+    public byte[] getKey() {
+        return key;
+    }
+
+    /**
+     * @param key Key.
+     */
+    public void setKey(byte[] key) {
+        this.key = key;
+    }
+
+    /**
+     * @return Value.
+     */
+    public byte[] getValue() {
+        return val;
+    }
+
+    /**
+     * @param val Value.
+     */
+    public void setValue(byte[] val) {
+        this.val = val;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreFactory.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreFactory.java b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreFactory.java
new file mode 100644
index 0000000..ea4df8a
--- /dev/null
+++ b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreFactory.java
@@ -0,0 +1,235 @@
+/*
+ * 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.cache.store.hibernate;
+
+import java.util.Properties;
+import javax.cache.configuration.Factory;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteComponentType;
+import org.apache.ignite.internal.util.spring.IgniteSpringHelper;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.resources.SpringApplicationContextResource;
+import org.hibernate.SessionFactory;
+
+/**
+ * {@link Factory} implementation for {@link CacheHibernateBlobStore}.
+ *
+ * Use this factory to pass {@link CacheHibernateBlobStore} to {@link CacheConfiguration}.
+ *
+ * <h2 class="header">Java Example</h2>
+ * In this example existing session factory is provided.
+ * <pre name="code" class="java">
+ *     ...
+ *     CacheHibernateBlobStoreFactory&lt;String, String&gt; factory = new CacheHibernateBlobStoreFactory&lt;String, String&gt;();
+ *
+ *     factory.setSessionFactory(sesFactory);
+ *     ...
+ * </pre>
+ *
+ * <h2 class="header">Spring Example (using Spring ORM)</h2>
+ * <pre name="code" class="xml">
+ *   ...
+ *   &lt;bean id=&quot;cache.hibernate.store.factory&quot;
+ *       class=&quot;org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory&quot;&gt;
+ *       &lt;property name=&quot;sessionFactory&quot;&gt;
+ *           &lt;bean class=&quot;org.springframework.orm.hibernate3.LocalSessionFactoryBean&quot;&gt;
+ *               &lt;property name=&quot;hibernateProperties&quot;&gt;
+ *                   &lt;value&gt;
+ *                       connection.url=jdbc:h2:mem:
+ *                       show_sql=true
+ *                       hbm2ddl.auto=true
+ *                       hibernate.dialect=org.hibernate.dialect.H2Dialect
+ *                   &lt;/value&gt;
+ *               &lt;/property&gt;
+ *               &lt;property name=&quot;mappingResources&quot;&gt;
+ *                   &lt;list&gt;
+ *                       &lt;value&gt;
+ *                           org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml
+ *                       &lt;/value&gt;
+ *                   &lt;/list&gt;
+ *               &lt;/property&gt;
+ *           &lt;/bean&gt;
+ *       &lt;/property&gt;
+ *   &lt;/bean&gt;
+ *   ...
+ * </pre>
+ *
+ * <h2 class="header">Spring Example (using Spring ORM and persistent annotations)</h2>
+ * <pre name="code" class="xml">
+ *     ...
+ *     &lt;bean id=&quot;cache.hibernate.store.factory1&quot;
+ *         class=&quot;org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory&quot;&gt;
+ *         &lt;property name=&quot;sessionFactory&quot;&gt;
+ *             &lt;bean class=&quot;org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean&quot;&gt;
+ *                 &lt;property name=&quot;hibernateProperties&quot;&gt;
+ *                     &lt;value&gt;
+ *                         connection.url=jdbc:h2:mem:
+ *                         show_sql=true
+ *                         hbm2ddl.auto=true
+ *                         hibernate.dialect=org.hibernate.dialect.H2Dialect
+ *                     &lt;/value&gt;
+ *                 &lt;/property&gt;
+ *                 &lt;property name=&quot;annotatedClasses&quot;&gt;
+ *                     &lt;list&gt;
+ *                         &lt;value&gt;
+ *                             org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreEntry
+ *                         &lt;/value&gt;
+ *                     &lt;/list&gt;
+ *                 &lt;/property&gt;
+ *             &lt;/bean&gt;
+ *         &lt;/property&gt;
+ *     &lt;/bean&gt;
+ *     ...
+ * </pre>
+ *
+ * <h2 class="header">Spring Example</h2>
+ * <pre name="code" class="xml">
+ *     ...
+ *     &lt;bean id=&quot;cache.hibernate.store.factory2&quot;
+ *         class=&quot;org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory&quot;&gt;
+ *         &lt;property name=&quot;hibernateProperties&quot;&gt;
+ *             &lt;props&gt;
+ *                 &lt;prop key=&quot;connection.url&quot;&gt;jdbc:h2:mem:&lt;/prop&gt;
+ *                 &lt;prop key=&quot;hbm2ddl.auto&quot;&gt;update&lt;/prop&gt;
+ *                 &lt;prop key=&quot;show_sql&quot;&gt;true&lt;/prop&gt;
+ *             &lt;/props&gt;
+ *         &lt;/property&gt;
+ *     &lt;/bean&gt;
+ *     ...
+ * </pre>
+ * <p>
+ * <img src="http://ignite.apache.org/images/spring-small.png">
+ * <br>
+ * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
+ */
+public class CacheHibernateBlobStoreFactory<K, V> implements Factory<CacheHibernateBlobStore<K, V>> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Session factory. */
+    @GridToStringExclude
+    private transient SessionFactory sesFactory;
+
+    /** Session factory bean name. */
+    private String sesFactoryBean;
+
+    /** Path to hibernate configuration file. */
+    private String hibernateCfgPath;
+
+    /** Hibernate properties. */
+    @GridToStringExclude
+    private Properties hibernateProps;
+
+    /** Application context. */
+    @SpringApplicationContextResource
+    private Object appContext;
+
+    /** {@inheritDoc} */
+    @Override public CacheHibernateBlobStore<K, V> create() {
+        CacheHibernateBlobStore<K, V> store = new CacheHibernateBlobStore<>();
+
+        store.setHibernateConfigurationPath(hibernateCfgPath);
+        store.setHibernateProperties(hibernateProps);
+
+        if (sesFactory != null)
+            store.setSessionFactory(sesFactory);
+        else if (sesFactoryBean != null) {
+            if (appContext == null)
+                throw new IgniteException("Spring application context resource is not injected.");
+
+            IgniteSpringHelper spring;
+
+            try {
+                spring = IgniteComponentType.SPRING.create(false);
+
+                SessionFactory sesFac = spring.loadBeanFromAppContext(appContext, sesFactoryBean);
+
+                store.setSessionFactory(sesFac);
+            }
+            catch (IgniteCheckedException e) {
+                throw new IgniteException("Failed to load bean in application context [beanName=" + sesFactoryBean +
+                        ", igniteConfig=" + appContext + ']');
+            }
+        }
+
+        return store;
+    }
+
+    /**
+     * Sets session factory.
+     *
+     * @param sesFactory Session factory.
+     * @return {@code This} for chaining.
+     * @see CacheHibernateBlobStore#setSessionFactory(SessionFactory)
+     */
+    public CacheHibernateBlobStoreFactory<K, V> setSessionFactory(SessionFactory sesFactory) {
+        this.sesFactory = sesFactory;
+
+        return this;
+    }
+
+    /**
+     * Sets name of the data source bean.
+     *
+     * @param sesFactory Session factory bean name.
+     * @return {@code This} for chaining.
+     * @see CacheHibernateBlobStore#setSessionFactory(SessionFactory)
+     */
+    public CacheHibernateBlobStoreFactory<K, V> setSessionFactoryBean(String sesFactory) {
+        this.sesFactoryBean = sesFactory;
+
+        return this;
+    }
+
+    /**
+     * Sets hibernate configuration path.
+     * <p>
+     * This may be either URL or file path or classpath resource.
+     *
+     * @param hibernateCfgPath URL or file path or classpath resource
+     *      pointing to hibernate configuration XML file.
+     * @return {@code This} for chaining.
+     * @see CacheHibernateBlobStore#setHibernateConfigurationPath(String)
+     */
+    public CacheHibernateBlobStoreFactory<K, V> setHibernateConfigurationPath(String hibernateCfgPath) {
+        this.hibernateCfgPath = hibernateCfgPath;
+
+        return this;
+    }
+
+    /**
+     * Sets Hibernate properties.
+     *
+     * @param hibernateProps Hibernate properties.
+     * @return {@code This} for chaining.
+     * @see CacheHibernateBlobStore#setHibernateProperties(Properties)
+     */
+    public CacheHibernateBlobStoreFactory<K, V> setHibernateProperties(Properties hibernateProps) {
+        this.hibernateProps = hibernateProps;
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(CacheHibernateBlobStoreFactory.class, this);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListener.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListener.java b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListener.java
new file mode 100644
index 0000000..8db9568
--- /dev/null
+++ b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListener.java
@@ -0,0 +1,224 @@
+/*
+ * 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.cache.store.hibernate;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import javax.cache.integration.CacheWriterException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.cache.store.CacheStoreSession;
+import org.apache.ignite.cache.store.CacheStoreSessionListener;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lifecycle.LifecycleAware;
+import org.apache.ignite.resources.LoggerResource;
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.resource.transaction.spi.TransactionStatus;
+
+/**
+ * Hibernate-based cache store session listener.
+ * <p>
+ * This listener creates a new Hibernate session for each store
+ * session. If there is an ongoing cache transaction, a corresponding
+ * Hibernate transaction is created as well.
+ * <p>
+ * The Hibernate session is saved as a store session
+ * {@link CacheStoreSession#attachment() attachment}.
+ * The listener guarantees that the session will be
+ * available for any store operation. If there is an
+ * ongoing cache transaction, all operations within this
+ * transaction will share a DB transaction.
+ * <p>
+ * As an example, here is how the {@link CacheStore#write(javax.cache.Cache.Entry)}
+ * method can be implemented if {@link CacheHibernateStoreSessionListener}
+ * is configured:
+ * <pre name="code" class="java">
+ * private static class Store extends CacheStoreAdapter&lt;Integer, Integer&gt; {
+ *     &#64;CacheStoreSessionResource
+ *     private CacheStoreSession ses;
+ *
+ *     &#64;Override public void write(Cache.Entry&lt;? extends Integer, ? extends Integer&gt; entry) throws CacheWriterException {
+ *         // Get Hibernate session from the current store session.
+ *         Session hibSes = ses.attachment();
+ *
+ *         // Persist the value.
+ *         hibSes.persist(entry.getValue());
+ *     }
+ * }
+ * </pre>
+ * Hibernate session will be automatically created by the listener
+ * at the start of the session and closed when it ends.
+ * <p>
+ * {@link CacheHibernateStoreSessionListener} requires that either
+ * {@link #setSessionFactory(SessionFactory)} session factory}
+ * or {@link #setHibernateConfigurationPath(String) Hibernate configuration file}
+ * is provided. If non of them is set, exception is thrown. Is both are provided,
+ * session factory will be used.
+ */
+public class CacheHibernateStoreSessionListener implements CacheStoreSessionListener, LifecycleAware {
+    /** Hibernate session factory. */
+    private SessionFactory sesFactory;
+
+    /** Hibernate configuration file path. */
+    private String hibernateCfgPath;
+
+    /** Logger. */
+    @LoggerResource
+    private IgniteLogger log;
+
+    /** Whether to close session on stop. */
+    private boolean closeSesOnStop;
+
+    /**
+     * Sets Hibernate session factory.
+     * <p>
+     * Either session factory or configuration file is required.
+     * If none is provided, exception will be thrown on startup.
+     *
+     * @param sesFactory Session factory.
+     */
+    public void setSessionFactory(SessionFactory sesFactory) {
+        this.sesFactory = sesFactory;
+    }
+
+    /**
+     * Gets Hibernate session factory.
+     *
+     * @return Session factory.
+     */
+    public SessionFactory getSessionFactory() {
+        return sesFactory;
+    }
+
+    /**
+     * Sets hibernate configuration path.
+     * <p>
+     * Either session factory or configuration file is required.
+     * If none is provided, exception will be thrown on startup.
+     *
+     * @param hibernateCfgPath Hibernate configuration path.
+     */
+    public void setHibernateConfigurationPath(String hibernateCfgPath) {
+        this.hibernateCfgPath = hibernateCfgPath;
+    }
+
+    /**
+     * Gets hibernate configuration path.
+     *
+     * @return Hibernate configuration path.
+     */
+    public String getHibernateConfigurationPath() {
+        return hibernateCfgPath;
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("deprecation")
+    @Override public void start() throws IgniteException {
+        if (sesFactory == null && F.isEmpty(hibernateCfgPath))
+            throw new IgniteException("Either session factory or Hibernate configuration file is required by " +
+                getClass().getSimpleName() + '.');
+
+        if (!F.isEmpty(hibernateCfgPath)) {
+            if (sesFactory == null) {
+                try {
+                    URL url = new URL(hibernateCfgPath);
+
+                    sesFactory = new Configuration().configure(url).buildSessionFactory();
+                }
+                catch (MalformedURLException ignored) {
+                    // No-op.
+                }
+
+                if (sesFactory == null) {
+                    File cfgFile = new File(hibernateCfgPath);
+
+                    if (cfgFile.exists())
+                        sesFactory = new Configuration().configure(cfgFile).buildSessionFactory();
+                }
+
+                if (sesFactory == null)
+                    sesFactory = new Configuration().configure(hibernateCfgPath).buildSessionFactory();
+
+                if (sesFactory == null)
+                    throw new IgniteException("Failed to resolve Hibernate configuration file: " + hibernateCfgPath);
+
+                closeSesOnStop = true;
+            }
+            else
+                U.warn(log, "Hibernate configuration file configured in " + getClass().getSimpleName() +
+                    " will be ignored (session factory is already set).");
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop() throws IgniteException {
+        if (closeSesOnStop && sesFactory != null && !sesFactory.isClosed())
+            sesFactory.close();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onSessionStart(CacheStoreSession ses) {
+        if (ses.attachment() == null) {
+            try {
+                Session hibSes = sesFactory.openSession();
+
+                ses.attach(hibSes);
+
+                if (ses.isWithinTransaction())
+                    hibSes.beginTransaction();
+            }
+            catch (HibernateException e) {
+                throw new CacheWriterException("Failed to start store session [tx=" + ses.transaction() + ']', e);
+            }
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onSessionEnd(CacheStoreSession ses, boolean commit) {
+        Session hibSes = ses.attach(null);
+
+        if (hibSes != null) {
+            try {
+                Transaction tx = hibSes.getTransaction();
+
+                if (commit) {
+                    if (hibSes.isDirty())
+                        hibSes.flush();
+
+                    if (tx.getStatus() == TransactionStatus.ACTIVE)
+                        tx.commit();
+                }
+                else if (tx.getStatus().canRollback())
+                    tx.rollback();
+            }
+            catch (HibernateException e) {
+                throw new CacheWriterException("Failed to end store session [tx=" + ses.transaction() + ']', e);
+            }
+            finally {
+                hibSes.close();
+            }
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/package-info.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/package-info.java b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/package-info.java
new file mode 100644
index 0000000..891d99a
--- /dev/null
+++ b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/store/hibernate/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains reference Hibernate-based cache store implementation.
+ */
+package org.apache.ignite.cache.store.hibernate;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/test/config/factory-cache.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/test/config/factory-cache.xml b/modules/hibernate-5.1/src/test/config/factory-cache.xml
new file mode 100644
index 0000000..a251846
--- /dev/null
+++ b/modules/hibernate-5.1/src/test/config/factory-cache.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean id="simpleSessionFactory"
+          class="org.apache.ignite.cache.store.hibernate.CacheHibernateStoreFactorySelfTest$DummySessionFactoryExt"/>
+
+    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+        <property name="cacheConfiguration">
+            <list>
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="test"/>
+                    <property name="atomicityMode" value="ATOMIC"/>
+                    <property name="backups" value="1"/>
+                    <property name="cacheStoreFactory">
+                        <bean class="org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory">
+                            <property name="sessionFactoryBean" value = "simpleSessionFactory"/>
+                        </bean>
+                    </property>
+                </bean>
+            </list>
+        </property>
+
+        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <value>127.0.0.1:47500..47509</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/test/config/factory-cache1.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/test/config/factory-cache1.xml b/modules/hibernate-5.1/src/test/config/factory-cache1.xml
new file mode 100644
index 0000000..7a53b1f
--- /dev/null
+++ b/modules/hibernate-5.1/src/test/config/factory-cache1.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean id="simpleSessionFactory1"
+          class="org.apache.ignite.cache.store.hibernate.CacheHibernateStoreFactorySelfTest$DummySessionFactory"/>
+
+    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+        <property name="igniteInstanceName" value="ignite1"/>
+
+        <property name="cacheConfiguration">
+            <list>
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="test"/>
+                    <property name="atomicityMode" value="ATOMIC"/>
+                    <property name="backups" value="1"/>
+                    <property name="cacheStoreFactory">
+                        <bean class="org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory">
+                            <property name="sessionFactoryBean" value = "simpleSessionFactory1"/>
+                        </bean>
+                    </property>
+                </bean>
+            </list>
+        </property>
+
+        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <value>127.0.0.1:47500..47509</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/test/config/factory-incorrect-store-cache.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/test/config/factory-incorrect-store-cache.xml b/modules/hibernate-5.1/src/test/config/factory-incorrect-store-cache.xml
new file mode 100644
index 0000000..459930c
--- /dev/null
+++ b/modules/hibernate-5.1/src/test/config/factory-incorrect-store-cache.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+        <property name="cacheConfiguration">
+            <list>
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="test"/>
+                    <property name="atomicityMode" value="ATOMIC"/>
+                    <property name="backups" value="1"/>
+                    <property name="cacheStoreFactory">
+                        <bean class="org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory">
+                            <property name="sessionFactoryBean" value = "simpleSessionFactory1"/>
+                        </bean>
+                    </property>
+                </bean>
+            </list>
+        </property>
+
+        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <value>127.0.0.1:47500..47509</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java
new file mode 100644
index 0000000..0363c41
--- /dev/null
+++ b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java
@@ -0,0 +1,407 @@
+/*
+ * 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.cache.hibernate;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import javax.cache.Cache;
+import javax.persistence.Cacheable;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
+import org.hibernate.cache.spi.access.AccessType;
+import org.hibernate.cfg.Configuration;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.hibernate.HibernateAccessStrategyFactory.DFLT_CACHE_NAME_PROPERTY;
+import static org.apache.ignite.cache.hibernate.HibernateAccessStrategyFactory.REGION_CACHE_PROPERTY;
+import static org.hibernate.cfg.AvailableSettings.CACHE_REGION_FACTORY;
+import static org.hibernate.cfg.AvailableSettings.GENERATE_STATISTICS;
+import static org.hibernate.cfg.AvailableSettings.HBM2DDL_AUTO;
+import static org.hibernate.cfg.AvailableSettings.RELEASE_CONNECTIONS;
+import static org.hibernate.cfg.AvailableSettings.USE_QUERY_CACHE;
+import static org.hibernate.cfg.AvailableSettings.USE_SECOND_LEVEL_CACHE;
+
+/**
+ * Tests Hibernate L2 cache configuration.
+ */
+public class HibernateL2CacheConfigurationSelfTest extends GridCommonAbstractTest {
+    /** */
+    public static final String ENTITY1_NAME = Entity1.class.getName();
+
+    /** */
+    public static final String ENTITY2_NAME = Entity2.class.getName();
+
+    /** */
+    public static final String ENTITY3_NAME = Entity3.class.getName();
+
+    /** */
+    public static final String ENTITY4_NAME = Entity4.class.getName();
+
+    /** */
+    public static final String TIMESTAMP_CACHE = "org.hibernate.cache.spi.UpdateTimestampsCache";
+
+    /** */
+    public static final String QUERY_CACHE = "org.hibernate.cache.internal.StandardQueryCache";
+
+    /** */
+    public static final String CONNECTION_URL = "jdbc:h2:mem:example;DB_CLOSE_DELAY=-1";
+
+    /** If {@code true} then sets default cache in configuration. */
+    private boolean dfltCache;
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGrid(0);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        for (IgniteCacheProxy<?, ?> cache : ((IgniteKernal)grid(0)).caches())
+            cache.clear();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+        discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
+
+        cfg.setDiscoverySpi(discoSpi);
+
+        cfg.setCacheConfiguration(cacheConfiguration(ENTITY3_NAME), cacheConfiguration(ENTITY4_NAME),
+            cacheConfiguration("cache1"), cacheConfiguration("cache2"), cacheConfiguration("cache3"),
+            cacheConfiguration(TIMESTAMP_CACHE), cacheConfiguration(QUERY_CACHE));
+
+        return cfg;
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @return Cache configuration.
+     */
+    private CacheConfiguration cacheConfiguration(String cacheName) {
+        CacheConfiguration cfg = new CacheConfiguration();
+
+        cfg.setName(cacheName);
+
+        cfg.setCacheMode(PARTITIONED);
+
+        cfg.setAtomicityMode(ATOMIC);
+
+        return cfg;
+    }
+    /**
+     * @param igniteInstanceName Ignite instance name.
+     * @return Hibernate configuration.
+     */
+    protected Configuration hibernateConfiguration(String igniteInstanceName) {
+        Configuration cfg = new Configuration();
+
+        cfg.addAnnotatedClass(Entity1.class);
+        cfg.addAnnotatedClass(Entity2.class);
+        cfg.addAnnotatedClass(Entity3.class);
+        cfg.addAnnotatedClass(Entity4.class);
+
+        cfg.setProperty(HibernateAccessStrategyFactory.DFLT_ACCESS_TYPE_PROPERTY, AccessType.NONSTRICT_READ_WRITE.name());
+
+        cfg.setProperty(HBM2DDL_AUTO, "create");
+
+        cfg.setProperty(GENERATE_STATISTICS, "true");
+
+        cfg.setProperty(USE_SECOND_LEVEL_CACHE, "true");
+
+        cfg.setProperty(USE_QUERY_CACHE, "true");
+
+        cfg.setProperty(CACHE_REGION_FACTORY, HibernateRegionFactory.class.getName());
+
+        cfg.setProperty(RELEASE_CONNECTIONS, "on_close");
+
+        cfg.setProperty(HibernateAccessStrategyFactory.IGNITE_INSTANCE_NAME_PROPERTY, igniteInstanceName);
+
+        cfg.setProperty(REGION_CACHE_PROPERTY + ENTITY1_NAME, "cache1");
+        cfg.setProperty(REGION_CACHE_PROPERTY + ENTITY2_NAME, "cache2");
+        cfg.setProperty(REGION_CACHE_PROPERTY + TIMESTAMP_CACHE, TIMESTAMP_CACHE);
+        cfg.setProperty(REGION_CACHE_PROPERTY + QUERY_CACHE, QUERY_CACHE);
+
+        if (dfltCache)
+            cfg.setProperty(DFLT_CACHE_NAME_PROPERTY, "cache3");
+
+        return cfg;
+    }
+
+    /**
+     * Tests property {@link HibernateAccessStrategyFactory#REGION_CACHE_PROPERTY}.
+     */
+    public void testPerRegionCacheProperty() {
+        testCacheUsage(1, 1, 0, 1, 1);
+    }
+
+    /**
+     * Tests property {@link HibernateAccessStrategyFactory#DFLT_CACHE_NAME_PROPERTY}.
+     */
+    public void testDefaultCache() {
+        dfltCache = true;
+
+        testCacheUsage(1, 1, 2, 0, 0);
+    }
+
+    /**
+     * @param expCache1 Expected size of cache with name 'cache1'.
+     * @param expCache2 Expected size of cache with name 'cache2'.
+     * @param expCache3 Expected size of cache with name 'cache3'.
+     * @param expCacheE3 Expected size of cache with name {@link #ENTITY3_NAME}.
+     * @param expCacheE4 Expected size of cache with name {@link #ENTITY4_NAME}.
+     */
+    @SuppressWarnings("unchecked")
+    private void testCacheUsage(int expCache1, int expCache2, int expCache3, int expCacheE3, int expCacheE4) {
+        SessionFactory sesFactory = startHibernate(getTestIgniteInstanceName(0));
+
+        try {
+            Session ses = sesFactory.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                ses.save(new Entity1());
+                ses.save(new Entity2());
+                ses.save(new Entity3());
+                ses.save(new Entity4());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            ses = sesFactory.openSession();
+
+            try {
+                List<Entity1> list1 = ses.createCriteria(ENTITY1_NAME).list();
+
+                assertEquals(1, list1.size());
+
+                for (Entity1 e : list1) {
+                    ses.load(ENTITY1_NAME, e.getId());
+                    assertNotNull(e.getId());
+                }
+
+                List<Entity2> list2 = ses.createCriteria(ENTITY2_NAME).list();
+
+                assertEquals(1, list2.size());
+
+                for (Entity2 e : list2)
+                    assertNotNull(e.getId());
+
+                List<Entity3> list3 = ses.createCriteria(ENTITY3_NAME).list();
+
+                assertEquals(1, list3.size());
+
+                for (Entity3 e : list3)
+                    assertNotNull(e.getId());
+
+                List<Entity4> list4 = ses.createCriteria(ENTITY4_NAME).list();
+
+                assertEquals(1, list4.size());
+
+                for (Entity4 e : list4)
+                    assertNotNull(e.getId());
+            }
+            finally {
+                ses.close();
+            }
+
+            IgniteCache<Object, Object> cache1 = grid(0).cache("cache1");
+            IgniteCache<Object, Object> cache2 = grid(0).cache("cache2");
+            IgniteCache<Object, Object> cache3 = grid(0).cache("cache3");
+            IgniteCache<Object, Object> cacheE3 = grid(0).cache(ENTITY3_NAME);
+            IgniteCache<Object, Object> cacheE4 = grid(0).cache(ENTITY4_NAME);
+
+            assertEquals("Unexpected entries: " + toSet(cache1.iterator()), expCache1, cache1.size());
+            assertEquals("Unexpected entries: " + toSet(cache2.iterator()), expCache2, cache2.size());
+            assertEquals("Unexpected entries: " + toSet(cache3.iterator()), expCache3, cache3.size());
+            assertEquals("Unexpected entries: " + toSet(cacheE3.iterator()), expCacheE3, cacheE3.size());
+            assertEquals("Unexpected entries: " + toSet(cacheE4.iterator()), expCacheE4, cacheE4.size());
+        }
+        finally {
+            sesFactory.close();
+        }
+    }
+
+    /**
+     *
+     */
+    private <K, V> Set<Cache.Entry<K, V>> toSet(Iterator<Cache.Entry<K, V>> iter){
+        Set<Cache.Entry<K, V>> set = new HashSet<>();
+
+        while (iter.hasNext())
+            set.add(iter.next());
+
+        return set;
+    }
+
+    /**
+     * @param igniteInstanceName Name of the grid providing caches.
+     * @return Session factory.
+     */
+    private SessionFactory startHibernate(String igniteInstanceName) {
+        Configuration cfg = hibernateConfiguration(igniteInstanceName);
+
+        StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
+
+        builder.applySetting("hibernate.connection.url", CONNECTION_URL);
+        builder.applySetting("hibernate.show_sql", false);
+        builder.applySettings(cfg.getProperties());
+
+        return cfg.buildSessionFactory(builder.build());
+    }
+
+    /**
+     * Test Hibernate entity1.
+     */
+    @javax.persistence.Entity
+    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
+    @Cacheable
+    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+    public static class Entity1 {
+        /** */
+        private int id;
+
+        /**
+         * @return ID.
+         */
+        @Id
+        @GeneratedValue
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+    }
+
+    /**
+     * Test Hibernate entity2.
+     */
+    @javax.persistence.Entity
+    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
+    @Cacheable
+    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+    public static class Entity2 {
+        /** */
+        private int id;
+
+        /**
+         * @return ID.
+         */
+        @Id
+        @GeneratedValue
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+    }
+
+    /**
+     * Test Hibernate entity3.
+     */
+    @javax.persistence.Entity
+    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
+    @Cacheable
+    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+    public static class Entity3 {
+        /** */
+        private int id;
+
+        /**
+         * @return ID.
+         */
+        @Id
+        @GeneratedValue
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+    }
+
+    /**
+     * Test Hibernate entity4.
+     */
+    @javax.persistence.Entity
+    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
+    @Cacheable
+    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+    public static class Entity4 {
+        /** */
+        private int id;
+
+        /**
+         * @return ID.
+         */
+        @Id
+        @GeneratedValue
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheMultiJvmTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheMultiJvmTest.java b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheMultiJvmTest.java
new file mode 100644
index 0000000..57a3f71
--- /dev/null
+++ b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheMultiJvmTest.java
@@ -0,0 +1,429 @@
+/*
+ * 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.cache.hibernate;
+
+import java.util.Map;
+import javax.persistence.Cacheable;
+import javax.persistence.Id;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCompute;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.lang.IgniteRunnable;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.resources.LoggerResource;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+import org.hibernate.boot.MetadataSources;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
+
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+import static org.apache.ignite.cache.hibernate.HibernateAccessStrategyFactory.DFLT_CACHE_NAME_PROPERTY;
+import static org.apache.ignite.cache.hibernate.HibernateL2CacheSelfTest.CONNECTION_URL;
+import static org.apache.ignite.cache.hibernate.HibernateL2CacheSelfTest.hibernateProperties;
+import static org.hibernate.cache.spi.access.AccessType.NONSTRICT_READ_WRITE;
+
+/**
+ *
+ */
+public class HibernateL2CacheMultiJvmTest extends GridCommonAbstractTest {
+    /** */
+    private static final String CACHE_NAME = "hibernateCache";
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        if (!getTestIgniteInstanceName(0).equals(igniteInstanceName))
+            cfg.setClientMode(true);
+
+        CacheConfiguration ccfg = new CacheConfiguration();
+
+        ccfg.setName(CACHE_NAME);
+        ccfg.setWriteSynchronizationMode(FULL_SYNC);
+
+        cfg.setCacheConfiguration(ccfg);
+
+        cfg.setMarshaller(new BinaryMarshaller());
+
+        cfg.setPeerClassLoadingEnabled(false);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean isMultiJvm() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
+        startGrid(0);
+
+        startGrid(1);
+        startGrid(2);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+
+        super.afterTestsStopped();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testL2Cache() throws Exception {
+        Ignite srv = ignite(0);
+
+        {
+            IgniteCompute client1Compute =
+                srv.compute(srv.cluster().forNodeId(ignite(1).cluster().localNode().id()));
+
+            client1Compute.run(new HibernateInsertRunnable());
+        }
+
+        {
+            IgniteCompute client2Compute =
+                srv.compute(srv.cluster().forNodeId(ignite(2).cluster().localNode().id()));
+
+            client2Compute.run(new HibernateLoadRunnable());
+        }
+
+        {
+            IgniteCompute srvCompute = srv.compute(srv.cluster().forLocal());
+
+            srvCompute.run(new HibernateLoadRunnable());
+        }
+    }
+
+    /**
+     *
+     */
+    private static class HibernateInsertRunnable extends HibernateBaseRunnable {
+        /** {@inheritDoc} */
+        @Override public void run() {
+            SessionFactory sesFactory = startHibernate(ignite.name());
+
+            Session ses = sesFactory.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                for (int i = 0; i < 1; i++) {
+                    {
+                        Entity1 e = new Entity1();
+                        e.setId(i);
+                        e.setName("name-" + i);
+
+                        ses.save(e);
+                    }
+
+                    {
+                        Entity2 e = new Entity2();
+                        e.setId(String.valueOf(i));
+                        e.setName("name-" + i);
+
+                        ses.save(e);
+                    }
+
+                    {
+                        Entity3 e = new Entity3();
+                        e.setId(i);
+                        e.setName("name-" + i);
+
+                        ses.save(e);
+                    }
+                }
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+        }
+    }
+
+    /**
+     *
+     */
+    private static class HibernateLoadRunnable extends HibernateBaseRunnable {
+        /** {@inheritDoc} */
+        @Override public void run() {
+            SessionFactory sesFactory = startHibernate(ignite.name());
+
+            Session ses = sesFactory.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                for (int i = 0; i < 1; i++) {
+                    {
+                        Entity1 e = (Entity1)ses.load(Entity1.class, i);
+
+                        log.info("Found: " + e.getName());
+                    }
+                    {
+                        Entity2 e = (Entity2)ses.load(Entity2.class, String.valueOf(i));
+
+                        log.info("Found: " + e.getName());
+                    }
+                    {
+                        Entity3 e = (Entity3)ses.load(Entity3.class, (double)i);
+
+                        log.info("Found: " + e.getName());
+                    }
+                }
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+        }
+    }
+
+    /**
+     *
+     */
+    private abstract static class HibernateBaseRunnable implements IgniteRunnable {
+        /** */
+        @IgniteInstanceResource
+        protected Ignite ignite;
+
+        /** */
+        @LoggerResource
+        IgniteLogger log;
+
+        /**
+         * @param nodeName Name of the grid providing caches.
+         * @return Session factory.
+         */
+        SessionFactory startHibernate(String nodeName) {
+            log.info("Start hibernate on node: " + nodeName);
+
+            StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
+
+            for (Map.Entry<String, String> e : hibernateProperties(nodeName, NONSTRICT_READ_WRITE.name()).entrySet())
+                builder.applySetting(e.getKey(), e.getValue());
+
+            builder.applySetting("hibernate.connection.url", CONNECTION_URL);
+            builder.applySetting(DFLT_CACHE_NAME_PROPERTY, CACHE_NAME);
+
+            MetadataSources metadataSources = new MetadataSources(builder.build());
+
+            metadataSources.addAnnotatedClass(Entity1.class);
+            metadataSources.addAnnotatedClass(Entity2.class);
+            metadataSources.addAnnotatedClass(Entity3.class);
+
+            return metadataSources.buildMetadata().buildSessionFactory();
+        }
+    }
+
+    /**
+     * Test Hibernate entity1.
+     */
+    @javax.persistence.Entity
+    @Cacheable
+    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+    public static class Entity1 {
+        /** */
+        @Id
+        private int id;
+
+        /** */
+        private String name;
+
+        /**
+         * @return ID.
+         */
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+
+        /**
+         * @return Name.
+         */
+        public String getName() {
+            return name;
+        }
+
+        /**
+         * @param name Name.
+         */
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (this == o)
+                return true;
+
+            if (o == null || getClass() != o.getClass())
+                return false;
+
+            Entity1 entity1 = (Entity1)o;
+
+            return id == entity1.id;
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            return id;
+        }
+    }
+
+    /**
+     * Test Hibernate entity1.
+     */
+    @javax.persistence.Entity
+    @Cacheable
+    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+    public static class Entity2 {
+        /** */
+        @Id
+        private String id;
+
+        /** */
+        private String name;
+
+        /**
+         * @return ID.
+         */
+        public String getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(String id) {
+            this.id = id;
+        }
+
+        /**
+         * @return Name.
+         */
+        public String getName() {
+            return name;
+        }
+
+        /**
+         * @param name Name.
+         */
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (this == o)
+                return true;
+
+            if (o == null || getClass() != o.getClass())
+                return false;
+
+            Entity2 entity2 = (Entity2)o;
+
+            return id.equals(entity2.id);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            return id.hashCode();
+        }
+    }
+
+    /**
+     * Test Hibernate entity1.
+     */
+    @javax.persistence.Entity
+    @Cacheable
+    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+    public static class Entity3 {
+        /** */
+        @Id
+        private double id;
+
+        /** */
+        private String name;
+
+        /**
+         * @return ID.
+         */
+        public double getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(double id) {
+            this.id = id;
+        }
+
+        /**
+         * @return Name.
+         */
+        public String getName() {
+            return name;
+        }
+
+        /**
+         * @param name Name.
+         */
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (this == o)
+                return true;
+
+            if (o == null || getClass() != o.getClass())
+                return false;
+
+            Entity3 entity3 = (Entity3)o;
+
+            return Double.compare(entity3.id, id) == 0;
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            long temp = Double.doubleToLongBits(id);
+            return (int)(temp ^ (temp >>> 32));
+        }
+    }
+}


[11/51] [abbrv] ignite git commit: ignite-1794 Refactored hibernate modules, switched to hibernate 5.1

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java
new file mode 100644
index 0000000..f227af1
--- /dev/null
+++ b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java
@@ -0,0 +1,1960 @@
+/*
+ * 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.cache.hibernate;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
+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.hibernate.ObjectNotFoundException;
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.StaleStateException;
+import org.hibernate.Transaction;
+import org.hibernate.annotations.NaturalId;
+import org.hibernate.annotations.NaturalIdCache;
+import org.hibernate.boot.Metadata;
+import org.hibernate.boot.MetadataSources;
+import org.hibernate.boot.registry.StandardServiceRegistry;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
+import org.hibernate.cache.spi.GeneralDataRegion;
+import org.hibernate.cache.spi.TransactionalDataRegion;
+import org.hibernate.cache.spi.access.AccessType;
+import org.hibernate.cfg.Environment;
+import org.hibernate.exception.ConstraintViolationException;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.RootClass;
+import org.hibernate.stat.NaturalIdCacheStatistics;
+import org.hibernate.stat.SecondLevelCacheStatistics;
+
+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.CacheWriteSynchronizationMode.FULL_SYNC;
+import static org.apache.ignite.cache.hibernate.HibernateAccessStrategyFactory.DFLT_ACCESS_TYPE_PROPERTY;
+import static org.apache.ignite.cache.hibernate.HibernateAccessStrategyFactory.IGNITE_INSTANCE_NAME_PROPERTY;
+import static org.apache.ignite.cache.hibernate.HibernateAccessStrategyFactory.REGION_CACHE_PROPERTY;
+import static org.hibernate.cache.spi.access.AccessType.NONSTRICT_READ_WRITE;
+import static org.hibernate.cfg.Environment.CACHE_REGION_FACTORY;
+import static org.hibernate.cfg.Environment.GENERATE_STATISTICS;
+import static org.hibernate.cfg.Environment.HBM2DDL_AUTO;
+import static org.hibernate.cfg.Environment.RELEASE_CONNECTIONS;
+import static org.hibernate.cfg.Environment.USE_QUERY_CACHE;
+import static org.hibernate.cfg.Environment.USE_SECOND_LEVEL_CACHE;
+
+/**
+ *
+ * Tests Hibernate L2 cache.
+ */
+public class HibernateL2CacheSelfTest extends GridCommonAbstractTest {
+    /** */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    public static final String CONNECTION_URL = "jdbc:h2:mem:example;DB_CLOSE_DELAY=-1";
+
+    /** */
+    public static final String ENTITY_NAME = Entity.class.getName();
+
+    /** */
+    public static final String ENTITY2_NAME = Entity2.class.getName();
+
+    /** */
+    public static final String VERSIONED_ENTITY_NAME = VersionedEntity.class.getName();
+
+    /** */
+    public static final String CHILD_ENTITY_NAME = ChildEntity.class.getName();
+
+    /** */
+    public static final String PARENT_ENTITY_NAME = ParentEntity.class.getName();
+
+    /** */
+    public static final String CHILD_COLLECTION_REGION = ENTITY_NAME + ".children";
+
+    /** */
+    public static final String NATURAL_ID_REGION =
+        "org.apache.ignite.cache.hibernate.HibernateL2CacheSelfTest$Entity##NaturalId";
+
+    /** */
+    public static final String NATURAL_ID_REGION2 =
+        "org.apache.ignite.cache.hibernate.HibernateL2CacheSelfTest$Entity2##NaturalId";
+
+    /** */
+    private SessionFactory sesFactory1;
+
+    /** */
+    private SessionFactory sesFactory2;
+
+    /**
+     * First Hibernate test entity.
+     */
+    @javax.persistence.Entity
+    @NaturalIdCache
+    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
+    public static class Entity {
+        /** */
+        private int id;
+
+        /** */
+        private String name;
+
+        /** */
+        private Collection<ChildEntity> children;
+
+        /**
+         * Default constructor required by Hibernate.
+         */
+        public Entity() {
+            // No-op.
+        }
+
+        /**
+         * @param id ID.
+         * @param name Name.
+         */
+        public Entity(int id, String name) {
+            this.id = id;
+            this.name = name;
+        }
+
+        /**
+         * @return ID.
+         */
+        @Id
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+
+        /**
+         * @return Name.
+         */
+        @NaturalId(mutable = true)
+        public String getName() {
+            return name;
+        }
+
+        /**
+         * @param name Name.
+         */
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        /**
+         * @return Children.
+         */
+        @OneToMany(cascade=javax.persistence.CascadeType.ALL, fetch=FetchType.LAZY)
+        @JoinColumn(name="ENTITY_ID")
+        public Collection<ChildEntity> getChildren() {
+            return children;
+        }
+
+        /**
+         * @param children Children.
+         */
+        public void setChildren(Collection<ChildEntity> children) {
+            this.children = children;
+        }
+    }
+
+    /**
+     * Second Hibernate test entity.
+     */
+    @javax.persistence.Entity
+    @NaturalIdCache
+    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
+    public static class Entity2 {
+        /** */
+        private int id;
+
+        /** */
+        private String name;
+
+        /** */
+        private Collection<ChildEntity> children;
+
+        /**
+         * Default constructor required by Hibernate.
+         */
+        public Entity2() {
+            // No-op.
+        }
+
+        /**
+         * @param id ID.
+         * @param name Name.
+         */
+        public Entity2(int id, String name) {
+            this.id = id;
+            this.name = name;
+        }
+
+        /**
+         * @return ID.
+         */
+        @Id
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+
+        /**
+         * @return Name.
+         */
+        @NaturalId(mutable = true)
+        public String getName() {
+            return name;
+        }
+
+        /**
+         * @param name Name.
+         */
+        public void setName(String name) {
+            this.name = name;
+        }
+    }
+
+    /**
+     * Hibernate child entity referenced by {@link Entity}.
+     */
+    @javax.persistence.Entity
+    @SuppressWarnings("PublicInnerClass")
+    public static class ChildEntity {
+        /** */
+        private int id;
+
+        /**
+         * Default constructor required by Hibernate.
+         */
+        public ChildEntity() {
+            // No-op.
+        }
+
+        /**
+         * @param id ID.
+         */
+        public ChildEntity(int id) {
+            this.id = id;
+        }
+
+        /**
+         * @return ID.
+         */
+        @Id
+        @GeneratedValue
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+    }
+
+    /**
+     * Hibernate entity referencing {@link Entity}.
+     */
+    @javax.persistence.Entity
+    @SuppressWarnings("PublicInnerClass")
+    public static class ParentEntity {
+        /** */
+        private int id;
+
+        /** */
+        private Entity entity;
+
+        /**
+         * Default constructor required by Hibernate.
+         */
+        public ParentEntity() {
+            // No-op.
+        }
+
+        /**
+         * @param id ID.
+         * @param entity Referenced entity.
+         */
+        public ParentEntity(int id, Entity entity) {
+            this.id = id;
+            this.entity = entity;
+        }
+
+        /**
+         * @return ID.
+         */
+        @Id
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+
+        /**
+         * @return Referenced entity.
+         */
+        @OneToOne
+        public Entity getEntity() {
+            return entity;
+        }
+
+        /**
+         * @param entity Referenced entity.
+         */
+        public void setEntity(Entity entity) {
+            this.entity = entity;
+        }
+    }
+
+    /**
+     * Hibernate entity.
+     */
+    @javax.persistence.Entity
+    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
+    public static class VersionedEntity {
+        /** */
+        private int id;
+
+        /** */
+        private long ver;
+
+        /**
+         * Default constructor required by Hibernate.
+         */
+        public VersionedEntity() {
+        }
+
+        /**
+         * @param id ID.
+         */
+        public VersionedEntity(int id) {
+            this.id = id;
+        }
+
+        /**
+         * @return ID.
+         */
+        @Id
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+
+        /**
+         * @return Version.
+         */
+        @javax.persistence.Version
+        public long getVersion() {
+            return ver;
+        }
+
+        /**
+         * @param ver Version.
+         */
+        public void setVersion(long ver) {
+            this.ver = ver;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+        discoSpi.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(discoSpi);
+
+        cfg.setCacheConfiguration(generalRegionConfiguration("org.hibernate.cache.spi.UpdateTimestampsCache"),
+            generalRegionConfiguration("org.hibernate.cache.internal.StandardQueryCache"),
+            transactionalRegionConfiguration(ENTITY_NAME),
+            transactionalRegionConfiguration(ENTITY2_NAME),
+            transactionalRegionConfiguration(VERSIONED_ENTITY_NAME),
+            transactionalRegionConfiguration(PARENT_ENTITY_NAME),
+            transactionalRegionConfiguration(CHILD_ENTITY_NAME),
+            transactionalRegionConfiguration(CHILD_COLLECTION_REGION),
+            transactionalRegionConfiguration(NATURAL_ID_REGION),
+            transactionalRegionConfiguration(NATURAL_ID_REGION2));
+
+        return cfg;
+    }
+
+    /**
+     * @param regionName Region name.
+     * @return Cache configuration for {@link GeneralDataRegion}.
+     */
+    private CacheConfiguration generalRegionConfiguration(String regionName) {
+        CacheConfiguration cfg = new CacheConfiguration();
+
+        cfg.setName(regionName);
+
+        cfg.setCacheMode(PARTITIONED);
+
+        cfg.setAtomicityMode(ATOMIC);
+
+        cfg.setWriteSynchronizationMode(FULL_SYNC);
+
+        cfg.setBackups(1);
+
+        cfg.setAffinity(new RendezvousAffinityFunction(false, 10));
+
+        return cfg;
+    }
+
+    /**
+     * @param regionName Region name.
+     * @return Cache configuration for {@link TransactionalDataRegion}.
+     */
+    protected CacheConfiguration transactionalRegionConfiguration(String regionName) {
+        CacheConfiguration cfg = new CacheConfiguration();
+
+        cfg.setName(regionName);
+
+        cfg.setCacheMode(PARTITIONED);
+
+        cfg.setAtomicityMode(TRANSACTIONAL);
+
+        cfg.setWriteSynchronizationMode(FULL_SYNC);
+
+        cfg.setBackups(1);
+
+        cfg.setAffinity(new RendezvousAffinityFunction(false, 10));
+
+        return cfg;
+    }
+
+    /**
+     * @return Hibernate registry builder.
+     */
+    protected StandardServiceRegistryBuilder registryBuilder() {
+        StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
+
+        builder.applySetting("hibernate.connection.url", CONNECTION_URL);
+
+        return builder;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGrids(2);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        cleanup();
+    }
+
+    /**
+     * @return Hibernate L2 cache access types to test.
+     */
+    protected AccessType[] accessTypes() {
+        return new AccessType[]{AccessType.READ_ONLY, AccessType.NONSTRICT_READ_WRITE, AccessType.READ_WRITE};
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCollectionCache() throws Exception {
+        for (AccessType accessType : accessTypes())
+            testCollectionCache(accessType);
+    }
+
+    /**
+     * @param accessType Cache access type.
+     * @throws Exception If failed.
+     */
+    @SuppressWarnings("unchecked")
+    private void testCollectionCache(AccessType accessType) throws Exception {
+        createSessionFactories(accessType);
+
+        Map<Integer, Integer> idToChildCnt = new HashMap<>();
+
+        try {
+            Session ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                for (int i = 0; i < 3; i++) {
+                    Entity e = new Entity(i, "name-" + i);
+
+                    Collection<ChildEntity> children = new ArrayList<>();
+
+                    for (int j = 0; j < 3; j++)
+                        children.add(new ChildEntity());
+
+                    e.setChildren(children);
+
+                    idToChildCnt.put(e.getId(), e.getChildren().size());
+
+                    ses.save(e);
+                }
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            // Load children, this should populate cache.
+
+            ses = sesFactory1.openSession();
+
+            try {
+                List<Entity> list = ses.createCriteria(ENTITY_NAME).list();
+
+                assertEquals(idToChildCnt.size(), list.size());
+
+                for (Entity e : list)
+                    assertEquals((int)idToChildCnt.get(e.getId()), e.getChildren().size());
+            }
+            finally {
+                ses.close();
+            }
+
+            assertCollectionCache(sesFactory2, idToChildCnt, 3, 0);
+            assertCollectionCache(sesFactory1, idToChildCnt, 3, 0);
+
+            if (accessType == AccessType.READ_ONLY)
+                return;
+
+            // Update children for one entity.
+
+            ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                Entity e1 = (Entity)ses.load(Entity.class, 1);
+
+                e1.getChildren().remove(e1.getChildren().iterator().next());
+
+                ses.update(e1);
+
+                idToChildCnt.put(e1.getId(), e1.getChildren().size());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertCollectionCache(sesFactory2, idToChildCnt, 2, 1); // After update collection cache entry is removed.
+            assertCollectionCache(sesFactory1, idToChildCnt, 3, 0); // 'assertCollectionCache' loads children in cache.
+
+            // Update children for the same entity using another SessionFactory.
+
+            ses = sesFactory2.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                Entity e1 = (Entity)ses.load(Entity.class, 1);
+
+                e1.getChildren().remove(e1.getChildren().iterator().next());
+
+                ses.update(e1);
+
+                idToChildCnt.put(e1.getId(), e1.getChildren().size());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertCollectionCache(sesFactory2, idToChildCnt, 2, 1); // After update collection cache entry is removed.
+            assertCollectionCache(sesFactory1, idToChildCnt, 3, 0); // 'assertCollectionCache' loads children in cache.
+        }
+        finally {
+            cleanup();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testEntityCache() throws Exception {
+        for (AccessType accessType : accessTypes())
+            testEntityCache(accessType);
+    }
+
+    /**
+     * @param accessType Cache access type.
+     * @throws Exception If failed.
+     */
+    private void testEntityCache(AccessType accessType) throws Exception {
+        createSessionFactories(accessType);
+
+        Map<Integer, String> idToName = new HashMap<>();
+
+        try {
+            Session ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                for (int i = 0; i < 2; i++) {
+                    String name = "name-" + i;
+
+                    ses.save(new Entity(i, name));
+
+                    idToName.put(i, name);
+                }
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 100);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 100);
+
+            if (accessType == AccessType.READ_ONLY)
+                return;
+
+            ses = sesFactory1.openSession();
+
+            try {
+                // Updates and inserts in single transaction.
+
+                Transaction tx = ses.beginTransaction();
+
+                Entity e0 = (Entity)ses.load(Entity.class, 0);
+
+                e0.setName("name-0-changed1");
+
+                ses.update(e0);
+
+                idToName.put(0, e0.getName());
+
+                ses.save(new Entity(2, "name-2"));
+
+                idToName.put(2, "name-2");
+
+                Entity e1 = (Entity)ses.load(Entity.class, 1);
+
+                e1.setName("name-1-changed1");
+
+                ses.update(e1);
+
+                idToName.put(1, e1.getName());
+
+                ses.save(new Entity(3, "name-3"));
+
+                idToName.put(3, "name-3");
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName);
+
+            ses = sesFactory1.openSession();
+
+            try {
+                // Updates, inserts and deletes in single transaction.
+
+                Transaction tx = ses.beginTransaction();
+
+                ses.save(new Entity(4, "name-4"));
+
+                idToName.put(4, "name-4");
+
+                Entity e0 = (Entity)ses.load(Entity.class, 0);
+
+                e0.setName("name-0-changed2");
+
+                ses.update(e0);
+
+                idToName.put(e0.getId(), e0.getName());
+
+                ses.delete(ses.load(Entity.class, 1));
+
+                idToName.remove(1);
+
+                Entity e2 = (Entity)ses.load(Entity.class, 2);
+
+                e2.setName("name-2-changed1");
+
+                ses.update(e2);
+
+                idToName.put(e2.getId(), e2.getName());
+
+                ses.delete(ses.load(Entity.class, 3));
+
+                idToName.remove(3);
+
+                ses.save(new Entity(5, "name-5"));
+
+                idToName.put(5, "name-5");
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 1, 3);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 1, 3);
+
+            // Try to update the same entity using another SessionFactory.
+
+            ses = sesFactory2.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                Entity e0 = (Entity)ses.load(Entity.class, 0);
+
+                e0.setName("name-0-changed3");
+
+                ses.update(e0);
+
+                idToName.put(e0.getId(), e0.getName());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName);
+        }
+        finally {
+            cleanup();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTwoEntitiesSameCache() throws Exception {
+        for (AccessType accessType : accessTypes())
+            testTwoEntitiesSameCache(accessType);
+    }
+
+    /**
+     * @param accessType Cache access type.
+     * @throws Exception If failed.
+     */
+    private void testTwoEntitiesSameCache(AccessType accessType) throws Exception {
+        createSessionFactories(accessType);
+
+        try {
+            Session ses = sesFactory1.openSession();
+
+            Map<Integer, String> idToName1 = new HashMap<>();
+            Map<Integer, String> idToName2 = new HashMap<>();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                for (int i = 0; i < 2; i++) {
+                    String name = "name-" + i;
+
+                    ses.save(new Entity(i, name));
+                    ses.save(new Entity2(i, name));
+
+                    idToName1.put(i, name);
+                    idToName2.put(i, name);
+                }
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 100);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 100);
+
+            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 100);
+            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 100);
+
+            if (accessType == AccessType.READ_ONLY)
+                return;
+
+            ses = sesFactory1.openSession();
+
+            try {
+                // Updates both entities in single transaction.
+
+                Transaction tx = ses.beginTransaction();
+
+                Entity e = (Entity)ses.load(Entity.class, 0);
+
+                e.setName("name-0-changed1");
+
+                ses.update(e);
+
+                Entity2 e2 = (Entity2)ses.load(Entity2.class, 0);
+
+                e2.setName("name-e2-0-changed1");
+
+                ses.update(e2);
+
+                idToName1.put(0, e.getName());
+                idToName2.put(0, e2.getName());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 100);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 100);
+
+            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 100);
+            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 100);
+
+            ses = sesFactory1.openSession();
+
+            try {
+                // Remove entity1 and insert entity2 in single transaction.
+
+                Transaction tx = ses.beginTransaction();
+
+                Entity e = (Entity)ses.load(Entity.class, 0);
+
+                ses.delete(e);
+
+                Entity2 e2 = new Entity2(2, "name-2");
+
+                ses.save(e2);
+
+                idToName1.remove(0);
+                idToName2.put(2, e2.getName());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 0, 100);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 0, 100);
+
+            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 100);
+            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 100);
+
+            ses = sesFactory1.openSession();
+
+            Transaction tx = ses.beginTransaction();
+
+            try {
+                // Update, remove, insert in single transaction, transaction fails.
+
+                Entity e = (Entity)ses.load(Entity.class, 1);
+
+                e.setName("name-1-changed1");
+
+                ses.update(e); // Valid update.
+
+                ses.save(new Entity(2, "name-2")); // Valid insert.
+
+                ses.delete(ses.load(Entity2.class, 0)); // Valid delete.
+
+                Entity2 e2 = (Entity2)ses.load(Entity2.class, 1);
+
+                e2.setName("name-2");  // Invalid update, not-unique name.
+
+                ses.update(e2);
+
+                tx.commit();
+
+                fail("Commit must fail.");
+            }
+            catch (ConstraintViolationException e) {
+                log.info("Expected exception: " + e);
+
+                tx.rollback();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 0, 2, 100);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 0, 2, 100);
+
+            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 100);
+            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 100);
+
+            ses = sesFactory2.openSession();
+
+            try {
+                // Update, remove, insert in single transaction.
+
+                tx = ses.beginTransaction();
+
+                Entity e = (Entity)ses.load(Entity.class, 1);
+
+                e.setName("name-1-changed1");
+
+                ses.update(e);
+
+                idToName1.put(1, e.getName());
+
+                ses.save(new Entity(2, "name-2"));
+
+                idToName1.put(2, "name-2");
+
+                ses.delete(ses.load(Entity2.class, 0));
+
+                idToName2.remove(0);
+
+                Entity2 e2 = (Entity2)ses.load(Entity2.class, 1);
+
+                e2.setName("name-e2-2-changed");
+
+                ses.update(e2);
+
+                idToName2.put(1, e2.getName());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 0, 100);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 0, 100);
+
+            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 0, 100);
+            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 0, 100);
+        }
+        finally {
+            cleanup();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testVersionedEntity() throws Exception {
+        for (AccessType accessType : accessTypes())
+            testVersionedEntity(accessType);
+    }
+
+    /**
+     * @param accessType Cache access type.
+     * @throws Exception If failed.
+     */
+    private void testVersionedEntity(AccessType accessType) throws Exception {
+        createSessionFactories(accessType);
+
+        try {
+            Session ses = sesFactory1.openSession();
+
+            VersionedEntity e0 = new VersionedEntity(0);
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                ses.save(e0);
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            ses = sesFactory1.openSession();
+
+            long ver;
+
+            try {
+                ver = ((VersionedEntity)ses.load(VersionedEntity.class, 0)).getVersion();
+            }
+            finally {
+                ses.close();
+            }
+
+            SecondLevelCacheStatistics stats1 =
+                sesFactory1.getStatistics().getSecondLevelCacheStatistics(VERSIONED_ENTITY_NAME);
+            SecondLevelCacheStatistics stats2 =
+                sesFactory2.getStatistics().getSecondLevelCacheStatistics(VERSIONED_ENTITY_NAME);
+
+            assertEquals(1, stats1.getElementCountInMemory());
+            assertEquals(1, stats2.getElementCountInMemory());
+
+            ses = sesFactory2.openSession();
+
+            try {
+                assertEquals(ver, ((VersionedEntity)ses.load(VersionedEntity.class, 0)).getVersion());
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEquals(1, stats2.getElementCountInMemory());
+            assertEquals(1, stats2.getHitCount());
+
+            if (accessType == AccessType.READ_ONLY)
+                return;
+
+            e0.setVersion(ver - 1);
+
+            ses = sesFactory1.openSession();
+
+            Transaction tx = ses.beginTransaction();
+
+            try {
+                ses.update(e0);
+
+                tx.commit();
+
+                fail("Commit must fail.");
+            }
+            catch (StaleStateException e) {
+                log.info("Expected exception: " + e);
+            }
+            finally {
+                tx.rollback();
+
+                ses.close();
+            }
+
+            sesFactory1.getStatistics().clear();
+
+            stats1 = sesFactory1.getStatistics().getSecondLevelCacheStatistics(VERSIONED_ENTITY_NAME);
+
+            ses = sesFactory1.openSession();
+
+            try {
+                assertEquals(ver, ((VersionedEntity)ses.load(VersionedEntity.class, 0)).getVersion());
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEquals(1, stats1.getElementCountInMemory());
+            assertEquals(1, stats1.getHitCount());
+            assertEquals(1, stats2.getElementCountInMemory());
+            assertEquals(1, stats2.getHitCount());
+        }
+        finally {
+            cleanup();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNaturalIdCache() throws Exception {
+        for (AccessType accessType : accessTypes())
+            testNaturalIdCache(accessType);
+    }
+
+    /**
+     * @param accessType Cache access type.
+     * @throws Exception If failed.
+     */
+    private void testNaturalIdCache(AccessType accessType) throws Exception {
+        createSessionFactories(accessType);
+
+        Map<String, Integer> nameToId = new HashMap<>();
+
+        try {
+            Session ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                for (int i = 0; i < 3; i++) {
+                    String name = "name-" + i;
+
+                    ses.save(new Entity(i, name));
+
+                    nameToId.put(name, i);
+                }
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            ses = sesFactory1.openSession();
+
+            try {
+                for (Map.Entry<String, Integer> e : nameToId.entrySet())
+                    ((Entity)ses.bySimpleNaturalId(Entity.class).load(e.getKey())).getId();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertNaturalIdCache(sesFactory2, nameToId, "name-100");
+            assertNaturalIdCache(sesFactory1, nameToId, "name-100");
+
+            if (accessType == AccessType.READ_ONLY)
+                return;
+
+            // Update naturalId.
+
+            ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                Entity e1 = (Entity)ses.load(Entity.class, 1);
+
+                nameToId.remove(e1.getName());
+
+                e1.setName("name-1-changed1");
+
+                nameToId.put(e1.getName(), e1.getId());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertNaturalIdCache(sesFactory2, nameToId, "name-1");
+            assertNaturalIdCache(sesFactory1, nameToId, "name-1");
+
+            // Update entity using another SessionFactory.
+
+            ses = sesFactory2.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                Entity e1 = (Entity)ses.load(Entity.class, 1);
+
+                nameToId.remove(e1.getName());
+
+                e1.setName("name-1-changed2");
+
+                nameToId.put(e1.getName(), e1.getId());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertNaturalIdCache(sesFactory2, nameToId, "name-1-changed1");
+            assertNaturalIdCache(sesFactory1, nameToId, "name-1-changed1");
+
+            // Try invalid NaturalId update.
+
+            ses = sesFactory1.openSession();
+
+            Transaction tx = ses.beginTransaction();
+
+            try {
+                Entity e1 = (Entity)ses.load(Entity.class, 1);
+
+                e1.setName("name-0"); // Invalid update (duplicated name).
+
+                tx.commit();
+
+                fail("Commit must fail.");
+            }
+            catch (ConstraintViolationException e) {
+                log.info("Expected exception: " + e);
+
+                tx.rollback();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertNaturalIdCache(sesFactory2, nameToId);
+            assertNaturalIdCache(sesFactory1, nameToId);
+
+            // Delete entity.
+
+            ses = sesFactory2.openSession();
+
+            try {
+                tx = ses.beginTransaction();
+
+                Entity e2 = (Entity)ses.load(Entity.class, 2);
+
+                ses.delete(e2);
+
+                nameToId.remove(e2.getName());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertNaturalIdCache(sesFactory2, nameToId, "name-2");
+            assertNaturalIdCache(sesFactory1, nameToId, "name-2");
+        }
+        finally {
+            cleanup();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testEntityCacheTransactionFails() throws Exception {
+        for (AccessType accessType : accessTypes())
+            testEntityCacheTransactionFails(accessType);
+    }
+
+    /**
+     * @param accessType Cache access type.
+     * @throws Exception If failed.
+     */
+    private void testEntityCacheTransactionFails(AccessType accessType) throws Exception {
+        createSessionFactories(accessType);
+
+        Map<Integer, String> idToName = new HashMap<>();
+
+        try {
+            Session ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                for (int i = 0; i < 3; i++) {
+                    String name = "name-" + i;
+
+                    ses.save(new Entity(i, name));
+
+                    idToName.put(i, name);
+                }
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 100);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 100);
+
+            ses = sesFactory1.openSession();
+
+            Transaction tx = ses.beginTransaction();
+
+            try {
+                ses.save(new Entity(3, "name-3")); // Valid insert.
+
+                ses.save(new Entity(0, "name-0")); // Invalid insert (duplicated ID).
+
+                tx.commit();
+
+                fail("Commit must fail.");
+            }
+            catch (ConstraintViolationException e) {
+                log.info("Expected exception: " + e);
+
+                tx.rollback();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 3);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 3);
+
+            if (accessType == AccessType.READ_ONLY)
+                return;
+
+            ses = sesFactory1.openSession();
+
+            tx = ses.beginTransaction();
+
+            try {
+                Entity e0 = (Entity)ses.load(Entity.class, 0);
+                Entity e1 = (Entity)ses.load(Entity.class, 1);
+
+                e0.setName("name-10"); // Valid update.
+                e1.setName("name-2"); // Invalid update (violates unique constraint).
+
+                ses.update(e0);
+                ses.update(e1);
+
+                tx.commit();
+
+                fail("Commit must fail.");
+            }
+            catch (ConstraintViolationException e) {
+                log.info("Expected exception: " + e);
+
+                tx.rollback();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName);
+
+            ses = sesFactory1.openSession();
+
+            try {
+                // Create parent entity referencing Entity with ID = 0.
+
+                tx = ses.beginTransaction();
+
+                ses.save(new ParentEntity(0, (Entity) ses.load(Entity.class, 0)));
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            ses = sesFactory1.openSession();
+
+            tx = ses.beginTransaction();
+
+            try {
+                ses.save(new Entity(3, "name-3")); // Valid insert.
+
+                Entity e1 = (Entity)ses.load(Entity.class, 1);
+
+                e1.setName("name-10"); // Valid update.
+
+                ses.delete(ses.load(Entity.class, 0)); // Invalid delete (there is a parent entity referencing it).
+
+                tx.commit();
+
+                fail("Commit must fail.");
+            }
+            catch (ConstraintViolationException e) {
+                log.info("Expected exception: " + e);
+
+                tx.rollback();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 3);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 3);
+
+            ses = sesFactory1.openSession();
+
+            tx = ses.beginTransaction();
+
+            try {
+                ses.delete(ses.load(Entity.class, 1)); // Valid delete.
+
+                idToName.remove(1);
+
+                ses.delete(ses.load(Entity.class, 0)); // Invalid delete (there is a parent entity referencing it).
+
+                tx.commit();
+
+                fail("Commit must fail.");
+            }
+            catch (ConstraintViolationException e) {
+                log.info("Expected exception: " + e);
+
+                tx.rollback();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName);
+        }
+        finally {
+            cleanup();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testQueryCache() throws Exception {
+        for (AccessType accessType : accessTypes())
+            testQueryCache(accessType);
+    }
+
+    /**
+     * @param accessType Cache access type.
+     * @throws Exception If failed.
+     */
+    private void testQueryCache(AccessType accessType) throws Exception {
+        createSessionFactories(accessType);
+
+        try {
+            Session ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                for (int i = 0; i < 5; i++)
+                    ses.save(new Entity(i, "name-" + i));
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            // Run some queries.
+
+            ses = sesFactory1.openSession();
+
+            try {
+                Query qry1 = ses.createQuery("from " + ENTITY_NAME + " where id > 2");
+
+                qry1.setCacheable(true);
+
+                assertEquals(2, qry1.list().size());
+
+                Query qry2 = ses.createQuery("from " + ENTITY_NAME + " where name = 'name-0'");
+
+                qry2.setCacheable(true);
+
+                assertEquals(1, qry2.list().size());
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEquals(0, sesFactory1.getStatistics().getQueryCacheHitCount());
+            assertEquals(2, sesFactory1.getStatistics().getQueryCacheMissCount());
+            assertEquals(2, sesFactory1.getStatistics().getQueryCachePutCount());
+
+            // Run queries using another SessionFactory.
+
+            ses = sesFactory2.openSession();
+
+            try {
+                Query qry1 = ses.createQuery("from " + ENTITY_NAME + " where id > 2");
+
+                qry1.setCacheable(true);
+
+                assertEquals(2, qry1.list().size());
+
+                Query qry2 = ses.createQuery("from " + ENTITY_NAME + " where name = 'name-0'");
+
+                qry2.setCacheable(true);
+
+                assertEquals(1, qry2.list().size());
+
+                Query qry3 = ses.createQuery("from " + ENTITY_NAME + " where id > 1");
+
+                qry3.setCacheable(true);
+
+                assertEquals(3, qry3.list().size());
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEquals(2, sesFactory2.getStatistics().getQueryCacheHitCount());
+            assertEquals(1, sesFactory2.getStatistics().getQueryCacheMissCount());
+            assertEquals(1, sesFactory2.getStatistics().getQueryCachePutCount());
+
+            // Update entity, it should invalidate query cache.
+
+            ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                ses.save(new Entity(5, "name-5"));
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            // Run queries.
+
+            ses = sesFactory1.openSession();
+
+            sesFactory1.getStatistics().clear();
+
+            try {
+                Query qry1 = ses.createQuery("from " + ENTITY_NAME + " where id > 2");
+
+                qry1.setCacheable(true);
+
+                assertEquals(3, qry1.list().size());
+
+                Query qry2 = ses.createQuery("from " + ENTITY_NAME + " where name = 'name-0'");
+
+                qry2.setCacheable(true);
+
+                assertEquals(1, qry2.list().size());
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEquals(0, sesFactory1.getStatistics().getQueryCacheHitCount());
+            assertEquals(2, sesFactory1.getStatistics().getQueryCacheMissCount());
+            assertEquals(2, sesFactory1.getStatistics().getQueryCachePutCount());
+
+            // Clear query cache using another SessionFactory.
+
+            sesFactory2.getCache().evictDefaultQueryRegion();
+
+            ses = sesFactory1.openSession();
+
+            // Run queries again.
+
+            sesFactory1.getStatistics().clear();
+
+            try {
+                Query qry1 = ses.createQuery("from " + ENTITY_NAME + " where id > 2");
+
+                qry1.setCacheable(true);
+
+                assertEquals(3, qry1.list().size());
+
+                Query qry2 = ses.createQuery("from " + ENTITY_NAME + " where name = 'name-0'");
+
+                qry2.setCacheable(true);
+
+                assertEquals(1, qry2.list().size());
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEquals(0, sesFactory1.getStatistics().getQueryCacheHitCount());
+            assertEquals(2, sesFactory1.getStatistics().getQueryCacheMissCount());
+            assertEquals(2, sesFactory1.getStatistics().getQueryCachePutCount());
+        }
+        finally {
+            cleanup();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testRegionClear() throws Exception {
+        for (AccessType accessType : accessTypes())
+            testRegionClear(accessType);
+    }
+
+    /**
+     * @param accessType Cache access type.
+     * @throws Exception If failed.
+     */
+    private void testRegionClear(AccessType accessType) throws Exception {
+        createSessionFactories(accessType);
+
+        try {
+            final int ENTITY_CNT = 100;
+
+            Session ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                for (int i = 0; i < ENTITY_CNT; i++) {
+                    Entity e = new Entity(i, "name-" + i);
+
+                    Collection<ChildEntity> children = new ArrayList<>();
+
+                    for (int j = 0; j < 3; j++)
+                        children.add(new ChildEntity());
+
+                    e.setChildren(children);
+
+                    ses.save(e);
+                }
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            loadEntities(sesFactory2, ENTITY_CNT);
+
+            SecondLevelCacheStatistics stats1 = sesFactory1.getStatistics().getSecondLevelCacheStatistics(ENTITY_NAME);
+            SecondLevelCacheStatistics stats2 = sesFactory2.getStatistics().getSecondLevelCacheStatistics(ENTITY_NAME);
+
+            NaturalIdCacheStatistics idStats1 =
+                sesFactory1.getStatistics().getNaturalIdCacheStatistics(NATURAL_ID_REGION);
+            NaturalIdCacheStatistics idStats2 =
+                sesFactory2.getStatistics().getNaturalIdCacheStatistics(NATURAL_ID_REGION);
+
+            SecondLevelCacheStatistics colStats1 =
+                sesFactory1.getStatistics().getSecondLevelCacheStatistics(CHILD_COLLECTION_REGION);
+            SecondLevelCacheStatistics colStats2 =
+                sesFactory2.getStatistics().getSecondLevelCacheStatistics(CHILD_COLLECTION_REGION);
+
+            assertEquals(ENTITY_CNT, stats1.getElementCountInMemory());
+            assertEquals(ENTITY_CNT, stats2.getElementCountInMemory());
+
+            assertEquals(ENTITY_CNT, idStats1.getElementCountInMemory());
+            assertEquals(ENTITY_CNT, idStats2.getElementCountInMemory());
+
+            assertEquals(ENTITY_CNT, colStats1.getElementCountInMemory());
+            assertEquals(ENTITY_CNT, colStats2.getElementCountInMemory());
+
+            // Test cache is cleared after update query.
+
+            ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                ses.createQuery("delete from " + ENTITY_NAME + " where name='no such name'").executeUpdate();
+
+                ses.createQuery("delete from " + ChildEntity.class.getName() + " where id=-1").executeUpdate();
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEquals(0, stats1.getElementCountInMemory());
+            assertEquals(0, stats2.getElementCountInMemory());
+
+            assertEquals(0, idStats1.getElementCountInMemory());
+            assertEquals(0, idStats2.getElementCountInMemory());
+
+            assertEquals(0, colStats1.getElementCountInMemory());
+            assertEquals(0, colStats2.getElementCountInMemory());
+
+            // Load some data in cache.
+
+            loadEntities(sesFactory1, 10);
+
+            assertEquals(10, stats1.getElementCountInMemory());
+            assertEquals(10, stats2.getElementCountInMemory());
+            assertEquals(10, idStats1.getElementCountInMemory());
+            assertEquals(10, idStats2.getElementCountInMemory());
+
+            // Test evictAll method.
+
+            sesFactory2.getCache().evictEntityRegion(ENTITY_NAME);
+
+            assertEquals(0, stats1.getElementCountInMemory());
+            assertEquals(0, stats2.getElementCountInMemory());
+
+            sesFactory2.getCache().evictNaturalIdRegion(ENTITY_NAME);
+
+            assertEquals(0, idStats1.getElementCountInMemory());
+            assertEquals(0, idStats2.getElementCountInMemory());
+
+            sesFactory2.getCache().evictCollectionRegion(CHILD_COLLECTION_REGION);
+
+            assertEquals(0, colStats1.getElementCountInMemory());
+            assertEquals(0, colStats2.getElementCountInMemory());
+        }
+        finally {
+            cleanup();
+        }
+    }
+
+    /**
+     * @param sesFactory Session factory.
+     * @param nameToId Name-ID mapping.
+     * @param absentNames Absent entities' names.
+     */
+    private void assertNaturalIdCache(SessionFactory sesFactory, Map<String, Integer> nameToId, String... absentNames) {
+        sesFactory.getStatistics().clear();
+
+        NaturalIdCacheStatistics stats =
+            sesFactory.getStatistics().getNaturalIdCacheStatistics(NATURAL_ID_REGION);
+
+        long hitBefore = stats.getHitCount();
+
+        long missBefore = stats.getMissCount();
+
+        final Session ses = sesFactory.openSession();
+
+        try {
+            for (Map.Entry<String, Integer> e : nameToId.entrySet())
+                assertEquals((int)e.getValue(), ((Entity)ses.bySimpleNaturalId(Entity.class).load(e.getKey())).getId());
+
+            for (String name : absentNames)
+                assertNull((ses.bySimpleNaturalId(Entity.class).load(name)));
+
+            assertEquals(nameToId.size() + hitBefore, stats.getHitCount());
+
+            assertEquals(absentNames.length + missBefore, stats.getMissCount());
+        }
+        finally {
+            ses.close();
+        }
+    }
+
+    /**
+     * @param sesFactory Session factory.
+     * @param idToChildCnt Number of children per entity.
+     * @param expHit Expected cache hits.
+     * @param expMiss Expected cache misses.
+     */
+    @SuppressWarnings("unchecked")
+    private void assertCollectionCache(SessionFactory sesFactory, Map<Integer, Integer> idToChildCnt, int expHit,
+        int expMiss) {
+        sesFactory.getStatistics().clear();
+
+        Session ses = sesFactory.openSession();
+
+        try {
+            for(Map.Entry<Integer, Integer> e : idToChildCnt.entrySet()) {
+                Entity entity = (Entity)ses.load(Entity.class, e.getKey());
+
+                assertEquals((int)e.getValue(), entity.getChildren().size());
+            }
+        }
+        finally {
+            ses.close();
+        }
+
+        SecondLevelCacheStatistics stats =
+            sesFactory.getStatistics().getSecondLevelCacheStatistics(CHILD_COLLECTION_REGION);
+
+        assertEquals(expHit, stats.getHitCount());
+
+        assertEquals(expMiss, stats.getMissCount());
+    }
+
+    /**
+     * @param sesFactory Session factory.
+     * @param cnt Number of entities to load.
+     */
+    private void loadEntities(SessionFactory sesFactory, int cnt) {
+        Session ses = sesFactory.openSession();
+
+        try {
+            for (int i = 0; i < cnt; i++) {
+                Entity e = (Entity)ses.load(Entity.class, i);
+
+                assertEquals("name-" + i, e.getName());
+
+                assertFalse(e.getChildren().isEmpty());
+
+                ses.bySimpleNaturalId(Entity.class).load(e.getName());
+            }
+        }
+        finally {
+            ses.close();
+        }
+    }
+
+    /**
+     * @param entityName Entity name.
+     * @param sesFactory Session factory.
+     * @param idToName ID to name mapping.
+     * @param absentIds Absent entities' IDs.
+     */
+    private void assertEntityCache(String entityName, SessionFactory sesFactory, Map<Integer, String> idToName,
+        Integer... absentIds) {
+        assert entityName.equals(ENTITY_NAME) || entityName.equals(ENTITY2_NAME) : entityName;
+
+        sesFactory.getStatistics().clear();
+
+        final Session ses = sesFactory.openSession();
+
+        final boolean entity1 = entityName.equals(ENTITY_NAME);
+
+        try {
+            if (entity1) {
+                for (Map.Entry<Integer, String> e : idToName.entrySet())
+                    assertEquals(e.getValue(), ((Entity)ses.load(Entity.class, e.getKey())).getName());
+            }
+            else {
+                for (Map.Entry<Integer, String> e : idToName.entrySet())
+                    assertEquals(e.getValue(), ((Entity2)ses.load(Entity2.class, e.getKey())).getName());
+            }
+
+            for (final int id : absentIds) {
+                GridTestUtils.assertThrows(log, new Callable<Void>() {
+                    @Override public Void call() throws Exception {
+                        if (entity1)
+                            ((Entity)ses.load(Entity.class, id)).getName();
+                        else
+                            ((Entity2)ses.load(Entity2.class, id)).getName();
+
+                        return null;
+                    }
+                }, ObjectNotFoundException.class, null);
+            }
+
+            SecondLevelCacheStatistics stats = sesFactory.getStatistics().getSecondLevelCacheStatistics(entityName);
+
+            assertEquals(idToName.size(), stats.getHitCount());
+
+            assertEquals(absentIds.length, stats.getMissCount());
+        }
+        finally {
+            ses.close();
+        }
+    }
+
+    /**
+     * Creates session factories.
+     *
+     * @param accessType Cache access type.
+     */
+    private void createSessionFactories(AccessType accessType) {
+        sesFactory1 = startHibernate(accessType, getTestIgniteInstanceName(0));
+
+        sesFactory2 = startHibernate(accessType, getTestIgniteInstanceName(1));
+    }
+
+    /**
+     * Starts Hibernate.
+     *
+     * @param accessType Cache access type.
+     * @param igniteInstanceName Ignite instance name.
+     * @return Session factory.
+     */
+    private SessionFactory startHibernate(org.hibernate.cache.spi.access.AccessType accessType, String igniteInstanceName) {
+        StandardServiceRegistryBuilder builder = registryBuilder();
+
+        for (Map.Entry<String, String> e : hibernateProperties(igniteInstanceName, accessType.name()).entrySet())
+            builder.applySetting(e.getKey(), e.getValue());
+
+        // Use the same cache for Entity and Entity2.
+        builder.applySetting(REGION_CACHE_PROPERTY + ENTITY2_NAME, ENTITY_NAME);
+
+        StandardServiceRegistry srvcRegistry = builder.build();
+
+        MetadataSources metadataSources = new MetadataSources(srvcRegistry);
+
+        for (Class entityClass : getAnnotatedClasses())
+            metadataSources.addAnnotatedClass(entityClass);
+
+        Metadata metadata = metadataSources.buildMetadata();
+
+        for (PersistentClass entityBinding : metadata.getEntityBindings()) {
+            if (!entityBinding.isInherited())
+                ((RootClass)entityBinding).setCacheConcurrencyStrategy(accessType.getExternalName());
+        }
+
+        for (org.hibernate.mapping.Collection collectionBinding : metadata.getCollectionBindings())
+            collectionBinding.setCacheConcurrencyStrategy( accessType.getExternalName() );
+
+        return metadata.buildSessionFactory();
+    }
+
+    /**
+     * @return Entities classes.
+     */
+    private Class[] getAnnotatedClasses() {
+        return new Class[]{Entity.class, Entity2.class, VersionedEntity.class, ChildEntity.class, ParentEntity.class};
+    }
+
+    /**
+     * Closes session factories and clears data from caches.
+     *
+     * @throws Exception If failed.
+     */
+    private void cleanup() throws Exception {
+        if (sesFactory1 != null)
+            sesFactory1.close();
+
+        sesFactory1 = null;
+
+        if (sesFactory2 != null)
+            sesFactory2.close();
+
+        sesFactory2 = null;
+
+        for (IgniteCacheProxy<?, ?> cache : ((IgniteKernal)grid(0)).caches())
+            cache.clear();
+    }
+
+    /**
+     * @param igniteInstanceName Node name.
+     * @param dfltAccessType Default cache access type.
+     * @return Properties map.
+     */
+    static Map<String, String> hibernateProperties(String igniteInstanceName, String dfltAccessType) {
+        Map<String, String> map = new HashMap<>();
+
+        map.put(HBM2DDL_AUTO, "create");
+        map.put(GENERATE_STATISTICS, "true");
+        map.put(USE_SECOND_LEVEL_CACHE, "true");
+        map.put(USE_QUERY_CACHE, "true");
+        map.put(CACHE_REGION_FACTORY, HibernateRegionFactory.class.getName());
+        map.put(RELEASE_CONNECTIONS, "on_close");
+        map.put(IGNITE_INSTANCE_NAME_PROPERTY, igniteInstanceName);
+        map.put(DFLT_ACCESS_TYPE_PROPERTY, dfltAccessType);
+
+        return map;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java
new file mode 100644
index 0000000..5175292
--- /dev/null
+++ b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java
@@ -0,0 +1,154 @@
+/*
+ * 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.cache.hibernate;
+
+import java.util.Collections;
+import javax.cache.configuration.Factory;
+import javax.transaction.Synchronization;
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+import org.apache.commons.dbcp.managed.BasicManagedDataSource;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.h2.jdbcx.JdbcDataSource;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
+import org.hibernate.cache.spi.access.AccessType;
+import org.hibernate.cfg.Environment;
+import org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl;
+import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
+import org.hibernate.engine.transaction.jta.platform.internal.AbstractJtaPlatform;
+import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform;
+import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl;
+import org.jetbrains.annotations.Nullable;
+import org.objectweb.jotm.Jotm;
+
+/**
+ *
+ * Tests Hibernate L2 cache with TRANSACTIONAL access mode (Hibernate and Cache are configured
+ * to used the same TransactionManager).
+ */
+public class HibernateL2CacheTransactionalSelfTest extends HibernateL2CacheSelfTest {
+    /** */
+    private static Jotm jotm;
+
+    /**
+     */
+    private static class TestJtaPlatform extends AbstractJtaPlatform {
+        /** {@inheritDoc} */
+        @Override protected TransactionManager locateTransactionManager() {
+            return jotm.getTransactionManager();
+        }
+
+        /** {@inheritDoc} */
+        @Override protected UserTransaction locateUserTransaction() {
+            return jotm.getUserTransaction();
+        }
+    }
+
+    /**
+     */
+    @SuppressWarnings("PublicInnerClass")
+    public static class TestTmFactory implements Factory<TransactionManager> {
+        /** */
+        private static final long serialVersionUID = 0;
+
+        /** {@inheritDoc} */
+        @Override public TransactionManager create() {
+            return jotm.getTransactionManager();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        jotm = new Jotm(true, false);
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        if (jotm != null)
+            jotm.stop();
+
+        jotm = null;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        cfg.getTransactionConfiguration().setTxManagerFactory(new TestTmFactory());
+        cfg.getTransactionConfiguration().setUseJtaSynchronization(useJtaSynchronization());
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheConfiguration transactionalRegionConfiguration(String regionName) {
+        CacheConfiguration cfg = super.transactionalRegionConfiguration(regionName);
+
+        cfg.setNearConfiguration(null);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override protected StandardServiceRegistryBuilder registryBuilder() {
+        StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
+
+        DatasourceConnectionProviderImpl connProvider = new DatasourceConnectionProviderImpl();
+
+        BasicManagedDataSource dataSrc = new BasicManagedDataSource(); // JTA-aware data source.
+
+        dataSrc.setTransactionManager(jotm.getTransactionManager());
+
+        dataSrc.setDefaultAutoCommit(false);
+
+        JdbcDataSource h2DataSrc = new JdbcDataSource();
+
+        h2DataSrc.setURL(CONNECTION_URL);
+
+        dataSrc.setXaDataSourceInstance(h2DataSrc);
+
+        connProvider.setDataSource(dataSrc);
+
+        connProvider.configure(Collections.emptyMap());
+
+        builder.addService(ConnectionProvider.class, connProvider);
+
+        builder.addService(JtaPlatform.class, new TestJtaPlatform());
+
+        builder.applySetting(Environment.TRANSACTION_COORDINATOR_STRATEGY, JtaTransactionCoordinatorBuilderImpl.class.getName());
+
+        return builder;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected AccessType[] accessTypes() {
+        return new AccessType[]{AccessType.TRANSACTIONAL};
+    }
+
+    /**
+     * @return Whether to use {@link Synchronization}.
+     */
+    protected boolean useJtaSynchronization() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.java b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.java
new file mode 100644
index 0000000..44899f9
--- /dev/null
+++ b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.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.cache.hibernate;
+
+import javax.transaction.Synchronization;
+
+/**
+ * Tests Hibernate L2 cache with TRANSACTIONAL access mode and {@link Synchronization}
+ * instead of XA resource.
+ */
+public class HibernateL2CacheTransactionalUseSyncSelfTest extends HibernateL2CacheTransactionalSelfTest {
+    /** {@inheritDoc} */
+    @Override protected boolean useJtaSynchronization() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
new file mode 100644
index 0000000..d5496af
--- /dev/null
+++ b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.cache.store.hibernate;
+
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.internal.processors.cache.integration.IgniteCacheStoreNodeRestartAbstractTest;
+
+public class CacheHibernateBlobStoreNodeRestartTest extends IgniteCacheStoreNodeRestartAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected CacheStore getStore() {
+        return new CacheHibernateBlobStore();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.PARTITIONED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return CacheAtomicityMode.ATOMIC;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected NearCacheConfiguration nearConfiguration() {
+        return null;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreSelfTest.java b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreSelfTest.java
new file mode 100644
index 0000000..c62db4a
--- /dev/null
+++ b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreSelfTest.java
@@ -0,0 +1,114 @@
+/*
+ * 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.cache.store.hibernate;
+
+import java.io.File;
+import java.net.URL;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.cache.GridAbstractCacheStoreSelfTest;
+import org.hibernate.FlushMode;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.resource.transaction.spi.TransactionStatus;
+
+/**
+ * Cache store test.
+ */
+public class CacheHibernateBlobStoreSelfTest extends
+    GridAbstractCacheStoreSelfTest<CacheHibernateBlobStore<Object, Object>> {
+    /**
+     * @throws Exception If failed.
+     */
+    public CacheHibernateBlobStoreSelfTest() throws Exception {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        Session s = store.session(null);
+
+        if (s == null)
+            return;
+
+        try {
+            s.createQuery("delete from " + CacheHibernateBlobStoreEntry.class.getSimpleName())
+                    .setFlushMode(FlushMode.ALWAYS).executeUpdate();
+
+            Transaction hTx = s.getTransaction();
+
+            if (hTx != null && hTx.getStatus() == TransactionStatus.ACTIVE)
+                hTx.commit();
+        }
+        finally {
+            s.close();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheHibernateBlobStore<Object, Object> store() {
+        return new CacheHibernateBlobStore<>();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testConfigurationByUrl() throws Exception {
+        URL url = U.resolveIgniteUrl(CacheHibernateStoreFactorySelfTest.MODULE_PATH +
+            "/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
+
+        assert url != null;
+
+        store.setHibernateConfigurationPath(url.toString());
+
+        // Store will be implicitly initialized.
+        store.load("key");
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testConfigurationByFile() throws Exception {
+        URL url = U.resolveIgniteUrl(CacheHibernateStoreFactorySelfTest.MODULE_PATH +
+                "/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
+
+        assert url != null;
+
+        File file = new File(url.toURI());
+
+        store.setHibernateConfigurationPath(file.getAbsolutePath());
+
+        // Store will be implicitly initialized.
+        store.load("key");
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testConfigurationByResource() throws Exception {
+        store.setHibernateConfigurationPath("/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
+
+        // Store will be implicitly initialized.
+        store.load("key");
+    }
+
+    @Override public void testSimpleMultithreading() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-1757");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
new file mode 100644
index 0000000..7d4f280
--- /dev/null
+++ b/modules/hibernate-5.1/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
@@ -0,0 +1,256 @@
+/*
+ * 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.cache.store.hibernate;
+
+import java.sql.Connection;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.hibernate.Cache;
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+import org.hibernate.SessionBuilder;
+import org.hibernate.SessionFactory;
+import org.hibernate.StatelessSession;
+import org.hibernate.StatelessSessionBuilder;
+import org.hibernate.TypeHelper;
+import org.hibernate.boot.spi.SessionFactoryOptions;
+import org.hibernate.engine.spi.FilterDefinition;
+import org.hibernate.metadata.ClassMetadata;
+import org.hibernate.metadata.CollectionMetadata;
+import org.hibernate.stat.Statistics;
+
+/**
+ * Test for Cache jdbc blob store factory.
+ */
+public class CacheHibernateStoreFactorySelfTest extends GridCommonAbstractTest {
+    /** Cache name. */
+    private static final String CACHE_NAME = "test";
+
+    /** */
+    static final String MODULE_PATH = "modules/hibernate-5.1/";
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCacheConfiguration() throws Exception {
+        try (Ignite ignite1 = startGrid(0)) {
+            IgniteCache<Integer, String> cache1 = ignite1.getOrCreateCache(cacheConfiguration());
+
+            checkStore(cache1);
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testXmlConfiguration() throws Exception {
+        try (Ignite ignite = Ignition.start(MODULE_PATH + "/src/test/config/factory-cache.xml")) {
+            try(Ignite ignite1 = Ignition.start(MODULE_PATH + "/src/test/config/factory-cache1.xml")) {
+                checkStore(ignite.<Integer, String>cache(CACHE_NAME), DummySessionFactoryExt.class);
+
+                checkStore(ignite1.<Integer, String>cache(CACHE_NAME), DummySessionFactory.class);
+            }
+        }
+    }
+
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testIncorrectBeanConfiguration() throws Exception {
+        GridTestUtils.assertThrows(log, new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                try(Ignite ignite =
+                    Ignition.start(MODULE_PATH + "/src/test/config/factory-incorrect-store-cache.xml")) {
+                    ignite.cache(CACHE_NAME).getConfiguration(CacheConfiguration.class).
+                            getCacheStoreFactory().create();
+                }
+                return null;
+            }
+        }, IgniteException.class, "Failed to load bean in application context");
+    }
+
+    /**
+     * @return Cache configuration with store.
+     */
+    private CacheConfiguration<Integer, String> cacheConfiguration() {
+        CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
+
+        CacheHibernateBlobStoreFactory<Integer, String> factory = new CacheHibernateBlobStoreFactory();
+
+        factory.setHibernateConfigurationPath("/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
+
+        cfg.setCacheStoreFactory(factory);
+
+        return cfg;
+    }
+
+    /**
+     * @param cache Ignite cache.
+     * @param dataSrcClass Data source class.
+     * @throws Exception If store parameters is not the same as in configuration xml.
+     */
+    private void checkStore(IgniteCache<Integer, String> cache, Class<?> dataSrcClass) throws Exception {
+        CacheHibernateBlobStore store = (CacheHibernateBlobStore)cache
+            .getConfiguration(CacheConfiguration.class).getCacheStoreFactory().create();
+
+        assertEquals(dataSrcClass,
+            GridTestUtils.getFieldValue(store, CacheHibernateBlobStore.class, "sesFactory").getClass());
+    }
+
+    /**
+     * @param cache Ignite cache.
+     * @throws Exception If store parameters is not the same as in configuration xml.
+     */
+    private void checkStore(IgniteCache<Integer, String> cache) throws Exception {
+        CacheHibernateBlobStore store = (CacheHibernateBlobStore)cache.getConfiguration(CacheConfiguration.class)
+            .getCacheStoreFactory().create();
+
+        assertEquals("/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml",
+            GridTestUtils.getFieldValue(store, CacheHibernateBlobStore.class, "hibernateCfgPath"));
+    }
+
+    /**
+     *
+     */
+    public static class DummySessionFactoryExt extends DummySessionFactory {
+        /** */
+        public DummySessionFactoryExt() {
+            // No-op.
+        }
+    }
+
+    /**
+     *
+     */
+    public static class DummySessionFactory implements SessionFactory {
+        /** {@inheritDoc} */
+        @Override public SessionFactoryOptions getSessionFactoryOptions() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public SessionBuilder withOptions() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Session openSession() throws HibernateException {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Session getCurrentSession() throws HibernateException {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public StatelessSessionBuilder withStatelessOptions() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public StatelessSession openStatelessSession() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public StatelessSession openStatelessSession(Connection conn) {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public ClassMetadata getClassMetadata(Class entityCls) {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public ClassMetadata getClassMetadata(String entityName) {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public CollectionMetadata getCollectionMetadata(String roleName) {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Map<String, ClassMetadata> getAllClassMetadata() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Map getAllCollectionMetadata() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Statistics getStatistics() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void close() throws HibernateException {
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isClosed() {
+            return false;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Cache getCache() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Set getDefinedFilterNames() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public FilterDefinition getFilterDefinition(String filterName) throws HibernateException {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean containsFetchProfileDefinition(String name) {
+            return false;
+        }
+
+        /** {@inheritDoc} */
+        @Override public TypeHelper getTypeHelper() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Reference getReference() throws NamingException {
+            return null;
+        }
+    }
+}
\ No newline at end of file


[29/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/jms11/src/test/java/org/apache/ignite/stream/jms11/IgniteJmsStreamerTest.java
----------------------------------------------------------------------
diff --git a/modules/jms11/src/test/java/org/apache/ignite/stream/jms11/IgniteJmsStreamerTest.java b/modules/jms11/src/test/java/org/apache/ignite/stream/jms11/IgniteJmsStreamerTest.java
index 290185e..2011684 100644
--- a/modules/jms11/src/test/java/org/apache/ignite/stream/jms11/IgniteJmsStreamerTest.java
+++ b/modules/jms11/src/test/java/org/apache/ignite/stream/jms11/IgniteJmsStreamerTest.java
@@ -121,7 +121,7 @@ public class IgniteJmsStreamerTest extends GridCommonAbstractTest {
      */
     @After
     public void afterTest() throws Exception {
-        grid().cache(null).clear();
+        grid().cache(DEFAULT_CACHE_NAME).clear();
 
         broker.stop();
         broker.deleteAllMessages();
@@ -136,7 +136,7 @@ public class IgniteJmsStreamerTest extends GridCommonAbstractTest {
         // produce messages into the queue
         produceObjectMessages(dest, false);
 
-        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(null)) {
+        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) {
             JmsStreamer<ObjectMessage, String, String> jmsStreamer = newJmsStreamer(ObjectMessage.class, dataStreamer);
             jmsStreamer.setDestinationType(Queue.class);
             jmsStreamer.setDestinationName(QUEUE_NAME);
@@ -165,7 +165,7 @@ public class IgniteJmsStreamerTest extends GridCommonAbstractTest {
         // should not produced messages until subscribed to the topic; otherwise they will be missed because this is not
         // a durable subscriber (for which a dedicated test exists)
 
-        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(null)) {
+        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) {
             JmsStreamer<ObjectMessage, String, String> jmsStreamer = newJmsStreamer(ObjectMessage.class, dataStreamer);
             jmsStreamer.setDestinationType(Topic.class);
             jmsStreamer.setDestinationName(TOPIC_NAME);
@@ -197,7 +197,7 @@ public class IgniteJmsStreamerTest extends GridCommonAbstractTest {
         // produce messages into the queue
         produceObjectMessages(dest, false);
 
-        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(null)) {
+        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) {
             JmsStreamer<ObjectMessage, String, String> jmsStreamer = newJmsStreamer(ObjectMessage.class, dataStreamer);
             jmsStreamer.setDestination(dest);
 
@@ -226,7 +226,7 @@ public class IgniteJmsStreamerTest extends GridCommonAbstractTest {
         // should not produced messages until subscribed to the topic; otherwise they will be missed because this is not
         // a durable subscriber (for which a dedicated test exists)
 
-        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(null)) {
+        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) {
             JmsStreamer<ObjectMessage, String, String> jmsStreamer = newJmsStreamer(ObjectMessage.class, dataStreamer);
             jmsStreamer.setDestination(dest);
 
@@ -257,7 +257,7 @@ public class IgniteJmsStreamerTest extends GridCommonAbstractTest {
         // produce A SINGLE MESSAGE, containing all data, into the queue
         produceStringMessages(dest, true);
 
-        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(null)) {
+        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) {
             JmsStreamer<TextMessage, String, String> jmsStreamer = newJmsStreamer(TextMessage.class, dataStreamer);
             jmsStreamer.setDestination(dest);
 
@@ -282,7 +282,7 @@ public class IgniteJmsStreamerTest extends GridCommonAbstractTest {
     public void testDurableSubscriberStartStopStart() throws Exception {
         Destination dest = new ActiveMQTopic(TOPIC_NAME);
 
-        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(null)) {
+        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) {
             JmsStreamer<TextMessage, String, String> jmsStreamer = newJmsStreamer(TextMessage.class, dataStreamer);
             jmsStreamer.setDestination(dest);
             jmsStreamer.setDurableSubscription(true);
@@ -325,7 +325,7 @@ public class IgniteJmsStreamerTest extends GridCommonAbstractTest {
         // produce multiple messages into the queue
         produceStringMessages(dest, false);
 
-        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(null)) {
+        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) {
             JmsStreamer<TextMessage, String, String> jmsStreamer = newJmsStreamer(TextMessage.class, dataStreamer);
             jmsStreamer.setDestination(dest);
             jmsStreamer.setBatched(true);
@@ -364,7 +364,7 @@ public class IgniteJmsStreamerTest extends GridCommonAbstractTest {
         // produce multiple messages into the queue
         produceStringMessages(dest, false);
 
-        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(null)) {
+        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) {
             JmsStreamer<TextMessage, String, String> jmsStreamer = newJmsStreamer(TextMessage.class, dataStreamer);
             jmsStreamer.setDestination(dest);
             jmsStreamer.setBatched(true);
@@ -414,7 +414,7 @@ public class IgniteJmsStreamerTest extends GridCommonAbstractTest {
         // produce multiple messages into the queue
         produceStringMessages(dest, false);
 
-        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(null)) {
+        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) {
             JmsStreamer<TextMessage, String, String> jmsStreamer = newJmsStreamer(TextMessage.class, dataStreamer);
             // override the transformer with one that generates no cache entries
             jmsStreamer.setTransformer(TestTransformers.generateNoEntries());
@@ -442,7 +442,7 @@ public class IgniteJmsStreamerTest extends GridCommonAbstractTest {
         // produce multiple messages into the queue
         produceStringMessages(dest, false);
 
-        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(null)) {
+        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) {
             JmsStreamer<TextMessage, String, String> jmsStreamer = newJmsStreamer(TextMessage.class, dataStreamer);
             jmsStreamer.setTransacted(true);
             jmsStreamer.setDestination(dest);
@@ -471,7 +471,7 @@ public class IgniteJmsStreamerTest extends GridCommonAbstractTest {
         // produce messages into the queue
         produceObjectMessages(dest, false);
 
-        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(null)) {
+        try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) {
             JmsStreamer<ObjectMessage, String, String> jmsStreamer = newJmsStreamer(ObjectMessage.class, dataStreamer);
             jmsStreamer.setDestination(dest);
             jmsStreamer.setThreads(5);
@@ -504,7 +504,7 @@ public class IgniteJmsStreamerTest extends GridCommonAbstractTest {
      */
     private void assertAllCacheEntriesLoaded() {
         // Get the cache and check that the entries are present
-        IgniteCache<String, String> cache = grid().cache(null);
+        IgniteCache<String, String> cache = grid().cache(DEFAULT_CACHE_NAME);
         for (Map.Entry<String, String> entry : TEST_DATA.entrySet())
             assertEquals(entry.getValue(), cache.get(entry.getKey()));
     }
@@ -545,7 +545,7 @@ public class IgniteJmsStreamerTest extends GridCommonAbstractTest {
             }
         };
 
-        ignite.events(ignite.cluster().forCacheNodes(null)).remoteListen(cb, null, EVT_CACHE_OBJECT_PUT);
+        ignite.events(ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME)).remoteListen(cb, null, EVT_CACHE_OBJECT_PUT);
         return latch;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheJtaConfigurationValidationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheJtaConfigurationValidationSelfTest.java b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheJtaConfigurationValidationSelfTest.java
index b2a9b69..c7b7fed 100644
--- a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheJtaConfigurationValidationSelfTest.java
+++ b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheJtaConfigurationValidationSelfTest.java
@@ -37,7 +37,7 @@ public class GridCacheJtaConfigurationValidationSelfTest extends GridCommonAbstr
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(ATOMIC);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheJtaFactoryConfigValidationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheJtaFactoryConfigValidationSelfTest.java b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheJtaFactoryConfigValidationSelfTest.java
index d39e14b..bb12d5e 100644
--- a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheJtaFactoryConfigValidationSelfTest.java
+++ b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheJtaFactoryConfigValidationSelfTest.java
@@ -41,7 +41,7 @@ public class GridCacheJtaFactoryConfigValidationSelfTest extends GridCommonAbstr
 
         cfg.getTransactionConfiguration().setTxManagerFactory(factory);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(ATOMIC);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaLookupClassNameSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaLookupClassNameSelfTest.java b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaLookupClassNameSelfTest.java
index 1efbda6..bb1e89c 100644
--- a/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaLookupClassNameSelfTest.java
+++ b/modules/jta/src/test/java/org/apache/ignite/internal/processors/cache/GridPartitionedCacheJtaLookupClassNameSelfTest.java
@@ -44,7 +44,7 @@ public class GridPartitionedCacheJtaLookupClassNameSelfTest extends AbstractCach
     public void testUncompatibleTmLookup() {
         final IgniteEx ignite = grid(0);
 
-        final CacheConfiguration cacheCfg = new CacheConfiguration();
+        final CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cacheCfg.setName("Foo");
         cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/kafka/src/test/java/org/apache/ignite/stream/kafka/KafkaIgniteStreamerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/kafka/src/test/java/org/apache/ignite/stream/kafka/KafkaIgniteStreamerSelfTest.java b/modules/kafka/src/test/java/org/apache/ignite/stream/kafka/KafkaIgniteStreamerSelfTest.java
index 102b647..00cb4fc 100644
--- a/modules/kafka/src/test/java/org/apache/ignite/stream/kafka/KafkaIgniteStreamerSelfTest.java
+++ b/modules/kafka/src/test/java/org/apache/ignite/stream/kafka/KafkaIgniteStreamerSelfTest.java
@@ -81,7 +81,7 @@ public class KafkaIgniteStreamerSelfTest extends GridCommonAbstractTest {
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-        grid().cache(null).clear();
+        grid().cache(DEFAULT_CACHE_NAME).clear();
 
         embeddedBroker.shutdown();
     }
@@ -150,7 +150,7 @@ public class KafkaIgniteStreamerSelfTest extends GridCommonAbstractTest {
 
         Ignite ignite = grid();
 
-        try (IgniteDataStreamer<String, String> stmr = ignite.dataStreamer(null)) {
+        try (IgniteDataStreamer<String, String> stmr = ignite.dataStreamer(DEFAULT_CACHE_NAME)) {
             stmr.allowOverwrite(true);
             stmr.autoFlushFrequency(10);
 
@@ -158,7 +158,7 @@ public class KafkaIgniteStreamerSelfTest extends GridCommonAbstractTest {
             kafkaStmr = new KafkaStreamer<>();
 
             // Get the cache.
-            IgniteCache<String, String> cache = ignite.cache(null);
+            IgniteCache<String, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             // Set Ignite instance.
             kafkaStmr.setIgnite(ignite);
@@ -210,7 +210,7 @@ public class KafkaIgniteStreamerSelfTest extends GridCommonAbstractTest {
                 }
             };
 
-            ignite.events(ignite.cluster().forCacheNodes(null)).remoteListen(locLsnr, null, EVT_CACHE_OBJECT_PUT);
+            ignite.events(ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME)).remoteListen(locLsnr, null, EVT_CACHE_OBJECT_PUT);
 
             // Checks all events successfully processed in 10 seconds.
             assertTrue(latch.await(10, TimeUnit.SECONDS));

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java
----------------------------------------------------------------------
diff --git a/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java b/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java
index 49e1f71..d8c15ea 100644
--- a/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java
+++ b/modules/mqtt/src/test/java/org/apache/ignite/stream/mqtt/IgniteMqttStreamerTest.java
@@ -145,7 +145,7 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
         client.connect();
 
         // create mqtt streamer
-        dataStreamer = grid().dataStreamer(null);
+        dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME);
 
         streamer = createMqttStreamer(dataStreamer);
     }
@@ -164,7 +164,7 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
 
         dataStreamer.close();
 
-        grid().cache(null).clear();
+        grid().cache(DEFAULT_CACHE_NAME).clear();
 
         broker.stop();
         broker.deleteAllMessages();
@@ -441,7 +441,7 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
 
         Thread.sleep(3000);
 
-        assertNull(grid().cache(null).get(50));
+        assertNull(grid().cache(DEFAULT_CACHE_NAME).get(50));
     }
 
     /**
@@ -570,7 +570,7 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
             }
         };
 
-        remoteLsnr = ignite.events(ignite.cluster().forCacheNodes(null))
+        remoteLsnr = ignite.events(ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME))
             .remoteListen(cb, null, EVT_CACHE_OBJECT_PUT);
 
         return latch;
@@ -581,7 +581,7 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
      */
     private void assertCacheEntriesLoaded(int cnt) {
         // get the cache and check that the entries are present
-        IgniteCache<Integer, String> cache = grid().cache(null);
+        IgniteCache<Integer, String> cache = grid().cache(DEFAULT_CACHE_NAME);
 
         // for each key from 0 to count from the TEST_DATA (ordered by key), check that the entry is present in cache
         for (Integer key : new ArrayList<>(new TreeSet<>(TEST_DATA.keySet())).subList(0, cnt))
@@ -591,7 +591,7 @@ public class IgniteMqttStreamerTest extends GridCommonAbstractTest {
         assertEquals(cnt, cache.size(CachePeekMode.ALL));
 
         // remove the event listener
-        grid().events(grid().cluster().forCacheNodes(null)).stopRemoteListen(remoteLsnr);
+        grid().events(grid().cluster().forCacheNodes(DEFAULT_CACHE_NAME)).stopRemoteListen(remoteLsnr);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
index 2ee7cad..735cfff 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
@@ -115,7 +115,7 @@ namespace Apache.Ignite.Core.Tests.Binary
         {
             var grid = client ? _clientGrid : _grid;
 
-            var cache = grid.GetCache<int, PlatformComputeBinarizable>(null);
+            var cache = grid.GetCache<int, PlatformComputeBinarizable>("default");
 
             // Populate cache in .NET
             for (var i = 0; i < 100; i++)

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
index 687b1f5..549e453 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
@@ -102,7 +102,7 @@ namespace Apache.Ignite.Core.Tests.Binary
                 BinaryConfiguration = new BinaryConfiguration {CompactFooter = false},
                 CacheConfiguration = new[]
                 {
-                    new CacheConfiguration
+                    new CacheConfiguration("default")
                     {
                         CacheStoreFactory = new StoreFactory(),
                         ReadThrough = true,
@@ -138,14 +138,14 @@ namespace Apache.Ignite.Core.Tests.Binary
             using (var ignite = Ignition.Start(cfg))
             {
                 // Put through statically started cache
-                var staticCache = ignite.GetCache<int, Foo>(null);
+                var staticCache = ignite.GetCache<int, Foo>("default");
                 staticCache[1] = new Foo {Str = "test", Int = 2};
             }
 
             using (var ignite = Ignition.Start(cfg))
             {
-                var foo = ignite.GetCache<int, Foo>(null)[1];
-                var foo2 = ignite.GetCache<int, Foo>(null)[2];
+                var foo = ignite.GetCache<int, Foo>("default")[1];
+                var foo2 = ignite.GetCache<int, Foo>("default")[2];
 
                 Assert.AreEqual("test", foo.Str);
                 Assert.AreEqual(2, foo.Int);
@@ -160,8 +160,8 @@ namespace Apache.Ignite.Core.Tests.Binary
                     IgniteInstanceName = "grid2"
                 }))
                 {
-                    var fooClient = igniteClient.GetCache<int, Foo>(null)[1];
-                    var fooClient2 = igniteClient.GetCache<int, Foo>(null)[2];
+                    var fooClient = igniteClient.GetCache<int, Foo>("default")[1];
+                    var fooClient2 = igniteClient.GetCache<int, Foo>("default")[2];
 
                     Assert.AreEqual("test", fooClient.Str);
                     Assert.AreEqual(2, fooClient.Int);
@@ -176,7 +176,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             using (var ignite = Ignition.Start(cfg))
             {
-                var ex = Assert.Throws<BinaryObjectException>(() => ignite.GetCache<int, Foo>(null).Get(1));
+                var ex = Assert.Throws<BinaryObjectException>(() => ignite.GetCache<int, Foo>("default").Get(1));
 
                 Assert.IsTrue(ex.Message.Contains("Unknown pair"));
             }
@@ -192,7 +192,7 @@ namespace Apache.Ignite.Core.Tests.Binary
             {
                 CacheConfiguration = new[]
                 {
-                    new CacheConfiguration
+                    new CacheConfiguration("default")
                     {
                         CacheStoreFactory = new StoreFactory {StringProp = "test", IntProp = 9},
                         ReadThrough = true,
@@ -303,7 +303,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             using (var ignite = Ignition.Start(cfg))
             {
-                var cacheCfg = new CacheConfiguration(null, new QueryEntity(typeof(PlatformComputeBinarizable))
+                var cacheCfg = new CacheConfiguration("default", new QueryEntity(typeof(PlatformComputeBinarizable))
                 {
                     Fields = new[] {new QueryField("Field", typeof(int))}
                 });

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/JavaBinaryInteropTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/JavaBinaryInteropTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/JavaBinaryInteropTest.cs
index 9af5c35..9343799 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/JavaBinaryInteropTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/JavaBinaryInteropTest.cs
@@ -36,7 +36,7 @@ namespace Apache.Ignite.Core.Tests.Binary
         {
             using (var ignite = Ignition.Start(TestUtils.GetTestConfiguration()))
             {
-                ignite.CreateCache<int, object>((string) null);
+                ignite.CreateCache<int, object>("default");
 
                 // Basic types.
                 // Types which map directly to Java are returned properly when retrieved as object.
@@ -95,7 +95,7 @@ namespace Apache.Ignite.Core.Tests.Binary
         /// </summary>
         private static void CheckValueCaching<T>(T val, bool asObject = true, bool asArray = true)
         {
-            var cache = Ignition.GetIgnite(null).GetCache<int, T>(null);
+            var cache = Ignition.GetIgnite().GetCache<int, T>("default");
 
             cache[1] = val;
             Assert.AreEqual(val, cache[1]);
@@ -117,7 +117,7 @@ namespace Apache.Ignite.Core.Tests.Binary
         /// </summary>
         private static void CheckValueCachingAsObject<T>(T val)
         {
-            var cache = Ignition.GetIgnite(null).GetCache<int, object>(null);
+            var cache = Ignition.GetIgnite().GetCache<int, object>("default");
 
             cache[1] = val;
             Assert.AreEqual(val, (T) cache[1]);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/BinaryConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/BinaryConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/BinaryConfigurationTest.cs
index 496f46f..d549d1d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/BinaryConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/BinaryConfigurationTest.cs
@@ -75,7 +75,7 @@ namespace Apache.Ignite.Core.Tests
                 BinaryConfiguration = binaryConfiguration
             });
 
-            _cache = grid.GetCache<int, TestGenericBinarizableBase>(null);
+            _cache = grid.GetCache<int, TestGenericBinarizableBase>("default");
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFieldTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFieldTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFieldTest.cs
index 71883b1..31326b7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFieldTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityFieldTest.cs
@@ -48,11 +48,11 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
             var grid1 = Ignition.Start(GetConfig());
             var grid2 = Ignition.Start(GetConfig("grid2"));
 
-            _cache1 = grid1.CreateCache<object, string>(new CacheConfiguration
+            _cache1 = grid1.CreateCache<object, string>(new CacheConfiguration("default")
             {
                 CacheMode = CacheMode.Partitioned
             });
-            _cache2 = grid2.GetCache<object, string>(null);
+            _cache2 = grid2.GetCache<object, string>("default");
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityTest.cs
index 1ae46c5..a3b8c03 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Affinity/AffinityTest.cs
@@ -62,7 +62,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
         {
             IIgnite g = Ignition.GetIgnite("grid-0");
 
-            ICacheAffinity aff = g.GetAffinity(null);
+            ICacheAffinity aff = g.GetAffinity("default");
 
             IClusterNode node = aff.MapKeyToNode(new AffinityTestKey(0, 1));
 
@@ -78,7 +78,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Affinity
         {
             IIgnite g = Ignition.GetIgnite("grid-0");
 
-            ICacheAffinity aff = g.GetAffinity(null);  
+            ICacheAffinity aff = g.GetAffinity("default");  
 
             IBinaryObject affKey = g.GetBinary().ToBinary<IBinaryObject>(new AffinityTestKey(0, 1));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
index 67184a6..70fd473 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs
@@ -43,6 +43,9 @@ namespace Apache.Ignite.Core.Tests.Cache
         private const string CacheName = "cacheName";
 
         /** */
+        private const string DefaultCacheName = "default";
+
+        /** */
         private const string CacheName2 = "cacheName2";
 
         /** */
@@ -59,7 +62,7 @@ namespace Apache.Ignite.Core.Tests.Cache
             {
                 CacheConfiguration = new List<CacheConfiguration>
                 {
-                    new CacheConfiguration(),
+                    new CacheConfiguration(DefaultCacheName),
                     GetCustomCacheConfiguration(),
                     GetCustomCacheConfiguration2()
                 },
@@ -96,11 +99,11 @@ namespace Apache.Ignite.Core.Tests.Cache
         [Test]
         public void TestDefaultConfiguration()
         {
-            AssertConfigIsDefault(new CacheConfiguration());
+            AssertConfigIsDefault(new CacheConfiguration(DefaultCacheName));
 
-            AssertConfigIsDefault(_ignite.GetCache<int, int>(null).GetConfiguration());
+            AssertConfigIsDefault(_ignite.GetCache<int, int>(DefaultCacheName).GetConfiguration());
 
-            AssertConfigIsDefault(_ignite.GetConfiguration().CacheConfiguration.Single(c => c.Name == null));
+            AssertConfigIsDefault(_ignite.GetConfiguration().CacheConfiguration.Single(c => c.Name == DefaultCacheName));
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs
index 3401b79..0dc214f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs
@@ -73,7 +73,7 @@ namespace Apache.Ignite.Core.Tests.Cache
         [Test]
         public void TestClearCache()
         {
-            _grid.GetCache<object, object>(null).Clear();
+            _grid.GetCache<object, object>("default").Clear();
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheNearTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheNearTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheNearTest.cs
index 24dc971..285f635 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheNearTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheNearTest.cs
@@ -29,6 +29,9 @@ namespace Apache.Ignite.Core.Tests.Cache
     public class CacheNearTest : IEventListener<CacheEvent>
     {
         /** */
+        private const string DefaultCacheName = "default";
+
+        /** */
         private IIgnite _grid;
 
         /** */
@@ -49,10 +52,12 @@ namespace Apache.Ignite.Core.Tests.Cache
                         NearConfiguration = new NearCacheConfiguration
                         {
                             EvictionPolicy = new FifoEvictionPolicy {MaxSize = 5}
-                        }
+                        },
+                        Name = DefaultCacheName
                     }
                 },
-                IncludedEventTypes = new[] { EventType.CacheEntryCreated }
+                IncludedEventTypes = new[] { EventType.CacheEntryCreated },
+                IgniteInstanceName = "server"
             };
 
             _grid = Ignition.Start(cfg);
@@ -73,15 +78,15 @@ namespace Apache.Ignite.Core.Tests.Cache
         [Test]
         public void TestExistingNearCache()
         {
-            var cache = _grid.GetCache<int, string>(null);
+            var cache = _grid.GetCache<int, string>(DefaultCacheName);
 
             cache[1] = "1";
 
-            var nearCache = _grid.GetOrCreateNearCache<int, string>(null, new NearCacheConfiguration());
+            var nearCache = _grid.GetOrCreateNearCache<int, string>(DefaultCacheName, new NearCacheConfiguration());
             Assert.AreEqual("1", nearCache[1]);
 
             // GetOrCreate when exists
-            nearCache = _grid.GetOrCreateNearCache<int, string>(null, new NearCacheConfiguration());
+            nearCache = _grid.GetOrCreateNearCache<int, string>(DefaultCacheName, new NearCacheConfiguration());
             Assert.AreEqual("1", nearCache[1]);
         }
 
@@ -93,15 +98,22 @@ namespace Apache.Ignite.Core.Tests.Cache
         {
             const string cacheName = "dyn_cache";
 
-            var cache = _grid.CreateCache<int, string>(cacheName);
+            var cache = _grid.CreateCache<int, string>(new CacheConfiguration(cacheName));
             cache[1] = "1";
 
-            var nearCache = _grid.CreateNearCache<int, string>(cacheName, new NearCacheConfiguration());
-            Assert.AreEqual("1", nearCache[1]);
+            using (var client = Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration())
+            {
+                ClientMode = true,
+                IgniteInstanceName = "client"
+            }))
+            {
+                var nearCache = client.CreateNearCache<int, string>(cacheName, new NearCacheConfiguration());
+                Assert.AreEqual("1", nearCache[1]);
 
-            // Create when exists
-            nearCache = _grid.CreateNearCache<int, string>(cacheName, new NearCacheConfiguration());
-            Assert.AreEqual("1", nearCache[1]);
+                // Create when exists.
+                nearCache = client.CreateNearCache<int, string>(cacheName, new NearCacheConfiguration());
+                Assert.AreEqual("1", nearCache[1]);
+            }
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
index c638449..ab661cf 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
@@ -46,7 +46,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
     public class CacheLinqTest
     {
         /** Cache name. */
-        private const string PersonOrgCacheName = null;
+        private const string PersonOrgCacheName = "person_org";
 
         /** Cache name. */
         private const string PersonSecondCacheName = "person_cache";
@@ -1280,7 +1280,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
             Assert.AreEqual(cache.Ignite, query.Ignite);
 
             var fq = query.GetFieldsQuery();
-            Assert.AreEqual("select _T0._key, _T0._val from \"\".Person as _T0 where (_T0._key > ?)", fq.Sql);
+            Assert.AreEqual("select _T0._key, _T0._val from \"person_org\".Person as _T0 where (_T0._key > ?)", 
+                fq.Sql);
             Assert.AreEqual(new[] {10}, fq.Arguments);
             Assert.IsTrue(fq.Local);
             Assert.AreEqual(PersonCount - 11, cache.QueryFields(fq).GetAll().Count);
@@ -1289,8 +1290,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
             Assert.IsTrue(fq.EnforceJoinOrder);
 
             var str = query.ToString();
-            Assert.AreEqual("CacheQueryable [CacheName=, TableName=Person, Query=SqlFieldsQuery [Sql=select " +
-                            "_T0._key, _T0._val from \"\".Person as _T0 where (_T0._key > ?), Arguments=[10], " +
+            Assert.AreEqual("CacheQueryable [CacheName=person_org, TableName=Person, Query=SqlFieldsQuery " +
+                            "[Sql=select _T0._key, _T0._val from \"person_org\".Person as _T0 where " +
+                            "(_T0._key > ?), Arguments=[10], " +
                             "Local=True, PageSize=999, EnableDistributedJoins=False, EnforceJoinOrder=True]]", str);
 
             // Check fields query
@@ -1300,16 +1302,16 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
             Assert.AreEqual(cache.Ignite, fieldsQuery.Ignite);
 
             fq = fieldsQuery.GetFieldsQuery();
-            Assert.AreEqual("select _T0.Name from \"\".Person as _T0", fq.Sql);
+            Assert.AreEqual("select _T0.Name from \"person_org\".Person as _T0", fq.Sql);
             Assert.IsFalse(fq.Local);
             Assert.AreEqual(SqlFieldsQuery.DefaultPageSize, fq.PageSize);
             Assert.IsFalse(fq.EnableDistributedJoins);
             Assert.IsFalse(fq.EnforceJoinOrder);
 
             str = fieldsQuery.ToString();
-            Assert.AreEqual("CacheQueryable [CacheName=, TableName=Person, Query=SqlFieldsQuery [Sql=select " +
-                            "_T0.Name from \"\".Person as _T0, Arguments=[], Local=False, PageSize=1024, " +
-                            "EnableDistributedJoins=False, EnforceJoinOrder=False]]", str);
+            Assert.AreEqual("CacheQueryable [CacheName=person_org, TableName=Person, Query=SqlFieldsQuery " +
+                            "[Sql=select _T0.Name from \"person_org\".Person as _T0, Arguments=[], Local=False, " +
+                            "PageSize=1024, EnableDistributedJoins=False, EnforceJoinOrder=False]]", str);
             
             // Check distributed joins flag propagation
             var distrQuery = cache.AsCacheQueryable(new QueryOptions {EnableDistributedJoins = true})
@@ -1320,8 +1322,9 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
             Assert.IsTrue(query.GetFieldsQuery().EnableDistributedJoins);
 
             str = distrQuery.ToString();
-            Assert.AreEqual("CacheQueryable [CacheName=, TableName=Person, Query=SqlFieldsQuery [Sql=select " +
-                            "_T0._key, _T0._val from \"\".Person as _T0 where (((_T0._key > ?) and (_T0.age1 > ?)) " +
+            Assert.AreEqual("CacheQueryable [CacheName=person_org, TableName=Person, Query=SqlFieldsQuery " +
+                            "[Sql=select _T0._key, _T0._val from \"person_org\".Person as _T0 where " +
+                            "(((_T0._key > ?) and (_T0.age1 > ?)) " +
                             "and (_T0.Name like \'%\' || ? || \'%\') ), Arguments=[10, 20, x], Local=False, " +
                             "PageSize=1024, EnableDistributedJoins=True, EnforceJoinOrder=False]]", str);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/CancellationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/CancellationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/CancellationTest.cs
index 19bb40d..a8a99ce 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/CancellationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/CancellationTest.cs
@@ -71,7 +71,7 @@ namespace Apache.Ignite.Core.Tests.Compute
             TestClosure((c, t) => c.BroadcastAsync(new ComputeFunc(), t));
             TestClosure((c, t) => c.BroadcastAsync(new ComputeBiFunc(), 10, t));
 
-            TestClosure((c, t) => c.AffinityRunAsync(null, 0, new ComputeAction(), t));
+            TestClosure((c, t) => c.AffinityRunAsync("default", 0, new ComputeAction(), t));
 
             TestClosure((c, t) => c.RunAsync(new ComputeAction(), t));
             TestClosure((c, t) => c.RunAsync(Enumerable.Range(1, 10).Select(x => new ComputeAction()), t));
@@ -81,7 +81,7 @@ namespace Apache.Ignite.Core.Tests.Compute
             TestClosure((c, t) => c.CallAsync(Enumerable.Range(1, 10).Select(x => new ComputeFunc()), 
                 new ComputeReducer(), t));
 
-            TestClosure((c, t) => c.AffinityCallAsync(null, 0, new ComputeFunc(), t));
+            TestClosure((c, t) => c.AffinityCallAsync("default", 0, new ComputeFunc(), t));
 
             TestClosure((c, t) => c.ApplyAsync(new ComputeBiFunc(), 10, t));
             TestClosure((c, t) => c.ApplyAsync(new ComputeBiFunc(), Enumerable.Range(1, 100), t));

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
index d675d14..02eb266 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
@@ -122,6 +122,9 @@ namespace Apache.Ignite.Core.Tests.Compute
         /** Echo type: IgniteUuid. */
         private const int EchoTypeIgniteUuid = 22;
 
+        /** */
+        private const string DefaultCacheName = "default";
+
         /** First node. */
         private IIgnite _grid1;
 
@@ -195,21 +198,6 @@ namespace Apache.Ignite.Core.Tests.Compute
         }
 
         /// <summary>
-        /// Test getting cache with default (null) name.
-        /// </summary>
-        [Test]
-        public void TestCacheDefaultName()
-        {
-            var cache = _grid1.GetCache<int, int>(null);
-
-            Assert.IsNotNull(cache);
-
-            cache.GetAndPut(1, 1);
-
-            Assert.AreEqual(1, cache.Get(1));
-        }
-
-        /// <summary>
         /// Test non-existent cache.
         /// </summary>
         [Test]
@@ -954,7 +942,7 @@ namespace Apache.Ignite.Core.Tests.Compute
         [Test]
         public void TestEchoTaskEnumFromCache()
         {
-            var cache = _grid1.GetCache<int, PlatformComputeEnum>(null);
+            var cache = _grid1.GetCache<int, PlatformComputeEnum>(DefaultCacheName);
 
             foreach (PlatformComputeEnum val in Enum.GetValues(typeof(PlatformComputeEnum)))
             {
@@ -988,7 +976,7 @@ namespace Apache.Ignite.Core.Tests.Compute
         [Test]
         public void TestEchoTaskEnumArrayFromCache()
         {
-            var cache = _grid1.GetCache<int, PlatformComputeEnum[]>(null);
+            var cache = _grid1.GetCache<int, PlatformComputeEnum[]>(DefaultCacheName);
 
             foreach (var val in new[]
             {
@@ -1015,7 +1003,7 @@ namespace Apache.Ignite.Core.Tests.Compute
         {
             var enumVal = PlatformComputeEnum.Baz;
 
-            _grid1.GetCache<int, InteropComputeEnumFieldTest>(null)
+            _grid1.GetCache<int, InteropComputeEnumFieldTest>(DefaultCacheName)
                 .Put(EchoTypeEnumField, new InteropComputeEnumFieldTest {InteropEnum = enumVal});
 
             var res = _grid1.GetCompute().ExecuteJavaTask<PlatformComputeEnum>(EchoTask, EchoTypeEnumField);
@@ -1037,7 +1025,7 @@ namespace Apache.Ignite.Core.Tests.Compute
         {
             var guid = Guid.NewGuid();
 
-            _grid1.GetCache<int, object>(null)[EchoTypeIgniteUuid] = new IgniteGuid(guid, 25);
+            _grid1.GetCache<int, object>(DefaultCacheName)[EchoTypeIgniteUuid] = new IgniteGuid(guid, 25);
 
             var res = _grid1.GetCompute().ExecuteJavaTask<IgniteGuid>(EchoTask, EchoTypeIgniteUuid);
 
@@ -1161,7 +1149,7 @@ namespace Apache.Ignite.Core.Tests.Compute
         [Test]
         public void TestAffinityRun()
         {
-            const string cacheName = null;
+            const string cacheName = DefaultCacheName;
 
             // Test keys for non-client nodes
             var nodes = new[] {_grid1, _grid2}.Select(x => x.GetCluster().GetLocalNode());
@@ -1188,7 +1176,7 @@ namespace Apache.Ignite.Core.Tests.Compute
         [Test]
         public void TestAffinityCall()
         {
-            const string cacheName = null;
+            const string cacheName = DefaultCacheName;
 
             // Test keys for non-client nodes
             var nodes = new[] { _grid1, _grid2 }.Select(x => x.GetCluster().GetLocalNode());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
index f01bd57..aa4c4e8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
@@ -42,6 +42,7 @@
         <property name="cacheConfiguration">
             <list>
                 <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="default"/>
                     <property name="startSize" value="10"/>
                     <property name="queryEntities">
                         <list>

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml
index 3990e3b..b428776 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml
@@ -29,7 +29,9 @@
 
         <property name="cacheConfiguration">
             <list>
-                <bean class="org.apache.ignite.configuration.CacheConfiguration" />
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="default"/>
+                </bean>
                 <bean class="org.apache.ignite.configuration.CacheConfiguration">
                     <property name="name" value="cache1"/>
                 </bean>

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-binarizables.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-binarizables.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-binarizables.xml
index 97ec97e..a8309e5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-binarizables.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-binarizables.xml
@@ -56,7 +56,9 @@
 
         <property name="cacheConfiguration">
             <list>
-                <bean class="org.apache.ignite.configuration.CacheConfiguration" />
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                   <property name="name" value="default"/>
+                </bean>
             </list>
         </property>
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-affinity.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-affinity.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-affinity.xml
index 9c7bfb0..610d1dd 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-affinity.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-affinity.xml
@@ -48,6 +48,7 @@
             <list>
                 <bean class="org.apache.ignite.configuration.CacheConfiguration">
                     <property name="cacheMode" value="PARTITIONED"/>
+                    <property name="name" value="default"/>
                 </bean>
             </list>
         </property>

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
index 545a5c5..7578475 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
@@ -42,6 +42,9 @@ namespace Apache.Ignite.Core.Tests
     public class EventsTest
     {
         /** */
+        public const string CacheName = "eventsTest";
+
+        /** */
         private IIgnite _grid1;
 
         /** */
@@ -240,7 +243,7 @@ namespace Apache.Ignite.Core.Tests
                 {
                     EventType = EventType.CacheAll,
                     EventObjectType = typeof (CacheEvent),
-                    GenerateEvent = g => g.GetCache<int, int>(null).Put(TestUtils.GetPrimaryKey(g), 1),
+                    GenerateEvent = g => g.GetCache<int, int>(CacheName).Put(TestUtils.GetPrimaryKey(g, CacheName), 1),
                     VerifyEvents = (e, g) => VerifyCacheEvents(e, g),
                     EventCount = 3
                 };
@@ -699,7 +702,7 @@ namespace Apache.Ignite.Core.Tests
             {
                 IgniteInstanceName = name,
                 EventStorageSpi = new MemoryEventStorageSpi(),
-                CacheConfiguration = new [] {new CacheConfiguration() },
+                CacheConfiguration = new [] {new CacheConfiguration(CacheName) },
                 ClientMode = client
             };
         }
@@ -730,11 +733,11 @@ namespace Apache.Ignite.Core.Tests
         /// </summary>
         private static void GenerateCacheQueryEvent(IIgnite g)
         {
-            var cache = g.GetCache<int, int>(null);
+            var cache = g.GetCache<int, int>(CacheName);
 
             cache.Clear();
 
-            cache.Put(TestUtils.GetPrimaryKey(g), 1);
+            cache.Put(TestUtils.GetPrimaryKey(g, CacheName), 1);
 
             cache.Query(new ScanQuery<int, int>()).GetAll();
         }
@@ -748,7 +751,7 @@ namespace Apache.Ignite.Core.Tests
 
             foreach (var cacheEvent in e)
             {
-                Assert.AreEqual(null, cacheEvent.CacheName);
+                Assert.AreEqual(CacheName, cacheEvent.CacheName);
                 Assert.AreEqual(null, cacheEvent.ClosureClassName);
                 Assert.AreEqual(null, cacheEvent.TaskName);
                 Assert.AreEqual(grid.GetCluster().GetLocalNode(), cacheEvent.EventNode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs
index 2c9a63b..486878a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs
@@ -67,7 +67,7 @@ namespace Apache.Ignite.Core.Tests
         {
             var cfg = new IgniteConfiguration
             {
-                SpringConfigUrl = "config/default-config.xml",
+                SpringConfigUrl = "config\\start-test-grid1.xml",
                 JvmClasspath = TestUtils.CreateTestClasspath()
             };
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MarshallerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MarshallerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MarshallerTest.cs
index 7def56f..030916b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MarshallerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/MarshallerTest.cs
@@ -32,9 +32,9 @@ namespace Apache.Ignite.Core.Tests
         [Test]
         public void TestDefaultMarhsaller()
         {
-            using (var grid = Ignition.Start("config\\marshaller-default.xml"))
+            using (var grid = StartIgnite("config\\marshaller-default.xml"))
             {
-                var cache = grid.GetOrCreateCache<int, int>((string) null);
+                var cache = grid.GetOrCreateCache<int, int>("default");
 
                 cache.Put(1, 1);
 
@@ -49,9 +49,9 @@ namespace Apache.Ignite.Core.Tests
         [Test]
         public void TestExplicitMarhsaller()
         {
-            using (var grid = Ignition.Start("config\\marshaller-explicit.xml"))
+            using (var grid = StartIgnite("config\\marshaller-explicit.xml"))
             {
-                var cache = grid.GetOrCreateCache<int, int>((string) null);
+                var cache = grid.GetOrCreateCache<int, int>("default");
 
                 cache.Put(1, 1);
 
@@ -65,7 +65,21 @@ namespace Apache.Ignite.Core.Tests
         [Test]
         public void TestInvalidMarshaller()
         {
-            Assert.Throws<IgniteException>(() => Ignition.Start("config\\marshaller-invalid.xml"));
+            var ex = Assert.Throws<IgniteException>(() => StartIgnite("config\\marshaller-invalid.xml"));
+            Assert.AreEqual("Unsupported marshaller (only org.apache.ignite.internal.binary.BinaryMarshaller " +
+                            "can be used when running Apache Ignite.NET): org.apache.ignite.internal." +
+                            "marshaller.optimized.OptimizedMarshaller", ex.Message);
+        }
+
+        /// <summary>
+        /// Starts the ignite.
+        /// </summary>
+        private static IIgnite StartIgnite(string xml)
+        {
+            return Ignition.Start(new IgniteConfiguration(TestUtils.GetTestConfiguration())
+            {
+                SpringConfigUrl = xml
+            });
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
index ed12efd..6e0a497 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
@@ -387,7 +387,7 @@ namespace Apache.Ignite.Core.Tests
         /// <summary>
         /// Gets the primary keys.
         /// </summary>
-        public static IEnumerable<int> GetPrimaryKeys(IIgnite ignite, string cacheName = null,
+        public static IEnumerable<int> GetPrimaryKeys(IIgnite ignite, string cacheName,
             IClusterNode node = null)
         {
             var aff = ignite.GetAffinity(cacheName);
@@ -399,7 +399,7 @@ namespace Apache.Ignite.Core.Tests
         /// <summary>
         /// Gets the primary key.
         /// </summary>
-        public static int GetPrimaryKey(IIgnite ignite, string cacheName = null, IClusterNode node = null)
+        public static int GetPrimaryKey(IIgnite ignite, string cacheName, IClusterNode node = null)
         {
             return GetPrimaryKeys(ignite, cacheName, node).First();
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
index 573cfb3..05a8ae3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
@@ -252,7 +252,8 @@ namespace Apache.Ignite.Core
         IgniteConfiguration GetConfiguration();
 
         /// <summary>
-        /// Starts a near cache on local node if cache with specified was previously started.
+        /// Starts a near cache on local client node if cache with specified was previously started.
+        /// This method does not work on server nodes.
         /// </summary>
         /// <param name="name">The name.</param>
         /// <param name="configuration">The configuration.</param>

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Compute.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Compute.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Compute.cs
index 300e944..efe5905 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Compute.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/Compute.cs
@@ -196,12 +196,16 @@ namespace Apache.Ignite.Core.Impl.Compute
         /** <inheritDoc /> */
         public TJobRes AffinityCall<TJobRes>(string cacheName, object affinityKey, IComputeFunc<TJobRes> clo)
         {
+            IgniteArgumentCheck.NotNull(cacheName, "cacheName");
+
             return _compute.AffinityCall(cacheName, affinityKey, clo).Get();
         }
 
         /** <inheritDoc /> */
         public Task<TRes> AffinityCallAsync<TRes>(string cacheName, object affinityKey, IComputeFunc<TRes> clo)
         {
+            IgniteArgumentCheck.NotNull(cacheName, "cacheName");
+
             return _compute.AffinityCall(cacheName, affinityKey, clo).Task;
         }
 
@@ -209,6 +213,8 @@ namespace Apache.Ignite.Core.Impl.Compute
         public Task<TRes> AffinityCallAsync<TRes>(string cacheName, object affinityKey, IComputeFunc<TRes> clo, 
             CancellationToken cancellationToken)
         {
+            IgniteArgumentCheck.NotNull(cacheName, "cacheName");
+
             return GetTaskIfAlreadyCancelled<TRes>(cancellationToken) ??
                 _compute.AffinityCall(cacheName, affinityKey, clo).GetTask(cancellationToken);
         }
@@ -341,12 +347,16 @@ namespace Apache.Ignite.Core.Impl.Compute
         /** <inheritDoc /> */
         public void AffinityRun(string cacheName, object affinityKey, IComputeAction action)
         {
+            IgniteArgumentCheck.NotNull(cacheName, "cacheName");
+
             _compute.AffinityRun(cacheName, affinityKey, action).Get();
         }
 
         /** <inheritDoc /> */
         public Task AffinityRunAsync(string cacheName, object affinityKey, IComputeAction action)
         {
+            IgniteArgumentCheck.NotNull(cacheName, "cacheName");
+
             return _compute.AffinityRun(cacheName, affinityKey, action).Task;
         }
 
@@ -354,6 +364,8 @@ namespace Apache.Ignite.Core.Impl.Compute
         public Task AffinityRunAsync(string cacheName, object affinityKey, IComputeAction action, 
             CancellationToken cancellationToken)
         {
+            IgniteArgumentCheck.NotNull(cacheName, "cacheName");
+
             return GetTaskIfAlreadyCancelled<object>(cancellationToken) ??
                 _compute.AffinityRun(cacheName, affinityKey, action).GetTask(cancellationToken);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
index d36caf3..66e5339 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
@@ -445,6 +445,7 @@ namespace Apache.Ignite.Core.Impl.Compute
         /// <param name="action">Job to execute.</param>
         public Future<object> AffinityRun(string cacheName, object affinityKey, IComputeAction action)
         {
+            IgniteArgumentCheck.NotNull(cacheName, "cacheName");
             IgniteArgumentCheck.NotNull(action, "action");
 
             return ExecuteClosures0(new ComputeSingleClosureTask<object, object, object>(),
@@ -463,6 +464,7 @@ namespace Apache.Ignite.Core.Impl.Compute
         /// <typeparam name="TJobRes">Type of job result.</typeparam>
         public Future<TJobRes> AffinityCall<TJobRes>(string cacheName, object affinityKey, IComputeFunc<TJobRes> clo)
         {
+            IgniteArgumentCheck.NotNull(cacheName, "cacheName");
             IgniteArgumentCheck.NotNull(clo, "clo");
 
             return ExecuteClosures0(new ComputeSingleClosureTask<object, TJobRes, TJobRes>(),

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
index a795459..8fa1f6a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
@@ -386,12 +386,16 @@ namespace Apache.Ignite.Core.Impl
         /** <inheritdoc /> */
         public ICache<TK, TV> GetCache<TK, TV>(string name)
         {
+            IgniteArgumentCheck.NotNull(name, "name");
+
             return Cache<TK, TV>(UU.ProcessorCache(_proc, name));
         }
 
         /** <inheritdoc /> */
         public ICache<TK, TV> GetOrCreateCache<TK, TV>(string name)
         {
+            IgniteArgumentCheck.NotNull(name, "name");
+
             return Cache<TK, TV>(UU.ProcessorGetOrCreateCache(_proc, name));
         }
 
@@ -406,6 +410,7 @@ namespace Apache.Ignite.Core.Impl
             NearCacheConfiguration nearConfiguration)
         {
             IgniteArgumentCheck.NotNull(configuration, "configuration");
+            IgniteArgumentCheck.NotNull(configuration.Name, "CacheConfiguration.Name");
             configuration.Validate(Logger);
 
             using (var stream = IgniteManager.Memory.Allocate().GetStream())
@@ -431,6 +436,8 @@ namespace Apache.Ignite.Core.Impl
         /** <inheritdoc /> */
         public ICache<TK, TV> CreateCache<TK, TV>(string name)
         {
+            IgniteArgumentCheck.NotNull(name, "name");
+
             return Cache<TK, TV>(UU.ProcessorCreateCache(_proc, name));
         }
 
@@ -445,6 +452,7 @@ namespace Apache.Ignite.Core.Impl
             NearCacheConfiguration nearConfiguration)
         {
             IgniteArgumentCheck.NotNull(configuration, "configuration");
+            IgniteArgumentCheck.NotNull(configuration.Name, "CacheConfiguration.Name");
             configuration.Validate(Logger);
 
             using (var stream = IgniteManager.Memory.Allocate().GetStream())
@@ -471,6 +479,8 @@ namespace Apache.Ignite.Core.Impl
         /** <inheritdoc /> */
         public void DestroyCache(string name)
         {
+            IgniteArgumentCheck.NotNull(name, "name");
+
             UU.ProcessorDestroyCache(_proc, name);
         }
 
@@ -528,6 +538,8 @@ namespace Apache.Ignite.Core.Impl
         /** <inheritdoc /> */
         public IDataStreamer<TK, TV> GetDataStreamer<TK, TV>(string cacheName)
         {
+            IgniteArgumentCheck.NotNull(cacheName, "cacheName");
+
             return new DataStreamerImpl<TK, TV>(UU.ProcessorDataStreamer(_proc, cacheName, false),
                 _marsh, cacheName, false);
         }
@@ -541,6 +553,8 @@ namespace Apache.Ignite.Core.Impl
         /** <inheritdoc /> */
         public ICacheAffinity GetAffinity(string cacheName)
         {
+            IgniteArgumentCheck.NotNull(cacheName, "cacheName");
+
             return new CacheAffinityImpl(UU.ProcessorAffinity(_proc, cacheName), _marsh, false, this);
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/scalar/src/main/scala/org/apache/ignite/scalar/scalar.scala
----------------------------------------------------------------------
diff --git a/modules/scalar/src/main/scala/org/apache/ignite/scalar/scalar.scala b/modules/scalar/src/main/scala/org/apache/ignite/scalar/scalar.scala
index 0101e25..35c95fc 100644
--- a/modules/scalar/src/main/scala/org/apache/ignite/scalar/scalar.scala
+++ b/modules/scalar/src/main/scala/org/apache/ignite/scalar/scalar.scala
@@ -258,20 +258,11 @@ object scalar extends ScalarConversions {
     }
 
     /**
-     * Gets default cache.
-     *
-     * Note that you always need to provide types when calling
-     * this function - otherwise Scala will create `Cache[Nothing, Nothing]`
-     * typed instance that cannot be used.
-     */
-    @inline def cache$[K, V]: Option[IgniteCache[K, V]] = Option(Ignition.ignite.cache[K, V](null))
-
-    /**
      * Gets named cache from default grid.
      *
      * @param cacheName Name of the cache to get.
      */
-    @inline def cache$[K, V](@Nullable cacheName: String): Option[IgniteCache[K, V]] =
+    @inline def cache$[K, V](cacheName: String): Option[IgniteCache[K, V]] =
         Option(Ignition.ignite.cache(cacheName))
 
     /**
@@ -279,7 +270,7 @@ object scalar extends ScalarConversions {
      *
      * @param cacheName Name of the cache to get.
      */
-    @inline def createCache$[K, V](@Nullable cacheName: String, cacheMode: CacheMode = CacheMode.PARTITIONED,
+    @inline def createCache$[K, V](cacheName: String, cacheMode: CacheMode = CacheMode.PARTITIONED,
         indexedTypes: Seq[Class[_]] = Seq.empty): IgniteCache[K, V] = {
         val cfg = new CacheConfiguration[K, V]()
 
@@ -295,7 +286,7 @@ object scalar extends ScalarConversions {
       *
       * @param cacheName Name of the cache to destroy.
       */
-    @inline def destroyCache$(@Nullable cacheName: String) = {
+    @inline def destroyCache$(cacheName: String) = {
         Ignition.ignite.destroyCache(cacheName)
     }
 
@@ -306,7 +297,7 @@ object scalar extends ScalarConversions {
      * @param cacheName Name of the cache to get.
      */
     @inline def cache$[K, V](@Nullable igniteInstanceName: String,
-        @Nullable cacheName: String): Option[IgniteCache[K, V]] =
+        cacheName: String): Option[IgniteCache[K, V]] =
         ignite$(igniteInstanceName) match {
             case Some(g) => Option(g.cache(cacheName))
             case None => None
@@ -320,7 +311,7 @@ object scalar extends ScalarConversions {
      * @return New instance of data streamer.
      */
     @inline def dataStreamer$[K, V](
-        @Nullable cacheName: String,
+        cacheName: String,
         bufSize: Int): IgniteDataStreamer[K, V] = {
         val dl = ignite$.dataStreamer[K, V](cacheName)
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/scalar/src/test/resources/spring-cache.xml
----------------------------------------------------------------------
diff --git a/modules/scalar/src/test/resources/spring-cache.xml b/modules/scalar/src/test/resources/spring-cache.xml
index 7c6adc0..210335e0 100644
--- a/modules/scalar/src/test/resources/spring-cache.xml
+++ b/modules/scalar/src/test/resources/spring-cache.xml
@@ -26,6 +26,7 @@
         <property name="cacheConfiguration">
             <list>
                 <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="default"/>
                     <property name="cacheMode" value="PARTITIONED"/>
                     <property name="atomicityMode" value="TRANSACTIONAL"/>
                     <property name="nearConfiguration">

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheQueriesSpec.scala
----------------------------------------------------------------------
diff --git a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheQueriesSpec.scala b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheQueriesSpec.scala
index 2a11e5e..52ddf23 100644
--- a/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheQueriesSpec.scala
+++ b/modules/scalar/src/test/scala/org/apache/ignite/scalar/tests/ScalarCacheQueriesSpec.scala
@@ -51,7 +51,7 @@ class ScalarCacheQueriesSpec extends FunSpec with ShouldMatchers with BeforeAndA
     override def beforeAll() {
         n = start("modules/scalar/src/test/resources/spring-cache.xml").cluster().localNode
 
-        c = cache$[Int, ObjectValue].get
+        c = cache$[Int, ObjectValue]("default").get
 
         (1 to ENTRY_CNT).foreach(i => c.put(i, ObjectValue(i, "str " + WORDS(i))))
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/spark/src/test/java/org/apache/ignite/spark/JavaEmbeddedIgniteRDDSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/spark/src/test/java/org/apache/ignite/spark/JavaEmbeddedIgniteRDDSelfTest.java b/modules/spark/src/test/java/org/apache/ignite/spark/JavaEmbeddedIgniteRDDSelfTest.java
index 59dbbfa..49bb1ac 100644
--- a/modules/spark/src/test/java/org/apache/ignite/spark/JavaEmbeddedIgniteRDDSelfTest.java
+++ b/modules/spark/src/test/java/org/apache/ignite/spark/JavaEmbeddedIgniteRDDSelfTest.java
@@ -305,7 +305,7 @@ public class JavaEmbeddedIgniteRDDSelfTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     private static CacheConfiguration<Object, Object> cacheConfiguration() {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setBackups(1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/spark/src/test/java/org/apache/ignite/spark/JavaStandaloneIgniteRDDSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/spark/src/test/java/org/apache/ignite/spark/JavaStandaloneIgniteRDDSelfTest.java b/modules/spark/src/test/java/org/apache/ignite/spark/JavaStandaloneIgniteRDDSelfTest.java
index 7f5c252..87da627 100644
--- a/modules/spark/src/test/java/org/apache/ignite/spark/JavaStandaloneIgniteRDDSelfTest.java
+++ b/modules/spark/src/test/java/org/apache/ignite/spark/JavaStandaloneIgniteRDDSelfTest.java
@@ -334,7 +334,7 @@ public class JavaStandaloneIgniteRDDSelfTest extends GridCommonAbstractTest {
      * @return cache Configuration.
      */
     private static CacheConfiguration<Object, Object> cacheConfiguration(String name, Class<?> clsK, Class<?> clsV) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setBackups(1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheManagerSelfTest.java b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheManagerSelfTest.java
index 158f898..5a0e759 100644
--- a/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheManagerSelfTest.java
+++ b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheManagerSelfTest.java
@@ -66,7 +66,7 @@ public class GridSpringCacheManagerSelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration cache = new CacheConfiguration();
+        CacheConfiguration cache = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cache.setName(CACHE_NAME);
 
@@ -390,7 +390,7 @@ public class GridSpringCacheManagerSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testDynamicCacheEvict() throws Exception {
-        CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cacheCfg.setName(DYNAMIC_CACHE_NAME);
 
@@ -417,7 +417,7 @@ public class GridSpringCacheManagerSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testDynamicCacheEvictAll() throws Exception {
-        CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cacheCfg.setName(DYNAMIC_CACHE_NAME);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/spring/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStoreFactorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStoreFactorySelfTest.java b/modules/spring/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStoreFactorySelfTest.java
index 6ecf67f..bc4f268 100644
--- a/modules/spring/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStoreFactorySelfTest.java
+++ b/modules/spring/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcBlobStoreFactorySelfTest.java
@@ -92,7 +92,7 @@ public class CacheJdbcBlobStoreFactorySelfTest extends GridCommonAbstractTest {
      * @return Cache configuration with store.
      */
     private CacheConfiguration<Integer, String> cacheConfiguration() {
-        CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         CacheJdbcBlobStoreFactory<Integer, String> factory = new CacheJdbcBlobStoreFactory();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/spring/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactorySelfTest.java b/modules/spring/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactorySelfTest.java
index e354935..9389646 100644
--- a/modules/spring/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactorySelfTest.java
+++ b/modules/spring/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreFactorySelfTest.java
@@ -84,7 +84,7 @@ public class CacheJdbcPojoStoreFactorySelfTest extends GridCommonAbstractTest {
      * @return Cache configuration with store.
      */
     private CacheConfiguration<Integer, String> cacheConfiguration() {
-        CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         CacheJdbcPojoStoreFactory<Integer, String> factory = new CacheJdbcPojoStoreFactory<>();
 
@@ -101,7 +101,7 @@ public class CacheJdbcPojoStoreFactorySelfTest extends GridCommonAbstractTest {
      * @return Cache configuration with store.
      */
     private CacheConfiguration<Integer, String> cacheConfigurationH2Dialect() {
-        CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         CacheJdbcPojoStoreFactory<Integer, String> factory = new CacheJdbcPojoStoreFactory<>();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/spring/src/test/java/org/apache/ignite/internal/IgniteDynamicCacheConfigTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/internal/IgniteDynamicCacheConfigTest.java b/modules/spring/src/test/java/org/apache/ignite/internal/IgniteDynamicCacheConfigTest.java
index ff23dc8..6dad1f4 100644
--- a/modules/spring/src/test/java/org/apache/ignite/internal/IgniteDynamicCacheConfigTest.java
+++ b/modules/spring/src/test/java/org/apache/ignite/internal/IgniteDynamicCacheConfigTest.java
@@ -74,7 +74,7 @@ public class IgniteDynamicCacheConfigTest extends GridCommonAbstractTest {
 
         cfg.setUserAttributes(F.asMap(TEST_ATTRIBUTE_NAME, testAttribute));
 
-        CacheConfiguration cacheCfg = new CacheConfiguration();
+        CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cacheCfg.setCacheMode(CacheMode.REPLICATED);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/spring/src/test/java/org/apache/ignite/internal/processors/resource/GridTransformSpringInjectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/internal/processors/resource/GridTransformSpringInjectionSelfTest.java b/modules/spring/src/test/java/org/apache/ignite/internal/processors/resource/GridTransformSpringInjectionSelfTest.java
index 09ff15c..dcf42c0 100644
--- a/modules/spring/src/test/java/org/apache/ignite/internal/processors/resource/GridTransformSpringInjectionSelfTest.java
+++ b/modules/spring/src/test/java/org/apache/ignite/internal/processors/resource/GridTransformSpringInjectionSelfTest.java
@@ -99,7 +99,7 @@ public class GridTransformSpringInjectionSelfTest extends GridCacheAbstractSelfT
      * @return Cache configuration.
      */
     private CacheConfiguration<String, Integer> cacheConfiguration(CacheAtomicityMode atomicityMode) {
-        CacheConfiguration<String, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<String, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setName(getClass().getSimpleName());
         ccfg.setAtomicityMode(atomicityMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/spring/src/test/java/org/apache/ignite/p2p/GridP2PUserVersionChangeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/p2p/GridP2PUserVersionChangeSelfTest.java b/modules/spring/src/test/java/org/apache/ignite/p2p/GridP2PUserVersionChangeSelfTest.java
index dbc5b25..b861e19 100644
--- a/modules/spring/src/test/java/org/apache/ignite/p2p/GridP2PUserVersionChangeSelfTest.java
+++ b/modules/spring/src/test/java/org/apache/ignite/p2p/GridP2PUserVersionChangeSelfTest.java
@@ -102,7 +102,7 @@ public class GridP2PUserVersionChangeSelfTest extends GridCommonAbstractTest {
         cfg.setDiscoverySpi(discoSpi);
 
         if (igniteInstanceName.contains("testCacheRedeployVersionChangeContinuousMode")) {
-            CacheConfiguration cacheCfg = new CacheConfiguration();
+            CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             cacheCfg.setCacheMode(CacheMode.REPLICATED);
 
@@ -299,13 +299,13 @@ public class GridP2PUserVersionChangeSelfTest extends GridCommonAbstractTest {
 
             Class rcrsCls = ldr.loadClass(TEST_RCRS_NAME);
 
-            IgniteCache<Long, Object> cache1 = ignite1.cache(null);
+            IgniteCache<Long, Object> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
 
             assertNotNull(cache1);
 
             cache1.put(1L, rcrsCls.newInstance());
 
-            final IgniteCache<Long, Object> cache2 = ignite2.cache(null);
+            final IgniteCache<Long, Object> cache2 = ignite2.cache(DEFAULT_CACHE_NAME);
 
             assertNotNull(cache2);
 
@@ -325,7 +325,7 @@ public class GridP2PUserVersionChangeSelfTest extends GridCommonAbstractTest {
 
             ignite1 = startGrid("testCacheRedeployVersionChangeContinuousMode1");
 
-            cache1 = ignite1.cache(null);
+            cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
 
             assertNotNull(cache1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/spring/src/test/java/org/apache/ignite/spring/IgniteStartFromStreamConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/IgniteStartFromStreamConfigurationTest.java b/modules/spring/src/test/java/org/apache/ignite/spring/IgniteStartFromStreamConfigurationTest.java
index 421011f..2307a35 100644
--- a/modules/spring/src/test/java/org/apache/ignite/spring/IgniteStartFromStreamConfigurationTest.java
+++ b/modules/spring/src/test/java/org/apache/ignite/spring/IgniteStartFromStreamConfigurationTest.java
@@ -41,9 +41,9 @@ public class IgniteStartFromStreamConfigurationTest extends GridCommonAbstractTe
         URL cfgLocation = U.resolveIgniteUrl(cfg);
 
         try (Ignite grid = Ignition.start(new FileInputStream(cfgLocation.getFile()))) {
-            grid.cache(null).put("1", "1");
+            grid.cache(DEFAULT_CACHE_NAME).put("1", "1");
 
-            assert grid.cache(null).get("1").equals("1");
+            assert grid.cache(DEFAULT_CACHE_NAME).get("1").equals("1");
 
             IgniteConfiguration icfg = Ignition.loadSpringBean(new FileInputStream(cfgLocation.getFile()), "ignite.cfg");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/spring/src/test/java/org/apache/ignite/transactions/spring/GridSpringTransactionManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/transactions/spring/GridSpringTransactionManagerSelfTest.java b/modules/spring/src/test/java/org/apache/ignite/transactions/spring/GridSpringTransactionManagerSelfTest.java
index e119d81..3014706 100644
--- a/modules/spring/src/test/java/org/apache/ignite/transactions/spring/GridSpringTransactionManagerSelfTest.java
+++ b/modules/spring/src/test/java/org/apache/ignite/transactions/spring/GridSpringTransactionManagerSelfTest.java
@@ -50,7 +50,7 @@ public class GridSpringTransactionManagerSelfTest extends GridCommonAbstractTest
     protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration cache = new CacheConfiguration();
+        CacheConfiguration cache = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cache.setName(CACHE_NAME);
         cache.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/twitter/src/test/java/org/apache/ignite/stream/twitter/IgniteTwitterStreamerTest.java
----------------------------------------------------------------------
diff --git a/modules/twitter/src/test/java/org/apache/ignite/stream/twitter/IgniteTwitterStreamerTest.java b/modules/twitter/src/test/java/org/apache/ignite/stream/twitter/IgniteTwitterStreamerTest.java
index f6d51a7..2210a27 100644
--- a/modules/twitter/src/test/java/org/apache/ignite/stream/twitter/IgniteTwitterStreamerTest.java
+++ b/modules/twitter/src/test/java/org/apache/ignite/stream/twitter/IgniteTwitterStreamerTest.java
@@ -93,7 +93,7 @@ public class IgniteTwitterStreamerTest extends GridCommonAbstractTest {
      * @throws Exception Test exception.
      */
     public void testStatusesFilterEndpointOAuth1() throws Exception {
-        try (IgniteDataStreamer<Long, String> dataStreamer = grid().dataStreamer(null)) {
+        try (IgniteDataStreamer<Long, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) {
             TwitterStreamerImpl streamer = newStreamerInstance(dataStreamer);
 
             Map<String, String> params = new HashMap<>();
@@ -153,7 +153,7 @@ public class IgniteTwitterStreamerTest extends GridCommonAbstractTest {
 
         Status status = TwitterObjectFactory.createStatus(tweet);
 
-        IgniteCache<Long, String> cache = grid().cache(null);
+        IgniteCache<Long, String> cache = grid().cache(DEFAULT_CACHE_NAME);
 
         String cachedValue = cache.get(status.getId());
 
@@ -173,7 +173,7 @@ public class IgniteTwitterStreamerTest extends GridCommonAbstractTest {
         // Listen to cache PUT events and expect as many as messages as test data items.
         CacheListener listener = new CacheListener();
 
-        ignite.events(ignite.cluster().forCacheNodes(null)).localListen(listener, EVT_CACHE_OBJECT_PUT);
+        ignite.events(ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME)).localListen(listener, EVT_CACHE_OBJECT_PUT);
 
         return listener;
     }
@@ -184,7 +184,7 @@ public class IgniteTwitterStreamerTest extends GridCommonAbstractTest {
     private void unsubscribeToPutEvents(CacheListener listener) {
         Ignite ignite = grid();
 
-        ignite.events(ignite.cluster().forCacheNodes(null)).stopLocalListen(listener, EVT_CACHE_OBJECT_PUT);
+        ignite.events(ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME)).stopLocalListen(listener, EVT_CACHE_OBJECT_PUT);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala
index fb2f8cb..59e6b39 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheClearCommandSpec.scala
@@ -17,17 +17,15 @@
 
 package org.apache.ignite.visor.commands.cache
 
-import org.apache.ignite.cache.{CacheMode, CacheAtomicityMode}
+import org.apache.ignite.cache.{CacheAtomicityMode, CacheMode}
 import CacheAtomicityMode._
 import CacheMode._
 import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor}
-
 import org.apache.ignite.Ignition
 import org.apache.ignite.configuration.{CacheConfiguration, IgniteConfiguration}
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder
-import org.jetbrains.annotations.Nullable
-
+import org.jetbrains.annotations.{NotNull, Nullable}
 import org.apache.ignite.visor.commands.cache.VisorCacheCommand._
 
 import scala.collection.JavaConversions._
@@ -50,7 +48,7 @@ class VisorCacheClearCommandSpec extends VisorRuntimeBaseSpec(2) {
 
         cfg.setIgniteInstanceName(name)
         cfg.setLocalHost("127.0.0.1")
-        cfg.setCacheConfiguration(cacheConfig(null), cacheConfig("cache"))
+        cfg.setCacheConfiguration(cacheConfig("cache"))
 
         val discoSpi = new TcpDiscoverySpi()
 
@@ -65,7 +63,7 @@ class VisorCacheClearCommandSpec extends VisorRuntimeBaseSpec(2) {
      * @param name Cache name.
      * @return Cache Configuration.
      */
-    def cacheConfig(@Nullable name: String): CacheConfiguration[Object, Object] = {
+    def cacheConfig(@NotNull name: String): CacheConfiguration[Object, Object] = {
         val cfg = new CacheConfiguration[Object, Object]
 
         cfg.setCacheMode(REPLICATED)
@@ -76,20 +74,6 @@ class VisorCacheClearCommandSpec extends VisorRuntimeBaseSpec(2) {
     }
 
     describe("An 'cclear' visor command") {
-        it("should show correct result for default cache") {
-            Ignition.ignite("node-1").cache[Int, Int](null).putAll(Map(1 -> 1, 2 -> 2, 3 -> 3))
-
-            val lock = Ignition.ignite("node-1").cache[Int, Int](null).lock(1)
-
-            lock.lock()
-
-            VisorCacheClearCommand().clear(Nil, None)
-
-            lock.unlock()
-
-            VisorCacheClearCommand().clear(Nil, None)
-        }
-
         it("should show correct result for named cache") {
             Ignition.ignite("node-1").cache[Int, Int]("cache").putAll(Map(1 -> 1, 2 -> 2, 3 -> 3))
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala
index 5aff431..384aae0 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommandSpec.scala
@@ -44,7 +44,7 @@ class VisorCacheCommandSpec extends VisorRuntimeBaseSpec(1) {
      * @param name Cache name.
      * @return Cache Configuration.
      */
-    def cacheConfig(@Nullable name: String): CacheConfiguration[Object, Object] = {
+    def cacheConfig(@NotNull name: String): CacheConfiguration[Object, Object] = {
         val cfg = new CacheConfiguration[Object, Object]
 
         cfg.setCacheMode(REPLICATED)


[24/51] [abbrv] ignite git commit: IGNITE-3487: hidden _key and _val columns - Fixes #1865.

Posted by sb...@apache.org.
IGNITE-3487: hidden _key and _val columns - Fixes #1865.

Signed-off-by: Sergi Vladykin <se...@gmail.com>


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

Branch: refs/heads/ignite-5075-cacheStart
Commit: efb7abce8323e0dc3449d7ce1bcd1d9558e6f2bc
Parents: 760cf95
Author: devozerov <vo...@gridgain.com>
Authored: Wed Apr 26 17:17:12 2017 +0300
Committer: Sergi Vladykin <se...@gmail.com>
Committed: Wed Apr 26 17:17:12 2017 +0300

----------------------------------------------------------------------
 .../jdbc2/JdbcAbstractDmlStatementSelfTest.java |   6 +
 .../internal/jdbc2/JdbcMetadataSelfTest.java    |  28 +-
 .../ignite/jdbc/JdbcMetadataSelfTest.java       |   8 +-
 .../org/apache/ignite/cache/QueryEntity.java    |  81 ++++
 .../configuration/CacheConfiguration.java       |  12 +-
 .../cache/query/GridCacheQueryManager.java      |  14 +-
 .../utils/PlatformConfigurationUtils.java       |   6 +
 .../query/GridQueryTypeDescriptor.java          |  12 +
 .../query/QueryTypeDescriptorImpl.java          |  34 +-
 .../internal/processors/query/QueryUtils.java   | 134 +++++--
 .../query/h2/DmlStatementsProcessor.java        |  17 +-
 .../processors/query/h2/IgniteH2Indexing.java   | 191 ++++++++-
 .../query/h2/dml/UpdatePlanBuilder.java         |  32 +-
 .../query/h2/opt/GridH2AbstractKeyValueRow.java |  78 ++--
 .../query/h2/opt/GridH2CollocationModel.java    |   4 +-
 .../query/h2/opt/GridH2IndexBase.java           |  15 +-
 .../query/h2/opt/GridH2KeyValueRowOffheap.java  |   6 +-
 .../query/h2/opt/GridH2KeyValueRowOnheap.java   |   6 +-
 .../query/h2/opt/GridH2ProxyIndex.java          | 204 ++++++++++
 .../query/h2/opt/GridH2ProxySpatialIndex.java   |  70 ++++
 .../query/h2/opt/GridH2RowDescriptor.java       |  67 ++++
 .../processors/query/h2/opt/GridH2Table.java    | 114 +++++-
 .../query/h2/opt/GridLuceneIndex.java           |   4 +-
 .../processors/query/h2/sql/DmlAstUtils.java    |  36 +-
 .../IgniteBinaryObjectQueryArgumentsTest.java   |   4 +-
 .../IgniteCacheAbstractFieldsQuerySelfTest.java |  15 +-
 .../IgniteCacheDeleteSqlQuerySelfTest.java      |   6 +-
 .../IgniteCacheUpdateSqlQuerySelfTest.java      |   8 +-
 .../cache/index/AbstractSchemaSelfTest.java     |   3 +
 .../index/DynamicIndexAbstractSelfTest.java     |   3 +
 .../query/IgniteSqlKeyValueFieldsTest.java      | 392 +++++++++++++++++++
 .../query/IgniteSqlSplitterSelfTest.java        |   8 +-
 .../h2/GridIndexingSpiAbstractSelfTest.java     |  10 +
 .../query/h2/sql/GridQueryParsingTest.java      |   2 +-
 .../IgniteCacheQuerySelfTestSuite.java          |   2 +
 .../core-test/config/cache-query-default.xml    |   6 +
 .../cpp/core-test/src/cache_query_test.cpp      |  82 ++++
 .../cpp/odbc-test/config/queries-default.xml    |   5 +
 .../cpp/odbc-test/include/complex_type.h        |  25 ++
 .../cpp/odbc-test/src/queries_test.cpp          | 148 +++++++
 .../Cache/Query/CacheLinqTest.cs                |   7 +
 .../Cache/Query/CacheQueriesTest.cs             |  52 +++
 .../IgniteConfigurationSerializerTest.cs        |   4 +-
 .../Cache/Configuration/QueryEntity.cs          |  20 +
 .../IgniteConfigurationSection.xsd              |  14 +
 .../Impl/CacheQueryExpressionVisitor.cs         |  14 +-
 .../Impl/CacheQueryModelVisitor.cs              |  12 +-
 47 files changed, 1822 insertions(+), 199 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
index f23dde7..90f52bd 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
@@ -44,6 +44,9 @@ public abstract class JdbcAbstractDmlStatementSelfTest extends GridCommonAbstrac
     /** SQL SELECT query for verification. */
     static final String SQL_SELECT = "select _key, id, firstName, lastName, age from Person";
 
+    /** Alias for _key */
+    private static final String KEY_ALIAS = "key";
+
     /** Connection. */
     protected Connection conn;
 
@@ -97,6 +100,9 @@ public abstract class JdbcAbstractDmlStatementSelfTest extends GridCommonAbstrac
         e.setKeyType(String.class.getName());
         e.setValueType("Person");
 
+        e.setKeyFieldName(KEY_ALIAS);
+
+        e.addQueryField(KEY_ALIAS, e.getKeyType(), null);
         e.addQueryField("id", Integer.class.getName(), null);
         e.addQueryField("age", Integer.class.getName(), null);
         e.addQueryField("firstName", String.class.getName(), null);

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
index 750af74..ebf8874 100755
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
@@ -203,8 +203,6 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
             names.add("NAME");
             names.add("AGE");
             names.add("ORGID");
-            names.add("_KEY");
-            names.add("_VAL");
 
             int cnt = 0;
 
@@ -222,22 +220,12 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
                     assertEquals("INTEGER", rs.getString("TYPE_NAME"));
                     assertEquals(0, rs.getInt("NULLABLE"));
                 }
-                if ("_KEY".equals(name)) {
-                    assertEquals(OTHER, rs.getInt("DATA_TYPE"));
-                    assertEquals("OTHER", rs.getString("TYPE_NAME"));
-                    assertEquals(0, rs.getInt("NULLABLE"));
-                }
-                if ("_VAL".equals(name)) {
-                    assertEquals(OTHER, rs.getInt("DATA_TYPE"));
-                    assertEquals("OTHER", rs.getString("TYPE_NAME"));
-                    assertEquals(0, rs.getInt("NULLABLE"));
-                }
 
                 cnt++;
             }
 
             assertTrue(names.isEmpty());
-            assertEquals(5, cnt);
+            assertEquals(3, cnt);
 
             rs = meta.getColumns("", "org", "Organization", "%");
 
@@ -245,8 +233,6 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
 
             names.add("ID");
             names.add("NAME");
-            names.add("_KEY");
-            names.add("_VAL");
 
             cnt = 0;
 
@@ -264,22 +250,12 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
                     assertEquals("VARCHAR", rs.getString("TYPE_NAME"));
                     assertEquals(1, rs.getInt("NULLABLE"));
                 }
-                if ("_KEY".equals(name)) {
-                    assertEquals(VARCHAR, rs.getInt("DATA_TYPE"));
-                    assertEquals("VARCHAR", rs.getString("TYPE_NAME"));
-                    assertEquals(0, rs.getInt("NULLABLE"));
-                }
-                if ("_VAL".equals(name)) {
-                    assertEquals(OTHER, rs.getInt("DATA_TYPE"));
-                    assertEquals("OTHER", rs.getString("TYPE_NAME"));
-                    assertEquals(0, rs.getInt("NULLABLE"));
-                }
 
                 cnt++;
             }
 
             assertTrue(names.isEmpty());
-            assertEquals(4, cnt);
+            assertEquals(2, cnt);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcMetadataSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcMetadataSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcMetadataSelfTest.java
index 3ba5ed2..a02f489 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcMetadataSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcMetadataSelfTest.java
@@ -195,8 +195,6 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
             names.add("NAME");
             names.add("AGE");
             names.add("ORGID");
-            names.add("_KEY");
-            names.add("_VAL");
 
             int cnt = 0;
 
@@ -229,7 +227,7 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
             }
 
             assert names.isEmpty();
-            assert cnt == 5;
+            assert cnt == 3;
 
             rs = meta.getColumns("", "org", "Organization", "%");
 
@@ -237,8 +235,6 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
 
             names.add("ID");
             names.add("NAME");
-            names.add("_KEY");
-            names.add("_VAL");
 
             cnt = 0;
 
@@ -271,7 +267,7 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
             }
 
             assert names.isEmpty();
-            assert cnt == 4;
+            assert cnt == 2;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java b/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java
index 806cd7d..31d89a3 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/QueryEntity.java
@@ -45,6 +45,12 @@ public class QueryEntity implements Serializable {
     /** Value type. */
     private String valType;
 
+    /** Key name. Can be used in field list to denote the key as a whole. */
+    private String keyFieldName;
+
+    /** Value name. Can be used in field list to denote the entire value. */
+    private String valueFieldName;
+
     /** Fields available for query. A map from field name to type name. */
     @GridToStringInclude
     private LinkedHashMap<String, String> fields = new LinkedHashMap<>();
@@ -80,6 +86,9 @@ public class QueryEntity implements Serializable {
         keyType = other.keyType;
         valType = other.valType;
 
+        keyFieldName = other.keyFieldName;
+        valueFieldName = other.valueFieldName;
+
         fields = new LinkedHashMap<>(other.fields);
         keyFields = other.keyFields != null ? new HashSet<>(other.keyFields) : null;
 
@@ -110,6 +119,21 @@ public class QueryEntity implements Serializable {
     }
 
     /**
+     * Attempts to get key type from fields in case it was not set directly.
+     *
+     * @return Key type.
+     */
+    public String findKeyType() {
+        if (keyType != null)
+            return keyType;
+
+        if (fields != null && keyFieldName != null)
+            return fields.get(keyFieldName);
+
+        return null;
+    }
+
+    /**
      * Sets key type for this query pair.
      *
      * @param keyType Key type.
@@ -131,6 +155,21 @@ public class QueryEntity implements Serializable {
     }
 
     /**
+     * Attempts to get value type from fields in case it was not set directly.
+     *
+     * @return Value type.
+     */
+    public String findValueType() {
+        if (valType != null)
+            return valType;
+
+        if (fields != null && valueFieldName != null)
+            return fields.get(valueFieldName);
+
+        return null;
+    }
+
+    /**
      * Sets value type for this query pair.
      *
      * @param valType Value type.
@@ -191,6 +230,48 @@ public class QueryEntity implements Serializable {
     }
 
     /**
+     * Gets key field name.
+     *
+     * @return Key name.
+     */
+    public String getKeyFieldName() {
+        return keyFieldName;
+    }
+
+    /**
+     * Sets key field name.
+     *
+     * @param keyFieldName Key name.
+     * @return {@code this} for chaining.
+     */
+    public QueryEntity setKeyFieldName(String keyFieldName) {
+        this.keyFieldName = keyFieldName;
+
+        return this;
+    }
+
+    /**
+     * Get value field name.
+     *
+     * @return Value name.
+     */
+    public String getValueFieldName() {
+        return valueFieldName;
+    }
+
+    /**
+     * Sets value field name.
+     *
+     * @param valueFieldName value name.
+     * @return {@code this} for chaining.
+     */
+    public QueryEntity setValueFieldName(String valueFieldName) {
+        this.valueFieldName = valueFieldName;
+
+        return this;
+    }
+
+    /**
      * Gets a collection of index entities.
      *
      * @return Collection of index entities.

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 8a3874f..275a21e 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -1749,7 +1749,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
             boolean dup = false;
 
             for (QueryEntity entity : qryEntities) {
-                if (F.eq(entity.getValueType(), converted.getValueType())) {
+                if (F.eq(entity.findValueType(), converted.findValueType())) {
                     dup = true;
 
                     break;
@@ -1832,7 +1832,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
             boolean found = false;
 
             for (QueryEntity existing : this.qryEntities) {
-                if (F.eq(entity.getValueType(), existing.getValueType())) {
+                if (F.eq(entity.findValueType(), existing.findValueType())) {
                     found = true;
 
                     break;
@@ -2032,10 +2032,10 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
 
                 txtIdx.setIndexType(QueryIndexType.FULLTEXT);
 
-                txtIdx.setFieldNames(Arrays.asList(QueryUtils._VAL), true);
+                txtIdx.setFieldNames(Arrays.asList(QueryUtils.VAL_FIELD_NAME), true);
             }
             else
-                txtIdx.getFields().put(QueryUtils._VAL, true);
+                txtIdx.getFields().put(QueryUtils.VAL_FIELD_NAME, true);
         }
 
         if (txtIdx != null)
@@ -2089,12 +2089,12 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
         @Nullable ClassProperty parent) {
         if (U.isJdk(cls) || QueryUtils.isGeometryClass(cls)) {
             if (parent == null && !key && QueryUtils.isSqlType(cls)) { // We have to index primitive _val.
-                String idxName = cls.getSimpleName() + "_" + QueryUtils._VAL + "_idx";
+                String idxName = cls.getSimpleName() + "_" + QueryUtils.VAL_FIELD_NAME + "_idx";
 
                 type.addIndex(idxName, QueryUtils.isGeometryClass(cls) ?
                     QueryIndexType.GEOSPATIAL : QueryIndexType.SORTED);
 
-                type.addFieldToIndex(idxName, QueryUtils._VAL, 0, false);
+                type.addFieldToIndex(idxName, QueryUtils.VAL_FIELD_NAME, 0, false);
             }
 
             return;

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index 900e96f..0f7b0df 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -2031,6 +2031,12 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
         /** */
         private static final long serialVersionUID = 0L;
 
+        /**
+         * Number of fields to report when no fields defined.
+         * Includes _key and _val columns.
+         */
+        private static final int NO_FIELDS_COLUMNS_COUNT = 2;
+
         /** Grid */
         @IgniteInstanceResource
         private Ignite ignite;
@@ -2073,13 +2079,15 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
                         keyClasses.put(type.name(), type.keyClass().getName());
                         valClasses.put(type.name(), type.valueClass().getName());
 
-                        int size = 2 + type.fields().size();
+                        int size = type.fields().isEmpty() ? NO_FIELDS_COLUMNS_COUNT : type.fields().size();
 
                         Map<String, String> fieldsMap = U.newLinkedHashMap(size);
 
                         // _KEY and _VAL are not included in GridIndexingTypeDescriptor.valueFields
-                        fieldsMap.put("_KEY", type.keyClass().getName());
-                        fieldsMap.put("_VAL", type.valueClass().getName());
+                        if (type.fields().isEmpty()) {
+                            fieldsMap.put("_KEY", type.keyClass().getName());
+                            fieldsMap.put("_VAL", type.valueClass().getName());
+                        }
 
                         for (Map.Entry<String, Class<?>> e : type.fields().entrySet())
                             fieldsMap.put(e.getKey().toUpperCase(), e.getValue().getName());

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index eb3e716..9bbf5d6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
@@ -493,6 +493,9 @@ public class PlatformConfigurationUtils {
             res.setIndexes(indexes);
         }
 
+        res.setKeyFieldName(in.readString());
+        res.setValueFieldName(in.readString());
+
         return res;
     }
 
@@ -909,6 +912,9 @@ public class PlatformConfigurationUtils {
         }
         else
             writer.writeInt(0);
+
+        writer.writeString(queryEntity.getKeyFieldName());
+        writer.writeString(queryEntity.getValueFieldName());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryTypeDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryTypeDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryTypeDescriptor.java
index b7434d3..3c75ac4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryTypeDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryTypeDescriptor.java
@@ -133,4 +133,16 @@ public interface GridQueryTypeDescriptor {
      * @return BinaryObject's type ID if indexed value is BinaryObject, otherwise value class' hash code.
      */
     public int typeId();
+
+    /**
+     * Gets key field name.
+     * @return Key field name.
+     */
+    public String keyFieldName();
+
+    /**
+     * Gets value field name.
+     * @return value field name.
+     */
+    public String valueFieldName();
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryTypeDescriptorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryTypeDescriptorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryTypeDescriptorImpl.java
index 119a389..56c6aa5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryTypeDescriptorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryTypeDescriptorImpl.java
@@ -90,6 +90,12 @@ public class QueryTypeDescriptorImpl implements GridQueryTypeDescriptor {
     /** */
     private String affKey;
 
+    /** */
+    private String keyFieldName;
+
+    /** */
+    private String valFieldName;
+
     /** Obsolete. */
     private volatile boolean obsolete;
 
@@ -265,7 +271,7 @@ public class QueryTypeDescriptorImpl implements GridQueryTypeDescriptor {
      * @return {@code True} if exists.
      */
     public boolean hasField(String field) {
-        return props.containsKey(field) || QueryUtils._VAL.equalsIgnoreCase(field);
+        return props.containsKey(field) || QueryUtils.VAL_FIELD_NAME.equalsIgnoreCase(field);
     }
 
     /**
@@ -415,4 +421,30 @@ public class QueryTypeDescriptorImpl implements GridQueryTypeDescriptor {
     @Override public String toString() {
         return S.toString(QueryTypeDescriptorImpl.class, this);
     }
+
+    /**
+     * Sets key field name.
+     * @param keyFieldName Key field name.
+     */
+    public void keyFieldName(String keyFieldName) {
+        this.keyFieldName = keyFieldName;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String keyFieldName() {
+        return keyFieldName;
+    }
+
+    /**
+     * Sets value field name.
+     * @param valueFieldName value field name.
+     */
+    public void valueFieldName(String valueFieldName) {
+        this.valFieldName = valueFieldName;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String valueFieldName() {
+        return valFieldName;
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
index e56f39f..1a80a37 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
@@ -45,8 +45,10 @@ import java.lang.reflect.Method;
 import java.math.BigDecimal;
 import java.sql.Time;
 import java.sql.Timestamp;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -60,8 +62,15 @@ import static org.apache.ignite.IgniteSystemProperties.getInteger;
  * Utility methods for queries.
  */
 public class QueryUtils {
-    /** */
-    public static final String _VAL = "_val";
+
+    /** Field name for key. */
+    public static final String KEY_FIELD_NAME = "_key";
+
+    /** Field name for value. */
+    public static final String VAL_FIELD_NAME = "_val";
+
+    /** Version field name. */
+    public static final String VER_FIELD_NAME = "_ver";
 
     /** Discovery history size. */
     private static final int DISCO_HIST_SIZE = getInteger(IGNITE_INDEXING_DISCOVERY_HISTORY_SIZE, 1000);
@@ -98,7 +107,7 @@ public class QueryUtils {
         String res = entity.getTableName();
 
         if (res == null)
-            res = typeName(entity.getValueType());
+            res = typeName(entity.findValueType());
 
         return res;
     }
@@ -176,8 +185,8 @@ public class QueryUtils {
 
         // Key and value classes still can be available if they are primitive or JDK part.
         // We need that to set correct types for _key and _val columns.
-        Class<?> keyCls = U.classForName(qryEntity.getKeyType(), null);
-        Class<?> valCls = U.classForName(qryEntity.getValueType(), null);
+        Class<?> keyCls = U.classForName(qryEntity.findKeyType(), null);
+        Class<?> valCls = U.classForName(qryEntity.findValueType(), null);
 
         // If local node has the classes and they are externalizable, we must use reflection properties.
         boolean keyMustDeserialize = mustDeserializeBinary(ctx, keyCls);
@@ -188,7 +197,7 @@ public class QueryUtils {
         if (keyCls == null)
             keyCls = Object.class;
 
-        String simpleValType = ((valCls == null) ? typeName(qryEntity.getValueType()) : typeName(valCls));
+        String simpleValType = ((valCls == null) ? typeName(qryEntity.findValueType()) : typeName(valCls));
 
         desc.name(simpleValType);
 
@@ -209,14 +218,17 @@ public class QueryUtils {
         else {
             if (valCls == null)
                 throw new IgniteCheckedException("Failed to find value class in the node classpath " +
-                    "(use default marshaller to enable binary objects) : " + qryEntity.getValueType());
+                    "(use default marshaller to enable binary objects) : " + qryEntity.findValueType());
 
             desc.valueClass(valCls);
             desc.keyClass(keyCls);
         }
 
-        desc.keyTypeName(qryEntity.getKeyType());
-        desc.valueTypeName(qryEntity.getValueType());
+        desc.keyTypeName(qryEntity.findKeyType());
+        desc.valueTypeName(qryEntity.findValueType());
+
+        desc.keyFieldName(qryEntity.getKeyFieldName());
+        desc.valueFieldName(qryEntity.getValueFieldName());
 
         if (binaryEnabled && keyOrValMustDeserialize) {
             if (keyMustDeserialize)
@@ -232,14 +244,14 @@ public class QueryUtils {
         if (valCls == null || (binaryEnabled && !keyOrValMustDeserialize)) {
             processBinaryMeta(ctx, qryEntity, desc);
 
-            typeId = new QueryTypeIdKey(space, ctx.cacheObjects().typeId(qryEntity.getValueType()));
+            typeId = new QueryTypeIdKey(space, ctx.cacheObjects().typeId(qryEntity.findValueType()));
 
             if (valCls != null)
                 altTypeId = new QueryTypeIdKey(space, valCls);
 
-            if (!cctx.customAffinityMapper() && qryEntity.getKeyType() != null) {
+            if (!cctx.customAffinityMapper() && qryEntity.findKeyType() != null) {
                 // Need to setup affinity key for distributed joins.
-                String affField = ctx.cacheObjects().affinityField(qryEntity.getKeyType());
+                String affField = ctx.cacheObjects().affinityField(qryEntity.findKeyType());
 
                 if (affField != null)
                     desc.affinityKey(affField);
@@ -259,7 +271,7 @@ public class QueryUtils {
             }
 
             typeId = new QueryTypeIdKey(space, valCls);
-            altTypeId = new QueryTypeIdKey(space, ctx.cacheObjects().typeId(qryEntity.getValueType()));
+            altTypeId = new QueryTypeIdKey(space, ctx.cacheObjects().typeId(qryEntity.findValueType()));
         }
 
         return new QueryTypeCandidate(typeId, altTypeId, desc);
@@ -310,7 +322,7 @@ public class QueryUtils {
 
         processIndexes(qryEntity, d);
     }
-    
+
     /**
      * Processes declarative metadata for binary object.
      *
@@ -321,9 +333,11 @@ public class QueryUtils {
     public static void processClassMeta(QueryEntity qryEntity, QueryTypeDescriptorImpl d, CacheObjectContext coCtx)
         throws IgniteCheckedException {
         for (Map.Entry<String, String> entry : qryEntity.getFields().entrySet()) {
-            QueryClassProperty prop = buildClassProperty(
+            GridQueryProperty prop = buildProperty(
                 d.keyClass(),
                 d.valueClass(),
+                d.keyFieldName(),
+                d.valueFieldName(),
                 entry.getKey(),
                 U.classForName(entry.getValue(), Object.class),
                 d.aliases(),
@@ -429,7 +443,7 @@ public class QueryUtils {
         else
             throw new IllegalArgumentException("Index type is not set: " + idx.getName());
     }
-    
+
     /**
      * Builds binary object property.
      *
@@ -443,7 +457,7 @@ public class QueryUtils {
      * @return Binary property.
      */
     public static QueryBinaryProperty buildBinaryProperty(GridKernalContext ctx, String pathStr, Class<?> resType,
-        Map<String, String> aliases, @Nullable Boolean isKeyField) throws IgniteCheckedException {
+                                     Map<String, String> aliases, @Nullable Boolean isKeyField) throws IgniteCheckedException {
         String[] path = pathStr.split("\\.");
 
         QueryBinaryProperty res = null;
@@ -464,7 +478,7 @@ public class QueryUtils {
 
         return res;
     }
-    
+
     /**
      * @param keyCls Key class.
      * @param valCls Value class.
@@ -494,6 +508,33 @@ public class QueryUtils {
     }
 
     /**
+     * @param keyCls Key class.
+     * @param valCls Value class.
+     * @param keyFieldName Key Field.
+     * @param valueFieldName Value Field.
+     * @param pathStr Path string.
+     * @param resType Result type.
+     * @param aliases Aliases.
+     * @return Class property.
+     * @throws IgniteCheckedException If failed.
+     */
+    public static GridQueryProperty buildProperty(Class<?> keyCls, Class<?> valCls, String keyFieldName, String valueFieldName, String pathStr,
+                                                  Class<?> resType, Map<String,String> aliases, CacheObjectContext coCtx) throws IgniteCheckedException {
+        if (pathStr.equals(keyFieldName))
+            return new KeyOrValProperty(true, pathStr, keyCls);
+
+        if (pathStr.equals(valueFieldName))
+            return new KeyOrValProperty(false, pathStr, valCls);
+
+        return buildClassProperty(keyCls,
+                valCls,
+                pathStr,
+                resType,
+                aliases,
+                coCtx);
+    }
+
+    /**
      * Exception message to compare in tests.
      *
      * @param keyCls key class
@@ -508,7 +549,7 @@ public class QueryUtils {
             resType.getName() + "' for key class '" + keyCls + "' and value class '" + valCls + "'. " +
             "Make sure that one of these classes contains respective getter method or field.";
     }
-    
+
     /**
      * @param key If this is a key property.
      * @param cls Source type class.
@@ -553,7 +594,7 @@ public class QueryUtils {
 
         return res;
     }
-    
+
     /**
      * Find a member (either a getter method or a field) with given name of given class.
      * @param prop Property name.
@@ -807,7 +848,7 @@ public class QueryUtils {
 
         if (!F.isEmpty(entities)) {
             for (QueryEntity entity : entities) {
-                if (F.isEmpty(entity.getValueType()))
+                if (F.isEmpty(entity.findValueType()))
                     continue;
 
                 Collection<QueryIndex> idxs = entity.getIndexes();
@@ -839,7 +880,7 @@ public class QueryUtils {
 
         if (!F.isEmpty(entities)) {
             for (QueryEntity entity : entities) {
-                if (F.isEmpty(entity.getValueType()))
+                if (F.isEmpty(entity.findValueType()))
                     throw new IgniteCheckedException("Value type cannot be null or empty [cacheName=" +
                         ccfg.getName() + ", queryEntity=" + entity + ']');
 
@@ -875,4 +916,53 @@ public class QueryUtils {
     private QueryUtils() {
         // No-op.
     }
+
+    /** Property used for keyFieldName or valueFieldName */
+    public static class KeyOrValProperty implements GridQueryProperty {
+        /** */
+        boolean isKey;
+
+        /** */
+        String name;
+
+        /** */
+        Class<?> cls;
+
+        /** */
+        public KeyOrValProperty(boolean key, String name, Class<?> cls) {
+            this.isKey = key;
+            this.name = name;
+            this.cls = cls;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object value(Object key, Object val) throws IgniteCheckedException {
+            return isKey ? key : val;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void setValue(Object key, Object val, Object propVal) throws IgniteCheckedException {
+            //No-op
+        }
+
+        /** {@inheritDoc} */
+        @Override public String name() {
+            return name;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Class<?> type() {
+            return cls;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean key() {
+            return isKey;
+        }
+
+        /** {@inheritDoc} */
+        @Override public GridQueryProperty parent() {
+            return null;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
index e8dc73b..4194bc7 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
@@ -86,6 +86,7 @@ import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode.createJdbcSqlException;
 import static org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.UPDATE_RESULT_META;
+import static org.apache.ignite.internal.processors.query.h2.opt.GridH2AbstractKeyValueRow.DEFAULT_COLUMNS_COUNT;
 
 /**
  *
@@ -587,9 +588,12 @@ public class DmlStatementsProcessor {
             if (newVal == null)
                 throw new IgniteSQLException("New value for UPDATE must not be null", IgniteQueryErrorCode.NULL_VALUE);
 
-            // Skip key and value - that's why we start off with 2nd column
-            for (int i = 0; i < plan.tbl.getColumns().length - 2; i++) {
-                Column c = plan.tbl.getColumn(i + 2);
+            // Skip key and value - that's why we start off with 3rd column
+            for (int i = 0; i < plan.tbl.getColumns().length - DEFAULT_COLUMNS_COUNT; i++) {
+                Column c = plan.tbl.getColumn(i + DEFAULT_COLUMNS_COUNT);
+
+                if (desc.isKeyValueOrVersionColumn(c.getColumnId()))
+                    continue;
 
                 GridQueryProperty prop = desc.type().property(c.getName());
 
@@ -965,8 +969,11 @@ public class DmlStatementsProcessor {
         // column order preserves their precedence for correct update of nested properties.
         Column[] cols = plan.tbl.getColumns();
 
-        // First 2 columns are _key and _val, skip 'em.
-        for (int i = 2; i < cols.length; i++) {
+        // First 3 columns are _key, _val and _ver. Skip 'em.
+        for (int i = DEFAULT_COLUMNS_COUNT; i < cols.length; i++) {
+            if (plan.tbl.rowDescriptor().isKeyValueOrVersionColumn(i))
+                continue;
+
             String colName = cols[i].getName();
 
             if (!newColVals.containsKey(colName))

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 361b55b..83fb1f2 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -115,6 +115,7 @@ import org.apache.ignite.internal.processors.query.h2.opt.GridH2IndexBase;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2SystemIndexFactory;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2KeyValueRowOffheap;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2KeyValueRowOnheap;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2ProxyIndex;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryContext;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2Row;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor;
@@ -165,11 +166,14 @@ import org.h2.engine.Session;
 import org.h2.engine.SysProperties;
 import org.h2.index.Cursor;
 import org.h2.index.Index;
+import org.h2.index.SpatialIndex;
 import org.h2.jdbc.JdbcConnection;
 import org.h2.jdbc.JdbcPreparedStatement;
 import org.h2.jdbc.JdbcStatement;
 import org.h2.message.DbException;
 import org.h2.mvstore.cache.CacheLongKeyLIRS;
+import org.h2.result.SearchRow;
+import org.h2.result.SimpleRow;
 import org.h2.result.SortOrder;
 import org.h2.server.web.WebServer;
 import org.h2.table.Column;
@@ -209,9 +213,15 @@ import static org.apache.ignite.IgniteSystemProperties.getString;
 import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.SQL;
 import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.SQL_FIELDS;
 import static org.apache.ignite.internal.processors.cache.query.GridCacheQueryType.TEXT;
+import static org.apache.ignite.internal.processors.query.QueryUtils.KEY_FIELD_NAME;
+import static org.apache.ignite.internal.processors.query.QueryUtils.VAL_FIELD_NAME;
+import static org.apache.ignite.internal.processors.query.QueryUtils.VER_FIELD_NAME;
 import static org.apache.ignite.internal.processors.query.h2.opt.DistributedJoinMode.OFF;
 import static org.apache.ignite.internal.processors.query.h2.opt.DistributedJoinMode.distributedJoinMode;
+import static org.apache.ignite.internal.processors.query.h2.opt.GridH2AbstractKeyValueRow.DEFAULT_COLUMNS_COUNT;
 import static org.apache.ignite.internal.processors.query.h2.opt.GridH2AbstractKeyValueRow.KEY_COL;
+import static org.apache.ignite.internal.processors.query.h2.opt.GridH2AbstractKeyValueRow.VAL_COL;
+import static org.apache.ignite.internal.processors.query.h2.opt.GridH2AbstractKeyValueRow.VER_COL;
 import static org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryType.LOCAL;
 import static org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryType.PREPARE;
 
@@ -262,12 +272,6 @@ public class IgniteH2Indexing implements GridQueryIndexing {
     /** */
     private static final int TWO_STEP_QRY_CACHE_SIZE = 1024;
 
-    /** Field name for key. */
-    public static final String KEY_FIELD_NAME = "_KEY";
-
-    /** Field name for value. */
-    public static final String VAL_FIELD_NAME = "_VAL";
-
     /** */
     private static final Field COMMAND_FIELD;
 
@@ -1886,9 +1890,23 @@ public class IgniteH2Indexing implements GridQueryIndexing {
         String ptrn = "Name ''{0}'' is reserved and cannot be used as a field name [type=" + type.name() + "]";
 
         for (String name : names) {
-            if (name.equalsIgnoreCase(KEY_FIELD_NAME) || name.equalsIgnoreCase(VAL_FIELD_NAME))
+            if (name.equalsIgnoreCase(KEY_FIELD_NAME) ||
+                name.equalsIgnoreCase(VAL_FIELD_NAME) ||
+                name.equalsIgnoreCase(VER_FIELD_NAME))
                 throw new IgniteCheckedException(MessageFormat.format(ptrn, name));
         }
+
+        if (type.keyFieldName() != null && !type.fields().containsKey(type.keyFieldName())) {
+            throw new IgniteCheckedException(
+                    MessageFormat.format("Name ''{0}'' must be amongst fields since it is configured as ''keyFieldName'' [type=" +
+                            type.name() + "]", type.keyFieldName()));
+        }
+
+        if (type.valueFieldName() != null && !type.fields().containsKey(type.valueFieldName())) {
+            throw new IgniteCheckedException(
+                    MessageFormat.format("Name ''{0}'' must be amongst fields since it is configured as ''valueFieldName'' [type=" +
+                            type.name() + "]", type.valueFieldName()));
+        }
     }
 
     /**
@@ -1965,10 +1983,13 @@ public class IgniteH2Indexing implements GridQueryIndexing {
 
         SB sql = new SB();
 
+        String keyValVisibility = tbl.type().fields().isEmpty() ? " VISIBLE" : " INVISIBLE";
+
         sql.a("CREATE TABLE ").a(tbl.fullTableName()).a(" (")
-            .a(KEY_FIELD_NAME).a(' ').a(keyType).a(" NOT NULL");
+            .a(KEY_FIELD_NAME).a(' ').a(keyType).a(keyValVisibility).a(" NOT NULL");
 
-        sql.a(',').a(VAL_FIELD_NAME).a(' ').a(valTypeStr);
+        sql.a(',').a(VAL_FIELD_NAME).a(' ').a(valTypeStr).a(keyValVisibility);
+        sql.a(',').a(VER_FIELD_NAME).a(" OTHER INVISIBLE");
 
         for (Map.Entry<String, Class<?>> e : tbl.type().fields().entrySet())
             sql.a(',').a(escapeName(e.getKey(), escapeAll)).a(' ').a(dbTypeFromClass(e.getValue()));
@@ -2758,15 +2779,32 @@ public class IgniteH2Indexing implements GridQueryIndexing {
     }
 
     /**
+     * Check whether columns list contains key or key alias column.
+     *
+     * @param desc Row descriptor.
+     * @param cols Columns list.
+     * @return Result.
+     */
+    private static boolean containsKeyColumn(GridH2RowDescriptor desc, List<IndexColumn> cols) {
+        for (int i = cols.size() - 1; i >= 0; i--) {
+            if (desc.isKeyColumn(cols.get(i).column.getColumnId()))
+                return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * @param desc Row descriptor.
      * @param cols Columns list.
      * @param keyCol Primary key column.
      * @param affCol Affinity key column.
      * @return The same list back.
      */
-    private static List<IndexColumn> treeIndexColumns(List<IndexColumn> cols, IndexColumn keyCol, IndexColumn affCol) {
+    private static List<IndexColumn> treeIndexColumns(GridH2RowDescriptor desc, List<IndexColumn> cols, IndexColumn keyCol, IndexColumn affCol) {
         assert keyCol != null;
 
-        if (!containsColumn(cols, keyCol))
+        if (!containsKeyColumn(desc, cols))
             cols.add(keyCol);
 
         if (affCol != null && !containsColumn(cols, affCol))
@@ -3077,11 +3115,13 @@ public class IgniteH2Indexing implements GridQueryIndexing {
             if (affCol != null && equal(affCol, keyCol))
                 affCol = null;
 
+            GridH2RowDescriptor desc = tbl.rowDescriptor();
+
             Index hashIdx = createHashIndex(
                 schema,
                 tbl,
                 "_key_PK_hash",
-                treeIndexColumns(new ArrayList<IndexColumn>(2), keyCol, affCol)
+                treeIndexColumns(desc, new ArrayList<IndexColumn>(2), keyCol, affCol)
             );
 
             if (hashIdx != null)
@@ -3093,7 +3133,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
                 "_key_PK",
                 tbl,
                 true,
-                treeIndexColumns(new ArrayList<IndexColumn>(2), keyCol, affCol),
+                treeIndexColumns(desc, new ArrayList<IndexColumn>(2), keyCol, affCol),
                 -1
             );
 
@@ -3144,7 +3184,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
             // Add explicit affinity key index if nothing alike was found.
             if (affCol != null && !affIdxFound) {
                 idxs.add(createSortedIndex(schema, "AFFINITY_KEY", tbl, false,
-                    treeIndexColumns(new ArrayList<IndexColumn>(2), affCol, keyCol), -1));
+                    treeIndexColumns(desc, new ArrayList<IndexColumn>(2), affCol, keyCol), -1));
             }
 
             return idxs;
@@ -3194,13 +3234,14 @@ public class IgniteH2Indexing implements GridQueryIndexing {
                     idxDesc.descending(field) ? SortOrder.DESCENDING : SortOrder.ASCENDING));
             }
 
+            GridH2RowDescriptor desc = tbl.rowDescriptor();
             if (idxDesc.type() == QueryIndexType.SORTED) {
-                cols = treeIndexColumns(cols, keyCol, affCol);
-
+                cols = treeIndexColumns(desc, cols, keyCol, affCol);
                 return createSortedIndex(schema, name, tbl, false, cols, idxDesc.inlineSize());
             }
-            else if (idxDesc.type() == QueryIndexType.GEOSPATIAL)
+            else if (idxDesc.type() == QueryIndexType.GEOSPATIAL) {
                 return createSpatialIndex(tbl, name, cols.toArray(new IndexColumn[cols.size()]));
+            }
 
             throw new IllegalStateException("Index type: " + idxDesc.type());
         }
@@ -3483,6 +3524,12 @@ public class IgniteH2Indexing implements GridQueryIndexing {
         /** */
         private final GridQueryProperty[] props;
 
+        /** Id of user-defined key column */
+        private final int keyAliasColumnId;
+
+        /** Id of user-defined value column */
+        private final int valueAliasColumnId;
+
         /**
          * @param type Type descriptor.
          * @param schema Schema.
@@ -3522,6 +3569,10 @@ public class IgniteH2Indexing implements GridQueryIndexing {
                 props[i] = p;
             }
 
+            final List<String> fieldsList = Arrays.asList(fields);
+            keyAliasColumnId = (type.keyFieldName() != null) ? DEFAULT_COLUMNS_COUNT + fieldsList.indexOf(type.keyFieldName()) : -1;
+            valueAliasColumnId = (type.valueFieldName() != null) ? DEFAULT_COLUMNS_COUNT + fieldsList.indexOf(type.valueFieldName()) : -1;
+
             // Index is not snapshotable in db-x.
             snapshotableIdx = false;
         }
@@ -3649,8 +3700,8 @@ public class IgniteH2Indexing implements GridQueryIndexing {
                     row = GridH2RowFactory.create(wrap(key, keyType));
                 else
                     row = schema.offheap == null ?
-                        new GridH2KeyValueRowOnheap(this, key, keyType, val, valType, expirationTime) :
-                        new GridH2KeyValueRowOffheap(this, key, keyType, val, valType, expirationTime);
+                        new GridH2KeyValueRowOnheap(this, key, keyType, val, valType, ver, expirationTime) :
+                        new GridH2KeyValueRowOffheap(this, key, keyType, val, valType, ver, expirationTime);
             }
             catch (ClassCastException e) {
                 throw new IgniteCheckedException("Failed to convert key to SQL type. " +
@@ -3733,6 +3784,108 @@ public class IgniteH2Indexing implements GridQueryIndexing {
         @Override public boolean snapshotableIndex() {
             return snapshotableIdx;
         }
+
+        /** {@inheritDoc} */
+        @Override public boolean isKeyColumn(int columnId) {
+            assert columnId >= 0;
+            return columnId == KEY_COL || columnId == keyAliasColumnId;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isValueColumn(int columnId) {
+            assert columnId >= 0;
+            return columnId == VAL_COL || columnId == valueAliasColumnId;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isKeyValueOrVersionColumn(int columnId) {
+            assert columnId >= 0;
+            if (columnId < DEFAULT_COLUMNS_COUNT)
+                return true;
+            if (columnId == keyAliasColumnId)
+                return true;
+            if (columnId == valueAliasColumnId)
+                return true;
+            return false;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean checkKeyIndexCondition(int masks[], int mask) {
+            assert masks != null;
+            assert masks.length > 0;
+
+            if (keyAliasColumnId < 0)
+                return (masks[KEY_COL] & mask) != 0;
+            else
+                return (masks[KEY_COL] & mask) != 0 || (masks[keyAliasColumnId] & mask) != 0;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void initValueCache(Value valCache[], Value key, Value value, Value version) {
+            assert valCache != null;
+            assert valCache.length > 0;
+
+            valCache[KEY_COL] = key;
+            valCache[VAL_COL] = value;
+            valCache[VER_COL] = version;
+
+            if (keyAliasColumnId > 0)
+                valCache[keyAliasColumnId] = key;
+
+            if (valueAliasColumnId > 0)
+                valCache[valueAliasColumnId] = value;
+        }
+
+        /** {@inheritDoc} */
+        @Override public SearchRow prepareProxyIndexRow(SearchRow row) {
+            if (row == null)
+                return null;
+
+            Value[] data = new Value[row.getColumnCount()];
+            for (int idx = 0; idx < data.length; idx++)
+                data[idx] = row.getValue(idx);
+
+            copyAliasColumnData(data, KEY_COL, keyAliasColumnId);
+            copyAliasColumnData(data, VAL_COL, valueAliasColumnId);
+
+            return new SimpleRow(data);
+        }
+
+        /**
+         * Copies data between original and alias columns
+         *
+         * @param data Array of values.
+         * @param colId Original column id.
+         * @param aliasColId Alias column id.
+         */
+        private void copyAliasColumnData(Value[] data, int colId, int aliasColId) {
+            if (aliasColId <= 0)
+                return;
+
+            if (data[aliasColId] == null && data[colId] != null)
+                data[aliasColId] = data[colId];
+
+            if (data[colId] == null && data[aliasColId] != null)
+                data[colId] = data[aliasColId];
+        }
+
+        /** {@inheritDoc} */
+        @Override public int getAlternativeColumnId(int colId) {
+            if (keyAliasColumnId > 0) {
+                if (colId == KEY_COL)
+                    return keyAliasColumnId;
+                else if (colId == keyAliasColumnId)
+                    return KEY_COL;
+            }
+            if (valueAliasColumnId > 0) {
+                if (colId == VAL_COL)
+                    return valueAliasColumnId;
+                else if (colId == valueAliasColumnId)
+                    return VAL_COL;
+            }
+
+            return colId;
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
index 77946dd..22c3e33 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/UpdatePlanBuilder.java
@@ -31,7 +31,6 @@ import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
 import org.apache.ignite.internal.processors.query.IgniteSQLException;
 import org.apache.ignite.internal.processors.query.QueryUtils;
 import org.apache.ignite.internal.processors.query.h2.DmlStatementsProcessor;
-import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
 import org.apache.ignite.internal.processors.query.h2.sql.DmlAstUtils;
@@ -54,8 +53,7 @@ import org.h2.command.Prepared;
 import org.h2.table.Column;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.KEY_FIELD_NAME;
-import static org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.VAL_FIELD_NAME;
+import static org.apache.ignite.internal.processors.query.h2.opt.GridH2AbstractKeyValueRow.DEFAULT_COLUMNS_COUNT;
 
 /**
  * Logic for building update plans performed by {@link DmlStatementsProcessor}.
@@ -133,7 +131,7 @@ public final class UpdatePlanBuilder {
             // not for updates, and hence will allow putting new pairs only.
             // We don't quote _key and _val column names on CREATE TABLE, so they are always uppercase here.
             GridSqlColumn[] keys = merge.keys();
-            if (keys.length != 1 || !IgniteH2Indexing.KEY_FIELD_NAME.equals(keys[0].columnName()))
+            if (keys.length != 1 || !desc.isKeyColumn(tbl.dataTable().getColumn(keys[0].columnName()).getColumnId()))
                 throw new CacheException("SQL MERGE does not support arbitrary keys");
 
             cols = merge.columns();
@@ -173,12 +171,13 @@ public final class UpdatePlanBuilder {
 
             colTypes[i] = col.resultType().type();
 
-            if (KEY_FIELD_NAME.equals(colName)) {
+            int colId = col.column().getColumnId();
+            if (desc.isKeyColumn(colId)) {
                 keyColIdx = i;
                 continue;
             }
 
-            if (VAL_FIELD_NAME.equals(colName)) {
+            if (desc.isValueColumn(colId)) {
                 valColIdx = i;
                 continue;
             }
@@ -267,7 +266,8 @@ public final class UpdatePlanBuilder {
 
                     colTypes[i] = updatedCols.get(i).resultType().type();
 
-                    if (VAL_FIELD_NAME.equals(colNames[i]))
+                    Column column = updatedCols.get(i).column();
+                    if (desc.isValueColumn(column.getColumnId()))
                         valColIdx = i;
                 }
 
@@ -485,17 +485,19 @@ public final class UpdatePlanBuilder {
     private static boolean updateAffectsKeyColumns(GridH2Table gridTbl, Set<String> affectedColNames) {
         GridH2RowDescriptor desc = gridTbl.rowDescriptor();
 
-        Column[] cols = gridTbl.getColumns();
+        for (String colName : affectedColNames) {
+            int colId = gridTbl.getColumn(colName).getColumnId();
 
-        // Check "_key" column itself - always has index of 0.
-        if (affectedColNames.contains(cols[0].getName()))
-            return true;
-
-        // Start off from i = 2 to skip indices of 0 an 1 corresponding to key and value respectively.
-        for (int i = 2; i < cols.length; i++)
-            if (affectedColNames.contains(cols[i].getName()) && desc.isColumnKeyProperty(i - 2))
+            // Check "_key" column and alias key column
+            if (desc.isKeyColumn(colId))
                 return true;
 
+            // column ids 0..2 are _key, _val, _ver
+            if (colId >= DEFAULT_COLUMNS_COUNT) {
+                if (desc.isColumnKeyProperty(colId - DEFAULT_COLUMNS_COUNT))
+                    return true;
+            }
+        }
         return false;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
index 28dd891..499d258 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2AbstractKeyValueRow.java
@@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.IgniteInterruptedException;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -40,7 +41,7 @@ import org.jetbrains.annotations.Nullable;
  */
 public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
     /** */
-    public static final int DEFAULT_COLUMNS_COUNT = 2;
+    public static final int DEFAULT_COLUMNS_COUNT = 3;
 
     /** Key column. */
     public static final int KEY_COL = 0;
@@ -48,6 +49,9 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
     /** Value column. */
     public static final int VAL_COL = 1;
 
+    /** Version column. */
+    public static final int VER_COL = 2;
+
     /** */
     protected final GridH2RowDescriptor desc;
 
@@ -64,6 +68,9 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
     /** */
     private Value[] valCache;
 
+    /** */
+    private Value version;
+
     /**
      * Constructor.
      *
@@ -76,14 +83,17 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
      * @throws IgniteCheckedException If failed.
      */
     protected GridH2AbstractKeyValueRow(GridH2RowDescriptor desc, Object key, int keyType, @Nullable Object val,
-        int valType, long expirationTime) throws IgniteCheckedException {
+                                        int valType, GridCacheVersion ver, long expirationTime) throws IgniteCheckedException {
+        this.desc = desc;
+        this.expirationTime = expirationTime;
+
         setValue(KEY_COL, desc.wrap(key, keyType));
 
         if (val != null) // We remove by key only, so value can be null here.
             setValue(VAL_COL, desc.wrap(val, valType));
 
-        this.desc = desc;
-        this.expirationTime = expirationTime;
+        if (ver != null)
+            setValue(VER_COL, desc.wrap(ver, Value.JAVA_OBJECT));
     }
 
     /** {@inheritDoc} */
@@ -165,7 +175,13 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
      * @return Value if exists.
      */
     protected final Value peekValue(int col) {
-        return col == KEY_COL ? key : val;
+        if (col == KEY_COL)
+            return key;
+        if (col == VAL_COL)
+            return val;
+
+        assert col == VER_COL;
+        return version;
     }
 
     /** {@inheritDoc} */
@@ -179,32 +195,33 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
                 return v;
         }
 
-        if (col < DEFAULT_COLUMNS_COUNT) {
-            Value v;
+        Value v;
 
-            if (col == VAL_COL)
-                v = peekValue(VAL_COL);
-            else {
-                assert col == KEY_COL : col;
+        if (desc.isValueColumn(col)) {
+            v = peekValue(VAL_COL);
 
-                v = peekValue(KEY_COL);
+            assert !(v instanceof WeakValue) : v;
+            return v;
+        }
+        else if (desc.isKeyColumn(col)) {
+            v = peekValue(KEY_COL);
 
-                if (v == null) {
-                    v = getOffheapValue(KEY_COL);
+            if (v == null) {
+                v = getOffheapValue(KEY_COL);
 
-                    assert v != null;
+                assert v != null;
 
-                    setValue(KEY_COL, v);
+                setValue(KEY_COL, v);
 
-                    if (peekValue(VAL_COL) == null)
-                        cache();
-                }
+                if (peekValue(VAL_COL) == null)
+                    cache();
             }
 
             assert !(v instanceof WeakValue) : v;
-
             return v;
         }
+        else if (col == VER_COL)
+            return version;
 
         col -= DEFAULT_COLUMNS_COUNT;
 
@@ -218,8 +235,6 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
 
         Object res = desc.columnValue(key.getObject(), val.getObject(), col);
 
-        Value v;
-
         if (res == null)
             v = ValueNull.INSTANCE;
         else {
@@ -242,8 +257,7 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
      */
     public void valuesCache(Value[] valCache) {
         if (valCache != null) {
-            valCache[KEY_COL] = key;
-            valCache[VAL_COL] = val;
+            desc.initValueCache(valCache, key, val, version);
         }
 
         this.valCache = valCache;
@@ -281,16 +295,20 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
         v = WeakValue.unwrap(peekValue(VAL_COL));
         sb.a(", val: ").a(v == null ? "nil" : v.getString());
 
+        v = peekValue(VER_COL);
+        sb.a(", ver: ").a(v == null ? "nil" : v.getString());
+
         sb.a(" ][ ");
 
         if (v != null) {
-            for (int i = 2, cnt = getColumnCount(); i < cnt; i++) {
+            for (int i = DEFAULT_COLUMNS_COUNT, cnt = getColumnCount(); i < cnt; i++) {
                 v = getValue(i);
 
-                if (i != 2)
+                if (i != DEFAULT_COLUMNS_COUNT)
                     sb.a(", ");
 
-                sb.a(v == null ? "nil" : v.getString());
+                if (!desc.isKeyValueOrVersionColumn(i))
+                    sb.a(v == null ? "nil" : v.getString());
             }
         }
 
@@ -418,10 +436,12 @@ public abstract class GridH2AbstractKeyValueRow extends GridH2Row {
 
     /** {@inheritDoc} */
     @Override public void setValue(int idx, Value v) {
-        if (idx == VAL_COL)
+        if (desc.isValueColumn(idx))
             val = v;
+        else if (idx == VER_COL)
+            version = v;
         else {
-            assert idx == KEY_COL : idx + " " + v;
+            assert desc.isKeyColumn(idx) : idx + " " + v;
 
             key = v;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2CollocationModel.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2CollocationModel.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2CollocationModel.java
index 4df355e..037607b 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2CollocationModel.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2CollocationModel.java
@@ -39,8 +39,6 @@ import org.h2.table.Table;
 import org.h2.table.TableFilter;
 import org.h2.table.TableView;
 
-import static org.apache.ignite.internal.processors.query.h2.opt.GridH2AbstractKeyValueRow.KEY_COL;
-
 /**
  * Collocation model for a query.
  */
@@ -413,7 +411,7 @@ public final class GridH2CollocationModel {
                 int cmpType = c.getCompareType();
 
                 if ((cmpType == Comparison.EQUAL || cmpType == Comparison.EQUAL_NULL_SAFE) &&
-                    (colId == affColId || colId == KEY_COL) && c.isEvaluatable()) {
+                    (colId == affColId || tbl.rowDescriptor().isKeyColumn(colId)) && c.isEvaluatable()) {
                     affKeyCondFound = true;
 
                     Expression exp = c.getExpression();

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index 81a9620..623da09 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
@@ -397,6 +397,7 @@ public abstract class GridH2IndexBase extends BaseIndex {
             return null;
 
         IndexColumn affCol = getTable().getAffinityKeyColumn();
+        GridH2RowDescriptor desc = getTable().rowDescriptor();
 
         int affColId = -1;
         boolean ucast = false;
@@ -407,7 +408,7 @@ public abstract class GridH2IndexBase extends BaseIndex {
 
             if (masks != null) {
                 ucast = (masks[affColId] & IndexCondition.EQUALITY) != 0 ||
-                    (masks[KEY_COL] & IndexCondition.EQUALITY) != 0;
+                        desc.checkKeyIndexCondition(masks, IndexCondition.EQUALITY);
             }
         }
 
@@ -416,6 +417,16 @@ public abstract class GridH2IndexBase extends BaseIndex {
         return new DistributedLookupBatch(cctx, ucast, affColId);
     }
 
+    /** {@inheritDoc} */
+    @Override public void removeChildrenAndResources(Session session) {
+        // The sole purpose of this override is to pass session to table.removeIndex
+        assert table instanceof GridH2Table;
+
+        ((GridH2Table)table).removeIndex(session, this);
+        remove(session);
+        database.removeMeta(session, getId());
+    }
+
     /**
      * @param nodes Nodes.
      * @param msg Message.
@@ -1130,7 +1141,7 @@ public abstract class GridH2IndexBase extends BaseIndex {
             if (affKeyFirst != null && equal(affKeyFirst, affKeyLast))
                 return affKeyFirst == ValueNull.INSTANCE ? EXPLICIT_NULL : affKeyFirst.getObject();
 
-            if (affColId == KEY_COL)
+            if (getTable().rowDescriptor().isKeyColumn(affColId))
                 return null;
 
             // Try to extract affinity key from primary key.

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java
index fd310ce..3d92777 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOffheap.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.query.h2.opt;
 
 import java.util.concurrent.locks.Lock;
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.GridStripedLock;
 import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory;
 import org.apache.ignite.internal.util.typedef.internal.SB;
@@ -84,12 +85,13 @@ public class GridH2KeyValueRowOffheap extends GridH2AbstractKeyValueRow {
      * @param keyType Key type.
      * @param val Value.
      * @param valType Value type.
+     * @param ver Version.
      * @param expirationTime Expiration time.
      * @throws IgniteCheckedException If failed.
      */
     public GridH2KeyValueRowOffheap(GridH2RowDescriptor desc, Object key, int keyType, @Nullable Object val, int valType,
-        long expirationTime) throws IgniteCheckedException {
-        super(desc, key, keyType, val, valType, expirationTime);
+                                    GridCacheVersion ver, long expirationTime) throws IgniteCheckedException {
+        super(desc, key, keyType, val, valType, ver, expirationTime);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOnheap.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOnheap.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOnheap.java
index 772302f..4975092 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOnheap.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2KeyValueRowOnheap.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.query.h2.opt;
 
 
 import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.h2.value.Value;
 import org.jetbrains.annotations.Nullable;
 
@@ -34,12 +35,13 @@ public class GridH2KeyValueRowOnheap extends GridH2AbstractKeyValueRow {
      * @param keyType Key type.
      * @param val Value.
      * @param valType Value type.
+     * @param ver Version.
      * @param expirationTime Expiration time.
      * @throws IgniteCheckedException If failed.
      */
     public GridH2KeyValueRowOnheap(GridH2RowDescriptor desc, Object key, int keyType, @Nullable Object val, int valType,
-        long expirationTime) throws IgniteCheckedException {
-        super(desc, key, keyType, val, valType, expirationTime);
+                                   GridCacheVersion ver, long expirationTime) throws IgniteCheckedException {
+        super(desc, key, keyType, val, valType, ver, expirationTime);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ProxyIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ProxyIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ProxyIndex.java
new file mode 100644
index 0000000..7c70ded
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ProxyIndex.java
@@ -0,0 +1,204 @@
+/*
+ * 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.h2.opt;
+
+import org.h2.engine.Session;
+import org.h2.index.BaseIndex;
+import org.h2.index.Cursor;
+import org.h2.index.Index;
+import org.h2.index.IndexLookupBatch;
+import org.h2.index.IndexType;
+import org.h2.index.SpatialIndex;
+import org.h2.message.DbException;
+import org.h2.result.Row;
+import org.h2.result.SearchRow;
+import org.h2.result.SortOrder;
+import org.h2.table.Column;
+import org.h2.table.IndexColumn;
+import org.h2.table.TableFilter;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.concurrent.Future;
+
+/**
+ * Allows to have 'free' index for alias columns
+ * Delegates the calls to underlying normal index
+ */
+public class GridH2ProxyIndex extends BaseIndex {
+
+    /** Underlying normal index */
+    protected Index idx;
+
+    /**
+     *
+     * @param tbl Table.
+     * @param name Name of the proxy index.
+     * @param colsList Column list for the proxy index.
+     * @param idx Target index.
+     */
+    public GridH2ProxyIndex(GridH2Table tbl,
+                            String name,
+                            List<IndexColumn> colsList,
+                            Index idx) {
+
+        IndexColumn[] cols = colsList.toArray(new IndexColumn[colsList.size()]);
+
+        IndexColumn.mapColumns(cols, tbl);
+
+        initBaseIndex(tbl, 0, name, cols, IndexType.createNonUnique(false, false, idx instanceof SpatialIndex));
+
+        this.idx = idx;
+    }
+
+    /**
+     * @return Underlying index.
+     */
+    public Index underlyingIndex() {
+        return idx;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void checkRename() {
+        throw DbException.getUnsupportedException("rename");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void close(Session session) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void add(Session session, Row row) {
+        throw DbException.getUnsupportedException("add");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void remove(Session session, Row row) {
+        throw DbException.getUnsupportedException("remove row");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Cursor find(Session session, SearchRow first, SearchRow last) {
+        GridH2RowDescriptor desc = ((GridH2Table)idx.getTable()).rowDescriptor();
+        return idx.find(session, desc.prepareProxyIndexRow(first), desc.prepareProxyIndexRow(last));
+    }
+
+    /** {@inheritDoc} */
+    @Override public double getCost(Session session, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder, HashSet<Column> allColumnsSet) {
+        long rowCnt = getRowCountApproximation();
+
+        double baseCost = getCostRangeIndex(masks, rowCnt, filters, filter, sortOrder, false, allColumnsSet);
+
+        int mul = ((GridH2IndexBase)idx).getDistributedMultiplier(session, filters, filter);
+
+        return mul * baseCost;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void remove(Session session) {
+        throw DbException.getUnsupportedException("remove index");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void truncate(Session session) {
+        throw DbException.getUnsupportedException("truncate");
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean canGetFirstOrLast() {
+        return idx.canGetFirstOrLast();
+    }
+
+    /** {@inheritDoc} */
+    @Override public Cursor findFirstOrLast(Session session, boolean first) {
+        return idx.findFirstOrLast(session, first);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean needRebuild() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getRowCount(Session session) {
+        return idx.getRowCount(session);
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getRowCountApproximation() {
+        return idx.getRowCountApproximation();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getDiskSpaceUsed() {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public IndexLookupBatch createLookupBatch(TableFilter[] filters, int filter) {
+        return new ProxyIndexLookupBatch(idx.createLookupBatch(filters, filter));
+    }
+
+    /** {@inheritDoc} */
+    @Override public void removeChildrenAndResources(Session session) {
+        // No-op. Will be removed when underlying index is removed
+    }
+
+    /** Proxy lookup batch */
+    private class ProxyIndexLookupBatch implements IndexLookupBatch {
+
+        /** Underlying normal lookup batch */
+        private final IndexLookupBatch target;
+
+        /**
+         * Creates proxy lookup batch.
+         *
+         * @param target Underlying index lookup batch.
+         */
+        private ProxyIndexLookupBatch(IndexLookupBatch target) {
+            this.target = target;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean addSearchRows(SearchRow first, SearchRow last) {
+            GridH2RowDescriptor desc = ((GridH2Table)idx.getTable()).rowDescriptor();
+            return target.addSearchRows(desc.prepareProxyIndexRow(first), desc.prepareProxyIndexRow(last));
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isBatchFull() {
+            return target.isBatchFull();
+        }
+
+        /** {@inheritDoc} */
+        @Override public List<Future<Cursor>> find() {
+            return target.find();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String getPlanSQL() {
+            return target.getPlanSQL();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void reset(boolean beforeQuery) {
+            target.reset(beforeQuery);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ProxySpatialIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ProxySpatialIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ProxySpatialIndex.java
new file mode 100644
index 0000000..8af5099
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2ProxySpatialIndex.java
@@ -0,0 +1,70 @@
+/*
+ * 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.h2.opt;
+
+
+import org.h2.engine.Session;
+import org.h2.index.Cursor;
+import org.h2.index.Index;
+import org.h2.index.SpatialIndex;
+import org.h2.index.SpatialTreeIndex;
+import org.h2.result.SearchRow;
+import org.h2.result.SortOrder;
+import org.h2.table.Column;
+import org.h2.table.IndexColumn;
+import org.h2.table.TableFilter;
+
+import java.util.HashSet;
+import java.util.List;
+
+/**
+ * Allows to have 'free' spatial index for alias columns
+ * Delegates the calls to underlying normal index
+ */
+public class GridH2ProxySpatialIndex extends GridH2ProxyIndex implements SpatialIndex {
+    /**
+     *
+     * @param tbl Table.
+     * @param name Name of the proxy index.
+     * @param colsList Column list for the proxy index.
+     * @param idx Target index.
+     */
+    public GridH2ProxySpatialIndex(GridH2Table tbl,
+                                   String name,
+                                   List<IndexColumn> colsList,
+                                   Index idx) {
+        super(tbl, name, colsList, idx);
+    }
+
+    /** {@inheritDoc} */
+    @Override public double getCost(Session ses, int[] masks, TableFilter[] filters, int filter,
+                                    SortOrder sortOrder, HashSet<Column> cols) {
+        return SpatialTreeIndex.getCostRangeIndex(masks,
+                table.getRowCountApproximation(), columns) / 10;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Cursor findByGeometry(TableFilter filter, SearchRow first, SearchRow last, SearchRow intersection) {
+        GridH2RowDescriptor desc = ((GridH2Table)idx.getTable()).rowDescriptor();
+
+        return ((SpatialIndex)idx).findByGeometry(filter,
+                desc.prepareProxyIndexRow(first),
+                desc.prepareProxyIndexRow(last),
+                desc.prepareProxyIndexRow(intersection));
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
index 61de362..778ebfb 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
@@ -28,6 +28,7 @@ import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
 import org.apache.ignite.internal.util.offheap.unsafe.GridOffHeapSmartPointerFactory;
 import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeGuard;
 import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory;
+import org.h2.result.SearchRow;
 import org.h2.value.Value;
 import org.jetbrains.annotations.Nullable;
 
@@ -161,4 +162,70 @@ public interface GridH2RowDescriptor extends GridOffHeapSmartPointerFactory<Grid
      * @return {@code True} if index should support snapshots.
      */
     public boolean snapshotableIndex();
+
+    /**
+     * Checks if provided column id matches key column or key alias.
+     *
+     * @param colId Column id.
+     * @return Result.
+     */
+    public boolean isKeyColumn(int colId);
+
+    /**
+     * Checks if provided column id matches value column or alias.
+     *
+     * @param colId Column id.
+     * @return Result.
+     */
+    public boolean isValueColumn(int colId);
+
+    /**
+     * Checks if provided column id matches key, key alias,
+     * value, value alias or version column.
+     *
+     * @param colId Column id.
+     * @return Result.
+     */
+    public boolean isKeyValueOrVersionColumn(int colId);
+
+    /**
+     * Checks if provided index condition is allowed for key column or key alias column.
+     *
+     * @param masks Array containing Index Condition masks for each column.
+     * @param mask Index Condition to check.
+     * @return Result.
+     */
+    public boolean checkKeyIndexCondition(int masks[], int mask);
+
+    /**
+     * Initializes value cache with key, val and version.
+     *
+     * @param valCache Value cache.
+     * @param key Key.
+     * @param value Value.
+     * @param version Version.
+     */
+    public void initValueCache(Value valCache[], Value key, Value value, Value version);
+
+    /**
+     * Clones provided row and copies values of alias key and val columns
+     * into respective key and val positions.
+     *
+     * @param row Source row.
+     * @return Result.
+     */
+    public SearchRow prepareProxyIndexRow(SearchRow row);
+
+    /**
+     * Gets alternative column id that may substitute the given column id.
+     *
+     * For alias column returns original one.
+     * For original column returns its alias.
+     *
+     * Otherwise, returns the given column id.
+     *
+     * @param colId Column id.
+     * @return Result.
+     */
+    public int getAlternativeColumnId(int colId);
 }
\ No newline at end of file


[16/51] [abbrv] ignite git commit: ignite-1794 Refactored hibernate modules, switched to hibernate 5.1

Posted by sb...@apache.org.
ignite-1794 Refactored hibernate modules, switched to hibernate 5.1


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

Branch: refs/heads/ignite-5075-cacheStart
Commit: ee1b19d3f6eb8c07405ee6783379d4c2c20ad8c8
Parents: c9cd761
Author: sboikov <sb...@gridgain.com>
Authored: Wed Apr 26 14:18:01 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Apr 26 14:18:14 2017 +0300

----------------------------------------------------------------------
 assembly/dependencies-fabric.xml                |    5 +-
 examples/pom-standalone-lgpl.xml                |    2 +-
 examples/pom-standalone.xml                     |    2 +-
 examples/pom.xml                                |   38 +-
 .../hibernate/HibernateL2CacheExample.java      |   12 +-
 modules/hibernate-4.2/README.txt                |   48 +
 modules/hibernate-4.2/licenses/apache-2.0.txt   |  202 ++
 modules/hibernate-4.2/pom.xml                   |  159 ++
 .../HibernateAbstractRegionAccessStrategy.java  |  102 +
 .../hibernate/HibernateCollectionRegion.java    |  100 +
 .../cache/hibernate/HibernateEntityRegion.java  |  112 +
 .../hibernate/HibernateGeneralDataRegion.java   |   76 +
 .../cache/hibernate/HibernateKeyWrapper.java    |   73 +
 .../hibernate/HibernateNaturalIdRegion.java     |  103 +
 .../hibernate/HibernateQueryResultsRegion.java  |   70 +
 .../ignite/cache/hibernate/HibernateRegion.java |   99 +
 .../cache/hibernate/HibernateRegionFactory.java |  179 ++
 .../hibernate/HibernateTimestampsRegion.java    |   39 +
 .../HibernateTransactionalDataRegion.java       |   84 +
 .../ignite/cache/hibernate/package-info.java    |   24 +
 .../hibernate/CacheHibernateBlobStore.java      |  542 +++++
 .../CacheHibernateBlobStoreEntry.hbm.xml        |   31 +
 .../hibernate/CacheHibernateBlobStoreEntry.java |   89 +
 .../CacheHibernateBlobStoreFactory.java         |  235 +++
 .../CacheHibernateStoreSessionListener.java     |  222 ++
 .../cache/store/hibernate/package-info.java     |   22 +
 .../src/test/config/factory-cache.xml           |   59 +
 .../src/test/config/factory-cache1.xml          |   61 +
 .../config/factory-incorrect-store-cache.xml    |   56 +
 .../HibernateL2CacheConfigurationSelfTest.java  |  409 ++++
 .../hibernate/HibernateL2CacheMultiJvmTest.java |  440 ++++
 .../hibernate/HibernateL2CacheSelfTest.java     | 1954 +++++++++++++++++
 .../HibernateL2CacheTransactionalSelfTest.java  |  154 ++
 ...nateL2CacheTransactionalUseSyncSelfTest.java |   31 +
 .../CacheHibernateBlobStoreNodeRestartTest.java |   46 +
 .../CacheHibernateBlobStoreSelfTest.java        |  113 +
 .../CacheHibernateStoreFactorySelfTest.java     |  288 +++
 ...heHibernateStoreSessionListenerSelfTest.java |  238 +++
 .../cache/store/hibernate/hibernate.cfg.xml     |   42 +
 .../cache/store/hibernate/package-info.java     |   22 +
 .../IgniteBinaryHibernateTestSuite.java         |   37 +
 .../testsuites/IgniteHibernateTestSuite.java    |   57 +
 modules/hibernate-5.1/README.txt                |   48 +
 modules/hibernate-5.1/licenses/apache-2.0.txt   |  202 ++
 modules/hibernate-5.1/pom.xml                   |  159 ++
 .../HibernateAbstractRegionAccessStrategy.java  |  103 +
 .../hibernate/HibernateCollectionRegion.java    |  114 +
 .../cache/hibernate/HibernateEntityRegion.java  |  128 ++
 .../hibernate/HibernateGeneralDataRegion.java   |   79 +
 .../cache/hibernate/HibernateKeyWrapper.java    |  109 +
 .../hibernate/HibernateNaturalIdRegion.java     |  113 +
 .../hibernate/HibernateQueryResultsRegion.java  |   70 +
 .../ignite/cache/hibernate/HibernateRegion.java |   99 +
 .../cache/hibernate/HibernateRegionFactory.java |  168 ++
 .../hibernate/HibernateTimestampsRegion.java    |   39 +
 .../HibernateTransactionalDataRegion.java       |   84 +
 .../ignite/cache/hibernate/package-info.java    |   24 +
 .../hibernate/CacheHibernateBlobStore.java      |  543 +++++
 .../CacheHibernateBlobStoreEntry.hbm.xml        |   31 +
 .../hibernate/CacheHibernateBlobStoreEntry.java |   89 +
 .../CacheHibernateBlobStoreFactory.java         |  235 +++
 .../CacheHibernateStoreSessionListener.java     |  224 ++
 .../cache/store/hibernate/package-info.java     |   22 +
 .../src/test/config/factory-cache.xml           |   59 +
 .../src/test/config/factory-cache1.xml          |   61 +
 .../config/factory-incorrect-store-cache.xml    |   56 +
 .../HibernateL2CacheConfigurationSelfTest.java  |  407 ++++
 .../hibernate/HibernateL2CacheMultiJvmTest.java |  429 ++++
 .../hibernate/HibernateL2CacheSelfTest.java     | 1960 ++++++++++++++++++
 .../HibernateL2CacheTransactionalSelfTest.java  |  154 ++
 ...nateL2CacheTransactionalUseSyncSelfTest.java |   31 +
 .../CacheHibernateBlobStoreNodeRestartTest.java |   46 +
 .../CacheHibernateBlobStoreSelfTest.java        |  114 +
 .../CacheHibernateStoreFactorySelfTest.java     |  256 +++
 ...heHibernateStoreSessionListenerSelfTest.java |  242 +++
 .../cache/store/hibernate/hibernate.cfg.xml     |   42 +
 .../cache/store/hibernate/package-info.java     |   22 +
 .../IgniteBinaryHibernate5TestSuite.java        |   37 +
 .../testsuites/IgniteHibernate5TestSuite.java   |   57 +
 modules/hibernate-core/pom.xml                  |   76 +
 .../HibernateAccessStrategyAdapter.java         |  340 +++
 .../HibernateAccessStrategyFactory.java         |  235 +++
 .../cache/hibernate/HibernateCacheProxy.java    |  801 +++++++
 .../hibernate/HibernateExceptionConverter.java  |   29 +
 .../hibernate/HibernateKeyTransformer.java      |   29 +
 .../HibernateNonStrictAccessStrategy.java       |  230 ++
 .../HibernateReadOnlyAccessStrategy.java        |  105 +
 .../HibernateReadWriteAccessStrategy.java       |  326 +++
 .../HibernateTransactionalAccessStrategy.java   |  141 ++
 .../ignite/cache/hibernate/package-info.java    |   24 +
 modules/hibernate/README.txt                    |   48 -
 modules/hibernate/licenses/apache-2.0.txt       |  202 --
 modules/hibernate/pom.xml                       |  146 --
 .../HibernateAbstractRegionAccessStrategy.java  |   98 -
 .../HibernateAccessStrategyAdapter.java         |  379 ----
 .../cache/hibernate/HibernateCacheProxy.java    |  801 -------
 .../hibernate/HibernateCollectionRegion.java    |  100 -
 .../cache/hibernate/HibernateEntityRegion.java  |  112 -
 .../hibernate/HibernateGeneralDataRegion.java   |   71 -
 .../hibernate/HibernateKeyTransformer.java      |   28 -
 .../cache/hibernate/HibernateKeyWrapper.java    |   72 -
 .../hibernate/HibernateNaturalIdRegion.java     |  100 -
 .../HibernateNonStrictAccessStrategy.java       |  222 --
 .../hibernate/HibernateQueryResultsRegion.java  |   70 -
 .../HibernateReadOnlyAccessStrategy.java        |  107 -
 .../HibernateReadWriteAccessStrategy.java       |  328 ---
 .../ignite/cache/hibernate/HibernateRegion.java |   99 -
 .../cache/hibernate/HibernateRegionFactory.java |  266 ---
 .../hibernate/HibernateTimestampsRegion.java    |   39 -
 .../HibernateTransactionalAccessStrategy.java   |  141 --
 .../HibernateTransactionalDataRegion.java       |  107 -
 .../ignite/cache/hibernate/package-info.java    |   24 -
 .../hibernate/CacheHibernateBlobStore.java      |  542 -----
 .../CacheHibernateBlobStoreEntry.hbm.xml        |   31 -
 .../hibernate/CacheHibernateBlobStoreEntry.java |   89 -
 .../CacheHibernateBlobStoreFactory.java         |  235 ---
 .../CacheHibernateStoreSessionListener.java     |  222 --
 .../cache/store/hibernate/package-info.java     |   22 -
 .../hibernate/src/test/config/factory-cache.xml |   59 -
 .../src/test/config/factory-cache1.xml          |   61 -
 .../config/factory-incorrect-store-cache.xml    |   56 -
 .../HibernateL2CacheConfigurationSelfTest.java  |  408 ----
 .../hibernate/HibernateL2CacheSelfTest.java     | 1949 -----------------
 .../HibernateL2CacheTransactionalSelfTest.java  |  154 --
 ...nateL2CacheTransactionalUseSyncSelfTest.java |   31 -
 .../CacheHibernateBlobStoreNodeRestartTest.java |   46 -
 .../CacheHibernateBlobStoreSelfTest.java        |  113 -
 .../CacheHibernateStoreFactorySelfTest.java     |  285 ---
 ...heHibernateStoreSessionListenerSelfTest.java |  238 ---
 .../cache/store/hibernate/hibernate.cfg.xml     |   42 -
 .../cache/store/hibernate/package-info.java     |   22 -
 .../IgniteBinaryHibernateTestSuite.java         |   37 -
 .../testsuites/IgniteHibernateTestSuite.java    |   57 -
 modules/hibernate5/README.txt                   |   48 -
 modules/hibernate5/licenses/apache-2.0.txt      |  202 --
 modules/hibernate5/pom.xml                      |  146 --
 .../HibernateAbstractRegionAccessStrategy.java  |   99 -
 .../HibernateAccessStrategyAdapter.java         |  379 ----
 .../cache/hibernate/HibernateCacheProxy.java    |  801 -------
 .../hibernate/HibernateCollectionRegion.java    |  114 -
 .../cache/hibernate/HibernateEntityRegion.java  |  129 --
 .../hibernate/HibernateGeneralDataRegion.java   |   72 -
 .../hibernate/HibernateKeyTransformer.java      |   28 -
 .../cache/hibernate/HibernateKeyWrapper.java    |  108 -
 .../hibernate/HibernateNaturalIdRegion.java     |  113 -
 .../HibernateNonStrictAccessStrategy.java       |  222 --
 .../hibernate/HibernateQueryResultsRegion.java  |   70 -
 .../HibernateReadOnlyAccessStrategy.java        |  107 -
 .../HibernateReadWriteAccessStrategy.java       |  328 ---
 .../ignite/cache/hibernate/HibernateRegion.java |   99 -
 .../cache/hibernate/HibernateRegionFactory.java |  255 ---
 .../hibernate/HibernateTimestampsRegion.java    |   39 -
 .../HibernateTransactionalAccessStrategy.java   |  141 --
 .../HibernateTransactionalDataRegion.java       |  107 -
 .../ignite/cache/hibernate/package-info.java    |   24 -
 .../hibernate/CacheHibernateBlobStore.java      |  542 -----
 .../CacheHibernateBlobStoreEntry.hbm.xml        |   31 -
 .../hibernate/CacheHibernateBlobStoreEntry.java |   89 -
 .../CacheHibernateBlobStoreFactory.java         |  235 ---
 .../CacheHibernateStoreSessionListener.java     |  223 --
 .../cache/store/hibernate/package-info.java     |   22 -
 .../src/test/config/factory-cache.xml           |   59 -
 .../src/test/config/factory-cache1.xml          |   61 -
 .../config/factory-incorrect-store-cache.xml    |   56 -
 .../HibernateL2CacheConfigurationSelfTest.java  |  409 ----
 .../hibernate/HibernateL2CacheSelfTest.java     | 1948 -----------------
 .../HibernateL2CacheTransactionalSelfTest.java  |  154 --
 ...nateL2CacheTransactionalUseSyncSelfTest.java |   31 -
 .../CacheHibernateBlobStoreNodeRestartTest.java |   46 -
 .../CacheHibernateBlobStoreSelfTest.java        |  113 -
 .../CacheHibernateStoreFactorySelfTest.java     |  326 ---
 ...heHibernateStoreSessionListenerSelfTest.java |  241 ---
 .../cache/store/hibernate/hibernate.cfg.xml     |   42 -
 .../cache/store/hibernate/package-info.java     |   22 -
 .../IgniteBinaryHibernate5TestSuite.java        |   37 -
 .../testsuites/IgniteHibernate5TestSuite.java   |   57 -
 .../osgi-karaf/src/main/resources/features.xml  |    2 +-
 pom.xml                                         |    9 +-
 178 files changed, 15647 insertions(+), 16667 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/assembly/dependencies-fabric.xml
----------------------------------------------------------------------
diff --git a/assembly/dependencies-fabric.xml b/assembly/dependencies-fabric.xml
index 23a1731..be68d0a 100644
--- a/assembly/dependencies-fabric.xml
+++ b/assembly/dependencies-fabric.xml
@@ -127,8 +127,9 @@
                 <exclude>org.apache.ignite:ignite-hadoop</exclude>
                 <exclude>org.apache.ignite:ignite-codegen</exclude>
                 <exclude>org.apache.ignite:ignite-apache-license-gen</exclude>
-                <exclude>org.apache.ignite:ignite-hibernate</exclude>
-                <exclude>org.apache.ignite:ignite-hibernate5</exclude>
+                <exclude>org.apache.ignite:ignite-hibernate-core</exclude>
+                <exclude>org.apache.ignite:ignite-hibernate_4.2</exclude>
+                <exclude>org.apache.ignite:ignite-hibernate_5.1</exclude>
                 <exclude>org.apache.ignite:ignite-schedule</exclude>
                 <exclude>org.apache.ignite:ignite-geospatial</exclude>
                 <exclude>org.apache.ignite:ignite-appserver-test</exclude>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/examples/pom-standalone-lgpl.xml
----------------------------------------------------------------------
diff --git a/examples/pom-standalone-lgpl.xml b/examples/pom-standalone-lgpl.xml
index 5fbb4ea..4798d03 100644
--- a/examples/pom-standalone-lgpl.xml
+++ b/examples/pom-standalone-lgpl.xml
@@ -191,7 +191,7 @@
             <dependencies>
                 <dependency>
                     <groupId>org.apache.ignite</groupId>
-                    <artifactId>ignite-hibernate</artifactId>
+                    <artifactId>ignite-hibernate_5.1</artifactId>
                     <version>to_be_replaced_by_ignite_version</version>
                 </dependency>
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/examples/pom-standalone.xml
----------------------------------------------------------------------
diff --git a/examples/pom-standalone.xml b/examples/pom-standalone.xml
index 0183563..e74082c 100644
--- a/examples/pom-standalone.xml
+++ b/examples/pom-standalone.xml
@@ -192,7 +192,7 @@
             <dependencies>
                 <dependency>
                     <groupId>org.apache.ignite</groupId>
-                    <artifactId>ignite-hibernate</artifactId>
+                    <artifactId>ignite-hibernate_5.1</artifactId>
                     <version>to_be_replaced_by_ignite_version</version>
                 </dependency>
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index 895519b..26f653d 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -64,24 +64,6 @@
 
         <dependency>
             <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-hibernate</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-schedule</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-geospatial</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
             <artifactId>ignite-spring-data</artifactId>
             <version>${project.version}</version>
         </dependency>
@@ -288,6 +270,26 @@
                 <lgpl.folder>src/main/java-lgpl</lgpl.folder>
                 <lgpl.test.folder>src/test/java-lgpl</lgpl.test.folder>
             </properties>
+
+            <dependencies>
+                <dependency>
+                    <groupId>org.apache.ignite</groupId>
+                    <artifactId>ignite-hibernate_5.1</artifactId>
+                    <version>${project.version}</version>
+                </dependency>
+
+                <dependency>
+                    <groupId>org.apache.ignite</groupId>
+                    <artifactId>ignite-schedule</artifactId>
+                    <version>${project.version}</version>
+                </dependency>
+
+                <dependency>
+                    <groupId>org.apache.ignite</groupId>
+                    <artifactId>ignite-geospatial</artifactId>
+                    <version>${project.version}</version>
+                </dependency>
+            </dependencies>
         </profile>
     </profiles>
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
index a31d394..28aa6ca 100644
--- a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
+++ b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
@@ -31,9 +31,9 @@ import org.apache.ignite.examples.ExamplesUtils;
 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
 import org.hibernate.Transaction;
+import org.hibernate.boot.MetadataSources;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
 import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.service.ServiceRegistryBuilder;
 import org.hibernate.stat.SecondLevelCacheStatistics;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
@@ -226,14 +226,14 @@ public class HibernateL2CacheExample {
      * @return New Hibernate {@link SessionFactory}.
      */
     private static SessionFactory createHibernateSessionFactory(URL hibernateCfg) {
-        ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
+        StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
 
         builder.applySetting("hibernate.connection.url", JDBC_URL);
         builder.applySetting("hibernate.show_sql", true);
 
-        return new Configuration()
-            .configure(hibernateCfg)
-            .buildSessionFactory(builder.buildServiceRegistry());
+        builder.configure(hibernateCfg);
+
+        return new MetadataSources(builder.build()).buildMetadata().buildSessionFactory();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/README.txt
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/README.txt b/modules/hibernate-4.2/README.txt
new file mode 100644
index 0000000..096b9d7
--- /dev/null
+++ b/modules/hibernate-4.2/README.txt
@@ -0,0 +1,48 @@
+Apache Ignite Hibernate Module
+------------------------------
+
+Apache Ignite Hibernate module provides Hibernate second-level cache (L2 cache) implementation based
+on Apache Ignite In-Memory Data Grid.
+
+To enable Hibernate module when starting a standalone node, move 'optional/ignite-hibernate' folder to
+'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will
+be added to classpath in this case.
+
+Importing Hibernate Module In Maven Project
+-------------------------------------------
+
+If you are using Maven to manage dependencies of your project, you can add Hibernate module
+dependency like this (replace '${ignite.version}' with actual Ignite version you are
+interested in):
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                        http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    ...
+    <dependencies>
+        ...
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-hibernate_4.2</artifactId>
+            <version>${ignite.version}</version>
+        </dependency>
+        ...
+    </dependencies>
+    ...
+</project>
+
+
+LGPL dependencies
+-----------------
+
+Ignite includes the following optional LGPL dependencies:
+ - Hibernate L2 Cache Integration, http://hibernate.org/orm/
+ - JTS Topology Suite for Geospatial indexing, http://tsusiatsoftware.net/jts/main.html
+ - cron4j for cron-based task scheduling, http://www.sauronsoftware.it/projects/cron4j
+
+Apache binary releases cannot include LGPL dependencies. If you would like include
+optional LGPL dependencies into your release, you should download the source release
+from Ignite website and do the build with the following maven command:
+
+mvn clean package -DskipTests -Prelease,lgpl

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/licenses/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/licenses/apache-2.0.txt b/modules/hibernate-4.2/licenses/apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/hibernate-4.2/licenses/apache-2.0.txt
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/pom.xml b/modules/hibernate-4.2/pom.xml
new file mode 100644
index 0000000..c597b21
--- /dev/null
+++ b/modules/hibernate-4.2/pom.xml
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<!--
+    POM file.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.ignite</groupId>
+        <artifactId>ignite-parent</artifactId>
+        <version>1</version>
+        <relativePath>../../parent</relativePath>
+    </parent>
+
+    <artifactId>ignite-hibernate_4.2</artifactId>
+    <version>2.0.0-SNAPSHOT</version>
+    <url>http://ignite.apache.org</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-hibernate-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-core</artifactId>
+            <version>4.2.21.Final</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-jta</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ow2.jotm</groupId>
+            <artifactId>jotm-core</artifactId>
+            <version>2.1.9</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-dbcp</groupId>
+            <artifactId>commons-dbcp</artifactId>
+            <version>1.4</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <version>${h2.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>javax.resource</groupId>
+            <artifactId>connector-api</artifactId>
+            <version>1.5</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-spring</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-log4j</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
+            <version>${spring.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>${spring.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.thoughtworks.xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>1.4.8</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <testResources>
+            <testResource>
+                <directory>src/main/java</directory>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                </excludes>
+            </testResource>
+            <testResource>
+                <directory>src/test/java</directory>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                </excludes>
+            </testResource>
+        </testResources>
+
+        <plugins>
+            <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateAbstractRegionAccessStrategy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateAbstractRegionAccessStrategy.java b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateAbstractRegionAccessStrategy.java
new file mode 100644
index 0000000..8bf4e9b
--- /dev/null
+++ b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateAbstractRegionAccessStrategy.java
@@ -0,0 +1,102 @@
+/*
+ * 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.cache.hibernate;
+
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.spi.access.RegionAccessStrategy;
+import org.hibernate.cache.spi.access.SoftLock;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Implementation of L2 cache access strategy delegating to {@link HibernateAccessStrategyAdapter}.
+ */
+public abstract class HibernateAbstractRegionAccessStrategy implements RegionAccessStrategy {
+    /** */
+    final HibernateAccessStrategyAdapter stgy;
+
+    /**
+     * @param stgy Access strategy implementation.
+     */
+    HibernateAbstractRegionAccessStrategy(HibernateAccessStrategyAdapter stgy) {
+        this.stgy = stgy;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public Object get(Object key, long txTs) throws CacheException {
+        return stgy.get(key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean putFromLoad(Object key, Object val, long txTs, Object ver) throws CacheException {
+        stgy.putFromLoad(key, val);
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean putFromLoad(Object key, Object val, long txTs, Object ver, boolean minimalPutOverride)
+        throws CacheException {
+        stgy.putFromLoad(key, val, minimalPutOverride);
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public SoftLock lockItem(Object key, Object ver) throws CacheException {
+        stgy.lock(key);
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public SoftLock lockRegion() throws CacheException {
+        stgy.lockRegion();
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void unlockRegion(SoftLock lock) throws CacheException {
+        stgy.unlockRegion();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void unlockItem(Object key, SoftLock lock) throws CacheException {
+        stgy.unlock(key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void remove(Object key) throws CacheException {
+        stgy.remove(key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void removeAll() throws CacheException {
+        stgy.removeAll();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void evict(Object key) throws CacheException {
+        stgy.evict(key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void evictAll() throws CacheException {
+        stgy.evictAll();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateCollectionRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateCollectionRegion.java b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateCollectionRegion.java
new file mode 100644
index 0000000..dae476c
--- /dev/null
+++ b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateCollectionRegion.java
@@ -0,0 +1,100 @@
+/*
+ * 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.cache.hibernate;
+
+import org.apache.ignite.Ignite;
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.spi.CacheDataDescription;
+import org.hibernate.cache.spi.CollectionRegion;
+import org.hibernate.cache.spi.access.AccessType;
+import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy;
+
+/**
+ * Implementation of {@link CollectionRegion}. This region is used to store collection data.
+ * <p>
+ * L2 cache for collection can be enabled in the Hibernate configuration file:
+ * <pre name="code" class="xml">
+ * &lt;hibernate-configuration&gt;
+ *     &lt;!-- Enable L2 cache. --&gt;
+ *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
+ *
+ *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
+ *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
+ *
+ *     &lt;!-- Specify entities. --&gt;
+ *     &lt;mapping class="com.example.Entity"/&gt;
+ *     &lt;mapping class="com.example.ChildEntity"/&gt;
+ *
+ *     &lt;!-- Enable L2 cache with nonstrict-read-write access strategy for entities and collection. --&gt;
+ *     &lt;collection-cache collection="com.example.Entity" usage="nonstrict-read-write"/&gt;
+ *     &lt;collection-cache collection="com.example.ChildEntity" usage="nonstrict-read-write"/&gt;
+ *     &lt;collection-cache collection="com.example.Entity.children" usage="nonstrict-read-write"/&gt;
+ * &lt;/hibernate-configuration&gt;
+ * </pre>
+ * Also cache for collection can be enabled using annotations:
+ * <pre name="code" class="java">
+ * &#064;javax.persistence.Entity
+ * public class Entity {
+ *    ...
+ *
+ *    &#064;javax.persistence.OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
+ *    &#064;javax.persistence.JoinColumn(name="PARENT_ID")
+ *    &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+ *    public List&lt;ChildEntity&gt; getChildren() {...}
+ * }
+ * </pre>
+ * Note: the collection cache does not cache the state of the actual entities in the cache, it caches only identifier
+ * values. For this reason, the collection cache should always be used in conjunction with
+ * the second-level cache for those entities expected to be cached as part of a collection cache.
+ */
+public class HibernateCollectionRegion extends HibernateTransactionalDataRegion implements CollectionRegion {
+    /**
+     * @param factory Region factory.
+     * @param name Region name.
+     * @param ignite Grid.
+     * @param cache Region cache.
+     * @param dataDesc Region data description.
+     */
+    HibernateCollectionRegion(HibernateRegionFactory factory, String name,
+        Ignite ignite, HibernateCacheProxy cache, CacheDataDescription dataDesc) {
+        super(factory, name, ignite, cache, dataDesc);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
+        return new AccessStrategy(createAccessStrategy(accessType));
+    }
+
+    /**
+     * Collection region access strategy.
+     */
+    private class AccessStrategy extends HibernateAbstractRegionAccessStrategy
+        implements CollectionRegionAccessStrategy {
+        /**
+         * @param stgy Access strategy implementation.
+         */
+        private AccessStrategy(HibernateAccessStrategyAdapter stgy) {
+            super(stgy);
+        }
+
+        /** {@inheritDoc} */
+        @Override public CollectionRegion getRegion() {
+            return HibernateCollectionRegion.this;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateEntityRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateEntityRegion.java b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateEntityRegion.java
new file mode 100644
index 0000000..db921dc
--- /dev/null
+++ b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateEntityRegion.java
@@ -0,0 +1,112 @@
+/*
+ * 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.cache.hibernate;
+
+import org.apache.ignite.Ignite;
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.spi.CacheDataDescription;
+import org.hibernate.cache.spi.EntityRegion;
+import org.hibernate.cache.spi.access.AccessType;
+import org.hibernate.cache.spi.access.EntityRegionAccessStrategy;
+import org.hibernate.cache.spi.access.SoftLock;
+
+/**
+ * Implementation of {@link EntityRegion}. This region is used to store entity data.
+ * <p>
+ * L2 cache for entity can be enabled in the Hibernate configuration file:
+ * <pre name="code" class="xml">
+ * &lt;hibernate-configuration&gt;
+ *     &lt;!-- Enable L2 cache. --&gt;
+ *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
+ *
+ *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
+ *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
+ *
+ *     &lt;!-- Specify entity. --&gt;
+ *     &lt;mapping class="com.example.Entity"/&gt;
+ *
+ *     &lt;!-- Enable L2 cache with nonstrict-read-write access strategy for entity. --&gt;
+ *     &lt;class-cache class="com.example.Entity" usage="nonstrict-read-write"/&gt;
+ * &lt;/hibernate-configuration&gt;
+ * </pre>
+ * Also cache for entity can be enabled using annotations:
+ * <pre name="code" class="java">
+ * &#064;javax.persistence.Entity
+ * &#064;javax.persistence.Cacheable
+ * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+ * public class Entity { ... }
+ * </pre>
+ */
+public class HibernateEntityRegion extends HibernateTransactionalDataRegion implements EntityRegion {
+    /**
+     * @param factory Region factory.
+     * @param name Region name.
+     * @param ignite Grid.
+     * @param cache Region cache,
+     * @param dataDesc Region data description.
+     */
+    HibernateEntityRegion(HibernateRegionFactory factory, String name, Ignite ignite,
+        HibernateCacheProxy cache, CacheDataDescription dataDesc) {
+        super(factory, name, ignite, cache, dataDesc);
+    }
+
+    /** {@inheritDoc} */
+    @Override public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
+        return new AccessStrategy(createAccessStrategy(accessType));
+    }
+
+    /**
+     * Entity region access strategy.
+     */
+    private class AccessStrategy extends HibernateAbstractRegionAccessStrategy
+        implements EntityRegionAccessStrategy {
+        /**
+         * @param stgy Access strategy implementation.
+         */
+        private AccessStrategy(HibernateAccessStrategyAdapter stgy) {
+            super(stgy);
+        }
+
+        /** {@inheritDoc} */
+        @Override public EntityRegion getRegion() {
+            return HibernateEntityRegion.this;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean insert(Object key, Object val, Object ver) throws CacheException {
+            return stgy.insert(key, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean afterInsert(Object key, Object val, Object ver) throws CacheException {
+            return stgy.afterInsert(key, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean update(Object key, Object val, Object currVer, Object previousVer)
+            throws CacheException {
+            return stgy.update(key, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean afterUpdate(Object key, Object val, Object currVer, Object previousVer, SoftLock lock)
+            throws CacheException {
+            return stgy.afterUpdate(key, val);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateGeneralDataRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateGeneralDataRegion.java b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateGeneralDataRegion.java
new file mode 100644
index 0000000..578d88b
--- /dev/null
+++ b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateGeneralDataRegion.java
@@ -0,0 +1,76 @@
+/*
+ * 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.cache.hibernate;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.spi.GeneralDataRegion;
+import org.hibernate.cache.spi.QueryResultsRegion;
+import org.hibernate.cache.spi.TimestampsRegion;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Implementation of {@link GeneralDataRegion}. This interface defines common contract for {@link QueryResultsRegion}
+ * and {@link TimestampsRegion}.
+ */
+public class HibernateGeneralDataRegion extends HibernateRegion implements GeneralDataRegion {
+    /**
+     * @param factory Region factory.
+     * @param name Region name.
+     * @param ignite Grid.
+     * @param cache Region cache.
+     */
+    HibernateGeneralDataRegion(HibernateRegionFactory factory, String name,
+        Ignite ignite, HibernateCacheProxy cache) {
+        super(factory, name, ignite, cache);
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public Object get(Object key) throws CacheException {
+        try {
+            return cache.get(key);
+        } catch (IgniteCheckedException e) {
+            throw new CacheException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void put(Object key, Object val) throws CacheException {
+        try {
+            cache.put(key, val);
+        } catch (IgniteCheckedException e) {
+            throw new CacheException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void evict(Object key) throws CacheException {
+        HibernateAccessStrategyAdapter.evict(ignite, cache, key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void evictAll() throws CacheException {
+        try {
+            HibernateAccessStrategyAdapter.evictAll(cache);
+        }
+        catch (IgniteCheckedException e) {
+            throw HibernateRegionFactory.EXCEPTION_CONVERTER.convert(e);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyWrapper.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyWrapper.java b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyWrapper.java
new file mode 100644
index 0000000..64de395
--- /dev/null
+++ b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyWrapper.java
@@ -0,0 +1,73 @@
+/*
+ * 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.cache.hibernate;
+
+import java.io.Serializable;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * Hibernate cache key wrapper.
+ */
+public class HibernateKeyWrapper implements Serializable {
+    /** Key. */
+    private final Object key;
+
+    /** Entry. */
+    private final String entry;
+
+    /** */
+    private final String tenantId;
+
+    /**
+     * @param key Key.
+     * @param entry Entry.
+     * @param tenantId Tenant ID.
+     */
+    HibernateKeyWrapper(Object key, String entry, String tenantId) {
+        this.key = key;
+        this.entry = entry;
+        this.tenantId = tenantId;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o) return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        HibernateKeyWrapper that = (HibernateKeyWrapper) o;
+
+        return (key != null ? key.equals(that.key) : that.key == null) &&
+            (entry != null ? entry.equals(that.entry) : that.entry == null) &&
+            (tenantId != null ? tenantId.equals(that.tenantId) : that.tenantId == null);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = key != null ? key.hashCode() : 0;
+        res = 31 * res + (entry != null ? entry.hashCode() : 0);
+        res = 31 * res + (tenantId != null ? tenantId.hashCode() : 0);
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(HibernateKeyWrapper.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateNaturalIdRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateNaturalIdRegion.java b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateNaturalIdRegion.java
new file mode 100644
index 0000000..ae1099d
--- /dev/null
+++ b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateNaturalIdRegion.java
@@ -0,0 +1,103 @@
+/*
+ * 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.cache.hibernate;
+
+import org.apache.ignite.Ignite;
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.spi.CacheDataDescription;
+import org.hibernate.cache.spi.NaturalIdRegion;
+import org.hibernate.cache.spi.access.AccessType;
+import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy;
+import org.hibernate.cache.spi.access.SoftLock;
+
+/**
+ * Implementation of {@link NaturalIdRegion}. This region is used to store naturalId data.
+ * <p>
+ * L2 cache for entity naturalId and target cache region can be set using annotations:
+ * <pre name="code" class="java">
+ * &#064;javax.persistence.Entity
+ * &#064;javax.persistence.Cacheable
+ * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+ * &#064;org.hibernate.annotations.NaturalIdCache
+ * public class Entity {
+ *     &#064;org.hibernate.annotations.NaturalId
+ *     private String entityCode;
+ *
+ *     ...
+ * }
+ * </pre>
+ */
+public class HibernateNaturalIdRegion extends HibernateTransactionalDataRegion implements NaturalIdRegion {
+    /**
+     * @param factory Region factory.
+     * @param name Region name.
+     * @param ignite Grid.
+     * @param cache Region cache,
+     * @param dataDesc Region data description.
+     */
+    HibernateNaturalIdRegion(HibernateRegionFactory factory,
+        String name,
+        Ignite ignite,
+        HibernateCacheProxy cache,
+        CacheDataDescription dataDesc) {
+        super(factory, name, ignite, cache, dataDesc);
+    }
+
+    /** {@inheritDoc} */
+    @Override public NaturalIdRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
+        return new AccessStrategy(createAccessStrategy(accessType));
+    }
+
+    /**
+     * NaturalId region access strategy.
+     */
+    private class AccessStrategy extends HibernateAbstractRegionAccessStrategy implements
+        NaturalIdRegionAccessStrategy {
+        /**
+         * @param stgy Access strategy implementation.
+         */
+        private AccessStrategy(HibernateAccessStrategyAdapter stgy) {
+            super(stgy);
+        }
+
+        /** {@inheritDoc} */
+        @Override public NaturalIdRegion getRegion() {
+            return HibernateNaturalIdRegion.this;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean insert(Object key, Object val) throws CacheException {
+            return stgy.insert(key, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean afterInsert(Object key, Object val) throws CacheException {
+            return stgy.afterInsert(key, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean update(Object key, Object val) throws CacheException {
+            return stgy.update(key, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean afterUpdate(Object key, Object val, SoftLock lock) throws CacheException {
+            return stgy.afterUpdate(key, val);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateQueryResultsRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateQueryResultsRegion.java b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateQueryResultsRegion.java
new file mode 100644
index 0000000..fccbb5e
--- /dev/null
+++ b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateQueryResultsRegion.java
@@ -0,0 +1,70 @@
+/*
+ * 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.cache.hibernate;
+
+import org.apache.ignite.Ignite;
+import org.hibernate.Query;
+import org.hibernate.cache.spi.QueryResultsRegion;
+
+/**
+ * Implementation of {@link QueryResultsRegion}. This region is used to store query results.
+ * <p>
+ * Query results caching can be enabled in the Hibernate configuration file:
+ * <pre name="code" class="xml">
+ * &lt;hibernate-configuration&gt;
+ *     &lt;!-- Enable L2 cache. --&gt;
+ *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
+ *
+ *     &lt;!-- Enable query cache. --&gt;
+ *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
+
+ *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
+ *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
+ *
+ *     &lt;!-- Specify entity. --&gt;
+ *     &lt;mapping class="com.example.Entity"/&gt;
+ *
+ *     &lt;!-- Enable L2 cache with nonstrict-read-write access strategy for entity. --&gt;
+ *     &lt;class-cache class="com.example.Entity" usage="nonstrict-read-write"/&gt;
+ * &lt;/hibernate-configuration&gt;
+ * </pre>
+ * By default queries are not cached even after enabling query caching, to enable results caching for a particular
+ * query, call {@link Query#setCacheable(boolean)}:
+ * <pre name="code" class="java">
+ *     Session ses = getSession();
+ *
+ *     Query qry = ses.createQuery("...");
+ *
+ *     qry.setCacheable(true); // Enable L2 cache for query.
+ * </pre>
+ * Note: the query cache does not cache the state of the actual entities in the cache, it caches only identifier
+ * values. For this reason, the query cache should always be used in conjunction with
+ * the second-level cache for those entities expected to be cached as part of a query result cache
+ */
+class HibernateQueryResultsRegion extends HibernateGeneralDataRegion implements QueryResultsRegion {
+    /**
+     * @param factory Region factory.
+     * @param name Region name.
+     * @param ignite Grid.
+     * @param cache Region cache.
+     */
+    HibernateQueryResultsRegion(HibernateRegionFactory factory, String name,
+        Ignite ignite, HibernateCacheProxy cache) {
+        super(factory, name, ignite, cache);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegion.java b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegion.java
new file mode 100644
index 0000000..3666732
--- /dev/null
+++ b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegion.java
@@ -0,0 +1,99 @@
+/*
+ * 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.cache.hibernate;
+
+import java.util.Collections;
+import java.util.Map;
+import org.apache.ignite.Ignite;
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.spi.Region;
+
+/**
+ * Implementation of {@link Region}. This interface defines base contract for all L2 cache regions.
+ */
+public class HibernateRegion implements Region {
+    /** */
+    protected final HibernateRegionFactory factory;
+
+    /** */
+    private final String name;
+
+    /** Cache instance. */
+    protected final HibernateCacheProxy cache;
+
+    /** Grid instance. */
+    protected Ignite ignite;
+
+    /**
+     * @param factory Region factory.
+     * @param name Region name.
+     * @param ignite Grid.
+     * @param cache Region cache.
+     */
+    HibernateRegion(HibernateRegionFactory factory, String name, Ignite ignite, HibernateCacheProxy cache) {
+        this.factory = factory;
+        this.name = name;
+        this.ignite = ignite;
+        this.cache = cache;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getName() {
+        return name;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void destroy() throws CacheException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean contains(Object key) {
+        return cache.containsKey(key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSizeInMemory() {
+        return -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getElementCountInMemory() {
+        return cache.size();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getElementCountOnDisk() {
+        return -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Map toMap() {
+        return Collections.emptyMap();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long nextTimestamp() {
+        return System.currentTimeMillis();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTimeout() {
+        return 0;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegionFactory.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegionFactory.java b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegionFactory.java
new file mode 100644
index 0000000..5667eb2
--- /dev/null
+++ b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegionFactory.java
@@ -0,0 +1,179 @@
+/*
+ * 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.cache.hibernate;
+
+import java.util.Properties;
+import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.spi.CacheDataDescription;
+import org.hibernate.cache.spi.CacheKey;
+import org.hibernate.cache.spi.CollectionRegion;
+import org.hibernate.cache.spi.EntityRegion;
+import org.hibernate.cache.spi.NaturalIdRegion;
+import org.hibernate.cache.spi.QueryResultsRegion;
+import org.hibernate.cache.spi.RegionFactory;
+import org.hibernate.cache.spi.TimestampsRegion;
+import org.hibernate.cache.spi.access.AccessType;
+import org.hibernate.cfg.Settings;
+
+import static org.apache.ignite.cache.hibernate.HibernateAccessStrategyFactory.DFLT_ACCESS_TYPE_PROPERTY;
+import static org.hibernate.cache.spi.access.AccessType.NONSTRICT_READ_WRITE;
+
+/**
+ * Hibernate L2 cache region factory.
+ * <p>
+ * Following Hibernate settings should be specified to enable second level cache and to use this
+ * region factory for caching:
+ * <pre name="code" class="brush: xml; gutter: false;">
+ * hibernate.cache.use_second_level_cache=true
+ * hibernate.cache.region.factory_class=org.apache.ignite.cache.hibernate.HibernateRegionFactory
+ * </pre>
+ * Note that before region factory is started you need to start properly configured Ignite node in the same JVM.
+ * For example to start Ignite node one of loader provided in {@code org.apache.ignite.grid.startup} package can be used.
+ * <p>
+ * Name of Ignite instance to be used for region factory must be specified as following Hibernate property:
+ * <pre name="code" class="brush: xml; gutter: false;">
+ * org.apache.ignite.hibernate.ignite_instance_name=&lt;Ignite instance name&gt;
+ * </pre>
+ * Each Hibernate cache region must be associated with some {@link IgniteInternalCache}, by default it is assumed that
+ * for each cache region there is a {@link IgniteInternalCache} with the same name. Also it is possible to define
+ * region to cache mapping using properties with prefix {@code org.apache.ignite.hibernate.region_cache}.
+ * For example if for region with name "region1" cache with name "cache1" should be used then following
+ * Hibernate property should be specified:
+ * <pre name="code" class="brush: xml; gutter: false;">
+ * org.apache.ignite.hibernate.region_cache.region1=cache1
+ * </pre>
+ */
+public class HibernateRegionFactory implements RegionFactory {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    static final HibernateExceptionConverter EXCEPTION_CONVERTER = new HibernateExceptionConverter() {
+        @Override public RuntimeException convert(Exception e) {
+            return new CacheException(e);
+        }
+    };
+
+    /** Default region access type. */
+    private AccessType dfltAccessType;
+
+    /** Key transformer. */
+    private final HibernateKeyTransformer hibernate4transformer = new HibernateKeyTransformer() {
+        @Override public Object transform(Object key) {
+            if (key instanceof CacheKey) {
+                CacheKey cacheKey = (CacheKey)key;
+
+                return new HibernateKeyWrapper(
+                    cacheKey.getKey(),
+                    cacheKey.getEntityOrRoleName(),
+                    cacheKey.getTenantId()
+                );
+            }
+
+            return key;
+        }
+    };
+
+    /** */
+    private final HibernateAccessStrategyFactory accessStgyFactory =
+        new HibernateAccessStrategyFactory(hibernate4transformer, EXCEPTION_CONVERTER);
+
+    /** {@inheritDoc} */
+    @Override public void start(Settings settings, Properties props) throws CacheException {
+        String accessType = props.getProperty(DFLT_ACCESS_TYPE_PROPERTY, NONSTRICT_READ_WRITE.name());
+
+        dfltAccessType = AccessType.valueOf(accessType);
+
+        accessStgyFactory.start(props);
+    }
+
+    /**
+     * @return Access strategy factory.
+     */
+    HibernateAccessStrategyFactory accessStrategyFactory() {
+        return accessStgyFactory;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop() {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isMinimalPutsEnabledByDefault() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public AccessType getDefaultAccessType() {
+        return dfltAccessType;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long nextTimestamp() {
+        return System.currentTimeMillis();
+    }
+
+    /** {@inheritDoc} */
+    @Override public EntityRegion buildEntityRegion(String regionName, Properties props, CacheDataDescription metadata)
+        throws CacheException {
+        return new HibernateEntityRegion(this,
+            regionName,
+            accessStgyFactory.node(),
+            accessStgyFactory.regionCache(regionName),
+            metadata);
+    }
+
+    /** {@inheritDoc} */
+    @Override public NaturalIdRegion buildNaturalIdRegion(String regionName, Properties props,
+        CacheDataDescription metadata) throws CacheException {
+        return new HibernateNaturalIdRegion(this,
+            regionName,
+            accessStgyFactory.node(),
+            accessStgyFactory.regionCache(regionName),
+            metadata);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CollectionRegion buildCollectionRegion(String regionName, Properties props,
+        CacheDataDescription metadata) throws CacheException {
+        return new HibernateCollectionRegion(this,
+            regionName,
+            accessStgyFactory.node(),
+            accessStgyFactory.regionCache(regionName),
+            metadata);
+    }
+
+    /** {@inheritDoc} */
+    @Override public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties props)
+        throws CacheException {
+        return new HibernateQueryResultsRegion(this,
+            regionName,
+            accessStgyFactory.node(),
+            accessStgyFactory.regionCache(regionName));
+    }
+
+    /** {@inheritDoc} */
+    @Override public TimestampsRegion buildTimestampsRegion(String regionName, Properties props) throws CacheException {
+        return new HibernateTimestampsRegion(this,
+            regionName,
+            accessStgyFactory.node(),
+            accessStgyFactory.regionCache(regionName));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateTimestampsRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateTimestampsRegion.java b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateTimestampsRegion.java
new file mode 100644
index 0000000..8b4c243
--- /dev/null
+++ b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateTimestampsRegion.java
@@ -0,0 +1,39 @@
+/*
+ * 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.cache.hibernate;
+
+import org.apache.ignite.Ignite;
+import org.hibernate.cache.spi.TimestampsRegion;
+
+/**
+ * Implementation of {@link TimestampsRegion}. This region is automatically created when query
+ * caching is enabled and it holds most recent updates timestamps to queryable tables.
+ * Name of timestamps region is {@code "org.hibernate.cache.spi.UpdateTimestampsCache"}.
+ */
+public class HibernateTimestampsRegion extends HibernateGeneralDataRegion implements TimestampsRegion {
+    /**
+     * @param factory Region factory.
+     * @param name Region name.
+     * @param ignite Grid.
+     * @param cache Region cache.
+     */
+    public HibernateTimestampsRegion(HibernateRegionFactory factory, String name,
+        Ignite ignite,  HibernateCacheProxy cache) {
+        super(factory, name, ignite, cache);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalDataRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalDataRegion.java b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalDataRegion.java
new file mode 100644
index 0000000..275ea9e
--- /dev/null
+++ b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalDataRegion.java
@@ -0,0 +1,84 @@
+/*
+ * 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.cache.hibernate;
+
+import org.apache.ignite.Ignite;
+import org.hibernate.cache.spi.CacheDataDescription;
+import org.hibernate.cache.spi.CollectionRegion;
+import org.hibernate.cache.spi.EntityRegion;
+import org.hibernate.cache.spi.NaturalIdRegion;
+import org.hibernate.cache.spi.TransactionalDataRegion;
+import org.hibernate.cache.spi.access.AccessType;
+
+/**
+ * Implementation of {@link TransactionalDataRegion} (transactional means that
+ * data in the region is updated in connection with database transaction).
+ * This interface defines base contract for {@link EntityRegion}, {@link CollectionRegion}
+ * and {@link NaturalIdRegion}.
+ */
+public class HibernateTransactionalDataRegion extends HibernateRegion implements TransactionalDataRegion {
+    /** */
+    private final CacheDataDescription dataDesc;
+
+    /**
+     * @param factory Region factory.
+     * @param name Region name.
+     * @param ignite Grid.
+     * @param cache Region cache.
+     * @param dataDesc Region data description.
+     */
+    HibernateTransactionalDataRegion(HibernateRegionFactory factory, String name,
+        Ignite ignite, HibernateCacheProxy cache, CacheDataDescription dataDesc) {
+        super(factory, name, ignite, cache);
+
+        this.dataDesc = dataDesc;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isTransactionAware() {
+        return false; // This method is not used by Hibernate.
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheDataDescription getCacheDataDescription() {
+        return dataDesc;
+    }
+
+    /**
+     * @param accessType Hibernate L2 cache access type.
+     * @return Access strategy for given access type.
+     */
+    HibernateAccessStrategyAdapter createAccessStrategy(AccessType accessType) {
+        switch (accessType) {
+            case READ_ONLY:
+                return factory.accessStrategyFactory().createReadOnlyStrategy(cache);
+
+            case NONSTRICT_READ_WRITE:
+                return factory.accessStrategyFactory().createNonStrictReadWriteStrategy(cache);
+
+            case READ_WRITE:
+                return factory.accessStrategyFactory().createReadWriteStrategy(cache);
+
+            case TRANSACTIONAL:
+                return factory.accessStrategyFactory().createTransactionalStrategy(cache);
+
+            default:
+                throw new IllegalArgumentException("Unknown Hibernate access type: " + accessType);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/package-info.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/package-info.java b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/package-info.java
new file mode 100644
index 0000000..1179aec
--- /dev/null
+++ b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/hibernate/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * 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 description. -->
+ * Contains implementation of Hibernate L2 cache. Refer to
+ * <i>org.apache.ignite.examples.datagrid.hibernate.HibernateL2CacheExample</i> for more information on how to
+ * configure and use Ignite with Hibernate.
+ */
+package org.apache.ignite.cache.hibernate;
\ No newline at end of file


[42/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
index 68ba28f..b130ad9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
@@ -89,15 +89,15 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         for (int i = 0; i < gridCount(); i++) {
             Ignite g = grid(i);
 
-            g.cache(null).removeAll();
+            g.cache(DEFAULT_CACHE_NAME).removeAll();
 
-            assert g.cache(null).localSize() == 0;
+            assert g.cache(DEFAULT_CACHE_NAME).localSize() == 0;
         }
 
         for (int i = 0; i < gridCount(); i++) {
             Ignite g = grid(i);
 
-            g.cache(null).localMxBean().clear();
+            g.cache(DEFAULT_CACHE_NAME).localMxBean().clear();
 
             g.transactions().resetMetrics();
         }
@@ -110,7 +110,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         for (int i = 0; i < gridCount(); i++) {
             Ignite g = grid(i);
 
-            g.cache(null).getConfiguration(CacheConfiguration.class).setStatisticsEnabled(true);
+            g.cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).setStatisticsEnabled(true);
         }
     }
 
@@ -122,10 +122,10 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         for (int i = 0; i < gridCount(); i++) {
             Ignite g = grid(i);
 
-            g.cache(null).getConfiguration(CacheConfiguration.class).setStatisticsEnabled(false);
+            g.cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).setStatisticsEnabled(false);
         }
 
-        IgniteCache<Object, Object> jcache = grid(0).cache(null);
+        IgniteCache<Object, Object> jcache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         // Write to cache.
         for (int i = 0; i < KEY_CNT; i++)
@@ -141,7 +141,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         // Assert that statistics is clear.
         for (int i = 0; i < gridCount(); i++) {
-            CacheMetrics m = grid(i).cache(null).localMetrics();
+            CacheMetrics m = grid(i).cache(DEFAULT_CACHE_NAME).localMetrics();
 
             assertEquals(m.getCacheGets(), 0);
             assertEquals(m.getCachePuts(), 0);
@@ -160,7 +160,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testGetMetricsSnapshot() throws Exception {
-        IgniteCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         assertNotSame("Method metrics() should return snapshot.", cache.localMetrics(), cache.localMetrics());
     }
@@ -169,7 +169,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testGetAndRemoveAsyncAvgTime() throws Exception {
-        IgniteCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < KEY_CNT; i++)
             cache.put(i, i);
@@ -186,7 +186,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testRemoveAsyncValAvgTime() throws Exception {
-        IgniteCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         Integer key = 0;
 
@@ -213,7 +213,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testRemoveAvgTime() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < KEY_CNT; i++)
             cache.put(i, i);
@@ -230,7 +230,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testRemoveAllAvgTime() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.put(1, 1);
         cache.put(2, 2);
@@ -254,7 +254,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testRemoveAllAsyncAvgTime() throws Exception {
-        IgniteCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         Set<Integer> keys = new LinkedHashSet<>();
 
@@ -283,7 +283,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testGetAvgTime() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.put(1, 1);
 
@@ -304,7 +304,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testGetAllAvgTime() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         assertEquals(0.0, cache.localMetrics().getAverageGetTime(), 0.0);
 
@@ -328,7 +328,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testGetAllAsyncAvgTime() throws Exception {
-        IgniteCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         assertEquals(0.0, cache.localMetrics().getAverageGetTime(), 0.0);
 
@@ -356,7 +356,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testPutAvgTime() throws Exception {
-        final IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        final IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         assertEquals(0.0, cache.localMetrics().getAveragePutTime(), 0.0);
         assertEquals(0, cache.localMetrics().getCachePuts());
@@ -373,7 +373,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testPutAsyncAvgTime() throws Exception {
-        IgniteCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         assertEquals(0.0, cache.localMetrics().getAveragePutTime(), 0.0);
         assertEquals(0, cache.localMetrics().getCachePuts());
@@ -389,7 +389,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testGetAndPutAsyncAvgTime() throws Exception {
-        IgniteCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         Integer key = null;
 
@@ -416,7 +416,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testPutIfAbsentAsyncAvgTime() throws Exception {
-        IgniteCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         Integer key = null;
 
@@ -441,7 +441,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testGetAndPutIfAbsentAsyncAvgTime() throws Exception {
-        IgniteCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         Integer key = null;
 
@@ -466,7 +466,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testPutAllAvgTime() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         assertEquals(0.0, cache.localMetrics().getAveragePutTime(), 0.0);
         assertEquals(0, cache.localMetrics().getCachePuts());
@@ -489,7 +489,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testPutsReads() throws Exception {
-        IgniteCache<Integer, Integer> cache0 = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache0 = grid(0).cache(DEFAULT_CACHE_NAME);
 
         int keyCnt = keyCount();
 
@@ -508,7 +508,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
             info("Puts: " + cache0.localMetrics().getCachePuts());
 
             for (int j = 0; j < gridCount(); j++) {
-                IgniteCache<Integer, Integer> cache = grid(j).cache(null);
+                IgniteCache<Integer, Integer> cache = grid(j).cache(DEFAULT_CACHE_NAME);
 
                 int cacheWrites = (int)cache.localMetrics().getCachePuts();
 
@@ -527,7 +527,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         int misses = 0;
 
         for (int i = 0; i < gridCount(); i++) {
-            CacheMetrics m = grid(i).cache(null).localMetrics();
+            CacheMetrics m = grid(i).cache(DEFAULT_CACHE_NAME).localMetrics();
 
             puts += m.getCachePuts();
             reads += m.getCacheGets();
@@ -547,7 +547,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testMissHitPercentage() throws Exception {
-        IgniteCache<Integer, Integer> cache0 = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache0 = grid(0).cache(DEFAULT_CACHE_NAME);
 
         final int keyCnt = keyCount();
 
@@ -558,7 +558,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
             info("Puts: " + cache0.localMetrics().getCachePuts());
 
             for (int j = 0; j < gridCount(); j++) {
-                IgniteCache<Integer, Integer> cache = grid(j).cache(null);
+                IgniteCache<Integer, Integer> cache = grid(j).cache(DEFAULT_CACHE_NAME);
 
                 long cacheWrites = cache.localMetrics().getCachePuts();
 
@@ -570,7 +570,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         // Check metrics for the whole cache.
         for (int i = 0; i < gridCount(); i++) {
-            CacheMetrics m = grid(i).cache(null).localMetrics();
+            CacheMetrics m = grid(i).cache(DEFAULT_CACHE_NAME).localMetrics();
 
             assertEquals(m.getCacheHits() * 100f / m.getCacheGets(), m.getCacheHitPercentage(), 0.1f);
             assertEquals(m.getCacheMisses() * 100f / m.getCacheGets(), m.getCacheMissPercentage(), 0.1f);
@@ -583,7 +583,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
     public void testMisses() throws Exception {
         fail("https://issues.apache.org/jira/browse/IGNITE-4536");
 
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         int keyCnt = keyCount();
 
@@ -607,7 +607,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         long misses = 0;
 
         for (int i = 0; i < gridCount(); i++) {
-            CacheMetrics m = grid(i).cache(null).localMetrics();
+            CacheMetrics m = grid(i).cache(DEFAULT_CACHE_NAME).localMetrics();
 
             puts += m.getCachePuts();
             reads += m.getCacheGets();
@@ -627,7 +627,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
     public void testMissesOnEmptyCache() throws Exception {
         fail("https://issues.apache.org/jira/browse/IGNITE-4536");
 
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         assertEquals("Expected 0 read", 0, cache.localMetrics().getCacheGets());
         assertEquals("Expected 0 miss", 0, cache.localMetrics().getCacheMisses());
@@ -665,7 +665,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testRemoves() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.put(1, 1);
 
@@ -681,7 +681,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
     public void testManualEvictions() throws Exception {
         fail("https://issues.apache.org/jira/browse/IGNITE-4536");
 
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         if (cache.getConfiguration(CacheConfiguration.class).getCacheMode() == CacheMode.PARTITIONED)
             return;
@@ -698,7 +698,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testTxEvictions() throws Exception {
-        if (grid(0).cache(null).getConfiguration(CacheConfiguration.class).getAtomicityMode() != CacheAtomicityMode.ATOMIC)
+        if (grid(0).cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getAtomicityMode() != CacheAtomicityMode.ATOMIC)
             checkTtl(true);
     }
 
@@ -706,7 +706,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testNonTxEvictions() throws Exception {
-        if (grid(0).cache(null).getConfiguration(CacheConfiguration.class).getAtomicityMode() == CacheAtomicityMode.ATOMIC)
+        if (grid(0).cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getAtomicityMode() == CacheAtomicityMode.ATOMIC)
             checkTtl(false);
     }
 
@@ -719,13 +719,13 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
 
         final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl));
 
-        final IgniteCache<Integer, Integer> c = grid(0).cache(null);
+        final IgniteCache<Integer, Integer> c = grid(0).cache(DEFAULT_CACHE_NAME);
 
         final Integer key = primaryKeys(jcache(0), 1, 0).get(0);
 
         c.put(key, 1);
 
-        GridCacheAdapter<Object, Object> c0 = ((IgniteKernal)grid(0)).internalCache();
+        GridCacheAdapter<Object, Object> c0 = ((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME);
 
         if (c0.isNear())
             c0 = c0.context().near().dht();
@@ -744,13 +744,13 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
             Transaction tx = grid(0).transactions().txStart();
 
             try {
-                grid(0).cache(null).withExpiryPolicy(expiry).put(key, 1);
+                grid(0).cache(DEFAULT_CACHE_NAME).withExpiryPolicy(expiry).put(key, 1);
             }
             finally {
                 tx.rollback();
             }
 
-            entry = ((IgniteKernal)grid(0)).internalCache().entryEx(key);
+            entry = ((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME).entryEx(key);
 
             assertEquals(0, entry.ttl());
             assertEquals(0, entry.expireTime());
@@ -760,7 +760,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         Transaction tx = inTx ? grid(0).transactions().txStart() : null;
 
         try {
-            grid(0).cache(null).withExpiryPolicy(expiry).put(key, 1);
+            grid(0).cache(DEFAULT_CACHE_NAME).withExpiryPolicy(expiry).put(key, 1);
         }
         finally {
             if (tx != null)
@@ -770,8 +770,8 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         long[] expireTimes = new long[gridCount()];
 
         for (int i = 0; i < gridCount(); i++) {
-            if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key)) {
-                c0 = ((IgniteKernal)grid(i)).internalCache();
+            if (grid(i).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid(i).localNode(), key)) {
+                c0 = ((IgniteKernal)grid(i)).internalCache(DEFAULT_CACHE_NAME);
 
                 if (c0.isNear())
                     c0 = c0.context().near().dht();
@@ -792,7 +792,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         tx = inTx ? grid(0).transactions().txStart() : null;
 
         try {
-            grid(0).cache(null).withExpiryPolicy(expiry).put(key, 2);
+            grid(0).cache(DEFAULT_CACHE_NAME).withExpiryPolicy(expiry).put(key, 2);
         }
         finally {
             if (tx != null)
@@ -800,8 +800,8 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         }
 
         for (int i = 0; i < gridCount(); i++) {
-            if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key)) {
-                c0 = ((IgniteKernal)grid(i)).internalCache();
+            if (grid(i).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid(i).localNode(), key)) {
+                c0 = ((IgniteKernal)grid(i)).internalCache(DEFAULT_CACHE_NAME);
 
                 if (c0.isNear())
                     c0 = c0.context().near().dht();
@@ -822,7 +822,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         tx = inTx ? grid(0).transactions().txStart() : null;
 
         try {
-            grid(0).cache(null).withExpiryPolicy(expiry).put(key, 3);
+            grid(0).cache(DEFAULT_CACHE_NAME).withExpiryPolicy(expiry).put(key, 3);
         }
         finally {
             if (tx != null)
@@ -830,8 +830,8 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         }
 
         for (int i = 0; i < gridCount(); i++) {
-            if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key)) {
-                c0 = ((IgniteKernal)grid(i)).internalCache();
+            if (grid(i).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid(i).localNode(), key)) {
+                c0 = ((IgniteKernal)grid(i)).internalCache(DEFAULT_CACHE_NAME);
 
                 if (c0.isNear())
                     c0 = c0.context().near().dht();
@@ -864,8 +864,8 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         log.info("Put 4 done");
 
         for (int i = 0; i < gridCount(); i++) {
-            if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key)) {
-                c0 = ((IgniteKernal)grid(i)).internalCache();
+            if (grid(i).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid(i).localNode(), key)) {
+                c0 = ((IgniteKernal)grid(i)).internalCache(DEFAULT_CACHE_NAME);
 
                 if (c0.isNear())
                     c0 = c0.context().near().dht();
@@ -905,7 +905,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
             }
         }, Math.min(ttl * 10, getTestTimeout())));
 
-        c0 = ((IgniteKernal)grid(0)).internalCache();
+        c0 = ((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME);
 
         if (c0.isNear())
             c0 = c0.context().near().dht();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
index 0a36b75..faa19dc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractRemoveFailureTest.java
@@ -190,9 +190,9 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCommonAbstr
         final TransactionIsolation txIsolation) throws Exception {
         assertEquals(testClientNode(), (boolean) grid(0).configuration().isClientMode());
 
-        grid(0).destroyCache(null);
+        grid(0).destroyCache(DEFAULT_CACHE_NAME);
 
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
 
@@ -446,7 +446,7 @@ public abstract class GridCacheAbstractRemoveFailureTest extends GridCommonAbstr
         for (int i = 0; i < GRID_CNT; i++) {
             Ignite ignite = grid(i);
 
-            IgniteCache<Integer, Integer> cache = ignite.cache(null);
+            IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             for (Map.Entry<Integer, GridTuple<Integer>> expVal : expVals.entrySet()) {
                 Integer val = cache.get(expVal.getKey());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
index c40d44d..822537c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java
@@ -369,7 +369,7 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest {
      */
     @SuppressWarnings({"unchecked"})
     @Override protected IgniteCache<String, Integer> jcache(int idx) {
-        return ignite(idx).cache(null);
+        return ignite(idx).cache(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -381,7 +381,7 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest {
             throw new UnsupportedOperationException("Operation can't be done automatically via proxy. " +
                 "Send task with this logic on remote jvm instead.");
 
-        return ((IgniteKernal)grid(idx)).<String, Integer>internalCache().context();
+        return ((IgniteKernal)grid(idx)).<String, Integer>internalCache(DEFAULT_CACHE_NAME).context();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractUsersAffinityMapperSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractUsersAffinityMapperSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractUsersAffinityMapperSelfTest.java
index 1306319..37355f7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractUsersAffinityMapperSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractUsersAffinityMapperSelfTest.java
@@ -68,9 +68,8 @@ public abstract class GridCacheAbstractUsersAffinityMapperSelfTest extends GridC
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration cacheCfg = new CacheConfiguration();
+        CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
-        cacheCfg.setName(null);
         cacheCfg.setCacheMode(getCacheMode());
         cacheCfg.setAtomicityMode(getAtomicMode());
         cacheCfg.setNearConfiguration(nearConfiguration());
@@ -108,7 +107,7 @@ public abstract class GridCacheAbstractUsersAffinityMapperSelfTest extends GridC
      * @throws Exception If failed.
      */
     public void testAffinityMapper() throws Exception {
-        IgniteCache<Object, Object> cache = startGrid(0).cache(null);
+        IgniteCache<Object, Object> cache = startGrid(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < KEY_CNT; i++) {
             cache.put(String.valueOf(i), String.valueOf(i));
@@ -121,7 +120,7 @@ public abstract class GridCacheAbstractUsersAffinityMapperSelfTest extends GridC
         startGrid(1);
 
         for (int i = 0; i < KEY_CNT; i++)
-            grid(i % 2).compute().affinityRun((String)null, new TestAffinityKey(1, "1"), new NoopClosure());
+            grid(i % 2).compute().affinityRun(DEFAULT_CACHE_NAME, new TestAffinityKey(1, "1"), new NoopClosure());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityApiSelfTest.java
index 8294b0d..c146525 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityApiSelfTest.java
@@ -70,14 +70,14 @@ public class GridCacheAffinityApiSelfTest extends GridCacheAbstractSelfTest {
      * @return Affinity.
      */
     private AffinityFunction affinity() {
-        return ((IgniteKernal)grid(0)).internalCache().configuration().getAffinity();
+        return ((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME).configuration().getAffinity();
     }
 
     /**
      * @return Affinity mapper.
      */
     private AffinityKeyMapper affinityMapper() {
-        return ((IgniteKernal)grid(0)).internalCache().configuration().getAffinityMapper();
+        return ((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME).configuration().getAffinityMapper();
     }
 
     /**
@@ -86,7 +86,7 @@ public class GridCacheAffinityApiSelfTest extends GridCacheAbstractSelfTest {
      * @throws Exception If failed.
      */
     public void testPartitions() throws Exception {
-        assertEquals(affinity().partitions(), grid(0).affinity(null).partitions());
+        assertEquals(affinity().partitions(), grid(0).affinity(DEFAULT_CACHE_NAME).partitions());
     }
 
     /**
@@ -97,7 +97,7 @@ public class GridCacheAffinityApiSelfTest extends GridCacheAbstractSelfTest {
     public void testPartition() throws Exception {
         String key = "key";
 
-        assertEquals(affinity().partition(key), grid(0).affinity(null).partition(key));
+        assertEquals(affinity().partition(key), grid(0).affinity(DEFAULT_CACHE_NAME).partition(key));
     }
 
     /**
@@ -113,7 +113,7 @@ public class GridCacheAffinityApiSelfTest extends GridCacheAbstractSelfTest {
         List<List<ClusterNode>> assignment = affinity().assignPartitions(ctx);
 
         for (ClusterNode node : grid(0).cluster().nodes()) {
-            int[] parts = grid(0).affinity(null).primaryPartitions(node);
+            int[] parts = grid(0).affinity(DEFAULT_CACHE_NAME).primaryPartitions(node);
 
             assert !F.isEmpty(parts);
 
@@ -138,7 +138,7 @@ public class GridCacheAffinityApiSelfTest extends GridCacheAbstractSelfTest {
         // Pick 2 nodes and create a projection over them.
         ClusterNode n0 = grid(0).localNode();
 
-        int[] parts = grid(0).affinity(null).primaryPartitions(n0);
+        int[] parts = grid(0).affinity(DEFAULT_CACHE_NAME).primaryPartitions(n0);
 
         info("Primary partitions count: " + parts.length);
 
@@ -176,7 +176,7 @@ public class GridCacheAffinityApiSelfTest extends GridCacheAbstractSelfTest {
         ClusterNode n0 = grid(0).localNode();
 
         // Get backup partitions without explicitly specified levels.
-        int[] parts = grid(0).affinity(null).backupPartitions(n0);
+        int[] parts = grid(0).affinity(DEFAULT_CACHE_NAME).backupPartitions(n0);
 
         assert !F.isEmpty(parts);
 
@@ -210,7 +210,7 @@ public class GridCacheAffinityApiSelfTest extends GridCacheAbstractSelfTest {
         // Pick 2 nodes and create a projection over them.
         ClusterNode n0 = grid(0).localNode();
 
-        int[] parts = grid(0).affinity(null).allPartitions(n0);
+        int[] parts = grid(0).affinity(DEFAULT_CACHE_NAME).allPartitions(n0);
 
         assert !F.isEmpty(parts);
 
@@ -245,7 +245,7 @@ public class GridCacheAffinityApiSelfTest extends GridCacheAbstractSelfTest {
 
         List<List<ClusterNode>> assignment = aff.assignPartitions(ctx);
 
-        assertEquals(F.first(nodes(assignment, aff, part)), grid(0).affinity(null).mapPartitionToNode(part));
+        assertEquals(F.first(nodes(assignment, aff, part)), grid(0).affinity(DEFAULT_CACHE_NAME).mapPartitionToNode(part));
     }
 
     /**
@@ -254,7 +254,7 @@ public class GridCacheAffinityApiSelfTest extends GridCacheAbstractSelfTest {
      * @throws Exception If failed.
      */
     public void testMapPartitionsToNode() throws Exception {
-        Map<Integer, ClusterNode> map = grid(0).affinity(null).mapPartitionsToNodes(F.asList(0, 1, 5, 19, 12));
+        Map<Integer, ClusterNode> map = grid(0).affinity(DEFAULT_CACHE_NAME).mapPartitionsToNodes(F.asList(0, 1, 5, 19, 12));
 
         AffinityFunctionContext ctx =
             new GridAffinityFunctionContextImpl(new ArrayList<>(grid(0).cluster().nodes()), null, null,
@@ -274,7 +274,7 @@ public class GridCacheAffinityApiSelfTest extends GridCacheAbstractSelfTest {
      * @throws Exception If failed.
      */
     public void testMapPartitionsToNodeArray() throws Exception {
-        Map<Integer, ClusterNode> map = grid(0).affinity(null).mapPartitionsToNodes(F.asList(0, 1, 5, 19, 12));
+        Map<Integer, ClusterNode> map = grid(0).affinity(DEFAULT_CACHE_NAME).mapPartitionsToNodes(F.asList(0, 1, 5, 19, 12));
 
         AffinityFunctionContext ctx =
             new GridAffinityFunctionContextImpl(new ArrayList<>(grid(0).cluster().nodes()), null, null,
@@ -299,7 +299,7 @@ public class GridCacheAffinityApiSelfTest extends GridCacheAbstractSelfTest {
         for (int p = 0; p < affinity().partitions(); p++)
             parts.add(p);
 
-        Map<Integer, ClusterNode> map = grid(0).affinity(null).mapPartitionsToNodes(parts);
+        Map<Integer, ClusterNode> map = grid(0).affinity(DEFAULT_CACHE_NAME).mapPartitionsToNodes(parts);
 
         AffinityFunctionContext ctx =
             new GridAffinityFunctionContextImpl(new ArrayList<>(grid(0).cluster().nodes()), null, null,
@@ -343,6 +343,6 @@ public class GridCacheAffinityApiSelfTest extends GridCacheAbstractSelfTest {
         int expPart = affinity().partition(affinityMapper().affinityKey(key));
 
         for (int i = 0; i < gridCount(); i++)
-            assertEquals(expPart, grid(i).affinity(null).partition(key));
+            assertEquals(expPart, grid(i).affinity(DEFAULT_CACHE_NAME).partition(key));
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityRoutingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityRoutingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityRoutingSelfTest.java
index 901caa2..0df4887 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityRoutingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAffinityRoutingSelfTest.java
@@ -118,7 +118,7 @@ public class GridCacheAffinityRoutingSelfTest extends GridCommonAbstractTest {
         assert G.allGrids().size() == GRID_CNT;
 
         for (int i = 0; i < KEY_CNT; i++) {
-            grid(0).cache(null).put(i, i);
+            grid(0).cache(DEFAULT_CACHE_NAME).put(i, i);
 
             grid(0).cache(NON_DFLT_CACHE_NAME).put(i, i);
         }
@@ -276,8 +276,8 @@ public class GridCacheAffinityRoutingSelfTest extends GridCommonAbstractTest {
 
         /** {@inheritDoc} */
         @Override public void applyx() throws IgniteCheckedException {
-            assert ignite.cluster().localNode().id().equals(ignite.affinity(null).mapKeyToNode(affKey).id());
-            assert ignite.cluster().localNode().id().equals(ignite.affinity(null).mapKeyToNode(key).id());
+            assert ignite.cluster().localNode().id().equals(ignite.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(affKey).id());
+            assert ignite.cluster().localNode().id().equals(ignite.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key).id());
         }
     }
 
@@ -412,8 +412,8 @@ public class GridCacheAffinityRoutingSelfTest extends GridCommonAbstractTest {
 
         /** {@inheritDoc} */
         @Override public Object call() throws IgniteCheckedException {
-            assert ignite.cluster().localNode().id().equals(ignite.affinity(null).mapKeyToNode(affKey).id());
-            assert ignite.cluster().localNode().id().equals(ignite.affinity(null).mapKeyToNode(key).id());
+            assert ignite.cluster().localNode().id().equals(ignite.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(affKey).id());
+            assert ignite.cluster().localNode().id().equals(ignite.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key).id());
 
             return null;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicEntryProcessorDeploymentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicEntryProcessorDeploymentSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicEntryProcessorDeploymentSelfTest.java
index 80b1aa8..4f513b3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicEntryProcessorDeploymentSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicEntryProcessorDeploymentSelfTest.java
@@ -100,7 +100,7 @@ public class GridCacheAtomicEntryProcessorDeploymentSelfTest extends GridCommonA
      * @return Cache.
      */
     protected IgniteCache getCache(){
-        return grid(1).cache(null);
+        return grid(1).cache(DEFAULT_CACHE_NAME);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
index 1365577..ca94c7f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicMessageCountSelfTest.java
@@ -66,7 +66,7 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
 
         cfg.setDiscoverySpi(discoSpi);
 
-        CacheConfiguration cCfg = new CacheConfiguration();
+        CacheConfiguration cCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cCfg.setCacheMode(PARTITIONED);
         cCfg.setBackups(1);
@@ -108,7 +108,7 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
 
         startGrids(4);
 
-        ignite(0).cache(null);
+        ignite(0).cache(DEFAULT_CACHE_NAME);
 
         try {
             awaitPartitionMapExchange();
@@ -129,7 +129,7 @@ public class GridCacheAtomicMessageCountSelfTest extends GridCommonAbstractTest
             for (int i = 0; i < putCnt; i++) {
                 ClusterNode locNode = grid(0).localNode();
 
-                Affinity<Object> affinity = ignite(0).affinity(null);
+                Affinity<Object> affinity = ignite(0).affinity(DEFAULT_CACHE_NAME);
 
                 if (affinity.isPrimary(locNode, i))
                     expDhtCnt++;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicApiAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicApiAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicApiAbstractTest.java
index f4d8336..f766d01 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicApiAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicApiAbstractTest.java
@@ -89,7 +89,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws Exception If test failed.
      */
     public void testBasicLock() throws Exception {
-        IgniteCache<Integer, String> cache = ignite.cache(null);
+        IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         Lock lock = cache.lock(1);
 
@@ -106,7 +106,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws IgniteCheckedException If test failed.
      */
     public void testSingleLockReentry() throws IgniteCheckedException {
-        IgniteCache<Integer, String> cache = ignite.cache(null);
+        IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         Lock lock = cache.lock(1);
 
@@ -134,7 +134,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws Exception If test failed.
      */
     public void testReentry() throws Exception {
-        IgniteCache<Integer, String> cache = ignite.cache(null);
+        IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         Lock lock = cache.lock(1);
 
@@ -173,7 +173,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      *
      */
     public void testInterruptLock() throws InterruptedException {
-        final IgniteCache<Integer, String> cache = ignite.cache(null);
+        final IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         final Lock lock = cache.lock(1);
 
@@ -217,12 +217,12 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      *
      */
     public void testInterruptLockWithTimeout() throws Exception {
-        final IgniteCache<Integer, String> cache = ignite.cache(null);
+        final IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         startGrid(1);
 
         try {
-            final List<Integer> keys = primaryKeys(grid(1).cache(null), 2, 1);
+            final List<Integer> keys = primaryKeys(grid(1).cache(DEFAULT_CACHE_NAME), 2, 1);
 
             Lock lock1 = cache.lock(keys.get(1));
 
@@ -262,8 +262,8 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
             assertFalse(cache.isLocalLocked(keys.get(0), false));
             assertFalse(cache.isLocalLocked(keys.get(1), false));
 
-            assertFalse(grid(1).cache(null).isLocalLocked(keys.get(0), false));
-            assertFalse(grid(1).cache(null).isLocalLocked(keys.get(1), false));
+            assertFalse(grid(1).cache(DEFAULT_CACHE_NAME).isLocalLocked(keys.get(0), false));
+            assertFalse(grid(1).cache(DEFAULT_CACHE_NAME).isLocalLocked(keys.get(1), false));
 
             assertTrue(isOk.get());
         }
@@ -276,7 +276,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws IgniteCheckedException If test failed.
      */
     public void testManyLockReentries() throws IgniteCheckedException {
-        IgniteCache<Integer, String> cache = ignite.cache(null);
+        IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         Integer key = 1;
 
@@ -319,7 +319,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws Exception If test failed.
      */
     public void testLockMultithreaded() throws Exception {
-        final IgniteCache<Integer, String> cache = ignite.cache(null);
+        final IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         final CountDownLatch l1 = new CountDownLatch(1);
         final CountDownLatch l2 = new CountDownLatch(1);
@@ -437,7 +437,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws Exception If error occur.
      */
     public void testBasicOps() throws Exception {
-        IgniteCache<Integer, String> cache = ignite.cache(null);
+        IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         CountDownLatch latch = new CountDownLatch(1);
 
@@ -498,7 +498,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws Exception If error occur.
      */
     public void testBasicOpsWithReentry() throws Exception {
-        IgniteCache<Integer, String> cache = ignite.cache(null);
+        IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         int key = (int)System.currentTimeMillis();
 
@@ -570,7 +570,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws Exception If test failed.
      */
     public void testMultiLocks() throws Exception {
-        IgniteCache<Integer, String> cache = ignite.cache(null);
+        IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         Collection<Integer> keys = Arrays.asList(1, 2, 3);
 
@@ -601,7 +601,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws IgniteCheckedException If test failed.
      */
     public void testGetPutRemove() throws IgniteCheckedException {
-        IgniteCache<Integer, String> cache = ignite.cache(null);
+        IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         int key = (int)System.currentTimeMillis();
 
@@ -625,7 +625,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
      * @throws Exception In case of error.
      */
     public void testPutWithExpiration() throws Exception {
-        IgniteCache<Integer, String> cache = ignite.cache(null);
+        IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         CacheEventListener lsnr = new CacheEventListener(new CountDownLatch(1));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearLocallySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearLocallySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearLocallySelfTest.java
index 69de233..82c4659 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearLocallySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearLocallySelfTest.java
@@ -78,14 +78,14 @@ public class GridCacheClearLocallySelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration ccfgLoc = new CacheConfiguration();
+        CacheConfiguration ccfgLoc = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfgLoc.setName(CACHE_LOCAL);
         ccfgLoc.setCacheMode(LOCAL);
         ccfgLoc.setWriteSynchronizationMode(FULL_SYNC);
         ccfgLoc.setAtomicityMode(TRANSACTIONAL);
 
-        CacheConfiguration ccfgPartitioned = new CacheConfiguration();
+        CacheConfiguration ccfgPartitioned = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfgPartitioned.setName(CACHE_PARTITIONED);
         ccfgPartitioned.setCacheMode(PARTITIONED);
@@ -99,7 +99,7 @@ public class GridCacheClearLocallySelfTest extends GridCommonAbstractTest {
 
         ccfgPartitioned.setAtomicityMode(TRANSACTIONAL);
 
-        CacheConfiguration ccfgColocated = new CacheConfiguration();
+        CacheConfiguration ccfgColocated = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfgColocated.setName(CACHE_COLOCATED);
         ccfgColocated.setCacheMode(PARTITIONED);
@@ -107,7 +107,7 @@ public class GridCacheClearLocallySelfTest extends GridCommonAbstractTest {
         ccfgColocated.setWriteSynchronizationMode(FULL_SYNC);
         ccfgColocated.setAtomicityMode(TRANSACTIONAL);
 
-        CacheConfiguration ccfgReplicated = new CacheConfiguration();
+        CacheConfiguration ccfgReplicated = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfgReplicated.setName(CACHE_REPLICATED);
         ccfgReplicated.setCacheMode(REPLICATED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
index 0218394..593fc3e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapSelfTest.java
@@ -77,7 +77,7 @@ public class GridCacheConcurrentMapSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testRehash() throws Exception {
-        IgniteCache<Integer, String> c = grid().cache(null);
+        IgniteCache<Integer, String> c = grid().cache(DEFAULT_CACHE_NAME);
 
         int cnt = 100 * 1024;
 
@@ -108,7 +108,7 @@ public class GridCacheConcurrentMapSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testRehashRandom() throws Exception {
-        IgniteCache<Integer, String> c = grid().cache(null);
+        IgniteCache<Integer, String> c = grid().cache(DEFAULT_CACHE_NAME);
 
         int cnt = 100 * 1024;
 
@@ -156,7 +156,7 @@ public class GridCacheConcurrentMapSelfTest extends GridCommonAbstractTest {
         multithreaded(new Callable<Object>() {
             @SuppressWarnings("UnusedAssignment")
             @Override public Object call() throws Exception {
-                IgniteCache<Integer, String> c = grid().cache(null);
+                IgniteCache<Integer, String> c = grid().cache(DEFAULT_CACHE_NAME);
 
                 int tid = tidGen.getAndIncrement();
 
@@ -228,7 +228,7 @@ public class GridCacheConcurrentMapSelfTest extends GridCommonAbstractTest {
         multithreaded(new Callable<Object>() {
             @SuppressWarnings("UnusedAssignment")
             @Override public Object call() throws Exception {
-                IgniteCache<Integer, String> c = grid().cache(null);
+                IgniteCache<Integer, String> c = grid().cache(DEFAULT_CACHE_NAME);
 
                 int tid = tidGen.getAndIncrement();
 
@@ -313,7 +313,7 @@ public class GridCacheConcurrentMapSelfTest extends GridCommonAbstractTest {
      */
     @SuppressWarnings("ResultOfObjectAllocationIgnored")
     public void testEmptyWeakIterator() throws Exception {
-        final IgniteCache<Integer, String> c = grid().cache(null);
+        final IgniteCache<Integer, String> c = grid().cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < 10; i++) {
             multithreaded(new Callable<Object>() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
index 3656270..e7e7840 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java
@@ -227,7 +227,7 @@ public class GridCacheConcurrentTxMultiNodeTest extends GridCommonAbstractTest {
                     String terminalId = String.valueOf(++tid);
 
                     // Server partition cache
-                    UUID mappedId = srvr1.affinity(null).mapKeyToNode(terminalId).id();
+                    UUID mappedId = srvr1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(terminalId).id();
 
                     if (!srvrId.equals(mappedId))
                         continue;
@@ -475,7 +475,7 @@ public class GridCacheConcurrentTxMultiNodeTest extends GridCommonAbstractTest {
 
             doWork();
 
-            GridNearCacheAdapter near = (GridNearCacheAdapter)((IgniteKernal) ignite).internalCache();
+            GridNearCacheAdapter near = (GridNearCacheAdapter)((IgniteKernal) ignite).internalCache(DEFAULT_CACHE_NAME);
             GridDhtCacheAdapter dht = near.dht();
 
             long start = cntrs.get2().get();
@@ -604,7 +604,7 @@ public class GridCacheConcurrentTxMultiNodeTest extends GridCommonAbstractTest {
                         if (g.name().contains("server")) {
                             GridNearCacheAdapter<AffinityKey<String>, Object> near =
                                 (GridNearCacheAdapter<AffinityKey<String>, Object>)((IgniteKernal)g).
-                                    <AffinityKey<String>, Object>internalCache();
+                                    <AffinityKey<String>, Object>internalCache(DEFAULT_CACHE_NAME);
                             GridDhtCacheAdapter<AffinityKey<String>, Object> dht = near.dht();
 
                             for (AffinityKey<String> k : keys) {
@@ -692,7 +692,7 @@ public class GridCacheConcurrentTxMultiNodeTest extends GridCommonAbstractTest {
          * @param terminalId Terminal ID.
          */
         private void put(Object o, String cacheKey, String terminalId) {
-//            CacheProjection<AffinityKey<String>, Object> cache = ((IgniteKernal)ignite).cache(null);
+//            CacheProjection<AffinityKey<String>, Object> cache = ((IgniteKernal)ignite).cache(DEFAULT_CACHE_NAME);
 //
 //            AffinityKey<String> affinityKey = new AffinityKey<>(cacheKey, terminalId);
 //
@@ -711,7 +711,7 @@ public class GridCacheConcurrentTxMultiNodeTest extends GridCommonAbstractTest {
         private <T> Object get(String cacheKey, String terminalId) {
             Object key = new AffinityKey<>(cacheKey, terminalId);
 
-            return (T) ignite.cache(null).get(key);
+            return (T) ignite.cache(DEFAULT_CACHE_NAME).get(key);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConditionalDeploymentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConditionalDeploymentSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConditionalDeploymentSelfTest.java
index b26b582..eefdf9d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConditionalDeploymentSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConditionalDeploymentSelfTest.java
@@ -94,7 +94,7 @@ public class GridCacheConditionalDeploymentSelfTest extends GridCommonAbstractTe
 
         awaitPartitionMapExchange();
 
-        ignite0.cache(null).put(1, new TestValue());
+        ignite0.cache(DEFAULT_CACHE_NAME).put(1, new TestValue());
     }
 
     /** {@inheritDoc} */
@@ -168,7 +168,7 @@ public class GridCacheConditionalDeploymentSelfTest extends GridCommonAbstractTe
     }
 
     protected GridCacheContext cacheContext() {
-        return ((IgniteCacheProxy)grid(0).cache(null)).context();
+        return ((IgniteCacheProxy)grid(0).cache(DEFAULT_CACHE_NAME)).context();
     }
 
     protected GridCacheIoManager cacheIoManager() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
index 6a153b3..2865627 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
@@ -68,7 +68,7 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
     private boolean cacheEnabled;
 
     /** */
-    private String cacheName;
+    private String cacheName = DEFAULT_CACHE_NAME;
 
     /** */
     private CacheMode cacheMode = REPLICATED;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeAbstractSelfTest.java
index aaaac0d..8077251 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeAbstractSelfTest.java
@@ -98,7 +98,7 @@ public abstract class GridCacheDaemonNodeAbstractSelfTest extends GridCommonAbst
 
             startGrid(4);
 
-            IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+            IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < 30; i++)
                 cache.put(i, i);
@@ -129,7 +129,7 @@ public abstract class GridCacheDaemonNodeAbstractSelfTest extends GridCommonAbst
 
             startGrid(4);
 
-            IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+            IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < 30; i++) {
                 try (Transaction tx = ignite(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
@@ -174,14 +174,14 @@ public abstract class GridCacheDaemonNodeAbstractSelfTest extends GridCommonAbst
 
             for (long i = 0; i < Integer.MAX_VALUE; i = (i << 1) + 1) {
                 // Call mapKeyToNode for normal node.
-                assertNotNull(g1.<Long>affinity(null).mapKeyToNode(i));
+                assertNotNull(g1.<Long>affinity(DEFAULT_CACHE_NAME).mapKeyToNode(i));
 
                 // Call mapKeyToNode for daemon node.
                 final long i0 = i;
 
                 GridTestUtils.assertThrows(log, new Callable<Object>() {
                     @Override public Object call() throws Exception {
-                        return g2.<Long>affinity(null).mapKeyToNode(i0);
+                        return g2.<Long>affinity(DEFAULT_CACHE_NAME).mapKeyToNode(i0);
                     }
                 }, IgniteException.class, "Failed to find cache");
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java
index 933165b..c88d0cc 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java
@@ -170,7 +170,7 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
             for (int i = 0; i < 1000; i++) {
                 key = "1" + i;
 
-                if (g1.affinity(null).mapKeyToNode(key).id().equals(g2.cluster().localNode().id()))
+                if (g1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key).id().equals(g2.cluster().localNode().id()))
                     break;
             }
 
@@ -205,7 +205,7 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
             for (int i = 0; i < 1000; i++) {
                 key = "1" + i;
 
-                if (g1.affinity(null).mapKeyToNode(key).id().equals(g2.cluster().localNode().id()))
+                if (g1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key).id().equals(g2.cluster().localNode().id()))
                     break;
             }
 
@@ -214,15 +214,15 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
             stopGrid(IGNITE_INSTANCE_NAME);
 
             for (int i = 0; i < 10; i++) {
-                if (g1.cache(null).localSize() == 0 && g2.cache(null).localSize() == 0)
+                if (g1.cache(DEFAULT_CACHE_NAME).localSize() == 0 && g2.cache(DEFAULT_CACHE_NAME).localSize() == 0)
                     break;
 
                 U.sleep(500);
             }
 
-            assertEquals(0, g1.cache(null).localSize());
+            assertEquals(0, g1.cache(DEFAULT_CACHE_NAME).localSize());
 
-            assertEquals(isCacheUndeployed(g1) ? 0 : 1, g2.cache(null).localSize());
+            assertEquals(isCacheUndeployed(g1) ? 0 : 1, g2.cache(DEFAULT_CACHE_NAME).localSize());
 
             startGrid(3);
         }
@@ -268,8 +268,8 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
             for (int i = 0; i < 1000; i++) {
                 key = "1" + i;
 
-                if (g1.affinity(null).mapKeyToNode(key).id().equals(g2.cluster().localNode().id()) &&
-                    g1.affinity(null).isBackup((backupLeavesGrid ? g0 : g1).cluster().localNode(), key))
+                if (g1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key).id().equals(g2.cluster().localNode().id()) &&
+                    g1.affinity(DEFAULT_CACHE_NAME).isBackup((backupLeavesGrid ? g0 : g1).cluster().localNode(), key))
                     break;
             }
 
@@ -277,9 +277,9 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
 
             stopGrid(IGNITE_INSTANCE_NAME);
 
-            assertEquals(1, g1.cache(null).localSize(CachePeekMode.ALL));
+            assertEquals(1, g1.cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.ALL));
 
-            assertEquals(1, g2.cache(null).localSize(CachePeekMode.ALL));
+            assertEquals(1, g2.cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.ALL));
 
             startGrid(3);
         }
@@ -314,7 +314,7 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
 
             info("Key: " + key);
 
-            IgniteCache<Object, Object> cache = g0.cache(null);
+            IgniteCache<Object, Object> cache = g0.cache(DEFAULT_CACHE_NAME);
 
             assert cache != null;
 
@@ -363,7 +363,7 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
             for (int i = 0; i < 1000; i++) {
                 key = "1" + i;
 
-                if (g1.affinity(null).mapKeyToNode(key).id().equals(g2.cluster().localNode().id()))
+                if (g1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key).id().equals(g2.cluster().localNode().id()))
                     break;
             }
 
@@ -396,7 +396,7 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
             for (int i = 0; i < 1000; i++) {
                 key = "1" + i;
 
-                if (g1.affinity(null).mapKeyToNode(key).id().equals(g2.cluster().localNode().id()))
+                if (g1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key).id().equals(g2.cluster().localNode().id()))
                     break;
             }
 
@@ -422,7 +422,7 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
 
             Ignite g = startGrid(0);
 
-            g.cache(null).put(0, valCls.newInstance());
+            g.cache(DEFAULT_CACHE_NAME).put(0, valCls.newInstance());
 
             info("Added value to cache 0.");
 
@@ -463,10 +463,10 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
             Ignite g1 = startGrid(1);
 
             for (int i = 0; i < 20; i++)
-                g0.cache(null).put(i, valCls.newInstance());
+                g0.cache(DEFAULT_CACHE_NAME).put(i, valCls.newInstance());
 
-            assert g0.cache(null).localSize(CachePeekMode.ALL) > 0 : "Cache is empty";
-            assert g1.cache(null).localSize(CachePeekMode.ALL) > 0 : "Cache is empty";
+            assert g0.cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.ALL) > 0 : "Cache is empty";
+            assert g1.cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.ALL) > 0 : "Cache is empty";
 
             g0.compute(g0.cluster().forRemotes()).execute(taskCls, g1.cluster().localNode());
 
@@ -474,23 +474,23 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
 
             if (depMode == SHARED && isCacheUndeployed(g1)) {
                 for (int i = 0; i < 10; i++) {
-                    if (g1.cache(null).localSize(CachePeekMode.ALL) == 0)
+                    if (g1.cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.ALL) == 0)
                         break;
 
                     Thread.sleep(500);
                 }
 
-                assertEquals(0, g1.cache(null).localSize(CachePeekMode.ALL));
+                assertEquals(0, g1.cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.ALL));
             }
             else {
                 for (int i = 0; i < 4; i++) {
-                    if (g1.cache(null).localSize(CachePeekMode.ALL) == 0)
+                    if (g1.cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.ALL) == 0)
                         break;
 
                     Thread.sleep(500);
                 }
 
-                assert g1.cache(null).localSize(CachePeekMode.ALL) > 0 : "Cache undeployed unexpectadly";
+                assert g1.cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.ALL) > 0 : "Cache undeployed unexpectadly";
             }
         }
         finally {
@@ -516,9 +516,9 @@ public class GridCacheDeploymentSelfTest extends GridCommonAbstractTest {
         info("Near: " + near);
 
         for (int i = start; i < start + 10000; i++) {
-            if (g.affinity(null).isPrimary(primary, i) && g.affinity(null).isBackup(backup, i)) {
-                assert !g.affinity(null).isPrimary(near, i) : "Key: " + i;
-                assert !g.affinity(null).isBackup(near, i) : "Key: " + i;
+            if (g.affinity(DEFAULT_CACHE_NAME).isPrimary(primary, i) && g.affinity(DEFAULT_CACHE_NAME).isBackup(backup, i)) {
+                assert !g.affinity(DEFAULT_CACHE_NAME).isPrimary(near, i) : "Key: " + i;
+                assert !g.affinity(DEFAULT_CACHE_NAME).isBackup(near, i) : "Key: " + i;
 
                 return i;
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryMemorySizeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryMemorySizeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryMemorySizeSelfTest.java
index d361d45..b10ff70 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryMemorySizeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryMemorySizeSelfTest.java
@@ -226,7 +226,7 @@ public class GridCacheEntryMemorySizeSelfTest extends GridCommonAbstractTest {
                 while (true) {
                     key++;
 
-                    if (grid(0).affinity(null).mapKeyToNode(key).equals(grid(0).localNode())) {
+                    if (grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key).equals(grid(0).localNode())) {
                         if (i > 0)
                             jcache(0).put(key, new Value(new byte[i * 1024]));
 
@@ -278,7 +278,7 @@ public class GridCacheEntryMemorySizeSelfTest extends GridCommonAbstractTest {
                 while (true) {
                     key++;
 
-                    if (grid(0).affinity(null).mapKeyToNode(key).equals(grid(0).localNode())) {
+                    if (grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key).equals(grid(0).localNode())) {
                         if (i > 0)
                             jcache(0).put(key, new Value(new byte[i * 1024]));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
index 79b77ed..9e933be 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
@@ -53,7 +53,7 @@ public class GridCacheEntryVersionSelfTest extends GridCommonAbstractTest {
 
         discoSpi.setIpFinder(IP_FINDER);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -96,23 +96,23 @@ public class GridCacheEntryVersionSelfTest extends GridCommonAbstractTest {
 
             for (Integer key : map.keySet()) {
                 info("Affinity nodes [key=" + key + ", nodes=" +
-                    F.viewReadOnly(grid(0).affinity(null).mapKeyToPrimaryAndBackups(key), F.node2id()) + ']');
+                    F.viewReadOnly(grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToPrimaryAndBackups(key), F.node2id()) + ']');
             }
 
-            grid(0).cache(null).putAll(map);
+            grid(0).cache(DEFAULT_CACHE_NAME).putAll(map);
 
             for (int g = 0; g < 3; g++) {
                 IgniteKernal grid = (IgniteKernal)grid(g);
 
                 for (Integer key : map.keySet()) {
-                    GridCacheAdapter<Object, Object> cache = grid.internalCache();
+                    GridCacheAdapter<Object, Object> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
                     GridCacheEntryEx entry = cache.peekEx(key);
 
                     if (entry != null) {
                         GridCacheVersion ver = entry.version();
 
-                        long order = grid.affinity(null).mapKeyToNode(key).order();
+                        long order = grid.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key).order();
 
                         // Check topology version.
                         assertEquals(3, ver.topologyVersion() -
@@ -126,20 +126,20 @@ public class GridCacheEntryVersionSelfTest extends GridCommonAbstractTest {
 
             startGrid(3);
 
-            grid(0).cache(null).putAll(map);
+            grid(0).cache(DEFAULT_CACHE_NAME).putAll(map);
 
             for (int g = 0; g < 4; g++) {
                 IgniteKernal grid = (IgniteKernal)grid(g);
 
                 for (Integer key : map.keySet()) {
-                    GridCacheAdapter<Object, Object> cache = grid.internalCache();
+                    GridCacheAdapter<Object, Object> cache = grid.internalCache(DEFAULT_CACHE_NAME);
 
                     GridCacheEntryEx entry = cache.peekEx(key);
 
                     if (entry != null) {
                         GridCacheVersion ver = entry.version();
 
-                        long order = grid.affinity(null).mapKeyToNode(key).order();
+                        long order = grid.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key).order();
 
                         // Check topology version.
                         assertEquals(4, ver.topologyVersion() -

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEventAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEventAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEventAbstractTest.java
index eae8dad..554a7a9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEventAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEvictionEventAbstractTest.java
@@ -112,7 +112,7 @@ public abstract class GridCacheEvictionEventAbstractTest extends GridCommonAbstr
             }
         }, EventType.EVT_CACHE_ENTRY_EVICTED);
 
-        IgniteCache<String, String> c = g.cache(null);
+        IgniteCache<String, String> c = g.cache(DEFAULT_CACHE_NAME);
 
         c.put("1", "val1");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java
index 780b9a8..9732272 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java
@@ -89,9 +89,9 @@ public class GridCacheFinishPartitionsSelfTest extends GridCacheAbstractSelfTest
         String key = "key";
         String val = "value";
 
-        IgniteCache<String, String> cache = grid.cache(null);
+        IgniteCache<String, String> cache = grid.cache(DEFAULT_CACHE_NAME);
 
-        int keyPart = grid.<String, String>internalCache().context().affinity().partition(key);
+        int keyPart = grid.<String, String>internalCache(DEFAULT_CACHE_NAME).context().affinity().partition(key);
 
         cache.put(key, val);
 
@@ -132,7 +132,7 @@ public class GridCacheFinishPartitionsSelfTest extends GridCacheAbstractSelfTest
                 if (barrier.await() == 0)
                     start.set(System.currentTimeMillis());
 
-                IgniteCache<String, String> cache = grid(0).cache(null);
+                IgniteCache<String, String> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
                 Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ);
 
@@ -170,7 +170,7 @@ public class GridCacheFinishPartitionsSelfTest extends GridCacheAbstractSelfTest
     public void testMvccFinishPartitions() throws Exception {
         String key = "key";
 
-        int keyPart = grid.internalCache().context().affinity().partition(key);
+        int keyPart = grid.internalCache(DEFAULT_CACHE_NAME).context().affinity().partition(key);
 
         // Wait for tx-enlisted partition.
         long waitTime = runLock(key, keyPart, F.asList(keyPart));
@@ -194,14 +194,14 @@ public class GridCacheFinishPartitionsSelfTest extends GridCacheAbstractSelfTest
      * @throws Exception If failed.
      */
     public void testMvccFinishKeys() throws Exception {
-        IgniteCache<String, Integer> cache = grid(0).cache(null);
+        IgniteCache<String, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
             final String key = "key";
 
             cache.get(key);
 
-            GridCacheAdapter<String, Integer> internal = grid.internalCache();
+            GridCacheAdapter<String, Integer> internal = grid.internalCache(DEFAULT_CACHE_NAME);
 
             KeyCacheObject cacheKey = internal.context().toCacheKeyObject(key);
 
@@ -235,7 +235,7 @@ public class GridCacheFinishPartitionsSelfTest extends GridCacheAbstractSelfTest
 
         final CountDownLatch latch = new CountDownLatch(1);
 
-        IgniteCache<Integer, String> cache = grid.cache(null);
+        IgniteCache<Integer, String> cache = grid.cache(DEFAULT_CACHE_NAME);
 
         Lock lock = cache.lock(key);
 
@@ -293,7 +293,7 @@ public class GridCacheFinishPartitionsSelfTest extends GridCacheAbstractSelfTest
 
         final CountDownLatch latch = new CountDownLatch(1);
 
-        IgniteCache<String, String> cache = grid.cache(null);
+        IgniteCache<String, String> cache = grid.cache(DEFAULT_CACHE_NAME);
 
         Lock lock = cache.lock(key);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java
index d2d9cbb..e12e246 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFullTextQueryMultithreadedSelfTest.java
@@ -75,7 +75,7 @@ public class GridCacheFullTextQueryMultithreadedSelfTest extends GridCacheAbstra
         final int logFreq = 50;
         final String txt = "Value";
 
-        final GridCacheAdapter<Integer, H2TextValue> c = ((IgniteKernal)grid(0)).internalCache(null);
+        final GridCacheAdapter<Integer, H2TextValue> c = ((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME);
 
         IgniteInternalFuture<?> fut1 = multithreadedAsync(new Callable() {
                 @Override public Object call() throws Exception {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIncrementTransformTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIncrementTransformTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIncrementTransformTest.java
index d926d40..33b094f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIncrementTransformTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIncrementTransformTest.java
@@ -61,7 +61,7 @@ public class GridCacheIncrementTransformTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration cache = new CacheConfiguration();
+        CacheConfiguration cache = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cache.setCacheMode(PARTITIONED);
         cache.setAtomicityMode(ATOMIC);
@@ -170,7 +170,7 @@ public class GridCacheIncrementTransformTest extends GridCommonAbstractTest {
                 ignite = restarts ? grids.getAndSet(idx, null) : grid(idx);
             }
 
-            IgniteCache<String, TestObject> cache = ignite.<String, TestObject>cache(null).withNoRetries();
+            IgniteCache<String, TestObject> cache = ignite.<String, TestObject>cache(DEFAULT_CACHE_NAME).withNoRetries();
 
             assertNotNull(cache);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
index d247831..fdca159 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java
@@ -1336,7 +1336,7 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst
     private List<String> primaryKeys(int idx, int cnt) {
         assert cnt > 0;
 
-        Affinity aff = ignite(0).affinity(null);
+        Affinity aff = ignite(0).affinity(DEFAULT_CACHE_NAME);
 
         List<String> keys = new ArrayList<>(cnt);
 
@@ -1361,7 +1361,7 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst
      * @return Primary key for grid.
      */
     private String backupKey(int idx) {
-        Affinity aff = ignite(0).affinity(null);
+        Affinity aff = ignite(0).affinity(DEFAULT_CACHE_NAME);
 
         String key = null;
 
@@ -1383,7 +1383,7 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst
      * @return Key which does not belong to the grid.
      */
     private String nearKey(int idx) {
-        Affinity aff = ignite(0).affinity(null);
+        Affinity aff = ignite(0).affinity(DEFAULT_CACHE_NAME);
 
         String key = null;
 
@@ -1413,7 +1413,7 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst
 
         try {
             for (int i = 0; i < gridCount(); i++)
-                assertEquals("Unexpected value for grid " + i, expVal, grid(i).cache(null).get(key));
+                assertEquals("Unexpected value for grid " + i, expVal, grid(i).cache(DEFAULT_CACHE_NAME).get(key));
         }
         finally {
             interceptor.disabled = false;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIteratorPerformanceTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIteratorPerformanceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIteratorPerformanceTest.java
index 99820ec..f38a0b2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIteratorPerformanceTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheIteratorPerformanceTest.java
@@ -107,7 +107,7 @@ public class GridCacheIteratorPerformanceTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testSmall() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid().cache(null);
+        IgniteCache<Integer, Integer> cache = grid().cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < SMALL_ENTRY_CNT; i++)
             cache.put(i, i);
@@ -136,7 +136,7 @@ public class GridCacheIteratorPerformanceTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testLarge() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid().cache(null);
+        IgniteCache<Integer, Integer> cache = grid().cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < LARGE_ENTRY_CNT; i++)
             cache.put(i, i);
@@ -165,7 +165,7 @@ public class GridCacheIteratorPerformanceTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testFiltered() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid().cache(null);
+        IgniteCache<Integer, Integer> cache = grid().cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < LARGE_ENTRY_CNT; i++)
             cache.put(i, i);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheKeyCheckSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheKeyCheckSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheKeyCheckSelfTest.java
index 0ea1ff5..ebb88a3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheKeyCheckSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheKeyCheckSelfTest.java
@@ -130,7 +130,7 @@ public class GridCacheKeyCheckSelfTest extends GridCacheAbstractSelfTest {
         this.atomicityMode = atomicityMode;
 
         try {
-            IgniteCache<IncorrectCacheKey, String> cache = grid(0).cache(null);
+            IgniteCache<IncorrectCacheKey, String> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             cache.get(new IncorrectCacheKey(0));
 
@@ -150,7 +150,7 @@ public class GridCacheKeyCheckSelfTest extends GridCacheAbstractSelfTest {
         this.atomicityMode = atomicityMode;
 
         try {
-            IgniteCache<IncorrectCacheKey, String> cache = grid(0).cache(null);
+            IgniteCache<IncorrectCacheKey, String> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             cache.put(new IncorrectCacheKey(0), "test_value");
 
@@ -170,7 +170,7 @@ public class GridCacheKeyCheckSelfTest extends GridCacheAbstractSelfTest {
         this.atomicityMode = atomicityMode;
 
         try {
-            IgniteCache<IncorrectCacheKey, String> cache = grid(0).cache(null);
+            IgniteCache<IncorrectCacheKey, String> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             cache.remove(new IncorrectCacheKey(0));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallerTxAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallerTxAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallerTxAbstractTest.java
index a87a6ed..0d616d4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallerTxAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallerTxAbstractTest.java
@@ -95,7 +95,7 @@ public abstract class GridCacheMarshallerTxAbstractTest extends GridCommonAbstra
 
         Transaction tx = grid().transactions().txStart(PESSIMISTIC, REPEATABLE_READ);
         try {
-            grid().cache(null).put(key, value);
+            grid().cache(DEFAULT_CACHE_NAME).put(key, value);
 
             tx.commit();
         }
@@ -106,11 +106,11 @@ public abstract class GridCacheMarshallerTxAbstractTest extends GridCommonAbstra
         tx = grid().transactions().txStart(PESSIMISTIC, REPEATABLE_READ);
 
         try {
-            assert value.equals(grid().cache(null).get(key));
+            assert value.equals(grid().cache(DEFAULT_CACHE_NAME).get(key));
 
-            grid().cache(null).put(key, newValue);
+            grid().cache(DEFAULT_CACHE_NAME).put(key, newValue);
 
-            grid().cache(null).put(key2, wrongValue);
+            grid().cache(DEFAULT_CACHE_NAME).put(key2, wrongValue);
 
             tx.commit();
         }
@@ -121,7 +121,7 @@ public abstract class GridCacheMarshallerTxAbstractTest extends GridCommonAbstra
         tx = grid().transactions().txStart(PESSIMISTIC, REPEATABLE_READ);
 
         try {
-            String locVal = (String)grid().cache(null).get(key);
+            String locVal = (String)grid().cache(DEFAULT_CACHE_NAME).get(key);
 
             assert locVal != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java
index 1f81ba5..392f8e5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallingNodeJoinSelfTest.java
@@ -55,7 +55,7 @@ public class GridCacheMarshallingNodeJoinSelfTest extends GridCommonAbstractTest
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration<Integer, TestObject> cacheCfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, TestObject> cacheCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cacheCfg.setCacheMode(CacheMode.PARTITIONED);
         cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
@@ -116,7 +116,7 @@ public class GridCacheMarshallingNodeJoinSelfTest extends GridCommonAbstractTest
             }
         }, 1);
 
-        IgniteCache<Integer, TestObject> cache = ignite(0).cache(null);
+        IgniteCache<Integer, TestObject> cache = ignite(0).cache(DEFAULT_CACHE_NAME);
 
         try (Transaction tx = ignite(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
             cache.get(0);


[05/51] [abbrv] ignite git commit: ignite-1794 Refactored hibernate modules, switched to hibernate 5.1

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListenerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListenerSelfTest.java b/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListenerSelfTest.java
deleted file mode 100644
index 880d12a..0000000
--- a/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListenerSelfTest.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * 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.cache.store.hibernate;
-
-import java.io.Serializable;
-import java.util.Map;
-import javax.cache.Cache;
-import javax.cache.configuration.Factory;
-import javax.cache.integration.CacheLoaderException;
-import javax.cache.integration.CacheWriterException;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import org.apache.ignite.cache.store.CacheStore;
-import org.apache.ignite.cache.store.CacheStoreAdapter;
-import org.apache.ignite.cache.store.CacheStoreSession;
-import org.apache.ignite.cache.store.CacheStoreSessionListener;
-import org.apache.ignite.cache.store.CacheStoreSessionListenerAbstractSelfTest;
-import org.apache.ignite.cache.store.jdbc.CacheJdbcStoreSessionListener;
-import org.apache.ignite.lang.IgniteBiInClosure;
-import org.apache.ignite.resources.CacheStoreSessionResource;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.cfg.Configuration;
-
-/**
- * Tests for {@link CacheJdbcStoreSessionListener}.
- */
-public class CacheHibernateStoreSessionListenerSelfTest extends CacheStoreSessionListenerAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected Factory<? extends CacheStore<Integer, Integer>> storeFactory() {
-        return new Factory<CacheStore<Integer, Integer>>() {
-            @Override public CacheStore<Integer, Integer> create() {
-                return new Store();
-            }
-        };
-    }
-
-    /** {@inheritDoc} */
-    @Override protected Factory<CacheStoreSessionListener> sessionListenerFactory() {
-        return new Factory<CacheStoreSessionListener>() {
-            @Override public CacheStoreSessionListener create() {
-                CacheHibernateStoreSessionListener lsnr = new CacheHibernateStoreSessionListener();
-
-                SessionFactory sesFactory = new Configuration().
-                    setProperty("hibernate.connection.url", URL).
-                    addAnnotatedClass(Table1.class).
-                    addAnnotatedClass(Table2.class).
-                    buildSessionFactory();
-
-                lsnr.setSessionFactory(sesFactory);
-
-                return lsnr;
-            }
-        };
-    }
-
-    /**
-     */
-    private static class Store extends CacheStoreAdapter<Integer, Integer> {
-        /** */
-        private static String SES_CONN_KEY = "ses_conn";
-
-        /** */
-        @CacheStoreSessionResource
-        private CacheStoreSession ses;
-
-        /** {@inheritDoc} */
-        @Override public void loadCache(IgniteBiInClosure<Integer, Integer> clo, Object... args) {
-            loadCacheCnt.incrementAndGet();
-
-            checkSession();
-        }
-
-        /** {@inheritDoc} */
-        @Override public Integer load(Integer key) throws CacheLoaderException {
-            loadCnt.incrementAndGet();
-
-            checkSession();
-
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void write(Cache.Entry<? extends Integer, ? extends Integer> entry)
-            throws CacheWriterException {
-            writeCnt.incrementAndGet();
-
-            checkSession();
-
-            if (write.get()) {
-                Session hibSes = ses.attachment();
-
-                switch (ses.cacheName()) {
-                    case "cache1":
-                        hibSes.save(new Table1(entry.getKey(), entry.getValue()));
-
-                        break;
-
-                    case "cache2":
-                        if (fail.get())
-                            throw new CacheWriterException("Expected failure.");
-
-                        hibSes.save(new Table2(entry.getKey(), entry.getValue()));
-
-                        break;
-
-                    default:
-                        throw new CacheWriterException("Wring cache: " + ses.cacheName());
-                }
-            }
-        }
-
-        /** {@inheritDoc} */
-        @Override public void delete(Object key) throws CacheWriterException {
-            deleteCnt.incrementAndGet();
-
-            checkSession();
-        }
-
-        /** {@inheritDoc} */
-        @Override public void sessionEnd(boolean commit) {
-            assertNull(ses.attachment());
-        }
-
-        /**
-         */
-        private void checkSession() {
-            Session hibSes = ses.attachment();
-
-            assertNotNull(hibSes);
-
-            assertTrue(hibSes.isOpen());
-
-            Transaction tx = hibSes.getTransaction();
-
-            assertNotNull(tx);
-
-            if (ses.isWithinTransaction())
-                assertTrue(tx.isActive());
-            else
-                assertFalse(tx.isActive());
-
-            verifySameInstance(hibSes);
-        }
-
-        /**
-         * @param hibSes Session.
-         */
-        private void verifySameInstance(Session hibSes) {
-            Map<String, Session> props = ses.properties();
-
-            Session sesConn = props.get(SES_CONN_KEY);
-
-            if (sesConn == null)
-                props.put(SES_CONN_KEY, hibSes);
-            else {
-                assertSame(hibSes, sesConn);
-
-                reuseCnt.incrementAndGet();
-            }
-        }
-    }
-
-    /**
-     */
-    @Entity
-    @Table(name = "Table1")
-    private static class Table1 implements Serializable {
-        /** */
-        @Id @GeneratedValue
-        @Column(name = "id")
-        private Integer id;
-
-        /** */
-        @Column(name = "key")
-        private int key;
-
-        /** */
-        @Column(name = "value")
-        private int value;
-
-        /**
-         * @param key Key.
-         * @param value Value.
-         */
-        private Table1(int key, int value) {
-            this.key = key;
-            this.value = value;
-        }
-    }
-
-    /**
-     */
-    @Entity
-    @Table(name = "Table2")
-    private static class Table2 implements Serializable {
-        /** */
-        @Id @GeneratedValue
-        @Column(name = "id")
-        private Integer id;
-
-        /** */
-        @Column(name = "key")
-        private int key;
-
-        /** */
-        @Column(name = "value")
-        private int value;
-
-        /**
-         * @param key Key.
-         * @param value Value.
-         */
-        private Table2(int key, int value) {
-            this.key = key;
-            this.value = value;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml b/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml
deleted file mode 100644
index 3822b31..0000000
--- a/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-
-<!DOCTYPE hibernate-configuration PUBLIC
-        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
-        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
-
-<hibernate-configuration>
-    <session-factory>
-        <!-- Show SQL. -->
-        <property name="show_sql">true</property>
-
-        <!-- Database connection settings (private in-memory database). -->
-        <property name="connection.url">jdbc:h2:mem:example;DB_CLOSE_DELAY=-1</property>
-
-        <!-- Only validate the database schema on startup in production mode. -->
-        <property name="hbm2ddl.auto">update</property>
-
-        <!-- H2 dialect. -->
-        <property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property>
-
-        <!-- Mappings. -->
-        <mapping resource="org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml"/>
-    </session-factory>
-</hibernate-configuration>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/package-info.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/package-info.java b/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/package-info.java
deleted file mode 100644
index 8af9886..0000000
--- a/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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 description. -->
- * Contains internal tests or test related classes and interfaces.
- */
-package org.apache.ignite.cache.store.hibernate;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernateTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernateTestSuite.java b/modules/hibernate/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernateTestSuite.java
deleted file mode 100644
index 3791bae..0000000
--- a/modules/hibernate/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernateTestSuite.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.testsuites;
-
-import junit.framework.TestSuite;
-import org.apache.ignite.internal.binary.BinaryMarshaller;
-import org.apache.ignite.testframework.config.GridTestProperties;
-
-/**
- *
- */
-public class IgniteBinaryHibernateTestSuite extends TestSuite {
-    /**
-     * @return Test suite.
-     * @throws Exception If failed.
-     */
-    public static TestSuite suite() throws Exception {
-        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
-
-        return IgniteHibernateTestSuite.suite();
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/test/java/org/apache/ignite/testsuites/IgniteHibernateTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/test/java/org/apache/ignite/testsuites/IgniteHibernateTestSuite.java b/modules/hibernate/src/test/java/org/apache/ignite/testsuites/IgniteHibernateTestSuite.java
deleted file mode 100644
index 99fea56..0000000
--- a/modules/hibernate/src/test/java/org/apache/ignite/testsuites/IgniteHibernateTestSuite.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.testsuites;
-
-import junit.framework.TestSuite;
-import org.apache.ignite.cache.hibernate.HibernateL2CacheConfigurationSelfTest;
-import org.apache.ignite.cache.hibernate.HibernateL2CacheSelfTest;
-import org.apache.ignite.cache.hibernate.HibernateL2CacheTransactionalSelfTest;
-import org.apache.ignite.cache.hibernate.HibernateL2CacheTransactionalUseSyncSelfTest;
-import org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreNodeRestartTest;
-import org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreSelfTest;
-import org.apache.ignite.cache.store.hibernate.CacheHibernateStoreFactorySelfTest;
-import org.apache.ignite.cache.store.hibernate.CacheHibernateStoreSessionListenerSelfTest;
-
-/**
- * Hibernate integration tests.
- */
-public class IgniteHibernateTestSuite extends TestSuite {
-    /**
-     * @return Test suite.
-     * @throws Exception Thrown in case of the failure.
-     */
-    public static TestSuite suite() throws Exception {
-        TestSuite suite = new TestSuite("Hibernate Integration Test Suite");
-
-        // Hibernate L2 cache.
-        suite.addTestSuite(HibernateL2CacheSelfTest.class);
-        suite.addTestSuite(HibernateL2CacheTransactionalSelfTest.class);
-        suite.addTestSuite(HibernateL2CacheTransactionalUseSyncSelfTest.class);
-        suite.addTestSuite(HibernateL2CacheConfigurationSelfTest.class);
-
-        suite.addTestSuite(CacheHibernateBlobStoreSelfTest.class);
-
-        suite.addTestSuite(CacheHibernateBlobStoreNodeRestartTest.class);
-
-        suite.addTestSuite(CacheHibernateStoreSessionListenerSelfTest.class);
-
-        suite.addTestSuite(CacheHibernateStoreFactorySelfTest.class);
-
-        return suite;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/README.txt
----------------------------------------------------------------------
diff --git a/modules/hibernate5/README.txt b/modules/hibernate5/README.txt
deleted file mode 100644
index 370258b..0000000
--- a/modules/hibernate5/README.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-Apache Ignite Hibernate Module
-------------------------------
-
-Apache Ignite Hibernate module provides Hibernate second-level cache (L2 cache) implementation based
-on Apache Ignite In-Memory Data Grid.
-
-To enable Hibernate module when starting a standalone node, move 'optional/ignite-hibernate5' folder to
-'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will
-be added to classpath in this case.
-
-Importing Hibernate Module In Maven Project
--------------------------------------------
-
-If you are using Maven to manage dependencies of your project, you can add Hibernate module
-dependency like this (replace '${ignite.version}' with actual Ignite version you are
-interested in):
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
-                        http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    ...
-    <dependencies>
-        ...
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-hibernate5</artifactId>
-            <version>${ignite.version}</version>
-        </dependency>
-        ...
-    </dependencies>
-    ...
-</project>
-
-
-LGPL dependencies
------------------
-
-Ignite includes the following optional LGPL dependencies:
- - Hibernate L2 Cache Integration, http://hibernate.org/orm/
- - JTS Topology Suite for Geospatial indexing, http://tsusiatsoftware.net/jts/main.html
- - cron4j for cron-based task scheduling, http://www.sauronsoftware.it/projects/cron4j
-
-Apache binary releases cannot include LGPL dependencies. If you would like include
-optional LGPL dependencies into your release, you should download the source release
-from Ignite website and do the build with the following maven command:
-
-mvn clean package -DskipTests -Prelease,lgpl

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/licenses/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/modules/hibernate5/licenses/apache-2.0.txt b/modules/hibernate5/licenses/apache-2.0.txt
deleted file mode 100644
index d645695..0000000
--- a/modules/hibernate5/licenses/apache-2.0.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed 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.

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate5/pom.xml b/modules/hibernate5/pom.xml
deleted file mode 100644
index 13a0c40..0000000
--- a/modules/hibernate5/pom.xml
+++ /dev/null
@@ -1,146 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-<!--
-    POM file.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.ignite</groupId>
-        <artifactId>ignite-parent</artifactId>
-        <version>1</version>
-        <relativePath>../../parent</relativePath>
-    </parent>
-
-    <artifactId>ignite-hibernate5</artifactId>
-    <version>2.0.0-SNAPSHOT</version>
-    <url>http://ignite.apache.org</url>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-core</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-core</artifactId>
-            <version>5.2.9.Final</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-jta</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.ow2.jotm</groupId>
-            <artifactId>jotm-core</artifactId>
-            <version>2.1.9</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-dbcp</groupId>
-            <artifactId>commons-dbcp</artifactId>
-            <version>1.4</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>com.h2database</groupId>
-            <artifactId>h2</artifactId>
-            <version>${h2.version}</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>javax.resource</groupId>
-            <artifactId>connector-api</artifactId>
-            <version>1.5</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-core</artifactId>
-            <version>${project.version}</version>
-            <type>test-jar</type>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-spring</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-log4j</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-beans</artifactId>
-            <version>${spring.version}</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-context</artifactId>
-            <version>${spring.version}</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <testResources>
-            <testResource>
-                <directory>src/main/java</directory>
-                <excludes>
-                    <exclude>**/*.java</exclude>
-                </excludes>
-            </testResource>
-            <testResource>
-                <directory>src/test/java</directory>
-                <excludes>
-                    <exclude>**/*.java</exclude>
-                </excludes>
-            </testResource>
-        </testResources>
-
-        <plugins>
-            <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateAbstractRegionAccessStrategy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateAbstractRegionAccessStrategy.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateAbstractRegionAccessStrategy.java
deleted file mode 100644
index efb9056..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateAbstractRegionAccessStrategy.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.access.RegionAccessStrategy;
-import org.hibernate.cache.spi.access.SoftLock;
-import org.hibernate.engine.spi.SharedSessionContractImplementor;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Implementation of L2 cache access strategy delegating to {@link HibernateAccessStrategyAdapter}.
- */
-public abstract class HibernateAbstractRegionAccessStrategy implements RegionAccessStrategy {
-    /** */
-    protected final HibernateAccessStrategyAdapter stgy;
-
-    /**
-     * @param stgy Access strategy implementation.
-     */
-    protected HibernateAbstractRegionAccessStrategy(HibernateAccessStrategyAdapter stgy) {
-        this.stgy = stgy;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object get(SharedSessionContractImplementor ses, Object key, long txTs) throws CacheException {
-        return stgy.get(key);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean putFromLoad(SharedSessionContractImplementor ses, Object key, Object val, long txTs, Object ver) throws CacheException {
-        stgy.putFromLoad(key, val);
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean putFromLoad(SharedSessionContractImplementor ses, Object key, Object val, long txTs, Object ver, boolean minimalPutOverride)
-        throws CacheException {
-        stgy.putFromLoad(key, val, minimalPutOverride);
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public SoftLock lockItem(SharedSessionContractImplementor ses, Object key, Object ver) throws CacheException {
-        return stgy.lock(key);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public SoftLock lockRegion() throws CacheException {
-        return stgy.lockRegion();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void unlockRegion(SoftLock lock) throws CacheException {
-        stgy.unlockRegion(lock);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void unlockItem(SharedSessionContractImplementor ses, Object key, SoftLock lock) throws CacheException {
-        stgy.unlock(key, lock);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void remove(SharedSessionContractImplementor ses, Object key) throws CacheException {
-        stgy.remove(key);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void removeAll() throws CacheException {
-        stgy.removeAll();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void evict(Object key) throws CacheException {
-        stgy.evict(key);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void evictAll() throws CacheException {
-        stgy.evictAll();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyAdapter.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyAdapter.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyAdapter.java
deleted file mode 100644
index f6c1d0e..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyAdapter.java
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteCallable;
-import org.apache.ignite.resources.IgniteInstanceResource;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy;
-import org.hibernate.cache.spi.access.EntityRegionAccessStrategy;
-import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy;
-import org.hibernate.cache.spi.access.RegionAccessStrategy;
-import org.hibernate.cache.spi.access.SoftLock;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Common interface used to implement Hibernate L2 cache access strategies ({@link RegionAccessStrategy},
- * {@link EntityRegionAccessStrategy} and {@link CollectionRegionAccessStrategy}).
- * <p>
- * The expected sequences of steps related to various CRUD operations executed by Hibernate are:
- * <p>
- * Insert:
- * <ul>
- *     <li>Start DB transaction.</li>
- *     <li>Execute database insert.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#insert}.</li>
- *     <li>Commit DB transaction.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#afterInsert}.</li>
- * </ul>
- * In case if some step fails and DB transaction is rolled back then
- * {@link HibernateAccessStrategyAdapter#afterInsert} is not called.
- * <p>
- * Update:
- * <ul>
- *     <li>Start DB transaction.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#lock}.</li>
- *     <li>Execute database update.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#update}.</li>
- *     <li>Commit DB transaction.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#afterUpdate}.</li>
- * </ul>
- * In case if {@link HibernateAccessStrategyAdapter#lock} was called, but some other step fails and DB
- * transaction is rolled back then {@link HibernateAccessStrategyAdapter#unlock} is called for all locked keys.
- * <p>
- * Delete:
- * <ul>
- *     <li>Start DB transaction.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#lock} for removing key.</li>
- *     <li>Execute database delete.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#remove}.</li>
- *     <li>Commit DB transaction.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#unlock}.</li>
- * </ul>
- * In case if {@link HibernateAccessStrategyAdapter#lock} was called, but some other step fails and DB
- * transaction is rolled back then {@link HibernateAccessStrategyAdapter#unlock} is called for all locked keys.
- * <p>
- * In case if custom SQL update query is executed Hibernate clears entire cache region,
- * for this case operations sequence is:
- * <ul>
- *     <li>Start DB transaction.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#lockRegion}.</li>
- *     <li>Execute database query.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#removeAll}.</li>
- *     <li>Commit DB transaction.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#unlockRegion}.</li>
- * </ul>
- */
-public abstract class HibernateAccessStrategyAdapter {
-    /** */
-    protected final HibernateCacheProxy cache;
-
-    /** Grid. */
-    protected final Ignite ignite;
-
-    /** */
-    protected final IgniteLogger log;
-
-    /**
-     * @param ignite Grid.
-     * @param cache Cache.
-     */
-    protected HibernateAccessStrategyAdapter(Ignite ignite, HibernateCacheProxy cache) {
-        this.cache = cache;
-        this.ignite = ignite;
-
-        log = ignite.log();
-    }
-
-    /**
-     * Gets value from cache. Used by {@link RegionAccessStrategy#get}.
-     *
-     * @param key Key.
-     * @return Cached value.
-     * @throws CacheException If failed.
-     */
-    @Nullable protected Object get(Object key) throws CacheException {
-        try {
-            return cache.get(key);
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /**
-     * Puts in cache value loaded from the database. Used by {@link RegionAccessStrategy#putFromLoad}.
-     *
-     * @param key Key.
-     * @param val Value.
-     * @param minimalPutOverride MinimalPut flag
-     * @throws CacheException If failed.
-     */
-    protected void putFromLoad(Object key, Object val, boolean minimalPutOverride) throws CacheException {
-        putFromLoad(key, val);
-    }
-
-    /**
-     * Puts in cache value loaded from the database. Used by {@link RegionAccessStrategy#putFromLoad}.
-     *
-     * @param key Key.
-     * @param val Value.
-     * @throws CacheException If failed.
-     */
-    protected void putFromLoad(Object key, Object val) throws CacheException {
-        try {
-            cache.put(key, val);
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /**
-     * Called during database transaction execution before Hibernate attempts to update or remove given key.
-     * Used by {@link RegionAccessStrategy#lockItem}.
-     *
-     * @param key Key.
-     * @return Lock representation or {@code null}.
-     * @throws CacheException If failed.
-     */
-    @Nullable protected abstract SoftLock lock(Object key) throws CacheException;
-
-    /**
-     * Called after Hibernate failed to update or successfully removed given key.
-     * Used by {@link RegionAccessStrategy#unlockItem}.
-     *
-     * @param key Key.
-     * @param lock The lock previously obtained from {@link #lock}
-     * @throws CacheException If failed.
-     */
-    protected abstract void unlock(Object key, SoftLock lock) throws CacheException;
-
-    /**
-     * Called after Hibernate updated object in the database but before transaction completed.
-     * Used by {@link EntityRegionAccessStrategy#update} and {@link NaturalIdRegionAccessStrategy#update}.
-     *
-     * @param key Key.
-     * @param val Value.
-     * @return {@code True} if operation updated cache.
-     * @throws CacheException If failed.
-     */
-    protected abstract boolean update(Object key, Object val) throws CacheException;
-
-    /**
-     * Called after Hibernate updated object in the database and transaction successfully completed.
-     * Used by {@link EntityRegionAccessStrategy#afterUpdate} and {@link NaturalIdRegionAccessStrategy#afterUpdate}.
-     *
-     * @param key Key.
-     * @param val Value.
-     * @param lock The lock previously obtained from {@link #lock}
-     * @return {@code True} if operation updated cache.
-     * @throws CacheException If failed.
-     */
-    protected abstract boolean afterUpdate(Object key, Object val, SoftLock lock) throws CacheException;
-
-    /**
-     * Called after Hibernate inserted object in the database but before transaction completed.
-     * Used by {@link EntityRegionAccessStrategy#insert} and {@link NaturalIdRegionAccessStrategy#insert}.
-     *
-     * @param key Key.
-     * @param val Value.
-     * @return {@code True} if operation updated cache.
-     * @throws CacheException If failed.
-     */
-    protected abstract boolean insert(Object key, Object val) throws CacheException;
-
-    /**
-     * Called after Hibernate inserted object in the database and transaction successfully completed.
-     * Used by {@link EntityRegionAccessStrategy#afterInsert} and {@link NaturalIdRegionAccessStrategy#afterInsert}.
-     *
-     * @param key Key.
-     * @param val Value.
-     * @return {@code True} if operation updated cache.
-     * @throws CacheException If failed.
-     */
-    protected abstract boolean afterInsert(Object key, Object val) throws CacheException;
-
-    /**
-     * Called after Hibernate removed object from database but before transaction completed.
-     * Used by {@link RegionAccessStrategy#remove}.
-     *
-     * @param key Key,
-     * @throws CacheException If failed.
-     */
-    protected abstract void remove(Object key) throws CacheException;
-
-    /**
-     * Called to remove object from cache without regard to transaction.
-     * Used by {@link RegionAccessStrategy#evict}.
-     *
-     * @param key Key.
-     * @throws CacheException If failed.
-     */
-    protected void evict(Object key) throws CacheException {
-        evict(ignite, cache, key);
-    }
-
-    /**
-     * Called to remove all data from cache without regard to transaction.
-     * Used by {@link RegionAccessStrategy#evictAll}.
-     *
-     * @throws CacheException If failed.
-     */
-    protected void evictAll() throws CacheException {
-        evictAll(cache);
-    }
-
-    /**
-     * Called during database transaction execution before Hibernate executed
-     * update operation which should invalidate entire cache region.
-     * Used by {@link RegionAccessStrategy#lockRegion}.
-     *
-     * @throws CacheException If failed.
-     * @return Lock representation or {@code null}.
-     */
-    @Nullable protected SoftLock lockRegion() throws CacheException {
-        return null;
-    }
-
-    /**
-     * Called after transaction clearing entire cache region completed.
-     * Used by {@link RegionAccessStrategy#unlockRegion}.
-     *
-     * @param lock The lock previously obtained from {@link #lockRegion}
-     * @throws CacheException If failed.
-     */
-    protected void unlockRegion(SoftLock lock) throws CacheException {
-        // No-op.
-    }
-
-    /**
-     * Called during database transaction execution to clear entire cache region after
-     * Hibernate executed database update, but before transaction completed.
-     * Used by {@link RegionAccessStrategy#removeAll}.
-     *
-     * @throws CacheException If failed.
-     */
-    protected final void removeAll() throws CacheException {
-        evictAll();
-    }
-
-    /**
-     * Called to remove object from cache without regard to transaction.
-     *
-     * @param ignite Grid.
-     * @param cache Cache.
-     * @param key Key.
-     * @throws CacheException If failed.
-     */
-    static void evict(Ignite ignite, HibernateCacheProxy cache, Object key) throws CacheException {
-        try {
-            key = cache.keyTransformer().transform(key);
-
-            ignite.compute(ignite.cluster()).call(new ClearKeyCallable(key, cache.name()));
-        }
-        catch (IgniteException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /**
-     * Called to remove all data from cache without regard to transaction.
-     *
-     * @param cache Cache.
-     * @throws CacheException If failed.
-     */
-    static void evictAll(IgniteInternalCache<Object,Object> cache) throws CacheException {
-        try {
-            cache.clear();
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /**
-     * Callable invalidates given key.
-     */
-    private static class ClearKeyCallable implements IgniteCallable<Void>, Externalizable {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** */
-        @IgniteInstanceResource
-        private Ignite ignite;
-
-        /** */
-        private Object key;
-
-        /** */
-        private String cacheName;
-
-        /**
-         * Empty constructor required by {@link Externalizable}.
-         */
-        public ClearKeyCallable() {
-            // No-op.
-        }
-
-        /**
-         * @param key Key to clear.
-         * @param cacheName Cache name.
-         */
-        private ClearKeyCallable(Object key, String cacheName) {
-            this.key = key;
-            this.cacheName = cacheName;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Void call() throws IgniteCheckedException {
-            IgniteInternalCache<Object, Object> cache = ((IgniteKernal)ignite).getCache(cacheName);
-
-            assert cache != null;
-
-            cache.clearLocally(key);
-
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void writeExternal(ObjectOutput out) throws IOException {
-            out.writeObject(key);
-
-            U.writeString(out, cacheName);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-            key = in.readObject();
-
-            cacheName = U.readString(in);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
deleted file mode 100644
index 7204083..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
+++ /dev/null
@@ -1,801 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import javax.cache.Cache;
-import javax.cache.expiry.ExpiryPolicy;
-import javax.cache.processor.EntryProcessor;
-import javax.cache.processor.EntryProcessorResult;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cache.CacheEntry;
-import org.apache.ignite.cache.CacheMetrics;
-import org.apache.ignite.cache.CachePeekMode;
-import org.apache.ignite.cache.affinity.Affinity;
-import org.apache.ignite.cluster.ClusterGroup;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.IgniteCacheExpiryPolicy;
-import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
-import org.apache.ignite.lang.IgniteBiPredicate;
-import org.apache.ignite.mxbean.CacheMetricsMXBean;
-import org.apache.ignite.transactions.Transaction;
-import org.apache.ignite.transactions.TransactionConcurrency;
-import org.apache.ignite.transactions.TransactionIsolation;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Hibernate cache proxy used to substitute hibernate keys with ignite keys.
- */
-public class HibernateCacheProxy implements IgniteInternalCache<Object, Object> {
-    /** Delegate. */
-    private final IgniteInternalCache<Object, Object> delegate;
-
-    /** Transformer. */
-    private final HibernateKeyTransformer keyTransformer;
-
-    /**
-     * @param delegate Delegate.
-     * @param keyTransformer Key keyTransformer.
-     */
-    HibernateCacheProxy(
-        IgniteInternalCache<Object, Object> delegate,
-        HibernateKeyTransformer keyTransformer
-    ) {
-        assert delegate != null;
-        assert keyTransformer != null;
-
-        this.delegate = delegate;
-        this.keyTransformer = keyTransformer;
-    }
-
-    /**
-     * @return HibernateKeyTransformer
-     */
-    HibernateKeyTransformer keyTransformer(){
-        return keyTransformer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String name() {
-        return delegate.name();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean skipStore() {
-        return delegate.skipStore();
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalCache setSkipStore(boolean skipStore) {
-        return delegate.setSkipStore(skipStore);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isEmpty() {
-        return delegate.isEmpty();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean containsKey(Object key) {
-        return delegate.containsKey(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> containsKeyAsync(Object key) {
-        return delegate.containsKeyAsync(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean containsKeys(Collection keys) {
-        return delegate.containsKey(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> containsKeysAsync(Collection keys) {
-        return delegate.containsKeysAsync(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object localPeek(
-        Object key,
-        CachePeekMode[] peekModes,
-        @Nullable IgniteCacheExpiryPolicy plc
-    ) throws IgniteCheckedException {
-        return delegate.localPeek(keyTransformer.transform(key), peekModes, plc);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Iterable<Cache.Entry<Object, Object>> localEntries(
-        CachePeekMode[] peekModes
-    ) throws IgniteCheckedException {
-        return delegate.localEntries(peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object get(Object key) throws IgniteCheckedException {
-        return delegate.get(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public CacheEntry getEntry(Object key) throws IgniteCheckedException {
-        return delegate.getEntry(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture getAsync(Object key) {
-        return delegate.getAsync(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<CacheEntry<Object, Object>> getEntryAsync(Object key) {
-        return delegate.getEntryAsync(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public Map getAll(@Nullable Collection keys) throws IgniteCheckedException {
-        return delegate.getAll(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public Collection<CacheEntry<Object, Object>> getEntries(
-        @Nullable Collection keys) throws IgniteCheckedException {
-        return delegate.getEntries(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Map<Object, Object>> getAllAsync(@Nullable Collection keys) {
-        return delegate.getAllAsync(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Collection<CacheEntry<Object,Object>>> getEntriesAsync(
-        @Nullable Collection keys
-    ) {
-        return delegate.getEntriesAsync(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object getAndPut(Object key, Object val) throws IgniteCheckedException {
-        return delegate.getAndPut(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture getAndPutAsync(Object key, Object val) {
-        return delegate.getAndPutAsync(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean put(Object key, Object val) throws IgniteCheckedException {
-        return delegate.put(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> putAsync(Object key, Object val) {
-        return delegate.putAsync(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object getAndPutIfAbsent(Object key, Object val) throws IgniteCheckedException {
-        return delegate.getAndPutIfAbsent(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture getAndPutIfAbsentAsync(Object key, Object val) {
-        return delegate.getAndPutIfAbsentAsync(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean putIfAbsent(Object key, Object val) throws IgniteCheckedException {
-        return delegate.putIfAbsent(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> putIfAbsentAsync(Object key, Object val) {
-        return delegate.putIfAbsentAsync(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object getAndReplace(Object key, Object val) throws IgniteCheckedException {
-        return delegate.getAndReplace(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture getAndReplaceAsync(Object key, Object val) {
-        return delegate.getAndReplaceAsync(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean replace(Object key, Object val) throws IgniteCheckedException {
-        return delegate.replace(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> replaceAsync(Object key, Object val) {
-        return delegate.replaceAsync(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean replace(Object key, Object oldVal, Object newVal) throws IgniteCheckedException {
-        return delegate.replace(keyTransformer.transform(key), oldVal, newVal);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> replaceAsync(Object key, Object oldVal, Object newVal) {
-        return delegate.replaceAsync(keyTransformer.transform(key), oldVal, newVal);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void putAll(@Nullable Map m) throws IgniteCheckedException {
-        delegate.putAll(transform(m));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> putAllAsync(@Nullable Map m) {
-        return delegate.putAllAsync(transform(m));
-    }
-
-    /** {@inheritDoc} */
-    @Override public Set keySet() {
-        return delegate.keySet();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Set keySetx() {
-        return delegate.keySetx();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Set primaryKeySet() {
-        return delegate.primaryKeySet();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Iterable values() {
-        return delegate.values();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Set<Cache.Entry<Object, Object>> entrySet() {
-        return delegate.entrySet();
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Set<Cache.Entry<Object,Object>> entrySet(int part) {
-        return delegate.entrySet(part);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Set<Cache.Entry<Object, Object>> entrySetx(CacheEntryPredicate... filter) {
-        return delegate.entrySetx(filter);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Transaction txStart(
-        TransactionConcurrency concurrency,
-        TransactionIsolation isolation
-    ) {
-        return delegate.txStart(concurrency, isolation);
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridNearTxLocal txStartEx(
-        TransactionConcurrency concurrency,
-        TransactionIsolation isolation
-    ) {
-        return delegate.txStartEx(concurrency, isolation);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Transaction txStart(
-        TransactionConcurrency concurrency,
-        TransactionIsolation isolation,
-        long timeout,
-        int txSize
-    ) {
-        return delegate.txStart(concurrency, isolation, timeout, txSize);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public GridNearTxLocal tx() {
-        return delegate.tx();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean evict(Object key) {
-        return delegate.evict(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void evictAll(@Nullable Collection keys) {
-        delegate.evictAll(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void clearLocally(boolean srv, boolean near, boolean readers) {
-        delegate.clearLocally(srv, near, readers);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean clearLocally(Object key) {
-        return delegate.clearLocally(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void clearLocallyAll(Set keys, boolean srv, boolean near, boolean readers) {
-        delegate.clearLocallyAll((Set<?>)transform(keys), srv, near, readers);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void clear(Object key) throws IgniteCheckedException {
-        delegate.clear(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void clearAll(Set keys) throws IgniteCheckedException {
-        delegate.clearAll((Set<?>)transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void clear() throws IgniteCheckedException {
-        delegate.clear();
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> clearAsync() {
-        return delegate.clearAsync();
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> clearAsync(Object key) {
-        return delegate.clearAsync(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> clearAllAsync(Set keys) {
-        return delegate.clearAllAsync((Set<?>)transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object getAndRemove(Object key) throws IgniteCheckedException {
-        return delegate.getAndRemove(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture getAndRemoveAsync(Object key) {
-        return delegate.getAndRemoveAsync(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean remove(Object key) throws IgniteCheckedException {
-        return delegate.remove(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> removeAsync(Object key) {
-        return delegate.removeAsync(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean remove(Object key, Object val) throws IgniteCheckedException {
-        return delegate.remove(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> removeAsync(Object key, Object val) {
-        return delegate.removeAsync(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void removeAll(@Nullable Collection keys) throws IgniteCheckedException {
-        delegate.removeAll(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> removeAllAsync(@Nullable Collection keys) {
-        return delegate.removeAllAsync(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void removeAll() throws IgniteCheckedException {
-        delegate.removeAll();
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> removeAllAsync() {
-        return delegate.removeAllAsync();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean lock(Object key, long timeout) throws IgniteCheckedException {
-        return delegate.lock(keyTransformer.transform(key), timeout);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> lockAsync(Object key, long timeout) {
-        return delegate.lockAsync(keyTransformer.transform(key), timeout);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean lockAll(@Nullable Collection keys, long timeout) throws IgniteCheckedException {
-        return delegate.lockAll(transform(keys), timeout);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> lockAllAsync(@Nullable Collection keys, long timeout) {
-        return delegate.lockAllAsync(transform(keys), timeout);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void unlock(Object key) throws IgniteCheckedException {
-        delegate.unlock(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void unlockAll(@Nullable Collection keys) throws IgniteCheckedException {
-        delegate.unlockAll(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isLocked(Object key) {
-        return delegate.isLocked(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isLockedByThread(Object key) {
-        return delegate.isLockedByThread(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public int size() {
-        return delegate.size();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long sizeLong() {
-        return delegate.sizeLong();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int localSize(CachePeekMode[] peekModes) throws IgniteCheckedException {
-        return delegate.localSize(peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Override public long localSizeLong(CachePeekMode[] peekModes) throws IgniteCheckedException {
-        return delegate.localSizeLong(peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Override public long localSizeLong(int partition, CachePeekMode[] peekModes) throws IgniteCheckedException {
-        return delegate.localSizeLong(partition, peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int size(CachePeekMode[] peekModes) throws IgniteCheckedException {
-        return delegate.size(peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Override public long sizeLong(CachePeekMode[] peekModes) throws IgniteCheckedException {
-        return delegate.sizeLong(peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Override public long sizeLong(int partition, CachePeekMode[] peekModes) throws IgniteCheckedException {
-        return delegate.sizeLong(partition, peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Integer> sizeAsync(CachePeekMode[] peekModes) {
-        return delegate.sizeAsync(peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Long> sizeLongAsync(CachePeekMode[] peekModes) {
-        return delegate.sizeLongAsync(peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Long> sizeLongAsync(int partition, CachePeekMode[] peekModes) {
-        return delegate.sizeLongAsync(partition, peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int nearSize() {
-        return delegate.nearSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int primarySize() {
-        return delegate.primarySize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long primarySizeLong() {
-        return delegate.primarySizeLong();
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheConfiguration configuration() {
-        return delegate.configuration();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Affinity affinity() {
-        return delegate.affinity();
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheMetrics clusterMetrics() {
-        return delegate.clusterMetrics();
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheMetrics clusterMetrics(ClusterGroup grp) {
-        return delegate.clusterMetrics(grp);
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheMetrics localMetrics() {
-        return delegate.localMetrics();
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheMetricsMXBean clusterMxBean() {
-        return delegate.clusterMxBean();
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheMetricsMXBean localMxBean() {
-        return delegate.localMxBean();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long offHeapEntriesCount() {
-        return delegate.offHeapEntriesCount();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long offHeapAllocatedSize() {
-        return delegate.offHeapAllocatedSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> rebalance() {
-        return delegate.rebalance();
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalCache forSubjectId(UUID subjId) {
-        return delegate.forSubjectId(subjId);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object getForcePrimary(Object key) throws IgniteCheckedException {
-        return delegate.getForcePrimary(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture getForcePrimaryAsync(Object key) {
-        return delegate.getForcePrimaryAsync(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public Map getAllOutTx(Set keys) throws IgniteCheckedException {
-        return delegate.getAllOutTx((Set<?>)transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Map<Object, Object>> getAllOutTxAsync(Set keys) {
-        return delegate.getAllOutTxAsync((Set<?>)transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isIgfsDataCache() {
-        return delegate.isIgfsDataCache();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long igfsDataSpaceUsed() {
-        return delegate.igfsDataSpaceUsed();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isMongoDataCache() {
-        return delegate.isMongoDataCache();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isMongoMetaCache() {
-        return delegate.isMongoMetaCache();
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public ExpiryPolicy expiry() {
-        return delegate.expiry();
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalCache withExpiryPolicy(ExpiryPolicy plc) {
-        return delegate.withExpiryPolicy(plc);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalCache withNoRetries() {
-        return delegate.withNoRetries();
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheContext context() {
-        return delegate.context();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void localLoadCache(
-        @Nullable IgniteBiPredicate p,
-        @Nullable Object... args
-    ) throws IgniteCheckedException {
-        delegate.localLoadCache(p, args);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> localLoadCacheAsync(
-        @Nullable IgniteBiPredicate p,
-        @Nullable Object... args
-    ) {
-        return delegate.localLoadCacheAsync(p, args);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Object getTopologySafe(Object key) throws IgniteCheckedException {
-        return delegate.getTopologySafe(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public Collection<Integer> lostPartitions() {
-        return delegate.lostPartitions();
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public EntryProcessorResult invoke(
-        @Nullable AffinityTopologyVersion topVer,
-        Object key,
-        EntryProcessor entryProcessor,
-        Object... args
-    ) throws IgniteCheckedException {
-        return delegate.invoke(topVer, key, entryProcessor, args);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Map> invokeAllAsync(Map map, Object... args) {
-        return delegate.invokeAllAsync(map, args);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Map invokeAll(Map map, Object... args) throws IgniteCheckedException {
-        return delegate.invokeAll(map, args);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Map> invokeAllAsync(Set keys, EntryProcessor entryProcessor, Object... args) {
-        return delegate.invokeAllAsync((Set<?>)transform(keys), entryProcessor, args);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Map invokeAll(Set keys, EntryProcessor entryProcessor, Object... args) throws IgniteCheckedException {
-        return delegate.invokeAll((Set<?>)transform(keys), entryProcessor, args);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<EntryProcessorResult> invokeAsync(
-        Object key,
-        EntryProcessor entryProcessor,
-        Object... args
-    ) {
-        return delegate.invokeAsync(keyTransformer.transform(key), entryProcessor, args);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public EntryProcessorResult invoke(
-        Object key,
-        EntryProcessor entryProcessor,
-        Object... args
-    ) throws IgniteCheckedException {
-        return delegate.invoke(keyTransformer.transform(key), entryProcessor, args);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Iterator<Cache.Entry<Object,Object>> scanIterator(
-        boolean keepBinary,
-        @Nullable IgniteBiPredicate p
-    ) throws IgniteCheckedException {
-        return delegate.scanIterator(keepBinary, p);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> removeAllConflictAsync(Map drMap) throws IgniteCheckedException {
-        return delegate.removeAllConflictAsync(drMap);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void removeAllConflict(Map drMap) throws IgniteCheckedException {
-        delegate.removeAllConflictAsync(drMap);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> putAllConflictAsync(Map drMap) throws IgniteCheckedException {
-        return delegate.putAllConflictAsync(drMap);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void putAllConflict(Map drMap) throws IgniteCheckedException {
-        delegate.putAllConflict(drMap);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalCache keepBinary() {
-        return delegate.keepBinary();
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalCache cache() {
-        return delegate.cache();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Iterator iterator() {
-        return delegate.iterator();
-    }
-
-    /**
-     * @param keys Keys.
-     */
-    private Collection<Object> transform(Collection<Object> keys) {
-        Collection<Object> res = new LinkedList<>();
-
-        for (Object o : keys)
-            res.add(keyTransformer.transform(o));
-
-        return res;
-    }
-
-    /**
-     * @param map Map.
-     */
-    private Map<Object, Object> transform(Map<Object, Object> map) {
-        Map<Object, Object> res = new HashMap<>();
-
-        Set<Map.Entry<Object, Object>> ents = map.entrySet();
-
-        for (Map.Entry<Object, Object> e : ents)
-            res.put(keyTransformer.transform(e.getKey()), e.getValue());
-
-        return res;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateCollectionRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateCollectionRegion.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateCollectionRegion.java
deleted file mode 100644
index be99e98..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateCollectionRegion.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.Ignite;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.CacheDataDescription;
-import org.hibernate.cache.spi.CollectionRegion;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy;
-import org.hibernate.engine.spi.SessionFactoryImplementor;
-import org.hibernate.persister.collection.CollectionPersister;
-
-/**
- * Implementation of {@link CollectionRegion}. This region is used to store collection data.
- * <p>
- * L2 cache for collection can be enabled in the Hibernate configuration file:
- * <pre name="code" class="xml">
- * &lt;hibernate-configuration&gt;
- *     &lt;!-- Enable L2 cache. --&gt;
- *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
- *
- *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
- *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
- *
- *     &lt;!-- Specify entities. --&gt;
- *     &lt;mapping class="com.example.Entity"/&gt;
- *     &lt;mapping class="com.example.ChildEntity"/&gt;
- *
- *     &lt;!-- Enable L2 cache with nonstrict-read-write access strategy for entities and collection. --&gt;
- *     &lt;collection-cache collection="com.example.Entity" usage="nonstrict-read-write"/&gt;
- *     &lt;collection-cache collection="com.example.ChildEntity" usage="nonstrict-read-write"/&gt;
- *     &lt;collection-cache collection="com.example.Entity.children" usage="nonstrict-read-write"/&gt;
- * &lt;/hibernate-configuration&gt;
- * </pre>
- * Also cache for collection can be enabled using annotations:
- * <pre name="code" class="java">
- * &#064;javax.persistence.Entity
- * public class Entity {
- *    ...
- *
- *    &#064;javax.persistence.OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
- *    &#064;javax.persistence.JoinColumn(name="PARENT_ID")
- *    &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
- *    public List&lt;ChildEntity&gt; getChildren() {...}
- * }
- * </pre>
- * Note: the collection cache does not cache the state of the actual entities in the cache, it caches only identifier
- * values. For this reason, the collection cache should always be used in conjunction with
- * the second-level cache for those entities expected to be cached as part of a collection cache.
- */
-public class HibernateCollectionRegion extends HibernateTransactionalDataRegion implements CollectionRegion {
-    /**
-     * @param factory Region factory.
-     * @param name Region name.
-     * @param ignite Grid.
-     * @param cache Region cache.
-     * @param dataDesc Region data description.
-     */
-    public HibernateCollectionRegion(HibernateRegionFactory factory, String name,
-        Ignite ignite, HibernateCacheProxy cache, CacheDataDescription dataDesc) {
-        super(factory, name, ignite, cache, dataDesc);
-    }
-
-    /** {@inheritDoc} */
-    @Override public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
-        return new AccessStrategy(createAccessStrategy(accessType));
-    }
-
-    /**
-     * Collection region access strategy.
-     */
-    private class AccessStrategy extends HibernateAbstractRegionAccessStrategy
-        implements CollectionRegionAccessStrategy {
-        /**
-         * @param stgy Access strategy implementation.
-         */
-        private AccessStrategy(HibernateAccessStrategyAdapter stgy) {
-            super(stgy);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object generateCacheKey(Object id,
-            CollectionPersister persister,
-            SessionFactoryImplementor factory, String tenantIdentifier) {
-            return HibernateKeyWrapper.staticCreateCollectionKey(id, persister, tenantIdentifier);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object getCacheKeyId(Object cacheKey) {
-            return ((HibernateKeyWrapper)cacheKey).id();
-        }
-
-        /** {@inheritDoc} */
-        @Override public CollectionRegion getRegion() {
-            return HibernateCollectionRegion.this;
-        }
-    }
-}
\ No newline at end of file


[32/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedTxOneNodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedTxOneNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedTxOneNodeTest.java
index 9d39844..cdd17e6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedTxOneNodeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedTxOneNodeTest.java
@@ -114,7 +114,7 @@ public class GridCacheContinuousQueryReplicatedTxOneNodeTest extends GridCommonA
      */
     private void doTest(boolean loc) throws Exception {
         try {
-            IgniteCache<String, Integer> cache = startGrid(0).cache(null);
+            IgniteCache<String, Integer> cache = startGrid(0).cache(DEFAULT_CACHE_NAME);
 
             ContinuousQuery<String, Integer> qry = new ContinuousQuery<>();
 
@@ -155,7 +155,7 @@ public class GridCacheContinuousQueryReplicatedTxOneNodeTest extends GridCommonA
      */
     private void doTestOneNode(boolean loc) throws Exception {
         try {
-            IgniteCache<String, Integer> cache = startGrid(0).cache(null);
+            IgniteCache<String, Integer> cache = startGrid(0).cache(DEFAULT_CACHE_NAME);
 
             ContinuousQuery<String, Integer> qry = new ContinuousQuery<>();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientReconnectTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientReconnectTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientReconnectTest.java
index eb1b27e..9ad6d4e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientReconnectTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientReconnectTest.java
@@ -54,7 +54,7 @@ public class IgniteCacheContinuousQueryClientReconnectTest extends IgniteClientR
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(atomicMode());
@@ -88,7 +88,7 @@ public class IgniteCacheContinuousQueryClientReconnectTest extends IgniteClientR
 
         qry.setLocalListener(lsnr);
 
-        IgniteCache<Object, Object> clnCache = client.cache(null);
+        IgniteCache<Object, Object> clnCache = client.cache(DEFAULT_CACHE_NAME);
 
         QueryCursor<?> cur = clnCache.query(qry);
 
@@ -133,7 +133,7 @@ public class IgniteCacheContinuousQueryClientReconnectTest extends IgniteClientR
 
         qry.setLocalListener(lsnr);
 
-        IgniteCache<Object, Object> clnCache = client.cache(null);
+        IgniteCache<Object, Object> clnCache = client.cache(DEFAULT_CACHE_NAME);
 
         QueryCursor<?> cur = clnCache.query(qry);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientTest.java
index ae5a2d6..1e40170 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientTest.java
@@ -58,7 +58,7 @@ public class IgniteCacheContinuousQueryClientTest extends GridCommonAbstractTest
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(ATOMIC);
@@ -98,7 +98,7 @@ public class IgniteCacheContinuousQueryClientTest extends GridCommonAbstractTest
 
         qry.setLocalListener(lsnr);
 
-        QueryCursor<?> cur = clientNode.cache(null).query(qry);
+        QueryCursor<?> cur = clientNode.cache(DEFAULT_CACHE_NAME).query(qry);
 
         for (int i = 0; i < 10; i++) {
             log.info("Start iteration: " + i);
@@ -107,7 +107,7 @@ public class IgniteCacheContinuousQueryClientTest extends GridCommonAbstractTest
 
             Ignite joined1 = startGrid(4);
 
-            IgniteCache<Object, Object> joinedCache1 = joined1.cache(null);
+            IgniteCache<Object, Object> joinedCache1 = joined1.cache(DEFAULT_CACHE_NAME);
 
             joinedCache1.put(primaryKey(joinedCache1), 1);
 
@@ -117,7 +117,7 @@ public class IgniteCacheContinuousQueryClientTest extends GridCommonAbstractTest
 
             Ignite joined2 = startGrid(5);
 
-            IgniteCache<Object, Object> joinedCache2 = joined2.cache(null);
+            IgniteCache<Object, Object> joinedCache2 = joined2.cache(DEFAULT_CACHE_NAME);
 
             joinedCache2.put(primaryKey(joinedCache2), 2);
 
@@ -154,13 +154,13 @@ public class IgniteCacheContinuousQueryClientTest extends GridCommonAbstractTest
 
             qry.setLocalListener(lsnr);
 
-            QueryCursor<?> cur = clientNode.cache(null).query(qry);
+            QueryCursor<?> cur = clientNode.cache(DEFAULT_CACHE_NAME).query(qry);
 
             lsnr.latch = new CountDownLatch(1);
 
             Ignite joined1 = startGrid(4);
 
-            IgniteCache<Object, Object> joinedCache1 = joined1.cache(null);
+            IgniteCache<Object, Object> joinedCache1 = joined1.cache(DEFAULT_CACHE_NAME);
 
             joinedCache1.put(primaryKey(joinedCache1), 1);
 
@@ -172,7 +172,7 @@ public class IgniteCacheContinuousQueryClientTest extends GridCommonAbstractTest
 
             Ignite joined2 = startGrid(5);
 
-            IgniteCache<Object, Object> joinedCache2 = joined2.cache(null);
+            IgniteCache<Object, Object> joinedCache2 = joined2.cache(DEFAULT_CACHE_NAME);
 
             joinedCache2.put(primaryKey(joinedCache2), 2);
 
@@ -209,7 +209,7 @@ public class IgniteCacheContinuousQueryClientTest extends GridCommonAbstractTest
                 @Override public IgniteCache<Integer, Integer> apply() {
                     ++cnt;
 
-                    return grid(CLIENT_ID).cache(null);
+                    return grid(CLIENT_ID).cache(DEFAULT_CACHE_NAME);
                 }
             };
 
@@ -219,7 +219,7 @@ public class IgniteCacheContinuousQueryClientTest extends GridCommonAbstractTest
 
         qry.setLocalListener(lsnr);
 
-        QueryCursor<?> cur = clnNode.cache(null).query(qry);
+        QueryCursor<?> cur = clnNode.cache(DEFAULT_CACHE_NAME).query(qry);
 
         boolean first = true;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryImmutableEntryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryImmutableEntryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryImmutableEntryTest.java
index efac24a..b91217f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryImmutableEntryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryImmutableEntryTest.java
@@ -65,7 +65,7 @@ public class IgniteCacheContinuousQueryImmutableEntryTest extends GridCommonAbst
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(ATOMIC);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
@@ -102,17 +102,17 @@ public class IgniteCacheContinuousQueryImmutableEntryTest extends GridCommonAbst
 
         // Add initial values.
         for (int i = 0; i < GRID_COUNT; ++i) {
-            keys[i] = primaryKey(grid(i).cache(null));
+            keys[i] = primaryKey(grid(i).cache(DEFAULT_CACHE_NAME));
 
-            grid(0).cache(null).put(keys[i], -1);
+            grid(0).cache(DEFAULT_CACHE_NAME).put(keys[i], -1);
         }
 
-        try (QueryCursor<?> cur = grid(0).cache(null).query(qry)) {
+        try (QueryCursor<?> cur = grid(0).cache(DEFAULT_CACHE_NAME).query(qry)) {
             // Replace values on the keys.
             for (int i = 0; i < KEYS_COUNT; i++) {
                 log.info("Put key: " + i);
 
-                grid(i % GRID_COUNT).cache(null).put(keys[i % GRID_COUNT], i);
+                grid(i % GRID_COUNT).cache(DEFAULT_CACHE_NAME).put(keys[i % GRID_COUNT], i);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryNoUnsubscribeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryNoUnsubscribeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryNoUnsubscribeTest.java
index fa676c7..d683346 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryNoUnsubscribeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryNoUnsubscribeTest.java
@@ -54,7 +54,7 @@ public class IgniteCacheContinuousQueryNoUnsubscribeTest extends GridCommonAbstr
         cfg.setPeerClassLoadingEnabled(false);
         cfg.setClientMode(client);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setCacheConfiguration(ccfg);
 
@@ -111,9 +111,9 @@ public class IgniteCacheContinuousQueryNoUnsubscribeTest extends GridCommonAbstr
 
             qry.setAutoUnsubscribe(false);
 
-            ignite.cache(null).query(qry);
+            ignite.cache(DEFAULT_CACHE_NAME).query(qry);
 
-            ignite.cache(null).put(1, 1);
+            ignite.cache(DEFAULT_CACHE_NAME).put(1, 1);
 
             assertEquals(1, cntr.get());
         }
@@ -123,20 +123,20 @@ public class IgniteCacheContinuousQueryNoUnsubscribeTest extends GridCommonAbstr
         try (Ignite newSrv = startGrid(3)) {
             awaitPartitionMapExchange();
 
-            Integer key = primaryKey(newSrv.cache(null));
+            Integer key = primaryKey(newSrv.cache(DEFAULT_CACHE_NAME));
 
-            newSrv.cache(null).put(key, 1);
+            newSrv.cache(DEFAULT_CACHE_NAME).put(key, 1);
 
             assertEquals(2, cntr.get());
 
             for (int i = 0; i < 10; i++)
-                ignite(0).cache(null).put(i, 1);
+                ignite(0).cache(DEFAULT_CACHE_NAME).put(i, 1);
 
             assertEquals(12, cntr.get());
         }
 
         for (int i = 10; i < 20; i++)
-            ignite(0).cache(null).put(i, 1);
+            ignite(0).cache(DEFAULT_CACHE_NAME).put(i, 1);
 
         assertEquals(22, cntr.get());
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryReconnectTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryReconnectTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryReconnectTest.java
index 58a9490..f8f5393 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryReconnectTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryReconnectTest.java
@@ -51,7 +51,7 @@ public class IgniteCacheContinuousQueryReconnectTest extends GridCommonAbstractT
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(atomicMode());
@@ -134,8 +134,8 @@ public class IgniteCacheContinuousQueryReconnectTest extends GridCommonAbstractT
 
         isClient = false;
 
-        IgniteCache<Object, Object> cache1 = srv1.cache(null);
-        IgniteCache<Object, Object> clCache = client.cache(null);
+        IgniteCache<Object, Object> cache1 = srv1.cache(DEFAULT_CACHE_NAME);
+        IgniteCache<Object, Object> clCache = client.cache(DEFAULT_CACHE_NAME);
 
         putAndCheck(clCache, 0); // 0 remote listeners.
 
@@ -179,7 +179,7 @@ public class IgniteCacheContinuousQueryReconnectTest extends GridCommonAbstractT
 
         isClient = false;
 
-        clCache = client.cache(null);
+        clCache = client.cache(DEFAULT_CACHE_NAME);
 
         putAndCheck(clCache, 2); // 2 remote listeners.
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java
index acc1a7a..64d815c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStorePartitionedMultiNodeSelfTest.java
@@ -140,7 +140,7 @@ public class GridCacheWriteBehindStorePartitionedMultiNodeSelfTest extends GridC
     private void checkSingleWrites() throws Exception {
         prepare();
 
-        IgniteCache<Integer, String> cache = grid(0).cache(null);
+        IgniteCache<Integer, String> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < 100; i++)
             cache.put(i, String.valueOf(i));
@@ -159,7 +159,7 @@ public class GridCacheWriteBehindStorePartitionedMultiNodeSelfTest extends GridC
         for (int i = 0; i < 100; i++)
             map.put(i, String.valueOf(i));
 
-        grid(0).cache(null).putAll(map);
+        grid(0).cache(DEFAULT_CACHE_NAME).putAll(map);
 
         checkWrites();
     }
@@ -170,7 +170,7 @@ public class GridCacheWriteBehindStorePartitionedMultiNodeSelfTest extends GridC
     private void checkTxWrites() throws Exception {
         prepare();
 
-        IgniteCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
             for (int i = 0; i < 100; i++)

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgniteCacheWriteBehindNoUpdateSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgniteCacheWriteBehindNoUpdateSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgniteCacheWriteBehindNoUpdateSelfTest.java
index f71b65b..cd5e02e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgniteCacheWriteBehindNoUpdateSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgniteCacheWriteBehindNoUpdateSelfTest.java
@@ -63,7 +63,7 @@ public class IgniteCacheWriteBehindNoUpdateSelfTest extends GridCommonAbstractTe
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration<String, Long> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<String, Long> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
         ccfg.setCacheMode(CacheMode.PARTITIONED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreAbstractTest.java
index c1d948e..a64104e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreAbstractTest.java
@@ -88,7 +88,7 @@ public abstract class IgnteCacheClientWriteBehindStoreAbstractTest extends Ignit
 
         assertTrue(client.configuration().isClientMode());
 
-        IgniteCache<Integer, Integer> cache = client.cache(null);
+        IgniteCache<Integer, Integer> cache = client.cache(DEFAULT_CACHE_NAME);
 
         assertNull(cache.getConfiguration(CacheConfiguration.class).getCacheStoreFactory());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreNonCoalescingTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreNonCoalescingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreNonCoalescingTest.java
index 1d44a98..6a75dbd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreNonCoalescingTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/IgnteCacheClientWriteBehindStoreNonCoalescingTest.java
@@ -76,7 +76,7 @@ public class IgnteCacheClientWriteBehindStoreNonCoalescingTest extends IgniteCac
     public void testNonCoalescingIncrementing() throws Exception {
         Ignite ignite = grid(0);
 
-        IgniteCache<Integer, Integer> cache = ignite.cache(null);
+        IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         assertEquals(cache.getConfiguration(CacheConfiguration.class).getCacheStoreFactory().getClass(),
             TestIncrementStoreFactory.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionCrossCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionCrossCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionCrossCacheTest.java
index 370dacb..612978f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionCrossCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxPessimisticDeadlockDetectionCrossCacheTest.java
@@ -36,6 +36,7 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionDeadlockException;
 import org.apache.ignite.transactions.TransactionTimeoutException;
+import org.jetbrains.annotations.NotNull;
 
 import static org.apache.ignite.internal.util.typedef.X.hasCause;
 import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
@@ -199,7 +200,7 @@ public class TxPessimisticDeadlockDetectionCrossCacheTest extends GridCommonAbst
      * @param name Name.
      * @param near Near.
      */
-    private IgniteCache<Integer, Integer> getCache(Ignite ignite, String name, boolean near) {
+    private IgniteCache<Integer, Integer> getCache(Ignite ignite, @NotNull String name, boolean near) {
         CacheConfiguration ccfg = defaultCacheConfiguration();
 
         ccfg.setName(name);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
index b58d831..61ceef7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
@@ -44,7 +44,7 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
     @Override protected void beforeTest() throws Exception {
         super.beforeTest();
 
-        Cache<Integer, String> cache = grid(0).cache(null);
+        Cache<Integer, String> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0 ; i < ENTRIES_NUM; i++)
             cache.put(i, "value_" + i);
@@ -54,7 +54,7 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
      * @throws Exception If failed.
      */
     public void testInvoke() throws Exception {
-        Cache<Integer, String> cache = grid(0).cache(null);
+        Cache<Integer, String> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         final AtomicInteger invoked = new AtomicInteger();
 
@@ -79,7 +79,7 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
      * @throws Exception If failed.
      */
     public void testInvokeAll() throws Exception {
-        Cache<Integer, String> cache = grid(0).cache(null);
+        Cache<Integer, String> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         Set<Integer> keys = new HashSet<>();
 
@@ -109,7 +109,7 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
      * @throws Exception If failed.
      */
     public void testLocalPeek() throws Exception {
-        IgniteCache<Integer, String> cache = grid(0).cache(null);
+        IgniteCache<Integer, String> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         Iterable<Cache.Entry<Integer, String>> entries = cache.localEntries();
 
@@ -121,7 +121,7 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
      * @throws Exception If failed.
      */
     public void testVersionComparision() throws Exception {
-        IgniteCache<Integer, String> cache = grid(0).cache(null);
+        IgniteCache<Integer, String> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         CacheEntry<String, Integer> ver1 = cache.invoke(100,
             new EntryProcessor<Integer, String, CacheEntry<String, Integer>>() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java
index f9c63ee..780e20d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbAbstractTest.java
@@ -72,7 +72,7 @@ public abstract class IgniteDbAbstractTest extends GridCommonAbstractTest {
 
         cfg.setMemoryConfiguration(dbCfg);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         if (indexingEnabled())
             ccfg.setIndexedTypes(Integer.class, DbValue.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java
index b7a8bf3..a2732e8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java
@@ -86,7 +86,7 @@ public class IgniteDbDynamicCacheSelfTest extends GridCommonAbstractTest {
 
         Ignite ignite = ignite(0);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName("cache1");
         ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
@@ -119,7 +119,7 @@ public class IgniteDbDynamicCacheSelfTest extends GridCommonAbstractTest {
 
         Ignite ignite = ignite(0);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
         ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbPutGetAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbPutGetAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbPutGetAbstractTest.java
index 12b0126..c916c10 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbPutGetAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbPutGetAbstractTest.java
@@ -54,7 +54,7 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void testGradualRandomPutAllRemoveAll() {
         IgniteEx ig = grid(0);
 
-        IgniteCache<Integer, DbValue> cache = ig.cache(null);
+        IgniteCache<Integer, DbValue> cache = ig.cache(DEFAULT_CACHE_NAME);
 
         final int cnt = 100_000;
 
@@ -116,7 +116,7 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void testRandomRemove() {
         IgniteEx ig = grid(0);
 
-        IgniteCache<Integer, DbValue> cache = ig.cache(null);
+        IgniteCache<Integer, DbValue> cache = ig.cache(DEFAULT_CACHE_NAME);
 
         final int cnt = 50_000;
 
@@ -158,7 +158,7 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void testRandomPut() {
         IgniteEx ig = grid(0);
 
-        IgniteCache<Integer, DbValue> cache = ig.cache(null);
+        IgniteCache<Integer, DbValue> cache = ig.cache(DEFAULT_CACHE_NAME);
 
         final int cnt = 1_000;
 
@@ -189,9 +189,9 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void testPutGetSimple() throws Exception {
         IgniteEx ig = grid(0);
 
-        IgniteCache<Integer, DbValue> cache = ig.cache(null);
+        IgniteCache<Integer, DbValue> cache = ig.cache(DEFAULT_CACHE_NAME);
 
-        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache();
+        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache(DEFAULT_CACHE_NAME);
 
         int k0 = 0;
         DbValue v0 = new DbValue(0, "value-0", 0L);
@@ -215,7 +215,7 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void testPutGetLarge() throws Exception {
         IgniteEx ig = grid(0);
 
-        IgniteCache<Integer, byte[]> cache = ig.cache(null);
+        IgniteCache<Integer, byte[]> cache = ig.cache(DEFAULT_CACHE_NAME);
 
         final byte[] val = new byte[2048];
 
@@ -257,7 +257,7 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
      * @throws Exception If failed.
      */
     public void testPutGetLargeKeys() throws Exception {
-        IgniteCache<LargeDbKey, Integer> cache = ignite(0).cache(null);
+        IgniteCache<LargeDbKey, Integer> cache = ignite(0).cache(DEFAULT_CACHE_NAME);
 
         ThreadLocalRandom rnd = ThreadLocalRandom.current();
 
@@ -307,9 +307,9 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void testPutGetOverwrite() throws Exception {
         IgniteEx ig = grid(0);
 
-        final IgniteCache<Integer, DbValue> cache = ig.cache(null);
+        final IgniteCache<Integer, DbValue> cache = ig.cache(DEFAULT_CACHE_NAME);
 
-        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache();
+        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache(DEFAULT_CACHE_NAME);
 
         final int k0 = 0;
         DbValue v0 = new DbValue(0, "value-0", 0L);
@@ -337,9 +337,9 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void testOverwriteNormalSizeAfterSmallerSize() throws Exception {
         IgniteEx ig = grid(0);
 
-        final IgniteCache<Integer, DbValue> cache = ig.cache(null);
+        final IgniteCache<Integer, DbValue> cache = ig.cache(DEFAULT_CACHE_NAME);
 
-        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache();
+        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache(DEFAULT_CACHE_NAME);
 
         String[] vals = new String[] {"long-long-long-value", "short-value"};
         final int k0 = 0;
@@ -363,7 +363,7 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void testPutDoesNotTriggerRead() throws Exception {
         IgniteEx ig = grid(0);
 
-        final IgniteCache<Integer, DbValue> cache = ig.cache(null);
+        final IgniteCache<Integer, DbValue> cache = ig.cache(DEFAULT_CACHE_NAME);
 
         cache.put(0, new DbValue(0, "test-value-0", 0));
     }
@@ -374,9 +374,9 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void testPutGetMultipleObjects() throws Exception {
         IgniteEx ig = grid(0);
 
-        final IgniteCache<Integer, DbValue> cache = ig.cache(null);
+        final IgniteCache<Integer, DbValue> cache = ig.cache(DEFAULT_CACHE_NAME);
 
-        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache();
+        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache(DEFAULT_CACHE_NAME);
 
         int cnt = 20_000;
 
@@ -449,9 +449,9 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void testSizeClear() throws Exception {
         IgniteEx ig = grid(0);
 
-        final IgniteCache<Integer, DbValue> cache = ig.cache(null);
+        final IgniteCache<Integer, DbValue> cache = ig.cache(DEFAULT_CACHE_NAME);
 
-        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache();
+        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache(DEFAULT_CACHE_NAME);
 
         int cnt = 5000;
 
@@ -486,13 +486,13 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void testBounds() throws Exception {
         IgniteEx ig = grid(0);
 
-        final IgniteCache<Integer, DbValue> cache = ig.cache(null);
+        final IgniteCache<Integer, DbValue> cache = ig.cache(DEFAULT_CACHE_NAME);
 
         X.println("Put start");
 
         int cnt = 1000;
 
-        try (IgniteDataStreamer<Integer, DbValue> st = ig.dataStreamer(null)) {
+        try (IgniteDataStreamer<Integer, DbValue> st = ig.dataStreamer(DEFAULT_CACHE_NAME)) {
             st.allowOverwrite(true);
 
             for (int i = 0; i < cnt; i++) {
@@ -544,13 +544,13 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void testMultithreadedPut() throws Exception {
         IgniteEx ig = grid(0);
 
-        final IgniteCache<Integer, DbValue> cache = ig.cache(null);
+        final IgniteCache<Integer, DbValue> cache = ig.cache(DEFAULT_CACHE_NAME);
 
         X.println("Put start");
 
         int cnt = 20_000;
 
-        try (IgniteDataStreamer<Integer, DbValue> st = ig.dataStreamer(null)) {
+        try (IgniteDataStreamer<Integer, DbValue> st = ig.dataStreamer(DEFAULT_CACHE_NAME)) {
             st.allowOverwrite(true);
 
             for (int i = 0; i < cnt; i++) {
@@ -608,9 +608,9 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void testPutGetRandomUniqueMultipleObjects() throws Exception {
         IgniteEx ig = grid(0);
 
-        final IgniteCache<Integer, DbValue> cache = ig.cache(null);
+        final IgniteCache<Integer, DbValue> cache = ig.cache(DEFAULT_CACHE_NAME);
 
-        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache();
+        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache(DEFAULT_CACHE_NAME);
 
         int cnt = 100_000;
 
@@ -677,9 +677,9 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void testPutPrimaryUniqueSecondaryDuplicates() throws Exception {
         IgniteEx ig = grid(0);
 
-        final IgniteCache<Integer, DbValue> cache = ig.cache(null);
+        final IgniteCache<Integer, DbValue> cache = ig.cache(DEFAULT_CACHE_NAME);
 
-        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache();
+        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache(DEFAULT_CACHE_NAME);
 
         int cnt = 100_000;
 
@@ -723,9 +723,9 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void testPutGetRandomNonUniqueMultipleObjects() throws Exception {
         IgniteEx ig = grid(0);
 
-        final IgniteCache<Integer, DbValue> cache = ig.cache(null);
+        final IgniteCache<Integer, DbValue> cache = ig.cache(DEFAULT_CACHE_NAME);
 
-        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache();
+        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache(DEFAULT_CACHE_NAME);
 
         int cnt = 100_000;
 
@@ -771,9 +771,9 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void testPutGetRemoveMultipleForward() throws Exception {
         IgniteEx ig = grid(0);
 
-        final IgniteCache<Integer, DbValue> cache = ig.cache(null);
+        final IgniteCache<Integer, DbValue> cache = ig.cache(DEFAULT_CACHE_NAME);
 
-        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache();
+        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache(DEFAULT_CACHE_NAME);
 
         int cnt = 100_000;
 
@@ -814,7 +814,7 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void _testRandomPutGetRemove() {
         IgniteEx ig = grid(0);
 
-        final IgniteCache<Integer, DbValue> cache = ig.cache(null);
+        final IgniteCache<Integer, DbValue> cache = ig.cache(DEFAULT_CACHE_NAME);
 
         int cnt = 100_000;
 
@@ -865,9 +865,9 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void testPutGetRemoveMultipleBackward() throws Exception {
         IgniteEx ig = grid(0);
 
-        final IgniteCache<Integer, DbValue> cache = ig.cache(null);
+        final IgniteCache<Integer, DbValue> cache = ig.cache(DEFAULT_CACHE_NAME);
 
-        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache();
+        GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache(DEFAULT_CACHE_NAME);
 
         int cnt = 100_000;
 
@@ -911,7 +911,7 @@ public abstract class IgniteDbPutGetAbstractTest extends IgniteDbAbstractTest {
     public void testIndexOverwrite() throws Exception {
         IgniteEx ig = grid(0);
 
-        final IgniteCache<Integer, DbValue> cache = ig.cache(null);
+        final IgniteCache<Integer, DbValue> cache = ig.cache(DEFAULT_CACHE_NAME);
 
         GridCacheAdapter<Object, Object> internalCache = ig.context().cache().internalCache("non-primitive");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
index ec2aa61..ec5e6d0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamProcessorSelfTest.java
@@ -217,7 +217,7 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
 
             Ignite igniteWithoutCache = startGrid(1);
 
-            final IgniteDataStreamer<Integer, Integer> ldr = igniteWithoutCache.dataStreamer(null);
+            final IgniteDataStreamer<Integer, Integer> ldr = igniteWithoutCache.dataStreamer(DEFAULT_CACHE_NAME);
 
             ldr.receiver(DataStreamerCacheUpdaters.<Integer, Integer>batchedSorted());
 
@@ -253,13 +253,13 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
 
             f1.get();
 
-            int s2 = grid(2).cache(null).localSize(CachePeekMode.PRIMARY);
-            int s3 = grid(3).cache(null).localSize(CachePeekMode.PRIMARY);
+            int s2 = grid(2).cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.PRIMARY);
+            int s3 = grid(3).cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.PRIMARY);
             int total = threads * cnt;
 
             assertEquals(total, s2 + s3);
 
-            final IgniteDataStreamer<Integer, Integer> rmvLdr = igniteWithCache.dataStreamer(null);
+            final IgniteDataStreamer<Integer, Integer> rmvLdr = igniteWithCache.dataStreamer(DEFAULT_CACHE_NAME);
 
             rmvLdr.receiver(DataStreamerCacheUpdaters.<Integer, Integer>batchedSorted());
 
@@ -290,8 +290,8 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
 
             f2.get();
 
-            s2 = grid(2).cache(null).localSize(CachePeekMode.PRIMARY);
-            s3 = grid(3).cache(null).localSize(CachePeekMode.PRIMARY);
+            s2 = grid(2).cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.PRIMARY);
+            s3 = grid(3).cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.PRIMARY);
 
             assert s2 == 0 && s3 == 0 : "Incorrect entries count [s2=" + s2 + ", s3=" + s3 + ']';
         }
@@ -331,7 +331,7 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
 
             awaitPartitionMapExchange();
 
-            IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+            IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < 100; i++)
                 cache.put(i, -1);
@@ -339,7 +339,7 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
             final int cnt = 40_000;
             final int threads = 10;
 
-            try (final IgniteDataStreamer<Integer, Integer> ldr = g1.dataStreamer(null)) {
+            try (final IgniteDataStreamer<Integer, Integer> ldr = g1.dataStreamer(DEFAULT_CACHE_NAME)) {
                 final AtomicInteger idxGen = new AtomicInteger();
 
                 IgniteInternalFuture<?> f1 = multithreadedAsync(new Callable<Object>() {
@@ -360,7 +360,7 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
             for (int g = 0; g < 3; g++) {
                 ClusterNode locNode = grid(g).localNode();
 
-                GridCacheAdapter<Integer, Integer> cache0 = ((IgniteKernal)grid(g)).internalCache(null);
+                GridCacheAdapter<Integer, Integer> cache0 = ((IgniteKernal)grid(g)).internalCache(DEFAULT_CACHE_NAME);
 
                 if (cache0.isNear())
                     cache0 = ((GridNearCacheAdapter<Integer, Integer>)cache0).dht();
@@ -402,7 +402,7 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
                 new byte[] {1}, new boolean[] {true, false}, new char[] {2, 3}, new short[] {3, 4},
                 new int[] {4, 5}, new long[] {5, 6}, new float[] {6, 7}, new double[] {7, 8});
 
-            IgniteDataStreamer<Object, Object> dataLdr = g1.dataStreamer(null);
+            IgniteDataStreamer<Object, Object> dataLdr = g1.dataStreamer(DEFAULT_CACHE_NAME);
 
             for (int i = 0, size = arrays.size(); i < 1000; i++) {
                 Object arr = arrays.get(i % size);
@@ -462,7 +462,7 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
             Ignite g1 = grid(idx - 1);
 
             // Get and configure loader.
-            final IgniteDataStreamer<Integer, Integer> ldr = g1.dataStreamer(null);
+            final IgniteDataStreamer<Integer, Integer> ldr = g1.dataStreamer(DEFAULT_CACHE_NAME);
 
             ldr.receiver(DataStreamerCacheUpdaters.<Integer, Integer>individual());
             ldr.perNodeBufferSize(2);
@@ -564,7 +564,7 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
         try {
             Ignite g1 = startGrid(1);
 
-            IgniteDataStreamer<Object, Object> ldr = g1.dataStreamer(null);
+            IgniteDataStreamer<Object, Object> ldr = g1.dataStreamer(DEFAULT_CACHE_NAME);
 
             ldr.close(false);
 
@@ -598,7 +598,7 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
             ldr.future().get();
 
             // Create another loader.
-            ldr = g1.dataStreamer(null);
+            ldr = g1.dataStreamer(DEFAULT_CACHE_NAME);
 
             // Cancel with future.
             ldr.future().cancel();
@@ -624,7 +624,7 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
             }
 
             // Create another loader.
-            ldr = g1.dataStreamer(null);
+            ldr = g1.dataStreamer(DEFAULT_CACHE_NAME);
 
             // This will close loader.
             stopGrid(getTestIgniteInstanceName(1), false);
@@ -720,9 +720,9 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
         try {
             Ignite g = startGrid();
 
-            final IgniteCache<Integer, Integer> c = g.cache(null);
+            final IgniteCache<Integer, Integer> c = g.cache(DEFAULT_CACHE_NAME);
 
-            final IgniteDataStreamer<Integer, Integer> ldr = g.dataStreamer(null);
+            final IgniteDataStreamer<Integer, Integer> ldr = g.dataStreamer(DEFAULT_CACHE_NAME);
 
             ldr.perNodeBufferSize(10);
 
@@ -772,9 +772,9 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
         try {
             Ignite g = startGrid();
 
-            IgniteCache<Integer, Integer> c = g.cache(null);
+            IgniteCache<Integer, Integer> c = g.cache(DEFAULT_CACHE_NAME);
 
-            IgniteDataStreamer<Integer, Integer> ldr = g.dataStreamer(null);
+            IgniteDataStreamer<Integer, Integer> ldr = g.dataStreamer(DEFAULT_CACHE_NAME);
 
             ldr.perNodeBufferSize(10);
 
@@ -817,11 +817,11 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
                 }
             }, EVT_CACHE_OBJECT_PUT);
 
-            IgniteCache<Integer, Integer> c = g.cache(null);
+            IgniteCache<Integer, Integer> c = g.cache(DEFAULT_CACHE_NAME);
 
             assertTrue(c.localSize() == 0);
 
-            IgniteDataStreamer<Integer, Integer> ldr = g.dataStreamer(null);
+            IgniteDataStreamer<Integer, Integer> ldr = g.dataStreamer(DEFAULT_CACHE_NAME);
 
             ldr.perNodeBufferSize(10);
             ldr.autoFlushFrequency(3000);
@@ -866,7 +866,7 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
             for (int i = 0; i < 1000; i++)
                 storeMap.put(i, i);
 
-            try (IgniteDataStreamer<Object, Object> ldr = ignite.dataStreamer(null)) {
+            try (IgniteDataStreamer<Object, Object> ldr = ignite.dataStreamer(DEFAULT_CACHE_NAME)) {
                 ldr.allowOverwrite(true);
 
                 assertFalse(ldr.skipStore());
@@ -884,7 +884,7 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
             for (int i = 1000; i < 2000; i++)
                 assertEquals(i, storeMap.get(i));
 
-            try (IgniteDataStreamer<Object, Object> ldr = ignite.dataStreamer(null)) {
+            try (IgniteDataStreamer<Object, Object> ldr = ignite.dataStreamer(DEFAULT_CACHE_NAME)) {
                 ldr.allowOverwrite(true);
 
                 ldr.skipStore(true);
@@ -896,7 +896,7 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
                     ldr.removeData(i);
             }
 
-            IgniteCache<Object, Object> cache = ignite.cache(null);
+            IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < 1000; i++) {
                 assertNull(storeMap.get(i));
@@ -927,7 +927,7 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
             startGrid(2);
             startGrid(3);
 
-            try (IgniteDataStreamer<String, TestObject> ldr = ignite.dataStreamer(null)) {
+            try (IgniteDataStreamer<String, TestObject> ldr = ignite.dataStreamer(DEFAULT_CACHE_NAME)) {
                 ldr.allowOverwrite(true);
                 ldr.keepBinary(customKeepBinary());
 
@@ -937,7 +937,7 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
                     ldr.addData(String.valueOf(i), new TestObject(i));
             }
 
-            IgniteCache<String, TestObject> cache = ignite.cache(null);
+            IgniteCache<String, TestObject> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < 100; i++) {
                 TestObject val = cache.get(String.valueOf(i));
@@ -960,9 +960,9 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
 
             Ignite ignite = startGrid(1);
 
-            final IgniteCache<String, String> cache = ignite.cache(null);
+            final IgniteCache<String, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
-            IgniteDataStreamer<String, String> ldr = ignite.dataStreamer(null);
+            IgniteDataStreamer<String, String> ldr = ignite.dataStreamer(DEFAULT_CACHE_NAME);
             try {
                 ldr.receiver(new StreamReceiver<String, String>() {
                     @Override public void receive(IgniteCache<String, String> cache,
@@ -1009,9 +1009,9 @@ public class DataStreamProcessorSelfTest extends GridCommonAbstractTest {
 
             Ignite client = startGrid(0);
 
-            final IgniteCache<String, String> cache = ignite.cache(null);
+            final IgniteCache<String, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
-            IgniteDataStreamer<String, String> ldr = client.dataStreamer(null);
+            IgniteDataStreamer<String, String> ldr = client.dataStreamer(DEFAULT_CACHE_NAME);
 
             try {
                 ldr.receiver(new StringStringStreamReceiver());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
index ca8b192..6d10312 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerImplSelfTest.java
@@ -101,7 +101,7 @@ public class DataStreamerImplSelfTest extends GridCommonAbstractTest {
 
         Ignite g4 = grid(4);
 
-        IgniteDataStreamer<Object, Object> dataLdr = g4.dataStreamer(null);
+        IgniteDataStreamer<Object, Object> dataLdr = g4.dataStreamer(DEFAULT_CACHE_NAME);
 
         dataLdr.perNodeBufferSize(32);
 
@@ -136,7 +136,7 @@ public class DataStreamerImplSelfTest extends GridCommonAbstractTest {
 
         Ignite g0 = grid(0);
 
-        IgniteDataStreamer<Integer, String> dataLdr = g0.dataStreamer(null);
+        IgniteDataStreamer<Integer, String> dataLdr = g0.dataStreamer(DEFAULT_CACHE_NAME);
 
         Map<Integer, String> map = U.newHashMap(KEYS_COUNT);
 
@@ -149,7 +149,7 @@ public class DataStreamerImplSelfTest extends GridCommonAbstractTest {
 
         Random rnd = new Random();
 
-        IgniteCache<Integer, String> c = g0.cache(null);
+        IgniteCache<Integer, String> c = g0.cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < KEYS_COUNT; i++) {
             Integer k = rnd.nextInt(KEYS_COUNT);
@@ -175,7 +175,7 @@ public class DataStreamerImplSelfTest extends GridCommonAbstractTest {
         try {
             Ignite ignite = startGrid(1);
 
-            try (IgniteDataStreamer<Integer, String> streamer = ignite.dataStreamer(null)) {
+            try (IgniteDataStreamer<Integer, String> streamer = ignite.dataStreamer(DEFAULT_CACHE_NAME)) {
                 streamer.addData(1, "1");
             }
             catch (CacheException ignored) {
@@ -206,7 +206,7 @@ public class DataStreamerImplSelfTest extends GridCommonAbstractTest {
 
             IgniteFuture fut = null;
 
-            try (IgniteDataStreamer<Integer, String> streamer = ignite.dataStreamer(null)) {
+            try (IgniteDataStreamer<Integer, String> streamer = ignite.dataStreamer(DEFAULT_CACHE_NAME)) {
                 fut = streamer.addData(1, "1");
 
                 streamer.flush();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultiThreadedSelfTest.java
index b4427ef..6d7b367 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultiThreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerMultiThreadedSelfTest.java
@@ -124,7 +124,7 @@ public class DataStreamerMultiThreadedSelfTest extends GridCommonAbstractTest {
             if (dynamicCache)
                 ignite.getOrCreateCache(cacheConfiguration());
 
-            try (final DataStreamerImpl dataLdr = (DataStreamerImpl)ignite.dataStreamer(null)) {
+            try (final DataStreamerImpl dataLdr = (DataStreamerImpl)ignite.dataStreamer(DEFAULT_CACHE_NAME)) {
                 Random rnd = new Random();
 
                 long endTime = U.currentTimeMillis() + 15_000;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateAfterLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateAfterLoadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateAfterLoadTest.java
index a5a7155..6df4ec9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateAfterLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/DataStreamerUpdateAfterLoadTest.java
@@ -29,6 +29,7 @@ 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 org.jetbrains.annotations.NotNull;
 
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
 
@@ -161,8 +162,8 @@ public class DataStreamerUpdateAfterLoadTest extends GridCommonAbstractTest {
      */
     private CacheConfiguration<Integer, Integer> cacheConfiguration(CacheAtomicityMode atomicityMode,
         int backups,
-        String name) {
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        @NotNull String name) {
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setName(name);
         ccfg.setAtomicityMode(atomicityMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/IgniteDataStreamerPerformanceTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/IgniteDataStreamerPerformanceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/IgniteDataStreamerPerformanceTest.java
index 5c86bba..e5f5011 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/IgniteDataStreamerPerformanceTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/datastreamer/IgniteDataStreamerPerformanceTest.java
@@ -137,7 +137,7 @@ public class IgniteDataStreamerPerformanceTest extends GridCommonAbstractTest {
 
             Ignite ignite = startGrid();
 
-            final IgniteDataStreamer<Integer, String> ldr = ignite.dataStreamer(null);
+            final IgniteDataStreamer<Integer, String> ldr = ignite.dataStreamer(DEFAULT_CACHE_NAME);
 
             ldr.perNodeBufferSize(8192);
             ldr.receiver(DataStreamerCacheUpdaters.<Integer, String>batchedSorted());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBlockMessageSystemPoolStarvationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBlockMessageSystemPoolStarvationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBlockMessageSystemPoolStarvationSelfTest.java
index e6bdc8e..9012e0e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBlockMessageSystemPoolStarvationSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsBlockMessageSystemPoolStarvationSelfTest.java
@@ -223,7 +223,7 @@ public class IgfsBlockMessageSystemPoolStarvationSelfTest extends IgfsCommonAbst
      */
     private IgniteConfiguration config(String name, TcpDiscoveryVmIpFinder ipFinder) throws Exception {
         // Data cache configuration.
-        CacheConfiguration dataCcfg = new CacheConfiguration();
+        CacheConfiguration dataCcfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         dataCcfg.setCacheMode(CacheMode.REPLICATED);
         dataCcfg.setAtomicityMode(TRANSACTIONAL);
@@ -232,7 +232,7 @@ public class IgfsBlockMessageSystemPoolStarvationSelfTest extends IgfsCommonAbst
         dataCcfg.setMaxConcurrentAsyncOperations(1);
 
         // Meta cache configuration.
-        CacheConfiguration metaCcfg = new CacheConfiguration();
+        CacheConfiguration metaCcfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         metaCcfg.setCacheMode(CacheMode.REPLICATED);
         metaCcfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCacheSelfTest.java
index 96820ea..af9d285 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsCacheSelfTest.java
@@ -32,6 +32,7 @@ import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
+import org.jetbrains.annotations.NotNull;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -68,7 +69,7 @@ public class IgfsCacheSelfTest extends IgfsCommonAbstractTest {
     }
 
     /** {@inheritDoc} */
-    protected CacheConfiguration cacheConfiguration(String cacheName) {
+    protected CacheConfiguration cacheConfiguration(@NotNull String cacheName) {
         CacheConfiguration cacheCfg = defaultCacheConfiguration();
 
         cacheCfg.setName(cacheName);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java
index f12590a..774af03 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDataManagerSelfTest.java
@@ -36,6 +36,7 @@ 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.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.nio.ByteBuffer;
@@ -109,7 +110,7 @@ public class IgfsDataManagerSelfTest extends IgfsCommonAbstractTest {
     }
 
     /** {@inheritDoc} */
-    protected CacheConfiguration cacheConfiguration(String cacheName) {
+    protected CacheConfiguration cacheConfiguration(@NotNull String cacheName) {
         CacheConfiguration cacheCfg = defaultCacheConfiguration();
 
         cacheCfg.setName(cacheName);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java
index e4faa41..ecba1bf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsIgniteMock.java
@@ -98,13 +98,6 @@ public class IgfsIgniteMock implements IgniteEx {
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public <K, V> IgniteInternalCache<K, V> cachex() {
-        throwUnsupported();
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public Collection<IgniteInternalCache<?, ?>> cachesx(
         @Nullable IgnitePredicate<? super IgniteInternalCache<?, ?>>... p) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
index f77c1d1..b018088 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManagerSelfTest.java
@@ -30,6 +30,7 @@ import org.apache.ignite.lang.IgniteUuid;
 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.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.util.Arrays;
@@ -94,7 +95,7 @@ public class IgfsMetaManagerSelfTest extends IgfsCommonAbstractTest {
     }
 
     /** {@inheritDoc} */
-    protected CacheConfiguration cacheConfiguration(String cacheName) {
+    protected CacheConfiguration cacheConfiguration(@NotNull String cacheName) {
         CacheConfiguration cacheCfg = defaultCacheConfiguration();
 
         cacheCfg.setName(cacheName);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsOneClientNodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsOneClientNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsOneClientNodeTest.java
index 58fb71b..a55f607 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsOneClientNodeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsOneClientNodeTest.java
@@ -29,6 +29,7 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
 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.jetbrains.annotations.NotNull;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -55,8 +56,8 @@ public class IgfsOneClientNodeTest extends GridCommonAbstractTest {
         FileSystemConfiguration igfsCfg = new FileSystemConfiguration();
 
         igfsCfg.setName("igfs");
-        igfsCfg.setMetaCacheConfiguration(cacheConfiguration(null));
-        igfsCfg.setDataCacheConfiguration(cacheConfiguration(null));
+        igfsCfg.setMetaCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME));
+        igfsCfg.setDataCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME));
 
         cfg.setFileSystemConfiguration(igfsCfg);
 
@@ -64,7 +65,7 @@ public class IgfsOneClientNodeTest extends GridCommonAbstractTest {
     }
 
     /** {@inheritDoc} */
-    protected CacheConfiguration cacheConfiguration(String cacheName) {
+    protected CacheConfiguration cacheConfiguration(@NotNull String cacheName) {
         CacheConfiguration cacheCfg = defaultCacheConfiguration();
 
         cacheCfg.setName(cacheName);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
index 25f425b..6d69cbe 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsProcessorSelfTest.java
@@ -44,6 +44,7 @@ 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.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import javax.cache.Cache;
@@ -137,7 +138,7 @@ public class IgfsProcessorSelfTest extends IgfsCommonAbstractTest {
     }
 
     /** {@inheritDoc} */
-    protected CacheConfiguration cacheConfiguration(String cacheName) {
+    protected CacheConfiguration cacheConfiguration(@NotNull String cacheName) {
         CacheConfiguration cacheCfg = defaultCacheConfiguration();
 
         cacheCfg.setName(cacheName);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStartCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStartCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStartCacheTest.java
index a04f5c3..46fdae5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStartCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStartCacheTest.java
@@ -72,14 +72,14 @@ public class IgfsStartCacheTest extends IgfsCommonAbstractTest {
             igfsCfg.setDefaultMode(PRIMARY);
             igfsCfg.setFragmentizerEnabled(false);
 
-            CacheConfiguration dataCacheCfg = new CacheConfiguration();
+            CacheConfiguration dataCacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             dataCacheCfg.setCacheMode(PARTITIONED);
             dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
             dataCacheCfg.setWriteSynchronizationMode(FULL_SYNC);
             dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(1));
 
-            CacheConfiguration metaCacheCfg = new CacheConfiguration();
+            CacheConfiguration metaCacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             metaCacheCfg.setCacheMode(REPLICATED);
             metaCacheCfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
index 0e749f3..d77296a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsStreamsSelfTest.java
@@ -39,6 +39,7 @@ 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.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import java.io.IOException;
@@ -138,7 +139,7 @@ public class IgfsStreamsSelfTest extends IgfsCommonAbstractTest {
     }
 
     /** {@inheritDoc} */
-    protected CacheConfiguration cacheConfiguration(String cacheName) {
+    protected CacheConfiguration cacheConfiguration(@NotNull String cacheName) {
         CacheConfiguration cacheCfg = defaultCacheConfiguration();
 
         cacheCfg.setName(cacheName);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java
index fcc8fd7..13163d8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsTaskSelfTest.java
@@ -117,7 +117,7 @@ public class IgfsTaskSelfTest extends IgfsCommonAbstractTest {
         igfsCfg.setDefaultMode(PRIMARY);
         igfsCfg.setFragmentizerEnabled(false);
 
-        CacheConfiguration dataCacheCfg = new CacheConfiguration();
+        CacheConfiguration dataCacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         dataCacheCfg.setCacheMode(PARTITIONED);
         dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
@@ -125,7 +125,7 @@ public class IgfsTaskSelfTest extends IgfsCommonAbstractTest {
         dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(1));
         dataCacheCfg.setBackups(0);
 
-        CacheConfiguration metaCacheCfg = new CacheConfiguration();
+        CacheConfiguration metaCacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         metaCacheCfg.setCacheMode(REPLICATED);
         metaCacheCfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/split/IgfsAbstractRecordResolverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/split/IgfsAbstractRecordResolverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/split/IgfsAbstractRecordResolverSelfTest.java
index bd3d7a0..c929909 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/split/IgfsAbstractRecordResolverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/split/IgfsAbstractRecordResolverSelfTest.java
@@ -62,7 +62,7 @@ public class IgfsAbstractRecordResolverSelfTest extends GridCommonAbstractTest {
         igfsCfg.setBlockSize(512);
         igfsCfg.setDefaultMode(PRIMARY);
 
-        CacheConfiguration dataCacheCfg = new CacheConfiguration();
+        CacheConfiguration dataCacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         dataCacheCfg.setCacheMode(PARTITIONED);
         dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
@@ -71,7 +71,7 @@ public class IgfsAbstractRecordResolverSelfTest extends GridCommonAbstractTest {
         dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128));
         dataCacheCfg.setBackups(0);
 
-        CacheConfiguration metaCacheCfg = new CacheConfiguration();
+        CacheConfiguration metaCacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         metaCacheCfg.setCacheMode(REPLICATED);
         metaCacheCfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java
index c26376e..a5718b8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java
@@ -107,6 +107,8 @@ public class GridCacheCommandHandlerSelfTest extends GridCommonAbstractTest {
 
         GridRestCacheRequest req = new GridRestCacheRequest();
 
+        req.cacheName(DEFAULT_CACHE_NAME);
+
         req.command(GridRestCommand.CACHE_GET);
 
         req.key("k1");
@@ -185,6 +187,8 @@ public class GridCacheCommandHandlerSelfTest extends GridCommonAbstractTest {
 
         GridRestCacheRequest req = new GridRestCacheRequest();
 
+        req.cacheName(DEFAULT_CACHE_NAME);
+
         req.command(append ? GridRestCommand.CACHE_APPEND : GridRestCommand.CACHE_PREPEND);
 
         req.key(key);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/query/GridQueryCommandHandlerTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/query/GridQueryCommandHandlerTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/query/GridQueryCommandHandlerTest.java
index 7e4cd82..130899f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/query/GridQueryCommandHandlerTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/query/GridQueryCommandHandlerTest.java
@@ -114,7 +114,7 @@ public class GridQueryCommandHandlerTest extends GridCommonAbstractTest {
         IgniteInternalFuture<GridRestResponse> resp = cmdHnd.handleAsync(req);
         resp.get();
 
-        assertEquals("Failed to find cache with name: null", resp.result().getError());
+        assertEquals("Ouch! Argument is invalid: Cache name must not be null or empty.", resp.result().getError());
         assertEquals(GridRestResponse.STATUS_FAILED, resp.result().getSuccessStatus());
         assertNull(resp.result().getResponse());
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorAbstractSelfTest.java
index fafd24e..db07cde 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/GridServiceProcessorAbstractSelfTest.java
@@ -77,7 +77,7 @@ public abstract class GridServiceProcessorAbstractSelfTest extends GridCommonAbs
         if (svcs != null)
             c.setServiceConfiguration(svcs);
 
-        CacheConfiguration cc = new CacheConfiguration();
+        CacheConfiguration cc = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cc.setName(CACHE_NAME);
         cc.setCacheMode(CacheMode.PARTITIONED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/service/ServicePredicateAccessCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/ServicePredicateAccessCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/ServicePredicateAccessCacheTest.java
index 189d7a4..389cbba 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/service/ServicePredicateAccessCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/service/ServicePredicateAccessCacheTest.java
@@ -82,7 +82,7 @@ public class ServicePredicateAccessCacheTest extends GridCommonAbstractTest {
     public void testPredicateAccessCache() throws Exception {
         final Ignite ignite0 = startGrid(0);
 
-        ignite0.getOrCreateCache(new CacheConfiguration<String, Object>()
+        ignite0.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME)
             .setName("testCache")
             .setAtomicityMode(ATOMIC)
             .setCacheMode(REPLICATED)

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java
index f111864..8c351d7 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java
@@ -58,6 +58,9 @@ import org.springframework.context.support.FileSystemXmlApplicationContext;
  * Common stuff for cache load tests.
  */
 abstract class GridCacheAbstractLoadTest {
+    /** */
+    protected static final String DEFAULT_CACHE_NAME = "test-cache";
+
     /** Random. */
     protected static final Random RAND = new Random();
 
@@ -146,7 +149,7 @@ abstract class GridCacheAbstractLoadTest {
 
         final Ignite ignite = G.ignite();
 
-        final IgniteCache<Integer, Integer> cache = ignite.cache(null);
+        final IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         assert cache != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheDataStructuresLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheDataStructuresLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheDataStructuresLoadTest.java
index 18537c5..745828e 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheDataStructuresLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheDataStructuresLoadTest.java
@@ -484,7 +484,7 @@ public final class GridCacheDataStructuresLoadTest extends GridCacheAbstractLoad
 
         final Ignite ignite = G.ignite();
 
-        final IgniteCache<Integer, Integer> cache = ignite.cache(null);
+        final IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         assert cache != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheLoadTest.java
index 5d3f5f3..6bd3b7a 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheLoadTest.java
@@ -102,7 +102,7 @@ public final class GridCacheLoadTest extends GridCacheAbstractLoadTest {
     private void memoryTest() {
         Ignite ignite = G.ignite();
 
-        final IgniteCache<Integer, byte[]> cache = ignite.cache(null);
+        final IgniteCache<Integer, byte[]> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         assert cache != null;
 
@@ -152,7 +152,7 @@ public final class GridCacheLoadTest extends GridCacheAbstractLoadTest {
             if (LOAD)
                 test.loadTest(test.writeClos, test.readClos);
 
-            G.ignite().cache(null).clear();
+            G.ignite().cache(DEFAULT_CACHE_NAME).clear();
 
             System.gc();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/loadtests/capacity/GridCapacityLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/capacity/GridCapacityLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/capacity/GridCapacityLoadTest.java
index 538ab06..9da3ecf 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/capacity/GridCapacityLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/capacity/GridCapacityLoadTest.java
@@ -48,7 +48,7 @@ public class GridCapacityLoadTest {
         IgniteConfiguration cfg = (IgniteConfiguration)ctx.getBean("grid.cfg");
 
         try (Ignite g = G.start(cfg)) {
-            IgniteCache<Integer, Integer> c = g.cache(null);
+            IgniteCache<Integer, Integer> c = g.cache("test-cache");
 
             long init = mem.getHeapMemoryUsage().getUsed();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/loadtests/capacity/spring-capacity-cache.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/capacity/spring-capacity-cache.xml b/modules/core/src/test/java/org/apache/ignite/loadtests/capacity/spring-capacity-cache.xml
index 5519d0e..d52c91b 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/capacity/spring-capacity-cache.xml
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/capacity/spring-capacity-cache.xml
@@ -57,6 +57,8 @@
                     Partitioned cache example configuration.
                 -->
                 <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="test-cache"/>
+
                     <property name="cacheMode" value="PARTITIONED"/>
 
                     <!-- Initial cache size. -->

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/loadtests/continuous/GridContinuousOperationsLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/continuous/GridContinuousOperationsLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/continuous/GridContinuousOperationsLoadTest.java
index 84258b9..74150d7 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/continuous/GridContinuousOperationsLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/continuous/GridContinuousOperationsLoadTest.java
@@ -102,7 +102,7 @@ public class GridContinuousOperationsLoadTest {
 
             // Continuous query manager, used to monitor queue size.
             final CacheContinuousQueryManager contQryMgr =
-                ((IgniteKernal)ignite).context().cache().cache().context().continuousQueries();
+                ((IgniteKernal)ignite).context().cache().cache(cacheName).context().continuousQueries();
 
             if (contQryMgr == null)
                 throw new IgniteCheckedException("Could not access CacheContinuousQueryManager");

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/loadtests/datastructures/GridCachePartitionedAtomicLongLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/datastructures/GridCachePartitionedAtomicLongLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/datastructures/GridCachePartitionedAtomicLongLoadTest.java
index c5cea67..2ac615a 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/datastructures/GridCachePartitionedAtomicLongLoadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/datastructures/GridCachePartitionedAtomicLongLoadTest.java
@@ -116,7 +116,7 @@ public class GridCachePartitionedAtomicLongLoadTest extends GridCommonAbstractTe
         @Override public Boolean call() throws Exception {
             Ignite ignite = grid();
 
-            IgniteCache cache = ignite.cache(null);
+            IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             assert cache != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/loadtests/discovery/GridGcTimeoutTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/discovery/GridGcTimeoutTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/discovery/GridGcTimeoutTest.java
index e7d8456..4351dae 100644
--- a/modules/core/src/test/java/org/apache/ignite/loadtests/discovery/GridGcTimeoutTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/loadtests/discovery/GridGcTimeoutTest.java
@@ -41,7 +41,7 @@ public class GridGcTimeoutTest {
     public static void main(String[] args) {
         Ignite g = G.start(U.resolveIgniteUrl(CFG_PATH));
 
-        IgniteDataStreamer<Long, String> ldr = g.dataStreamer(null);
+        IgniteDataStreamer<Long, String> ldr = g.dataStreamer("default");
 
         ldr.perNodeBufferSize(16 * 1024);
 


[50/51] [abbrv] ignite git commit: IGNITE-4799 Missing change after merge.

Posted by sb...@apache.org.
IGNITE-4799 Missing change after merge.


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

Branch: refs/heads/ignite-5075-cacheStart
Commit: 4d260619b1ad90469b5dac7b24ff413847522fa6
Parents: 96f5cf5
Author: Alexey Kuznetsov <ak...@gridgain.com>
Authored: Wed Apr 26 23:50:39 2017 +0700
Committer: Alexey Kuznetsov <ak...@gridgain.com>
Committed: Wed Apr 26 23:50:39 2017 +0700

----------------------------------------------------------------------
 .../internal/visor/node/VisorBasicConfiguration.java   | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4d260619/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java
index a70cfdd..0a3a8ea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorBasicConfiguration.java
@@ -113,6 +113,9 @@ public class VisorBasicConfiguration extends VisorDataTransferObject {
     /** Whether update checker is enabled. */
     private boolean updateNtf;
 
+    /** Full metrics enabled flag. */
+    private long metricsUpdateFreq;
+
     /**
      * Default constructor.
      */
@@ -148,6 +151,7 @@ public class VisorBasicConfiguration extends VisorDataTransferObject {
         quiet = boolValue(IGNITE_QUIET, true);
         successFile = getProperty(IGNITE_SUCCESS_FILE);
         updateNtf = boolValue(IGNITE_UPDATE_NOTIFIER, true);
+        metricsUpdateFreq = c.getMetricsUpdateFrequency();
     }
 
     /**
@@ -297,6 +301,13 @@ public class VisorBasicConfiguration extends VisorDataTransferObject {
         return updateNtf;
     }
 
+    /**
+     * @return Job metrics update frequency in milliseconds.
+     */
+    public long getMetricsUpdateFrequency() {
+        return metricsUpdateFreq;
+    }
+
     /** {@inheritDoc} */
     @Override protected void writeExternalData(ObjectOutput out) throws IOException {
         U.writeString(out, igniteInstanceName);
@@ -320,6 +331,7 @@ public class VisorBasicConfiguration extends VisorDataTransferObject {
         out.writeBoolean(quiet);
         U.writeString(out, successFile);
         out.writeBoolean(updateNtf);
+        out.writeLong(metricsUpdateFreq);
     }
 
     /** {@inheritDoc} */
@@ -345,6 +357,7 @@ public class VisorBasicConfiguration extends VisorDataTransferObject {
         quiet = in.readBoolean();
         successFile = U.readString(in);
         updateNtf = in.readBoolean();
+        metricsUpdateFreq = in.readLong();
     }
 
     /** {@inheritDoc} */


[09/51] [abbrv] ignite git commit: ignite-1794 Refactored hibernate modules, switched to hibernate 5.1

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadWriteAccessStrategy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadWriteAccessStrategy.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadWriteAccessStrategy.java
new file mode 100644
index 0000000..491553d
--- /dev/null
+++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadWriteAccessStrategy.java
@@ -0,0 +1,326 @@
+/*
+ * 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.cache.hibernate;
+
+import java.util.Set;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
+import org.apache.ignite.internal.util.GridLeanSet;
+
+import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
+
+/**
+ * Implementation of READ_WRITE cache access strategy.
+ * <p>
+ * Configuration of L2 cache and per-entity cache access strategy can be set in the
+ * Hibernate configuration file:
+ * <pre name="code" class="xml">
+ * &lt;hibernate-configuration&gt;
+ *     &lt;!-- Enable L2 cache. --&gt;
+ *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
+ *
+ *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
+ *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
+ *
+ *     &lt;!-- Specify entity. --&gt;
+ *     &lt;mapping class="com.example.Entity"/&gt;
+ *
+ *     &lt;!-- Enable L2 cache with read-write access strategy for entity. --&gt;
+ *     &lt;class-cache class="com.example.Entity" usage="read-write"/&gt;
+ * &lt;/hibernate-configuration&gt;
+ * </pre>
+ * Also cache access strategy can be set using annotations:
+ * <pre name="code" class="java">
+ * &#064;javax.persistence.Entity
+ * &#064;javax.persistence.Cacheable
+ * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
+ * public class Entity { ... }
+ * </pre>
+ */
+public class HibernateReadWriteAccessStrategy extends HibernateAccessStrategyAdapter {
+    /** */
+    private final ThreadLocal<TxContext> txCtx;
+
+    /**
+     * @param ignite Grid.
+     * @param cache Cache.
+     * @param txCtx Thread local instance used to track updates done during one Hibernate transaction.
+     * @param eConverter Exception converter.
+     */
+    protected HibernateReadWriteAccessStrategy(Ignite ignite,
+        HibernateCacheProxy cache,
+        ThreadLocal txCtx,
+        HibernateExceptionConverter eConverter) {
+        super(ignite, cache, eConverter);
+
+        this.txCtx = (ThreadLocal<TxContext>)txCtx;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Object get(Object key) {
+        boolean success = false;
+
+        try {
+            Object o = cache.get(key);
+
+            success = true;
+
+            return o;
+        }
+        catch (IgniteCheckedException e) {
+            throw convertException(e);
+        }
+        finally {
+            if (!success)
+                rollbackCurrentTx();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void putFromLoad(Object key, Object val) {
+        boolean success = false;
+
+        try {
+            cache.put(key, val);
+
+            success = true;
+        }
+        catch (IgniteCheckedException e) {
+            throw convertException(e);
+        }
+        finally {
+            if (!success)
+                rollbackCurrentTx();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void lock(Object key) {
+        boolean success = false;
+
+        try {
+            TxContext ctx = txCtx.get();
+
+            if (ctx == null)
+                txCtx.set(ctx = new TxContext());
+
+            lockKey(key);
+
+            ctx.locked(key);
+
+            success = true;
+        }
+        catch (IgniteCheckedException e) {
+            throw convertException(e);
+        }
+        finally {
+            if (!success)
+                rollbackCurrentTx();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void unlock(Object key) {
+        boolean success = false;
+
+        try {
+            TxContext ctx = txCtx.get();
+
+            if (ctx != null)
+                unlock(ctx, key);
+
+            success = true;
+        }
+        catch (Exception e) {
+            throw convertException(e);
+        }
+        finally {
+            if (!success)
+                rollbackCurrentTx();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean update(Object key, Object val) {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean afterUpdate(Object key, Object val) {
+        boolean success = false;
+        boolean res = false;
+
+        try {
+            TxContext ctx = txCtx.get();
+
+            if (ctx != null) {
+                cache.put(key, val);
+
+                unlock(ctx, key);
+
+                res = true;
+            }
+
+            success = true;
+
+            return res;
+        }
+        catch (Exception e) {
+            throw convertException(e);
+        }
+        finally {
+            if (!success)
+                rollbackCurrentTx();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean insert(Object key, Object val) {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean afterInsert(Object key, Object val) {
+        boolean success = false;
+
+        try {
+            cache.put(key, val);
+
+            success = true;
+
+            return true;
+        }
+        catch (IgniteCheckedException e) {
+            throw convertException(e);
+        }
+        finally {
+            if (!success)
+                rollbackCurrentTx();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void remove(Object key) {
+        boolean success = false;
+
+        try {
+            TxContext ctx = txCtx.get();
+
+            if (ctx != null)
+                cache.remove(key);
+
+            success = true;
+        }
+        catch (IgniteCheckedException e) {
+            throw convertException(e);
+        }
+        finally {
+            if (!success)
+                rollbackCurrentTx();
+        }
+    }
+
+    /**
+     *
+     * @param ctx Transaction context.
+     * @param key Key.
+     */
+    private void unlock(TxContext ctx, Object key) {
+        if (ctx.unlocked(key)) { // Finish transaction if last key is unlocked.
+            txCtx.remove();
+
+            GridNearTxLocal tx = cache.tx();
+
+            assert tx != null;
+
+            try {
+                tx.proxy().commit();
+            }
+            finally {
+                tx.proxy().close();
+            }
+
+            assert cache.tx() == null;
+        }
+    }
+
+    /**
+     * Roll backs current transaction.
+     */
+    private void rollbackCurrentTx() {
+        try {
+            TxContext ctx = txCtx.get();
+
+            if (ctx != null) {
+                txCtx.remove();
+
+                GridNearTxLocal tx = cache.tx();
+
+                if (tx != null)
+                    tx.proxy().rollback();
+            }
+        }
+        catch (IgniteException e) {
+            log.error("Failed to rollback cache transaction.", e);
+        }
+    }
+
+    /**
+     * @param key Key.
+     * @throws IgniteCheckedException If failed.
+     */
+    private void lockKey(Object key) throws IgniteCheckedException {
+        if (cache.tx() == null)
+            cache.txStart(PESSIMISTIC, REPEATABLE_READ);
+
+        cache.get(key); // Acquire distributed lock.
+    }
+
+    /**
+     * Information about updates done during single database transaction.
+     */
+    @SuppressWarnings("TypeMayBeWeakened")
+    private static class TxContext {
+        /** */
+        private Set<Object> locked = new GridLeanSet<>();
+
+        /**
+         * Marks key as locked.
+         *
+         * @param key Key.
+         */
+        void locked(Object key) {
+            locked.add(key);
+        }
+
+        /**
+         * Marks key as unlocked.
+         *
+         * @param key Key.
+         * @return {@code True} if last locked key was unlocked.
+         */
+        boolean unlocked(Object key) {
+            locked.remove(key);
+
+            return locked.isEmpty();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalAccessStrategy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalAccessStrategy.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalAccessStrategy.java
new file mode 100644
index 0000000..6f4935b
--- /dev/null
+++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalAccessStrategy.java
@@ -0,0 +1,141 @@
+/*
+ * 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.cache.hibernate;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Implementation of {TRANSACTIONAL cache access strategy.
+ * <p>
+ * It is supposed that this strategy is used in JTA environment and Hibernate and
+ * {@link IgniteInternalCache} corresponding to the L2 cache region are configured to use the same transaction manager.
+ * <p>
+ * Configuration of L2 cache and per-entity cache access strategy can be set in the
+ * Hibernate configuration file:
+ * <pre name="code" class="xml">
+ * &lt;hibernate-configuration&gt;
+ *     &lt;!-- Enable L2 cache. --&gt;
+ *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
+ *
+ *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
+ *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
+ *
+ *     &lt;!-- Specify entity. --&gt;
+ *     &lt;mapping class="com.example.Entity"/&gt;
+ *
+ *     &lt;!-- Enable L2 cache with transactional access strategy for entity. --&gt;
+ *     &lt;class-cache class="com.example.Entity" usage="transactional"/&gt;
+ * &lt;/hibernate-configuration&gt;
+ * </pre>
+ * Also cache access strategy can be set using annotations:
+ * <pre name="code" class="java">
+ * &#064;javax.persistence.Entity
+ * &#064;javax.persistence.Cacheable
+ * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
+ * public class Entity { ... }
+ * </pre>
+ */
+public class HibernateTransactionalAccessStrategy extends HibernateAccessStrategyAdapter {
+    /**
+     * @param ignite Grid.
+     * @param cache Cache.
+     * @param eConverter Exception converter.
+     */
+    HibernateTransactionalAccessStrategy(Ignite ignite,
+        HibernateCacheProxy cache,
+        HibernateExceptionConverter eConverter) {
+        super(ignite, cache, eConverter);
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public Object get(Object key) {
+        try {
+            return cache.get(key);
+        }
+        catch (IgniteCheckedException e) {
+            throw convertException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void putFromLoad(Object key, Object val) {
+        try {
+            cache.put(key, val);
+        }
+        catch (IgniteCheckedException e) {
+            throw convertException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void lock(Object key) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public void unlock(Object key) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean update(Object key, Object val) {
+        try {
+            cache.put(key, val);
+
+            return true;
+        }
+        catch (IgniteCheckedException e) {
+            throw convertException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean afterUpdate(Object key, Object val) {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean insert(Object key, Object val) {
+        try {
+            cache.put(key, val);
+
+            return true;
+        }
+        catch (IgniteCheckedException e) {
+            throw convertException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean afterInsert(Object key, Object val) {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void remove(Object key) {
+        try {
+            cache.remove(key);
+        }
+        catch (IgniteCheckedException e) {
+            throw convertException(e);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/package-info.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/package-info.java b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/package-info.java
new file mode 100644
index 0000000..1179aec
--- /dev/null
+++ b/modules/hibernate-core/src/main/java/org/apache/ignite/cache/hibernate/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * 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 description. -->
+ * Contains implementation of Hibernate L2 cache. Refer to
+ * <i>org.apache.ignite.examples.datagrid.hibernate.HibernateL2CacheExample</i> for more information on how to
+ * configure and use Ignite with Hibernate.
+ */
+package org.apache.ignite.cache.hibernate;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/README.txt
----------------------------------------------------------------------
diff --git a/modules/hibernate/README.txt b/modules/hibernate/README.txt
deleted file mode 100644
index 8e90dab..0000000
--- a/modules/hibernate/README.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-Apache Ignite Hibernate Module
-------------------------------
-
-Apache Ignite Hibernate module provides Hibernate second-level cache (L2 cache) implementation based
-on Apache Ignite In-Memory Data Grid.
-
-To enable Hibernate module when starting a standalone node, move 'optional/ignite-hibernate' folder to
-'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will
-be added to classpath in this case.
-
-Importing Hibernate Module In Maven Project
--------------------------------------------
-
-If you are using Maven to manage dependencies of your project, you can add Hibernate module
-dependency like this (replace '${ignite.version}' with actual Ignite version you are
-interested in):
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
-                        http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    ...
-    <dependencies>
-        ...
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-hibernate</artifactId>
-            <version>${ignite.version}</version>
-        </dependency>
-        ...
-    </dependencies>
-    ...
-</project>
-
-
-LGPL dependencies
------------------
-
-Ignite includes the following optional LGPL dependencies:
- - Hibernate L2 Cache Integration, http://hibernate.org/orm/
- - JTS Topology Suite for Geospatial indexing, http://tsusiatsoftware.net/jts/main.html
- - cron4j for cron-based task scheduling, http://www.sauronsoftware.it/projects/cron4j
-
-Apache binary releases cannot include LGPL dependencies. If you would like include
-optional LGPL dependencies into your release, you should download the source release
-from Ignite website and do the build with the following maven command:
-
-mvn clean package -DskipTests -Prelease,lgpl

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/licenses/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/modules/hibernate/licenses/apache-2.0.txt b/modules/hibernate/licenses/apache-2.0.txt
deleted file mode 100644
index d645695..0000000
--- a/modules/hibernate/licenses/apache-2.0.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed 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.

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate/pom.xml b/modules/hibernate/pom.xml
deleted file mode 100644
index 75dacb1..0000000
--- a/modules/hibernate/pom.xml
+++ /dev/null
@@ -1,146 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-<!--
-    POM file.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.ignite</groupId>
-        <artifactId>ignite-parent</artifactId>
-        <version>1</version>
-        <relativePath>../../parent</relativePath>
-    </parent>
-
-    <artifactId>ignite-hibernate</artifactId>
-    <version>2.0.0-SNAPSHOT</version>
-    <url>http://ignite.apache.org</url>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-core</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-core</artifactId>
-            <version>4.2.6.Final</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-jta</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.ow2.jotm</groupId>
-            <artifactId>jotm-core</artifactId>
-            <version>2.1.9</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-dbcp</groupId>
-            <artifactId>commons-dbcp</artifactId>
-            <version>1.4</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>com.h2database</groupId>
-            <artifactId>h2</artifactId>
-            <version>${h2.version}</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>javax.resource</groupId>
-            <artifactId>connector-api</artifactId>
-            <version>1.5</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-core</artifactId>
-            <version>${project.version}</version>
-            <type>test-jar</type>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-spring</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-log4j</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-beans</artifactId>
-            <version>${spring.version}</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-context</artifactId>
-            <version>${spring.version}</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <testResources>
-            <testResource>
-                <directory>src/main/java</directory>
-                <excludes>
-                    <exclude>**/*.java</exclude>
-                </excludes>
-            </testResource>
-            <testResource>
-                <directory>src/test/java</directory>
-                <excludes>
-                    <exclude>**/*.java</exclude>
-                </excludes>
-            </testResource>
-        </testResources>
-
-        <plugins>
-            <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateAbstractRegionAccessStrategy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateAbstractRegionAccessStrategy.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateAbstractRegionAccessStrategy.java
deleted file mode 100644
index 7186cfb..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateAbstractRegionAccessStrategy.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.access.RegionAccessStrategy;
-import org.hibernate.cache.spi.access.SoftLock;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Implementation of L2 cache access strategy delegating to {@link HibernateAccessStrategyAdapter}.
- */
-public abstract class HibernateAbstractRegionAccessStrategy implements RegionAccessStrategy {
-    /** */
-    protected final HibernateAccessStrategyAdapter stgy;
-
-    /**
-     * @param stgy Access strategy implementation.
-     */
-    protected HibernateAbstractRegionAccessStrategy(HibernateAccessStrategyAdapter stgy) {
-        this.stgy = stgy;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object get(Object key, long txTs) throws CacheException {
-        return stgy.get(key);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean putFromLoad(Object key, Object val, long txTs, Object ver) throws CacheException {
-        stgy.putFromLoad(key, val);
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean putFromLoad(Object key, Object val, long txTs, Object ver, boolean minimalPutOverride)
-        throws CacheException {
-        stgy.putFromLoad(key, val, minimalPutOverride);
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public SoftLock lockItem(Object key, Object ver) throws CacheException {
-        return stgy.lock(key);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public SoftLock lockRegion() throws CacheException {
-        return stgy.lockRegion();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void unlockRegion(SoftLock lock) throws CacheException {
-        stgy.unlockRegion(lock);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void unlockItem(Object key, SoftLock lock) throws CacheException {
-        stgy.unlock(key, lock);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void remove(Object key) throws CacheException {
-        stgy.remove(key);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void removeAll() throws CacheException {
-        stgy.removeAll();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void evict(Object key) throws CacheException {
-        stgy.evict(key);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void evictAll() throws CacheException {
-        stgy.evictAll();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyAdapter.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyAdapter.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyAdapter.java
deleted file mode 100644
index f6c1d0e..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateAccessStrategyAdapter.java
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteCallable;
-import org.apache.ignite.resources.IgniteInstanceResource;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy;
-import org.hibernate.cache.spi.access.EntityRegionAccessStrategy;
-import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy;
-import org.hibernate.cache.spi.access.RegionAccessStrategy;
-import org.hibernate.cache.spi.access.SoftLock;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Common interface used to implement Hibernate L2 cache access strategies ({@link RegionAccessStrategy},
- * {@link EntityRegionAccessStrategy} and {@link CollectionRegionAccessStrategy}).
- * <p>
- * The expected sequences of steps related to various CRUD operations executed by Hibernate are:
- * <p>
- * Insert:
- * <ul>
- *     <li>Start DB transaction.</li>
- *     <li>Execute database insert.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#insert}.</li>
- *     <li>Commit DB transaction.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#afterInsert}.</li>
- * </ul>
- * In case if some step fails and DB transaction is rolled back then
- * {@link HibernateAccessStrategyAdapter#afterInsert} is not called.
- * <p>
- * Update:
- * <ul>
- *     <li>Start DB transaction.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#lock}.</li>
- *     <li>Execute database update.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#update}.</li>
- *     <li>Commit DB transaction.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#afterUpdate}.</li>
- * </ul>
- * In case if {@link HibernateAccessStrategyAdapter#lock} was called, but some other step fails and DB
- * transaction is rolled back then {@link HibernateAccessStrategyAdapter#unlock} is called for all locked keys.
- * <p>
- * Delete:
- * <ul>
- *     <li>Start DB transaction.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#lock} for removing key.</li>
- *     <li>Execute database delete.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#remove}.</li>
- *     <li>Commit DB transaction.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#unlock}.</li>
- * </ul>
- * In case if {@link HibernateAccessStrategyAdapter#lock} was called, but some other step fails and DB
- * transaction is rolled back then {@link HibernateAccessStrategyAdapter#unlock} is called for all locked keys.
- * <p>
- * In case if custom SQL update query is executed Hibernate clears entire cache region,
- * for this case operations sequence is:
- * <ul>
- *     <li>Start DB transaction.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#lockRegion}.</li>
- *     <li>Execute database query.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#removeAll}.</li>
- *     <li>Commit DB transaction.</li>
- *     <li>Call {@link HibernateAccessStrategyAdapter#unlockRegion}.</li>
- * </ul>
- */
-public abstract class HibernateAccessStrategyAdapter {
-    /** */
-    protected final HibernateCacheProxy cache;
-
-    /** Grid. */
-    protected final Ignite ignite;
-
-    /** */
-    protected final IgniteLogger log;
-
-    /**
-     * @param ignite Grid.
-     * @param cache Cache.
-     */
-    protected HibernateAccessStrategyAdapter(Ignite ignite, HibernateCacheProxy cache) {
-        this.cache = cache;
-        this.ignite = ignite;
-
-        log = ignite.log();
-    }
-
-    /**
-     * Gets value from cache. Used by {@link RegionAccessStrategy#get}.
-     *
-     * @param key Key.
-     * @return Cached value.
-     * @throws CacheException If failed.
-     */
-    @Nullable protected Object get(Object key) throws CacheException {
-        try {
-            return cache.get(key);
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /**
-     * Puts in cache value loaded from the database. Used by {@link RegionAccessStrategy#putFromLoad}.
-     *
-     * @param key Key.
-     * @param val Value.
-     * @param minimalPutOverride MinimalPut flag
-     * @throws CacheException If failed.
-     */
-    protected void putFromLoad(Object key, Object val, boolean minimalPutOverride) throws CacheException {
-        putFromLoad(key, val);
-    }
-
-    /**
-     * Puts in cache value loaded from the database. Used by {@link RegionAccessStrategy#putFromLoad}.
-     *
-     * @param key Key.
-     * @param val Value.
-     * @throws CacheException If failed.
-     */
-    protected void putFromLoad(Object key, Object val) throws CacheException {
-        try {
-            cache.put(key, val);
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /**
-     * Called during database transaction execution before Hibernate attempts to update or remove given key.
-     * Used by {@link RegionAccessStrategy#lockItem}.
-     *
-     * @param key Key.
-     * @return Lock representation or {@code null}.
-     * @throws CacheException If failed.
-     */
-    @Nullable protected abstract SoftLock lock(Object key) throws CacheException;
-
-    /**
-     * Called after Hibernate failed to update or successfully removed given key.
-     * Used by {@link RegionAccessStrategy#unlockItem}.
-     *
-     * @param key Key.
-     * @param lock The lock previously obtained from {@link #lock}
-     * @throws CacheException If failed.
-     */
-    protected abstract void unlock(Object key, SoftLock lock) throws CacheException;
-
-    /**
-     * Called after Hibernate updated object in the database but before transaction completed.
-     * Used by {@link EntityRegionAccessStrategy#update} and {@link NaturalIdRegionAccessStrategy#update}.
-     *
-     * @param key Key.
-     * @param val Value.
-     * @return {@code True} if operation updated cache.
-     * @throws CacheException If failed.
-     */
-    protected abstract boolean update(Object key, Object val) throws CacheException;
-
-    /**
-     * Called after Hibernate updated object in the database and transaction successfully completed.
-     * Used by {@link EntityRegionAccessStrategy#afterUpdate} and {@link NaturalIdRegionAccessStrategy#afterUpdate}.
-     *
-     * @param key Key.
-     * @param val Value.
-     * @param lock The lock previously obtained from {@link #lock}
-     * @return {@code True} if operation updated cache.
-     * @throws CacheException If failed.
-     */
-    protected abstract boolean afterUpdate(Object key, Object val, SoftLock lock) throws CacheException;
-
-    /**
-     * Called after Hibernate inserted object in the database but before transaction completed.
-     * Used by {@link EntityRegionAccessStrategy#insert} and {@link NaturalIdRegionAccessStrategy#insert}.
-     *
-     * @param key Key.
-     * @param val Value.
-     * @return {@code True} if operation updated cache.
-     * @throws CacheException If failed.
-     */
-    protected abstract boolean insert(Object key, Object val) throws CacheException;
-
-    /**
-     * Called after Hibernate inserted object in the database and transaction successfully completed.
-     * Used by {@link EntityRegionAccessStrategy#afterInsert} and {@link NaturalIdRegionAccessStrategy#afterInsert}.
-     *
-     * @param key Key.
-     * @param val Value.
-     * @return {@code True} if operation updated cache.
-     * @throws CacheException If failed.
-     */
-    protected abstract boolean afterInsert(Object key, Object val) throws CacheException;
-
-    /**
-     * Called after Hibernate removed object from database but before transaction completed.
-     * Used by {@link RegionAccessStrategy#remove}.
-     *
-     * @param key Key,
-     * @throws CacheException If failed.
-     */
-    protected abstract void remove(Object key) throws CacheException;
-
-    /**
-     * Called to remove object from cache without regard to transaction.
-     * Used by {@link RegionAccessStrategy#evict}.
-     *
-     * @param key Key.
-     * @throws CacheException If failed.
-     */
-    protected void evict(Object key) throws CacheException {
-        evict(ignite, cache, key);
-    }
-
-    /**
-     * Called to remove all data from cache without regard to transaction.
-     * Used by {@link RegionAccessStrategy#evictAll}.
-     *
-     * @throws CacheException If failed.
-     */
-    protected void evictAll() throws CacheException {
-        evictAll(cache);
-    }
-
-    /**
-     * Called during database transaction execution before Hibernate executed
-     * update operation which should invalidate entire cache region.
-     * Used by {@link RegionAccessStrategy#lockRegion}.
-     *
-     * @throws CacheException If failed.
-     * @return Lock representation or {@code null}.
-     */
-    @Nullable protected SoftLock lockRegion() throws CacheException {
-        return null;
-    }
-
-    /**
-     * Called after transaction clearing entire cache region completed.
-     * Used by {@link RegionAccessStrategy#unlockRegion}.
-     *
-     * @param lock The lock previously obtained from {@link #lockRegion}
-     * @throws CacheException If failed.
-     */
-    protected void unlockRegion(SoftLock lock) throws CacheException {
-        // No-op.
-    }
-
-    /**
-     * Called during database transaction execution to clear entire cache region after
-     * Hibernate executed database update, but before transaction completed.
-     * Used by {@link RegionAccessStrategy#removeAll}.
-     *
-     * @throws CacheException If failed.
-     */
-    protected final void removeAll() throws CacheException {
-        evictAll();
-    }
-
-    /**
-     * Called to remove object from cache without regard to transaction.
-     *
-     * @param ignite Grid.
-     * @param cache Cache.
-     * @param key Key.
-     * @throws CacheException If failed.
-     */
-    static void evict(Ignite ignite, HibernateCacheProxy cache, Object key) throws CacheException {
-        try {
-            key = cache.keyTransformer().transform(key);
-
-            ignite.compute(ignite.cluster()).call(new ClearKeyCallable(key, cache.name()));
-        }
-        catch (IgniteException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /**
-     * Called to remove all data from cache without regard to transaction.
-     *
-     * @param cache Cache.
-     * @throws CacheException If failed.
-     */
-    static void evictAll(IgniteInternalCache<Object,Object> cache) throws CacheException {
-        try {
-            cache.clear();
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /**
-     * Callable invalidates given key.
-     */
-    private static class ClearKeyCallable implements IgniteCallable<Void>, Externalizable {
-        /** */
-        private static final long serialVersionUID = 0L;
-
-        /** */
-        @IgniteInstanceResource
-        private Ignite ignite;
-
-        /** */
-        private Object key;
-
-        /** */
-        private String cacheName;
-
-        /**
-         * Empty constructor required by {@link Externalizable}.
-         */
-        public ClearKeyCallable() {
-            // No-op.
-        }
-
-        /**
-         * @param key Key to clear.
-         * @param cacheName Cache name.
-         */
-        private ClearKeyCallable(Object key, String cacheName) {
-            this.key = key;
-            this.cacheName = cacheName;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Void call() throws IgniteCheckedException {
-            IgniteInternalCache<Object, Object> cache = ((IgniteKernal)ignite).getCache(cacheName);
-
-            assert cache != null;
-
-            cache.clearLocally(key);
-
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void writeExternal(ObjectOutput out) throws IOException {
-            out.writeObject(key);
-
-            U.writeString(out, cacheName);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-            key = in.readObject();
-
-            cacheName = U.readString(in);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
deleted file mode 100644
index 7204083..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateCacheProxy.java
+++ /dev/null
@@ -1,801 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import javax.cache.Cache;
-import javax.cache.expiry.ExpiryPolicy;
-import javax.cache.processor.EntryProcessor;
-import javax.cache.processor.EntryProcessorResult;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cache.CacheEntry;
-import org.apache.ignite.cache.CacheMetrics;
-import org.apache.ignite.cache.CachePeekMode;
-import org.apache.ignite.cache.affinity.Affinity;
-import org.apache.ignite.cluster.ClusterGroup;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.CacheEntryPredicate;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.IgniteCacheExpiryPolicy;
-import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
-import org.apache.ignite.lang.IgniteBiPredicate;
-import org.apache.ignite.mxbean.CacheMetricsMXBean;
-import org.apache.ignite.transactions.Transaction;
-import org.apache.ignite.transactions.TransactionConcurrency;
-import org.apache.ignite.transactions.TransactionIsolation;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Hibernate cache proxy used to substitute hibernate keys with ignite keys.
- */
-public class HibernateCacheProxy implements IgniteInternalCache<Object, Object> {
-    /** Delegate. */
-    private final IgniteInternalCache<Object, Object> delegate;
-
-    /** Transformer. */
-    private final HibernateKeyTransformer keyTransformer;
-
-    /**
-     * @param delegate Delegate.
-     * @param keyTransformer Key keyTransformer.
-     */
-    HibernateCacheProxy(
-        IgniteInternalCache<Object, Object> delegate,
-        HibernateKeyTransformer keyTransformer
-    ) {
-        assert delegate != null;
-        assert keyTransformer != null;
-
-        this.delegate = delegate;
-        this.keyTransformer = keyTransformer;
-    }
-
-    /**
-     * @return HibernateKeyTransformer
-     */
-    HibernateKeyTransformer keyTransformer(){
-        return keyTransformer;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String name() {
-        return delegate.name();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean skipStore() {
-        return delegate.skipStore();
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalCache setSkipStore(boolean skipStore) {
-        return delegate.setSkipStore(skipStore);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isEmpty() {
-        return delegate.isEmpty();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean containsKey(Object key) {
-        return delegate.containsKey(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> containsKeyAsync(Object key) {
-        return delegate.containsKeyAsync(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean containsKeys(Collection keys) {
-        return delegate.containsKey(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> containsKeysAsync(Collection keys) {
-        return delegate.containsKeysAsync(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object localPeek(
-        Object key,
-        CachePeekMode[] peekModes,
-        @Nullable IgniteCacheExpiryPolicy plc
-    ) throws IgniteCheckedException {
-        return delegate.localPeek(keyTransformer.transform(key), peekModes, plc);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Iterable<Cache.Entry<Object, Object>> localEntries(
-        CachePeekMode[] peekModes
-    ) throws IgniteCheckedException {
-        return delegate.localEntries(peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object get(Object key) throws IgniteCheckedException {
-        return delegate.get(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public CacheEntry getEntry(Object key) throws IgniteCheckedException {
-        return delegate.getEntry(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture getAsync(Object key) {
-        return delegate.getAsync(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<CacheEntry<Object, Object>> getEntryAsync(Object key) {
-        return delegate.getEntryAsync(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public Map getAll(@Nullable Collection keys) throws IgniteCheckedException {
-        return delegate.getAll(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public Collection<CacheEntry<Object, Object>> getEntries(
-        @Nullable Collection keys) throws IgniteCheckedException {
-        return delegate.getEntries(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Map<Object, Object>> getAllAsync(@Nullable Collection keys) {
-        return delegate.getAllAsync(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Collection<CacheEntry<Object,Object>>> getEntriesAsync(
-        @Nullable Collection keys
-    ) {
-        return delegate.getEntriesAsync(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object getAndPut(Object key, Object val) throws IgniteCheckedException {
-        return delegate.getAndPut(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture getAndPutAsync(Object key, Object val) {
-        return delegate.getAndPutAsync(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean put(Object key, Object val) throws IgniteCheckedException {
-        return delegate.put(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> putAsync(Object key, Object val) {
-        return delegate.putAsync(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object getAndPutIfAbsent(Object key, Object val) throws IgniteCheckedException {
-        return delegate.getAndPutIfAbsent(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture getAndPutIfAbsentAsync(Object key, Object val) {
-        return delegate.getAndPutIfAbsentAsync(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean putIfAbsent(Object key, Object val) throws IgniteCheckedException {
-        return delegate.putIfAbsent(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> putIfAbsentAsync(Object key, Object val) {
-        return delegate.putIfAbsentAsync(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object getAndReplace(Object key, Object val) throws IgniteCheckedException {
-        return delegate.getAndReplace(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture getAndReplaceAsync(Object key, Object val) {
-        return delegate.getAndReplaceAsync(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean replace(Object key, Object val) throws IgniteCheckedException {
-        return delegate.replace(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> replaceAsync(Object key, Object val) {
-        return delegate.replaceAsync(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean replace(Object key, Object oldVal, Object newVal) throws IgniteCheckedException {
-        return delegate.replace(keyTransformer.transform(key), oldVal, newVal);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> replaceAsync(Object key, Object oldVal, Object newVal) {
-        return delegate.replaceAsync(keyTransformer.transform(key), oldVal, newVal);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void putAll(@Nullable Map m) throws IgniteCheckedException {
-        delegate.putAll(transform(m));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> putAllAsync(@Nullable Map m) {
-        return delegate.putAllAsync(transform(m));
-    }
-
-    /** {@inheritDoc} */
-    @Override public Set keySet() {
-        return delegate.keySet();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Set keySetx() {
-        return delegate.keySetx();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Set primaryKeySet() {
-        return delegate.primaryKeySet();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Iterable values() {
-        return delegate.values();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Set<Cache.Entry<Object, Object>> entrySet() {
-        return delegate.entrySet();
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Set<Cache.Entry<Object,Object>> entrySet(int part) {
-        return delegate.entrySet(part);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Set<Cache.Entry<Object, Object>> entrySetx(CacheEntryPredicate... filter) {
-        return delegate.entrySetx(filter);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Transaction txStart(
-        TransactionConcurrency concurrency,
-        TransactionIsolation isolation
-    ) {
-        return delegate.txStart(concurrency, isolation);
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridNearTxLocal txStartEx(
-        TransactionConcurrency concurrency,
-        TransactionIsolation isolation
-    ) {
-        return delegate.txStartEx(concurrency, isolation);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Transaction txStart(
-        TransactionConcurrency concurrency,
-        TransactionIsolation isolation,
-        long timeout,
-        int txSize
-    ) {
-        return delegate.txStart(concurrency, isolation, timeout, txSize);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public GridNearTxLocal tx() {
-        return delegate.tx();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean evict(Object key) {
-        return delegate.evict(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void evictAll(@Nullable Collection keys) {
-        delegate.evictAll(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void clearLocally(boolean srv, boolean near, boolean readers) {
-        delegate.clearLocally(srv, near, readers);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean clearLocally(Object key) {
-        return delegate.clearLocally(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void clearLocallyAll(Set keys, boolean srv, boolean near, boolean readers) {
-        delegate.clearLocallyAll((Set<?>)transform(keys), srv, near, readers);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void clear(Object key) throws IgniteCheckedException {
-        delegate.clear(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void clearAll(Set keys) throws IgniteCheckedException {
-        delegate.clearAll((Set<?>)transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void clear() throws IgniteCheckedException {
-        delegate.clear();
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> clearAsync() {
-        return delegate.clearAsync();
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> clearAsync(Object key) {
-        return delegate.clearAsync(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> clearAllAsync(Set keys) {
-        return delegate.clearAllAsync((Set<?>)transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object getAndRemove(Object key) throws IgniteCheckedException {
-        return delegate.getAndRemove(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture getAndRemoveAsync(Object key) {
-        return delegate.getAndRemoveAsync(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean remove(Object key) throws IgniteCheckedException {
-        return delegate.remove(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> removeAsync(Object key) {
-        return delegate.removeAsync(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean remove(Object key, Object val) throws IgniteCheckedException {
-        return delegate.remove(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> removeAsync(Object key, Object val) {
-        return delegate.removeAsync(keyTransformer.transform(key), val);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void removeAll(@Nullable Collection keys) throws IgniteCheckedException {
-        delegate.removeAll(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> removeAllAsync(@Nullable Collection keys) {
-        return delegate.removeAllAsync(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void removeAll() throws IgniteCheckedException {
-        delegate.removeAll();
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> removeAllAsync() {
-        return delegate.removeAllAsync();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean lock(Object key, long timeout) throws IgniteCheckedException {
-        return delegate.lock(keyTransformer.transform(key), timeout);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> lockAsync(Object key, long timeout) {
-        return delegate.lockAsync(keyTransformer.transform(key), timeout);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean lockAll(@Nullable Collection keys, long timeout) throws IgniteCheckedException {
-        return delegate.lockAll(transform(keys), timeout);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Boolean> lockAllAsync(@Nullable Collection keys, long timeout) {
-        return delegate.lockAllAsync(transform(keys), timeout);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void unlock(Object key) throws IgniteCheckedException {
-        delegate.unlock(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public void unlockAll(@Nullable Collection keys) throws IgniteCheckedException {
-        delegate.unlockAll(transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isLocked(Object key) {
-        return delegate.isLocked(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isLockedByThread(Object key) {
-        return delegate.isLockedByThread(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public int size() {
-        return delegate.size();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long sizeLong() {
-        return delegate.sizeLong();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int localSize(CachePeekMode[] peekModes) throws IgniteCheckedException {
-        return delegate.localSize(peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Override public long localSizeLong(CachePeekMode[] peekModes) throws IgniteCheckedException {
-        return delegate.localSizeLong(peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Override public long localSizeLong(int partition, CachePeekMode[] peekModes) throws IgniteCheckedException {
-        return delegate.localSizeLong(partition, peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int size(CachePeekMode[] peekModes) throws IgniteCheckedException {
-        return delegate.size(peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Override public long sizeLong(CachePeekMode[] peekModes) throws IgniteCheckedException {
-        return delegate.sizeLong(peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Override public long sizeLong(int partition, CachePeekMode[] peekModes) throws IgniteCheckedException {
-        return delegate.sizeLong(partition, peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Integer> sizeAsync(CachePeekMode[] peekModes) {
-        return delegate.sizeAsync(peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Long> sizeLongAsync(CachePeekMode[] peekModes) {
-        return delegate.sizeLongAsync(peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Long> sizeLongAsync(int partition, CachePeekMode[] peekModes) {
-        return delegate.sizeLongAsync(partition, peekModes);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int nearSize() {
-        return delegate.nearSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int primarySize() {
-        return delegate.primarySize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long primarySizeLong() {
-        return delegate.primarySizeLong();
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheConfiguration configuration() {
-        return delegate.configuration();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Affinity affinity() {
-        return delegate.affinity();
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheMetrics clusterMetrics() {
-        return delegate.clusterMetrics();
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheMetrics clusterMetrics(ClusterGroup grp) {
-        return delegate.clusterMetrics(grp);
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheMetrics localMetrics() {
-        return delegate.localMetrics();
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheMetricsMXBean clusterMxBean() {
-        return delegate.clusterMxBean();
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheMetricsMXBean localMxBean() {
-        return delegate.localMxBean();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long offHeapEntriesCount() {
-        return delegate.offHeapEntriesCount();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long offHeapAllocatedSize() {
-        return delegate.offHeapAllocatedSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> rebalance() {
-        return delegate.rebalance();
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalCache forSubjectId(UUID subjId) {
-        return delegate.forSubjectId(subjId);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object getForcePrimary(Object key) throws IgniteCheckedException {
-        return delegate.getForcePrimary(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture getForcePrimaryAsync(Object key) {
-        return delegate.getForcePrimaryAsync(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public Map getAllOutTx(Set keys) throws IgniteCheckedException {
-        return delegate.getAllOutTx((Set<?>)transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Map<Object, Object>> getAllOutTxAsync(Set keys) {
-        return delegate.getAllOutTxAsync((Set<?>)transform(keys));
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isIgfsDataCache() {
-        return delegate.isIgfsDataCache();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long igfsDataSpaceUsed() {
-        return delegate.igfsDataSpaceUsed();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isMongoDataCache() {
-        return delegate.isMongoDataCache();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isMongoMetaCache() {
-        return delegate.isMongoMetaCache();
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public ExpiryPolicy expiry() {
-        return delegate.expiry();
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalCache withExpiryPolicy(ExpiryPolicy plc) {
-        return delegate.withExpiryPolicy(plc);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalCache withNoRetries() {
-        return delegate.withNoRetries();
-    }
-
-    /** {@inheritDoc} */
-    @Override public GridCacheContext context() {
-        return delegate.context();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void localLoadCache(
-        @Nullable IgniteBiPredicate p,
-        @Nullable Object... args
-    ) throws IgniteCheckedException {
-        delegate.localLoadCache(p, args);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> localLoadCacheAsync(
-        @Nullable IgniteBiPredicate p,
-        @Nullable Object... args
-    ) {
-        return delegate.localLoadCacheAsync(p, args);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Object getTopologySafe(Object key) throws IgniteCheckedException {
-        return delegate.getTopologySafe(keyTransformer.transform(key));
-    }
-
-    /** {@inheritDoc} */
-    @Override public Collection<Integer> lostPartitions() {
-        return delegate.lostPartitions();
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public EntryProcessorResult invoke(
-        @Nullable AffinityTopologyVersion topVer,
-        Object key,
-        EntryProcessor entryProcessor,
-        Object... args
-    ) throws IgniteCheckedException {
-        return delegate.invoke(topVer, key, entryProcessor, args);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Map> invokeAllAsync(Map map, Object... args) {
-        return delegate.invokeAllAsync(map, args);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Map invokeAll(Map map, Object... args) throws IgniteCheckedException {
-        return delegate.invokeAll(map, args);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Map> invokeAllAsync(Set keys, EntryProcessor entryProcessor, Object... args) {
-        return delegate.invokeAllAsync((Set<?>)transform(keys), entryProcessor, args);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Map invokeAll(Set keys, EntryProcessor entryProcessor, Object... args) throws IgniteCheckedException {
-        return delegate.invokeAll((Set<?>)transform(keys), entryProcessor, args);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<EntryProcessorResult> invokeAsync(
-        Object key,
-        EntryProcessor entryProcessor,
-        Object... args
-    ) {
-        return delegate.invokeAsync(keyTransformer.transform(key), entryProcessor, args);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public EntryProcessorResult invoke(
-        Object key,
-        EntryProcessor entryProcessor,
-        Object... args
-    ) throws IgniteCheckedException {
-        return delegate.invoke(keyTransformer.transform(key), entryProcessor, args);
-    }
-
-    /** {@inheritDoc} */
-    @Override public Iterator<Cache.Entry<Object,Object>> scanIterator(
-        boolean keepBinary,
-        @Nullable IgniteBiPredicate p
-    ) throws IgniteCheckedException {
-        return delegate.scanIterator(keepBinary, p);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> removeAllConflictAsync(Map drMap) throws IgniteCheckedException {
-        return delegate.removeAllConflictAsync(drMap);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void removeAllConflict(Map drMap) throws IgniteCheckedException {
-        delegate.removeAllConflictAsync(drMap);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<?> putAllConflictAsync(Map drMap) throws IgniteCheckedException {
-        return delegate.putAllConflictAsync(drMap);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void putAllConflict(Map drMap) throws IgniteCheckedException {
-        delegate.putAllConflict(drMap);
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalCache keepBinary() {
-        return delegate.keepBinary();
-    }
-
-    /** {@inheritDoc} */
-    @Override public IgniteInternalCache cache() {
-        return delegate.cache();
-    }
-
-    /** {@inheritDoc} */
-    @Override public Iterator iterator() {
-        return delegate.iterator();
-    }
-
-    /**
-     * @param keys Keys.
-     */
-    private Collection<Object> transform(Collection<Object> keys) {
-        Collection<Object> res = new LinkedList<>();
-
-        for (Object o : keys)
-            res.add(keyTransformer.transform(o));
-
-        return res;
-    }
-
-    /**
-     * @param map Map.
-     */
-    private Map<Object, Object> transform(Map<Object, Object> map) {
-        Map<Object, Object> res = new HashMap<>();
-
-        Set<Map.Entry<Object, Object>> ents = map.entrySet();
-
-        for (Map.Entry<Object, Object> e : ents)
-            res.put(keyTransformer.transform(e.getKey()), e.getValue());
-
-        return res;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateCollectionRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateCollectionRegion.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateCollectionRegion.java
deleted file mode 100644
index eb35a2c..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateCollectionRegion.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.Ignite;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.CacheDataDescription;
-import org.hibernate.cache.spi.CollectionRegion;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy;
-
-/**
- * Implementation of {@link CollectionRegion}. This region is used to store collection data.
- * <p>
- * L2 cache for collection can be enabled in the Hibernate configuration file:
- * <pre name="code" class="xml">
- * &lt;hibernate-configuration&gt;
- *     &lt;!-- Enable L2 cache. --&gt;
- *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
- *
- *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
- *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
- *
- *     &lt;!-- Specify entities. --&gt;
- *     &lt;mapping class="com.example.Entity"/&gt;
- *     &lt;mapping class="com.example.ChildEntity"/&gt;
- *
- *     &lt;!-- Enable L2 cache with nonstrict-read-write access strategy for entities and collection. --&gt;
- *     &lt;collection-cache collection="com.example.Entity" usage="nonstrict-read-write"/&gt;
- *     &lt;collection-cache collection="com.example.ChildEntity" usage="nonstrict-read-write"/&gt;
- *     &lt;collection-cache collection="com.example.Entity.children" usage="nonstrict-read-write"/&gt;
- * &lt;/hibernate-configuration&gt;
- * </pre>
- * Also cache for collection can be enabled using annotations:
- * <pre name="code" class="java">
- * &#064;javax.persistence.Entity
- * public class Entity {
- *    ...
- *
- *    &#064;javax.persistence.OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
- *    &#064;javax.persistence.JoinColumn(name="PARENT_ID")
- *    &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
- *    public List&lt;ChildEntity&gt; getChildren() {...}
- * }
- * </pre>
- * Note: the collection cache does not cache the state of the actual entities in the cache, it caches only identifier
- * values. For this reason, the collection cache should always be used in conjunction with
- * the second-level cache for those entities expected to be cached as part of a collection cache.
- */
-public class HibernateCollectionRegion extends HibernateTransactionalDataRegion implements CollectionRegion {
-    /**
-     * @param factory Region factory.
-     * @param name Region name.
-     * @param ignite Grid.
-     * @param cache Region cache.
-     * @param dataDesc Region data description.
-     */
-    public HibernateCollectionRegion(HibernateRegionFactory factory, String name,
-        Ignite ignite, HibernateCacheProxy cache, CacheDataDescription dataDesc) {
-        super(factory, name, ignite, cache, dataDesc);
-    }
-
-    /** {@inheritDoc} */
-    @Override public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
-        return new AccessStrategy(createAccessStrategy(accessType));
-    }
-
-    /**
-     * Collection region access strategy.
-     */
-    private class AccessStrategy extends HibernateAbstractRegionAccessStrategy
-        implements CollectionRegionAccessStrategy {
-        /**
-         * @param stgy Access strategy implementation.
-         */
-        private AccessStrategy(HibernateAccessStrategyAdapter stgy) {
-            super(stgy);
-        }
-
-        /** {@inheritDoc} */
-        @Override public CollectionRegion getRegion() {
-            return HibernateCollectionRegion.this;
-        }
-    }
-}
\ No newline at end of file


[06/51] [abbrv] ignite git commit: ignite-1794 Refactored hibernate modules, switched to hibernate 5.1

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java b/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java
deleted file mode 100644
index 13956dc..0000000
--- a/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java
+++ /dev/null
@@ -1,1949 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
-import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
-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.hibernate.ObjectNotFoundException;
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.StaleObjectStateException;
-import org.hibernate.Transaction;
-import org.hibernate.annotations.NaturalId;
-import org.hibernate.annotations.NaturalIdCache;
-import org.hibernate.cache.spi.GeneralDataRegion;
-import org.hibernate.cache.spi.TransactionalDataRegion;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.exception.ConstraintViolationException;
-import org.hibernate.service.ServiceRegistryBuilder;
-import org.hibernate.stat.NaturalIdCacheStatistics;
-import org.hibernate.stat.SecondLevelCacheStatistics;
-
-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.CacheWriteSynchronizationMode.FULL_SYNC;
-import static org.apache.ignite.cache.hibernate.HibernateRegionFactory.DFLT_ACCESS_TYPE_PROPERTY;
-import static org.apache.ignite.cache.hibernate.HibernateRegionFactory.IGNITE_INSTANCE_NAME_PROPERTY;
-import static org.apache.ignite.cache.hibernate.HibernateRegionFactory.REGION_CACHE_PROPERTY;
-import static org.hibernate.cfg.Environment.CACHE_REGION_FACTORY;
-import static org.hibernate.cfg.Environment.GENERATE_STATISTICS;
-import static org.hibernate.cfg.Environment.HBM2DDL_AUTO;
-import static org.hibernate.cfg.Environment.RELEASE_CONNECTIONS;
-import static org.hibernate.cfg.Environment.USE_QUERY_CACHE;
-import static org.hibernate.cfg.Environment.USE_SECOND_LEVEL_CACHE;
-
-/**
- *
- * Tests Hibernate L2 cache.
- */
-public class HibernateL2CacheSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** */
-    public static final String CONNECTION_URL = "jdbc:h2:mem:example;DB_CLOSE_DELAY=-1";
-
-    /** */
-    public static final String ENTITY_NAME = Entity.class.getName();
-
-    /** */
-    public static final String ENTITY2_NAME = Entity2.class.getName();
-
-    /** */
-    public static final String VERSIONED_ENTITY_NAME = VersionedEntity.class.getName();
-
-    /** */
-    public static final String PARENT_ENTITY_NAME = ParentEntity.class.getName();
-
-    /** */
-    public static final String CHILD_COLLECTION_REGION = ENTITY_NAME + ".children";
-
-    /** */
-    public static final String NATURAL_ID_REGION =
-        "org.apache.ignite.cache.hibernate.HibernateL2CacheSelfTest$Entity##NaturalId";
-
-    /** */
-    public static final String NATURAL_ID_REGION2 =
-        "org.apache.ignite.cache.hibernate.HibernateL2CacheSelfTest$Entity2##NaturalId";
-
-    /** */
-    private SessionFactory sesFactory1;
-
-    /** */
-    private SessionFactory sesFactory2;
-
-    /**
-     * First Hibernate test entity.
-     */
-    @javax.persistence.Entity
-    @NaturalIdCache
-    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
-    public static class Entity {
-        /** */
-        private int id;
-
-        /** */
-        private String name;
-
-        /** */
-        private Collection<ChildEntity> children;
-
-        /**
-         * Default constructor required by Hibernate.
-         */
-        public Entity() {
-            // No-op.
-        }
-
-        /**
-         * @param id ID.
-         * @param name Name.
-         */
-        public Entity(int id, String name) {
-            this.id = id;
-            this.name = name;
-        }
-
-        /**
-         * @return ID.
-         */
-        @Id
-        public int getId() {
-            return id;
-        }
-
-        /**
-         * @param id ID.
-         */
-        public void setId(int id) {
-            this.id = id;
-        }
-
-        /**
-         * @return Name.
-         */
-        @NaturalId(mutable = true)
-        public String getName() {
-            return name;
-        }
-
-        /**
-         * @param name Name.
-         */
-        public void setName(String name) {
-            this.name = name;
-        }
-
-        /**
-         * @return Children.
-         */
-        @OneToMany(cascade=javax.persistence.CascadeType.ALL, fetch=FetchType.LAZY)
-        @JoinColumn(name="ENTITY_ID")
-        public Collection<ChildEntity> getChildren() {
-            return children;
-        }
-
-        /**
-         * @param children Children.
-         */
-        public void setChildren(Collection<ChildEntity> children) {
-            this.children = children;
-        }
-    }
-
-    /**
-     * Second Hibernate test entity.
-     */
-    @javax.persistence.Entity
-    @NaturalIdCache
-    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
-    public static class Entity2 {
-        /** */
-        private int id;
-
-        /** */
-        private String name;
-
-        /** */
-        private Collection<ChildEntity> children;
-
-        /**
-         * Default constructor required by Hibernate.
-         */
-        public Entity2() {
-            // No-op.
-        }
-
-        /**
-         * @param id ID.
-         * @param name Name.
-         */
-        public Entity2(int id, String name) {
-            this.id = id;
-            this.name = name;
-        }
-
-        /**
-         * @return ID.
-         */
-        @Id
-        public int getId() {
-            return id;
-        }
-
-        /**
-         * @param id ID.
-         */
-        public void setId(int id) {
-            this.id = id;
-        }
-
-        /**
-         * @return Name.
-         */
-        @NaturalId(mutable = true)
-        public String getName() {
-            return name;
-        }
-
-        /**
-         * @param name Name.
-         */
-        public void setName(String name) {
-            this.name = name;
-        }
-    }
-
-    /**
-     * Hibernate child entity referenced by {@link Entity}.
-     */
-    @javax.persistence.Entity
-    @SuppressWarnings("PublicInnerClass")
-    public static class ChildEntity {
-        /** */
-        private int id;
-
-        /**
-         * Default constructor required by Hibernate.
-         */
-        public ChildEntity() {
-            // No-op.
-        }
-
-        /**
-         * @param id ID.
-         */
-        public ChildEntity(int id) {
-            this.id = id;
-        }
-
-        /**
-         * @return ID.
-         */
-        @Id
-        @GeneratedValue
-        public int getId() {
-            return id;
-        }
-
-        /**
-         * @param id ID.
-         */
-        public void setId(int id) {
-            this.id = id;
-        }
-    }
-
-    /**
-     * Hibernate entity referencing {@link Entity}.
-     */
-    @javax.persistence.Entity
-    @SuppressWarnings("PublicInnerClass")
-    public static class ParentEntity {
-        /** */
-        private int id;
-
-        /** */
-        private Entity entity;
-
-        /**
-         * Default constructor required by Hibernate.
-         */
-        public ParentEntity() {
-            // No-op.
-        }
-
-        /**
-         * @param id ID.
-         * @param entity Referenced entity.
-         */
-        public ParentEntity(int id, Entity entity) {
-            this.id = id;
-            this.entity = entity;
-        }
-
-        /**
-         * @return ID.
-         */
-        @Id
-        public int getId() {
-            return id;
-        }
-
-        /**
-         * @param id ID.
-         */
-        public void setId(int id) {
-            this.id = id;
-        }
-
-        /**
-         * @return Referenced entity.
-         */
-        @OneToOne
-        public Entity getEntity() {
-            return entity;
-        }
-
-        /**
-         * @param entity Referenced entity.
-         */
-        public void setEntity(Entity entity) {
-            this.entity = entity;
-        }
-    }
-
-    /**
-     * Hibernate entity.
-     */
-    @javax.persistence.Entity
-    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
-    public static class VersionedEntity {
-        /** */
-        private int id;
-
-        /** */
-        private long ver;
-
-        /**
-         * Default constructor required by Hibernate.
-         */
-        public VersionedEntity() {
-        }
-
-        /**
-         * @param id ID.
-         */
-        public VersionedEntity(int id) {
-            this.id = id;
-        }
-
-        /**
-         * @return ID.
-         */
-        @Id
-        public int getId() {
-            return id;
-        }
-
-        /**
-         * @param id ID.
-         */
-        public void setId(int id) {
-            this.id = id;
-        }
-
-        /**
-         * @return Version.
-         */
-        @javax.persistence.Version
-        public long getVersion() {
-            return ver;
-        }
-
-        /**
-         * @param ver Version.
-         */
-        public void setVersion(long ver) {
-            this.ver = ver;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
-        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
-
-        discoSpi.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(discoSpi);
-
-        cfg.setCacheConfiguration(generalRegionConfiguration("org.hibernate.cache.spi.UpdateTimestampsCache"),
-            generalRegionConfiguration("org.hibernate.cache.internal.StandardQueryCache"),
-            transactionalRegionConfiguration(ENTITY_NAME),
-            transactionalRegionConfiguration(ENTITY2_NAME),
-            transactionalRegionConfiguration(VERSIONED_ENTITY_NAME),
-            transactionalRegionConfiguration(PARENT_ENTITY_NAME),
-            transactionalRegionConfiguration(CHILD_COLLECTION_REGION),
-            transactionalRegionConfiguration(NATURAL_ID_REGION),
-            transactionalRegionConfiguration(NATURAL_ID_REGION2));
-
-        return cfg;
-    }
-
-    /**
-     * @param regionName Region name.
-     * @return Cache configuration for {@link GeneralDataRegion}.
-     */
-    private CacheConfiguration generalRegionConfiguration(String regionName) {
-        CacheConfiguration cfg = new CacheConfiguration();
-
-        cfg.setName(regionName);
-
-        cfg.setCacheMode(PARTITIONED);
-
-        cfg.setAtomicityMode(ATOMIC);
-
-        cfg.setWriteSynchronizationMode(FULL_SYNC);
-
-        cfg.setBackups(1);
-
-        cfg.setAffinity(new RendezvousAffinityFunction(false, 10));
-
-        return cfg;
-    }
-
-    /**
-     * @param regionName Region name.
-     * @return Cache configuration for {@link TransactionalDataRegion}.
-     */
-    protected CacheConfiguration transactionalRegionConfiguration(String regionName) {
-        CacheConfiguration cfg = new CacheConfiguration();
-
-        cfg.setName(regionName);
-
-        cfg.setCacheMode(PARTITIONED);
-
-        cfg.setAtomicityMode(TRANSACTIONAL);
-
-        cfg.setWriteSynchronizationMode(FULL_SYNC);
-
-        cfg.setBackups(1);
-
-        cfg.setAffinity(new RendezvousAffinityFunction(false, 10));
-
-        return cfg;
-    }
-
-    /**
-     * @param accessType Hibernate L2 cache access type.
-     * @param igniteInstanceName Ignite instance name.
-     * @return Hibernate configuration.
-     */
-    private Configuration hibernateConfiguration(AccessType accessType,
-        String igniteInstanceName) {
-        Configuration cfg = new Configuration();
-
-        cfg.addAnnotatedClass(Entity.class);
-        cfg.addAnnotatedClass(Entity2.class);
-        cfg.addAnnotatedClass(VersionedEntity.class);
-        cfg.addAnnotatedClass(ChildEntity.class);
-        cfg.addAnnotatedClass(ParentEntity.class);
-
-        cfg.setCacheConcurrencyStrategy(ENTITY_NAME, accessType.getExternalName());
-        cfg.setCacheConcurrencyStrategy(ENTITY2_NAME, accessType.getExternalName());
-        cfg.setCacheConcurrencyStrategy(VERSIONED_ENTITY_NAME, accessType.getExternalName());
-        cfg.setCacheConcurrencyStrategy(PARENT_ENTITY_NAME, accessType.getExternalName());
-        cfg.setCollectionCacheConcurrencyStrategy(CHILD_COLLECTION_REGION, accessType.getExternalName());
-
-        cfg.setProperty(HBM2DDL_AUTO, "create");
-
-        cfg.setProperty(GENERATE_STATISTICS, "true");
-
-        cfg.setProperty(USE_SECOND_LEVEL_CACHE, "true");
-
-        cfg.setProperty(USE_QUERY_CACHE, "true");
-
-        cfg.setProperty(CACHE_REGION_FACTORY, HibernateRegionFactory.class.getName());
-
-        cfg.setProperty(RELEASE_CONNECTIONS, "on_close");
-
-        cfg.setProperty(IGNITE_INSTANCE_NAME_PROPERTY, igniteInstanceName);
-
-        // Use the same cache for Entity and Entity2.
-        cfg.setProperty(REGION_CACHE_PROPERTY + ENTITY2_NAME, ENTITY_NAME);
-
-        cfg.setProperty(DFLT_ACCESS_TYPE_PROPERTY, accessType.name());
-
-        return cfg;
-    }
-
-    /**
-     * @return Hibernate registry builder.
-     */
-    protected ServiceRegistryBuilder registryBuilder() {
-        ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
-
-        builder.applySetting("hibernate.connection.url", CONNECTION_URL);
-
-        return builder;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGrids(2);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        cleanup();
-    }
-
-    /**
-     * @return Hibernate L2 cache access types to test.
-     */
-    protected AccessType[] accessTypes() {
-        return new AccessType[]{AccessType.READ_ONLY, AccessType.NONSTRICT_READ_WRITE, AccessType.READ_WRITE};
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCollectionCache() throws Exception {
-        for (AccessType accessType : accessTypes())
-            testCollectionCache(accessType);
-    }
-
-    /**
-     * @param accessType Cache access type.
-     * @throws Exception If failed.
-     */
-    @SuppressWarnings("unchecked")
-    private void testCollectionCache(AccessType accessType) throws Exception {
-        createSessionFactories(accessType);
-
-        Map<Integer, Integer> idToChildCnt = new HashMap<>();
-
-        try {
-            Session ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                for (int i = 0; i < 3; i++) {
-                    Entity e = new Entity(i, "name-" + i);
-
-                    Collection<ChildEntity> children = new ArrayList<>();
-
-                    for (int j = 0; j < 3; j++)
-                        children.add(new ChildEntity());
-
-                    e.setChildren(children);
-
-                    idToChildCnt.put(e.getId(), e.getChildren().size());
-
-                    ses.save(e);
-                }
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            // Load children, this should populate cache.
-
-            ses = sesFactory1.openSession();
-
-            try {
-                List<Entity> list = ses.createCriteria(ENTITY_NAME).list();
-
-                assertEquals(idToChildCnt.size(), list.size());
-
-                for (Entity e : list)
-                    assertEquals((int)idToChildCnt.get(e.getId()), e.getChildren().size());
-            }
-            finally {
-                ses.close();
-            }
-
-            assertCollectionCache(sesFactory2, idToChildCnt, 3, 0);
-            assertCollectionCache(sesFactory1, idToChildCnt, 3, 0);
-
-            if (accessType == AccessType.READ_ONLY)
-                return;
-
-            // Update children for one entity.
-
-            ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                Entity e1 = (Entity)ses.load(Entity.class, 1);
-
-                e1.getChildren().remove(e1.getChildren().iterator().next());
-
-                ses.update(e1);
-
-                idToChildCnt.put(e1.getId(), e1.getChildren().size());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertCollectionCache(sesFactory2, idToChildCnt, 2, 1); // After update collection cache entry is removed.
-            assertCollectionCache(sesFactory1, idToChildCnt, 3, 0); // 'assertCollectionCache' loads children in cache.
-
-            // Update children for the same entity using another SessionFactory.
-
-            ses = sesFactory2.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                Entity e1 = (Entity)ses.load(Entity.class, 1);
-
-                e1.getChildren().remove(e1.getChildren().iterator().next());
-
-                ses.update(e1);
-
-                idToChildCnt.put(e1.getId(), e1.getChildren().size());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertCollectionCache(sesFactory2, idToChildCnt, 2, 1); // After update collection cache entry is removed.
-            assertCollectionCache(sesFactory1, idToChildCnt, 3, 0); // 'assertCollectionCache' loads children in cache.
-        }
-        finally {
-            cleanup();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testEntityCache() throws Exception {
-        for (AccessType accessType : accessTypes())
-            testEntityCache(accessType);
-    }
-
-    /**
-     * @param accessType Cache access type.
-     * @throws Exception If failed.
-     */
-    private void testEntityCache(AccessType accessType) throws Exception {
-        createSessionFactories(accessType);
-
-        Map<Integer, String> idToName = new HashMap<>();
-
-        try {
-            Session ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                for (int i = 0; i < 2; i++) {
-                    String name = "name-" + i;
-
-                    ses.save(new Entity(i, name));
-
-                    idToName.put(i, name);
-                }
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 100);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 100);
-
-            if (accessType == AccessType.READ_ONLY)
-                return;
-
-            ses = sesFactory1.openSession();
-
-            try {
-                // Updates and inserts in single transaction.
-
-                Transaction tx = ses.beginTransaction();
-
-                Entity e0 = (Entity)ses.load(Entity.class, 0);
-
-                e0.setName("name-0-changed1");
-
-                ses.update(e0);
-
-                idToName.put(0, e0.getName());
-
-                ses.save(new Entity(2, "name-2"));
-
-                idToName.put(2, "name-2");
-
-                Entity e1 = (Entity)ses.load(Entity.class, 1);
-
-                e1.setName("name-1-changed1");
-
-                ses.update(e1);
-
-                idToName.put(1, e1.getName());
-
-                ses.save(new Entity(3, "name-3"));
-
-                idToName.put(3, "name-3");
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName);
-
-            ses = sesFactory1.openSession();
-
-            try {
-                // Updates, inserts and deletes in single transaction.
-
-                Transaction tx = ses.beginTransaction();
-
-                ses.save(new Entity(4, "name-4"));
-
-                idToName.put(4, "name-4");
-
-                Entity e0 = (Entity)ses.load(Entity.class, 0);
-
-                e0.setName("name-0-changed2");
-
-                ses.update(e0);
-
-                idToName.put(e0.getId(), e0.getName());
-
-                ses.delete(ses.load(Entity.class, 1));
-
-                idToName.remove(1);
-
-                Entity e2 = (Entity)ses.load(Entity.class, 2);
-
-                e2.setName("name-2-changed1");
-
-                ses.update(e2);
-
-                idToName.put(e2.getId(), e2.getName());
-
-                ses.delete(ses.load(Entity.class, 3));
-
-                idToName.remove(3);
-
-                ses.save(new Entity(5, "name-5"));
-
-                idToName.put(5, "name-5");
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 1, 3);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 1, 3);
-
-            // Try to update the same entity using another SessionFactory.
-
-            ses = sesFactory2.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                Entity e0 = (Entity)ses.load(Entity.class, 0);
-
-                e0.setName("name-0-changed3");
-
-                ses.update(e0);
-
-                idToName.put(e0.getId(), e0.getName());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName);
-        }
-        finally {
-            cleanup();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTwoEntitiesSameCache() throws Exception {
-        for (AccessType accessType : accessTypes())
-            testTwoEntitiesSameCache(accessType);
-    }
-
-    /**
-     * @param accessType Cache access type.
-     * @throws Exception If failed.
-     */
-    private void testTwoEntitiesSameCache(AccessType accessType) throws Exception {
-        createSessionFactories(accessType);
-
-        try {
-            Session ses = sesFactory1.openSession();
-
-            Map<Integer, String> idToName1 = new HashMap<>();
-            Map<Integer, String> idToName2 = new HashMap<>();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                for (int i = 0; i < 2; i++) {
-                    String name = "name-" + i;
-
-                    ses.save(new Entity(i, name));
-                    ses.save(new Entity2(i, name));
-
-                    idToName1.put(i, name);
-                    idToName2.put(i, name);
-                }
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 100);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 100);
-
-            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 100);
-            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 100);
-
-            if (accessType == AccessType.READ_ONLY)
-                return;
-
-            ses = sesFactory1.openSession();
-
-            try {
-                // Updates both entities in single transaction.
-
-                Transaction tx = ses.beginTransaction();
-
-                Entity e = (Entity)ses.load(Entity.class, 0);
-
-                e.setName("name-0-changed1");
-
-                ses.update(e);
-
-                Entity2 e2 = (Entity2)ses.load(Entity2.class, 0);
-
-                e2.setName("name-e2-0-changed1");
-
-                ses.update(e2);
-
-                idToName1.put(0, e.getName());
-                idToName2.put(0, e2.getName());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 100);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 100);
-
-            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 100);
-            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 100);
-
-            ses = sesFactory1.openSession();
-
-            try {
-                // Remove entity1 and insert entity2 in single transaction.
-
-                Transaction tx = ses.beginTransaction();
-
-                Entity e = (Entity)ses.load(Entity.class, 0);
-
-                ses.delete(e);
-
-                Entity2 e2 = new Entity2(2, "name-2");
-
-                ses.save(e2);
-
-                idToName1.remove(0);
-                idToName2.put(2, e2.getName());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 0, 100);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 0, 100);
-
-            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 100);
-            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 100);
-
-            ses = sesFactory1.openSession();
-
-            Transaction tx = ses.beginTransaction();
-
-            try {
-                // Update, remove, insert in single transaction, transaction fails.
-
-                Entity e = (Entity)ses.load(Entity.class, 1);
-
-                e.setName("name-1-changed1");
-
-                ses.update(e); // Valid update.
-
-                ses.save(new Entity(2, "name-2")); // Valid insert.
-
-                ses.delete(ses.load(Entity2.class, 0)); // Valid delete.
-
-                Entity2 e2 = (Entity2)ses.load(Entity2.class, 1);
-
-                e2.setName("name-2");  // Invalid update, not-unique name.
-
-                ses.update(e2);
-
-                tx.commit();
-
-                fail("Commit must fail.");
-            }
-            catch (ConstraintViolationException e) {
-                log.info("Expected exception: " + e);
-
-                tx.rollback();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 0, 2, 100);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 0, 2, 100);
-
-            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 100);
-            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 100);
-
-            ses = sesFactory2.openSession();
-
-            try {
-                // Update, remove, insert in single transaction.
-
-                tx = ses.beginTransaction();
-
-                Entity e = (Entity)ses.load(Entity.class, 1);
-
-                e.setName("name-1-changed1");
-
-                ses.update(e);
-
-                idToName1.put(1, e.getName());
-
-                ses.save(new Entity(2, "name-2"));
-
-                idToName1.put(2, "name-2");
-
-                ses.delete(ses.load(Entity2.class, 0));
-
-                idToName2.remove(0);
-
-                Entity2 e2 = (Entity2)ses.load(Entity2.class, 1);
-
-                e2.setName("name-e2-2-changed");
-
-                ses.update(e2);
-
-                idToName2.put(1, e2.getName());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 0, 100);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 0, 100);
-
-            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 0, 100);
-            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 0, 100);
-        }
-        finally {
-            cleanup();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testVersionedEntity() throws Exception {
-        for (AccessType accessType : accessTypes())
-            testVersionedEntity(accessType);
-    }
-
-    /**
-     * @param accessType Cache access type.
-     * @throws Exception If failed.
-     */
-    private void testVersionedEntity(AccessType accessType) throws Exception {
-        createSessionFactories(accessType);
-
-        try {
-            Session ses = sesFactory1.openSession();
-
-            VersionedEntity e0 = new VersionedEntity(0);
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                ses.save(e0);
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            ses = sesFactory1.openSession();
-
-            long ver;
-
-            try {
-                ver = ((VersionedEntity)ses.load(VersionedEntity.class, 0)).getVersion();
-            }
-            finally {
-                ses.close();
-            }
-
-            SecondLevelCacheStatistics stats1 =
-                sesFactory1.getStatistics().getSecondLevelCacheStatistics(VERSIONED_ENTITY_NAME);
-            SecondLevelCacheStatistics stats2 =
-                sesFactory2.getStatistics().getSecondLevelCacheStatistics(VERSIONED_ENTITY_NAME);
-
-            assertEquals(1, stats1.getElementCountInMemory());
-            assertEquals(1, stats2.getElementCountInMemory());
-
-            ses = sesFactory2.openSession();
-
-            try {
-                assertEquals(ver, ((VersionedEntity)ses.load(VersionedEntity.class, 0)).getVersion());
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEquals(1, stats2.getElementCountInMemory());
-            assertEquals(1, stats2.getHitCount());
-
-            if (accessType == AccessType.READ_ONLY)
-                return;
-
-            e0.setVersion(ver - 1);
-
-            ses = sesFactory1.openSession();
-
-            Transaction tx = ses.beginTransaction();
-
-            try {
-                ses.update(e0);
-
-                tx.commit();
-
-                fail("Commit must fail.");
-            }
-            catch (StaleObjectStateException e) {
-                log.info("Expected exception: " + e);
-            }
-            finally {
-                tx.rollback();
-
-                ses.close();
-            }
-
-            sesFactory1.getStatistics().clear();
-
-            stats1 = sesFactory1.getStatistics().getSecondLevelCacheStatistics(VERSIONED_ENTITY_NAME);
-
-            ses = sesFactory1.openSession();
-
-            try {
-                assertEquals(ver, ((VersionedEntity)ses.load(VersionedEntity.class, 0)).getVersion());
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEquals(1, stats1.getElementCountInMemory());
-            assertEquals(1, stats1.getHitCount());
-            assertEquals(1, stats2.getElementCountInMemory());
-            assertEquals(1, stats2.getHitCount());
-        }
-        finally {
-            cleanup();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testNaturalIdCache() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-1084");
-
-        for (AccessType accessType : accessTypes())
-            testNaturalIdCache(accessType);
-    }
-
-    /**
-     * @param accessType Cache access type.
-     * @throws Exception If failed.
-     */
-    private void testNaturalIdCache(AccessType accessType) throws Exception {
-        createSessionFactories(accessType);
-
-        Map<String, Integer> nameToId = new HashMap<>();
-
-        try {
-            Session ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                for (int i = 0; i < 3; i++) {
-                    String name = "name-" + i;
-
-                    ses.save(new Entity(i, name));
-
-                    nameToId.put(name, i);
-                }
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            ses = sesFactory1.openSession();
-
-            try {
-                for (Map.Entry<String, Integer> e : nameToId.entrySet())
-                    ((Entity)ses.bySimpleNaturalId(Entity.class).load(e.getKey())).getId();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertNaturalIdCache(sesFactory2, nameToId, "name-100");
-            assertNaturalIdCache(sesFactory1, nameToId, "name-100");
-
-            if (accessType == AccessType.READ_ONLY)
-                return;
-
-            // Update naturalId.
-
-            ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                Entity e1 = (Entity)ses.load(Entity.class, 1);
-
-                nameToId.remove(e1.getName());
-
-                e1.setName("name-1-changed1");
-
-                nameToId.put(e1.getName(), e1.getId());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertNaturalIdCache(sesFactory2, nameToId, "name-1");
-            assertNaturalIdCache(sesFactory1, nameToId, "name-1");
-
-            // Update entity using another SessionFactory.
-
-            ses = sesFactory2.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                Entity e1 = (Entity)ses.load(Entity.class, 1);
-
-                nameToId.remove(e1.getName());
-
-                e1.setName("name-1-changed2");
-
-                nameToId.put(e1.getName(), e1.getId());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertNaturalIdCache(sesFactory2, nameToId, "name-1-changed1");
-            assertNaturalIdCache(sesFactory1, nameToId, "name-1-changed1");
-
-            // Try invalid NaturalId update.
-
-            ses = sesFactory1.openSession();
-
-            Transaction tx = ses.beginTransaction();
-
-            try {
-                Entity e1 = (Entity)ses.load(Entity.class, 1);
-
-                e1.setName("name-0"); // Invalid update (duplicated name).
-
-                tx.commit();
-
-                fail("Commit must fail.");
-            }
-            catch (ConstraintViolationException e) {
-                log.info("Expected exception: " + e);
-
-                tx.rollback();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertNaturalIdCache(sesFactory2, nameToId);
-            assertNaturalIdCache(sesFactory1, nameToId);
-
-            // Delete entity.
-
-            ses = sesFactory2.openSession();
-
-            try {
-                tx = ses.beginTransaction();
-
-                Entity e2 = (Entity)ses.load(Entity.class, 2);
-
-                ses.delete(e2);
-
-                nameToId.remove(e2.getName());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertNaturalIdCache(sesFactory2, nameToId, "name-2");
-            assertNaturalIdCache(sesFactory1, nameToId, "name-2");
-        }
-        finally {
-            cleanup();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testEntityCacheTransactionFails() throws Exception {
-        for (AccessType accessType : accessTypes())
-            testEntityCacheTransactionFails(accessType);
-    }
-
-    /**
-     * @param accessType Cache access type.
-     * @throws Exception If failed.
-     */
-    private void testEntityCacheTransactionFails(AccessType accessType) throws Exception {
-        createSessionFactories(accessType);
-
-        Map<Integer, String> idToName = new HashMap<>();
-
-        try {
-            Session ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                for (int i = 0; i < 3; i++) {
-                    String name = "name-" + i;
-
-                    ses.save(new Entity(i, name));
-
-                    idToName.put(i, name);
-                }
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 100);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 100);
-
-            ses = sesFactory1.openSession();
-
-            Transaction tx = ses.beginTransaction();
-
-            try {
-                ses.save(new Entity(3, "name-3")); // Valid insert.
-
-                ses.save(new Entity(0, "name-0")); // Invalid insert (duplicated ID).
-
-                tx.commit();
-
-                fail("Commit must fail.");
-            }
-            catch (ConstraintViolationException e) {
-                log.info("Expected exception: " + e);
-
-                tx.rollback();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 3);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 3);
-
-            if (accessType == AccessType.READ_ONLY)
-                return;
-
-            ses = sesFactory1.openSession();
-
-            tx = ses.beginTransaction();
-
-            try {
-                Entity e0 = (Entity)ses.load(Entity.class, 0);
-                Entity e1 = (Entity)ses.load(Entity.class, 1);
-
-                e0.setName("name-10"); // Valid update.
-                e1.setName("name-2"); // Invalid update (violates unique constraint).
-
-                ses.update(e0);
-                ses.update(e1);
-
-                tx.commit();
-
-                fail("Commit must fail.");
-            }
-            catch (ConstraintViolationException e) {
-                log.info("Expected exception: " + e);
-
-                tx.rollback();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName);
-
-            ses = sesFactory1.openSession();
-
-            try {
-                // Create parent entity referencing Entity with ID = 0.
-
-                tx = ses.beginTransaction();
-
-                ses.save(new ParentEntity(0, (Entity) ses.load(Entity.class, 0)));
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            ses = sesFactory1.openSession();
-
-            tx = ses.beginTransaction();
-
-            try {
-                ses.save(new Entity(3, "name-3")); // Valid insert.
-
-                Entity e1 = (Entity)ses.load(Entity.class, 1);
-
-                e1.setName("name-10"); // Valid update.
-
-                ses.delete(ses.load(Entity.class, 0)); // Invalid delete (there is a parent entity referencing it).
-
-                tx.commit();
-
-                fail("Commit must fail.");
-            }
-            catch (ConstraintViolationException e) {
-                log.info("Expected exception: " + e);
-
-                tx.rollback();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 3);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 3);
-
-            ses = sesFactory1.openSession();
-
-            tx = ses.beginTransaction();
-
-            try {
-                ses.delete(ses.load(Entity.class, 1)); // Valid delete.
-
-                idToName.remove(1);
-
-                ses.delete(ses.load(Entity.class, 0)); // Invalid delete (there is a parent entity referencing it).
-
-                tx.commit();
-
-                fail("Commit must fail.");
-            }
-            catch (ConstraintViolationException e) {
-                log.info("Expected exception: " + e);
-
-                tx.rollback();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEntityCache(ENTITY_NAME, sesFactory2, idToName);
-            assertEntityCache(ENTITY_NAME, sesFactory1, idToName);
-        }
-        finally {
-            cleanup();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testQueryCache() throws Exception {
-        for (AccessType accessType : accessTypes())
-            testQueryCache(accessType);
-    }
-
-    /**
-     * @param accessType Cache access type.
-     * @throws Exception If failed.
-     */
-    private void testQueryCache(AccessType accessType) throws Exception {
-        createSessionFactories(accessType);
-
-        try {
-            Session ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                for (int i = 0; i < 5; i++)
-                    ses.save(new Entity(i, "name-" + i));
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            // Run some queries.
-
-            ses = sesFactory1.openSession();
-
-            try {
-                Query qry1 = ses.createQuery("from " + ENTITY_NAME + " where id > 2");
-
-                qry1.setCacheable(true);
-
-                assertEquals(2, qry1.list().size());
-
-                Query qry2 = ses.createQuery("from " + ENTITY_NAME + " where name = 'name-0'");
-
-                qry2.setCacheable(true);
-
-                assertEquals(1, qry2.list().size());
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEquals(0, sesFactory1.getStatistics().getQueryCacheHitCount());
-            assertEquals(2, sesFactory1.getStatistics().getQueryCacheMissCount());
-            assertEquals(2, sesFactory1.getStatistics().getQueryCachePutCount());
-
-            // Run queries using another SessionFactory.
-
-            ses = sesFactory2.openSession();
-
-            try {
-                Query qry1 = ses.createQuery("from " + ENTITY_NAME + " where id > 2");
-
-                qry1.setCacheable(true);
-
-                assertEquals(2, qry1.list().size());
-
-                Query qry2 = ses.createQuery("from " + ENTITY_NAME + " where name = 'name-0'");
-
-                qry2.setCacheable(true);
-
-                assertEquals(1, qry2.list().size());
-
-                Query qry3 = ses.createQuery("from " + ENTITY_NAME + " where id > 1");
-
-                qry3.setCacheable(true);
-
-                assertEquals(3, qry3.list().size());
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEquals(2, sesFactory2.getStatistics().getQueryCacheHitCount());
-            assertEquals(1, sesFactory2.getStatistics().getQueryCacheMissCount());
-            assertEquals(1, sesFactory2.getStatistics().getQueryCachePutCount());
-
-            // Update entity, it should invalidate query cache.
-
-            ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                ses.save(new Entity(5, "name-5"));
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            // Run queries.
-
-            ses = sesFactory1.openSession();
-
-            sesFactory1.getStatistics().clear();
-
-            try {
-                Query qry1 = ses.createQuery("from " + ENTITY_NAME + " where id > 2");
-
-                qry1.setCacheable(true);
-
-                assertEquals(3, qry1.list().size());
-
-                Query qry2 = ses.createQuery("from " + ENTITY_NAME + " where name = 'name-0'");
-
-                qry2.setCacheable(true);
-
-                assertEquals(1, qry2.list().size());
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEquals(0, sesFactory1.getStatistics().getQueryCacheHitCount());
-            assertEquals(2, sesFactory1.getStatistics().getQueryCacheMissCount());
-            assertEquals(2, sesFactory1.getStatistics().getQueryCachePutCount());
-
-            // Clear query cache using another SessionFactory.
-
-            sesFactory2.getCache().evictDefaultQueryRegion();
-
-            ses = sesFactory1.openSession();
-
-            // Run queries again.
-
-            sesFactory1.getStatistics().clear();
-
-            try {
-                Query qry1 = ses.createQuery("from " + ENTITY_NAME + " where id > 2");
-
-                qry1.setCacheable(true);
-
-                assertEquals(3, qry1.list().size());
-
-                Query qry2 = ses.createQuery("from " + ENTITY_NAME + " where name = 'name-0'");
-
-                qry2.setCacheable(true);
-
-                assertEquals(1, qry2.list().size());
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEquals(0, sesFactory1.getStatistics().getQueryCacheHitCount());
-            assertEquals(2, sesFactory1.getStatistics().getQueryCacheMissCount());
-            assertEquals(2, sesFactory1.getStatistics().getQueryCachePutCount());
-        }
-        finally {
-            cleanup();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRegionClear() throws Exception {
-        for (AccessType accessType : accessTypes())
-            testRegionClear(accessType);
-    }
-
-    /**
-     * @param accessType Cache access type.
-     * @throws Exception If failed.
-     */
-    private void testRegionClear(AccessType accessType) throws Exception {
-        createSessionFactories(accessType);
-
-        try {
-            final int ENTITY_CNT = 100;
-
-            Session ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                for (int i = 0; i < ENTITY_CNT; i++) {
-                    Entity e = new Entity(i, "name-" + i);
-
-                    Collection<ChildEntity> children = new ArrayList<>();
-
-                    for (int j = 0; j < 3; j++)
-                        children.add(new ChildEntity());
-
-                    e.setChildren(children);
-
-                    ses.save(e);
-                }
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            loadEntities(sesFactory2, ENTITY_CNT);
-
-            SecondLevelCacheStatistics stats1 = sesFactory1.getStatistics().getSecondLevelCacheStatistics(ENTITY_NAME);
-            SecondLevelCacheStatistics stats2 = sesFactory2.getStatistics().getSecondLevelCacheStatistics(ENTITY_NAME);
-
-            NaturalIdCacheStatistics idStats1 =
-                sesFactory1.getStatistics().getNaturalIdCacheStatistics(NATURAL_ID_REGION);
-            NaturalIdCacheStatistics idStats2 =
-                sesFactory2.getStatistics().getNaturalIdCacheStatistics(NATURAL_ID_REGION);
-
-            SecondLevelCacheStatistics colStats1 =
-                sesFactory1.getStatistics().getSecondLevelCacheStatistics(CHILD_COLLECTION_REGION);
-            SecondLevelCacheStatistics colStats2 =
-                sesFactory2.getStatistics().getSecondLevelCacheStatistics(CHILD_COLLECTION_REGION);
-
-            assertEquals(ENTITY_CNT, stats1.getElementCountInMemory());
-            assertEquals(ENTITY_CNT, stats2.getElementCountInMemory());
-
-            assertEquals(ENTITY_CNT, idStats1.getElementCountInMemory());
-            assertEquals(ENTITY_CNT, idStats2.getElementCountInMemory());
-
-            assertEquals(ENTITY_CNT, colStats1.getElementCountInMemory());
-            assertEquals(ENTITY_CNT, colStats2.getElementCountInMemory());
-
-            // Test cache is cleared after update query.
-
-            ses = sesFactory1.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                ses.createQuery("delete from " + ENTITY_NAME + " where name='no such name'").executeUpdate();
-
-                ses.createQuery("delete from " + ChildEntity.class.getName() + " where id=-1").executeUpdate();
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            assertEquals(0, stats1.getElementCountInMemory());
-            assertEquals(0, stats2.getElementCountInMemory());
-
-            assertEquals(0, idStats1.getElementCountInMemory());
-            assertEquals(0, idStats2.getElementCountInMemory());
-
-            assertEquals(0, colStats1.getElementCountInMemory());
-            assertEquals(0, colStats2.getElementCountInMemory());
-
-            // Load some data in cache.
-
-            loadEntities(sesFactory1, 10);
-
-            assertEquals(10, stats1.getElementCountInMemory());
-            assertEquals(10, stats2.getElementCountInMemory());
-            assertEquals(10, idStats1.getElementCountInMemory());
-            assertEquals(10, idStats2.getElementCountInMemory());
-
-            // Test evictAll method.
-
-            sesFactory2.getCache().evictEntityRegion(ENTITY_NAME);
-
-            assertEquals(0, stats1.getElementCountInMemory());
-            assertEquals(0, stats2.getElementCountInMemory());
-
-            sesFactory2.getCache().evictNaturalIdRegion(ENTITY_NAME);
-
-            assertEquals(0, idStats1.getElementCountInMemory());
-            assertEquals(0, idStats2.getElementCountInMemory());
-
-            sesFactory2.getCache().evictCollectionRegion(CHILD_COLLECTION_REGION);
-
-            assertEquals(0, colStats1.getElementCountInMemory());
-            assertEquals(0, colStats2.getElementCountInMemory());
-        }
-        finally {
-            cleanup();
-        }
-    }
-
-    /**
-     * @param sesFactory Session factory.
-     * @param nameToId Name-ID mapping.
-     * @param absentNames Absent entities' names.
-     */
-    private void assertNaturalIdCache(SessionFactory sesFactory, Map<String, Integer> nameToId, String... absentNames) {
-        sesFactory.getStatistics().clear();
-
-        NaturalIdCacheStatistics stats =
-            sesFactory.getStatistics().getNaturalIdCacheStatistics(NATURAL_ID_REGION);
-
-        long hitBefore = stats.getHitCount();
-
-        long missBefore = stats.getMissCount();
-
-        final Session ses = sesFactory.openSession();
-
-        try {
-            for (Map.Entry<String, Integer> e : nameToId.entrySet())
-                assertEquals((int)e.getValue(), ((Entity)ses.bySimpleNaturalId(Entity.class).load(e.getKey())).getId());
-
-            for (String name : absentNames)
-                assertNull((ses.bySimpleNaturalId(Entity.class).load(name)));
-
-            assertEquals(nameToId.size() + hitBefore, stats.getHitCount());
-
-            assertEquals(absentNames.length + missBefore, stats.getMissCount());
-        }
-        finally {
-            ses.close();
-        }
-    }
-
-    /**
-     * @param sesFactory Session factory.
-     * @param idToChildCnt Number of children per entity.
-     * @param expHit Expected cache hits.
-     * @param expMiss Expected cache misses.
-     */
-    @SuppressWarnings("unchecked")
-    private void assertCollectionCache(SessionFactory sesFactory, Map<Integer, Integer> idToChildCnt, int expHit,
-        int expMiss) {
-        sesFactory.getStatistics().clear();
-
-        Session ses = sesFactory.openSession();
-
-        try {
-            for(Map.Entry<Integer, Integer> e : idToChildCnt.entrySet()) {
-                Entity entity = (Entity)ses.load(Entity.class, e.getKey());
-
-                assertEquals((int)e.getValue(), entity.getChildren().size());
-            }
-        }
-        finally {
-            ses.close();
-        }
-
-        SecondLevelCacheStatistics stats =
-            sesFactory.getStatistics().getSecondLevelCacheStatistics(CHILD_COLLECTION_REGION);
-
-        assertEquals(expHit, stats.getHitCount());
-
-        assertEquals(expMiss, stats.getMissCount());
-    }
-
-    /**
-     * @param sesFactory Session factory.
-     * @param cnt Number of entities to load.
-     */
-    private void loadEntities(SessionFactory sesFactory, int cnt) {
-        Session ses = sesFactory.openSession();
-
-        try {
-            for (int i = 0; i < cnt; i++) {
-                Entity e = (Entity)ses.load(Entity.class, i);
-
-                assertEquals("name-" + i, e.getName());
-
-                assertFalse(e.getChildren().isEmpty());
-
-                ses.bySimpleNaturalId(Entity.class).load(e.getName());
-            }
-        }
-        finally {
-            ses.close();
-        }
-    }
-
-    /**
-     * @param entityName Entity name.
-     * @param sesFactory Session factory.
-     * @param idToName ID to name mapping.
-     * @param absentIds Absent entities' IDs.
-     */
-    private void assertEntityCache(String entityName, SessionFactory sesFactory, Map<Integer, String> idToName,
-        Integer... absentIds) {
-        assert entityName.equals(ENTITY_NAME) || entityName.equals(ENTITY2_NAME) : entityName;
-
-        sesFactory.getStatistics().clear();
-
-        final Session ses = sesFactory.openSession();
-
-        final boolean entity1 = entityName.equals(ENTITY_NAME);
-
-        try {
-            if (entity1) {
-                for (Map.Entry<Integer, String> e : idToName.entrySet())
-                    assertEquals(e.getValue(), ((Entity)ses.load(Entity.class, e.getKey())).getName());
-            }
-            else {
-                for (Map.Entry<Integer, String> e : idToName.entrySet())
-                    assertEquals(e.getValue(), ((Entity2)ses.load(Entity2.class, e.getKey())).getName());
-            }
-
-            for (final int id : absentIds) {
-                GridTestUtils.assertThrows(log, new Callable<Void>() {
-                    @Override public Void call() throws Exception {
-                        if (entity1)
-                            ((Entity)ses.load(Entity.class, id)).getName();
-                        else
-                            ((Entity2)ses.load(Entity2.class, id)).getName();
-
-                        return null;
-                    }
-                }, ObjectNotFoundException.class, null);
-            }
-
-            SecondLevelCacheStatistics stats = sesFactory.getStatistics().getSecondLevelCacheStatistics(entityName);
-
-            assertEquals(idToName.size(), stats.getHitCount());
-
-            assertEquals(absentIds.length, stats.getMissCount());
-        }
-        finally {
-            ses.close();
-        }
-    }
-
-    /**
-     * Creates session factories.
-     *
-     * @param accessType Cache access type.
-     */
-    private void createSessionFactories(AccessType accessType) {
-        sesFactory1 = startHibernate(accessType, getTestIgniteInstanceName(0));
-
-        sesFactory2 = startHibernate(accessType, getTestIgniteInstanceName(1));
-    }
-
-    /**
-     * Starts Hibernate.
-     *
-     * @param accessType Cache access type.
-     * @param igniteInstanceName Ignite instance name.
-     * @return Session factory.
-     */
-    private SessionFactory startHibernate(AccessType accessType, String igniteInstanceName) {
-        Configuration cfg = hibernateConfiguration(accessType, igniteInstanceName);
-
-        ServiceRegistryBuilder builder = registryBuilder();
-
-        builder.applySetting("hibernate.show_sql", false);
-
-        return cfg.buildSessionFactory(builder.buildServiceRegistry());
-    }
-
-    /**
-     * Closes session factories and clears data from caches.
-     *
-     * @throws Exception If failed.
-     */
-    private void cleanup() throws Exception {
-        if (sesFactory1 != null)
-            sesFactory1.close();
-
-        sesFactory1 = null;
-
-        if (sesFactory2 != null)
-            sesFactory2.close();
-
-        sesFactory2 = null;
-
-        for (IgniteCacheProxy<?, ?> cache : ((IgniteKernal)grid(0)).caches())
-            cache.clear();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java b/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java
deleted file mode 100644
index deca893..0000000
--- a/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import java.util.Collections;
-import javax.cache.configuration.Factory;
-import javax.transaction.Synchronization;
-import javax.transaction.TransactionManager;
-import javax.transaction.UserTransaction;
-import org.apache.commons.dbcp.managed.BasicManagedDataSource;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.h2.jdbcx.JdbcDataSource;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.engine.transaction.internal.jta.JtaTransactionFactory;
-import org.hibernate.engine.transaction.spi.TransactionFactory;
-import org.hibernate.service.ServiceRegistryBuilder;
-import org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl;
-import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
-import org.hibernate.service.jta.platform.internal.AbstractJtaPlatform;
-import org.hibernate.service.jta.platform.spi.JtaPlatform;
-import org.jetbrains.annotations.Nullable;
-import org.objectweb.jotm.Jotm;
-
-/**
- *
- * Tests Hibernate L2 cache with TRANSACTIONAL access mode (Hibernate and Cache are configured
- * to used the same TransactionManager).
- */
-public class HibernateL2CacheTransactionalSelfTest extends HibernateL2CacheSelfTest {
-    /** */
-    private static Jotm jotm;
-
-    /**
-     */
-    private static class TestJtaPlatform extends AbstractJtaPlatform {
-        /** {@inheritDoc} */
-        @Override protected TransactionManager locateTransactionManager() {
-            return jotm.getTransactionManager();
-        }
-
-        /** {@inheritDoc} */
-        @Override protected UserTransaction locateUserTransaction() {
-            return jotm.getUserTransaction();
-        }
-    }
-
-    /**
-     */
-    @SuppressWarnings("PublicInnerClass")
-    public static class TestTmFactory implements Factory<TransactionManager> {
-        /** */
-        private static final long serialVersionUID = 0;
-
-        /** {@inheritDoc} */
-        @Override public TransactionManager create() {
-            return jotm.getTransactionManager();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        jotm = new Jotm(true, false);
-
-        super.beforeTestsStarted();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        super.afterTestsStopped();
-
-        if (jotm != null)
-            jotm.stop();
-
-        jotm = null;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
-        cfg.getTransactionConfiguration().setTxManagerFactory(new TestTmFactory());
-        cfg.getTransactionConfiguration().setUseJtaSynchronization(useJtaSynchronization());
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheConfiguration transactionalRegionConfiguration(String regionName) {
-        CacheConfiguration cfg = super.transactionalRegionConfiguration(regionName);
-
-        cfg.setNearConfiguration(null);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected ServiceRegistryBuilder registryBuilder() {
-        ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
-
-        DatasourceConnectionProviderImpl connProvider = new DatasourceConnectionProviderImpl();
-
-        BasicManagedDataSource dataSrc = new BasicManagedDataSource(); // JTA-aware data source.
-
-        dataSrc.setTransactionManager(jotm.getTransactionManager());
-
-        dataSrc.setDefaultAutoCommit(false);
-
-        JdbcDataSource h2DataSrc = new JdbcDataSource();
-
-        h2DataSrc.setURL(CONNECTION_URL);
-
-        dataSrc.setXaDataSourceInstance(h2DataSrc);
-
-        connProvider.setDataSource(dataSrc);
-
-        connProvider.configure(Collections.emptyMap());
-
-        builder.addService(ConnectionProvider.class, connProvider);
-
-        builder.addService(JtaPlatform.class, new TestJtaPlatform());
-
-        builder.addService(TransactionFactory.class, new JtaTransactionFactory());
-
-        return builder;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected AccessType[] accessTypes() {
-        return new AccessType[]{AccessType.TRANSACTIONAL};
-    }
-
-    /**
-     * @return Whether to use {@link Synchronization}.
-     */
-    protected boolean useJtaSynchronization() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.java b/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.java
deleted file mode 100644
index 44899f9..0000000
--- a/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import javax.transaction.Synchronization;
-
-/**
- * Tests Hibernate L2 cache with TRANSACTIONAL access mode and {@link Synchronization}
- * instead of XA resource.
- */
-public class HibernateL2CacheTransactionalUseSyncSelfTest extends HibernateL2CacheTransactionalSelfTest {
-    /** {@inheritDoc} */
-    @Override protected boolean useJtaSynchronization() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java b/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
deleted file mode 100644
index d5496af..0000000
--- a/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.cache.store.hibernate;
-
-import org.apache.ignite.cache.CacheAtomicityMode;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.cache.store.CacheStore;
-import org.apache.ignite.configuration.NearCacheConfiguration;
-import org.apache.ignite.internal.processors.cache.integration.IgniteCacheStoreNodeRestartAbstractTest;
-
-public class CacheHibernateBlobStoreNodeRestartTest extends IgniteCacheStoreNodeRestartAbstractTest {
-    /** {@inheritDoc} */
-    @Override protected CacheStore getStore() {
-        return new CacheHibernateBlobStore();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return CacheMode.PARTITIONED;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return CacheAtomicityMode.ATOMIC;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return null;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreSelfTest.java b/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreSelfTest.java
deleted file mode 100644
index d3d2b52..0000000
--- a/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreSelfTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.cache.store.hibernate;
-
-import java.io.File;
-import java.net.URL;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.testframework.junits.cache.GridAbstractCacheStoreSelfTest;
-import org.hibernate.FlushMode;
-import org.hibernate.Session;
-import org.hibernate.Transaction;
-
-/**
- * Cache store test.
- */
-public class CacheHibernateBlobStoreSelfTest extends
-    GridAbstractCacheStoreSelfTest<CacheHibernateBlobStore<Object, Object>> {
-    /**
-     * @throws Exception If failed.
-     */
-    public CacheHibernateBlobStoreSelfTest() throws Exception {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        super.afterTest();
-
-        Session s = store.session(null);
-
-        if (s == null)
-            return;
-
-        try {
-            s.createQuery("delete from " + CacheHibernateBlobStoreEntry.class.getSimpleName())
-                    .setFlushMode(FlushMode.ALWAYS).executeUpdate();
-
-            Transaction hTx = s.getTransaction();
-
-            if (hTx != null && hTx.isActive())
-                hTx.commit();
-        }
-        finally {
-            s.close();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheHibernateBlobStore<Object, Object> store() {
-        return new CacheHibernateBlobStore<>();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testConfigurationByUrl() throws Exception {
-        URL url = U.resolveIgniteUrl(
-                "modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
-
-        assert url != null;
-
-        store.setHibernateConfigurationPath(url.toString());
-
-        // Store will be implicitly initialized.
-        store.load("key");
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testConfigurationByFile() throws Exception {
-        URL url = U.resolveIgniteUrl(
-                "modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
-
-        assert url != null;
-
-        File file = new File(url.toURI());
-
-        store.setHibernateConfigurationPath(file.getAbsolutePath());
-
-        // Store will be implicitly initialized.
-        store.load("key");
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testConfigurationByResource() throws Exception {
-        store.setHibernateConfigurationPath("/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
-
-        // Store will be implicitly initialized.
-        store.load("key");
-    }
-
-    @Override public void testSimpleMultithreading() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-1757");
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java b/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
deleted file mode 100644
index 3a2244e..0000000
--- a/modules/hibernate/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * 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.cache.store.hibernate;
-
-import java.io.Serializable;
-import java.sql.Connection;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import javax.naming.NamingException;
-import javax.naming.Reference;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.hibernate.Cache;
-import org.hibernate.HibernateException;
-import org.hibernate.Session;
-import org.hibernate.SessionBuilder;
-import org.hibernate.SessionFactory;
-import org.hibernate.StatelessSession;
-import org.hibernate.StatelessSessionBuilder;
-import org.hibernate.TypeHelper;
-import org.hibernate.engine.spi.FilterDefinition;
-import org.hibernate.metadata.ClassMetadata;
-import org.hibernate.metadata.CollectionMetadata;
-import org.hibernate.stat.Statistics;
-
-/**
- * Test for Cache jdbc blob store factory.
- */
-public class CacheHibernateStoreFactorySelfTest extends GridCommonAbstractTest {
-    /** Cache name. */
-    private static final String CACHE_NAME = "test";
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCacheConfiguration() throws Exception {
-        try (Ignite ignite1 = startGrid(0)) {
-            IgniteCache<Integer, String> cache1 = ignite1.getOrCreateCache(cacheConfiguration());
-
-            checkStore(cache1);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testXmlConfiguration() throws Exception {
-        try (Ignite ignite = Ignition.start("modules/hibernate/src/test/config/factory-cache.xml")) {
-            try(Ignite ignite1 = Ignition.start("modules/hibernate/src/test/config/factory-cache1.xml")) {
-                checkStore(ignite.<Integer, String>cache(CACHE_NAME), DummySessionFactoryExt.class);
-
-                checkStore(ignite1.<Integer, String>cache(CACHE_NAME), DummySessionFactory.class);
-            }
-        }
-    }
-
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testIncorrectBeanConfiguration() throws Exception {
-        GridTestUtils.assertThrows(log, new Callable<Object>() {
-            @Override public Object call() throws Exception {
-                try(Ignite ignite =
-                    Ignition.start("modules/hibernate/src/test/config/factory-incorrect-store-cache.xml")) {
-                    ignite.cache(CACHE_NAME).getConfiguration(CacheConfiguration.class).
-                            getCacheStoreFactory().create();
-                }
-                return null;
-            }
-        }, IgniteException.class, "Failed to load bean in application context");
-    }
-
-    /**
-     * @return Cache configuration with store.
-     */
-    private CacheConfiguration<Integer, String> cacheConfiguration() {
-        CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
-
-        CacheHibernateBlobStoreFactory<Integer, String> factory = new CacheHibernateBlobStoreFactory();
-
-        factory.setHibernateConfigurationPath("/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
-
-        cfg.setCacheStoreFactory(factory);
-
-        return cfg;
-    }
-
-    /**
-     * @param cache Ignite cache.
-     * @param dataSrcClass Data source class.
-     * @throws Exception If store parameters is not the same as in configuration xml.
-     */
-    private void checkStore(IgniteCache<Integer, String> cache, Class<?> dataSrcClass) throws Exception {
-        CacheHibernateBlobStore store = (CacheHibernateBlobStore)cache
-            .getConfiguration(CacheConfiguration.class).getCacheStoreFactory().create();
-
-        assertEquals(dataSrcClass,
-            GridTestUtils.getFieldValue(store, CacheHibernateBlobStore.class, "sesFactory").getClass());
-    }
-
-    /**
-     * @param cache Ignite cache.
-     * @throws Exception If store parameters is not the same as in configuration xml.
-     */
-    private void checkStore(IgniteCache<Integer, String> cache) throws Exception {
-        CacheHibernateBlobStore store = (CacheHibernateBlobStore)cache.getConfiguration(CacheConfiguration.class)
-            .getCacheStoreFactory().create();
-
-        assertEquals("/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml",
-            GridTestUtils.getFieldValue(store, CacheHibernateBlobStore.class, "hibernateCfgPath"));
-    }
-
-    /**
-     *
-     */
-    public static class DummySessionFactoryExt extends DummySessionFactory {
-        /** */
-        public DummySessionFactoryExt() {
-            // No-op.
-        }
-    }
-
-    /**
-     *
-     */
-    public static class DummySessionFactory implements SessionFactory {
-        /** {@inheritDoc} */
-        @Override public SessionFactoryOptions getSessionFactoryOptions() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public SessionBuilder withOptions() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Session openSession() throws HibernateException {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Session getCurrentSession() throws HibernateException {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public StatelessSessionBuilder withStatelessOptions() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public StatelessSession openStatelessSession() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public StatelessSession openStatelessSession(Connection connection) {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public ClassMetadata getClassMetadata(Class entityClass) {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public ClassMetadata getClassMetadata(String entityName) {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public CollectionMetadata getCollectionMetadata(String roleName) {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Map<String, ClassMetadata> getAllClassMetadata() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Map getAllCollectionMetadata() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Statistics getStatistics() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void close() throws HibernateException {
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean isClosed() {
-            return false;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Cache getCache() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void evict(Class persistentClass) throws HibernateException {
-        }
-
-        /** {@inheritDoc} */
-        @Override public void evict(Class persistentClass, Serializable id) throws HibernateException {
-        }
-
-        /** {@inheritDoc} */
-        @Override public void evictEntity(String entityName) throws HibernateException {
-        }
-
-        /** {@inheritDoc} */
-        @Override public void evictEntity(String entityName, Serializable id) throws HibernateException {
-        }
-
-        /** {@inheritDoc} */
-        @Override public void evictCollection(String roleName) throws HibernateException {
-        }
-
-        /** {@inheritDoc} */
-        @Override public void evictCollection(String roleName, Serializable id) throws HibernateException {
-        }
-
-        /** {@inheritDoc} */
-        @Override public void evictQueries(String cacheRegion) throws HibernateException {
-        }
-
-        /** {@inheritDoc} */
-        @Override public void evictQueries() throws HibernateException {
-        }
-
-        /** {@inheritDoc} */
-        @Override public Set getDefinedFilterNames() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public FilterDefinition getFilterDefinition(String filterName) throws HibernateException {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean containsFetchProfileDefinition(String name) {
-            return false;
-        }
-
-        /** {@inheritDoc} */
-        @Override public TypeHelper getTypeHelper() {
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Reference getReference() throws NamingException {
-            return null;
-        }
-    }
-}
\ No newline at end of file


[47/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
IGNITE-3488: Prohibited null as cache name. This closes #1790.


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

Branch: refs/heads/ignite-5075-cacheStart
Commit: 8f9edebfe74e2de1368d42ba951fa074b116eb17
Parents: 74f11e8
Author: Igor Seliverstov <gv...@gmail.com>
Authored: Wed Apr 26 17:51:43 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Apr 26 17:51:57 2017 +0300

----------------------------------------------------------------------
 examples/config/example-cache.xml               |   1 +
 .../jmh/cache/JmhCacheAbstractBenchmark.java    |   7 +-
 .../stream/camel/IgniteCamelStreamerTest.java   |  10 +-
 .../ClientAbstractMultiThreadedSelfTest.java    |  37 ++--
 .../client/ClientDefaultCacheSelfTest.java      |   2 +-
 .../ClientAbstractMultiNodeSelfTest.java        |  25 ++-
 .../integration/ClientAbstractSelfTest.java     |   9 +-
 .../jdbc2/JdbcAbstractDmlStatementSelfTest.java |  10 +-
 .../jdbc2/JdbcComplexQuerySelfTest.java         |   5 +-
 .../internal/jdbc2/JdbcConnectionSelfTest.java  |   5 +-
 .../jdbc2/JdbcDistributedJoinsQueryTest.java    |   6 +-
 .../jdbc2/JdbcDynamicIndexAbstractSelfTest.java |  14 +-
 .../jdbc2/JdbcInsertStatementSelfTest.java      |   4 +-
 .../jdbc2/JdbcMergeStatementSelfTest.java       |   4 +-
 .../internal/jdbc2/JdbcMetadataSelfTest.java    |   3 +-
 .../internal/jdbc2/JdbcNoDefaultCacheTest.java  |  45 ++--
 .../jdbc2/JdbcPreparedStatementSelfTest.java    |   4 +-
 .../internal/jdbc2/JdbcResultSetSelfTest.java   |   4 +-
 .../internal/jdbc2/JdbcStatementSelfTest.java   |   4 +-
 .../internal/jdbc2/JdbcStreamingSelfTest.java   |  14 +-
 .../rest/AbstractRestProcessorSelfTest.java     |   2 +-
 .../JettyRestProcessorAbstractSelfTest.java     | 184 +++++++++--------
 .../rest/JettyRestProcessorSignedSelfTest.java  |   4 +-
 .../rest/RestBinaryProtocolSelfTest.java        | 101 ++++-----
 .../rest/RestMemcacheProtocolSelfTest.java      |  47 ++---
 .../processors/rest/RestProcessorTest.java      |   2 +-
 .../rest/TaskCommandHandlerSelfTest.java        |   7 +-
 .../processors/rest/TestBinaryClient.java       |  23 ++-
 .../tcp/redis/RedisProtocolSelfTest.java        |   8 +-
 .../jdbc/AbstractJdbcPojoQuerySelfTest.java     |   2 +-
 .../ignite/jdbc/JdbcConnectionSelfTest.java     |   5 +-
 .../ignite/jdbc/JdbcNoDefaultCacheTest.java     |   3 +-
 .../ignite/jdbc/JdbcPojoQuerySelfTest.java      |   2 +-
 .../jdbc/JdbcPreparedStatementSelfTest.java     |   2 +-
 .../ignite/jdbc/JdbcResultSetSelfTest.java      |   2 +-
 .../ignite/jdbc/JdbcStatementSelfTest.java      |   2 +-
 .../src/main/java/org/apache/ignite/Ignite.java |  10 +-
 .../java/org/apache/ignite/IgniteCompute.java   |   8 +-
 .../configuration/CacheConfiguration.java       |   6 +-
 .../ignite/internal/IgniteComputeImpl.java      |  37 +++-
 .../org/apache/ignite/internal/IgniteEx.java    |  12 +-
 .../apache/ignite/internal/IgniteKernal.java    |  76 +++----
 .../internal/cluster/ClusterGroupAdapter.java   |  23 ++-
 .../ignite/internal/cluster/ClusterGroupEx.java |   5 +-
 .../affinity/GridAffinityProcessor.java         |  67 +++---
 .../processors/cache/GridCacheProcessor.java    | 203 +++++++++----------
 .../processors/cache/GridCacheUtils.java        |  30 ++-
 .../processors/query/GridQueryIndexing.java     |  23 +--
 .../redis/GridRedisRestCommandHandler.java      |   3 +
 .../redis/key/GridRedisDelCommandHandler.java   |   1 +
 .../key/GridRedisExistsCommandHandler.java      |   1 +
 .../server/GridRedisDbSizeCommandHandler.java   |   1 +
 .../string/GridRedisAppendCommandHandler.java   |   3 +
 .../string/GridRedisGetCommandHandler.java      |   1 +
 .../string/GridRedisGetRangeCommandHandler.java |   1 +
 .../string/GridRedisGetSetCommandHandler.java   |   1 +
 .../string/GridRedisIncrDecrCommandHandler.java |   2 +
 .../string/GridRedisMGetCommandHandler.java     |   1 +
 .../string/GridRedisMSetCommandHandler.java     |   1 +
 .../string/GridRedisSetCommandHandler.java      |   1 +
 .../string/GridRedisSetRangeCommandHandler.java |   2 +
 .../string/GridRedisStrlenCommandHandler.java   |   1 +
 .../tcp/GridTcpMemcachedNioListener.java        |   5 +-
 .../spi/indexing/IndexingQueryFilter.java       |   2 +-
 .../core/src/test/config/discovery-stress.xml   |   2 +-
 .../core/src/test/config/spring-cache-load.xml  |   1 +
 .../core/src/test/config/spring-cache-swap.xml  |   2 +
 .../src/test/config/spring-cache-teststore.xml  |   2 +
 .../test/config/store/jdbc/ignite-jdbc-type.xml |   6 +
 .../GridCacheAffinityBackupsSelfTest.java       |   2 +-
 .../apache/ignite/GridTestStoreNodeStartup.java |   2 +-
 .../ignite/IgniteCacheAffinitySelfTest.java     |   2 +-
 .../cache/IgniteWarmupClosureSelfTest.java      |   2 +-
 .../ignite/cache/LargeEntryUpdateTest.java      |   2 +-
 .../affinity/AffinityClientNodeSelfTest.java    |  14 +-
 ...ityFunctionBackupFilterAbstractSelfTest.java |   8 +-
 ...unctionExcludeNeighborsAbstractSelfTest.java |   4 +-
 .../affinity/AffinityHistoryCleanupTest.java    |   2 +-
 .../local/LocalAffinityFunctionTest.java        |   2 +-
 ...cheStoreSessionListenerAbstractSelfTest.java |   6 +-
 .../store/GridCacheBalancingStoreSelfTest.java  |   8 +-
 .../IgniteCacheExpiryStoreLoadSelfTest.java     |   2 +-
 .../store/StoreResourceInjectionSelfTest.java   |   2 +-
 ...CacheJdbcBlobStoreMultithreadedSelfTest.java |   8 +-
 .../ignite/internal/GridAffinityMappedTest.java |   6 +-
 .../internal/GridAffinityP2PSelfTest.java       |   6 +-
 .../ignite/internal/GridAffinitySelfTest.java   |   6 +-
 .../ignite/internal/GridDiscoverySelfTest.java  |   2 +-
 .../GridJobMasterLeaveAwareSelfTest.java        |   8 +-
 .../GridProjectionForCachesSelfTest.java        |  13 +-
 ...ectionLocalJobMultipleArgumentsSelfTest.java |   4 +-
 .../ignite/internal/GridStartStopSelfTest.java  |   8 +-
 .../GridTaskFailoverAffinityRunTest.java        |   4 +-
 .../IgniteClientReconnectApiExceptionTest.java  |  18 +-
 .../IgniteClientReconnectCacheTest.java         |  70 +++----
 ...eClientReconnectContinuousProcessorTest.java |  10 +-
 .../IgniteClientReconnectFailoverTest.java      |   4 +-
 .../internal/IgniteClientReconnectStopTest.java |   2 +-
 .../IgniteComputeEmptyClusterGroupTest.java     |   8 +-
 ...eConcurrentEntryProcessorAccessStopTest.java |   2 +-
 .../internal/binary/BinaryEnumsSelfTest.java    |   2 +-
 .../BinaryObjectBuilderAdditionalSelfTest.java  |   2 +-
 .../internal/binary/BinaryTreeSelfTest.java     |   4 +-
 .../binary/GridBinaryAffinityKeySelfTest.java   |  30 +--
 ...aultBinaryMappersBinaryMetaDataSelfTest.java |   4 +-
 .../IgniteVariousConnectionNumberTest.java      |   4 +-
 .../GridDeploymentMessageCountSelfTest.java     |   6 +-
 .../GridDiscoveryManagerAliveCacheSelfTest.java |   2 +-
 .../OptimizedMarshallerNodeFailoverTest.java    |   6 +-
 .../GridCacheTxLoadFromStoreOnLockSelfTest.java |   2 +-
 .../GridAffinityProcessorAbstractSelfTest.java  |   2 +-
 .../CacheAtomicSingleMessageCountSelfTest.java  |   4 +-
 .../cache/CacheClientStoreSelfTest.java         |   2 +-
 .../cache/CacheConcurrentReadThroughTest.java   |   2 +-
 .../cache/CacheConfigurationLeakTest.java       |   2 +-
 .../cache/CacheDeferredDeleteQueueTest.java     |   4 +-
 .../CacheDeferredDeleteSanitySelfTest.java      |   4 +-
 ...cheDhtLocalPartitionAfterRemoveSelfTest.java |   6 +-
 .../cache/CacheEnumOperationsAbstractTest.java  |   2 +-
 ...CacheExchangeMessageDuplicatedStateTest.java |  10 +-
 .../cache/CacheFutureExceptionSelfTest.java     |   2 +-
 .../cache/CacheGetEntryAbstractTest.java        |  16 +-
 .../processors/cache/CacheGetFromJobTest.java   |   2 +-
 ...erceptorPartitionCounterLocalSanityTest.java |   2 +-
 ...torPartitionCounterRandomOperationsTest.java |   2 +-
 .../CacheMemoryPolicyConfigurationTest.java     |  10 +-
 .../processors/cache/CacheNamesSelfTest.java    |   8 +-
 .../CacheNamesWithSpecialCharactersTest.java    |   4 +-
 .../cache/CacheNearReaderUpdateTest.java        |   2 +-
 ...cheNearUpdateTopologyChangeAbstractTest.java |   8 +-
 .../cache/CacheOffheapMapEntrySelfTest.java     |   2 +-
 .../processors/cache/CachePutIfAbsentTest.java  |   2 +-
 .../cache/CacheReadThroughRestartSelfTest.java  |   8 +-
 .../cache/CacheRebalancingSelfTest.java         |   4 +-
 .../cache/CacheRemoveAllSelfTest.java           |   4 +-
 .../CacheSerializableTransactionsTest.java      |   6 +-
 .../CacheStartupInDeploymentModesTest.java      |   4 +-
 .../CacheStoreUsageMultinodeAbstractTest.java   |   8 +-
 ...eUsageMultinodeDynamicStartAbstractTest.java |   4 +-
 .../processors/cache/CacheTxFastFinishTest.java |   4 +-
 .../processors/cache/CrossCacheLockTest.java    |   4 +-
 .../cache/CrossCacheTxRandomOperationsTest.java |   2 +-
 .../EntryVersionConsistencyReadThroughTest.java |  10 +-
 .../GridCacheAbstractFailoverSelfTest.java      |   4 +-
 .../cache/GridCacheAbstractFullApiSelfTest.java | 114 +++++------
 .../GridCacheAbstractLocalStoreSelfTest.java    |  26 +--
 .../cache/GridCacheAbstractMetricsSelfTest.java | 102 +++++-----
 .../GridCacheAbstractRemoveFailureTest.java     |   6 +-
 .../cache/GridCacheAbstractSelfTest.java        |   4 +-
 ...acheAbstractUsersAffinityMapperSelfTest.java |   7 +-
 .../cache/GridCacheAffinityApiSelfTest.java     |  26 +--
 .../cache/GridCacheAffinityRoutingSelfTest.java |  10 +-
 ...eAtomicEntryProcessorDeploymentSelfTest.java |   2 +-
 .../GridCacheAtomicMessageCountSelfTest.java    |   6 +-
 .../cache/GridCacheBasicApiAbstractTest.java    |  30 +--
 .../cache/GridCacheClearLocallySelfTest.java    |   8 +-
 .../cache/GridCacheConcurrentMapSelfTest.java   |  10 +-
 .../GridCacheConcurrentTxMultiNodeTest.java     |  10 +-
 .../GridCacheConditionalDeploymentSelfTest.java |   4 +-
 ...idCacheConfigurationConsistencySelfTest.java |   2 +-
 .../GridCacheDaemonNodeAbstractSelfTest.java    |   8 +-
 .../cache/GridCacheDeploymentSelfTest.java      |  46 ++---
 .../cache/GridCacheEntryMemorySizeSelfTest.java |   4 +-
 .../cache/GridCacheEntryVersionSelfTest.java    |  16 +-
 .../GridCacheEvictionEventAbstractTest.java     |   2 +-
 .../GridCacheFinishPartitionsSelfTest.java      |  16 +-
 ...CacheFullTextQueryMultithreadedSelfTest.java |   2 +-
 .../cache/GridCacheIncrementTransformTest.java  |   4 +-
 .../GridCacheInterceptorAbstractSelfTest.java   |   8 +-
 .../cache/GridCacheIteratorPerformanceTest.java |   6 +-
 .../cache/GridCacheKeyCheckSelfTest.java        |   6 +-
 .../GridCacheMarshallerTxAbstractTest.java      |  10 +-
 .../GridCacheMarshallingNodeJoinSelfTest.java   |   4 +-
 .../GridCacheMissingCommitVersionSelfTest.java  |   2 +-
 ...GridCacheMixedPartitionExchangeSelfTest.java |   4 +-
 .../cache/GridCacheMultiUpdateLockSelfTest.java |   6 +-
 ...ridCacheMultinodeUpdateAbstractSelfTest.java |   6 +-
 .../cache/GridCacheMvccFlagsTest.java           |   4 +-
 .../cache/GridCacheMvccManagerSelfTest.java     |   6 +-
 .../cache/GridCacheMvccPartitionedSelfTest.java |  34 ++--
 .../processors/cache/GridCacheMvccSelfTest.java |  58 +++---
 .../cache/GridCacheNestedTxAbstractTest.java    |  12 +-
 .../cache/GridCacheObjectToStringSelfTest.java  |   4 +-
 ...HeapMultiThreadedUpdateAbstractSelfTest.java |  20 +-
 ...CacheOffHeapMultiThreadedUpdateSelfTest.java |  14 +-
 .../cache/GridCacheOffheapUpdateSelfTest.java   |  14 +-
 .../cache/GridCachePartitionedGetSelfTest.java  |  16 +-
 ...hePartitionedProjectionAffinitySelfTest.java |   8 +-
 .../GridCachePreloadingEvictionsSelfTest.java   |  14 +-
 .../GridCacheQueryIndexingDisabledSelfTest.java |   2 +-
 .../GridCacheQueryInternalKeysSelfTest.java     |   6 +-
 .../GridCacheReferenceCleanupSelfTest.java      |  10 +-
 ...ridCacheReplicatedSynchronousCommitTest.java |   6 +-
 .../GridCacheReturnValueTransferSelfTest.java   |   4 +-
 .../processors/cache/GridCacheStopSelfTest.java |   8 +-
 ...ridCacheStoreManagerDeserializationTest.java |   3 +
 .../cache/GridCacheStorePutxSelfTest.java       |   2 +-
 .../cache/GridCacheStoreValueBytesSelfTest.java |   4 +-
 .../cache/GridCacheSwapPreloadSelfTest.java     |  10 +-
 ...acheTcpClientDiscoveryMultiThreadedTest.java |   4 +-
 ...cheTransactionalAbstractMetricsSelfTest.java |   8 +-
 .../GridCacheTtlManagerEvictionSelfTest.java    |   6 +-
 .../cache/GridCacheTtlManagerLoadTest.java      |   4 +-
 .../GridCacheTtlManagerNotificationTest.java    |   8 +-
 .../cache/GridCacheTtlManagerSelfTest.java      |  12 +-
 .../GridCacheValueBytesPreloadingSelfTest.java  |  12 +-
 ...idCacheValueConsistencyAbstractSelfTest.java |  14 +-
 .../GridCacheVariableTopologySelfTest.java      |   4 +-
 .../cache/GridCacheVersionMultinodeTest.java    |   2 +-
 .../GridCacheVersionTopologyChangeTest.java     |   2 +-
 ...ProjectionForCachesOnDaemonNodeSelfTest.java |  16 +-
 .../IgniteCacheAbstractStopBusySelfTest.java    |   3 +-
 .../cache/IgniteCacheAbstractTest.java          |   2 +-
 ...IgniteCacheBinaryEntryProcessorSelfTest.java |   6 +-
 ...teCacheConfigurationDefaultTemplateTest.java |   6 +-
 .../IgniteCacheConfigurationTemplateTest.java   |  29 +--
 ...niteCacheCopyOnReadDisabledAbstractTest.java |   2 +-
 .../cache/IgniteCacheDynamicStopSelfTest.java   |  10 +-
 .../IgniteCacheEntryListenerAbstractTest.java   |   6 +-
 ...niteCacheEntryListenerExpiredEventsTest.java |   2 +-
 .../IgniteCacheEntryProcessorCallTest.java      |   8 +-
 .../IgniteCacheEntryProcessorNodeJoinTest.java  |  16 +-
 ...niteCacheExpireAndUpdateConsistencyTest.java |   2 +-
 ...IgniteCacheGetCustomCollectionsSelfTest.java |   2 +-
 .../cache/IgniteCacheIncrementTxTest.java       |  10 +-
 .../cache/IgniteCacheInvokeAbstractTest.java    |   2 +-
 ...gniteCacheInvokeReadThroughAbstractTest.java |   2 +-
 ...gniteCacheLoadRebalanceEvictionSelfTest.java |   6 +-
 .../IgniteCacheManyAsyncOperationsTest.java     |   2 +-
 .../cache/IgniteCacheObjectPutSelfTest.java     |   2 +-
 ...CacheP2pUnmarshallingRebalanceErrorTest.java |   4 +-
 .../IgniteCachePartitionMapUpdateTest.java      |   4 +-
 .../cache/IgniteCachePeekModesAbstractTest.java |  22 +-
 .../IgniteCacheReadThroughStoreCallTest.java    |   2 +-
 ...iteCacheScanPredicateDeploymentSelfTest.java |   2 +-
 .../cache/IgniteCacheSerializationSelfTest.java |   4 +-
 .../cache/IgniteCacheStartStopLoadTest.java     |   2 +-
 .../cache/IgniteCacheStoreCollectionTest.java   |   4 +-
 .../IgniteCacheStoreValueAbstractTest.java      |  30 +--
 .../cache/IgniteCacheTxPreloadNoWriteTest.java  |  12 +-
 .../IgniteClientAffinityAssignmentSelfTest.java |  22 +-
 .../IgniteDaemonNodeMarshallerCacheTest.java    |   2 +-
 .../cache/IgniteDynamicCacheAndNodeStop.java    |   4 +-
 .../cache/IgniteDynamicCacheFilterTest.java     |  10 +-
 ...eDynamicCacheStartNoExchangeTimeoutTest.java |  34 ++--
 .../cache/IgniteDynamicCacheStartSelfTest.java  |  36 ++--
 ...niteDynamicCacheStartStopConcurrentTest.java |   6 +-
 .../IgniteDynamicClientCacheStartSelfTest.java  |  44 ++--
 .../cache/IgniteExchangeFutureHistoryTest.java  |   2 +-
 ...iteMarshallerCacheClassNameConflictTest.java |   8 +-
 ...lerCacheClientRequestsMappingOnMissTest.java |  22 +-
 ...eMarshallerCacheConcurrentReadWriteTest.java |   8 +-
 .../cache/IgniteOnePhaseCommitNearSelfTest.java |   8 +-
 .../cache/IgnitePutAllLargeBatchSelfTest.java   |  12 +-
 ...tAllUpdateNonPreloadedPartitionSelfTest.java |   6 +-
 .../IgniteStartCacheInTransactionSelfTest.java  |  18 +-
 .../cache/IgniteStaticCacheStartSelfTest.java   |   2 +-
 ...gniteTopologyValidatorAbstractCacheTest.java |  37 ++--
 ...iteTopologyValidatorAbstractTxCacheTest.java |  20 +-
 ...niteTopologyValidatorGridSplitCacheTest.java |   2 +-
 .../processors/cache/IgniteTxAbstractTest.java  |   6 +-
 .../IgniteTxConcurrentGetAbstractTest.java      |   6 +-
 .../cache/IgniteTxConfigCacheSelfTest.java      |   2 +-
 .../IgniteTxExceptionAbstractSelfTest.java      |  36 ++--
 .../cache/IgniteTxMultiNodeAbstractTest.java    |  58 +++---
 .../IgniteTxMultiThreadedAbstractTest.java      |   4 +-
 .../cache/IgniteTxReentryAbstractSelfTest.java  |   2 +-
 .../IgniteTxStoreExceptionAbstractSelfTest.java |  34 ++--
 .../binary/BinaryMetadataUpdatesFlowTest.java   |  10 +-
 .../CacheKeepBinaryWithInterceptorTest.java     |   6 +-
 ...yAtomicEntryProcessorDeploymentSelfTest.java |   6 +-
 ...naryObjectMetadataExchangeMultinodeTest.java |  16 +-
 ...acheBinaryObjectUserClassloaderSelfTest.java |   4 +-
 ...naryObjectsAbstractDataStreamerSelfTest.java |   4 +-
 ...aryObjectsAbstractMultiThreadedSelfTest.java |   2 +-
 .../GridCacheBinaryObjectsAbstractSelfTest.java |   8 +-
 .../GridCacheBinaryStoreAbstractSelfTest.java   |   2 +-
 ...ntNodeBinaryObjectMetadataMultinodeTest.java |   8 +-
 ...CacheClientNodeBinaryObjectMetadataTest.java |   4 +-
 .../GridDataStreamerImplSelfTest.java           |  20 +-
 ...IgniteCacheAbstractExecutionContextTest.java |   4 +-
 ...eAbstractDataStructuresFailoverSelfTest.java |   2 +-
 ...CacheAtomicReferenceApiSelfAbstractTest.java |   2 +-
 ...idCacheAtomicStampedApiSelfAbstractTest.java |   2 +-
 .../GridCacheQueueApiSelfAbstractTest.java      |   2 +-
 .../GridCacheQueueCleanupSelfTest.java          |  10 +-
 .../GridCacheSequenceApiSelfAbstractTest.java   |   2 +-
 .../GridCacheSetAbstractSelfTest.java           |   2 +-
 .../GridCacheSetFailoverAbstractSelfTest.java   |   2 +-
 .../IgniteAtomicLongApiAbstractSelfTest.java    |   2 +-
 .../IgniteCountDownLatchAbstractSelfTest.java   |   2 +-
 .../IgniteLockAbstractSelfTest.java             |   2 +-
 .../IgniteSemaphoreAbstractSelfTest.java        |   2 +-
 ...achePartitionedAtomicSequenceTxSelfTest.java |   2 +-
 ...idCachePartitionedNodeRestartTxSelfTest.java |  24 +--
 ...PartitionedQueueCreateMultiNodeSelfTest.java |   4 +-
 ...acheAsyncOperationsFailoverAbstractTest.java |   4 +-
 .../distributed/CacheAsyncOperationsTest.java   |   2 +-
 .../CacheGetFutureHangsSelfTest.java            |   4 +-
 .../CacheGetInsideLockChangingTopologyTest.java |   2 +-
 .../CacheLateAffinityAssignmentTest.java        |   8 +-
 ...CacheLoadingConcurrentGridStartSelfTest.java |  20 +-
 .../CacheLockReleaseNodeLeaveTest.java          |  26 +--
 .../CachePutAllFailoverAbstractTest.java        |   2 +-
 .../CacheTryLockMultithreadedTest.java          |   4 +-
 .../GridCacheAbstractJobExecutionTest.java      |  14 +-
 ...tractPartitionedByteArrayValuesSelfTest.java |   2 +-
 .../GridCacheAbstractPrimarySyncSelfTest.java   |   6 +-
 .../GridCacheBasicOpAbstractTest.java           |  26 +--
 .../GridCacheClientModesAbstractSelfTest.java   |  20 +-
 .../GridCacheEntrySetAbstractSelfTest.java      |   2 +-
 .../distributed/GridCacheLockAbstractTest.java  |   6 +-
 .../distributed/GridCacheMixedModeSelfTest.java |   4 +-
 .../GridCacheMultiNodeAbstractTest.java         |  10 +-
 .../GridCacheMultiNodeLockAbstractTest.java     |  27 ++-
 ...dCacheMultithreadedFailoverAbstractTest.java |   2 +-
 .../GridCacheNodeFailureAbstractTest.java       |   6 +-
 ...ridCachePartitionNotLoadedEventSelfTest.java |   4 +-
 ...chePartitionedReloadAllAbstractSelfTest.java |   8 +-
 .../GridCachePreloadEventsAbstractSelfTest.java |   4 +-
 .../GridCacheTransformEventSelfTest.java        |   2 +-
 ...niteBinaryMetadataUpdateNodeRestartTest.java |   2 +-
 .../distributed/IgniteCache150ClientsTest.java  |   2 +-
 ...niteCacheClientNodeChangingTopologyTest.java | 130 ++++++------
 .../IgniteCacheClientNodeConcurrentStart.java   |   2 +-
 ...teCacheClientNodePartitionsExchangeTest.java |  16 +-
 .../IgniteCacheClientReconnectTest.java         |   2 +-
 .../IgniteCacheConnectionRecoveryTest.java      |   2 +-
 .../distributed/IgniteCacheCreatePutTest.java   |   6 +-
 .../distributed/IgniteCacheGetRestartTest.java  |   2 +-
 .../distributed/IgniteCacheManyClientsTest.java |   6 +-
 .../IgniteCacheMessageRecoveryAbstractTest.java |   4 +-
 ...eCacheMessageRecoveryIdleConnectionTest.java |   2 +-
 .../IgniteCacheNearRestartRollbackSelfTest.java |   4 +-
 .../distributed/IgniteCachePrimarySyncTest.java |   4 +-
 .../IgniteCacheReadFromBackupTest.java          |   2 +-
 .../IgniteCacheServerNodeConcurrentStart.java   |   6 +-
 .../IgniteCacheSingleGetMessageTest.java        |   2 +-
 .../IgniteCacheSizeFailoverTest.java            |   6 +-
 .../IgniteCacheSystemTransactionsSelfTest.java  |   6 +-
 .../IgniteNoClassOnServerAbstractTest.java      |   2 +-
 .../IgniteTxCachePrimarySyncTest.java           |  45 ++--
 ...teSynchronizationModesMultithreadedTest.java |  15 +-
 ...iteTxConsistencyRestartAbstractSelfTest.java |  12 +-
 ...xOriginatingNodeFailureAbstractSelfTest.java |  10 +-
 ...cOriginatingNodeFailureAbstractSelfTest.java |  22 +-
 .../IgniteTxTimeoutAbstractTest.java            |   2 +-
 ...heAbstractTransformWriteThroughSelfTest.java |   2 +-
 .../dht/GridCacheAtomicNearCacheSelfTest.java   |  50 ++---
 .../dht/GridCacheColocatedDebugTest.java        | 112 +++++-----
 ...eColocatedOptimisticTransactionSelfTest.java |   2 +-
 .../dht/GridCacheDhtEntrySelfTest.java          |   6 +-
 ...GridCacheDhtEvictionNearReadersSelfTest.java |   8 +-
 .../dht/GridCacheDhtMappingSelfTest.java        |   4 +-
 .../dht/GridCacheDhtPreloadBigDataSelfTest.java |  10 +-
 .../dht/GridCacheDhtPreloadDelayedSelfTest.java |  24 +--
 .../GridCacheDhtPreloadDisabledSelfTest.java    |  10 +-
 .../GridCacheDhtPreloadMessageCountTest.java    |   6 +-
 .../dht/GridCacheDhtPreloadPutGetSelfTest.java  |   4 +-
 .../dht/GridCacheDhtPreloadSelfTest.java        |  18 +-
 .../GridCacheDhtPreloadStartStopSelfTest.java   |   4 +-
 .../dht/GridCacheDhtPreloadUnloadSelfTest.java  |  24 +--
 ...ePartitionedNearDisabledMetricsSelfTest.java |  12 +-
 ...idCachePartitionedPreloadEventsSelfTest.java |   6 +-
 ...dCachePartitionedTopologyChangeSelfTest.java |  18 +-
 ...itionedTxOriginatingNodeFailureSelfTest.java |  10 +-
 ...ridCachePartitionedUnloadEventsSelfTest.java |  10 +-
 .../dht/GridCacheTxNodeFailureSelfTest.java     |  12 +-
 .../IgniteCacheCommitDelayTxRecoveryTest.java   |  22 +-
 .../dht/IgniteCacheConcurrentPutGetRemove.java  |   2 +-
 .../IgniteCacheCrossCacheTxFailoverTest.java    |   5 +-
 .../dht/IgniteCacheLockFailoverSelfTest.java    |   8 +-
 .../dht/IgniteCacheMultiTxLockSelfTest.java     |   2 +-
 ...artitionedBackupNodeFailureRecoveryTest.java |   6 +-
 ...ePrimaryNodeFailureRecoveryAbstractTest.java |  12 +-
 .../IgniteCachePutRetryAbstractSelfTest.java    |   8 +-
 .../dht/IgniteCachePutRetryAtomicSelfTest.java  |   4 +-
 ...gniteCachePutRetryTransactionalSelfTest.java |   6 +-
 .../dht/IgniteCacheTxRecoveryRollbackTest.java  |  20 +-
 .../dht/IgniteTxReentryColocatedSelfTest.java   |   2 +-
 ...eAtomicInvalidPartitionHandlingSelfTest.java |  12 +-
 .../atomic/GridCacheAtomicPreloadSelfTest.java  |  10 +-
 .../atomic/IgniteCacheAtomicProtocolTest.java   |   2 +-
 ...tomicClientOnlyMultiNodeFullApiSelfTest.java |   6 +-
 ...eAtomicNearOnlyMultiNodeFullApiSelfTest.java |   2 +-
 ...AtomicPartitionedTckMetricsSelfTestImpl.java |   8 +-
 .../near/GridCacheGetStoreErrorSelfTest.java    |   4 +-
 .../near/GridCacheNearEvictionSelfTest.java     |   6 +-
 .../near/GridCacheNearMetricsSelfTest.java      |  32 +--
 .../near/GridCacheNearMultiGetSelfTest.java     |   4 +-
 .../near/GridCacheNearMultiNodeSelfTest.java    |  12 +-
 ...idCacheNearOnlyMultiNodeFullApiSelfTest.java |  10 +-
 .../near/GridCacheNearOnlyTopologySelfTest.java |  16 +-
 .../GridCacheNearPartitionedClearSelfTest.java  |   2 +-
 .../GridCacheNearReaderPreloadSelfTest.java     |   2 +-
 .../near/GridCacheNearReadersSelfTest.java      |  36 ++--
 .../near/GridCacheNearTxForceKeyTest.java       |   8 +-
 .../near/GridCacheNearTxMultiNodeSelfTest.java  |  18 +-
 ...AffinityExcludeNeighborsPerformanceTest.java |   2 +-
 .../GridCachePartitionedAffinitySelfTest.java   |   8 +-
 ...ionedClientOnlyNoPrimaryFullApiSelfTest.java |   4 +-
 .../GridCachePartitionedEvictionSelfTest.java   |   2 +-
 ...titionedExplicitLockNodeFailureSelfTest.java |   4 +-
 ...GridCachePartitionedFilteredPutSelfTest.java |   2 +-
 .../GridCachePartitionedFullApiSelfTest.java    |   8 +-
 ...idCachePartitionedHitsAndMissesSelfTest.java |   4 +-
 .../GridCachePartitionedLoadCacheSelfTest.java  |   2 +-
 ...achePartitionedMultiNodeCounterSelfTest.java |  24 +--
 ...achePartitionedMultiNodeFullApiSelfTest.java |  34 ++--
 ...ePartitionedMultiThreadedPutGetSelfTest.java |   8 +-
 .../GridCachePartitionedStorePutSelfTest.java   |   6 +-
 .../GridCachePartitionedTxSalvageSelfTest.java  |   2 +-
 .../near/GridCachePutArrayValueSelfTest.java    |   2 +-
 ...idCacheRendezvousAffinityClientSelfTest.java |   2 +-
 .../near/GridPartitionedBackupLoadSelfTest.java |   4 +-
 .../near/IgniteCacheNearOnlyTxTest.java         |  24 +--
 .../near/IgniteCacheNearReadCommittedTest.java  |   4 +-
 .../near/IgniteTxReentryNearSelfTest.java       |   2 +-
 .../near/NearCacheMultithreadedUpdateTest.java  |   8 +-
 .../near/NearCachePutAllMultinodeTest.java      |   4 +-
 .../near/NearCacheSyncUpdateTest.java           |   4 +-
 .../near/NoneRebalanceModeSelfTest.java         |   4 +-
 ...cingDelayedPartitionMapExchangeSelfTest.java |   8 +-
 .../GridCacheRebalancingOrderingTest.java       |   2 +-
 .../GridCacheRebalancingSyncCheckDataTest.java  |   6 +-
 .../GridCacheRebalancingSyncSelfTest.java       |  10 +-
 ...eRebalancingUnmarshallingFailedSelfTest.java |   2 +-
 ...stractReplicatedByteArrayValuesSelfTest.java |   2 +-
 .../GridCacheSyncReplicatedPreloadSelfTest.java |  14 +-
 .../GridCacheReplicatedPreloadSelfTest.java     |  50 ++---
 ...eplicatedPreloadStartStopEventsSelfTest.java |   2 +-
 .../cache/eviction/EvictionAbstractTest.java    |  12 +-
 ...heConcurrentEvictionConsistencySelfTest.java |   2 +-
 .../GridCacheConcurrentEvictionsSelfTest.java   |   2 +-
 .../GridCacheEmptyEntriesAbstractSelfTest.java  |   2 +-
 .../GridCacheEvictionFilterSelfTest.java        |   4 +-
 .../GridCacheEvictionTouchSelfTest.java         |   8 +-
 .../lru/LruNearEvictionPolicySelfTest.java      |   6 +-
 .../LruNearOnlyNearEvictionPolicySelfTest.java  |   8 +-
 .../paged/PageEvictionAbstractTest.java         |   5 +-
 .../SortedEvictionPolicyPerformanceTest.java    |   2 +-
 .../IgniteCacheClientNearCacheExpiryTest.java   |   4 +-
 .../IgniteCacheExpiryPolicyAbstractTest.java    |  10 +-
 ...eCacheExpiryPolicyWithStoreAbstractTest.java |   6 +-
 .../expiry/IgniteCacheLargeValueExpireTest.java |   4 +-
 ...eCacheOnlyOneTtlCleanupThreadExistsTest.java |   5 +-
 .../expiry/IgniteCacheTtlCleanupSelfTest.java   |   8 +-
 .../IgniteCacheLoadAllAbstractTest.java         |   2 +-
 .../IgniteCacheStoreSessionAbstractTest.java    |   5 +-
 ...acheStoreSessionWriteBehindAbstractTest.java |   2 +-
 .../IgniteCacheTxStoreSessionTest.java          |  22 +-
 ...dCacheAtomicLocalTckMetricsSelfTestImpl.java |   8 +-
 .../GridCacheLocalByteArrayValuesSelfTest.java  |   2 +-
 .../local/GridCacheLocalFullApiSelfTest.java    |   4 +-
 .../cache/local/GridCacheLocalLockSelfTest.java |   6 +-
 .../GridCacheLocalMultithreadedSelfTest.java    |   2 +-
 .../local/GridCacheLocalTxTimeoutSelfTest.java  |   2 +-
 .../BinaryTxCacheLocalEntriesSelfTest.java      |   2 +-
 .../continuous/CacheContinuousBatchAckTest.java |   2 +-
 ...eContinuousQueryAsyncFilterListenerTest.java |   2 +-
 ...acheContinuousQueryExecuteInPrimaryTest.java |   2 +-
 ...ContinuousQueryFailoverAbstractSelfTest.java |  85 ++++----
 ...ontinuousQueryOperationFromCallbackTest.java |   2 +-
 .../CacheContinuousQueryOperationP2PTest.java   |   2 +-
 .../CacheContinuousQueryOrderingEventTest.java  |   2 +-
 ...acheContinuousQueryRandomOperationsTest.java |   2 +-
 .../CacheKeepBinaryIterationTest.java           |   2 +-
 .../ClientReconnectContinuousQueryTest.java     |   4 +-
 ...yRemoteFilterMissingInClassPathSelfTest.java |   2 +-
 ...ridCacheContinuousQueryAbstractSelfTest.java |  68 ++++---
 ...dCacheContinuousQueryNodesFilteringTest.java |   2 +-
 ...dCacheContinuousQueryReplicatedSelfTest.java |   8 +-
 ...eContinuousQueryReplicatedTxOneNodeTest.java |   4 +-
 ...CacheContinuousQueryClientReconnectTest.java |   6 +-
 .../IgniteCacheContinuousQueryClientTest.java   |  18 +-
 ...eCacheContinuousQueryImmutableEntryTest.java |  10 +-
 ...teCacheContinuousQueryNoUnsubscribeTest.java |  14 +-
 ...IgniteCacheContinuousQueryReconnectTest.java |   8 +-
 ...BehindStorePartitionedMultiNodeSelfTest.java |   6 +-
 .../IgniteCacheWriteBehindNoUpdateSelfTest.java |   2 +-
 ...CacheClientWriteBehindStoreAbstractTest.java |   2 +-
 ...ClientWriteBehindStoreNonCoalescingTest.java |   2 +-
 ...simisticDeadlockDetectionCrossCacheTest.java |   3 +-
 .../CacheVersionedEntryAbstractTest.java        |  10 +-
 .../database/IgniteDbAbstractTest.java          |   2 +-
 .../database/IgniteDbDynamicCacheSelfTest.java  |   4 +-
 .../database/IgniteDbPutGetAbstractTest.java    |  64 +++---
 .../DataStreamProcessorSelfTest.java            |  58 +++---
 .../datastreamer/DataStreamerImplSelfTest.java  |  10 +-
 .../DataStreamerMultiThreadedSelfTest.java      |   2 +-
 .../DataStreamerUpdateAfterLoadTest.java        |   5 +-
 .../IgniteDataStreamerPerformanceTest.java      |   2 +-
 ...lockMessageSystemPoolStarvationSelfTest.java |   4 +-
 .../processors/igfs/IgfsCacheSelfTest.java      |   3 +-
 .../igfs/IgfsDataManagerSelfTest.java           |   3 +-
 .../processors/igfs/IgfsIgniteMock.java         |   7 -
 .../igfs/IgfsMetaManagerSelfTest.java           |   3 +-
 .../processors/igfs/IgfsOneClientNodeTest.java  |   7 +-
 .../processors/igfs/IgfsProcessorSelfTest.java  |   3 +-
 .../processors/igfs/IgfsStartCacheTest.java     |   4 +-
 .../processors/igfs/IgfsStreamsSelfTest.java    |   3 +-
 .../processors/igfs/IgfsTaskSelfTest.java       |   4 +-
 .../IgfsAbstractRecordResolverSelfTest.java     |   4 +-
 .../cache/GridCacheCommandHandlerSelfTest.java  |   4 +
 .../query/GridQueryCommandHandlerTest.java      |   2 +-
 .../GridServiceProcessorAbstractSelfTest.java   |   2 +-
 .../ServicePredicateAccessCacheTest.java        |   2 +-
 .../cache/GridCacheAbstractLoadTest.java        |   5 +-
 .../cache/GridCacheDataStructuresLoadTest.java  |   2 +-
 .../loadtests/cache/GridCacheLoadTest.java      |   4 +-
 .../capacity/GridCapacityLoadTest.java          |   2 +-
 .../capacity/spring-capacity-cache.xml          |   2 +
 .../GridContinuousOperationsLoadTest.java       |   2 +-
 .../GridCachePartitionedAtomicLongLoadTest.java |   2 +-
 .../loadtests/discovery/GridGcTimeoutTest.java  |   2 +-
 .../marshaller/GridMarshallerAbstractTest.java  |  10 +-
 .../platform/PlatformComputeEchoTask.java       |  11 +-
 .../ignite/platform/PlatformSqlQueryTask.java   |   2 +-
 .../CacheCheckpointSpiSecondCacheSelfTest.java  |   7 +-
 .../communication/GridCacheMessageSelfTest.java |   2 +-
 .../tcp/GridCacheDhtLockBackupSelfTest.java     |   6 +-
 ...gniteClientReconnectMassiveShutdownTest.java |   4 +-
 .../tcp/TcpDiscoveryMultiThreadedTest.java      |  12 +-
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java |  16 +-
 .../stream/socket/SocketStreamerSelfTest.java   |   6 +-
 .../ignite/testframework/GridTestUtils.java     |   2 +-
 .../testframework/junits/GridAbstractTest.java  |   5 +-
 .../junits/common/GridCommonAbstractTest.java   |  23 ++-
 .../multijvm/IgniteClusterProcessProxy.java     |   9 +-
 .../junits/multijvm/IgniteProcessProxy.java     |   5 -
 .../testframework/test/ParametersTest.java      |   7 +-
 .../tests/p2p/CacheDeploymentTestTask1.java     |   2 +-
 .../tests/p2p/CacheDeploymentTestTask3.java     |   2 +-
 .../p2p/GridP2PContinuousDeploymentTask1.java   |   2 +-
 .../CacheNoValueClassOnServerTestClient.java    |   2 +-
 .../sink/flink/FlinkIgniteSinkSelfTest.java     |   4 +-
 .../query/h2/H2IndexingAbstractGeoSelfTest.java |   3 +-
 .../hadoop/impl/HadoopAbstractSelfTest.java     |   4 +-
 .../HibernateL2CacheConfigurationSelfTest.java  |   2 +-
 .../hibernate/HibernateL2CacheSelfTest.java     |   4 +-
 .../CacheHibernateStoreFactorySelfTest.java     |   2 +-
 .../CacheHibernateStoreFactorySelfTest.java     |   2 +-
 .../processors/query/h2/IgniteH2Indexing.java   |  32 +--
 .../cache/BinarySerializationQuerySelfTest.java |   5 +-
 .../CacheBinaryKeyConcurrentQueryTest.java      |   2 +-
 .../cache/CacheIndexStreamerTest.java           |   4 +-
 .../CacheOffheapBatchIndexingBaseTest.java      |   2 +-
 .../CacheOperationsWithExpirationTest.java      |   2 +-
 .../cache/CacheQueryBuildValueTest.java         |   4 +-
 .../cache/CacheQueryEvictDataLostTest.java      |   2 +-
 .../cache/CacheQueryFilterExpiredTest.java      |   2 +-
 .../CacheRandomOperationsMultithreadedTest.java |   2 +-
 ...CacheScanPartitionQueryFallbackSelfTest.java |  12 +-
 .../cache/CacheSqlQueryValueCopySelfTest.java   |  18 +-
 .../cache/GridCacheOffHeapSelfTest.java         |   4 +-
 .../GridCacheOffheapIndexEntryEvictTest.java    |   4 +-
 .../cache/GridCacheQuerySimpleBenchmark.java    |   2 +-
 .../cache/GridIndexingWithNoopSwapSelfTest.java |   2 +-
 .../IgniteBinaryObjectFieldsQuerySelfTest.java  |   9 +-
 .../IgniteBinaryObjectQueryArgumentsTest.java   |   4 +-
 ...eBinaryWrappedObjectFieldsQuerySelfTest.java |   3 +-
 .../IgniteCacheAbstractFieldsQuerySelfTest.java |   2 +-
 ...niteCacheAbstractInsertSqlQuerySelfTest.java |   2 +-
 .../cache/IgniteCacheAbstractQuerySelfTest.java |   6 +-
 .../IgniteCacheAbstractSqlDmlQuerySelfTest.java |   2 +-
 .../IgniteCacheCollocatedQuerySelfTest.java     |   6 +-
 ...acheConfigurationPrimitiveTypesSelfTest.java |  14 +-
 .../IgniteCacheCrossCacheJoinRandomTest.java    |   2 +-
 ...acheDistributedJoinCollocatedAndNotTest.java |   2 +-
 ...acheDistributedJoinCustomAffinityMapper.java |   2 +-
 .../IgniteCacheDistributedJoinNoIndexTest.java  |   2 +-
 ...ributedJoinPartitionedAndReplicatedTest.java |   2 +-
 ...CacheDistributedJoinQueryConditionsTest.java |   2 +-
 .../cache/IgniteCacheDistributedJoinTest.java   |   6 +-
 .../IgniteCacheFieldsQueryNoDataSelfTest.java   |   2 +-
 ...teCacheFullTextQueryNodeJoiningSelfTest.java |   6 +-
 ...PartitionedAndReplicatedCollocationTest.java |   2 +-
 ...teCacheJoinPartitionedAndReplicatedTest.java |   2 +-
 ...IgniteCacheJoinQueryWithAffinityKeyTest.java |   2 +-
 .../cache/IgniteCacheLargeResultSelfTest.java   |   4 +-
 ...eLockPartitionOnAffinityRunAbstractTest.java |   4 +
 .../IgniteCacheMultipleIndexedTypesTest.java    |   2 +-
 .../IgniteCacheObjectKeyIndexingSelfTest.java   |   6 +-
 .../cache/IgniteCacheOffheapEvictQueryTest.java |   2 +-
 .../cache/IgniteCacheOffheapIndexScanTest.java  |   4 +-
 ...hePartitionedQueryMultiThreadedSelfTest.java |   4 +-
 .../cache/IgniteCacheQueriesLoadTest1.java      |   2 +-
 .../IgniteCacheQueryH2IndexingLeakTest.java     |   4 +-
 .../cache/IgniteCacheQueryIndexSelfTest.java    |   4 +-
 .../cache/IgniteCacheQueryLoadSelfTest.java     |  14 +-
 .../IgniteCacheQueryMultiThreadedSelfTest.java  |  15 +-
 ...gniteCacheSqlQueryMultiThreadedSelfTest.java |   6 +-
 .../IgniteCacheStarvationOnRebalanceTest.java   |   2 +-
 ...ClientReconnectCacheQueriesFailoverTest.java |  10 +-
 .../cache/IgniteCrossCachesJoinsQueryTest.java  |   2 +-
 .../cache/QueryEntityCaseMismatchTest.java      |   2 +-
 .../cache/SqlFieldsQuerySelfTest.java           |   2 +-
 ...niteCacheDistributedQueryCancelSelfTest.java |   6 +-
 ...butedQueryStopOnCancelOrTimeoutSelfTest.java |   6 +-
 .../IgniteCachePartitionedQuerySelfTest.java    |   2 +-
 .../IgniteCacheQueryNoRebalanceSelfTest.java    |   4 +-
 .../near/IgniteCacheQueryNodeFailTest.java      |   4 +-
 .../IgniteCacheQueryNodeRestartSelfTest.java    |   2 +-
 .../DynamicIndexAbstractConcurrentSelfTest.java |   5 +-
 ...eCacheLocalQueryCancelOrTimeoutSelfTest.java |   6 +-
 .../cache/ttl/CacheTtlAbstractSelfTest.java     |   6 +-
 .../query/IgniteQueryDedicatedPoolTest.java     |   2 +-
 .../query/IgniteSqlDistributedJoinSelfTest.java |   2 +-
 .../query/IgniteSqlSchemaIndexingTest.java      |   2 +-
 .../query/IgniteSqlSplitterSelfTest.java        |   2 +-
 .../h2/GridIndexingSpiAbstractSelfTest.java     |   4 +-
 .../query/h2/IgniteSqlQueryMinMaxTest.java      |   4 +-
 .../query/h2/sql/GridQueryParsingTest.java      |   7 +-
 .../stream/jms11/IgniteJmsStreamerTest.java     |  28 +--
 ...CacheJtaConfigurationValidationSelfTest.java |   2 +-
 ...CacheJtaFactoryConfigValidationSelfTest.java |   2 +-
 ...titionedCacheJtaLookupClassNameSelfTest.java |   2 +-
 .../kafka/KafkaIgniteStreamerSelfTest.java      |   8 +-
 .../stream/mqtt/IgniteMqttStreamerTest.java     |  12 +-
 .../Binary/BinaryCompactFooterInteropTest.cs    |   2 +-
 .../Binary/BinaryDynamicRegistrationTest.cs     |  18 +-
 .../Binary/JavaBinaryInteropTest.cs             |   6 +-
 .../BinaryConfigurationTest.cs                  |   2 +-
 .../Cache/Affinity/AffinityFieldTest.cs         |   4 +-
 .../Cache/Affinity/AffinityTest.cs              |   4 +-
 .../Cache/CacheConfigurationTest.cs             |  11 +-
 .../Cache/CacheForkedTest.cs                    |   2 +-
 .../Cache/CacheNearTest.cs                      |  34 +++-
 .../Cache/Query/CacheLinqTest.cs                |  23 ++-
 .../Compute/CancellationTest.cs                 |   4 +-
 .../Compute/ComputeApiTest.cs                   |  30 +--
 .../Config/Compute/compute-grid1.xml            |   1 +
 .../Config/Compute/compute-standalone.xml       |   4 +-
 .../Config/cache-binarizables.xml               |   4 +-
 .../native-client-test-cache-affinity.xml       |   1 +
 .../Apache.Ignite.Core.Tests/EventsTest.cs      |  13 +-
 .../IgniteStartStopTest.cs                      |   2 +-
 .../Apache.Ignite.Core.Tests/MarshallerTest.cs  |  24 ++-
 .../Apache.Ignite.Core.Tests/TestUtils.cs       |   4 +-
 .../dotnet/Apache.Ignite.Core/IIgnite.cs        |   3 +-
 .../Apache.Ignite.Core/Impl/Compute/Compute.cs  |  12 ++
 .../Impl/Compute/ComputeImpl.cs                 |   2 +
 .../dotnet/Apache.Ignite.Core/Impl/Ignite.cs    |  14 ++
 .../scala/org/apache/ignite/scalar/scalar.scala |  19 +-
 .../scalar/src/test/resources/spring-cache.xml  |   1 +
 .../scalar/tests/ScalarCacheQueriesSpec.scala   |   2 +-
 .../spark/JavaEmbeddedIgniteRDDSelfTest.java    |   2 +-
 .../spark/JavaStandaloneIgniteRDDSelfTest.java  |   2 +-
 .../spring/GridSpringCacheManagerSelfTest.java  |   6 +-
 .../jdbc/CacheJdbcBlobStoreFactorySelfTest.java |   2 +-
 .../jdbc/CacheJdbcPojoStoreFactorySelfTest.java |   4 +-
 .../internal/IgniteDynamicCacheConfigTest.java  |   2 +-
 .../GridTransformSpringInjectionSelfTest.java   |   2 +-
 .../p2p/GridP2PUserVersionChangeSelfTest.java   |   8 +-
 .../IgniteStartFromStreamConfigurationTest.java |   4 +-
 .../GridSpringTransactionManagerSelfTest.java   |   2 +-
 .../twitter/IgniteTwitterStreamerTest.java      |   8 +-
 .../cache/VisorCacheClearCommandSpec.scala      |  24 +--
 .../commands/cache/VisorCacheCommandSpec.scala  |   2 +-
 .../cache/VisorCacheResetCommandSpec.scala      |   8 +-
 .../stream/zeromq/IgniteZeroMqStreamerTest.java |  12 +-
 661 files changed, 3189 insertions(+), 3044 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/examples/config/example-cache.xml
----------------------------------------------------------------------
diff --git a/examples/config/example-cache.xml b/examples/config/example-cache.xml
index 98e1a71..b0d13f4 100644
--- a/examples/config/example-cache.xml
+++ b/examples/config/example-cache.xml
@@ -41,6 +41,7 @@
             <list>
                 <!-- Partitioned cache example configuration (Atomic mode). -->
                 <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="default"/>
                     <property name="atomicityMode" value="ATOMIC"/>
                     <property name="backups" value="1"/>
                 </bean>

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/cache/JmhCacheAbstractBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/cache/JmhCacheAbstractBenchmark.java b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/cache/JmhCacheAbstractBenchmark.java
index 3d50b12..bb919f1 100644
--- a/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/cache/JmhCacheAbstractBenchmark.java
+++ b/modules/benchmarks/src/main/java/org/apache/ignite/internal/benchmarks/jmh/cache/JmhCacheAbstractBenchmark.java
@@ -64,6 +64,9 @@ public class JmhCacheAbstractBenchmark extends JmhAbstractBenchmark {
     /** IP finder shared across nodes. */
     private static final TcpDiscoveryVmIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
 
+    /** Default cache name. */
+    private static final String DEFAULT_CACHE_NAME = "default";
+
     /** Target node. */
     protected Ignite node;
 
@@ -116,7 +119,7 @@ public class JmhCacheAbstractBenchmark extends JmhAbstractBenchmark {
             node = Ignition.start(clientCfg);
         }
 
-        cache = node.cache(null);
+        cache = node.cache(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -159,7 +162,7 @@ public class JmhCacheAbstractBenchmark extends JmhAbstractBenchmark {
     protected CacheConfiguration cacheConfiguration() {
         CacheConfiguration cacheCfg = new CacheConfiguration();
 
-        cacheCfg.setName(null);
+        cacheCfg.setName(DEFAULT_CACHE_NAME);
         cacheCfg.setCacheMode(CacheMode.PARTITIONED);
         cacheCfg.setRebalanceMode(CacheRebalanceMode.SYNC);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/camel/src/test/java/org/apache/ignite/stream/camel/IgniteCamelStreamerTest.java
----------------------------------------------------------------------
diff --git a/modules/camel/src/test/java/org/apache/ignite/stream/camel/IgniteCamelStreamerTest.java b/modules/camel/src/test/java/org/apache/ignite/stream/camel/IgniteCamelStreamerTest.java
index 6940ea2..88b7eb8 100644
--- a/modules/camel/src/test/java/org/apache/ignite/stream/camel/IgniteCamelStreamerTest.java
+++ b/modules/camel/src/test/java/org/apache/ignite/stream/camel/IgniteCamelStreamerTest.java
@@ -107,7 +107,7 @@ public class IgniteCamelStreamerTest extends GridCommonAbstractTest {
         }
 
         // create Camel streamer
-        dataStreamer = grid().dataStreamer(null);
+        dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME);
         streamer = createCamelStreamer(dataStreamer);
     }
 
@@ -121,7 +121,7 @@ public class IgniteCamelStreamerTest extends GridCommonAbstractTest {
 
         dataStreamer.close();
 
-        grid().cache(null).clear();
+        grid().cache(DEFAULT_CACHE_NAME).clear();
     }
 
     /**
@@ -391,7 +391,7 @@ public class IgniteCamelStreamerTest extends GridCommonAbstractTest {
             }
         };
 
-        remoteLsnr = ignite.events(ignite.cluster().forCacheNodes(null))
+        remoteLsnr = ignite.events(ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME))
             .remoteListen(callback, null, EVT_CACHE_OBJECT_PUT);
 
         return latch;
@@ -402,7 +402,7 @@ public class IgniteCamelStreamerTest extends GridCommonAbstractTest {
      */
     private void assertCacheEntriesLoaded(int cnt) {
         // get the cache and check that the entries are present
-        IgniteCache<Integer, String> cache = grid().cache(null);
+        IgniteCache<Integer, String> cache = grid().cache(DEFAULT_CACHE_NAME);
 
         // for each key from 0 to count from the TEST_DATA (ordered by key), check that the entry is present in cache
         for (Integer key : new ArrayList<>(new TreeSet<>(TEST_DATA.keySet())).subList(0, cnt))
@@ -412,7 +412,7 @@ public class IgniteCamelStreamerTest extends GridCommonAbstractTest {
         assertEquals(cnt, cache.size(CachePeekMode.ALL));
 
         // remove the event listener
-        grid().events(grid().cluster().forCacheNodes(null)).stopRemoteListen(remoteLsnr);
+        grid().events(grid().cluster().forCacheNodes(DEFAULT_CACHE_NAME)).stopRemoteListen(remoteLsnr);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java
index 027574b..ecdbd4a 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java
@@ -47,6 +47,7 @@ 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 org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -179,7 +180,7 @@ public abstract class ClientAbstractMultiThreadedSelfTest extends GridCommonAbst
 
         c.setDiscoverySpi(disco);
 
-        c.setCacheConfiguration(cacheConfiguration(null), cacheConfiguration(PARTITIONED_CACHE_NAME),
+        c.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME), cacheConfiguration(PARTITIONED_CACHE_NAME),
             cacheConfiguration(REPLICATED_CACHE_NAME), cacheConfiguration(PARTITIONED_ASYNC_BACKUP_CACHE_NAME),
             cacheConfiguration(REPLICATED_ASYNC_CACHE_NAME));
 
@@ -191,31 +192,35 @@ public abstract class ClientAbstractMultiThreadedSelfTest extends GridCommonAbst
      * @return Cache configuration.
      * @throws Exception In case of error.
      */
-    private CacheConfiguration cacheConfiguration(@Nullable String cacheName) throws Exception {
+    private CacheConfiguration cacheConfiguration(@NotNull String cacheName) throws Exception {
         CacheConfiguration cfg = defaultCacheConfiguration();
 
         cfg.setAffinity(new RendezvousAffinityFunction());
 
         cfg.setAtomicityMode(TRANSACTIONAL);
 
-        if (cacheName == null)
-            cfg.setCacheMode(LOCAL);
-        else if (PARTITIONED_CACHE_NAME.equals(cacheName)) {
-            cfg.setCacheMode(PARTITIONED);
-
-            cfg.setBackups(0);
-        }
-        else if (PARTITIONED_ASYNC_BACKUP_CACHE_NAME.equals(cacheName)) {
-            cfg.setCacheMode(PARTITIONED);
-
-            cfg.setBackups(1);
+        switch (cacheName) {
+            case DEFAULT_CACHE_NAME:
+                cfg.setCacheMode(LOCAL);
+                break;
+            case PARTITIONED_CACHE_NAME:
+                cfg.setCacheMode(PARTITIONED);
+
+                cfg.setBackups(0);
+                break;
+            case PARTITIONED_ASYNC_BACKUP_CACHE_NAME:
+                cfg.setCacheMode(PARTITIONED);
+
+                cfg.setBackups(1);
+                break;
+            default:
+                cfg.setCacheMode(REPLICATED);
+                break;
         }
-        else
-            cfg.setCacheMode(REPLICATED);
 
         cfg.setName(cacheName);
 
-        if (cacheName != null && !cacheName.contains("async"))
+        if (!DEFAULT_CACHE_NAME.equals(cacheName) && !cacheName.contains("async"))
             cfg.setWriteSynchronizationMode(FULL_SYNC);
 
         return cfg;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientDefaultCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientDefaultCacheSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientDefaultCacheSelfTest.java
index eae4b0e..25fa2e9 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientDefaultCacheSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientDefaultCacheSelfTest.java
@@ -112,7 +112,7 @@ public class ClientDefaultCacheSelfTest extends GridCommonAbstractTest {
 
         cfg.setDiscoverySpi(disco);
 
-        CacheConfiguration cLoc = new CacheConfiguration();
+        CacheConfiguration cLoc = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cLoc.setName(LOCAL_CACHE);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java
index 2fba49a..c97d978 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractMultiNodeSelfTest.java
@@ -73,6 +73,7 @@ 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.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -189,7 +190,7 @@ public abstract class ClientAbstractMultiNodeSelfTest extends GridCommonAbstract
 
         c.setCommunicationSpi(spi);
 
-        c.setCacheConfiguration(cacheConfiguration(null), cacheConfiguration(PARTITIONED_CACHE_NAME),
+        c.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME), cacheConfiguration(PARTITIONED_CACHE_NAME),
             cacheConfiguration(REPLICATED_CACHE_NAME), cacheConfiguration(REPLICATED_ASYNC_CACHE_NAME));
 
         c.setPublicThreadPoolSize(40);
@@ -204,20 +205,24 @@ public abstract class ClientAbstractMultiNodeSelfTest extends GridCommonAbstract
      * @return Cache configuration.
      * @throws Exception In case of error.
      */
-    private CacheConfiguration cacheConfiguration(@Nullable String cacheName) throws Exception {
+    private CacheConfiguration cacheConfiguration(@NotNull String cacheName) throws Exception {
         CacheConfiguration cfg = defaultCacheConfiguration();
 
         cfg.setAtomicityMode(TRANSACTIONAL);
 
-        if (cacheName == null)
-            cfg.setCacheMode(LOCAL);
-        else if (PARTITIONED_CACHE_NAME.equals(cacheName)) {
-            cfg.setCacheMode(PARTITIONED);
-
-            cfg.setBackups(0);
+        switch (cacheName) {
+            case DEFAULT_CACHE_NAME:
+                cfg.setCacheMode(LOCAL);
+                break;
+            case PARTITIONED_CACHE_NAME:
+                cfg.setCacheMode(PARTITIONED);
+
+                cfg.setBackups(0);
+                break;
+            default:
+                cfg.setCacheMode(REPLICATED);
+                break;
         }
-        else
-            cfg.setCacheMode(REPLICATED);
 
         cfg.setName(cacheName);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
index 45cc88a..89eebdf 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/integration/ClientAbstractSelfTest.java
@@ -70,6 +70,7 @@ 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 org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.IgniteSystemProperties.IGNITE_JETTY_PORT;
@@ -162,7 +163,7 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
                 cacheStore.map.clear();
         }
 
-        grid().cache(null).clear();
+        grid().cache(DEFAULT_CACHE_NAME).clear();
         grid().cache(CACHE_NAME).clear();
 
         INTERCEPTED_OBJECTS.clear();
@@ -243,7 +244,7 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
 
         cfg.setDiscoverySpi(disco);
 
-        cfg.setCacheConfiguration(cacheConfiguration(null), cacheConfiguration("replicated"),
+        cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME), cacheConfiguration("replicated"),
             cacheConfiguration("partitioned"), cacheConfiguration(CACHE_NAME));
 
         clientCfg.setMessageInterceptor(new ConnectorMessageInterceptor() {
@@ -274,10 +275,10 @@ public abstract class ClientAbstractSelfTest extends GridCommonAbstractTest {
      * @throws Exception In case of error.
      */
     @SuppressWarnings("unchecked")
-    private  static CacheConfiguration cacheConfiguration(@Nullable final String cacheName) throws Exception {
+    private  static CacheConfiguration cacheConfiguration(@NotNull final String cacheName) throws Exception {
         CacheConfiguration cfg = defaultCacheConfiguration();
 
-        cfg.setCacheMode(cacheName == null || CACHE_NAME.equals(cacheName) ? LOCAL : "replicated".equals(cacheName) ?
+        cfg.setCacheMode(DEFAULT_CACHE_NAME.equals(cacheName) || CACHE_NAME.equals(cacheName) ? LOCAL : "replicated".equals(cacheName) ?
             REPLICATED : PARTITIONED);
         cfg.setName(cacheName);
         cfg.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
index 90f52bd..6ef86d3 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcAbstractDmlStatementSelfTest.java
@@ -36,10 +36,10 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
  */
 public abstract class JdbcAbstractDmlStatementSelfTest extends GridCommonAbstractTest {
     /** JDBC URL. */
-    private static final String BASE_URL = CFG_URL_PREFIX + "modules/clients/src/test/config/jdbc-config.xml";
+    private static final String BASE_URL = CFG_URL_PREFIX + "cache=" + DEFAULT_CACHE_NAME + "@modules/clients/src/test/config/jdbc-config.xml";
 
     /** JDBC URL for tests involving binary objects manipulation. */
-    static final String BASE_URL_BIN = CFG_URL_PREFIX + "modules/clients/src/test/config/jdbc-bin-config.xml";
+    static final String BASE_URL_BIN = CFG_URL_PREFIX + "cache=" + DEFAULT_CACHE_NAME + "@modules/clients/src/test/config/jdbc-bin-config.xml";
 
     /** SQL SELECT query for verification. */
     static final String SQL_SELECT = "select _key, id, firstName, lastName, age from Person";
@@ -64,9 +64,9 @@ public abstract class JdbcAbstractDmlStatementSelfTest extends GridCommonAbstrac
 
     /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
-        conn = DriverManager.getConnection(getCfgUrl());
-
         ignite(0).getOrCreateCache(cacheConfig());
+
+        conn = DriverManager.getConnection(getCfgUrl());
     }
 
     /**
@@ -129,7 +129,7 @@ public abstract class JdbcAbstractDmlStatementSelfTest extends GridCommonAbstrac
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-        grid(0).destroyCache(null);
+        grid(0).destroyCache(DEFAULT_CACHE_NAME);
 
         conn.close();
         assertTrue(conn.isClosed());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcComplexQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcComplexQuerySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcComplexQuerySelfTest.java
index ebda604..725ec3a 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcComplexQuerySelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcComplexQuerySelfTest.java
@@ -32,6 +32,7 @@ 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 org.jetbrains.annotations.NotNull;
 
 import static org.apache.ignite.IgniteJdbcDriver.CFG_URL_PREFIX;
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -46,7 +47,7 @@ public class JdbcComplexQuerySelfTest extends GridCommonAbstractTest {
     private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
 
     /** JDBC URL. */
-    private static final String BASE_URL = CFG_URL_PREFIX + "modules/clients/src/test/config/jdbc-config.xml";
+    private static final String BASE_URL = CFG_URL_PREFIX + "cache=pers@modules/clients/src/test/config/jdbc-config.xml";
 
     /** Statement. */
     private Statement stmt;
@@ -76,7 +77,7 @@ public class JdbcComplexQuerySelfTest extends GridCommonAbstractTest {
      * @param clsV Class v.
      * @return Cache configuration.
      */
-    protected CacheConfiguration cacheConfiguration(String name, Class<?> clsK, Class<?> clsV) {
+    protected CacheConfiguration cacheConfiguration(@NotNull String name, Class<?> clsK, Class<?> clsV) {
         CacheConfiguration<?,?> cache = defaultCacheConfiguration();
 
         cache.setName(name);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcConnectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcConnectionSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcConnectionSelfTest.java
index b999189..39a3648 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcConnectionSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcConnectionSelfTest.java
@@ -30,6 +30,7 @@ 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.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.IgniteJdbcDriver.CFG_URL_PREFIX;
@@ -64,7 +65,7 @@ public class JdbcConnectionSelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        cfg.setCacheConfiguration(cacheConfiguration(null), cacheConfiguration(CUSTOM_CACHE_NAME));
+        cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME), cacheConfiguration(CUSTOM_CACHE_NAME));
 
         TcpDiscoverySpi disco = new TcpDiscoverySpi();
 
@@ -84,7 +85,7 @@ public class JdbcConnectionSelfTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      * @throws Exception In case of error.
      */
-    private CacheConfiguration cacheConfiguration(@Nullable String name) throws Exception {
+    private CacheConfiguration cacheConfiguration(@NotNull String name) throws Exception {
         CacheConfiguration cfg = defaultCacheConfiguration();
 
         cfg.setName(name);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDistributedJoinsQueryTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDistributedJoinsQueryTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDistributedJoinsQueryTest.java
index c71ca94..6756a97 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDistributedJoinsQueryTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDistributedJoinsQueryTest.java
@@ -45,7 +45,7 @@ public class JdbcDistributedJoinsQueryTest extends GridCommonAbstractTest {
     private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
 
     /** JDBC URL. */
-    private static final String BASE_URL = CFG_URL_PREFIX + "distributedJoins=true@modules/clients/src/test/config/jdbc-config.xml";
+    private static final String BASE_URL = CFG_URL_PREFIX + "cache=default:distributedJoins=true@modules/clients/src/test/config/jdbc-config.xml";
 
     /** Statement. */
     private Statement stmt;
@@ -79,14 +79,14 @@ public class JdbcDistributedJoinsQueryTest extends GridCommonAbstractTest {
     @Override protected void beforeTestsStarted() throws Exception {
         startGrids(3);
 
-        IgniteCache<String, Organization> orgCache = grid(0).cache(null);
+        IgniteCache<String, Organization> orgCache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         assert orgCache != null;
 
         orgCache.put("o1", new Organization(1, "A"));
         orgCache.put("o2", new Organization(2, "B"));
 
-        IgniteCache<String, Person> personCache = grid(0).cache(null);
+        IgniteCache<String, Person> personCache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         assert personCache != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDynamicIndexAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDynamicIndexAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDynamicIndexAbstractSelfTest.java
index 84ffc28..7bbda6f 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDynamicIndexAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcDynamicIndexAbstractSelfTest.java
@@ -148,14 +148,14 @@ public abstract class JdbcDynamicIndexAbstractSelfTest extends JdbcAbstractDmlSt
 
         // Test that local queries on all server nodes use new index.
         for (int i = 0 ; i < 3; i++) {
-            List<List<?>> locRes = ignite(i).cache(null).query(new SqlFieldsQuery("explain select id from " +
+            List<List<?>> locRes = ignite(i).cache(DEFAULT_CACHE_NAME).query(new SqlFieldsQuery("explain select id from " +
                 "Person where id = 5").setLocal(true)).getAll();
 
             assertEquals(F.asList(
                 Collections.singletonList("SELECT\n" +
                     "    ID\n" +
-                    "FROM \"\".PERSON\n" +
-                    "    /* \"\".IDX: ID = 5 */\n" +
+                    "FROM \"default\".PERSON\n" +
+                    "    /* \"default\".IDX: ID = 5 */\n" +
                     "WHERE ID = 5")
             ), locRes);
         }
@@ -203,14 +203,14 @@ public abstract class JdbcDynamicIndexAbstractSelfTest extends JdbcAbstractDmlSt
 
         // Test that no local queries on server nodes use new index.
         for (int i = 0 ; i < 3; i++) {
-            List<List<?>> locRes = ignite(i).cache(null).query(new SqlFieldsQuery("explain select id from " +
+            List<List<?>> locRes = ignite(i).cache(DEFAULT_CACHE_NAME).query(new SqlFieldsQuery("explain select id from " +
                 "Person where id = 5").setLocal(true)).getAll();
 
             assertEquals(F.asList(
                 Collections.singletonList("SELECT\n" +
                     "    ID\n" +
-                    "FROM \"\".PERSON\n" +
-                    "    /* \"\".PERSON.__SCAN_ */\n" +
+                    "FROM \"default\".PERSON\n" +
+                    "    /* \"default\".PERSON.__SCAN_ */\n" +
                     "WHERE ID = 5")
             ), locRes);
         }
@@ -305,7 +305,7 @@ public abstract class JdbcDynamicIndexAbstractSelfTest extends JdbcAbstractDmlSt
      * @return Cache.
      */
     private IgniteCache<String, Person> cache() {
-        return grid(0).cache(null);
+        return grid(0).cache(DEFAULT_CACHE_NAME);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcInsertStatementSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcInsertStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcInsertStatementSelfTest.java
index 9e01bc7..b23f947 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcInsertStatementSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcInsertStatementSelfTest.java
@@ -108,9 +108,9 @@ public class JdbcInsertStatementSelfTest extends JdbcAbstractDmlStatementSelfTes
             }
         }
 
-        grid(0).cache(null).clear();
+        grid(0).cache(DEFAULT_CACHE_NAME).clear();
 
-        assertEquals(0, grid(0).cache(null).size(CachePeekMode.ALL));
+        assertEquals(0, grid(0).cache(DEFAULT_CACHE_NAME).size(CachePeekMode.ALL));
 
         super.afterTest();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMergeStatementSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMergeStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMergeStatementSelfTest.java
index 3c56c92..f4577f5 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMergeStatementSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMergeStatementSelfTest.java
@@ -103,9 +103,9 @@ public class JdbcMergeStatementSelfTest extends JdbcAbstractDmlStatementSelfTest
             }
         }
 
-        grid(0).cache(null).clear();
+        grid(0).cache(DEFAULT_CACHE_NAME).clear();
 
-        assertEquals(0, grid(0).cache(null).size(CachePeekMode.ALL));
+        assertEquals(0, grid(0).cache(DEFAULT_CACHE_NAME).size(CachePeekMode.ALL));
 
         super.afterTest();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
index ebf8874..e382b9d 100755
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcMetadataSelfTest.java
@@ -37,6 +37,7 @@ 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 org.jetbrains.annotations.NotNull;
 
 import static java.sql.Types.INTEGER;
 import static java.sql.Types.OTHER;
@@ -81,7 +82,7 @@ public class JdbcMetadataSelfTest extends GridCommonAbstractTest {
      * @param clsV Class v.
      * @return Cache configuration.
      */
-    protected CacheConfiguration cacheConfiguration(String name, Class<?> clsK, Class<?> clsV) {
+    protected CacheConfiguration cacheConfiguration(@NotNull String name, Class<?> clsK, Class<?> clsV) {
         CacheConfiguration<?,?> cache = defaultCacheConfiguration();
 
         cache.setName(name);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcNoDefaultCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcNoDefaultCacheTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcNoDefaultCacheTest.java
index 4bb2fe8..b28f9dd 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcNoDefaultCacheTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcNoDefaultCacheTest.java
@@ -20,7 +20,9 @@ package org.apache.ignite.internal.jdbc2;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.ResultSet;
+import java.sql.SQLException;
 import java.sql.Statement;
+import java.util.concurrent.Callable;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.configuration.CacheConfiguration;
@@ -28,7 +30,9 @@ import org.apache.ignite.configuration.IgniteConfiguration;
 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.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.IgniteJdbcDriver.CFG_URL_PREFIX;
@@ -72,7 +76,7 @@ public class JdbcNoDefaultCacheTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      * @throws Exception In case of error.
      */
-    private CacheConfiguration cacheConfiguration(@Nullable String name) throws Exception {
+    private CacheConfiguration cacheConfiguration(@NotNull String name) throws Exception {
         CacheConfiguration cfg = defaultCacheConfiguration();
 
         cfg.setIndexedTypes(Integer.class, Integer.class);
@@ -125,39 +129,20 @@ public class JdbcNoDefaultCacheTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testNoCacheNameQuery() throws Exception {
-        Statement stmt;
-
-        try (Connection conn = DriverManager.getConnection(CFG_URL_PREFIX + CFG_URL)) {
-            stmt = conn.createStatement();
-
+        try (
+            Connection conn = DriverManager.getConnection(CFG_URL_PREFIX + CFG_URL);
+            final Statement stmt = conn.createStatement()) {
             assertNotNull(stmt);
             assertFalse(stmt.isClosed());
 
-            stmt.execute("select t._key, t._val from \"cache1\".Integer t");
-
-            ResultSet rs = stmt.getResultSet();
-
-            while(rs.next())
-                assertEquals(rs.getInt(2), rs.getInt(1) * 2);
-
-            stmt.execute("select t._key, t._val from \"cache2\".Integer t");
-
-            rs = stmt.getResultSet();
-
-            while(rs.next())
-                assertEquals(rs.getInt(2), rs.getInt(1) * 3);
-
-            stmt.execute("select t._key, t._val, v._val " +
-                "from \"cache1\".Integer t join \"cache2\".Integer v on t._key = v._key");
-
-            rs = stmt.getResultSet();
-
-            while(rs.next()) {
-                assertEquals(rs.getInt(2), rs.getInt(1) * 2);
-                assertEquals(rs.getInt(3), rs.getInt(1) * 3);
-            }
+            Throwable throwable = GridTestUtils.assertThrows(null, new Callable<Void>() {
+                @Override public Void call() throws Exception {
+                    stmt.execute("select t._key, t._val from \"cache1\".Integer t");
+                    return null;
+                }
+            }, SQLException.class, "Failed to query Ignite.");
 
-            stmt.close();
+            assertEquals(throwable.getCause().getMessage(), "Ouch! Argument is invalid: Cache name must not be null or empty.");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcPreparedStatementSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcPreparedStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcPreparedStatementSelfTest.java
index 67127b0..5e402ff 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcPreparedStatementSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcPreparedStatementSelfTest.java
@@ -63,7 +63,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest {
     private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
 
     /** JDBC URL. */
-    private static final String BASE_URL = CFG_URL_PREFIX + "modules/clients/src/test/config/jdbc-config.xml";
+    private static final String BASE_URL = CFG_URL_PREFIX + "cache=default@modules/clients/src/test/config/jdbc-config.xml";
 
     /** Connection. */
     private Connection conn;
@@ -101,7 +101,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest {
     @Override protected void beforeTestsStarted() throws Exception {
         startGridsMultiThreaded(3);
 
-        IgniteCache<Integer, TestObject> cache = grid(0).cache(null);
+        IgniteCache<Integer, TestObject> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         assert cache != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcResultSetSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcResultSetSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcResultSetSelfTest.java
index 8fb651d..43cd586 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcResultSetSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcResultSetSelfTest.java
@@ -55,7 +55,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest {
     private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
 
     /** JDBC URL. */
-    private static final String BASE_URL = CFG_URL_PREFIX + "modules/clients/src/test/config/jdbc-config.xml";
+    private static final String BASE_URL = CFG_URL_PREFIX + "cache=default@modules/clients/src/test/config/jdbc-config.xml";
 
     /** SQL query. */
     private static final String SQL =
@@ -97,7 +97,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest {
     @Override protected void beforeTestsStarted() throws Exception {
         startGridsMultiThreaded(3);
 
-        IgniteCache<Integer, TestObject> cache = grid(0).cache(null);
+        IgniteCache<Integer, TestObject> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         assert cache != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcStatementSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcStatementSelfTest.java
index 7826987..99e813d 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcStatementSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcStatementSelfTest.java
@@ -45,7 +45,7 @@ public class JdbcStatementSelfTest extends GridCommonAbstractTest {
     private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
 
     /** JDBC URL. */
-    private static final String BASE_URL = CFG_URL_PREFIX + "modules/clients/src/test/config/jdbc-config.xml";
+    private static final String BASE_URL = CFG_URL_PREFIX + "cache=default@modules/clients/src/test/config/jdbc-config.xml";
 
     /** SQL query. */
     private static final String SQL = "select * from Person where age > 30";
@@ -86,7 +86,7 @@ public class JdbcStatementSelfTest extends GridCommonAbstractTest {
     @Override protected void beforeTestsStarted() throws Exception {
         startGridsMultiThreaded(3);
 
-        IgniteCache<String, Person> cache = grid(0).cache(null);
+        IgniteCache<String, Person> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         assert cache != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcStreamingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcStreamingSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcStreamingSelfTest.java
index 6837a41..5c98b1a 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcStreamingSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/jdbc2/JdbcStreamingSelfTest.java
@@ -41,7 +41,7 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
  */
 public class JdbcStreamingSelfTest extends GridCommonAbstractTest {
     /** JDBC URL. */
-    private static final String BASE_URL = CFG_URL_PREFIX + "modules/clients/src/test/config/jdbc-config.xml";
+    private static final String BASE_URL = CFG_URL_PREFIX + "cache=default@modules/clients/src/test/config/jdbc-config.xml";
 
     /** Connection. */
     protected Connection conn;
@@ -121,7 +121,7 @@ public class JdbcStreamingSelfTest extends GridCommonAbstractTest {
     @Override protected void afterTest() throws Exception {
         U.closeQuiet(conn);
 
-        ignite(0).cache(null).clear();
+        ignite(0).cache(DEFAULT_CACHE_NAME).clear();
 
         super.afterTest();
     }
@@ -133,7 +133,7 @@ public class JdbcStreamingSelfTest extends GridCommonAbstractTest {
         conn = createConnection(false);
 
         for (int i = 10; i <= 100; i += 10)
-            ignite(0).cache(null).put(i, i * 100);
+            ignite(0).cache(DEFAULT_CACHE_NAME).put(i, i * 100);
 
         PreparedStatement stmt = conn.prepareStatement("insert into Integer(_key, _val) values (?, ?)");
 
@@ -151,9 +151,9 @@ public class JdbcStreamingSelfTest extends GridCommonAbstractTest {
         // Now let's check it's all there.
         for (int i = 1; i <= 100; i++) {
             if (i % 10 != 0)
-                assertEquals(i, grid(0).cache(null).get(i));
+                assertEquals(i, grid(0).cache(DEFAULT_CACHE_NAME).get(i));
             else // All that divides by 10 evenly should point to numbers 100 times greater - see above
-                assertEquals(i * 100, grid(0).cache(null).get(i));
+                assertEquals(i * 100, grid(0).cache(DEFAULT_CACHE_NAME).get(i));
         }
     }
 
@@ -164,7 +164,7 @@ public class JdbcStreamingSelfTest extends GridCommonAbstractTest {
         conn = createConnection(true);
 
         for (int i = 10; i <= 100; i += 10)
-            ignite(0).cache(null).put(i, i * 100);
+            ignite(0).cache(DEFAULT_CACHE_NAME).put(i, i * 100);
 
         PreparedStatement stmt = conn.prepareStatement("insert into Integer(_key, _val) values (?, ?)");
 
@@ -182,6 +182,6 @@ public class JdbcStreamingSelfTest extends GridCommonAbstractTest {
         // Now let's check it's all there.
         // i should point to i at all times as we've turned overwrites on above.
         for (int i = 1; i <= 100; i++)
-            assertEquals(i, grid(0).cache(null).get(i));
+            assertEquals(i, grid(0).cache(DEFAULT_CACHE_NAME).get(i));
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java
index 5baac62..712b71a 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/AbstractRestProcessorSelfTest.java
@@ -100,6 +100,6 @@ abstract class AbstractRestProcessorSelfTest extends GridCommonAbstractTest {
      * @return Cache.
      */
     @Override protected <K, V> IgniteCache<K, V> jcache() {
-        return grid(0).cache(null);
+        return grid(0).cache(DEFAULT_CACHE_NAME);
     }
 }


[19/51] [abbrv] ignite git commit: ignite-4799 TcpDiscoverySpi: removed missedHeartbeats properties, heartbeatFrequency (instead use IgiteConfiguration.metricsUpdateFrequency). Added IgiteConfiguration.clientFailureDetectionTimeout.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
index 524fdcf..4b61199 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpiSelfTest.java
@@ -73,7 +73,6 @@ import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeAddedMessage
 import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jetbrains.annotations.Nullable;
-
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.MINUTES;
 import static org.apache.ignite.events.EventType.EVT_CLIENT_NODE_DISCONNECTED;
@@ -142,7 +141,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
     private boolean longSockTimeouts;
 
     /** */
-    private int maxMissedClientHbs = TcpDiscoverySpi.DFLT_MAX_MISSED_CLIENT_HEARTBEATS;
+    private long clientFailureDetectionTimeout = 1000;
 
     /** */
     private IgniteInClosure2X<TcpDiscoveryAbstractMessage, Socket> afterWrite;
@@ -154,9 +153,9 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        TcpDiscoverySpi disco = getDiscoverySpi();
+        cfg.setClientFailureDetectionTimeout(clientFailureDetectionTimeout());
 
-        disco.setMaxMissedClientHeartbeats(maxMissedClientHbs);
+        TcpDiscoverySpi disco = getDiscoverySpi();
 
         if (igniteInstanceName.startsWith("server"))
             disco.setIpFinder(IP_FINDER);
@@ -269,12 +268,21 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Gets client failure detection timeout to use.
+     *
+     * @return Client failure detection timeout.
+     */
+    protected long clientFailureDetectionTimeout() {
+        return clientFailureDetectionTimeout;
+    }
+
+    /**
      * Gets failure detection timeout to use.
      *
      * @return Failure detection timeout.
      */
     protected long failureDetectionTimeout() {
-        return 0;
+        return 500;
     }
 
     /**
@@ -301,6 +309,21 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
     /**
      * @throws Exception If failed.
      */
+    public void testClientToClientPing() throws Exception {
+        startGrid("server-p1");
+        Ignite c1 = startGrid("client-p1");
+
+        startGrid("server-p2");
+        Ignite c2 = startGrid("client-p2");
+
+        boolean res = ((IgniteEx)c1).context().discovery().pingNode(c2.cluster().localNode().id());
+
+        assertTrue(res);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testClientNodeJoin() throws Exception {
         startServerNodes(3);
         startClientNodes(3);
@@ -358,8 +381,8 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
 
         failClient(2);
 
-        await(srvFailedLatch);
-        await(clientFailedLatch);
+        awaitClient(srvFailedLatch);
+        awaitClient(clientFailedLatch);
 
         checkNodes(3, 2);
     }
@@ -588,7 +611,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testClientReconnectTopologyChange1() throws Exception {
-        maxMissedClientHbs = 100;
+        clientFailureDetectionTimeout = 100000;
 
         clientsPerSrv = 1;
 
@@ -632,7 +655,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testClientReconnectTopologyChange2() throws Exception {
-        maxMissedClientHbs = 100;
+        clientFailureDetectionTimeout = 100000;
 
         clientsPerSrv = 1;
 
@@ -744,8 +767,8 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
 
             failServer(2);
 
-            await(srvFailedLatch);
-            await(clientFailedLatch);
+            awaitClient(srvFailedLatch);
+            awaitClient(clientFailedLatch);
 
             await(client2StoppedLatch);
 
@@ -796,6 +819,8 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Test that server not fire client failure event after failure detection timeout.
+     *
      * @throws Exception If failed.
      */
     public void testClientNodeFailOneServer() throws Exception {
@@ -843,8 +868,8 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
         failClient(1);
         failServer(1);
 
-        await(srvFailedLatch);
-        await(clientFailedLatch);
+        awaitClient(srvFailedLatch);
+        awaitClient(clientFailedLatch);
 
         checkNodes(1, 1);
     }
@@ -1631,7 +1656,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
         assertFalse(err.get());
 
         if (!failSrv) {
-            await(srvFailedLatch);
+            awaitClient(srvFailedLatch);
 
             GridTestUtils.waitForCondition(new GridAbsPredicate() {
                 @Override public boolean apply() {
@@ -1721,7 +1746,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
     public void testDisconnectAfterNetworkTimeout() throws Exception {
         netTimeout = 5000;
         joinTimeout = 60_000;
-        maxMissedClientHbs = 2;
+        clientFailureDetectionTimeout = 2000;
 
         startServerNodes(1);
 
@@ -1774,7 +1799,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
 
         clientSpi.brakeConnection();
 
-        assertTrue(disconnectLatch.await(awaitTime(), MILLISECONDS));
+        assertTrue(disconnectLatch.await(awaitClientTime(), MILLISECONDS));
 
         log.info("Fail client connection2.");
 
@@ -1793,7 +1818,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
             @Override public boolean apply() {
                 return srv.cluster().nodes().size() == 2;
             }
-        }, awaitTime());
+        }, awaitClientTime());
 
         checkNodes(1, 1);
 
@@ -2076,6 +2101,15 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * @param latch Latch.
+     * @throws InterruptedException If interrupted.
+     */
+    private void awaitClient(CountDownLatch latch) throws InterruptedException {
+        assertTrue("Failed to wait for latch, latch count: " + latch.getCount(),
+            latch.await(awaitClientTime(), MILLISECONDS));
+    }
+
+    /**
      * Time to wait for operation completion.
      *
      * @return Time in milliseconds.
@@ -2085,6 +2119,15 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Time to wait for client operation completion.
+     *
+     * @return Time in milliseconds.
+     */
+    protected long awaitClientTime() {
+        return 20_000;
+    }
+
+    /**
      */
     private static class MessageListener implements IgniteBiPredicate<UUID, Object> {
         /** */
@@ -2267,7 +2310,7 @@ public class TcpClientDiscoverySpiSelfTest extends GridCommonAbstractTest {
             IgniteSpiOperationTimeoutHelper timeoutHelper) throws IOException, IgniteSpiOperationTimeoutException {
             waitFor(openSockLock);
 
-            return super.openSocket(sockAddr, new IgniteSpiOperationTimeoutHelper(this));
+            return super.openSocket(sockAddr, timeoutHelper);
         }
 
         /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
index c6d1147..f8f9baf 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java
@@ -78,7 +78,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMultic
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCustomEventMessage;
-import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryHeartbeatMessage;
+import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryMetricsUpdateMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeAddFinishedMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeAddedMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeFailedMessage;
@@ -154,16 +154,14 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
 
         spi.setNetworkTimeout(2500);
 
-        spi.setHeartbeatFrequency(1000);
-
-        spi.setMaxMissedHeartbeats(3);
-
         spi.setIpFinderCleanFrequency(5000);
 
         spi.setJoinTimeout(5000);
 
         cfg.setDiscoverySpi(spi);
 
+        cfg.setFailureDetectionTimeout(7500);
+
         if (ccfgs != null)
             cfg.setCacheConfiguration(ccfgs);
         else
@@ -173,12 +171,16 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
 
         cfg.setIncludeProperties();
 
+        cfg.setMetricsUpdateFrequency(1000);
+
         if (!igniteInstanceName.contains("LoopbackProblemTest"))
             cfg.setLocalHost("127.0.0.1");
 
         if (igniteInstanceName.contains("testFailureDetectionOnNodePing")) {
             spi.setReconnectCount(1); // To make test faster: on Windows 1 connect takes 1 second.
-            spi.setHeartbeatFrequency(40000);
+
+            cfg.setMetricsUpdateFrequency(40000);
+            cfg.setClientFailureDetectionTimeout(41000);
         }
 
         cfg.setConnectorConfiguration(null);
@@ -433,7 +435,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
 
         assertFalse("Ping is ok for node " + failedNodeId + ", but had to fail.", res);
 
-        // Heartbeat interval is 40 seconds, but we should detect node failure faster.
+        // Metrics update interval is 40 seconds, but we should detect node failure faster.
         assert cnt.await(7, SECONDS);
     }
 
@@ -2252,7 +2254,7 @@ public class TcpDiscoverySelfTest extends GridCommonAbstractTest {
             long timeout) throws IOException, IgniteCheckedException {
             boolean add = msgIds.add(msg.id());
 
-            if (checkDuplicates && !add && !(msg instanceof TcpDiscoveryHeartbeatMessage)) {
+            if (checkDuplicates && !add && !(msg instanceof TcpDiscoveryMetricsUpdateMessage)) {
                 log.error("Send duplicated message: " + msg);
 
                 failed = true;

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiConfigSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiConfigSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiConfigSelfTest.java
index c349e5f..ea1bb27 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiConfigSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiConfigSelfTest.java
@@ -40,9 +40,7 @@ public class TcpDiscoverySpiConfigSelfTest extends GridSpiAbstractConfigTest<Tcp
         checkNegativeSpiProperty(new TcpDiscoverySpi(), "ackTimeout", 0);
         checkNegativeSpiProperty(new TcpDiscoverySpi(), "maxAckTimeout", 0);
         checkNegativeSpiProperty(new TcpDiscoverySpi(), "reconnectCount", 0);
-        checkNegativeSpiProperty(new TcpDiscoverySpi(), "heartbeatFrequency", 0);
         checkNegativeSpiProperty(new TcpDiscoverySpi(), "threadPriority", -1);
-        checkNegativeSpiProperty(new TcpDiscoverySpi(), "maxMissedHeartbeats", 0);
         checkNegativeSpiProperty(new TcpDiscoverySpi(), "statisticsPrintFrequency", 0);
     }
 
@@ -65,4 +63,4 @@ public class TcpDiscoverySpiConfigSelfTest extends GridSpiAbstractConfigTest<Tcp
             stopAllGrids();
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
index a218bcb..cb5e84b 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiFailureTimeoutSelfTest.java
@@ -24,7 +24,6 @@ import java.net.Socket;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.cluster.ClusterNode;
 import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.lang.IgniteProductVersion;
 import org.apache.ignite.spi.IgniteSpiOperationTimeoutException;
 import org.apache.ignite.spi.IgniteSpiOperationTimeoutHelper;
 import org.apache.ignite.spi.discovery.AbstractDiscoverySelfTest;
@@ -93,6 +92,11 @@ public class TcpDiscoverySpiFailureTimeoutSelfTest extends AbstractDiscoverySelf
                 firstSpi().failureDetectionTimeout());
         assertEquals(IgniteConfiguration.DFLT_FAILURE_DETECTION_TIMEOUT.longValue(),
                 secondSpi().failureDetectionTimeout());
+
+        assertEquals(IgniteConfiguration.DFLT_CLIENT_FAILURE_DETECTION_TIMEOUT.longValue(),
+            firstSpi().clientFailureDetectionTimeout());
+        assertEquals(IgniteConfiguration.DFLT_CLIENT_FAILURE_DETECTION_TIMEOUT.longValue(),
+            secondSpi().clientFailureDetectionTimeout());
     }
 
     /**
@@ -102,6 +106,7 @@ public class TcpDiscoverySpiFailureTimeoutSelfTest extends AbstractDiscoverySelf
         for (int i = 2; i < spis.size(); i++) {
             assertFalse(((TcpDiscoverySpi)spis.get(i)).failureDetectionTimeoutEnabled());
             assertEquals(0, ((TcpDiscoverySpi)spis.get(i)).failureDetectionTimeout());
+            assertFalse(0 == ((TcpDiscoverySpi)spis.get(i)).clientFailureDetectionTimeout());
         }
     }
 
@@ -112,14 +117,14 @@ public class TcpDiscoverySpiFailureTimeoutSelfTest extends AbstractDiscoverySelf
         try {
             ClusterNode node = secondSpi().getLocalNode();
 
-            firstSpi().openSocketTimeout = true;
+            firstSpi().openSockTimeout = true;
 
             assertFalse(firstSpi().pingNode(node.id()));
             assertTrue(firstSpi().validTimeout);
             assertTrue(firstSpi().err.getMessage().equals("Timeout: openSocketTimeout"));
 
-            firstSpi().openSocketTimeout = false;
-            firstSpi().openSocketTimeoutWait = true;
+            firstSpi().openSockTimeout = false;
+            firstSpi().openSockTimeoutWait = true;
 
             assertFalse(firstSpi().pingNode(node.id()));
             assertTrue(firstSpi().validTimeout);
@@ -138,12 +143,12 @@ public class TcpDiscoverySpiFailureTimeoutSelfTest extends AbstractDiscoverySelf
         try {
             ClusterNode node = secondSpi().getLocalNode();
 
-            firstSpi().writeToSocketTimeoutWait = true;
+            firstSpi().writeToSockTimeoutWait = true;
 
             assertFalse(firstSpi().pingNode(node.id()));
             assertTrue(firstSpi().validTimeout);
 
-            firstSpi().writeToSocketTimeoutWait = false;
+            firstSpi().writeToSockTimeoutWait = false;
 
             assertTrue(firstSpi().pingNode(node.id()));
             assertTrue(firstSpi().validTimeout);
@@ -178,13 +183,13 @@ public class TcpDiscoverySpiFailureTimeoutSelfTest extends AbstractDiscoverySelf
 
             assert nextSpi.connCheckStatusMsgCntReceived == 0;
 
-            firstSpi().countConnCheckMsg = true;
-            nextSpi.countConnCheckMsg = true;
+            firstSpi().cntConnCheckMsg = true;
+            nextSpi.cntConnCheckMsg = true;
 
             Thread.sleep(firstSpi().failureDetectionTimeout());
 
-            firstSpi().countConnCheckMsg = false;
-            nextSpi.countConnCheckMsg = false;
+            firstSpi().cntConnCheckMsg = false;
+            nextSpi.cntConnCheckMsg = false;
 
             int sent = firstSpi().connCheckStatusMsgCntSent;
             int received = nextSpi.connCheckStatusMsgCntReceived;
@@ -224,16 +229,16 @@ public class TcpDiscoverySpiFailureTimeoutSelfTest extends AbstractDiscoverySelf
      */
     private static class TestTcpDiscoverySpi extends TcpDiscoverySpi {
         /** */
-        private volatile boolean openSocketTimeout;
+        private volatile boolean openSockTimeout;
 
         /** */
-        private volatile boolean openSocketTimeoutWait;
+        private volatile boolean openSockTimeoutWait;
 
         /** */
-        private volatile boolean writeToSocketTimeoutWait;
+        private volatile boolean writeToSockTimeoutWait;
 
         /** */
-        private volatile boolean countConnCheckMsg;
+        private volatile boolean cntConnCheckMsg;
 
         /** */
         private volatile int connCheckStatusMsgCntSent;
@@ -253,11 +258,11 @@ public class TcpDiscoverySpiFailureTimeoutSelfTest extends AbstractDiscoverySelf
             IgniteSpiOperationTimeoutHelper timeoutHelper)
             throws IOException, IgniteSpiOperationTimeoutException {
 
-            if (openSocketTimeout) {
+            if (openSockTimeout) {
                 err = new IgniteSpiOperationTimeoutException("Timeout: openSocketTimeout");
                 throw err;
             }
-            else if (openSocketTimeoutWait) {
+            else if (openSockTimeoutWait) {
                 long timeout = timeoutHelper.nextTimeoutChunk(0);
 
                 try {
@@ -291,7 +296,7 @@ public class TcpDiscoverySpiFailureTimeoutSelfTest extends AbstractDiscoverySelf
         @Override protected void writeToSocket(Socket sock, OutputStream out, TcpDiscoveryAbstractMessage msg, long timeout)
             throws IOException, IgniteCheckedException {
             if (!(msg instanceof TcpDiscoveryPingRequest)) {
-                if (countConnCheckMsg && msg instanceof TcpDiscoveryConnectionCheckMessage)
+                if (cntConnCheckMsg && msg instanceof TcpDiscoveryConnectionCheckMessage)
                     connCheckStatusMsgCntSent++;
 
                 super.writeToSocket(sock, out, msg, timeout);
@@ -305,7 +310,7 @@ public class TcpDiscoverySpiFailureTimeoutSelfTest extends AbstractDiscoverySelf
                 throw new IgniteCheckedException("Invalid timeout: " + timeout);
             }
 
-            if (writeToSocketTimeoutWait) {
+            if (writeToSockTimeoutWait) {
                 try {
                     Thread.sleep(timeout);
                 }
@@ -320,7 +325,7 @@ public class TcpDiscoverySpiFailureTimeoutSelfTest extends AbstractDiscoverySelf
         /** {@inheritDoc} */
         protected void writeToSocket(TcpDiscoveryAbstractMessage msg, Socket sock, int res, long timeout)
             throws IOException {
-            if (countConnCheckMsg && msg instanceof TcpDiscoveryConnectionCheckMessage)
+            if (cntConnCheckMsg && msg instanceof TcpDiscoveryConnectionCheckMessage)
                 connCheckStatusMsgCntReceived++;
 
             super.writeToSocket(msg, sock, res, timeout);
@@ -330,14 +335,14 @@ public class TcpDiscoverySpiFailureTimeoutSelfTest extends AbstractDiscoverySelf
          *
          */
         private void resetState() {
-            openSocketTimeout = false;
-            openSocketTimeoutWait = false;
-            writeToSocketTimeoutWait = false;
+            openSockTimeout = false;
+            openSockTimeoutWait = false;
+            writeToSockTimeoutWait = false;
             err = null;
             validTimeout = true;
             connCheckStatusMsgCntSent = 0;
             connCheckStatusMsgCntReceived = 0;
-            countConnCheckMsg = false;
+            cntConnCheckMsg = false;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/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 8a7150d..d080b54 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
@@ -1467,19 +1467,19 @@ public abstract class GridAbstractTest extends TestCase {
         TcpDiscoverySpi discoSpi = new TestTcpDiscoverySpi();
 
         if (isDebug()) {
-            discoSpi.setMaxMissedHeartbeats(Integer.MAX_VALUE);
+            cfg.setFailureDetectionTimeout(Integer.MAX_VALUE);
             cfg.setNetworkTimeout(Long.MAX_VALUE / 3);
         }
         else {
             // Set network timeout to 10 sec to avoid unexpected p2p class loading errors.
             cfg.setNetworkTimeout(10000);
 
-            // Increase max missed heartbeats to avoid unexpected node fails.
-            discoSpi.setMaxMissedHeartbeats(30);
+            // Increase failure detection timeoute to avoid unexpected node fails.
+            cfg.setFailureDetectionTimeout(300000);
         }
 
-        // Set heartbeat interval to 1 second to speed up tests.
-        discoSpi.setHeartbeatFrequency(1000);
+        // Set metrics update interval to 1 second to speed up tests.
+        cfg.setMetricsUpdateFrequency(1000);
 
         String mcastAddr = GridTestUtils.getNextMulticastGroup(getClass());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/test/webapp/META-INF/ignite-webapp-config.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/webapp/META-INF/ignite-webapp-config.xml b/modules/core/src/test/webapp/META-INF/ignite-webapp-config.xml
index cb781e0..429ff15 100644
--- a/modules/core/src/test/webapp/META-INF/ignite-webapp-config.xml
+++ b/modules/core/src/test/webapp/META-INF/ignite-webapp-config.xml
@@ -208,7 +208,6 @@
                         <property name="bucketName" value="YOUR_BUCKET_NAME_IP_FINDER"/>
                     </bean>
                 </property>
-                <property name="heartbeatFrequency" value="2000"/>
             </bean>
         </property>
         -->

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheMetricsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheMetricsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheMetricsTest.cs
index fd5822a..b409a5a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheMetricsTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheMetricsTest.cs
@@ -21,7 +21,6 @@ namespace Apache.Ignite.Core.Tests.Cache
     using System.Threading;
     using Apache.Ignite.Core.Cache;
     using Apache.Ignite.Core.Cache.Configuration;
-    using Apache.Ignite.Core.Discovery.Tcp;
     using Apache.Ignite.Core.Impl;
     using Apache.Ignite.Core.Impl.Cache;
     using NUnit.Framework;
@@ -228,7 +227,7 @@ namespace Apache.Ignite.Core.Tests.Cache
             localCache.Put(localKey, 1);
             localCache.Get(localKey);
             // Wait for metrics to propagate.
-            Thread.Sleep(TcpDiscoverySpi.DefaultHeartbeatFrequency);
+            Thread.Sleep(IgniteConfiguration.DefaultMetricsUpdateFrequency);
 
             var localMetrics = func(localCache);
             Assert.IsTrue(localMetrics.IsStatisticsEnabled);

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index 31dd887..0524c05 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -726,7 +726,6 @@ namespace Apache.Ignite.Core.Tests
                     },
                     ClientReconnectDisabled = true,
                     ForceServerMode = true,
-                    HeartbeatFrequency = TimeSpan.FromSeconds(3),
                     IpFinderCleanFrequency = TimeSpan.FromMinutes(7),
                     LocalAddress = "127.0.0.1",
                     LocalPort = 49900,

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
index 8da2616..b0ed0d2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@ -480,7 +480,6 @@ namespace Apache.Ignite.Core.Tests
                     },
                     ClientReconnectDisabled = true,
                     ForceServerMode = true,
-                    HeartbeatFrequency = TimeSpan.FromSeconds(3),
                     IpFinderCleanFrequency = TimeSpan.FromMinutes(7),
                     LocalAddress = "127.0.0.1",
                     LocalPort = 49900,

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/platforms/dotnet/Apache.Ignite.Core/Discovery/Tcp/TcpDiscoverySpi.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Discovery/Tcp/TcpDiscoverySpi.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Discovery/Tcp/TcpDiscoverySpi.cs
index a99f7b0..bdf5780 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Discovery/Tcp/TcpDiscoverySpi.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Discovery/Tcp/TcpDiscoverySpi.cs
@@ -88,11 +88,6 @@ namespace Apache.Ignite.Core.Discovery.Tcp
         public const int DefaultThreadPriority = 10;
 
         /// <summary>
-        /// Default value for the <see cref="HeartbeatFrequency"/> property.
-        /// </summary>
-        public static readonly TimeSpan DefaultHeartbeatFrequency = TimeSpan.FromSeconds(2);
-        
-        /// <summary>
         /// Default value for the <see cref="TopologyHistorySize"/> property.
         /// </summary>
         public const int DefaultTopologyHistorySize = 1000;
@@ -114,7 +109,6 @@ namespace Apache.Ignite.Core.Discovery.Tcp
             MaxMissedClientHeartbeats = DefaultMaxMissedClientHeartbeats;
             IpFinderCleanFrequency = DefaultIpFinderCleanFrequency;
             ThreadPriority = DefaultThreadPriority;
-            HeartbeatFrequency = DefaultHeartbeatFrequency;
             TopologyHistorySize = DefaultTopologyHistorySize;
         }
 
@@ -143,7 +137,6 @@ namespace Apache.Ignite.Core.Discovery.Tcp
             StatisticsPrintFrequency = reader.ReadLongAsTimespan();
             IpFinderCleanFrequency = reader.ReadLongAsTimespan();
             ThreadPriority = reader.ReadInt();
-            HeartbeatFrequency = reader.ReadLongAsTimespan();
             TopologyHistorySize = reader.ReadInt();
         }
 
@@ -248,13 +241,6 @@ namespace Apache.Ignite.Core.Discovery.Tcp
         public int ThreadPriority { get; set; }
 
         /// <summary>
-        /// Gets or sets delay between issuing of heartbeat messages. SPI sends heartbeat messages
-        /// in configurable time interval to other nodes to notify them about its state.
-        /// </summary>
-        [DefaultValue(typeof(TimeSpan), "0:0:2")]
-        public TimeSpan HeartbeatFrequency { get; set; }
-
-        /// <summary>
         /// Gets or sets the size of topology snapshots history.
         /// </summary>
         [DefaultValue(DefaultTopologyHistorySize)]
@@ -298,7 +284,6 @@ namespace Apache.Ignite.Core.Discovery.Tcp
             writer.WriteLong((long) StatisticsPrintFrequency.TotalMilliseconds);
             writer.WriteLong((long) IpFinderCleanFrequency.TotalMilliseconds);
             writer.WriteInt(ThreadPriority);
-            writer.WriteLong((long) HeartbeatFrequency.TotalMilliseconds);
             writer.WriteInt(TopologyHistorySize);
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index 67f2715..728e62b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -873,11 +873,6 @@
                                 </xs:documentation>
                             </xs:annotation>
                         </xs:attribute>
-                        <xs:attribute name="heartbeatFrequency" type="xs:string">
-                            <xs:annotation>
-                                <xs:documentation>Delay between issuing of heartbeat messages. SPI sends heartbeat messages in configurable time interval to other nodes to notify them about its state.</xs:documentation>
-                            </xs:annotation>
-                        </xs:attribute>
                         <xs:attribute name="ipFinderCleanFrequency" type="xs:string">
                             <xs:annotation>
                                 <xs:documentation>IP finder clean frequency.</xs:documentation>

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/MultiTieredCacheExample.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/MultiTieredCacheExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/MultiTieredCacheExample.cs
index c40814c..f7caa78 100644
--- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/MultiTieredCacheExample.cs
+++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Datagrid/MultiTieredCacheExample.cs
@@ -93,7 +93,7 @@ namespace Apache.Ignite.Examples.Datagrid
 
                 Console.WriteLine(">>> Waiting for metrics final update...");
 
-                Thread.Sleep(TcpDiscoverySpi.DefaultHeartbeatFrequency);
+                Thread.Sleep(IgniteConfiguration.DefaultMetricsUpdateFrequency);
 
                 PrintCacheMetrics(cache);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/urideploy/src/test/java/org/apache/ignite/p2p/GridP2PDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/urideploy/src/test/java/org/apache/ignite/p2p/GridP2PDisabledSelfTest.java b/modules/urideploy/src/test/java/org/apache/ignite/p2p/GridP2PDisabledSelfTest.java
index da51d68..2cfaa46 100644
--- a/modules/urideploy/src/test/java/org/apache/ignite/p2p/GridP2PDisabledSelfTest.java
+++ b/modules/urideploy/src/test/java/org/apache/ignite/p2p/GridP2PDisabledSelfTest.java
@@ -83,7 +83,7 @@ public class GridP2PDisabledSelfTest extends GridCommonAbstractTest {
             cfg.setDeploymentSpi(depSpi);
         }
 
-        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setHeartbeatFrequency(500);
+        cfg.setMetricsUpdateFrequency(500);
 
         return cfg;
     }
@@ -212,4 +212,4 @@ public class GridP2PDisabledSelfTest extends GridCommonAbstractTest {
 
         checkGar();
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/web/src/test/webapp2/META-INF/ignite-webapp-config.xml
----------------------------------------------------------------------
diff --git a/modules/web/src/test/webapp2/META-INF/ignite-webapp-config.xml b/modules/web/src/test/webapp2/META-INF/ignite-webapp-config.xml
index e504fe7..9cb2761 100644
--- a/modules/web/src/test/webapp2/META-INF/ignite-webapp-config.xml
+++ b/modules/web/src/test/webapp2/META-INF/ignite-webapp-config.xml
@@ -199,7 +199,6 @@
                         <property name="bucketName" value="YOUR_BUCKET_NAME_IP_FINDER"/>
                     </bean>
                 </property>
-                <property name="heartbeatFrequency" value="2000"/>
             </bean>
         </property>
         -->


[22/51] [abbrv] ignite git commit: ignite-2.0 - Fixed offheap RWLock tests

Posted by sb...@apache.org.
ignite-2.0 - Fixed offheap RWLock tests


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

Branch: refs/heads/ignite-5075-cacheStart
Commit: 760cf952d20dc302a208ee1a57abd874c7f8ad7b
Parents: 6998785
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Wed Apr 26 16:58:53 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Apr 26 16:58:53 2017 +0300

----------------------------------------------------------------------
 .../utils/IgniteOffheapReadWriteLockSelfTest.java | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/760cf952/modules/core/src/test/java/org/apache/ignite/lang/utils/IgniteOffheapReadWriteLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/lang/utils/IgniteOffheapReadWriteLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/lang/utils/IgniteOffheapReadWriteLockSelfTest.java
index 4d81a3d..7a38548 100644
--- a/modules/core/src/test/java/org/apache/ignite/lang/utils/IgniteOffheapReadWriteLockSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/lang/utils/IgniteOffheapReadWriteLockSelfTest.java
@@ -36,7 +36,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 @SuppressWarnings("BusyWait")
 public class IgniteOffheapReadWriteLockSelfTest extends GridCommonAbstractTest {
     /** */
-    private static final int TAG_0 = 0;
+    private static final int TAG_0 = 1;
 
     /**
      * @throws Exception if failed.
@@ -334,7 +334,7 @@ public class IgniteOffheapReadWriteLockSelfTest extends GridCommonAbstractTest {
 
         final long ptr = GridUnsafe.allocateMemory(OffheapReadWriteLock.LOCK_SIZE);
 
-        lock.init(ptr, 0);
+        lock.init(ptr, TAG_0);
 
         final AtomicInteger reads = new AtomicInteger();
         final AtomicInteger writes = new AtomicInteger();
@@ -350,7 +350,7 @@ public class IgniteOffheapReadWriteLockSelfTest extends GridCommonAbstractTest {
                 try {
                     ThreadLocalRandom rnd = ThreadLocalRandom.current();
 
-                    int tag = 0;
+                    int tag = TAG_0;
 
                     long lastSwitch = System.currentTimeMillis();
 
@@ -381,7 +381,12 @@ public class IgniteOffheapReadWriteLockSelfTest extends GridCommonAbstractTest {
                                     if (switched && waitBeforeSwitch)
                                         info("Switching...");
 
-                                    lock.writeUnlock(ptr, (tag + (switched ? 1 : 0)) & 0xFFFF);
+                                    int tag1 = (tag + (switched ? 1 : 0)) & 0xFFFF;
+
+                                    if (tag1 == 0)
+                                        tag1 = 1;
+
+                                    lock.writeUnlock(ptr, tag1);
                                 }
 
                                 writes.incrementAndGet();
@@ -422,7 +427,10 @@ public class IgniteOffheapReadWriteLockSelfTest extends GridCommonAbstractTest {
 
                             tag = (tag + 1) & 0xFFFF;
 
-                            if (waitBeforeSwitch || (!waitBeforeSwitch && tag == 0))
+                            if (tag == 0)
+                                tag = 1;
+
+                            if (waitBeforeSwitch || (!waitBeforeSwitch && tag == 1))
                                 info("Switch to a new tag: " + tag);
 
                             if (done.get()) {


[46/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
index 1321929..9a59338 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java
@@ -150,7 +150,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
     /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
-        grid(0).cache(null).removeAll();
+        grid(0).cache(DEFAULT_CACHE_NAME).removeAll();
     }
 
     /** {@inheritDoc} */
@@ -333,7 +333,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testGet() throws Exception {
         jcache().put("getKey", "getVal");
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "getKey"));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "getKey"));
 
         info("Get command result: " + ret);
 
@@ -350,7 +350,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         jcache().put("mapKey1", map1);
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "mapKey1"));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "mapKey1"));
 
         info("Get command result: " + ret);
 
@@ -364,7 +364,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         jcache().put("mapKey2", map2);
 
-        ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "mapKey2"));
+        ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "mapKey2"));
 
         info("Get command result: " + ret);
 
@@ -381,7 +381,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         jcache().put("simplePersonKey", p);
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "simplePersonKey"));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "simplePersonKey"));
 
         info("Get command result: " + ret);
 
@@ -408,7 +408,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         jcache().put("utilDateKey", utilDate);
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "utilDateKey"));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "utilDateKey"));
 
         info("Get command result: " + ret);
 
@@ -418,7 +418,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         jcache().put("sqlDateKey", sqlDate);
 
-        ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "sqlDateKey"));
+        ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "sqlDateKey"));
 
         info("Get SQL result: " + ret);
 
@@ -426,7 +426,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         jcache().put("timestampKey", new java.sql.Timestamp(utilDate.getTime()));
 
-        ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "timestampKey"));
+        ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "timestampKey"));
 
         info("Get timestamp: " + ret);
 
@@ -441,7 +441,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         jcache().put("uuidKey", uuid);
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "uuidKey"));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "uuidKey"));
 
         info("Get command result: " + ret);
 
@@ -451,7 +451,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         jcache().put("igniteUuidKey", igniteUuid);
 
-        ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "igniteUuidKey"));
+        ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "igniteUuidKey"));
 
         info("Get command result: " + ret);
 
@@ -466,7 +466,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         jcache().put("tupleKey", t);
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET.key(), "key", "tupleKey"));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_GET.key(), "key", "tupleKey"));
 
         info("Get command result: " + ret);
 
@@ -484,7 +484,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         jcache().put("getKey", "getVal");
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_SIZE.key()));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_SIZE.key()));
 
         info("Size command result: " + ret);
 
@@ -495,7 +495,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testIgniteName() throws Exception {
-        String ret = content(F.asMap("cmd", GridRestCommand.NAME.key()));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.NAME.key()));
 
         info("Name command result: " + ret);
 
@@ -506,13 +506,13 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testGetOrCreateCache() throws Exception {
-        String ret = content(F.asMap("cmd", GridRestCommand.GET_OR_CREATE_CACHE.key(), "cacheName", "testCache"));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.GET_OR_CREATE_CACHE.key(), "cacheName", "testCache"));
 
         info("Name command result: " + ret);
 
         grid(0).cache("testCache").put("1", "1");
 
-        ret = content(F.asMap("cmd", GridRestCommand.DESTROY_CACHE.key(), "cacheName", "testCache"));
+        ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.DESTROY_CACHE.key(), "cacheName", "testCache"));
 
         assertTrue(jsonResponse(ret).isNull());
 
@@ -527,7 +527,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         jcache().putAll(entries);
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_ALL.key(), "k1", "getKey1", "k2", "getKey2"));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET_ALL.key(), "k1", "getKey1", "k2", "getKey2"));
 
         info("Get all command result: " + ret);
 
@@ -542,7 +542,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testIncorrectPut() throws Exception {
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT.key(), "key", "key0"));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_PUT.key(), "key", "key0"));
 
         assertResponseContainsError(ret,
             "Failed to handle request: [req=CACHE_PUT, err=Failed to find mandatory parameter in request: val]");
@@ -552,9 +552,9 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testContainsKey() throws Exception {
-        grid(0).cache(null).put("key0", "val0");
+        grid(0).cache(DEFAULT_CACHE_NAME).put("key0", "val0");
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CONTAINS_KEY.key(), "key", "key0"));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_CONTAINS_KEY.key(), "key", "key0"));
 
         assertCacheOperation(ret, true);
     }
@@ -563,10 +563,10 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testContainesKeys() throws Exception {
-        grid(0).cache(null).put("key0", "val0");
-        grid(0).cache(null).put("key1", "val1");
+        grid(0).cache(DEFAULT_CACHE_NAME).put("key0", "val0");
+        grid(0).cache(DEFAULT_CACHE_NAME).put("key1", "val1");
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CONTAINS_KEYS.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_CONTAINS_KEYS.key(),
             "k1", "key0", "k2", "key1"));
 
         assertCacheBulkOperation(ret, true);
@@ -576,116 +576,116 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testGetAndPut() throws Exception {
-        grid(0).cache(null).put("key0", "val0");
+        grid(0).cache(DEFAULT_CACHE_NAME).put("key0", "val0");
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_PUT.key(), "key", "key0", "val", "val1"));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET_AND_PUT.key(), "key", "key0", "val", "val1"));
 
         assertCacheOperation(ret, "val0");
 
-        assertEquals("val1", grid(0).cache(null).get("key0"));
+        assertEquals("val1", grid(0).cache(DEFAULT_CACHE_NAME).get("key0"));
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testGetAndPutIfAbsent() throws Exception {
-        grid(0).cache(null).put("key0", "val0");
+        grid(0).cache(DEFAULT_CACHE_NAME).put("key0", "val0");
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_PUT_IF_ABSENT.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET_AND_PUT_IF_ABSENT.key(),
             "key", "key0", "val", "val1"));
 
         assertCacheOperation(ret, "val0");
 
-        assertEquals("val0", grid(0).cache(null).get("key0"));
+        assertEquals("val0", grid(0).cache(DEFAULT_CACHE_NAME).get("key0"));
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testPutIfAbsent2() throws Exception {
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT_IF_ABSENT.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_PUT_IF_ABSENT.key(),
             "key", "key0", "val", "val1"));
 
         assertCacheOperation(ret, true);
 
-        assertEquals("val1", grid(0).cache(null).get("key0"));
+        assertEquals("val1", grid(0).cache(DEFAULT_CACHE_NAME).get("key0"));
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testRemoveValue() throws Exception {
-        grid(0).cache(null).put("key0", "val0");
+        grid(0).cache(DEFAULT_CACHE_NAME).put("key0", "val0");
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_VALUE.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_REMOVE_VALUE.key(),
             "key", "key0", "val", "val1"));
 
         assertCacheOperation(ret, false);
 
-        assertEquals("val0", grid(0).cache(null).get("key0"));
+        assertEquals("val0", grid(0).cache(DEFAULT_CACHE_NAME).get("key0"));
 
-        ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_VALUE.key(),
+        ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_REMOVE_VALUE.key(),
             "key", "key0", "val", "val0"));
 
         assertCacheOperation(ret, true);
 
-        assertNull(grid(0).cache(null).get("key0"));
+        assertNull(grid(0).cache(DEFAULT_CACHE_NAME).get("key0"));
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testGetAndRemove() throws Exception {
-        grid(0).cache(null).put("key0", "val0");
+        grid(0).cache(DEFAULT_CACHE_NAME).put("key0", "val0");
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_REMOVE.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET_AND_REMOVE.key(),
             "key", "key0"));
 
         assertCacheOperation(ret, "val0");
 
-        assertNull(grid(0).cache(null).get("key0"));
+        assertNull(grid(0).cache(DEFAULT_CACHE_NAME).get("key0"));
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testReplaceValue() throws Exception {
-        grid(0).cache(null).put("key0", "val0");
+        grid(0).cache(DEFAULT_CACHE_NAME).put("key0", "val0");
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REPLACE_VALUE.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_REPLACE_VALUE.key(),
             "key", "key0", "val", "val1", "val2", "val2"));
 
         assertCacheOperation(ret, false);
 
-        assertEquals("val0", grid(0).cache(null).get("key0"));
+        assertEquals("val0", grid(0).cache(DEFAULT_CACHE_NAME).get("key0"));
 
-        ret = content(F.asMap("cmd", GridRestCommand.CACHE_REPLACE_VALUE.key(),
+        ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_REPLACE_VALUE.key(),
             "key", "key0", "val", "val1", "val2", "val0"));
 
         assertCacheOperation(ret, true);
 
-        assertEquals("val1", grid(0).cache(null).get("key0"));
+        assertEquals("val1", grid(0).cache(DEFAULT_CACHE_NAME).get("key0"));
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testGetAndReplace() throws Exception {
-        grid(0).cache(null).put("key0", "val0");
+        grid(0).cache(DEFAULT_CACHE_NAME).put("key0", "val0");
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_GET_AND_REPLACE.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_GET_AND_REPLACE.key(),
             "key", "key0", "val", "val1"));
 
         assertCacheOperation(ret, "val0");
 
-        assertEquals("val1", grid(0).cache(null).get("key0"));
+        assertEquals("val1", grid(0).cache(DEFAULT_CACHE_NAME).get("key0"));
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testPut() throws Exception {
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_PUT.key(),
             "key", "putKey", "val", "putVal"));
 
         info("Put command result: " + ret);
@@ -699,7 +699,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testPutWithExpiration() throws Exception {
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_PUT.key(),
             "key", "putKey", "val", "putVal", "exp", "2000"));
 
         assertCacheOperation(ret, true);
@@ -717,7 +717,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testAdd() throws Exception {
         jcache().put("addKey1", "addVal1");
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_ADD.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_ADD.key(),
             "key", "addKey2", "val", "addVal2"));
 
         assertCacheOperation(ret, true);
@@ -730,7 +730,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testAddWithExpiration() throws Exception {
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_ADD.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_ADD.key(),
             "key", "addKey", "val", "addVal", "exp", "2000"));
 
         assertCacheOperation(ret, true);
@@ -746,9 +746,14 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testPutAll() throws Exception {
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PUT_ALL.key(),
-            "k1", "putKey1", "k2", "putKey2",
-            "v1", "putVal1", "v2", "putVal2"));
+        Map<String, String> map = F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd", GridRestCommand.CACHE_PUT_ALL.key());
+
+        map.put("k1", "putKey1");
+        map.put("k2", "putKey2");
+        map.put("v1", "putVal1");
+        map.put("v2", "putVal2");
+
+        String ret = content(map);
 
         info("Put all command result: " + ret);
 
@@ -766,7 +771,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         assertEquals("rmvVal", jcache().localPeek("rmvKey"));
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_REMOVE.key(),
             "key", "rmvKey"));
 
         info("Remove command result: " + ret);
@@ -790,7 +795,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         assertEquals("rmvVal3", jcache().localPeek("rmvKey3"));
         assertEquals("rmvVal4", jcache().localPeek("rmvKey4"));
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_ALL.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_REMOVE_ALL.key(),
             "k1", "rmvKey1", "k2", "rmvKey2"));
 
         info("Remove all command result: " + ret);
@@ -802,7 +807,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         assertCacheBulkOperation(ret, true);
 
-        ret = content(F.asMap("cmd", GridRestCommand.CACHE_REMOVE_ALL.key()));
+        ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_REMOVE_ALL.key()));
 
         info("Remove all command result: " + ret);
 
@@ -823,7 +828,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         assertEquals("casOldVal", jcache().localPeek("casKey"));
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CAS.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_CAS.key(),
             "key", "casKey", "val2", "casOldVal", "val1", "casNewVal"));
 
         info("CAS command result: " + ret);
@@ -843,7 +848,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         assertEquals("repOldVal", jcache().localPeek("repKey"));
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REPLACE.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_REPLACE.key(),
             "key", "repKey", "val", "repVal"));
 
         info("Replace command result: " + ret);
@@ -861,7 +866,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         assertEquals("replaceVal", jcache().get("replaceKey"));
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_REPLACE.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_REPLACE.key(),
             "key", "replaceKey", "val", "replaceValNew", "exp", "2000"));
 
         assertCacheOperation(ret, true);
@@ -880,7 +885,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testAppend() throws Exception {
         jcache().put("appendKey", "appendVal");
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_APPEND.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_APPEND.key(),
             "key", "appendKey", "val", "_suffix"));
 
         assertCacheOperation(ret, true);
@@ -894,7 +899,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testPrepend() throws Exception {
         jcache().put("prependKey", "prependVal");
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_PREPEND.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_PREPEND.key(),
             "key", "prependKey", "val", "prefix_"));
 
         assertCacheOperation(ret, true);
@@ -906,7 +911,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testIncrement() throws Exception {
-        String ret = content(F.asMap("cmd", GridRestCommand.ATOMIC_INCREMENT.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.ATOMIC_INCREMENT.key(),
             "key", "incrKey", "init", "2", "delta", "3"));
 
         JsonNode res = jsonResponse(ret);
@@ -914,7 +919,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         assertEquals(5, res.asInt());
         assertEquals(5, grid(0).atomicLong("incrKey", 0, true).get());
 
-        ret = content(F.asMap("cmd", GridRestCommand.ATOMIC_INCREMENT.key(), "key", "incrKey", "delta", "10"));
+        ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.ATOMIC_INCREMENT.key(), "key", "incrKey", "delta", "10"));
 
         res = jsonResponse(ret);
 
@@ -926,7 +931,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testDecrement() throws Exception {
-        String ret = content(F.asMap("cmd", GridRestCommand.ATOMIC_DECREMENT.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.ATOMIC_DECREMENT.key(),
             "key", "decrKey", "init", "15", "delta", "10"));
 
         JsonNode res = jsonResponse(ret);
@@ -934,7 +939,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         assertEquals(5, res.asInt());
         assertEquals(5, grid(0).atomicLong("decrKey", 0, true).get());
 
-        ret = content(F.asMap("cmd", GridRestCommand.ATOMIC_DECREMENT.key(),
+        ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.ATOMIC_DECREMENT.key(),
             "key", "decrKey", "delta", "3"));
 
         res = jsonResponse(ret);
@@ -951,7 +956,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         assertEquals("casOldVal", jcache().localPeek("casKey"));
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CAS.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_CAS.key(),
             "key", "casKey", "val2", "casOldVal"));
 
         info("CAR command result: " + ret);
@@ -967,7 +972,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
     public void testPutIfAbsent() throws Exception {
         assertNull(jcache().localPeek("casKey"));
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CAS.key(),
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_CAS.key(),
             "key", "casKey", "val1", "casNewVal"));
 
         info("PutIfAbsent command result: " + ret);
@@ -985,7 +990,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         assertEquals("casVal", jcache().localPeek("casKey"));
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_CAS.key(), "key", "casKey"));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_CAS.key(), "key", "casKey"));
 
         info("CAS Remove command result: " + ret);
 
@@ -998,7 +1003,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testMetrics() throws Exception {
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_METRICS.key()));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_METRICS.key()));
 
         info("Cache metrics command result: " + ret);
 
@@ -1096,13 +1101,13 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         Collection<GridCacheSqlMetadata> metas = cache.context().queries().sqlMetadata();
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_METADATA.key()));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_METADATA.key()));
 
         info("Cache metadata: " + ret);
 
         testMetadata(metas, ret);
 
-        ret = content(F.asMap("cmd", GridRestCommand.CACHE_METADATA.key(), "cacheName", "person"));
+        ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_METADATA.key(), "cacheName", "person"));
 
         info("Cache metadata with cacheName parameter: " + ret);
 
@@ -1122,13 +1127,13 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         Collection<GridCacheSqlMetadata> metas = c.context().queries().sqlMetadata();
 
-        String ret = content(F.asMap("cmd", GridRestCommand.CACHE_METADATA.key()));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_METADATA.key()));
 
         info("Cache metadata: " + ret);
 
         testMetadata(metas, ret);
 
-        ret = content(F.asMap("cmd", GridRestCommand.CACHE_METADATA.key(), "cacheName", "person"));
+        ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CACHE_METADATA.key(), "cacheName", "person"));
 
         info("Cache metadata with cacheName parameter: " + ret);
 
@@ -1139,7 +1144,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testTopology() throws Exception {
-        String ret = content(F.asMap("cmd", GridRestCommand.TOPOLOGY.key(), "attr", "false", "mtr", "false"));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.TOPOLOGY.key(), "attr", "false", "mtr", "false"));
 
         info("Topology command result: " + ret);
 
@@ -1183,7 +1188,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testNode() throws Exception {
-        String ret = content(F.asMap("cmd", GridRestCommand.NODE.key(), "attr", "true", "mtr", "true", "id",
+        String ret = content(F.asMap("cmd",GridRestCommand.NODE.key(), "attr", "true", "mtr", "true", "id",
             grid(0).localNode().id().toString()));
 
         info("Topology command result: " + ret);
@@ -1193,7 +1198,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         assertTrue(res.get("attributes").isObject());
         assertTrue(res.get("metrics").isObject());
 
-        ret = content(F.asMap("cmd", GridRestCommand.NODE.key(), "attr", "false", "mtr", "false", "ip", LOC_HOST));
+        ret = content(F.asMap("cmd",GridRestCommand.NODE.key(), "attr", "false", "mtr", "false", "ip", LOC_HOST));
 
         info("Topology command result: " + ret);
 
@@ -1202,7 +1207,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         assertTrue(res.get("attributes").isNull());
         assertTrue(res.get("metrics").isNull());
 
-        ret = content(F.asMap("cmd", GridRestCommand.NODE.key(), "attr", "false", "mtr", "false", "ip", LOC_HOST, "id",
+        ret = content(F.asMap("cmd",GridRestCommand.NODE.key(), "attr", "false", "mtr", "false", "ip", LOC_HOST, "id",
             UUID.randomUUID().toString()));
 
         info("Topology command result: " + ret);
@@ -1220,14 +1225,14 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testExe() throws Exception {
-        String ret = content(F.asMap("cmd", GridRestCommand.EXE.key()));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.EXE.key()));
 
         info("Exe command result: " + ret);
 
         assertResponseContainsError(ret);
 
         // Attempt to execute unknown task (UNKNOWN_TASK) will result in exception on server.
-        ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", "UNKNOWN_TASK"));
+        ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.EXE.key(), "name", "UNKNOWN_TASK"));
 
         info("Exe command result: " + ret);
 
@@ -1236,7 +1241,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         grid(0).compute().localDeployTask(TestTask1.class, TestTask1.class.getClassLoader());
         grid(0).compute().localDeployTask(TestTask2.class, TestTask2.class.getClassLoader());
 
-        ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", TestTask1.class.getName()));
+        ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.EXE.key(), "name", TestTask1.class.getName()));
 
         info("Exe command result: " + ret);
 
@@ -1244,7 +1249,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         assertTrue(res.isNull());
 
-        ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", TestTask2.class.getName()));
+        ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.EXE.key(), "name", TestTask2.class.getName()));
 
         info("Exe command result: " + ret);
 
@@ -1252,7 +1257,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         assertEquals(TestTask2.RES, res.asText());
 
-        ret = content(F.asMap("cmd", GridRestCommand.RESULT.key()));
+        ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.RESULT.key()));
 
         info("Exe command result: " + ret);
 
@@ -1563,7 +1568,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testVersion() throws Exception {
-        String ret = content(F.asMap("cmd", GridRestCommand.VERSION.key()));
+        String ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.VERSION.key()));
 
         JsonNode res = jsonResponse(ret);
 
@@ -1652,11 +1657,12 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
      * @throws Exception If failed.
      */
     public void testQuery() throws Exception {
-        grid(0).cache(null).put("1", "1");
-        grid(0).cache(null).put("2", "2");
-        grid(0).cache(null).put("3", "3");
+        grid(0).cache(DEFAULT_CACHE_NAME).put("1", "1");
+        grid(0).cache(DEFAULT_CACHE_NAME).put("2", "2");
+        grid(0).cache(DEFAULT_CACHE_NAME).put("3", "3");
 
         Map<String, String> params = new HashMap<>();
+        params.put("cacheName", DEFAULT_CACHE_NAME);
         params.put("cmd", GridRestCommand.EXECUTE_SQL_QUERY.key());
         params.put("type", "String");
         params.put("pageSize", "1");
@@ -1668,7 +1674,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         assertFalse(jsonResponse(ret).get("queryId").isNull());
 
-        ret = content(F.asMap("cmd", GridRestCommand.FETCH_SQL_QUERY.key(),
+        ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.FETCH_SQL_QUERY.key(),
             "pageSize", "1", "qryId", qryId.asText()));
 
         JsonNode res = jsonResponse(ret);
@@ -1678,7 +1684,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
         assertEquals(qryId0, qryId);
         assertFalse(res.get("last").asBoolean());
 
-        ret = content(F.asMap("cmd", GridRestCommand.FETCH_SQL_QUERY.key(),
+        ret = content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.FETCH_SQL_QUERY.key(),
             "pageSize", "1", "qryId", qryId.asText()));
 
         res = jsonResponse(ret);
@@ -1820,7 +1826,7 @@ public abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestPro
 
         String qryId = res.get("queryId").asText();
 
-        content(F.asMap("cmd", GridRestCommand.CLOSE_SQL_QUERY.key(), "cacheName", "person", "qryId", qryId));
+        content(F.asMap("cacheName", DEFAULT_CACHE_NAME, "cmd",GridRestCommand.CLOSE_SQL_QUERY.key(), "cacheName", "person", "qryId", qryId));
 
         assertFalse(queryCursorFound());
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorSignedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorSignedSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorSignedSelfTest.java
index 0073471..4dc8eeb 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorSignedSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorSignedSelfTest.java
@@ -53,7 +53,7 @@ public class JettyRestProcessorSignedSelfTest extends JettyRestProcessorAbstract
      * @throws Exception If failed.
      */
     public void testUnauthorized() throws Exception {
-        String addr = "http://" + LOC_HOST + ":" + restPort() + "/ignite?cmd=top";
+        String addr = "http://" + LOC_HOST + ":" + restPort() + "/ignite?cacheName=default&cmd=top";
 
         URL url = new URL(addr);
 
@@ -65,7 +65,7 @@ public class JettyRestProcessorSignedSelfTest extends JettyRestProcessorAbstract
         assert ((HttpURLConnection)conn).getResponseCode() == 401;
 
         // Request with authentication info.
-        addr = "http://" + LOC_HOST + ":" + restPort() + "/ignite?cmd=top";
+        addr = "http://" + LOC_HOST + ":" + restPort() + "/ignite?cacheName=default&cmd=top";
 
         url = new URL(addr);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestBinaryProtocolSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestBinaryProtocolSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestBinaryProtocolSelfTest.java
index b6781d9..284cffc 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestBinaryProtocolSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestBinaryProtocolSelfTest.java
@@ -44,6 +44,7 @@ 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.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.cache.CacheMode.LOCAL;
@@ -88,7 +89,7 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
     @Override protected void afterTest() throws Exception {
         client.shutdown();
 
-        grid().cache(null).clear();
+        grid().cache(DEFAULT_CACHE_NAME).clear();
         grid().cache(CACHE_NAME).clear();
     }
 
@@ -112,7 +113,7 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
 
         cfg.setDiscoverySpi(disco);
 
-        cfg.setCacheConfiguration(cacheConfiguration(null), cacheConfiguration(CACHE_NAME));
+        cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME), cacheConfiguration(CACHE_NAME));
 
         return cfg;
     }
@@ -122,7 +123,7 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      * @throws Exception In case of error.
      */
-    private CacheConfiguration cacheConfiguration(@Nullable String cacheName) throws Exception {
+    private CacheConfiguration cacheConfiguration(@NotNull String cacheName) throws Exception {
         CacheConfiguration cfg = defaultCacheConfiguration();
 
         cfg.setCacheMode(LOCAL);
@@ -145,8 +146,8 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testPut() throws Exception {
-        assertTrue(client.cachePut(null, "key1", "val1"));
-        assertEquals("val1", grid().cache(null).get("key1"));
+        assertTrue(client.cachePut(DEFAULT_CACHE_NAME, "key1", "val1"));
+        assertEquals("val1", grid().cache(DEFAULT_CACHE_NAME).get("key1"));
 
         assertTrue(client.cachePut(CACHE_NAME, "key1", "val1"));
         assertEquals("val1", grid().cache(CACHE_NAME).get("key1"));
@@ -156,9 +157,9 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testPutAll() throws Exception {
-        client.cachePutAll(null, F.asMap("key1", "val1", "key2", "val2"));
+        client.cachePutAll(DEFAULT_CACHE_NAME, F.asMap("key1", "val1", "key2", "val2"));
 
-        Map<String, String> map = grid().<String, String>cache(null).getAll(F.asSet("key1", "key2"));
+        Map<String, String> map = grid().<String, String>cache(DEFAULT_CACHE_NAME).getAll(F.asSet("key1", "key2"));
 
         assertEquals(2, map.size());
         assertEquals("val1", map.get("key1"));
@@ -177,9 +178,9 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testGet() throws Exception {
-        grid().cache(null).put("key", "val");
+        grid().cache(DEFAULT_CACHE_NAME).put("key", "val");
 
-        assertEquals("val", client.cacheGet(null, "key"));
+        assertEquals("val", client.cacheGet(DEFAULT_CACHE_NAME, "key"));
 
         grid().cache(CACHE_NAME).put("key", "val");
 
@@ -210,7 +211,7 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
                 log,
                 new Callable<Object>() {
                     @Override public Object call() throws Exception {
-                        return client.cacheGet(null, "key");
+                        return client.cacheGet(DEFAULT_CACHE_NAME, "key");
                     }
                 },
                 IgniteCheckedException.class,
@@ -225,13 +226,13 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testGetAll() throws Exception {
-        IgniteCache<Object, Object> jcacheDflt = grid().cache(null);
+        IgniteCache<Object, Object> jcacheDflt = grid().cache(DEFAULT_CACHE_NAME);
         IgniteCache<Object, Object> jcacheName = grid().cache(CACHE_NAME);
 
         jcacheDflt.put("key1", "val1");
         jcacheDflt.put("key2", "val2");
 
-        Map<String, String> map = client.cacheGetAll(null, "key1", "key2");
+        Map<String, String> map = client.cacheGetAll(DEFAULT_CACHE_NAME, "key1", "key2");
 
         assertEquals(2, map.size());
         assertEquals("val1", map.get("key1"));
@@ -240,7 +241,7 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
         jcacheDflt.put("key3", "val3");
         jcacheDflt.put("key4", "val4");
 
-        map = client.cacheGetAll(null, "key3", "key4");
+        map = client.cacheGetAll(DEFAULT_CACHE_NAME, "key3", "key4");
 
         assertEquals(2, map.size());
         assertEquals("val3", map.get("key3"));
@@ -269,13 +270,13 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testRemove() throws Exception {
-        IgniteCache<Object, Object> jcacheDflt = grid().cache(null);
+        IgniteCache<Object, Object> jcacheDflt = grid().cache(DEFAULT_CACHE_NAME);
         IgniteCache<Object, Object> jcacheName = grid().cache(CACHE_NAME);
 
         jcacheDflt.put("key", "val");
 
-        assertTrue(client.cacheRemove(null, "key"));
-        assertFalse(client.cacheRemove(null, "wrongKey"));
+        assertTrue(client.cacheRemove(DEFAULT_CACHE_NAME, "key"));
+        assertFalse(client.cacheRemove(DEFAULT_CACHE_NAME, "wrongKey"));
 
         assertNull(jcacheDflt.get("key"));
 
@@ -292,14 +293,14 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testRemoveAll() throws Exception {
-        IgniteCache<Object, Object> jcacheDflt = grid().cache(null);
+        IgniteCache<Object, Object> jcacheDflt = grid().cache(DEFAULT_CACHE_NAME);
 
         jcacheDflt.put("key1", "val1");
         jcacheDflt.put("key2", "val2");
         jcacheDflt.put("key3", "val3");
         jcacheDflt.put("key4", "val4");
 
-        client.cacheRemoveAll(null, "key1", "key2");
+        client.cacheRemoveAll(DEFAULT_CACHE_NAME, "key1", "key2");
 
         assertNull(jcacheDflt.get("key1"));
         assertNull(jcacheDflt.get("key2"));
@@ -325,16 +326,16 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testReplace() throws Exception {
-        assertFalse(client.cacheReplace(null, "key1", "val1"));
+        assertFalse(client.cacheReplace(DEFAULT_CACHE_NAME, "key1", "val1"));
 
-        IgniteCache<Object, Object> jcacheDflt = grid().cache(null);
+        IgniteCache<Object, Object> jcacheDflt = grid().cache(DEFAULT_CACHE_NAME);
 
         jcacheDflt.put("key1", "val1");
-        assertTrue(client.cacheReplace(null, "key1", "val2"));
+        assertTrue(client.cacheReplace(DEFAULT_CACHE_NAME, "key1", "val2"));
 
-        assertFalse(client.cacheReplace(null, "key2", "val1"));
+        assertFalse(client.cacheReplace(DEFAULT_CACHE_NAME, "key2", "val1"));
         jcacheDflt.put("key2", "val1");
-        assertTrue(client.cacheReplace(null, "key2", "val2"));
+        assertTrue(client.cacheReplace(DEFAULT_CACHE_NAME, "key2", "val2"));
 
         jcacheDflt.clear();
 
@@ -347,32 +348,32 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testCompareAndSet() throws Exception {
-        assertFalse(client.cacheCompareAndSet(null, "key", null, null));
+        assertFalse(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", null, null));
 
-        IgniteCache<Object, Object> jcache = grid().cache(null);
+        IgniteCache<Object, Object> jcache = grid().cache(DEFAULT_CACHE_NAME);
 
         jcache.put("key", "val");
-        assertTrue(client.cacheCompareAndSet(null, "key", null, null));
+        assertTrue(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", null, null));
         assertNull(jcache.get("key"));
 
-        assertFalse(client.cacheCompareAndSet(null, "key", null, "val"));
+        assertFalse(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", null, "val"));
         jcache.put("key", "val");
-        assertFalse(client.cacheCompareAndSet(null, "key", null, "wrongVal"));
+        assertFalse(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", null, "wrongVal"));
         assertEquals("val", jcache.get("key"));
-        assertTrue(client.cacheCompareAndSet(null, "key", null, "val"));
+        assertTrue(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", null, "val"));
         assertNull(jcache.get("key"));
 
-        assertTrue(client.cacheCompareAndSet(null, "key", "val", null));
+        assertTrue(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", "val", null));
         assertEquals("val", jcache.get("key"));
-        assertFalse(client.cacheCompareAndSet(null, "key", "newVal", null));
+        assertFalse(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", "newVal", null));
         assertEquals("val", jcache.get("key"));
         jcache.remove("key");
 
-        assertFalse(client.cacheCompareAndSet(null, "key", "val1", "val2"));
+        assertFalse(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", "val1", "val2"));
         jcache.put("key", "val2");
-        assertFalse(client.cacheCompareAndSet(null, "key", "val1", "wrongVal"));
+        assertFalse(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", "val1", "wrongVal"));
         assertEquals("val2", jcache.get("key"));
-        assertTrue(client.cacheCompareAndSet(null, "key", "val1", "val2"));
+        assertTrue(client.cacheCompareAndSet(DEFAULT_CACHE_NAME, "key", "val1", "val2"));
         assertEquals("val1", jcache.get("key"));
         jcache.remove("key");
 
@@ -409,7 +410,7 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testMetrics() throws Exception {
-        IgniteCache<Object, Object> jcacheDft = grid().cache(null);
+        IgniteCache<Object, Object> jcacheDft = grid().cache(DEFAULT_CACHE_NAME);
         IgniteCache<Object, Object> jcacheName = grid().cache(CACHE_NAME);
 
         jcacheDft.localMxBean().clear();
@@ -432,7 +433,7 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
         jcacheName.get("key2");
         jcacheName.get("key2");
 
-        Map<String, Long> m = client.cacheMetrics(null);
+        Map<String, Long> m = client.cacheMetrics(DEFAULT_CACHE_NAME);
 
         assertNotNull(m);
         assertEquals(4, m.size());
@@ -451,19 +452,19 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testAppend() throws Exception {
-        grid().cache(null).remove("key");
+        grid().cache(DEFAULT_CACHE_NAME).remove("key");
         grid().cache(CACHE_NAME).remove("key");
 
-        assertFalse(client.cacheAppend(null, "key", ".val"));
+        assertFalse(client.cacheAppend(DEFAULT_CACHE_NAME, "key", ".val"));
         assertFalse(client.cacheAppend(CACHE_NAME, "key", ".val"));
 
-        grid().cache(null).put("key", "orig");
+        grid().cache(DEFAULT_CACHE_NAME).put("key", "orig");
         grid().cache(CACHE_NAME).put("key", "orig");
 
-        assertTrue(client.cacheAppend(null, "key", ".val"));
-        assertEquals("orig.val", grid().cache(null).get("key"));
-        assertTrue(client.cacheAppend(null, "key", ".newVal"));
-        assertEquals("orig.val.newVal", grid().cache(null).get("key"));
+        assertTrue(client.cacheAppend(DEFAULT_CACHE_NAME, "key", ".val"));
+        assertEquals("orig.val", grid().cache(DEFAULT_CACHE_NAME).get("key"));
+        assertTrue(client.cacheAppend(DEFAULT_CACHE_NAME, "key", ".newVal"));
+        assertEquals("orig.val.newVal", grid().cache(DEFAULT_CACHE_NAME).get("key"));
 
         assertTrue(client.cacheAppend(CACHE_NAME, "key", ".val"));
         assertEquals("orig.val", grid().cache(CACHE_NAME).get("key"));
@@ -475,19 +476,19 @@ public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testPrepend() throws Exception {
-        grid().cache(null).remove("key");
+        grid().cache(DEFAULT_CACHE_NAME).remove("key");
         grid().cache(CACHE_NAME).remove("key");
 
-        assertFalse(client.cachePrepend(null, "key", ".val"));
+        assertFalse(client.cachePrepend(DEFAULT_CACHE_NAME, "key", ".val"));
         assertFalse(client.cachePrepend(CACHE_NAME, "key", ".val"));
 
-        grid().cache(null).put("key", "orig");
+        grid().cache(DEFAULT_CACHE_NAME).put("key", "orig");
         grid().cache(CACHE_NAME).put("key", "orig");
 
-        assertTrue(client.cachePrepend(null, "key", "val."));
-        assertEquals("val.orig", grid().cache(null).get("key"));
-        assertTrue(client.cachePrepend(null, "key", "newVal."));
-        assertEquals("newVal.val.orig", grid().cache(null).get("key"));
+        assertTrue(client.cachePrepend(DEFAULT_CACHE_NAME, "key", "val."));
+        assertEquals("val.orig", grid().cache(DEFAULT_CACHE_NAME).get("key"));
+        assertTrue(client.cachePrepend(DEFAULT_CACHE_NAME, "key", "newVal."));
+        assertEquals("newVal.val.orig", grid().cache(DEFAULT_CACHE_NAME).get("key"));
 
         assertTrue(client.cachePrepend(CACHE_NAME, "key", "val."));
         assertEquals("val.orig", grid().cache(CACHE_NAME).get("key"));

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestMemcacheProtocolSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestMemcacheProtocolSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestMemcacheProtocolSelfTest.java
index 87540c2..02b7584 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestMemcacheProtocolSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestMemcacheProtocolSelfTest.java
@@ -27,6 +27,7 @@ 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 org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.cache.CacheMode.LOCAL;
@@ -71,7 +72,7 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
     @Override protected void afterTest() throws Exception {
         client.shutdown();
 
-        grid().cache(null).clear();
+        grid().cache(DEFAULT_CACHE_NAME).clear();
         grid().cache(CACHE_NAME).clear();
     }
 
@@ -95,7 +96,7 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
 
         cfg.setDiscoverySpi(disco);
 
-        cfg.setCacheConfiguration(cacheConfiguration(null), cacheConfiguration(CACHE_NAME));
+        cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME), cacheConfiguration(CACHE_NAME));
 
         return cfg;
     }
@@ -105,7 +106,7 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      * @throws Exception In case of error.
      */
-    private CacheConfiguration cacheConfiguration(@Nullable String cacheName) throws Exception {
+    private CacheConfiguration cacheConfiguration(@NotNull String cacheName) throws Exception {
         CacheConfiguration cfg = defaultCacheConfiguration();
 
         cfg.setCacheMode(LOCAL);
@@ -129,7 +130,7 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
      */
     public void testPut() throws Exception {
         assertTrue(client.cachePut(null, "key1", "val1"));
-        assertEquals("val1", grid().cache(null).get("key1"));
+        assertEquals("val1", grid().cache(DEFAULT_CACHE_NAME).get("key1"));
 
         assertTrue(client.cachePut(CACHE_NAME, "key1", "val1"));
         assertEquals("val1", grid().cache(CACHE_NAME).get("key1"));
@@ -139,7 +140,7 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testGet() throws Exception {
-        grid().cache(null).put("key", "val");
+        grid().cache(DEFAULT_CACHE_NAME).put("key", "val");
 
         Assert.assertEquals("val", client.cacheGet(null, "key"));
 
@@ -152,12 +153,12 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testRemove() throws Exception {
-        grid().cache(null).put("key", "val");
+        grid().cache(DEFAULT_CACHE_NAME).put("key", "val");
 
         assertTrue(client.cacheRemove(null, "key"));
         assertFalse(client.cacheRemove(null, "wrongKey"));
 
-        assertNull(grid().cache(null).get("key"));
+        assertNull(grid().cache(DEFAULT_CACHE_NAME).get("key"));
 
         grid().cache(CACHE_NAME).put("key", "val");
 
@@ -172,9 +173,9 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
      */
     public void testAdd() throws Exception {
         assertTrue(client.cacheAdd(null, "key", "val"));
-        assertEquals("val", grid().cache(null).get("key"));
+        assertEquals("val", grid().cache(DEFAULT_CACHE_NAME).get("key"));
         assertFalse(client.cacheAdd(null, "key", "newVal"));
-        assertEquals("val", grid().cache(null).get("key"));
+        assertEquals("val", grid().cache(DEFAULT_CACHE_NAME).get("key"));
 
         assertTrue(client.cacheAdd(CACHE_NAME, "key", "val"));
         assertEquals("val", grid().cache(CACHE_NAME).get("key"));
@@ -187,14 +188,14 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
      */
     public void testReplace() throws Exception {
         assertFalse(client.cacheReplace(null, "key1", "val1"));
-        grid().cache(null).put("key1", "val1");
+        grid().cache(DEFAULT_CACHE_NAME).put("key1", "val1");
         assertTrue(client.cacheReplace(null, "key1", "val2"));
 
         assertFalse(client.cacheReplace(null, "key2", "val1"));
-        grid().cache(null).put("key2", "val1");
+        grid().cache(DEFAULT_CACHE_NAME).put("key2", "val1");
         assertTrue(client.cacheReplace(null, "key2", "val2"));
 
-        grid().cache(null).clear();
+        grid().cache(DEFAULT_CACHE_NAME).clear();
 
         assertFalse(client.cacheReplace(CACHE_NAME, "key1", "val1"));
         grid().cache(CACHE_NAME).put("key1", "val1");
@@ -205,16 +206,16 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testMetrics() throws Exception {
-        grid().cache(null).localMxBean().clear();
+        grid().cache(DEFAULT_CACHE_NAME).localMxBean().clear();
         grid().cache(CACHE_NAME).localMxBean().clear();
 
-        grid().cache(null).put("key1", "val");
-        grid().cache(null).put("key2", "val");
-        grid().cache(null).put("key2", "val");
+        grid().cache(DEFAULT_CACHE_NAME).put("key1", "val");
+        grid().cache(DEFAULT_CACHE_NAME).put("key2", "val");
+        grid().cache(DEFAULT_CACHE_NAME).put("key2", "val");
 
-        grid().cache(null).get("key1");
-        grid().cache(null).get("key2");
-        grid().cache(null).get("key2");
+        grid().cache(DEFAULT_CACHE_NAME).get("key1");
+        grid().cache(DEFAULT_CACHE_NAME).get("key2");
+        grid().cache(DEFAULT_CACHE_NAME).get("key2");
 
         grid().cache(CACHE_NAME).put("key1", "val");
         grid().cache(CACHE_NAME).put("key2", "val");
@@ -292,9 +293,9 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
         assertFalse(client.cacheAppend(null, "wrongKey", "_suffix"));
         assertFalse(client.cacheAppend(CACHE_NAME, "wrongKey", "_suffix"));
 
-        grid().cache(null).put("key", "val");
+        grid().cache(DEFAULT_CACHE_NAME).put("key", "val");
         assertTrue(client.cacheAppend(null, "key", "_suffix"));
-        assertEquals("val_suffix", grid().cache(null).get("key"));
+        assertEquals("val_suffix", grid().cache(DEFAULT_CACHE_NAME).get("key"));
 
         grid().cache(CACHE_NAME).put("key", "val");
         assertTrue(client.cacheAppend(CACHE_NAME, "key", "_suffix"));
@@ -308,9 +309,9 @@ public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
         assertFalse(client.cachePrepend(null, "wrongKey", "prefix_"));
         assertFalse(client.cachePrepend(CACHE_NAME, "wrongKey", "prefix_"));
 
-        grid().cache(null).put("key", "val");
+        grid().cache(DEFAULT_CACHE_NAME).put("key", "val");
         assertTrue(client.cachePrepend(null, "key", "prefix_"));
-        assertEquals("prefix_val", grid().cache(null).get("key"));
+        assertEquals("prefix_val", grid().cache(DEFAULT_CACHE_NAME).get("key"));
 
         grid().cache(CACHE_NAME).put("key", "val");
         assertTrue(client.cachePrepend(CACHE_NAME, "key", "prefix_"));

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestProcessorTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestProcessorTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestProcessorTest.java
index ad62e6d..5b4ce53 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestProcessorTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/RestProcessorTest.java
@@ -140,7 +140,7 @@ public class RestProcessorTest extends GridCommonAbstractTest {
      *
      */
     private void populateCache() {
-        IgniteCache<String, Object> cache = G.ignite().cache(null);
+        IgniteCache<String, Object> cache = G.ignite().cache(DEFAULT_CACHE_NAME);
 
         cache.put("int", intValue());
         cache.put("string", "cacheString");

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TaskCommandHandlerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TaskCommandHandlerSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TaskCommandHandlerSelfTest.java
index 7f47e77..f6acd56 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TaskCommandHandlerSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TaskCommandHandlerSelfTest.java
@@ -45,6 +45,7 @@ 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 org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.ConcurrentLinkedHashMap;
 
@@ -120,7 +121,7 @@ public class TaskCommandHandlerSelfTest extends GridCommonAbstractTest {
 
         cfg.setDiscoverySpi(disco);
 
-        cfg.setCacheConfiguration(cacheConfiguration(null), cacheConfiguration("replicated"),
+        cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME), cacheConfiguration("replicated"),
             cacheConfiguration("partitioned"), cacheConfiguration(CACHE_NAME));
 
         return cfg;
@@ -131,10 +132,10 @@ public class TaskCommandHandlerSelfTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      * @throws Exception In case of error.
      */
-    private CacheConfiguration cacheConfiguration(@Nullable String cacheName) throws Exception {
+    private CacheConfiguration cacheConfiguration(@NotNull String cacheName) throws Exception {
         CacheConfiguration cfg = defaultCacheConfiguration();
 
-        cfg.setCacheMode(cacheName == null || CACHE_NAME.equals(cacheName) ? LOCAL : "replicated".equals(cacheName) ?
+        cfg.setCacheMode(DEFAULT_CACHE_NAME.equals(cacheName) || CACHE_NAME.equals(cacheName) ? LOCAL : "replicated".equals(cacheName) ?
             REPLICATED : PARTITIONED);
         cfg.setName(cacheName);
         cfg.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TestBinaryClient.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TestBinaryClient.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TestBinaryClient.java
index d71883b..badfd64 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TestBinaryClient.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/TestBinaryClient.java
@@ -48,6 +48,7 @@ import org.apache.ignite.internal.util.GridClientByteUtils;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.logger.java.JavaLogger;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest.GridCacheOperation.APPEND;
@@ -320,7 +321,7 @@ final class TestBinaryClient {
      * @return If value was actually put.
      * @throws IgniteCheckedException In case of error.
      */
-    public <K, V> boolean cachePut(@Nullable String cacheName, K key, V val)
+    public <K, V> boolean cachePut(@NotNull String cacheName, K key, V val)
         throws IgniteCheckedException {
         return cachePutAll(cacheName, Collections.singletonMap(key, val));
     }
@@ -332,7 +333,7 @@ final class TestBinaryClient {
      *      {@code false} otherwise
      * @throws IgniteCheckedException In case of error.
      */
-    public <K, V> boolean cachePutAll(@Nullable String cacheName, Map<K, V> entries)
+    public <K, V> boolean cachePutAll(@NotNull String cacheName, Map<K, V> entries)
         throws IgniteCheckedException {
         assert entries != null;
 
@@ -351,7 +352,7 @@ final class TestBinaryClient {
      * @return Value.
      * @throws IgniteCheckedException In case of error.
      */
-    public <K, V> V cacheGet(@Nullable String cacheName, K key)
+    public <K, V> V cacheGet(@NotNull String cacheName, K key)
         throws IgniteCheckedException {
         assert key != null;
 
@@ -371,7 +372,7 @@ final class TestBinaryClient {
      * @return Entries.
      * @throws IgniteCheckedException In case of error.
      */
-    public <K, V> Map<K, V> cacheGetAll(@Nullable String cacheName, K... keys)
+    public <K, V> Map<K, V> cacheGetAll(@NotNull String cacheName, K... keys)
         throws IgniteCheckedException {
         assert keys != null;
 
@@ -391,7 +392,7 @@ final class TestBinaryClient {
      * @throws IgniteCheckedException In case of error.
      */
     @SuppressWarnings("unchecked")
-    public <K> boolean cacheRemove(@Nullable String cacheName, K key) throws IgniteCheckedException {
+    public <K> boolean cacheRemove(@NotNull String cacheName, K key) throws IgniteCheckedException {
         assert key != null;
 
         GridClientCacheRequest req = new GridClientCacheRequest(RMV);
@@ -409,7 +410,7 @@ final class TestBinaryClient {
      * @return Whether entries were actually removed
      * @throws IgniteCheckedException In case of error.
      */
-    public <K> boolean cacheRemoveAll(@Nullable String cacheName, K... keys)
+    public <K> boolean cacheRemoveAll(@NotNull String cacheName, K... keys)
         throws IgniteCheckedException {
         assert keys != null;
 
@@ -429,7 +430,7 @@ final class TestBinaryClient {
      * @return Whether value was actually replaced.
      * @throws IgniteCheckedException In case of error.
      */
-    public <K, V> boolean cacheReplace(@Nullable String cacheName, K key, V val)
+    public <K, V> boolean cacheReplace(@NotNull String cacheName, K key, V val)
         throws IgniteCheckedException {
         assert key != null;
         assert val != null;
@@ -452,7 +453,7 @@ final class TestBinaryClient {
      * @return Whether new value was actually set.
      * @throws IgniteCheckedException In case of error.
      */
-    public <K, V> boolean cacheCompareAndSet(@Nullable String cacheName, K key, @Nullable V val1, @Nullable V val2)
+    public <K, V> boolean cacheCompareAndSet(@NotNull String cacheName, K key, @Nullable V val1, @Nullable V val2)
         throws IgniteCheckedException {
         assert key != null;
 
@@ -472,7 +473,7 @@ final class TestBinaryClient {
      * @return Metrics.
      * @throws IgniteCheckedException In case of error.
      */
-    public <K> Map<String, Long> cacheMetrics(@Nullable String cacheName) throws IgniteCheckedException {
+    public <K> Map<String, Long> cacheMetrics(@NotNull String cacheName) throws IgniteCheckedException {
         GridClientCacheRequest metrics = new GridClientCacheRequest(METRICS);
 
         metrics.requestId(idCntr.getAndIncrement());
@@ -488,7 +489,7 @@ final class TestBinaryClient {
      * @return Whether entry was appended.
      * @throws IgniteCheckedException In case of error.
      */
-    public <K, V> boolean cacheAppend(@Nullable String cacheName, K key, V val)
+    public <K, V> boolean cacheAppend(@NotNull String cacheName, K key, V val)
         throws IgniteCheckedException {
         assert key != null;
         assert val != null;
@@ -510,7 +511,7 @@ final class TestBinaryClient {
      * @return Whether entry was prepended.
      * @throws IgniteCheckedException In case of error.
      */
-    public <K, V> boolean cachePrepend(@Nullable String cacheName, K key, V val)
+    public <K, V> boolean cachePrepend(@NotNull String cacheName, K key, V val)
         throws IgniteCheckedException {
         assert key != null;
         assert val != null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/redis/RedisProtocolSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/redis/RedisProtocolSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/redis/RedisProtocolSelfTest.java
index 79896ea..691996c 100644
--- a/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/redis/RedisProtocolSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/protocols/tcp/redis/RedisProtocolSelfTest.java
@@ -114,7 +114,7 @@ public class RedisProtocolSelfTest extends GridCommonAbstractTest {
      * @return Cache.
      */
     @Override protected <K, V> IgniteCache<K, V> jcache() {
-        return grid(0).cache(null);
+        return grid(0).cache(DEFAULT_CACHE_NAME);
     }
 
     /** {@inheritDoc} */
@@ -221,8 +221,8 @@ public class RedisProtocolSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testSet() throws Exception {
-        long EXPIRE_MS = 5000L;
-        int EXPIRE_SEC = 5;
+        long EXPIRE_MS = 1000L;
+        int EXPIRE_SEC = 1;
 
         try (Jedis jedis = pool.getResource()) {
             jedis.set("setKey1", "1");
@@ -245,7 +245,7 @@ public class RedisProtocolSelfTest extends GridCommonAbstractTest {
             Assert.assertNull(jcache().get("setKey4"));
 
             // wait for expiration.
-            Thread.sleep(EXPIRE_MS);
+            Thread.sleep((long)(EXPIRE_MS * 1.2));
 
             Assert.assertNull(jcache().get("setKey1"));
             Assert.assertNull(jcache().get("setKey3"));

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/jdbc/AbstractJdbcPojoQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/AbstractJdbcPojoQuerySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/AbstractJdbcPojoQuerySelfTest.java
index a150574..6492eb0 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/AbstractJdbcPojoQuerySelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/AbstractJdbcPojoQuerySelfTest.java
@@ -108,7 +108,7 @@ public abstract class AbstractJdbcPojoQuerySelfTest extends GridCommonAbstractTe
 
         BinaryObject binObj = builder.build();
 
-        IgniteCache<String, BinaryObject> cache = grid(0).cache(null);
+        IgniteCache<String, BinaryObject> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.put("0", binObj);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcConnectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcConnectionSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcConnectionSelfTest.java
index cc06180..a2a83ee 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcConnectionSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcConnectionSelfTest.java
@@ -29,6 +29,7 @@ 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.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -54,7 +55,7 @@ public class JdbcConnectionSelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        cfg.setCacheConfiguration(cacheConfiguration(null), cacheConfiguration(CUSTOM_CACHE_NAME));
+        cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME), cacheConfiguration(CUSTOM_CACHE_NAME));
 
         TcpDiscoverySpi disco = new TcpDiscoverySpi();
 
@@ -79,7 +80,7 @@ public class JdbcConnectionSelfTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      * @throws Exception In case of error.
      */
-    private CacheConfiguration cacheConfiguration(@Nullable String name) throws Exception {
+    private CacheConfiguration cacheConfiguration(@NotNull String name) throws Exception {
         CacheConfiguration cfg = defaultCacheConfiguration();
 
         cfg.setName(name);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcNoDefaultCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcNoDefaultCacheTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcNoDefaultCacheTest.java
index 1506295..2d27637 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcNoDefaultCacheTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcNoDefaultCacheTest.java
@@ -30,6 +30,7 @@ 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 org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -74,7 +75,7 @@ public class JdbcNoDefaultCacheTest extends GridCommonAbstractTest {
      * @throws Exception In case of error.
      */
     @SuppressWarnings("unchecked")
-    private CacheConfiguration cacheConfiguration(@Nullable String name) throws Exception {
+    private CacheConfiguration cacheConfiguration(@NotNull String name) throws Exception {
         CacheConfiguration cfg = defaultCacheConfiguration();
 
         cfg.setIndexedTypes(Integer.class, Integer.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoQuerySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoQuerySelfTest.java
index c2af8a1..6729d04 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoQuerySelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPojoQuerySelfTest.java
@@ -26,7 +26,7 @@ import static org.apache.ignite.IgniteJdbcDriver.CFG_URL_PREFIX;
  */
 public class JdbcPojoQuerySelfTest extends AbstractJdbcPojoQuerySelfTest {
     /** URL. */
-    private static final String URL = CFG_URL_PREFIX + "modules/clients/src/test/config/jdbc-bin-config.xml";
+    private static final String URL = CFG_URL_PREFIX + "cache=default@modules/clients/src/test/config/jdbc-bin-config.xml";
 
     /**
      * @throws Exception If failed.

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPreparedStatementSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPreparedStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPreparedStatementSelfTest.java
index 5351b6a..67ccdb1 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPreparedStatementSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcPreparedStatementSelfTest.java
@@ -100,7 +100,7 @@ public class JdbcPreparedStatementSelfTest extends GridCommonAbstractTest {
     @Override protected void beforeTestsStarted() throws Exception {
         startGridsMultiThreaded(3);
 
-        IgniteCache<Integer, TestObject> cache = grid(0).cache(null);
+        IgniteCache<Integer, TestObject> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         assert cache != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcResultSetSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcResultSetSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcResultSetSelfTest.java
index 05f7f04..140ff36 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcResultSetSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcResultSetSelfTest.java
@@ -95,7 +95,7 @@ public class JdbcResultSetSelfTest extends GridCommonAbstractTest {
     @Override protected void beforeTestsStarted() throws Exception {
         startGridsMultiThreaded(3);
 
-        IgniteCache<Integer, TestObject> cache = grid(0).cache(null);
+        IgniteCache<Integer, TestObject> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         assert cache != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcStatementSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcStatementSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcStatementSelfTest.java
index eb77ec6..360d118 100644
--- a/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcStatementSelfTest.java
+++ b/modules/clients/src/test/java/org/apache/ignite/jdbc/JdbcStatementSelfTest.java
@@ -85,7 +85,7 @@ public class JdbcStatementSelfTest extends GridCommonAbstractTest {
     @Override protected void beforeTestsStarted() throws Exception {
         startGridsMultiThreaded(3);
 
-        IgniteCache<String, Person> cache = grid(0).cache(null);
+        IgniteCache<String, Person> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         assert cache != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/Ignite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/Ignite.java b/modules/core/src/main/java/org/apache/ignite/Ignite.java
index d8addcd..7445264 100644
--- a/modules/core/src/main/java/org/apache/ignite/Ignite.java
+++ b/modules/core/src/main/java/org/apache/ignite/Ignite.java
@@ -340,7 +340,7 @@ public interface Ignite extends AutoCloseable {
      * @return Cache instance.
      * @throws CacheException If error occurs.
      */
-    public <K, V> IgniteCache<K, V> createNearCache(@Nullable String cacheName, NearCacheConfiguration<K, V> nearCfg)
+    public <K, V> IgniteCache<K, V> createNearCache(String cacheName, NearCacheConfiguration<K, V> nearCfg)
         throws CacheException;
 
     /**
@@ -351,7 +351,7 @@ public interface Ignite extends AutoCloseable {
      * @return {@code IgniteCache} instance.
      * @throws CacheException If error occurs.
      */
-    public <K, V> IgniteCache<K, V> getOrCreateNearCache(@Nullable String cacheName, NearCacheConfiguration<K, V> nearCfg)
+    public <K, V> IgniteCache<K, V> getOrCreateNearCache(String cacheName, NearCacheConfiguration<K, V> nearCfg)
         throws CacheException;
 
     /**
@@ -378,7 +378,7 @@ public interface Ignite extends AutoCloseable {
      * @return Instance of the cache for the specified name.
      * @throws CacheException If error occurs.
      */
-    public <K, V> IgniteCache<K, V> cache(@Nullable String name) throws CacheException;
+    public <K, V> IgniteCache<K, V> cache(String name) throws CacheException;
 
     /**
      * Gets the collection of names of currently available caches.
@@ -402,11 +402,11 @@ public interface Ignite extends AutoCloseable {
      * is responsible for loading external data into in-memory data grid. For more information
      * refer to {@link IgniteDataStreamer} documentation.
      *
-     * @param cacheName Cache name ({@code null} for default cache).
+     * @param cacheName Cache name.
      * @return Data streamer.
      * @throws IllegalStateException If node is stopping.
      */
-    public <K, V> IgniteDataStreamer<K, V> dataStreamer(@Nullable String cacheName) throws IllegalStateException;
+    public <K, V> IgniteDataStreamer<K, V> dataStreamer(String cacheName) throws IllegalStateException;
 
     /**
      * Gets an instance of IGFS (Ignite In-Memory File System). If one is not

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java b/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
index f0e6039..98a9eb6 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCompute.java
@@ -138,7 +138,7 @@ public interface IgniteCompute extends IgniteAsyncSupport {
      * @throws IgniteException If job failed.
      */
     @IgniteAsyncSupported
-    public void affinityRun(@Nullable String cacheName, Object affKey, IgniteRunnable job) throws IgniteException;
+    public void affinityRun(String cacheName, Object affKey, IgniteRunnable job) throws IgniteException;
 
     /**
      * Executes given job asynchronously on the node where data for provided affinity key is located
@@ -151,7 +151,7 @@ public interface IgniteCompute extends IgniteAsyncSupport {
      * @return a Future representing pending completion of the affinity run.
      * @throws IgniteException If job failed.
      */
-    public IgniteFuture<Void> affinityRunAsync(@Nullable String cacheName, Object affKey, IgniteRunnable job)
+    public IgniteFuture<Void> affinityRunAsync(String cacheName, Object affKey, IgniteRunnable job)
         throws IgniteException;
 
     /**
@@ -231,7 +231,7 @@ public interface IgniteCompute extends IgniteAsyncSupport {
      * @throws IgniteException If job failed.
      */
     @IgniteAsyncSupported
-    public <R> R affinityCall(@Nullable String cacheName, Object affKey, IgniteCallable<R> job) throws IgniteException;
+    public <R> R affinityCall(String cacheName, Object affKey, IgniteCallable<R> job) throws IgniteException;
 
     /**
      * Executes given job asynchronously on the node where data for provided affinity key is located
@@ -244,7 +244,7 @@ public interface IgniteCompute extends IgniteAsyncSupport {
      * @return a Future representing pending completion of the affinity call.
      * @throws IgniteException If job failed.
      */
-    public <R> IgniteFuture<R> affinityCallAsync(@Nullable String cacheName, Object affKey, IgniteCallable<R> job)
+    public <R> IgniteFuture<R> affinityCallAsync(String cacheName, Object affKey, IgniteCallable<R> job)
         throws IgniteException;
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 275a21e..b0fcbc0 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -473,12 +473,10 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     /**
      * Sets cache name.
      *
-     * @param name Cache name. May be <tt>null</tt>, but may not be empty string.
+     * @param name Cache name. Can not be <tt>null</tt> or empty.
      * @return {@code this} for chaining.
      */
     public CacheConfiguration<K, V> setName(String name) {
-        A.ensure(name == null || !name.isEmpty(), "Name cannot be empty.");
-
         this.name = name;
 
         return this;
@@ -499,7 +497,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
      * @return {@code this} for chaining.
      */
     public CacheConfiguration<K, V> setMemoryPolicyName(String memPlcName) {
-        A.ensure(name == null || !name.isEmpty(), "Name cannot be empty.");
+        A.ensure(memPlcName == null || !memPlcName.isEmpty(), "Name cannot be empty.");
 
         this.memPlcName = memPlcName;
 


[18/51] [abbrv] ignite git commit: IGNITE-4774 Redesign table.

Posted by sb...@apache.org.
IGNITE-4774 Redesign table.


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

Branch: refs/heads/ignite-5075-cacheStart
Commit: c829aacaf71b06b32be3345c3c70047230b9f9e5
Parents: 335f243
Author: Dmitriy Shabalin <dm...@gmail.com>
Authored: Wed Apr 26 18:41:32 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Wed Apr 26 18:41:32 2017 +0700

----------------------------------------------------------------------
 .../list-of-registered-users.column-defs.js     |  26 +-
 .../list-of-registered-users.controller.js      | 163 +++++-----
 .../list-of-registered-users.tpl.pug            |  25 +-
 .../frontend/app/primitives/badge/index.scss    |   1 +
 .../frontend/app/primitives/btn/index.scss      |  24 +-
 .../frontend/app/primitives/dropdown/index.pug  |   2 +-
 .../frontend/app/primitives/dropdown/index.scss |  26 +-
 .../frontend/app/primitives/panel/index.scss    |   2 +-
 .../app/primitives/ui-grid-header/index.scss    |  10 +-
 .../app/primitives/ui-grid-header/index.tpl.pug |  10 +-
 .../app/primitives/ui-grid-settings/index.scss  |  58 +++-
 .../frontend/app/primitives/ui-grid/index.scss  | 149 +++++++--
 .../frontend/gulpfile.babel.js/paths.js         |   1 +
 .../frontend/gulpfile.babel.js/tasks/bundle.js  |   2 +-
 .../webpack/environments/development.js         |   4 +-
 .../frontend/public/images/icons/cross.svg      |   1 +
 .../frontend/public/images/icons/export.svg     |   1 +
 .../frontend/public/images/icons/gear.svg       |   1 +
 .../stylesheets/_bootstrap-variables.scss       |   4 +-
 modules/web-console/licenses/cc-by-3.0.txt      | 319 +++++++++++++++++++
 20 files changed, 669 insertions(+), 160 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
index 5bacce4..cb95735 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.column-defs.js
@@ -50,11 +50,11 @@ const EMAIL_TEMPLATE = '<div class="ui-grid-cell-contents"><a ng-href="mailto:{{
 
 export default [
     {name: 'actions', displayName: 'Actions', categoryDisplayName: 'Actions', cellTemplate: ACTIONS_TEMPLATE, field: 'actions', minWidth: 70, width: 70, enableFiltering: false, enableSorting: false, visible: false},
-    {name: 'user', displayName: 'User', categoryDisplayName: 'User', field: 'userName', cellTemplate: USER_TEMPLATE, minWidth: 160, enableFiltering: true, filter: { placeholder: 'Filter by name...' }},
+    {name: 'user', displayName: 'User', categoryDisplayName: 'User', field: 'userName', cellTemplate: USER_TEMPLATE, minWidth: 160, enableFiltering: true, pinnedLeft: true, filter: { placeholder: 'Filter by name...' }},
     {name: 'email', displayName: 'Email', categoryDisplayName: 'Email', field: 'email', cellTemplate: EMAIL_TEMPLATE, minWidth: 160, enableFiltering: false, filter: { placeholder: 'Filter by email...' }},
-    {name: 'company', displayName: 'Company', categoryDisplayName: 'Company', field: 'company', minWidth: 160, enableFiltering: true, filter: { placeholder: 'Filter by company...' }},
-    {name: 'country', displayName: 'Country', categoryDisplayName: 'Country', field: 'countryCode', minWidth: 120, enableFiltering: true, filter: { placeholder: 'Filter by country...' }},
-    {name: 'lastlogin', displayName: 'Last login', categoryDisplayName: 'Last login', field: 'lastLogin', cellFilter: 'date:"M/d/yy HH:mm"', minWidth: 105, width: 105, enableFiltering: false, visible: false},
+    {name: 'company', displayName: 'Company', categoryDisplayName: 'Company', field: 'company', minWidth: 180, enableFiltering: true, filter: { placeholder: 'Filter by company...' }},
+    {name: 'country', displayName: 'Country', categoryDisplayName: 'Country', field: 'countryCode', minWidth: 160, enableFiltering: true, filter: { placeholder: 'Filter by country...' }},
+    {name: 'lastlogin', displayName: 'Last login', categoryDisplayName: 'Last login', field: 'lastLogin', cellFilter: 'date:"M/d/yy HH:mm"', minWidth: 120, width: 120, enableFiltering: false, visible: false},
     {name: 'lastactivity', displayName: 'Last activity', categoryDisplayName: 'Last activity', field: 'lastActivity', cellFilter: 'date:"M/d/yy HH:mm"', minWidth: 130, width: 130, enableFiltering: false, visible: true, sort: { direction: 'desc', priority: 0 }},
     // Configurations
     {name: 'cfg_clusters', displayName: 'Clusters count', categoryDisplayName: 'Configurations', headerCellTemplate: CLUSTER_HEADER_TEMPLATE, field: 'counters.clusters', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Clusters count', minWidth: 65, width: 65, enableFiltering: false, visible: false},
@@ -66,15 +66,15 @@ export default [
     {name: 'qry', displayName: 'Qry', categoryDisplayName: 'Total activities', field: 'activitiesTotal["queries"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Total count of queries usages', minWidth: 70, width: 70, enableFiltering: false},
     {name: 'demo', displayName: 'Demo', categoryDisplayName: 'Total activities', field: 'activitiesTotal["demo"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Total count of demo startup', minWidth: 85, width: 85, enableFiltering: false},
     {name: 'dnld', displayName: 'Dnld', categoryDisplayName: 'Total activities', field: 'activitiesDetail["/agent/download"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Total count of agent downloads', minWidth: 80, width: 80, enableFiltering: false},
-    {name: 'starts', displayName: 'Starts', categoryDisplayName: 'Total activities', field: 'activitiesDetail["/agent/start"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Total count of agent startup', minWidth: 80, width: 80, enableFiltering: false},
+    {name: 'starts', displayName: 'Starts', categoryDisplayName: 'Total activities', field: 'activitiesDetail["/agent/start"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Total count of agent startup', minWidth: 87, width: 87, enableFiltering: false},
     // Activities Configuration
-    {name: 'clusters', displayName: 'Clusters', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/clusters"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Configuration clusters', minWidth: 80, width: 80, enableFiltering: false, visible: false},
-    {name: 'model', displayName: 'Model', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/domains"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Configuration model', minWidth: 80, width: 80, enableFiltering: false, visible: false},
-    {name: 'caches', displayName: 'Caches', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/caches"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Configuration caches', minWidth: 80, width: 80, enableFiltering: false, visible: false},
-    {name: 'igfs', displayName: 'IGFS', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/igfs"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Configuration IGFS', minWidth: 80, width: 80, enableFiltering: false, visible: false},
-    {name: 'summary', displayName: 'Summary', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/summary"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Configuration summary', minWidth: 80, width: 80, enableFiltering: false, visible: false},
+    {name: 'clusters', displayName: 'Clusters', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/clusters"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Configuration clusters', minWidth: 100, width: 100, enableFiltering: false, visible: false},
+    {name: 'model', displayName: 'Model', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/domains"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Configuration model', minWidth: 87, width: 87, enableFiltering: false, visible: false},
+    {name: 'caches', displayName: 'Caches', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/caches"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Configuration caches', minWidth: 96, width: 96, enableFiltering: false, visible: false},
+    {name: 'igfs', displayName: 'IGFS', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/igfs"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Configuration IGFS', minWidth: 85, width: 85, enableFiltering: false, visible: false},
+    {name: 'summary', displayName: 'Summary', categoryDisplayName: 'Configuration\'s activities', field: 'activitiesDetail["/configuration/summary"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Configuration summary', minWidth: 111, width: 111, enableFiltering: false, visible: false},
     // Activities Queries
-    {name: 'execute', displayName: 'Execute', categoryDisplayName: 'Queries\' activities', field: 'activitiesDetail["/queries/execute"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Query executions', minWidth: 65, width: 80, enableFiltering: false, visible: false},
-    {name: 'explain', displayName: 'Explain', categoryDisplayName: 'Queries\' activities', field: 'activitiesDetail["/queries/explain"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Query explain executions', minWidth: 65, width: 80, enableFiltering: false, visible: false},
-    {name: 'scan', displayName: 'Scan', categoryDisplayName: 'Queries\' activities', field: 'activitiesDetail["/queries/scan"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Scan query executions', minWidth: 65, width: 80, enableFiltering: false, visible: false}
+    {name: 'execute', displayName: 'Execute', categoryDisplayName: 'Queries\' activities', field: 'activitiesDetail["/queries/execute"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Query executions', minWidth: 98, width: 98, enableFiltering: false, visible: false},
+    {name: 'explain', displayName: 'Explain', categoryDisplayName: 'Queries\' activities', field: 'activitiesDetail["/queries/explain"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Query explain executions', minWidth: 95, width: 95, enableFiltering: false, visible: false},
+    {name: 'scan', displayName: 'Scan', categoryDisplayName: 'Queries\' activities', field: 'activitiesDetail["/queries/scan"] || 0', type: 'number', cellClass: 'ui-grid-number-cell', headerTooltip: 'Scan query executions', minWidth: 80, width: 80, enableFiltering: false, visible: false}
 ];

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
index 0fc1cd6..0faa561 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.controller.js
@@ -28,10 +28,14 @@ const rowTemplate = `<div
   role="{{col.isRowHeader ? 'rowheader' : 'gridcell'}}"
   ui-grid-cell/>`;
 
+const treeAggregationFinalizerFn = function(agg) {
+    return agg.rendered = agg.value;
+};
+
 export default class IgniteListOfRegisteredUsersCtrl {
-    static $inject = ['$scope', '$state', '$filter', 'User', 'uiGridGroupingConstants', 'IgniteAdminData', 'IgniteNotebookData', 'IgniteConfirm', 'IgniteActivitiesUserDialog'];
+    static $inject = ['$scope', '$state', '$filter', 'User', 'uiGridGroupingConstants', 'uiGridPinningConstants', 'IgniteAdminData', 'IgniteNotebookData', 'IgniteConfirm', 'IgniteActivitiesUserDialog'];
 
-    constructor($scope, $state, $filter, User, uiGridGroupingConstants, AdminData, NotebookData, Confirm, ActivitiesUserDialog) {
+    constructor($scope, $state, $filter, User, uiGridGroupingConstants, uiGridPinningConstants, AdminData, NotebookData, Confirm, ActivitiesUserDialog) {
         const $ctrl = this;
 
         const dtFilter = $filter('date');
@@ -45,6 +49,7 @@ export default class IgniteListOfRegisteredUsersCtrl {
             endDate: new Date()
         };
 
+        $ctrl.uiGridPinningConstants = uiGridPinningConstants;
         $ctrl.uiGridGroupingConstants = uiGridGroupingConstants;
 
         User.read().then((user) => $ctrl.user = user);
@@ -142,12 +147,12 @@ export default class IgniteListOfRegisteredUsersCtrl {
             columnDefs,
             categories,
 
+            treeRowHeaderAlwaysVisible: true,
             headerTemplate,
             columnVirtualizationThreshold: 30,
             rowTemplate,
             rowHeight: 46,
             selectWithCheckboxOnly: true,
-            selectionRowHeaderWidth: 52,
             suppressRemoveSort: false,
             enableFiltering: true,
             enableSelectAll: true,
@@ -293,118 +298,118 @@ export default class IgniteListOfRegisteredUsersCtrl {
         this.groupBy = 'user';
 
         this.gridApi.grouping.clearGrouping();
-        this.gridOptions.categories = this._userGridOptions.categories;
-        this.gridOptions.columnDefs = this._userGridOptions.columnDefs;
+        this.gridApi.selection.clearSelectedRows();
+
+        _.forEach(_.filter(this.gridApi.grid.columns, {name: 'company'}), (col) => {
+            this.gridApi.pinning.pinColumn(col, this.uiGridPinningConstants.container.NONE);
+        });
+
+        _.forEach(_.filter(this.gridApi.grid.columns, {name: 'country'}), (col) => {
+            this.gridApi.pinning.pinColumn(col, this.uiGridPinningConstants.container.NONE);
+        });
+
+        this.gridOptions.categories = categories;
     }
 
     groupByCompany() {
         this.groupBy = 'company';
 
         this.gridApi.grouping.clearGrouping();
+        this.gridApi.selection.clearSelectedRows();
+
+        _.forEach(this.gridApi.grid.columns, (col) => {
+            col.enableSorting = true;
+
+            if (col.colDef.type !== 'number')
+                return;
+
+            this.gridApi.grouping.aggregateColumn(col.colDef.name, this.uiGridGroupingConstants.aggregation.SUM);
+            col.customTreeAggregationFinalizerFn = treeAggregationFinalizerFn;
+        });
 
-        this.gridApi.grouping.groupColumn('company');
         this.gridApi.grouping.aggregateColumn('user', this.uiGridGroupingConstants.aggregation.COUNT);
+        _.forEach(_.filter(this.gridApi.grid.columns, {name: 'user'}), (col) => {
+            col.customTreeAggregationFinalizerFn = treeAggregationFinalizerFn;
+        });
 
-        if (this._companyGridOptions) {
-            this.gridOptions.categories = this._companyGridOptions.categories;
-            this.gridOptions.columnDefs = this._companyGridOptions.columnDefs;
+        this.gridApi.grouping.aggregateColumn('lastactivity', this.uiGridGroupingConstants.aggregation.MAX);
+        _.forEach(_.filter(this.gridApi.grid.columns, {name: 'lastactivity'}), (col) => {
+            col.customTreeAggregationFinalizerFn = treeAggregationFinalizerFn;
+        });
 
-            return;
-        }
+        this.gridApi.grouping.groupColumn('company');
+        _.forEach(_.filter(this.gridApi.grid.columns, {name: 'company'}), (col) => {
+            col.customTreeAggregationFinalizerFn = (agg) => agg.rendered = agg.groupVal;
+        });
 
-        const _categories = _.cloneDeep(categories);
-        const _columnDefs = _.cloneDeep(columnDefs);
+        // Pinning left company.
+        _.forEach(_.filter(this.gridApi.grid.columns, {name: 'company'}), (col) => {
+            this.gridApi.pinning.pinColumn(col, this.uiGridPinningConstants.container.LEFT);
+        });
 
+        // Unpinning country.
+        _.forEach(_.filter(this.gridApi.grid.columns, {name: 'country'}), (col) => {
+            this.gridApi.pinning.pinColumn(col, this.uiGridPinningConstants.container.NONE);
+        });
+
+        const _categories = _.cloneDeep(categories);
         // Cut company category.
         const company = _categories.splice(3, 1)[0];
         company.selectable = false;
 
-        // Hide Actions category.
-        _categories.splice(0, 1);
-
-        _.forEach(_.filter(_columnDefs, {displayName: 'Actions'}), (col) => {
-            col.visible = false;
-        });
-
         // Add company as first column.
         _categories.unshift(company);
+        this.gridOptions.categories = _categories;
+    }
+
+    groupByCountry() {
+        this.groupBy = 'country';
+
+        this.gridApi.grouping.clearGrouping();
+        this.gridApi.selection.clearSelectedRows();
 
-        _.forEach(_columnDefs, (col) => {
+        _.forEach(this.gridApi.grid.columns, (col) => {
             col.enableSorting = true;
 
-            if (col.type !== 'number')
+            if (col.colDef.type !== 'number')
                 return;
 
-            col.treeAggregationType = this.uiGridGroupingConstants.aggregation.SUM;
-            col.customTreeAggregationFinalizerFn = (agg) => agg.rendered = agg.value;
+            this.gridApi.grouping.aggregateColumn(col.colDef.name, this.uiGridGroupingConstants.aggregation.SUM);
+            col.customTreeAggregationFinalizerFn = treeAggregationFinalizerFn;
         });
 
-        // Set grouping to last activity column.
-        const lastactivity = _.find(_columnDefs, { name: 'lastactivity' });
-
-        if (_.nonNil(lastactivity)) {
-            lastactivity.treeAggregationType = this.uiGridGroupingConstants.aggregation.MAX;
-            lastactivity.customTreeAggregationFinalizerFn = (agg) => agg.rendered = agg.value;
-        }
-
-        this._companyGridOptions = {
-            categories: this.gridOptions.categories = _categories,
-            columnDefs: this.gridOptions.columnDefs = _columnDefs
-        };
-    }
+        this.gridApi.grouping.aggregateColumn('user', this.uiGridGroupingConstants.aggregation.COUNT);
+        _.forEach(_.filter(this.gridApi.grid.columns, {name: 'user'}), (col) => {
+            col.customTreeAggregationFinalizerFn = treeAggregationFinalizerFn;
+        });
 
-    groupByCountry() {
-        this.groupBy = 'country';
+        this.gridApi.grouping.aggregateColumn('lastactivity', this.uiGridGroupingConstants.aggregation.MAX);
+        _.forEach(_.filter(this.gridApi.grid.columns, {name: 'lastactivity'}), (col) => {
+            col.customTreeAggregationFinalizerFn = treeAggregationFinalizerFn;
+        });
 
-        this.gridApi.grouping.clearGrouping();
         this.gridApi.grouping.groupColumn('country');
-        this.gridApi.grouping.aggregateColumn('user', this.uiGridGroupingConstants.aggregation.COUNT);
+        _.forEach(_.filter(this.gridApi.grid.columns, {name: 'country'}), (col) => {
+            col.customTreeAggregationFinalizerFn = (agg) => agg.rendered = agg.groupVal;
+        });
 
-        if (this._countryGridOptions) {
-            this.gridOptions.categories = this._countryGridOptions.categories;
-            this.gridOptions.columnDefs = this._countryGridOptions.columnDefs;
+        // Pinning left country.
+        _.forEach(_.filter(this.gridApi.grid.columns, {name: 'country'}), (col) => {
+            this.gridApi.pinning.pinColumn(col, this.uiGridPinningConstants.container.LEFT);
+        });
 
-            return;
-        }
+        // Unpinning country.
+        _.forEach(_.filter(this.gridApi.grid.columns, {name: 'company'}), (col) => {
+            this.gridApi.pinning.pinColumn(col, this.uiGridPinningConstants.container.NONE);
+        });
 
         const _categories = _.cloneDeep(categories);
-        const _columnDefs = _.cloneDeep(columnDefs);
-
-        // Cut country category.
+        // Cut company category.
         const country = _categories.splice(4, 1)[0];
         country.selectable = false;
 
-        // Hide Actions category.
-        _categories.splice(0, 1);
-
-        _.forEach(_.filter(_columnDefs, {displayName: 'Actions'}), (col) => {
-            col.visible = false;
-        });
-
         // Add company as first column.
         _categories.unshift(country);
-
-        _.forEach(_columnDefs, (col) => {
-            col.enableSorting = true;
-
-            if (col.type !== 'number')
-                return;
-
-            col.treeAggregationType = this.uiGridGroupingConstants.aggregation.SUM;
-            col.customTreeAggregationFinalizerFn = (agg) => agg.rendered = agg.value;
-        });
-
-        // Set grouping to last activity column.
-        const lastactivity = _.find(_columnDefs, { name: 'lastactivity' });
-
-        if (_.nonNil(lastactivity)) {
-            lastactivity.treeAggregationType = this.uiGridGroupingConstants.aggregation.MAX;
-            lastactivity.customTreeAggregationFinalizerFn = (agg) => agg.rendered = agg.value;
-        }
-
-        this._countryGridOptions = {
-            categories: this.gridOptions.categories = _categories,
-            columnDefs: this.gridOptions.columnDefs = _columnDefs
-        };
+        this.gridOptions.categories = _categories;
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.tpl.pug b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.tpl.pug
index 0b8bf7e..b64a177 100644
--- a/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.tpl.pug
+++ b/modules/web-console/frontend/app/components/list-of-registered-users/list-of-registered-users.tpl.pug
@@ -18,7 +18,7 @@ include /app/helpers/jade/mixins
 
 mixin grid-settings()
     .grid-settings
-        i.fa.fa-cog(data-animation='am-flip-x' bs-dropdown='' aria-haspopup='true' aria-expanded='expanded' data-auto-close='1' data-trigger='click')
+        i.fa.gear-icon(data-animation='am-flip-x' bs-dropdown='' aria-haspopup='true' aria-expanded='expanded' data-auto-close='1' data-trigger='click')
         ul.select.dropdown-menu(role='menu')
             li
                 a(ng-click='$ctrl.gridOptions.selectedAll ? $ctrl.clearAllColumns() : $ctrl.selectAllColumns()')
@@ -51,13 +51,10 @@ mixin grid-settings()
 
     .panel--ignite
         .panel-heading.ui-grid-settings
-            .panel-title(ng-hide='$ctrl.selected.length')
-                span(ng-if='$ctrl.groupBy === "user"') List of registered users
-                span(ng-if='$ctrl.groupBy === "company"') List of registered companies
-                span(ng-if='$ctrl.groupBy === "country"') List of registered countries
-                +grid-settings
-                button.btn.btn--stroke(ng-click='$ctrl.exportCsv()' bs-tooltip data-title='Export table to csv')
-                    i.fa.fa-file-excel-o.export-icon
+            .panel-title
+                +ignite-form-field-bsdropdown('Actions', '$ctrl.action', 'action', '!$ctrl.selected.length', false, '$ctrl.actionOptions')
+                button.btn.btn--stroke(ng-click='$ctrl.exportCsv()' bs-tooltip='' data-title='Export table to csv' data-placement='top')
+                    i.fa.export-icon
                 form.ui-grid-settings-dateperiod(name=form novalidate)
                     -var form = 'admin'
                     +ignite-form-field-datepicker('Period: from', '$ctrl.params.startDate', '"startDate"', null, '$ctrl.params.endDate')
@@ -66,11 +63,13 @@ mixin grid-settings()
                     -var form = 'admin'
                     +ignite-form-field-text('Exclude:', '$ctrl.params.companiesExclude', '"exclude"', false, false, 'Exclude by company name...')
 
-            .panel-selected(ng-show='$ctrl.selected.length')
-                .pull-right
-                    +ignite-form-field-bsdropdown('Actions', '$ctrl.action', 'action', false, false, '$ctrl.actionOptions')
-                div
-                    | {{ $ctrl.selected.length }} item{{ $ctrl.selected.length > 1 ? 's' : '' }} selected
+                .ui-grid-settings--heading(ng-hide='$ctrl.selected.length')
+                    span(ng-if='$ctrl.groupBy === "user"') List of registered users
+                    span(ng-if='$ctrl.groupBy === "company"') List of registered companies
+                    span(ng-if='$ctrl.groupBy === "country"') List of registered countries
+                    +grid-settings
+                .panel-selected(ng-show='$ctrl.selected.length')
+                    | {{ $ctrl.selected.length }} item{{ $ctrl.selected.length > 1 ? 's' : '' }} selected            
 
         .panel-collapse
             .grid.ui-grid--ignite(ui-grid='$ctrl.gridOptions' ui-grid-resize-columns ui-grid-selection ui-grid-exporter ui-grid-pinning ui-grid-grouping)

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/app/primitives/badge/index.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/badge/index.scss b/modules/web-console/frontend/app/primitives/badge/index.scss
index 8ce477f..79082e0 100644
--- a/modules/web-console/frontend/app/primitives/badge/index.scss
+++ b/modules/web-console/frontend/app/primitives/badge/index.scss
@@ -29,6 +29,7 @@
   color: white;
   font-family: Roboto;
   font-size: 12px;
+  font-weight: 500;
   text-align: center;
   line-height: 12px;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/app/primitives/btn/index.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/btn/index.scss b/modules/web-console/frontend/app/primitives/btn/index.scss
index 1eb027f..ec62df4 100644
--- a/modules/web-console/frontend/app/primitives/btn/index.scss
+++ b/modules/web-console/frontend/app/primitives/btn/index.scss
@@ -19,23 +19,39 @@
     min-width: 36px;
     height: 36px;
 
-    line-height: 36px;
+    line-height: 34px;
     text-align: center;
 
     color: #ee2b27;
     border: 1px solid #ee2b27;
     background: initial;
 
+    i {
+        margin: 0;
+
+        &.export-icon {
+            display: block;
+            width: 16px;
+            height: 16px;
+            margin: auto;
+
+            background-image: url('/images/icons/export.svg');
+            background-repeat: no-repeat;
+            background-position: center;
+        }
+    }
+
     &:hover, &:focus {
         color: #a8110f;
         border-color: #a8110f;
+
+        i {
+            filter: hue-rotate(1deg) saturate(85) brightness(.66);
+        }
     }
 
     &:focus {
         outline: none;
     }
 
-    i {
-        margin: 0;
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/app/primitives/dropdown/index.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/dropdown/index.pug b/modules/web-console/frontend/app/primitives/dropdown/index.pug
index a6476eb..dfd229c 100644
--- a/modules/web-console/frontend/app/primitives/dropdown/index.pug
+++ b/modules/web-console/frontend/app/primitives/dropdown/index.pug
@@ -32,7 +32,7 @@ mixin ignite-form-field-bsdropdown(label, model, name, disabled, required, optio
             tabindex='0'
             aria-haspopup='true'
             aria-expanded='false'
-        )&attributes(attributes.attributes)
+        )&attributes(attributes)
             a.dropdown-toggle
                 span !{label}
                 span.caret

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/app/primitives/dropdown/index.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/dropdown/index.scss b/modules/web-console/frontend/app/primitives/dropdown/index.scss
index e474534..adf87ca 100644
--- a/modules/web-console/frontend/app/primitives/dropdown/index.scss
+++ b/modules/web-console/frontend/app/primitives/dropdown/index.scss
@@ -29,6 +29,8 @@
     .ignite-form-field__control {
         outline: none;
 
+        font-size: 14px;
+
         & > a {
             display: inline-block;
             height: 36px;
@@ -39,7 +41,7 @@
             border-radius: 4px;
 
             color: #de4538;
-            line-height: 36px;
+            line-height: 34px;
 
             .caret {
                 margin-left: 9px;
@@ -78,5 +80,27 @@
                 border-bottom: 1px solid #dddddd;
             }
         }
+
+        &[disabled='disabled'] {
+            opacity: .5;
+
+            & > a {
+                border-color: #c5c5c5;
+
+                color: #393939;
+            }
+
+            &:hover, &:focus {
+                & > a {
+                    border-color: #c5c5c5;
+
+                    color: #393939;
+                }
+            }
+
+            ul {
+                display: none !important;
+            }
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/app/primitives/panel/index.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/panel/index.scss b/modules/web-console/frontend/app/primitives/panel/index.scss
index 826d33e..d6cae27 100644
--- a/modules/web-console/frontend/app/primitives/panel/index.scss
+++ b/modules/web-console/frontend/app/primitives/panel/index.scss
@@ -19,7 +19,7 @@
 
 .panel--ignite {
   border: none;
-  border-radius: 0;
+  border-radius: 0 0 4px 4px;
 
   font-family: Roboto;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/app/primitives/ui-grid-header/index.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/ui-grid-header/index.scss b/modules/web-console/frontend/app/primitives/ui-grid-header/index.scss
index 4530c02..7b3ce7b 100644
--- a/modules/web-console/frontend/app/primitives/ui-grid-header/index.scss
+++ b/modules/web-console/frontend/app/primitives/ui-grid-header/index.scss
@@ -15,7 +15,11 @@
  * limitations under the License.
  */
 
+@import '../../../public/stylesheets/variables';
+
 .ui-grid-header--subcategories {
+    border-color: $table-border-color;
+
     .ui-grid-row:nth-child(even) .ui-grid-cell.cell-total {
         background-color: rgba(102,175,233,.6);
     }
@@ -34,6 +38,10 @@
         }
     }
 
+    .ui-grid-header-cell:last-child .ui-grid-column-resizer.right {
+        border-color: $table-border-color;
+    }
+
     .ui-grid-header-cell [role="columnheader"] {
         display: flex;
         
@@ -81,7 +89,7 @@
         }
 
         & > div > .ui-grid-cell-contents {
-            border-bottom: 1px solid #d4d4d4;
+            border-bottom: 1px solid $table-border-color;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/app/primitives/ui-grid-header/index.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/ui-grid-header/index.tpl.pug b/modules/web-console/frontend/app/primitives/ui-grid-header/index.tpl.pug
index 1b91d9e..8a41881 100644
--- a/modules/web-console/frontend/app/primitives/ui-grid-header/index.tpl.pug
+++ b/modules/web-console/frontend/app/primitives/ui-grid-header/index.tpl.pug
@@ -20,10 +20,18 @@
             .ui-grid-header-canvas
                 .ui-grid-header-cell-wrapper(ng-style='colContainer.headerCellWrapperStyle()')
                     .ui-grid-header-cell-row(role='row')
+                        .ui-grid-header-cell.ui-grid-clearfix(
+                            ng-if='col.colDef.name === "treeBaseRowHeaderCol" || col.colDef.name === "selectionRowHeaderCol"'
+                            ng-repeat='col in colContainer.renderedColumns track by col.uid'
+                            ng-class='{ disabled: !grid.options.multiSelect && col.colDef.name === "selectionRowHeaderCol"}'
+
+                            col='col'
+                            ui-grid-header-cell=''
+                            render-index='$index'
+                        )
                         .ui-grid-header-span.ui-grid-header-cell.ui-grid-clearfix.ui-grid-category(ng-repeat='cat in grid.options.categories', ng-if='cat.visible && \
                         (colContainer.renderedColumns | uiGridSubcategories: cat.name).length > 0')
                             div(ng-show='(colContainer.renderedColumns|uiGridSubcategories:cat.name).length > 1')
                                 .ui-grid-cell-contents {{ cat.name }}
                             .ui-grid-header-cell-row
                                 .ui-grid-header-cell.ui-grid-clearfix(ng-repeat='col in (colContainer.renderedColumns|uiGridSubcategories:cat.name) track by col.uid' ui-grid-header-cell='' col='col' render-index='$index')
-                        .ui-grid-header-cell.ui-grid-clearfix(ng-if='col.colDef.name === "treeBaseRowHeaderCol" || col.colDef.name === "selectionRowHeaderCol"' ng-repeat='col in colContainer.renderedColumns track by col.uid' ui-grid-header-cell='' col='col' render-index='$index' ng-class='{ disabled: !grid.options.multiSelect && col.colDef.name === "selectionRowHeaderCol"}')

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/app/primitives/ui-grid-settings/index.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/ui-grid-settings/index.scss b/modules/web-console/frontend/app/primitives/ui-grid-settings/index.scss
index 3519eb2..9cd497f 100644
--- a/modules/web-console/frontend/app/primitives/ui-grid-settings/index.scss
+++ b/modules/web-console/frontend/app/primitives/ui-grid-settings/index.scss
@@ -16,6 +16,8 @@
  */
 
 .ui-grid-settings {
+    color: #393939;
+
     ul.select.dropdown-menu {
         padding: 0;
 
@@ -63,7 +65,7 @@
                         content: '';
 
                         position: absolute;
-                        top: 0px;
+                        top: 0;
                         left: 3px;
 
                         width: 4px;
@@ -83,17 +85,16 @@
         }
     }
 
-    .btn {
-        float: right;
+    &--heading > span {
+        position: relative;
+        top: -1px;
+    }
 
+    .btn {
         line-height: 20px;
-        margin-right: 0;
     }
 
     &-filter {
-        float: right;
-        margin-right: 35px;
-
         .ignite-form-field {
             $height: 36px;
 
@@ -123,8 +124,6 @@
     }
 
     &-number-filter {
-        float: right;
-
         .ignite-form-field {
             width: 180px;
             margin-right: 0;
@@ -158,14 +157,51 @@
     }
 
     &-dateperiod {
-        float: right;
         display: block;
         margin-right: 35px;
     }
+
+    .btn.btn--stroke,
+    .dropdown--ignite.ignite-form-field,
+    &-filter,
+    &-number-filter,
+    &-dateperiod {
+        float: right;
+
+        margin-left: 20px;
+        margin-right: 0;
+    }
+
+    &-dateperiod {
+        margin-left: 15px;
+        margin-right: -5px;
+    }
+
+    .grid-settings {
+        i.gear-icon {
+            position: relative;
+            top: 2px;
+
+            display: block;
+            width: 16px;
+            height: 16px;
+            margin: auto;
+
+            background-image: url('/images/icons/gear.svg');
+            background-repeat: no-repeat;
+            background-position: center;
+        }
+
+        &:hover, &:focus {
+            i.gear-icon {
+                filter: hue-rotate(1deg) saturate(85) brightness(.66);
+            }
+        }
+    }
 }
 
 .grid-settings {
     display: inline-block;
 
     margin-left: 10px;
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/app/primitives/ui-grid/index.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/ui-grid/index.scss b/modules/web-console/frontend/app/primitives/ui-grid/index.scss
index 8e2fbaa..89e5c49 100644
--- a/modules/web-console/frontend/app/primitives/ui-grid/index.scss
+++ b/modules/web-console/frontend/app/primitives/ui-grid/index.scss
@@ -40,10 +40,19 @@
         border-color: transparent;
     }
 
-    .ui-grid-cell-contents {
-        font-family: Roboto;
+    .ui-grid-cell,
+    .ui-grid-header-cell {
+        .ui-grid-cell-contents {
+            padding: 13px 20px;
 
-        padding: 13px 20px;
+            text-align: left;
+            font-family: Roboto;
+        }
+    }
+
+    .ui-grid-contents-wrapper {
+        border-bottom-right-radius: 6px;
+        overflow: hidden;
     }
 
     .ui-grid-render-container-body {
@@ -57,12 +66,6 @@
                     text-align: right;
                 }
             }
-
-            &:first-child {
-                .ui-grid-cell-contents {
-                    padding-left: 0;
-                }            
-            }
         }
     }
 
@@ -70,19 +73,6 @@
         .ui-grid-header-span {
             background: initial;
 
-            &:first-child {
-                .ui-grid-cell-contents {
-                    padding-left: 0;
-                }
-
-                .ng-hide + .ui-grid-header-cell-row {
-                    .ui-grid-cell-contents,
-                    .ui-grid-filter-container {
-                        padding-left: 0;
-                    }
-                }
-            }
-
             .ui-grid-cell-contents {
                 color: $gray-light;
                 font-size: 14px;
@@ -141,21 +131,31 @@
                         width: auto;
                     }
                 }
+
+                &:before {
+                    content: '';
+
+                    position: absolute;
+                    top: 0;
+                    right: 9px;
+                    z-index: 1000;
+                    
+                    width: 5px;
+                    height: 100%;
+                    
+                    opacity: .2;
+                    box-shadow: 2px 0 3px #000;
+                    border-right: 1px solid #000;
+                }
             }
         }
     }
 
     .ui-grid-pinned-container-left .ui-grid-header-cell:last-child {
-        max-width: 52px;
-        min-width: 52px;
-
         border-width: 0;
     }
 
     .ui-grid-pinned-container-left .ui-grid-cell:last-child {
-        min-width: 52px;
-        max-width: 52px;
-
         border-width: 0;
         background-color: initial;
     }
@@ -182,7 +182,7 @@
         &.ui-grid-row-selected > [ui-grid-row] > .ui-grid-cell {
             background-color: #e5f2f9;
 
-            box-shadow: 0 -1px 0 0 rgba(117, 117, 117, 0.25), 0 1px 0 0 rgba(117, 117, 117, 0.25);
+            box-shadow: 0 -1px 0 0 #c6cfd8, 0 1px 0 0 #c6cfd8;
         }
     }
 
@@ -305,15 +305,23 @@
             .ui-grid-header-cell-row {
                 .ui-grid-header-cell {
                     border-right: none;
-                    padding-top: 12px;
 
                     &.disabled {
-                        opacity: .5;
+                        opacity: .2;
 
                         .ui-grid-icon-ok {
                             cursor: default;
                         }
                     }
+
+                    &:last-child {
+                        .ui-grid-header-cell {
+                            .ui-grid-column-resizer {
+                                right: -1px;
+                                opacity: 0;
+                            }
+                        }
+                    }
                 }
             }
         }
@@ -322,8 +330,87 @@
             .ui-grid-row {
                 .ui-grid-cell {
                     border-bottom: none;
+
+                    &:nth-child(2) {
+                        overflow: visible;
+                    }
+                }
+            }
+        }
+
+        .ui-grid-tree-header-row {
+            .ui-grid-selection-row-header-buttons {
+                opacity: .2;
+                cursor: default;
+            }
+
+            & ~ .ui-grid-row:not(.ui-grid-tree-header-row) {
+                position: relative;
+
+                &::before {
+                    content: '';
+                    position: absolute;
+                    top: 0;
+                    left: 0;
+                    z-index: 1;
+
+                    width: 4px;
+                    height: 46px;
+                    
+                    background: #0067b9;
+                    box-shadow: 0 -1px 0 0 rgba(0, 0, 0, .3), 0 -1px 0 0 rgba(0, 103, 185, 1);
                 }
             }
         }
     }
+
+    .ui-grid-tree-header-row {
+        font-weight: normal !important;
+    }
+
+    input[type="text"].ui-grid-filter-input {
+        display: block;
+        width: 100%;
+        height: 28px;
+        padding: 3px 3px;
+
+        border: 1px solid #ccc;
+        border-radius: 4px;
+        background-color: #fff;
+        background-image: none;
+
+        color: #393939;
+        text-align: left;
+        font-size: 14px;
+        line-height: 1.42857;
+
+        box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
+        transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
+
+        &::placeholder {
+            color: #999;
+        }
+
+        &:focus {
+            outline: none;
+
+            box-shadow: none;
+            border-color: #66afe9;
+        }
+    }
+
+    .ui-grid-icon-cancel {
+        &:before {
+            content: '';
+    
+            display: block;
+            width: 16px;
+            height: 16px;
+            margin: 8px 5px;
+
+            background-image: url('/images/icons/cross.svg');
+            background-repeat: no-repeat;
+            background-position: center;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/gulpfile.babel.js/paths.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/paths.js b/modules/web-console/frontend/gulpfile.babel.js/paths.js
index 627b2f9..92b354a 100644
--- a/modules/web-console/frontend/gulpfile.babel.js/paths.js
+++ b/modules/web-console/frontend/gulpfile.babel.js/paths.js
@@ -39,6 +39,7 @@ const appModulePaths = [
 ];
 
 const resourcePaths = [
+    './public/**/*.svg',
     './public/**/*.png',
     './public/*.ico'
 ];

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/gulpfile.babel.js/tasks/bundle.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/tasks/bundle.js b/modules/web-console/frontend/gulpfile.babel.js/tasks/bundle.js
index ac3ac76..07244b9 100644
--- a/modules/web-console/frontend/gulpfile.babel.js/tasks/bundle.js
+++ b/modules/web-console/frontend/gulpfile.babel.js/tasks/bundle.js
@@ -28,7 +28,7 @@ gulp.task('bundle', (cb) => {
     if (process.env.NODE_ENV === 'development') {
         // Important! Call webpack and WebpackDevServer must be inline.
         new WebpackDevServer(webpack(webpackConfig), devServerConfig)
-            .listen(devServerConfig.port, 'localhost', cb);
+            .listen(devServerConfig.port, devServerConfig.host || 'localhost', cb);
     }
     else
         webpack(webpackConfig, cb);

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/development.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/development.js b/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/development.js
index c837c43..87094a8 100644
--- a/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/development.js
+++ b/modules/web-console/frontend/gulpfile.babel.js/webpack/environments/development.js
@@ -18,7 +18,8 @@
 import {destDir} from '../../paths';
 
 const backendPort = 3000;
-const devServerPort = 9000;
+const devServerPort = process.env.PORT || 9000;
+const devServerHost = process.env.HOST;
 
 export default {
     devtool: 'source-map',
@@ -56,6 +57,7 @@ export default {
             colors: true,
             chunks: false
         },
+        host: devServerHost,
         port: devServerPort
     }
 };

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/public/images/icons/cross.svg
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/images/icons/cross.svg b/modules/web-console/frontend/public/images/icons/cross.svg
new file mode 100644
index 0000000..1a10375
--- /dev/null
+++ b/modules/web-console/frontend/public/images/icons/cross.svg
@@ -0,0 +1 @@
+<svg id="cross-icon" width="12" height="12" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg"><path fill="#757575" d="M10.791 0L6 4.791 1.209 0 0 1.209 4.791 6 0 10.791 1.209 12 6 7.209 10.791 12 12 10.791 7.209 6 12 1.209z" fill-rule="evenodd"/></svg>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/public/images/icons/export.svg
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/images/icons/export.svg b/modules/web-console/frontend/public/images/icons/export.svg
new file mode 100644
index 0000000..359c3df
--- /dev/null
+++ b/modules/web-console/frontend/public/images/icons/export.svg
@@ -0,0 +1 @@
+<svg id="export-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#ee2b27" d="M10.4 61.6v380.8l280.1 49.8V11.8L10.4 61.6zm161 270.5l-23.5-61.7-23.1 58.5H92.7l37.5-81.6-34.8-80h33l21.3 55.2 25.3-59.9 31.7-1.6-39.6 85.5 41.2 88.3-36.9-2.7zM489.3 61.1H300v27.8h71.2V139H300v15.1h71.2v50.1H300v15.1h71.2v50.1H300v15.1h71.2v50.2H300v15.4h71.2v50.1H300v32.2h189.3c5.4 0 9.7-4.5 9.7-10V71.2c0-5.6-4.4-10.1-9.7-10.1zm-23.1 339.2h-80.3v-50.1h80.3v50.1zm0-65.5h-80.3v-50.2h80.3v50.2zm0-65.2h-80.3v-50.1h80.3v50.1zm0-65.3h-80.3v-50.2h80.3v50.2zm0-65.2h-80.3V88.9h80.3v50.2z"/></svg>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/public/images/icons/gear.svg
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/images/icons/gear.svg b/modules/web-console/frontend/public/images/icons/gear.svg
new file mode 100644
index 0000000..a9a7269
--- /dev/null
+++ b/modules/web-console/frontend/public/images/icons/gear.svg
@@ -0,0 +1 @@
+<svg id="gear-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><style>.st0{fill:#424242}</style><path class="st0" d="M14.1 8.8c0-.3.1-.5.1-.8 0-.3 0-.5-.1-.8l1.7-1.3c.2-.1.2-.3.1-.5l-1.6-2.8c-.1-.2-.3-.2-.5-.2l-2 .8c-.4-.3-.9-.6-1.4-.8L10.1.3C10 .1 9.8 0 9.6 0H6.4c-.3 0-.4.1-.5.3l-.3 2.2c-.5.2-1 .5-1.4.8l-2-.8c-.2-.1-.4-.1-.5.1L.1 5.4c-.1.2-.1.4.1.5l1.7 1.3c0 .3-.1.5-.1.8 0 .3 0 .5.1.8L.2 10.1c-.2.1-.2.3-.1.5l1.6 2.8c.1.2.3.2.5.2l2-.8c.4.3.9.6 1.4.8l.3 2.1c.1.2.2.3.5.3h3.3c.2 0 .4-.1.4-.3l.3-2.1c.5-.2 1-.5 1.4-.8l2 .8c.2.1.4 0 .5-.2l1.6-2.8c.1-.2.1-.4-.1-.5l-1.7-1.3zM8 11c-1.7 0-3-1.3-3-3s1.3-3 3-3 3 1.3 3 3-1.3 3-3 3z"/></svg>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/frontend/public/stylesheets/_bootstrap-variables.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/public/stylesheets/_bootstrap-variables.scss b/modules/web-console/frontend/public/stylesheets/_bootstrap-variables.scss
index e308de3..d6a51e3 100644
--- a/modules/web-console/frontend/public/stylesheets/_bootstrap-variables.scss
+++ b/modules/web-console/frontend/public/stylesheets/_bootstrap-variables.scss
@@ -29,7 +29,7 @@ $gray-base:              #000 !default;
 $gray-darker:            lighten($gray-base, 13.5%) !default; // #222
 $gray-dark:              lighten($gray-base, 20%) !default;   // #333
 $gray:                   lighten($gray-base, 33.5%) !default; // #555
-$gray-light:             lighten($gray-base, 46.7%) !default; // #777
+$gray-light:             lighten($gray-base, 46%) !default;   // #757575
 $gray-lighter:           lighten($gray-base, 93.5%) !default; // #eee
 
 $brand-primary:         #ec1c24 !default;
@@ -46,7 +46,7 @@ $brand-danger:          #d9534f !default;
 //** Background color for `<body>`.
 $body-bg:               #f9f9f9 !default;
 //** Global text color on `<body>`.
-$text-color:            $gray-dark !default;
+$text-color:            #393939 !default;
 
 //** Global textual link color.
 $link-color:            $brand-primary !default;

http://git-wip-us.apache.org/repos/asf/ignite/blob/c829aaca/modules/web-console/licenses/cc-by-3.0.txt
----------------------------------------------------------------------
diff --git a/modules/web-console/licenses/cc-by-3.0.txt b/modules/web-console/licenses/cc-by-3.0.txt
new file mode 100644
index 0000000..bd32fa8
--- /dev/null
+++ b/modules/web-console/licenses/cc-by-3.0.txt
@@ -0,0 +1,319 @@
+Creative Commons Legal Code
+
+Attribution 3.0 Unported
+
+    CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
+    LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN
+    ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+    INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
+    REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR
+    DAMAGES RESULTING FROM ITS USE.
+
+License
+
+THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE
+COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY
+COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
+AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
+
+BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE
+TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY
+BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS
+CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND
+CONDITIONS.
+
+1. Definitions
+
+ a. "Adaptation" means a work based upon the Work, or upon the Work and
+    other pre-existing works, such as a translation, adaptation,
+    derivative work, arrangement of music or other alterations of a
+    literary or artistic work, or phonogram or performance and includes
+    cinematographic adaptations or any other form in which the Work may be
+    recast, transformed, or adapted including in any form recognizably
+    derived from the original, except that a work that constitutes a
+    Collection will not be considered an Adaptation for the purpose of
+    this License. For the avoidance of doubt, where the Work is a musical
+    work, performance or phonogram, the synchronization of the Work in
+    timed-relation with a moving image ("synching") will be considered an
+    Adaptation for the purpose of this License.
+ b. "Collection" means a collection of literary or artistic works, such as
+    encyclopedias and anthologies, or performances, phonograms or
+    broadcasts, or other works or subject matter other than works listed
+    in Section 1(f) below, which, by reason of the selection and
+    arrangement of their contents, constitute intellectual creations, in
+    which the Work is included in its entirety in unmodified form along
+    with one or more other contributions, each constituting separate and
+    independent works in themselves, which together are assembled into a
+    collective whole. A work that constitutes a Collection will not be
+    considered an Adaptation (as defined above) for the purposes of this
+    License.
+ c. "Distribute" means to make available to the public the original and
+    copies of the Work or Adaptation, as appropriate, through sale or
+    other transfer of ownership.
+ d. "Licensor" means the individual, individuals, entity or entities that
+    offer(s) the Work under the terms of this License.
+ e. "Original Author" means, in the case of a literary or artistic work,
+    the individual, individuals, entity or entities who created the Work
+    or if no individual or entity can be identified, the publisher; and in
+    addition (i) in the case of a performance the actors, singers,
+    musicians, dancers, and other persons who act, sing, deliver, declaim,
+    play in, interpret or otherwise perform literary or artistic works or
+    expressions of folklore; (ii) in the case of a phonogram the producer
+    being the person or legal entity who first fixes the sounds of a
+    performance or other sounds; and, (iii) in the case of broadcasts, the
+    organization that transmits the broadcast.
+ f. "Work" means the literary and/or artistic work offered under the terms
+    of this License including without limitation any production in the
+    literary, scientific and artistic domain, whatever may be the mode or
+    form of its expression including digital form, such as a book,
+    pamphlet and other writing; a lecture, address, sermon or other work
+    of the same nature; a dramatic or dramatico-musical work; a
+    choreographic work or entertainment in dumb show; a musical
+    composition with or without words; a cinematographic work to which are
+    assimilated works expressed by a process analogous to cinematography;
+    a work of drawing, painting, architecture, sculpture, engraving or
+    lithography; a photographic work to which are assimilated works
+    expressed by a process analogous to photography; a work of applied
+    art; an illustration, map, plan, sketch or three-dimensional work
+    relative to geography, topography, architecture or science; a
+    performance; a broadcast; a phonogram; a compilation of data to the
+    extent it is protected as a copyrightable work; or a work performed by
+    a variety or circus performer to the extent it is not otherwise
+    considered a literary or artistic work.
+ g. "You" means an individual or entity exercising rights under this
+    License who has not previously violated the terms of this License with
+    respect to the Work, or who has received express permission from the
+    Licensor to exercise rights under this License despite a previous
+    violation.
+ h. "Publicly Perform" means to perform public recitations of the Work and
+    to communicate to the public those public recitations, by any means or
+    process, including by wire or wireless means or public digital
+    performances; to make available to the public Works in such a way that
+    members of the public may access these Works from a place and at a
+    place individually chosen by them; to perform the Work to the public
+    by any means or process and the communication to the public of the
+    performances of the Work, including by public digital performance; to
+    broadcast and rebroadcast the Work by any means including signs,
+    sounds or images.
+ i. "Reproduce" means to make copies of the Work by any means including
+    without limitation by sound or visual recordings and the right of
+    fixation and reproducing fixations of the Work, including storage of a
+    protected performance or phonogram in digital form or other electronic
+    medium.
+
+2. Fair Dealing Rights. Nothing in this License is intended to reduce,
+limit, or restrict any uses free from copyright or rights arising from
+limitations or exceptions that are provided for in connection with the
+copyright protection under copyright law or other applicable laws.
+
+3. License Grant. Subject to the terms and conditions of this License,
+Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
+perpetual (for the duration of the applicable copyright) license to
+exercise the rights in the Work as stated below:
+
+ a. to Reproduce the Work, to incorporate the Work into one or more
+    Collections, and to Reproduce the Work as incorporated in the
+    Collections;
+ b. to create and Reproduce Adaptations provided that any such Adaptation,
+    including any translation in any medium, takes reasonable steps to
+    clearly label, demarcate or otherwise identify that changes were made
+    to the original Work. For example, a translation could be marked "The
+    original work was translated from English to Spanish," or a
+    modification could indicate "The original work has been modified.";
+ c. to Distribute and Publicly Perform the Work including as incorporated
+    in Collections; and,
+ d. to Distribute and Publicly Perform Adaptations.
+ e. For the avoidance of doubt:
+
+     i. Non-waivable Compulsory License Schemes. In those jurisdictions in
+        which the right to collect royalties through any statutory or
+        compulsory licensing scheme cannot be waived, the Licensor
+        reserves the exclusive right to collect such royalties for any
+        exercise by You of the rights granted under this License;
+    ii. Waivable Compulsory License Schemes. In those jurisdictions in
+        which the right to collect royalties through any statutory or
+        compulsory licensing scheme can be waived, the Licensor waives the
+        exclusive right to collect such royalties for any exercise by You
+        of the rights granted under this License; and,
+   iii. Voluntary License Schemes. The Licensor waives the right to
+        collect royalties, whether individually or, in the event that the
+        Licensor is a member of a collecting society that administers
+        voluntary licensing schemes, via that society, from any exercise
+        by You of the rights granted under this License.
+
+The above rights may be exercised in all media and formats whether now
+known or hereafter devised. The above rights include the right to make
+such modifications as are technically necessary to exercise the rights in
+other media and formats. Subject to Section 8(f), all rights not expressly
+granted by Licensor are hereby reserved.
+
+4. Restrictions. The license granted in Section 3 above is expressly made
+subject to and limited by the following restrictions:
+
+ a. You may Distribute or Publicly Perform the Work only under the terms
+    of this License. You must include a copy of, or the Uniform Resource
+    Identifier (URI) for, this License with every copy of the Work You
+    Distribute or Publicly Perform. You may not offer or impose any terms
+    on the Work that restrict the terms of this License or the ability of
+    the recipient of the Work to exercise the rights granted to that
+    recipient under the terms of the License. You may not sublicense the
+    Work. You must keep intact all notices that refer to this License and
+    to the disclaimer of warranties with every copy of the Work You
+    Distribute or Publicly Perform. When You Distribute or Publicly
+    Perform the Work, You may not impose any effective technological
+    measures on the Work that restrict the ability of a recipient of the
+    Work from You to exercise the rights granted to that recipient under
+    the terms of the License. This Section 4(a) applies to the Work as
+    incorporated in a Collection, but this does not require the Collection
+    apart from the Work itself to be made subject to the terms of this
+    License. If You create a Collection, upon notice from any Licensor You
+    must, to the extent practicable, remove from the Collection any credit
+    as required by Section 4(b), as requested. If You create an
+    Adaptation, upon notice from any Licensor You must, to the extent
+    practicable, remove from the Adaptation any credit as required by
+    Section 4(b), as requested.
+ b. If You Distribute, or Publicly Perform the Work or any Adaptations or
+    Collections, You must, unless a request has been made pursuant to
+    Section 4(a), keep intact all copyright notices for the Work and
+    provide, reasonable to the medium or means You are utilizing: (i) the
+    name of the Original Author (or pseudonym, if applicable) if supplied,
+    and/or if the Original Author and/or Licensor designate another party
+    or parties (e.g., a sponsor institute, publishing entity, journal) for
+    attribution ("Attribution Parties") in Licensor's copyright notice,
+    terms of service or by other reasonable means, the name of such party
+    or parties; (ii) the title of the Work if supplied; (iii) to the
+    extent reasonably practicable, the URI, if any, that Licensor
+    specifies to be associated with the Work, unless such URI does not
+    refer to the copyright notice or licensing information for the Work;
+    and (iv) , consistent with Section 3(b), in the case of an Adaptation,
+    a credit identifying the use of the Work in the Adaptation (e.g.,
+    "French translation of the Work by Original Author," or "Screenplay
+    based on original Work by Original Author"). The credit required by
+    this Section 4 (b) may be implemented in any reasonable manner;
+    provided, however, that in the case of a Adaptation or Collection, at
+    a minimum such credit will appear, if a credit for all contributing
+    authors of the Adaptation or Collection appears, then as part of these
+    credits and in a manner at least as prominent as the credits for the
+    other contributing authors. For the avoidance of doubt, You may only
+    use the credit required by this Section for the purpose of attribution
+    in the manner set out above and, by exercising Your rights under this
+    License, You may not implicitly or explicitly assert or imply any
+    connection with, sponsorship or endorsement by the Original Author,
+    Licensor and/or Attribution Parties, as appropriate, of You or Your
+    use of the Work, without the separate, express prior written
+    permission of the Original Author, Licensor and/or Attribution
+    Parties.
+ c. Except as otherwise agreed in writing by the Licensor or as may be
+    otherwise permitted by applicable law, if You Reproduce, Distribute or
+    Publicly Perform the Work either by itself or as part of any
+    Adaptations or Collections, You must not distort, mutilate, modify or
+    take other derogatory action in relation to the Work which would be
+    prejudicial to the Original Author's honor or reputation. Licensor
+    agrees that in those jurisdictions (e.g. Japan), in which any exercise
+    of the right granted in Section 3(b) of this License (the right to
+    make Adaptations) would be deemed to be a distortion, mutilation,
+    modification or other derogatory action prejudicial to the Original
+    Author's honor and reputation, the Licensor will waive or not assert,
+    as appropriate, this Section, to the fullest extent permitted by the
+    applicable national law, to enable You to reasonably exercise Your
+    right under Section 3(b) of this License (right to make Adaptations)
+    but not otherwise.
+
+5. Representations, Warranties and Disclaimer
+
+UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR
+OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY
+KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE,
+INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY,
+FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF
+LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS,
+WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION
+OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
+
+6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE
+LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR
+ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES
+ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. Termination
+
+ a. This License and the rights granted hereunder will terminate
+    automatically upon any breach by You of the terms of this License.
+    Individuals or entities who have received Adaptations or Collections
+    from You under this License, however, will not have their licenses
+    terminated provided such individuals or entities remain in full
+    compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will
+    survive any termination of this License.
+ b. Subject to the above terms and conditions, the license granted here is
+    perpetual (for the duration of the applicable copyright in the Work).
+    Notwithstanding the above, Licensor reserves the right to release the
+    Work under different license terms or to stop distributing the Work at
+    any time; provided, however that any such election will not serve to
+    withdraw this License (or any other license that has been, or is
+    required to be, granted under the terms of this License), and this
+    License will continue in full force and effect unless terminated as
+    stated above.
+
+8. Miscellaneous
+
+ a. Each time You Distribute or Publicly Perform the Work or a Collection,
+    the Licensor offers to the recipient a license to the Work on the same
+    terms and conditions as the license granted to You under this License.
+ b. Each time You Distribute or Publicly Perform an Adaptation, Licensor
+    offers to the recipient a license to the original Work on the same
+    terms and conditions as the license granted to You under this License.
+ c. If any provision of this License is invalid or unenforceable under
+    applicable law, it shall not affect the validity or enforceability of
+    the remainder of the terms of this License, and without further action
+    by the parties to this agreement, such provision shall be reformed to
+    the minimum extent necessary to make such provision valid and
+    enforceable.
+ d. No term or provision of this License shall be deemed waived and no
+    breach consented to unless such waiver or consent shall be in writing
+    and signed by the party to be charged with such waiver or consent.
+ e. This License constitutes the entire agreement between the parties with
+    respect to the Work licensed here. There are no understandings,
+    agreements or representations with respect to the Work not specified
+    here. Licensor shall not be bound by any additional provisions that
+    may appear in any communication from You. This License may not be
+    modified without the mutual written agreement of the Licensor and You.
+ f. The rights granted under, and the subject matter referenced, in this
+    License were drafted utilizing the terminology of the Berne Convention
+    for the Protection of Literary and Artistic Works (as amended on
+    September 28, 1979), the Rome Convention of 1961, the WIPO Copyright
+    Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996
+    and the Universal Copyright Convention (as revised on July 24, 1971).
+    These rights and subject matter take effect in the relevant
+    jurisdiction in which the License terms are sought to be enforced
+    according to the corresponding provisions of the implementation of
+    those treaty provisions in the applicable national law. If the
+    standard suite of rights granted under applicable copyright law
+    includes additional rights not granted under this License, such
+    additional rights are deemed to be included in the License; this
+    License is not intended to restrict the license of any rights under
+    applicable law.
+
+
+Creative Commons Notice
+
+    Creative Commons is not a party to this License, and makes no warranty
+    whatsoever in connection with the Work. Creative Commons will not be
+    liable to You or any party on any legal theory for any damages
+    whatsoever, including without limitation any general, special,
+    incidental or consequential damages arising in connection to this
+    license. Notwithstanding the foregoing two (2) sentences, if Creative
+    Commons has expressly identified itself as the Licensor hereunder, it
+    shall have all rights and obligations of Licensor.
+
+    Except for the limited purpose of indicating to the public that the
+    Work is licensed under the CCPL, Creative Commons does not authorize
+    the use by either party of the trademark "Creative Commons" or any
+    related trademark or logo of Creative Commons without the prior
+    written consent of Creative Commons. Any permitted use will be in
+    compliance with Creative Commons' then-current trademark usage
+    guidelines, as may be published on its website or otherwise made
+    available upon request from time to time. For the avoidance of doubt,
+    this trademark restriction does not form part of this License.
+
+    Creative Commons may be contacted at https://creativecommons.org/.
\ No newline at end of file


[26/51] [abbrv] ignite git commit: Merge remote-tracking branch 'origin/ignite-2.0' into ignite-2.0

Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-2.0' into ignite-2.0


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

Branch: refs/heads/ignite-5075-cacheStart
Commit: 50fe5aa5acb94c04565f9cc28f108f3f0c6ec7cf
Parents: 34a5ae3 efb7abc
Author: devozerov <vo...@gridgain.com>
Authored: Wed Apr 26 17:19:46 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Apr 26 17:19:46 2017 +0300

----------------------------------------------------------------------
 .../jdbc2/JdbcAbstractDmlStatementSelfTest.java |   6 +
 .../internal/jdbc2/JdbcMetadataSelfTest.java    |  28 +-
 .../ignite/jdbc/JdbcMetadataSelfTest.java       |   8 +-
 .../org/apache/ignite/cache/QueryEntity.java    |  81 ++++
 .../configuration/CacheConfiguration.java       |  12 +-
 .../cache/query/GridCacheQueryManager.java      |  14 +-
 .../utils/PlatformConfigurationUtils.java       |   6 +
 .../query/GridQueryTypeDescriptor.java          |  12 +
 .../query/QueryTypeDescriptorImpl.java          |  34 +-
 .../internal/processors/query/QueryUtils.java   | 134 +++++--
 .../IgniteOffheapReadWriteLockSelfTest.java     |  18 +-
 .../query/h2/DmlStatementsProcessor.java        |  17 +-
 .../processors/query/h2/IgniteH2Indexing.java   | 191 ++++++++-
 .../query/h2/dml/UpdatePlanBuilder.java         |  32 +-
 .../query/h2/opt/GridH2AbstractKeyValueRow.java |  78 ++--
 .../query/h2/opt/GridH2CollocationModel.java    |   4 +-
 .../query/h2/opt/GridH2IndexBase.java           |  15 +-
 .../query/h2/opt/GridH2KeyValueRowOffheap.java  |   6 +-
 .../query/h2/opt/GridH2KeyValueRowOnheap.java   |   6 +-
 .../query/h2/opt/GridH2ProxyIndex.java          | 204 ++++++++++
 .../query/h2/opt/GridH2ProxySpatialIndex.java   |  70 ++++
 .../query/h2/opt/GridH2RowDescriptor.java       |  67 ++++
 .../processors/query/h2/opt/GridH2Table.java    | 114 +++++-
 .../query/h2/opt/GridLuceneIndex.java           |   4 +-
 .../processors/query/h2/sql/DmlAstUtils.java    |  36 +-
 .../IgniteBinaryObjectQueryArgumentsTest.java   |   4 +-
 .../IgniteCacheAbstractFieldsQuerySelfTest.java |  15 +-
 .../IgniteCacheDeleteSqlQuerySelfTest.java      |   6 +-
 .../IgniteCacheUpdateSqlQuerySelfTest.java      |   8 +-
 .../cache/index/AbstractSchemaSelfTest.java     |   3 +
 .../index/DynamicIndexAbstractSelfTest.java     |   3 +
 .../query/IgniteSqlKeyValueFieldsTest.java      | 392 +++++++++++++++++++
 .../query/IgniteSqlSplitterSelfTest.java        |   8 +-
 .../h2/GridIndexingSpiAbstractSelfTest.java     |  10 +
 .../query/h2/sql/GridQueryParsingTest.java      |   2 +-
 .../IgniteCacheQuerySelfTestSuite.java          |   2 +
 .../core-test/config/cache-query-default.xml    |   6 +
 .../cpp/core-test/src/cache_query_test.cpp      |  82 ++++
 .../cpp/odbc-test/config/queries-default.xml    |   5 +
 .../cpp/odbc-test/include/complex_type.h        |  25 ++
 .../cpp/odbc-test/src/queries_test.cpp          | 148 +++++++
 .../Cache/Query/CacheLinqTest.cs                |   7 +
 .../Cache/Query/CacheQueriesTest.cs             |  52 +++
 .../IgniteConfigurationSerializerTest.cs        |   4 +-
 .../Cache/Configuration/QueryEntity.cs          |  20 +
 .../IgniteConfigurationSection.xsd              |  14 +
 .../Impl/CacheQueryExpressionVisitor.cs         |  14 +-
 .../Impl/CacheQueryModelVisitor.cs              |  12 +-
 48 files changed, 1835 insertions(+), 204 deletions(-)
----------------------------------------------------------------------



[30/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
index ea6e79b..9dc982c 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
@@ -296,7 +296,7 @@ public abstract class IgniteCacheAbstractInsertSqlQuerySelfTest extends GridComm
      * @return Cache configuration.
      */
     private static CacheConfiguration cacheConfig(String name, boolean partitioned, boolean escapeSql, Class<?>... idxTypes) {
-        return new CacheConfiguration()
+        return new CacheConfiguration(DEFAULT_CACHE_NAME)
             .setName(name)
             .setCacheMode(partitioned ? CacheMode.PARTITIONED : CacheMode.REPLICATED)
             .setAtomicityMode(CacheAtomicityMode.ATOMIC)

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
index c1e54cd..9c06900 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
@@ -626,7 +626,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac
      * @throws Exception In case of error.
      */
     public void testSimpleCustomTableName() throws Exception {
-        final IgniteCache<Integer, Object> cache = ignite().cache(null);
+        final IgniteCache<Integer, Object> cache = ignite().cache(DEFAULT_CACHE_NAME);
 
         cache.put(10, new Type1(1, "Type1 record #1"));
         cache.put(20, new Type1(2, "Type1 record #2"));
@@ -1212,7 +1212,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac
      * @throws Exception If failed.
      */
     public void testPaginationIteratorDefaultCache() throws Exception {
-        testPaginationIterator(jcache(ignite(), cacheConfiguration(), null, Integer.class, Integer.class));
+        testPaginationIterator(jcache(ignite(), cacheConfiguration(), DEFAULT_CACHE_NAME, Integer.class, Integer.class));
     }
 
     /**
@@ -1252,7 +1252,7 @@ public abstract class IgniteCacheAbstractQuerySelfTest extends GridCommonAbstrac
      * @throws Exception If failed.
      */
     public void testPaginationGetDefaultCache() throws Exception {
-        testPaginationGet(jcache(ignite(), cacheConfiguration(), null, Integer.class, Integer.class));
+        testPaginationGet(jcache(ignite(), cacheConfiguration(), DEFAULT_CACHE_NAME, Integer.class, Integer.class));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
index e1ee717..b50198c 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractSqlDmlQuerySelfTest.java
@@ -167,7 +167,7 @@ public abstract class IgniteCacheAbstractSqlDmlQuerySelfTest extends GridCommonA
      * @return Cache configuration.
      */
     protected static CacheConfiguration cacheConfig(String name, boolean partitioned, boolean escapeSql) {
-        return new CacheConfiguration()
+        return new CacheConfiguration(DEFAULT_CACHE_NAME)
             .setName(name)
             .setCacheMode(partitioned ? CacheMode.PARTITIONED : CacheMode.REPLICATED)
             .setAtomicityMode(CacheAtomicityMode.ATOMIC)

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCollocatedQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCollocatedQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCollocatedQuerySelfTest.java
index feebbf2..cd23611 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCollocatedQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCollocatedQuerySelfTest.java
@@ -103,7 +103,7 @@ public class IgniteCacheCollocatedQuerySelfTest extends GridCommonAbstractTest {
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-        ignite(0).cache(null).removeAll();
+        ignite(0).cache(DEFAULT_CACHE_NAME).removeAll();
     }
 
     /**
@@ -119,7 +119,7 @@ public class IgniteCacheCollocatedQuerySelfTest extends GridCommonAbstractTest {
      * Correct affinity.
      */
     public void testColocatedQueryRight() {
-        IgniteCache<AffinityUuid,Purchase> c = ignite(0).cache(null);
+        IgniteCache<AffinityUuid,Purchase> c = ignite(0).cache(DEFAULT_CACHE_NAME);
 
         Random rnd = new GridRandom(SEED);
 
@@ -146,7 +146,7 @@ public class IgniteCacheCollocatedQuerySelfTest extends GridCommonAbstractTest {
      * Correct affinity.
      */
     public void testColocatedQueryWrong() {
-        IgniteCache<AffinityUuid,Purchase> c = ignite(0).cache(null);
+        IgniteCache<AffinityUuid,Purchase> c = ignite(0).cache(DEFAULT_CACHE_NAME);
 
         Random rnd = new GridRandom(SEED);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationPrimitiveTypesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationPrimitiveTypesSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationPrimitiveTypesSelfTest.java
index 10203d4..4ea537b 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationPrimitiveTypesSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheConfigurationPrimitiveTypesSelfTest.java
@@ -59,31 +59,31 @@ public class IgniteCacheConfigurationPrimitiveTypesSelfTest extends GridCommonAb
     public void testPrimitiveTypes() throws Exception {
         Ignite ignite = startGrid(1);
 
-        IgniteCache<Byte, Byte> cacheByte = jcache(ignite, new CacheConfiguration(), byte.class, byte.class);
+        IgniteCache<Byte, Byte> cacheByte = jcache(ignite, new CacheConfiguration(DEFAULT_CACHE_NAME), byte.class, byte.class);
         byte b = 1;
         cacheByte.put(b, b);
 
-        IgniteCache<Short, Short> cacheShort = jcache(ignite, new CacheConfiguration(), short.class, short.class);
+        IgniteCache<Short, Short> cacheShort = jcache(ignite, new CacheConfiguration(DEFAULT_CACHE_NAME), short.class, short.class);
         short s = 2;
         cacheShort.put(s, s);
 
-        IgniteCache<Integer, Integer> cacheInt = jcache(ignite, new CacheConfiguration(), int.class, int.class);
+        IgniteCache<Integer, Integer> cacheInt = jcache(ignite, new CacheConfiguration(DEFAULT_CACHE_NAME), int.class, int.class);
         int i = 3;
         cacheInt.put(i, i);
 
-        IgniteCache<Long, Long> cacheLong = jcache(ignite, new CacheConfiguration(), long.class, long.class);
+        IgniteCache<Long, Long> cacheLong = jcache(ignite, new CacheConfiguration(DEFAULT_CACHE_NAME), long.class, long.class);
         long l = 4;
         cacheLong.put(l, l);
 
-        IgniteCache<Float, Float> cacheFloat = jcache(ignite, new CacheConfiguration(), float.class, float.class);
+        IgniteCache<Float, Float> cacheFloat = jcache(ignite, new CacheConfiguration(DEFAULT_CACHE_NAME), float.class, float.class);
         float f = 5;
         cacheFloat.put(f, f);
 
-        IgniteCache<Double, Double> cacheDouble = jcache(ignite, new CacheConfiguration(), double.class, double.class);
+        IgniteCache<Double, Double> cacheDouble = jcache(ignite, new CacheConfiguration(DEFAULT_CACHE_NAME), double.class, double.class);
         double d = 6;
         cacheDouble.put(d, d);
 
-        IgniteCache<Boolean, Boolean> cacheBoolean = jcache(ignite, new CacheConfiguration(), boolean.class, boolean.class);
+        IgniteCache<Boolean, Boolean> cacheBoolean = jcache(ignite, new CacheConfiguration(DEFAULT_CACHE_NAME), boolean.class, boolean.class);
         boolean bool = true;
         cacheBoolean.put(bool, bool);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCrossCacheJoinRandomTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCrossCacheJoinRandomTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCrossCacheJoinRandomTest.java
index b3525f4..638ac62 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCrossCacheJoinRandomTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheCrossCacheJoinRandomTest.java
@@ -173,7 +173,7 @@ public class IgniteCacheCrossCacheJoinRandomTest extends AbstractH2CompareQueryT
      * @return Cache configuration.
      */
     private CacheConfiguration configuration(String name, CacheMode cacheMode, int backups) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(name);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCollocatedAndNotTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCollocatedAndNotTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCollocatedAndNotTest.java
index 647ddc6..c3214d3 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCollocatedAndNotTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCollocatedAndNotTest.java
@@ -150,7 +150,7 @@ public class IgniteCacheDistributedJoinCollocatedAndNotTest extends GridCommonAb
      * @return Cache configuration.
      */
     private CacheConfiguration configuration(String name) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(name);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCustomAffinityMapper.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCustomAffinityMapper.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCustomAffinityMapper.java
index c1f6989..7c40a83 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCustomAffinityMapper.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinCustomAffinityMapper.java
@@ -136,7 +136,7 @@ public class IgniteCacheDistributedJoinCustomAffinityMapper extends GridCommonAb
      * @return Cache configuration.
      */
     private CacheConfiguration configuration(String name) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(name);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinNoIndexTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinNoIndexTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinNoIndexTest.java
index 5acd801..08e5244 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinNoIndexTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinNoIndexTest.java
@@ -108,7 +108,7 @@ public class IgniteCacheDistributedJoinNoIndexTest extends GridCommonAbstractTes
      * @return Cache configuration.
      */
     private CacheConfiguration configuration(String name) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(name);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinPartitionedAndReplicatedTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinPartitionedAndReplicatedTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinPartitionedAndReplicatedTest.java
index 5ef53eb..5e906af 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinPartitionedAndReplicatedTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinPartitionedAndReplicatedTest.java
@@ -82,7 +82,7 @@ public class IgniteCacheDistributedJoinPartitionedAndReplicatedTest extends Grid
      * @return Cache configuration.
      */
     private CacheConfiguration configuration(String name, CacheMode cacheMode) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(name);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinQueryConditionsTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinQueryConditionsTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinQueryConditionsTest.java
index f11bcd1..c183608 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinQueryConditionsTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinQueryConditionsTest.java
@@ -559,7 +559,7 @@ public class IgniteCacheDistributedJoinQueryConditionsTest extends GridCommonAbs
      * @return Configuration.
      */
     private CacheConfiguration cacheConfiguration(String name) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(name);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinTest.java
index e69b5ec..e643170 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDistributedJoinTest.java
@@ -57,7 +57,7 @@ public class IgniteCacheDistributedJoinTest extends GridCommonAbstractTest {
 
         spi.setIpFinder(IP_FINDER);
 
-        CacheConfiguration<Integer, A> ccfga = new CacheConfiguration<>();
+        CacheConfiguration<Integer, A> ccfga = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfga.setName("a");
         ccfga.setSqlSchema("A");
@@ -66,7 +66,7 @@ public class IgniteCacheDistributedJoinTest extends GridCommonAbstractTest {
         ccfga.setCacheMode(CacheMode.PARTITIONED);
         ccfga.setIndexedTypes(Integer.class, A.class);
 
-        CacheConfiguration<Integer, B> ccfgb = new CacheConfiguration<>();
+        CacheConfiguration<Integer, B> ccfgb = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfgb.setName("b");
         ccfgb.setSqlSchema("B");
@@ -75,7 +75,7 @@ public class IgniteCacheDistributedJoinTest extends GridCommonAbstractTest {
         ccfgb.setCacheMode(CacheMode.PARTITIONED);
         ccfgb.setIndexedTypes(Integer.class, B.class);
 
-        CacheConfiguration<Integer, C> ccfgc = new CacheConfiguration<>();
+        CacheConfiguration<Integer, C> ccfgc = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfgc.setName("c");
         ccfgc.setSqlSchema("C");

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheFieldsQueryNoDataSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheFieldsQueryNoDataSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheFieldsQueryNoDataSelfTest.java
index a23c126..dbb54d3 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheFieldsQueryNoDataSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheFieldsQueryNoDataSelfTest.java
@@ -75,7 +75,7 @@ public class IgniteCacheFieldsQueryNoDataSelfTest extends GridCommonAbstractTest
      * @throws Exception If failed.
      */
     public void testQuery() throws Exception {
-        Collection<Cache.Entry<Object, Object>> res = grid().cache(null)
+        Collection<Cache.Entry<Object, Object>> res = grid().cache(DEFAULT_CACHE_NAME)
             .query(new SqlQuery("Integer", "from Integer")).getAll();
 
         assert res != null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheFullTextQueryNodeJoiningSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheFullTextQueryNodeJoiningSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheFullTextQueryNodeJoiningSelfTest.java
index 877d47a..2a75bd3 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheFullTextQueryNodeJoiningSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheFullTextQueryNodeJoiningSelfTest.java
@@ -55,7 +55,7 @@ public class IgniteCacheFullTextQueryNodeJoiningSelfTest extends GridCommonAbstr
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration cache = new CacheConfiguration();
+        CacheConfiguration cache = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cache.setCacheMode(PARTITIONED);
         cache.setAtomicityMode(atomicityMode());
@@ -112,13 +112,13 @@ public class IgniteCacheFullTextQueryNodeJoiningSelfTest extends GridCommonAbstr
                 for (int i = 0; i < 1000; i++) {
                     IndexedEntity entity = new IndexedEntity("indexed " + i);
 
-                    grid(0).cache(null).put(new AffinityKey<>(i, i), entity);
+                    grid(0).cache(DEFAULT_CACHE_NAME).put(new AffinityKey<>(i, i), entity);
                 }
 
                 Ignite started = startGrid(GRID_CNT);
 
                 for (int i = 0; i < 100; i++) {
-                    QueryCursor<Cache.Entry<AffinityKey<Integer>, IndexedEntity>> res = started.cache(null)
+                    QueryCursor<Cache.Entry<AffinityKey<Integer>, IndexedEntity>> res = started.cache(DEFAULT_CACHE_NAME)
                         .query(new TextQuery<AffinityKey<Integer>, IndexedEntity>(IndexedEntity.class, "indexed"));
 
                     assertEquals(1000, res.getAll().size());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedCollocationTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedCollocationTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedCollocationTest.java
index 2d0e588..e7bfff3 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedCollocationTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedCollocationTest.java
@@ -133,7 +133,7 @@ public class IgniteCacheJoinPartitionedAndReplicatedCollocationTest extends Abst
      * @return Cache configuration.
      */
     private CacheConfiguration configuration(String name, int backups) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(name);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java
index 37b21c9..8bb7f53 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinPartitionedAndReplicatedTest.java
@@ -129,7 +129,7 @@ public class IgniteCacheJoinPartitionedAndReplicatedTest extends GridCommonAbstr
      * @return Cache configuration.
      */
     private CacheConfiguration configuration(String name) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(name);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinQueryWithAffinityKeyTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinQueryWithAffinityKeyTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinQueryWithAffinityKeyTest.java
index de81da3..4c7dbd0 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinQueryWithAffinityKeyTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheJoinQueryWithAffinityKeyTest.java
@@ -344,7 +344,7 @@ public class IgniteCacheJoinQueryWithAffinityKeyTest extends GridCommonAbstractT
         int backups,
         boolean affKey,
         boolean includeAffKey) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(cacheMode);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLargeResultSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLargeResultSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLargeResultSelfTest.java
index 5fca71a..a38f3fe 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLargeResultSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLargeResultSelfTest.java
@@ -78,7 +78,7 @@ public class IgniteCacheLargeResultSelfTest extends GridCommonAbstractTest {
      */
     public void testLargeResult() {
         // Fill cache.
-        try (IgniteDataStreamer<Integer, Integer> streamer = ignite(0).dataStreamer(null)) {
+        try (IgniteDataStreamer<Integer, Integer> streamer = ignite(0).dataStreamer(DEFAULT_CACHE_NAME)) {
             streamer.perNodeBufferSize(20000);
 
             for (int i = 0; i < 50_000; i++)  // default max merge table size is 10000
@@ -87,7 +87,7 @@ public class IgniteCacheLargeResultSelfTest extends GridCommonAbstractTest {
             streamer.flush();
         }
 
-        IgniteCache<Integer, Integer> cache = ignite(0).cache(null);
+        IgniteCache<Integer, Integer> cache = ignite(0).cache(DEFAULT_CACHE_NAME);
 
         try(QueryCursor<List<?>> res = cache.query(
             new SqlFieldsQuery("select _val from Integer where _key between ? and ?")

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java
index 629a5a8..83f5015 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunAbstractTest.java
@@ -39,6 +39,7 @@ import org.apache.ignite.internal.binary.BinaryMarshaller;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
 import org.apache.ignite.spi.failover.always.AlwaysFailoverSpi;
@@ -102,6 +103,9 @@ public class IgniteCacheLockPartitionOnAffinityRunAbstractTest extends GridCache
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
+        // Enables template with default test configuration
+        cfg.setCacheConfiguration(F.concat(cfg.getCacheConfiguration(), cacheConfiguration(igniteInstanceName).setName("*")));
+
         ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
 
         cfg.setMarshaller(new BinaryMarshaller());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMultipleIndexedTypesTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMultipleIndexedTypesTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMultipleIndexedTypesTest.java
index 75a4304..0614a05 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMultipleIndexedTypesTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheMultipleIndexedTypesTest.java
@@ -50,7 +50,7 @@ public class IgniteCacheMultipleIndexedTypesTest extends GridCommonAbstractTest
      * @throws Exception If failed.
      */
     public void testMultipleIndexedTypes() throws Exception {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         List<QueryEntity> qryEntities = new ArrayList<>();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheObjectKeyIndexingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheObjectKeyIndexingSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheObjectKeyIndexingSelfTest.java
index 9e3a0bc..5caa625 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheObjectKeyIndexingSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheObjectKeyIndexingSelfTest.java
@@ -49,7 +49,7 @@ public class IgniteCacheObjectKeyIndexingSelfTest extends GridCommonAbstractTest
 
     /** */
     protected static CacheConfiguration<Object, TestObject> cacheCfg() {
-        return new CacheConfiguration<Object, TestObject>()
+        return new CacheConfiguration<Object, TestObject>(DEFAULT_CACHE_NAME)
             .setIndexedTypes(Object.class, TestObject.class);
     }
 
@@ -104,9 +104,9 @@ public class IgniteCacheObjectKeyIndexingSelfTest extends GridCommonAbstractTest
     /** */
     @SuppressWarnings("ConstantConditions")
     private void assertItemsNumber(long num) {
-        assertEquals(num, grid().cachex().size());
+        assertEquals(num, grid().cachex(DEFAULT_CACHE_NAME).size());
 
-        assertEquals(num, grid().cache(null).query(new SqlFieldsQuery("select count(*) from TestObject")).getAll()
+        assertEquals(num, grid().cache(DEFAULT_CACHE_NAME).query(new SqlFieldsQuery("select count(*) from TestObject")).getAll()
             .get(0).get(0));
     }
     

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java
index 22856b5..6a22f05 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java
@@ -91,7 +91,7 @@ public class IgniteCacheOffheapEvictQueryTest extends GridCommonAbstractTest {
         final int KEYS_CNT = 3000;
         final int THREADS_CNT = 250;
 
-        final IgniteCache<Integer,Integer> c = startGrid().cache(null);
+        final IgniteCache<Integer,Integer> c = startGrid().cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < KEYS_CNT; i++) {
             c.put(i, i);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapIndexScanTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapIndexScanTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapIndexScanTest.java
index 6f46d33..5ad8bfe 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapIndexScanTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapIndexScanTest.java
@@ -53,7 +53,7 @@ public class IgniteCacheOffheapIndexScanTest extends GridCommonAbstractTest {
 
         cfg.setDiscoverySpi(disco);
 
-        CacheConfiguration<?,?> cacheCfg = new CacheConfiguration<>();
+        CacheConfiguration<?,?> cacheCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cacheCfg.setCacheMode(LOCAL);
         cacheCfg.setIndexedTypes(
@@ -69,7 +69,7 @@ public class IgniteCacheOffheapIndexScanTest extends GridCommonAbstractTest {
     @Override protected void beforeTestsStarted() throws Exception {
         startGridsMultiThreaded(1, false);
 
-        cache = grid(0).cache(null);
+        cache = grid(0).cache(DEFAULT_CACHE_NAME);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePartitionedQueryMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePartitionedQueryMultiThreadedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePartitionedQueryMultiThreadedSelfTest.java
index 71bce27..83012c8 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePartitionedQueryMultiThreadedSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachePartitionedQueryMultiThreadedSelfTest.java
@@ -113,7 +113,7 @@ public class IgniteCachePartitionedQueryMultiThreadedSelfTest extends GridCommon
 
         // Clean up all caches.
         for (int i = 0; i < GRID_CNT; i++)
-            grid(i).cache(null).removeAll();
+            grid(i).cache(DEFAULT_CACHE_NAME).removeAll();
     }
 
     /** {@inheritDoc} */
@@ -140,7 +140,7 @@ public class IgniteCachePartitionedQueryMultiThreadedSelfTest extends GridCommon
         final PersonObj p3 = new PersonObj("Mike", 1800, "Bachelor");
         final PersonObj p4 = new PersonObj("Bob", 1900, "Bachelor");
 
-        final IgniteCache<UUID, PersonObj> cache0 = grid(0).cache(null);
+        final IgniteCache<UUID, PersonObj> cache0 = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache0.put(p1.id(), p1);
         cache0.put(p2.id(), p2);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueriesLoadTest1.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueriesLoadTest1.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueriesLoadTest1.java
index 7787ce2..da773be 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueriesLoadTest1.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueriesLoadTest1.java
@@ -155,7 +155,7 @@ public class IgniteCacheQueriesLoadTest1 extends GridCommonAbstractTest {
         RendezvousAffinityFunction aff = new RendezvousAffinityFunction();
         aff.setPartitions(3000);
 
-        CacheConfiguration<Object, Object> parentCfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> parentCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         parentCfg.setAffinity(aff);
         parentCfg.setAtomicityMode(TRANSACTIONAL);
         parentCfg.setCacheMode(PARTITIONED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryH2IndexingLeakTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryH2IndexingLeakTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryH2IndexingLeakTest.java
index bb4c23b..305529a 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryH2IndexingLeakTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryH2IndexingLeakTest.java
@@ -132,7 +132,7 @@ public class IgniteCacheQueryH2IndexingLeakTest extends GridCommonAbstractTest {
      */
     @SuppressWarnings({"TooBroadScope"})
     public void testLeaksInIgniteH2IndexingOnTerminatedThread() throws Exception {
-        final IgniteCache<Integer, Integer> c = grid(0).cache(null);
+        final IgniteCache<Integer, Integer> c = grid(0).cache(DEFAULT_CACHE_NAME);
 
         for(int i = 0; i < ITERATIONS; ++i) {
             info("Iteration #" + i);
@@ -180,7 +180,7 @@ public class IgniteCacheQueryH2IndexingLeakTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testLeaksInIgniteH2IndexingOnUnusedThread() throws Exception {
-        final IgniteCache<Integer, Integer> c = grid(0).cache(null);
+        final IgniteCache<Integer, Integer> c = grid(0).cache(DEFAULT_CACHE_NAME);
 
         final CountDownLatch latch = new CountDownLatch(1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryIndexSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryIndexSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryIndexSelfTest.java
index 73b665e..f9916ae 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryIndexSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryIndexSelfTest.java
@@ -55,7 +55,7 @@ public class IgniteCacheQueryIndexSelfTest extends GridCacheAbstractSelfTest {
      * @throws Exception If failed.
      */
     public void testWithoutStoreLoad() throws Exception {
-        IgniteCache<Integer, CacheValue> cache = grid(0).cache(null);
+        IgniteCache<Integer, CacheValue> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < ENTRY_CNT; i++)
             cache.put(i, new CacheValue(i));
@@ -76,7 +76,7 @@ public class IgniteCacheQueryIndexSelfTest extends GridCacheAbstractSelfTest {
         for (int i = 0; i < ENTRY_CNT; i++)
             storeStgy.putToStore(i, new CacheValue(i));
 
-        IgniteCache<Integer, CacheValue> cache0 = grid(0).cache(null);
+        IgniteCache<Integer, CacheValue> cache0 = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache0.loadCache(null);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryLoadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryLoadSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryLoadSelfTest.java
index 0338429..70f350c 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryLoadSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryLoadSelfTest.java
@@ -109,7 +109,7 @@ public class IgniteCacheQueryLoadSelfTest extends GridCommonAbstractTest {
      * @throws IgniteCheckedException If failed.
      */
     private long size(Class<?> cls) throws IgniteCheckedException {
-        return (Long)grid().cache(null).query(
+        return (Long)grid().cache(DEFAULT_CACHE_NAME).query(
             new SqlFieldsQuery("select count(*) from " + QueryUtils.typeName(cls)).setLocal(true))
             .getAll().get(0).get(0);
     }
@@ -118,7 +118,7 @@ public class IgniteCacheQueryLoadSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testLoadCache() throws Exception {
-        IgniteCache<Integer, ValueObject> cache = grid().cache(null);
+        IgniteCache<Integer, ValueObject> cache = grid().cache(DEFAULT_CACHE_NAME);
 
         cache.loadCache(null);
 
@@ -136,7 +136,7 @@ public class IgniteCacheQueryLoadSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testLoadCacheAsync() throws Exception {
-        IgniteCache<Integer, ValueObject> cache = grid().cache(null);
+        IgniteCache<Integer, ValueObject> cache = grid().cache(DEFAULT_CACHE_NAME);
 
         cache.loadCacheAsync(null, 0).get();
 
@@ -154,7 +154,7 @@ public class IgniteCacheQueryLoadSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testLoadCacheFiltered() throws Exception {
-        IgniteCache<Integer, ValueObject> cache = grid().cache(null);
+        IgniteCache<Integer, ValueObject> cache = grid().cache(DEFAULT_CACHE_NAME);
 
         cache.loadCache(new P2<Integer,ValueObject>() {
             @Override
@@ -177,7 +177,7 @@ public class IgniteCacheQueryLoadSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testLoadCacheAsyncFiltered() throws Exception {
-        IgniteCache<Integer, ValueObject> cache = grid().cache(null);
+        IgniteCache<Integer, ValueObject> cache = grid().cache(DEFAULT_CACHE_NAME);
 
         cache.loadCacheAsync(new P2<Integer, ValueObject>() {
             @Override
@@ -232,7 +232,7 @@ public class IgniteCacheQueryLoadSelfTest extends GridCommonAbstractTest {
 
         CompletionListenerFuture fut = new CompletionListenerFuture();
 
-        grid().<Integer, Integer>cache(null).loadAll(F.asSet(keys), true, fut);
+        grid().<Integer, Integer>cache(DEFAULT_CACHE_NAME).loadAll(F.asSet(keys), true, fut);
 
         fut.get();
 
@@ -252,7 +252,7 @@ public class IgniteCacheQueryLoadSelfTest extends GridCommonAbstractTest {
 
         fut = new CompletionListenerFuture();
 
-        grid().<Integer, Integer>cache(null).loadAll(F.asSet(keys), true, fut);
+        grid().<Integer, Integer>cache(DEFAULT_CACHE_NAME).loadAll(F.asSet(keys), true, fut);
 
         fut.get();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
index e0024fb..4e5cf85 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheQueryMultiThreadedSelfTest.java
@@ -50,6 +50,7 @@ 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 org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -149,7 +150,7 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes
 
         // Clean up all caches.
         for (int i = 0; i < GRID_CNT; i++) {
-            IgniteCache<Object, Object> c = grid(i).cache(null);
+            IgniteCache<Object, Object> c = grid(i).cache(DEFAULT_CACHE_NAME);
 
             assertEquals(0, c.size());
         }
@@ -217,7 +218,7 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes
         Set<UUID> nodes = new HashSet<>();
 
         for (Cache.Entry<Integer, Integer> entry : entries)
-            nodes.add(g.affinity(null).mapKeyToPrimaryAndBackups(entry.getKey()).iterator().next().id());
+            nodes.add(g.affinity(DEFAULT_CACHE_NAME).mapKeyToPrimaryAndBackups(entry.getKey()).iterator().next().id());
 
         return nodes;
     }
@@ -238,7 +239,7 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes
         // Put test values into cache.
         final IgniteCache<Integer, String> c = cache(Integer.class, String.class);
 
-        assertEquals(0, g.cache(null).localSize());
+        assertEquals(0, g.cache(DEFAULT_CACHE_NAME).localSize());
         assertEquals(0, c.query(new SqlQuery(String.class, "1 = 1")).getAll().size());
 
         Random rnd = new Random();
@@ -308,7 +309,7 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes
         // Put test values into cache.
         final IgniteCache<Integer, Long> c = cache(Integer.class, Long.class);
 
-        assertEquals(0, g.cache(null).localSize());
+        assertEquals(0, g.cache(DEFAULT_CACHE_NAME).localSize());
         assertEquals(0, c.query(new SqlQuery(Long.class, "1 = 1")).getAll().size());
 
         Random rnd = new Random();
@@ -381,7 +382,7 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes
         // Put test values into cache.
         final IgniteCache<Integer, Object> c = cache(Integer.class, Object.class);
 
-        assertEquals(0, g.cache(null).size());
+        assertEquals(0, g.cache(DEFAULT_CACHE_NAME).size());
         assertEquals(0, c.query(new SqlQuery(Object.class, "1 = 1")).getAll().size());
 
         Random rnd = new Random();
@@ -452,7 +453,7 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes
         // Put test values into cache.
         final IgniteCache<Integer, TestValue> c = cache(Integer.class, TestValue.class);
 
-        assertEquals(0, g.cache(null).localSize());
+        assertEquals(0, g.cache(DEFAULT_CACHE_NAME).localSize());
         assertEquals(0, c.query(new SqlQuery(TestValue.class, "1 = 1")).getAll().size());
 
         Random rnd = new Random();
@@ -728,7 +729,7 @@ public class IgniteCacheQueryMultiThreadedSelfTest extends GridCommonAbstractTes
 
                         if (cnt.incrementAndGet() % logMod == 0) {
                             GridCacheQueryManager<Object, Object> qryMgr =
-                                ((IgniteKernal)g).internalCache().context().queries();
+                                ((IgniteKernal)g).internalCache(DEFAULT_CACHE_NAME).context().queries();
 
                             assert qryMgr != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSqlQueryMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSqlQueryMultiThreadedSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSqlQueryMultiThreadedSelfTest.java
index 1535689..6e6c49a 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSqlQueryMultiThreadedSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheSqlQueryMultiThreadedSelfTest.java
@@ -59,7 +59,7 @@ public class IgniteCacheSqlQueryMultiThreadedSelfTest extends GridCommonAbstract
 
         c.setDiscoverySpi(disco);
 
-        CacheConfiguration<?,?> ccfg = new CacheConfiguration();
+        CacheConfiguration<?,?> ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setNearConfiguration(null);
@@ -94,7 +94,7 @@ public class IgniteCacheSqlQueryMultiThreadedSelfTest extends GridCommonAbstract
      * @throws Exception If failed.
      */
     public void testQuery() throws Exception {
-        final IgniteCache<Integer, Person> cache = grid(0).cache(null);
+        final IgniteCache<Integer, Person> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.clear();
 
@@ -125,7 +125,7 @@ public class IgniteCacheSqlQueryMultiThreadedSelfTest extends GridCommonAbstract
      * @throws Exception If failed.
      */
     public void testQueryPut() throws Exception {
-        final IgniteCache<Integer, Person> cache = grid(0).cache(null);
+        final IgniteCache<Integer, Person> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.clear();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStarvationOnRebalanceTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStarvationOnRebalanceTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStarvationOnRebalanceTest.java
index 1b59256..621d10d 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStarvationOnRebalanceTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheStarvationOnRebalanceTest.java
@@ -87,7 +87,7 @@ public class IgniteCacheStarvationOnRebalanceTest extends GridCacheAbstractSelfT
      * @throws Exception If failed.
      */
     public void testLoadSystemWithPutAndStartRebalancing() throws Exception {
-        final IgniteCache<Integer, CacheValue> cache = grid(0).cache(null);
+        final IgniteCache<Integer, CacheValue> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         final long endTime = System.currentTimeMillis() + TEST_TIMEOUT - 60_000;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientReconnectCacheQueriesFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientReconnectCacheQueriesFailoverTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientReconnectCacheQueriesFailoverTest.java
index 2b10c61..51620b1 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientReconnectCacheQueriesFailoverTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientReconnectCacheQueriesFailoverTest.java
@@ -47,7 +47,7 @@ public class IgniteClientReconnectCacheQueriesFailoverTest extends IgniteClientR
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -62,7 +62,7 @@ public class IgniteClientReconnectCacheQueriesFailoverTest extends IgniteClientR
     @Override protected void beforeTestsStarted() throws Exception {
         super.beforeTestsStarted();
 
-        final IgniteCache<Integer, Person> cache = grid(serverCount()).cache(null);
+        final IgniteCache<Integer, Person> cache = grid(serverCount()).cache(DEFAULT_CACHE_NAME);
 
         assertNotNull(cache);
 
@@ -76,7 +76,7 @@ public class IgniteClientReconnectCacheQueriesFailoverTest extends IgniteClientR
     public void testReconnectCacheQueries() throws Exception {
         final Ignite client = grid(serverCount());
 
-        final IgniteCache<Integer, Person> cache = client.cache(null);
+        final IgniteCache<Integer, Person> cache = client.cache(DEFAULT_CACHE_NAME);
 
         assertNotNull(cache);
 
@@ -123,11 +123,11 @@ public class IgniteClientReconnectCacheQueriesFailoverTest extends IgniteClientR
     public void testReconnectScanQuery() throws Exception {
         final Ignite client = grid(serverCount());
 
-        final IgniteCache<Integer, Person> cache = client.cache(null);
+        final IgniteCache<Integer, Person> cache = client.cache(DEFAULT_CACHE_NAME);
 
         assertNotNull(cache);
 
-        final Affinity<Integer> aff = client.affinity(null);
+        final Affinity<Integer> aff = client.affinity(DEFAULT_CACHE_NAME);
 
         final Map<Integer, Integer> partMap = new HashMap<>();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCrossCachesJoinsQueryTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCrossCachesJoinsQueryTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCrossCachesJoinsQueryTest.java
index 3ad316f..c80ae69 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCrossCachesJoinsQueryTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCrossCachesJoinsQueryTest.java
@@ -687,7 +687,7 @@ public class IgniteCrossCachesJoinsQueryTest extends AbstractH2CompareQueryTest
         boolean accountCache,
         boolean personCache,
         boolean orgCache) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(cacheName);
         ccfg.setCacheMode(cacheMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/QueryEntityCaseMismatchTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/QueryEntityCaseMismatchTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/QueryEntityCaseMismatchTest.java
index 4f8cfee..1b0546a 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/QueryEntityCaseMismatchTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/QueryEntityCaseMismatchTest.java
@@ -61,7 +61,7 @@ public class QueryEntityCaseMismatchTest extends GridCommonAbstractTest {
 
         cfg.setDiscoverySpi(discoSpi);
 
-        CacheConfiguration<Object, Integer> ccfg = new CacheConfiguration<>("");
+        CacheConfiguration<Object, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cfg.setMarshaller(new BinaryMarshaller());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/SqlFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/SqlFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/SqlFieldsQuerySelfTest.java
index 117ffc0..a23f254 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/SqlFieldsQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/SqlFieldsQuerySelfTest.java
@@ -78,7 +78,7 @@ public class SqlFieldsQuerySelfTest extends GridCommonAbstractTest {
      *
      */
     private IgniteCache<Integer, Person> createAndFillCache() {
-        CacheConfiguration<Integer, Person> cacheConf = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Person> cacheConf = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cacheConf.setCacheMode(CacheMode.PARTITIONED);
         cacheConf.setBackups(0);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryCancelSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryCancelSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryCancelSelfTest.java
index 41915c8..b9ef1e4 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryCancelSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryCancelSelfTest.java
@@ -66,7 +66,7 @@ public class IgniteCacheDistributedQueryCancelSelfTest extends GridCommonAbstrac
         TcpDiscoverySpi spi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
         spi.setIpFinder(IP_FINDER);
 
-        CacheConfiguration<Integer, String> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, String> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         ccfg.setIndexedTypes(Integer.class, String.class);
 
         cfg.setCacheConfiguration(ccfg);
@@ -88,7 +88,7 @@ public class IgniteCacheDistributedQueryCancelSelfTest extends GridCommonAbstrac
     public void testQueryCancelsOnGridShutdown() throws Exception {
         try (Ignite client = startGrid("client")) {
 
-            IgniteCache<Object, Object> cache = client.cache(null);
+            IgniteCache<Object, Object> cache = client.cache(DEFAULT_CACHE_NAME);
 
             assertEquals(0, cache.localSize());
 
@@ -141,7 +141,7 @@ public class IgniteCacheDistributedQueryCancelSelfTest extends GridCommonAbstrac
     public void testQueryResponseFailCode() throws Exception {
         try (Ignite client = startGrid("client")) {
 
-            CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>();
+            CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
             cfg.setSqlFunctionClasses(Functions.class);
             cfg.setIndexedTypes(Integer.class, Integer.class);
             cfg.setName("test");

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
index 63db4ce..ee2787c 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest.java
@@ -79,7 +79,7 @@ public class IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest extends Gr
         TcpDiscoverySpi spi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
         spi.setIpFinder(IP_FINDER);
 
-        CacheConfiguration<Integer, String> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, String> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         ccfg.setIndexedTypes(Integer.class, String.class);
 
         cfg.setCacheConfiguration(ccfg);
@@ -95,7 +95,7 @@ public class IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest extends Gr
         super.afterTest();
 
         for (Ignite g : G.allGrids())
-            g.cache(null).removeAll();
+            g.cache(DEFAULT_CACHE_NAME).removeAll();
     }
 
     /** {@inheritDoc} */
@@ -185,7 +185,7 @@ public class IgniteCacheDistributedQueryStopOnCancelOrTimeoutSelfTest extends Gr
                                  boolean timeout) throws Exception {
         try (Ignite client = startGrid("client")) {
 
-            IgniteCache<Object, Object> cache = client.cache(null);
+            IgniteCache<Object, Object> cache = client.cache(DEFAULT_CACHE_NAME);
 
             assertEquals(0, cache.localSize());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQuerySelfTest.java
index 30a825b..72709ac 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQuerySelfTest.java
@@ -194,7 +194,7 @@ public class IgniteCachePartitionedQuerySelfTest extends IgniteCacheAbstractQuer
 
             List<Cache.Entry<Integer, Integer>> all = cache.query(qry).getAll();
 
-            assertTrue(pages.get() > ignite().cluster().forDataNodes(null).nodes().size());
+            assertTrue(pages.get() > ignite().cluster().forDataNodes(DEFAULT_CACHE_NAME).nodes().size());
 
             assertEquals(50, all.size());
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNoRebalanceSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNoRebalanceSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNoRebalanceSelfTest.java
index ac96cc5..d772aa1 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNoRebalanceSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNoRebalanceSelfTest.java
@@ -49,7 +49,7 @@ public class IgniteCacheQueryNoRebalanceSelfTest extends GridCommonAbstractTest
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
 
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         ccfg.setBackups(0);
         ccfg.setIndexedTypes(Integer.class, Integer.class);
         ccfg.setRebalanceMode(CacheRebalanceMode.NONE);
@@ -70,7 +70,7 @@ public class IgniteCacheQueryNoRebalanceSelfTest extends GridCommonAbstractTest
      * Tests correct query execution with disabled re-balancing.
      */
     public void testQueryNoRebalance() {
-        IgniteCache<Object, Object> cache = grid().cache(null);
+        IgniteCache<Object, Object> cache = grid().cache(DEFAULT_CACHE_NAME);
 
         cache.put(1, 1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeFailTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeFailTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeFailTest.java
index 20f3261..d76742b 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeFailTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeFailTest.java
@@ -51,7 +51,7 @@ public class IgniteCacheQueryNodeFailTest extends GridCommonAbstractTest {
 
         cfg.setClientMode(client);
 
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         ccfg.setBackups(0);
         ccfg.setIndexedTypes(Integer.class, Integer.class);
 
@@ -107,7 +107,7 @@ public class IgniteCacheQueryNodeFailTest extends GridCommonAbstractTest {
 
         Ignite client = grid(1);
 
-        final IgniteCache<Integer, Integer> cache = client.cache(null);
+        final IgniteCache<Integer, Integer> cache = client.cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < 100_000; i++)
             cache.put(i, i);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java
index 6f9b303..0c644e3 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheQueryNodeRestartSelfTest.java
@@ -108,7 +108,7 @@ public class IgniteCacheQueryNodeRestartSelfTest extends GridCacheAbstractSelfTe
         final long nodeLifeTime = 2 * 1000;
         final int logFreq = 50;
 
-        final IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        final IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         assert cache != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java
index 5976615..ae86933 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractConcurrentSelfTest.java
@@ -38,6 +38,7 @@ import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
 import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitor;
 import org.apache.ignite.internal.processors.query.schema.SchemaOperationException;
 import org.apache.ignite.internal.util.typedef.T2;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import javax.cache.Cache;
@@ -1024,7 +1025,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
      */
     private static class BlockingIndexing extends IgniteH2Indexing {
         /** {@inheritDoc} */
-        @Override public void dynamicIndexCreate(@Nullable String spaceName, String tblName,
+        @Override public void dynamicIndexCreate(@NotNull String spaceName, String tblName,
             QueryIndexDescriptorImpl idxDesc, boolean ifNotExists, SchemaIndexCacheVisitor cacheVisitor)
             throws IgniteCheckedException {
             awaitIndexing(ctx.localNodeId());
@@ -1033,7 +1034,7 @@ public abstract class DynamicIndexAbstractConcurrentSelfTest extends DynamicInde
         }
 
         /** {@inheritDoc} */
-        @Override public void dynamicIndexDrop(@Nullable String spaceName, String idxName, boolean ifExists)
+        @Override public void dynamicIndexDrop(@NotNull String spaceName, String idxName, boolean ifExists)
             throws IgniteCheckedException{
             awaitIndexing(ctx.localNodeId());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/local/IgniteCacheLocalQueryCancelOrTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/local/IgniteCacheLocalQueryCancelOrTimeoutSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/local/IgniteCacheLocalQueryCancelOrTimeoutSelfTest.java
index f8e3195..103d8b4 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/local/IgniteCacheLocalQueryCancelOrTimeoutSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/local/IgniteCacheLocalQueryCancelOrTimeoutSelfTest.java
@@ -46,7 +46,7 @@ public class IgniteCacheLocalQueryCancelOrTimeoutSelfTest extends GridCommonAbst
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration<Integer, String> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, String> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         ccfg.setIndexedTypes(Integer.class, String.class);
         ccfg.setCacheMode(LOCAL);
 
@@ -67,7 +67,7 @@ public class IgniteCacheLocalQueryCancelOrTimeoutSelfTest extends GridCommonAbst
         super.afterTest();
 
         for (Ignite g : G.allGrids())
-            g.cache(null).removeAll();
+            g.cache(DEFAULT_CACHE_NAME).removeAll();
     }
 
     /** {@inheritDoc} */
@@ -123,7 +123,7 @@ public class IgniteCacheLocalQueryCancelOrTimeoutSelfTest extends GridCommonAbst
     private void testQuery(boolean timeout, int timeoutUnits, TimeUnit timeUnit) {
         Ignite ignite = grid(0);
 
-        IgniteCache<Integer, String> cache = ignite.cache(null);
+        IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         loadCache(cache);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
index 02b6b3b..c9a5bf6 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/ttl/CacheTtlAbstractSelfTest.java
@@ -73,7 +73,7 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(cacheMode());
         ccfg.setAtomicityMode(atomicityMode());
@@ -195,7 +195,7 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testDefaultTimeToLiveStreamerAdd() throws Exception {
-        try (IgniteDataStreamer<Integer, Integer> streamer = ignite(0).dataStreamer(null)) {
+        try (IgniteDataStreamer<Integer, Integer> streamer = ignite(0).dataStreamer(DEFAULT_CACHE_NAME)) {
             for (int i = 0; i < SIZE; i++)
                 streamer.addData(i, i);
         }
@@ -206,7 +206,7 @@ public abstract class CacheTtlAbstractSelfTest extends GridCommonAbstractTest {
 
         checkSizeAfterLive();
 
-        try (IgniteDataStreamer<Integer, Integer> streamer = ignite(0).dataStreamer(null)) {
+        try (IgniteDataStreamer<Integer, Integer> streamer = ignite(0).dataStreamer(DEFAULT_CACHE_NAME)) {
             streamer.allowOverwrite(true);
 
             for (int i = 0; i < SIZE; i++)

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteQueryDedicatedPoolTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteQueryDedicatedPoolTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteQueryDedicatedPoolTest.java
index f3404fd..ddaea8a 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteQueryDedicatedPoolTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteQueryDedicatedPoolTest.java
@@ -71,7 +71,7 @@ public class IgniteQueryDedicatedPoolTest extends GridCommonAbstractTest {
 
         spi.setIpFinder(IP_FINDER);
 
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setIndexedTypes(Integer.class, Integer.class);
         ccfg.setIndexedTypes(Byte.class, Byte.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/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 81201c8..aad4cfb 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
@@ -78,7 +78,7 @@ public class IgniteSqlDistributedJoinSelfTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     private static CacheConfiguration cacheConfig(String name, boolean partitioned, Class<?>... idxTypes) {
-        return new CacheConfiguration()
+        return new CacheConfiguration(DEFAULT_CACHE_NAME)
             .setName(name)
             .setCacheMode(partitioned ? CacheMode.PARTITIONED : CacheMode.REPLICATED)
             .setAtomicityMode(CacheAtomicityMode.ATOMIC)

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSchemaIndexingTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSchemaIndexingTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSchemaIndexingTest.java
index 21fedf4..b79a064 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSchemaIndexingTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSchemaIndexingTest.java
@@ -67,7 +67,7 @@ public class IgniteSqlSchemaIndexingTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     private static CacheConfiguration cacheConfig(String name, boolean partitioned, Class<?>... idxTypes) {
-        return new CacheConfiguration()
+        return new CacheConfiguration(DEFAULT_CACHE_NAME)
             .setName(name)
             .setCacheMode(partitioned ? CacheMode.PARTITIONED : CacheMode.REPLICATED)
             .setAtomicityMode(CacheAtomicityMode.ATOMIC)

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
index 6110faa..8e56d36 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
@@ -110,7 +110,7 @@ public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     private static CacheConfiguration cacheConfig(String name, boolean partitioned, Class<?>... idxTypes) {
-        return new CacheConfiguration()
+        return new CacheConfiguration(DEFAULT_CACHE_NAME)
             .setName(name)
             .setCacheMode(partitioned ? CacheMode.PARTITIONED : CacheMode.REPLICATED)
             .setAtomicityMode(CacheAtomicityMode.ATOMIC)

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
index 7e2026b..3832878 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
@@ -119,7 +119,7 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
     /**
      */
     private CacheConfiguration cacheACfg() {
-        CacheConfiguration<?,?> cfg = new CacheConfiguration<>();
+        CacheConfiguration<?,?> cfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cfg.setName("A");
 
@@ -147,7 +147,7 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
      *
      */
     private CacheConfiguration cacheBCfg() {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setName("B");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/IgniteSqlQueryMinMaxTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/IgniteSqlQueryMinMaxTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/IgniteSqlQueryMinMaxTest.java
index e78b695..e8403ec 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/IgniteSqlQueryMinMaxTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/IgniteSqlQueryMinMaxTest.java
@@ -63,11 +63,11 @@ public class IgniteSqlQueryMinMaxTest extends GridCommonAbstractTest {
 
         spi.setIpFinder(IP_FINDER);
 
-        CacheConfiguration<?, ?> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<?, ?> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         ccfg.setIndexedTypes(Integer.class, Integer.class);
         ccfg.setName(CACHE_NAME);
 
-        CacheConfiguration<?, ?> ccfg2 = new CacheConfiguration<>();
+        CacheConfiguration<?, ?> ccfg2 = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         ccfg2.setIndexedTypes(Integer.class, ValueObj.class);
         ccfg2.setName(CACHE_NAME_2);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
index 7423c9b..6d0c6ac 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
@@ -51,6 +51,7 @@ import org.h2.command.Prepared;
 import org.h2.engine.Session;
 import org.h2.jdbc.JdbcConnection;
 import org.h2.message.DbException;
+import org.jetbrains.annotations.NotNull;
 
 import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
@@ -77,7 +78,7 @@ public class GridQueryParsingTest extends GridCommonAbstractTest {
         c.setDiscoverySpi(disco);
 
         c.setCacheConfiguration(
-            cacheConfiguration(null, "SCH1", String.class, Person.class),
+            cacheConfiguration(DEFAULT_CACHE_NAME, "SCH1", String.class, Person.class),
             cacheConfiguration("addr", "SCH2", String.class, Address.class));
 
         return c;
@@ -89,7 +90,7 @@ public class GridQueryParsingTest extends GridCommonAbstractTest {
      * @param clsV Value class.
      * @return Cache configuration.
      */
-    private CacheConfiguration cacheConfiguration(String name, String sqlSchema, Class<?> clsK, Class<?> clsV) {
+    private CacheConfiguration cacheConfiguration(@NotNull String name, String sqlSchema, Class<?> clsK, Class<?> clsV) {
         CacheConfiguration cc = defaultCacheConfiguration();
 
         cc.setName(name);
@@ -685,7 +686,7 @@ public class GridQueryParsingTest extends GridCommonAbstractTest {
 
         IgniteH2Indexing idx = U.field(qryProcessor, "idx");
 
-        return (JdbcConnection)idx.connectionForSpace(null);
+        return (JdbcConnection)idx.connectionForSpace(DEFAULT_CACHE_NAME);
     }
 
     /**


[43/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java
index bb09f40..8da7355 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/GridCacheTxLoadFromStoreOnLockSelfTest.java
@@ -88,7 +88,7 @@ public class GridCacheTxLoadFromStoreOnLockSelfTest extends GridCommonAbstractTe
      * @throws Exception If failed.
      */
     private void checkLoadedValue(int backups) throws Exception {
-        CacheConfiguration<Integer, Integer> cacheCfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> cacheCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cacheCfg.setCacheMode(CacheMode.PARTITIONED);
         cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessorAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessorAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessorAbstractSelfTest.java
index 655d6c0..1d70246 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessorAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessorAbstractSelfTest.java
@@ -180,7 +180,7 @@ public abstract class GridAffinityProcessorAbstractSelfTest extends GridCommonAb
         int iterations = 10000000;
 
         for (int i = 0; i < iterations; i++)
-            aff.mapKeyToNode(null, keys);
+            aff.mapKeyToNode(DEFAULT_CACHE_NAME, keys);
 
         long diff = System.currentTimeMillis() - start;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAtomicSingleMessageCountSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAtomicSingleMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAtomicSingleMessageCountSelfTest.java
index 991735b..5bd53bb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAtomicSingleMessageCountSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheAtomicSingleMessageCountSelfTest.java
@@ -66,7 +66,7 @@ public class CacheAtomicSingleMessageCountSelfTest extends GridCommonAbstractTes
 
         cfg.setDiscoverySpi(discoSpi);
 
-        CacheConfiguration cCfg = new CacheConfiguration();
+        CacheConfiguration cCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cCfg.setCacheMode(PARTITIONED);
         cCfg.setBackups(1);
@@ -120,7 +120,7 @@ public class CacheAtomicSingleMessageCountSelfTest extends GridCommonAbstractTes
     public void testSingleTransformMessage() throws Exception {
         startGrids(2);
 
-        int cacheId = ((IgniteKernal)grid(0)).internalCache(null).context().cacheId();
+        int cacheId = ((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME).context().cacheId();
 
         try {
             awaitPartitionMapExchange();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java
index 35442bb..3a418f0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java
@@ -77,7 +77,7 @@ public class CacheClientStoreSelfTest extends GridCommonAbstractTest {
         if (client)
             cfg.setMemoryConfiguration(new MemoryConfiguration());
 
-        CacheConfiguration cc = new CacheConfiguration();
+        CacheConfiguration cc = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cc.setName(CACHE_NAME);
         cc.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.java
index 0551ec6..130280d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConcurrentReadThroughTest.java
@@ -87,7 +87,7 @@ public class CacheConcurrentReadThroughTest extends GridCommonAbstractTest {
         assertTrue(client.configuration().isClientMode());
 
         for (int iter = 0; iter < 10; iter++) {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             final String cacheName = "test-" + iter;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java
index df9fbd5..b97bb26 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheConfigurationLeakTest.java
@@ -67,7 +67,7 @@ public class CacheConfigurationLeakTest extends GridCommonAbstractTest {
         GridTestUtils.runMultiThreaded(new IgniteInClosure<Integer>() {
             @Override public void apply(Integer idx) {
                 for (int i = 0; i < 100; i++) {
-                    CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+                    CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
                     ccfg.setName("cache-" + idx + "-" + i);
                     ccfg.setEvictionPolicy(new LruEvictionPolicy(1000));
                     ccfg.setOnheapCacheEnabled(true);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteQueueTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteQueueTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteQueueTest.java
index 37d3f4d..65037d8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteQueueTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteQueueTest.java
@@ -86,7 +86,7 @@ public class CacheDeferredDeleteQueueTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     private void testQueue(CacheAtomicityMode atomicityMode, boolean nearCache) throws Exception {
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(atomicityMode);
@@ -111,7 +111,7 @@ public class CacheDeferredDeleteQueueTest extends GridCommonAbstractTest {
                 @Override public boolean apply() {
                     for (int i = 0; i < NODES; i++) {
                         final GridDhtPartitionTopology top =
-                            ((IgniteKernal)ignite(i)).context().cache().cache(null).context().topology();
+                            ((IgniteKernal)ignite(i)).context().cache().cache(DEFAULT_CACHE_NAME).context().topology();
 
                         for (GridDhtLocalPartition p : top.currentLocalPartitions()) {
                             Collection<Object> rmvQueue = GridTestUtils.getFieldValue(p, "rmvQueue");

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteSanitySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteSanitySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteSanitySelfTest.java
index 5040172..177c990 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteSanitySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDeferredDeleteSanitySelfTest.java
@@ -76,7 +76,7 @@ public class CacheDeferredDeleteSanitySelfTest extends GridCommonAbstractTest {
      */
     @SuppressWarnings("unchecked")
     private void testDeferredDelete(CacheMode mode, CacheAtomicityMode atomicityMode, boolean near, boolean expVal) {
-        CacheConfiguration ccfg = new CacheConfiguration()
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME)
             .setCacheMode(mode)
             .setAtomicityMode(atomicityMode);
 
@@ -88,7 +88,7 @@ public class CacheDeferredDeleteSanitySelfTest extends GridCommonAbstractTest {
         try {
             cache = grid(0).getOrCreateCache(ccfg);
 
-            assertEquals(expVal, ((IgniteCacheProxy)grid(0).cache(null)).context().deferredDelete());
+            assertEquals(expVal, ((IgniteCacheProxy)grid(0).cache(DEFAULT_CACHE_NAME)).context().deferredDelete());
         }
         finally {
             if (cache != null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDhtLocalPartitionAfterRemoveSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDhtLocalPartitionAfterRemoveSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDhtLocalPartitionAfterRemoveSelfTest.java
index 1da94d4..c060eb3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDhtLocalPartitionAfterRemoveSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheDhtLocalPartitionAfterRemoveSelfTest.java
@@ -36,7 +36,7 @@ public class CacheDhtLocalPartitionAfterRemoveSelfTest extends GridCommonAbstrac
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(TRANSACTIONAL);
         ccfg.setNearConfiguration(null);
@@ -62,7 +62,7 @@ public class CacheDhtLocalPartitionAfterRemoveSelfTest extends GridCommonAbstrac
     public void testMemoryUsage() throws Exception {
         assertEquals(10_000, GridDhtLocalPartition.MAX_DELETE_QUEUE_SIZE);
 
-        IgniteCache<TestKey, Integer> cache = grid(0).cache(null);
+        IgniteCache<TestKey, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < 20_000; ++i)
             cache.put(new TestKey(String.valueOf(i)), i);
@@ -73,7 +73,7 @@ public class CacheDhtLocalPartitionAfterRemoveSelfTest extends GridCommonAbstrac
         assertEquals(0, cache.size());
 
         for (int g = 0; g < GRID_CNT; g++) {
-            cache = grid(g).cache(null);
+            cache = grid(g).cache(DEFAULT_CACHE_NAME);
 
             for (GridDhtLocalPartition p : dht(cache).topology().localPartitions()) {
                 int size = p.dataStore().size();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
index efaaee8..9b4aa46 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheEnumOperationsAbstractTest.java
@@ -234,7 +234,7 @@ public abstract class CacheEnumOperationsAbstractTest extends GridCommonAbstract
         CacheMode cacheMode,
         int backups,
         CacheAtomicityMode atomicityMode) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java
index a4dd3fe..d8a2065 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheExchangeMessageDuplicatedStateTest.java
@@ -92,19 +92,19 @@ public class CacheExchangeMessageDuplicatedStateTest extends GridCommonAbstractT
         List<CacheConfiguration> ccfgs = new ArrayList<>();
 
         {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
             ccfg.setName(AFF1_CACHE1);
             ccfg.setAffinity(new RendezvousAffinityFunction(false, 512));
             ccfgs.add(ccfg);
         }
         {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
             ccfg.setName(AFF1_CACHE2);
             ccfg.setAffinity(new RendezvousAffinityFunction(false, 512));
             ccfgs.add(ccfg);
         }
         {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
             ccfg.setName(AFF3_CACHE1);
             ccfg.setBackups(3);
 
@@ -114,14 +114,14 @@ public class CacheExchangeMessageDuplicatedStateTest extends GridCommonAbstractT
             ccfgs.add(ccfg);
         }
         {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
             ccfg.setName(AFF4_FILTER_CACHE1);
             ccfg.setNodeFilter(new TestNodeFilter());
             ccfg.setAffinity(new RendezvousAffinityFunction());
             ccfgs.add(ccfg);
         }
         {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
             ccfg.setName(AFF4_FILTER_CACHE2);
             ccfg.setNodeFilter(new TestNodeFilter());
             ccfg.setAffinity(new RendezvousAffinityFunction());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java
index 1b93623..a51765c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheFutureExceptionSelfTest.java
@@ -101,7 +101,7 @@ public class CacheFutureExceptionSelfTest extends GridCommonAbstractTest {
 
         final String cacheName = nearCache ? ("NEAR-CACHE-" + cpyOnRead) : ("CACHE-" + cpyOnRead);
 
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setCopyOnRead(cpyOnRead);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryAbstractTest.java
index 0ddac75..dd9ed3c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetEntryAbstractTest.java
@@ -99,7 +99,7 @@ public abstract class CacheGetEntryAbstractTest extends GridCacheAbstractSelfTes
      * @throws Exception If failed.
      */
     public void testNear() throws Exception {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setWriteSynchronizationMode(FULL_SYNC);
         cfg.setCacheMode(PARTITIONED);
@@ -114,7 +114,7 @@ public abstract class CacheGetEntryAbstractTest extends GridCacheAbstractSelfTes
      * @throws Exception If failed.
      */
     public void testNearTransactional() throws Exception {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setWriteSynchronizationMode(FULL_SYNC);
         cfg.setCacheMode(PARTITIONED);
@@ -129,7 +129,7 @@ public abstract class CacheGetEntryAbstractTest extends GridCacheAbstractSelfTes
      * @throws Exception If failed.
      */
     public void testPartitioned() throws Exception {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setWriteSynchronizationMode(FULL_SYNC);
         cfg.setCacheMode(PARTITIONED);
@@ -143,7 +143,7 @@ public abstract class CacheGetEntryAbstractTest extends GridCacheAbstractSelfTes
      * @throws Exception If failed.
      */
     public void testPartitionedTransactional() throws Exception {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setWriteSynchronizationMode(FULL_SYNC);
         cfg.setCacheMode(PARTITIONED);
@@ -157,7 +157,7 @@ public abstract class CacheGetEntryAbstractTest extends GridCacheAbstractSelfTes
      * @throws Exception If failed.
      */
     public void testLocal() throws Exception {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setWriteSynchronizationMode(FULL_SYNC);
         cfg.setCacheMode(LOCAL);
@@ -173,7 +173,7 @@ public abstract class CacheGetEntryAbstractTest extends GridCacheAbstractSelfTes
     public void testLocalTransactional() throws Exception {
         // TODO: fails since d13520e9a05bd9e9b987529472d6317951b72f96, need to review changes.
 
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setWriteSynchronizationMode(FULL_SYNC);
         cfg.setCacheMode(LOCAL);
@@ -187,7 +187,7 @@ public abstract class CacheGetEntryAbstractTest extends GridCacheAbstractSelfTes
      * @throws Exception If failed.
      */
     public void testReplicated() throws Exception {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setWriteSynchronizationMode(FULL_SYNC);
         cfg.setCacheMode(REPLICATED);
@@ -201,7 +201,7 @@ public abstract class CacheGetEntryAbstractTest extends GridCacheAbstractSelfTes
      * @throws Exception If failed.
      */
     public void testReplicatedTransactional() throws Exception {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setWriteSynchronizationMode(FULL_SYNC);
         cfg.setCacheMode(REPLICATED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetFromJobTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetFromJobTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetFromJobTest.java
index 7a7aabe..a48f342 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetFromJobTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetFromJobTest.java
@@ -99,7 +99,7 @@ public class CacheGetFromJobTest extends GridCacheAbstractSelfTest {
 
         /** {@inheritDoc} */
         @Override public Object call() throws Exception {
-            IgniteCache cache = ignite.cache(null);
+            IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             assertNotNull(cache);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterLocalSanityTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterLocalSanityTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterLocalSanityTest.java
index 5fe7d70..2874111 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterLocalSanityTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterLocalSanityTest.java
@@ -480,7 +480,7 @@ public class CacheInterceptorPartitionCounterLocalSanityTest extends GridCommonA
     protected CacheConfiguration<Object, Object> cacheConfiguration(
         CacheAtomicityMode atomicityMode,
         boolean store) {
-        CacheConfiguration<TestKey, TestValue> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<TestKey, TestValue> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(LOCAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterRandomOperationsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterRandomOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterRandomOperationsTest.java
index 7d49c11..e23c783 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterRandomOperationsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheInterceptorPartitionCounterRandomOperationsTest.java
@@ -723,7 +723,7 @@ public class CacheInterceptorPartitionCounterRandomOperationsTest extends GridCo
         int backups,
         CacheAtomicityMode atomicityMode,
         boolean store) {
-        CacheConfiguration<TestKey, TestValue> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<TestKey, TestValue> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMemoryPolicyConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMemoryPolicyConfigurationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMemoryPolicyConfigurationTest.java
index d88723c..92e7e84 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMemoryPolicyConfigurationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheMemoryPolicyConfigurationTest.java
@@ -58,7 +58,7 @@ public class CacheMemoryPolicyConfigurationTest extends GridCommonAbstractTest {
      * Verifies that proper exception is thrown when MemoryPolicy is misconfigured for cache.
      */
     public void testMissingMemoryPolicy() throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setMemoryPolicyName("nonExistingMemPlc");
 
@@ -93,11 +93,11 @@ public class CacheMemoryPolicyConfigurationTest extends GridCommonAbstractTest {
         memCfg.setMemoryPolicies(dfltPlcCfg, bigPlcCfg);
         memCfg.setDefaultMemoryPolicyName("dfltPlc");
 
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         IgniteEx ignite0 = startGrid(0);
 
-        IgniteCache<Object, Object> cache = ignite0.cache(null);
+        IgniteCache<Object, Object> cache = ignite0.cache(DEFAULT_CACHE_NAME);
 
         boolean oomeThrown = false;
 
@@ -146,12 +146,12 @@ public class CacheMemoryPolicyConfigurationTest extends GridCommonAbstractTest {
         memCfg.setMemoryPolicies(dfltPlcCfg, bigPlcCfg);
         memCfg.setDefaultMemoryPolicyName("dfltPlc");
 
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
         ccfg.setMemoryPolicyName("bigPlc");
 
         IgniteEx ignite0 = startGrid(0);
 
-        IgniteCache<Object, Object> cache = ignite0.cache(null);
+        IgniteCache<Object, Object> cache = ignite0.cache(DEFAULT_CACHE_NAME);
 
         try {
             for (int i = 0; i < 500_000; i++)

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNamesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNamesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNamesSelfTest.java
index 07ae278..d7d06a1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNamesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNamesSelfTest.java
@@ -35,15 +35,15 @@ public class CacheNamesSelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration cacheCfg1 = new CacheConfiguration();
+        CacheConfiguration cacheCfg1 = new CacheConfiguration(DEFAULT_CACHE_NAME);
         cacheCfg1.setCacheMode(CacheMode.REPLICATED);
         cacheCfg1.setName("replicated");
 
-        CacheConfiguration cacheCfg2 = new CacheConfiguration();
+        CacheConfiguration cacheCfg2 = new CacheConfiguration(DEFAULT_CACHE_NAME);
         cacheCfg2.setCacheMode(CacheMode.PARTITIONED);
         cacheCfg2.setName("partitioned");
 
-        CacheConfiguration cacheCfg3 = new CacheConfiguration();
+        CacheConfiguration cacheCfg3 = new CacheConfiguration(DEFAULT_CACHE_NAME);
         cacheCfg3.setCacheMode(CacheMode.LOCAL);
 
         if (client)
@@ -66,7 +66,7 @@ public class CacheNamesSelfTest extends GridCommonAbstractTest {
             assertEquals(3, names.size());
 
             for (String name : names)
-                assertTrue(name == null || name.equals("replicated") || name.equals("partitioned"));
+                assertTrue(DEFAULT_CACHE_NAME.equals(name) || name.equals("replicated") || name.equals("partitioned"));
 
             client = true;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNamesWithSpecialCharactersTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNamesWithSpecialCharactersTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNamesWithSpecialCharactersTest.java
index f39a181..ecb8227 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNamesWithSpecialCharactersTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNamesWithSpecialCharactersTest.java
@@ -37,11 +37,11 @@ public class CacheNamesWithSpecialCharactersTest extends GridCommonAbstractTest
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration cacheCfg1 = new CacheConfiguration();
+        CacheConfiguration cacheCfg1 = new CacheConfiguration(DEFAULT_CACHE_NAME);
         cacheCfg1.setCacheMode(CacheMode.REPLICATED);
         cacheCfg1.setName(CACHE_NAME_1);
 
-        CacheConfiguration cacheCfg2 = new CacheConfiguration();
+        CacheConfiguration cacheCfg2 = new CacheConfiguration(DEFAULT_CACHE_NAME);
         cacheCfg2.setCacheMode(CacheMode.PARTITIONED);
         cacheCfg2.setName(CACHE_NAME_2);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearReaderUpdateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearReaderUpdateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearReaderUpdateTest.java
index 9bd7a8c..c00fe16 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearReaderUpdateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearReaderUpdateTest.java
@@ -343,7 +343,7 @@ public class CacheNearReaderUpdateTest extends GridCommonAbstractTest {
         int backups,
         boolean storeEnabled,
         boolean nearCache) {
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(cacheMode);
         ccfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearUpdateTopologyChangeAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearUpdateTopologyChangeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearUpdateTopologyChangeAbstractTest.java
index e2ad79f..21b3c72 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearUpdateTopologyChangeAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheNearUpdateTopologyChangeAbstractTest.java
@@ -56,11 +56,11 @@ public abstract class CacheNearUpdateTopologyChangeAbstractTest extends IgniteCa
     public void testNearUpdateTopologyChange() throws Exception {
         awaitPartitionMapExchange();
 
-        final Affinity<Integer> aff = grid(0).affinity(null);
+        final Affinity<Integer> aff = grid(0).affinity(DEFAULT_CACHE_NAME);
 
         final Integer key = 9;
 
-        IgniteCache<Integer, Integer> primaryCache = primaryCache(key, null);
+        IgniteCache<Integer, Integer> primaryCache = primaryCache(key, DEFAULT_CACHE_NAME);
 
         final Ignite primaryIgnite = primaryCache.unwrap(Ignite.class);
 
@@ -104,7 +104,7 @@ public abstract class CacheNearUpdateTopologyChangeAbstractTest extends IgniteCa
 
                 gotNewPrimary = true;
 
-                primary.cache(null).put(key, 2);
+                primary.cache(DEFAULT_CACHE_NAME).put(key, 2);
 
                 break;
             }
@@ -130,7 +130,7 @@ public abstract class CacheNearUpdateTopologyChangeAbstractTest extends IgniteCa
 
         assertTrue(wait);
 
-        log.info("Primary node: " + primaryNode(key, null).name());
+        log.info("Primary node: " + primaryNode(key, DEFAULT_CACHE_NAME).name());
 
         assertTrue(aff.isPrimary(primaryIgnite.cluster().localNode(), key));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java
index 06fafb3..1886c76 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheOffheapMapEntrySelfTest.java
@@ -125,7 +125,7 @@ public class CacheOffheapMapEntrySelfTest extends GridCacheAbstractSelfTest {
         try {
             GridCacheAdapter<Integer, String> cache = ((IgniteKernal)grid(0)).internalCache(jcache.getName());
 
-            Integer key = primaryKey(grid(0).cache(null));
+            Integer key = primaryKey(grid(0).cache(DEFAULT_CACHE_NAME));
 
             cache.put(key, "val");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java
index 559cf72..1fdb8a6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CachePutIfAbsentTest.java
@@ -103,7 +103,7 @@ public class CachePutIfAbsentTest extends GridCommonAbstractTest {
         CacheMode cacheMode,
         CacheWriteSynchronizationMode syncMode,
         int backups) {
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(cacheMode);
         ccfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
index 776e213..8d7af84 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadThroughRestartSelfTest.java
@@ -99,7 +99,7 @@ public class CacheReadThroughRestartSelfTest extends GridCacheAbstractSelfTest {
      * @throws Exception If failed.
      */
     private void testReadThroughInTx(boolean needVer) throws Exception {
-        IgniteCache<String, Integer> cache = grid(1).cache(null);
+        IgniteCache<String, Integer> cache = grid(1).cache(DEFAULT_CACHE_NAME);
 
         for (int k = 0; k < 1000; k++)
             cache.put("key" + k, k);
@@ -112,7 +112,7 @@ public class CacheReadThroughRestartSelfTest extends GridCacheAbstractSelfTest {
 
         Ignite ignite = grid(1);
 
-        cache = ignite.cache(null);
+        cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         for (TransactionConcurrency txConcurrency : TransactionConcurrency.values()) {
             for (TransactionIsolation txIsolation : TransactionIsolation.values()) {
@@ -154,7 +154,7 @@ public class CacheReadThroughRestartSelfTest extends GridCacheAbstractSelfTest {
      * @throws Exception If failed.
      */
     private void testReadThrough(boolean needVer) throws Exception {
-        IgniteCache<String, Integer> cache = grid(1).cache(null);
+        IgniteCache<String, Integer> cache = grid(1).cache(DEFAULT_CACHE_NAME);
 
         for (int k = 0; k < 1000; k++)
             cache.put("key" + k, k);
@@ -165,7 +165,7 @@ public class CacheReadThroughRestartSelfTest extends GridCacheAbstractSelfTest {
 
         Ignite ignite = grid(1);
 
-        cache = ignite.cache(null);
+        cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         for (int k = 0; k < 1000; k++) {
             String key = "key" + k;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRebalancingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRebalancingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRebalancingSelfTest.java
index 15dcd0e..f5ae59d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRebalancingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRebalancingSelfTest.java
@@ -35,7 +35,7 @@ public class CacheRebalancingSelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        cfg.setCacheConfiguration(new CacheConfiguration());
+        cfg.setCacheConfiguration(new CacheConfiguration(DEFAULT_CACHE_NAME));
 
         return cfg;
     }
@@ -55,7 +55,7 @@ public class CacheRebalancingSelfTest extends GridCommonAbstractTest {
 
         startGrid(1);
 
-        IgniteCache<Object, Object> cache = ig0.cache(null);
+        IgniteCache<Object, Object> cache = ig0.cache(DEFAULT_CACHE_NAME);
 
         IgniteFuture fut1 = cache.rebalance();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java
index 674467a..a27bdda 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheRemoveAllSelfTest.java
@@ -43,7 +43,7 @@ public class CacheRemoveAllSelfTest extends GridCacheAbstractSelfTest {
      * @throws Exception If failed.
      */
     public void testRemoveAll() throws Exception {
-        IgniteCache<Integer, String> cache = grid(0).cache(null);
+        IgniteCache<Integer, String> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < 10_000; ++i)
             cache.put(i, "val");
@@ -66,7 +66,7 @@ public class CacheRemoveAllSelfTest extends GridCacheAbstractSelfTest {
         U.sleep(5000);
 
         for (int i = 0; i < igniteId.get(); ++i) {
-            IgniteCache locCache = grid(i).cache(null);
+            IgniteCache locCache = grid(i).cache(DEFAULT_CACHE_NAME);
 
             assertEquals("Local size: " + locCache.localSize() + "\n" +
                 "On heap: " + locCache.localSize(CachePeekMode.ONHEAP) + "\n" +

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java
index bfd7806..6ee4c99 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheSerializableTransactionsTest.java
@@ -660,8 +660,8 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest {
             try {
                 IgniteCache<Integer, Integer> cache = ignite0.createCache(ccfg);
 
-                Integer key0 = primaryKey(ignite(0).cache(null));
-                Integer key1 = primaryKey(ignite(1).cache(null));
+                Integer key0 = primaryKey(ignite(0).cache(DEFAULT_CACHE_NAME));
+                Integer key1 = primaryKey(ignite(1).cache(DEFAULT_CACHE_NAME));
 
                 try (Transaction tx = txs.txStart(OPTIMISTIC, SERIALIZABLE)) {
                     cache.put(key0, key0);
@@ -5059,7 +5059,7 @@ public class CacheSerializableTransactionsTest extends GridCommonAbstractTest {
         int backups,
         boolean storeEnabled,
         boolean nearCache) {
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(cacheMode);
         ccfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStartupInDeploymentModesTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStartupInDeploymentModesTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStartupInDeploymentModesTest.java
index d065890..949147e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStartupInDeploymentModesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStartupInDeploymentModesTest.java
@@ -50,11 +50,11 @@ public class CacheStartupInDeploymentModesTest extends GridCommonAbstractTest {
         cfg.setMarshaller(marshaller);
         cfg.setDeploymentMode(deploymentMode);
 
-        CacheConfiguration cacheCfg1 = new CacheConfiguration();
+        CacheConfiguration cacheCfg1 = new CacheConfiguration(DEFAULT_CACHE_NAME);
         cacheCfg1.setCacheMode(CacheMode.REPLICATED);
         cacheCfg1.setName(REPLICATED_CACHE);
 
-        CacheConfiguration cacheCfg2 = new CacheConfiguration();
+        CacheConfiguration cacheCfg2 = new CacheConfiguration(DEFAULT_CACHE_NAME);
         cacheCfg2.setCacheMode(CacheMode.PARTITIONED);
         cacheCfg2.setName(PARTITIONED_CACHE);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java
index 70f2fc5..5af7b07 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeAbstractTest.java
@@ -100,7 +100,7 @@ public abstract class CacheStoreUsageMultinodeAbstractTest extends GridCommonAbs
      */
     @SuppressWarnings("unchecked")
     protected CacheConfiguration cacheConfiguration() {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(atomicityMode());
@@ -147,9 +147,9 @@ public abstract class CacheStoreUsageMultinodeAbstractTest extends GridCommonAbs
 
         awaitPartitionMapExchange();
 
-        IgniteCache<Object, Object> cache0 = ignite(0).cache(null);
-        IgniteCache<Object, Object> cache1 = ignite(1).cache(null);
-        IgniteCache<Object, Object> clientCache = client.cache(null);
+        IgniteCache<Object, Object> cache0 = ignite(0).cache(DEFAULT_CACHE_NAME);
+        IgniteCache<Object, Object> cache1 = ignite(1).cache(DEFAULT_CACHE_NAME);
+        IgniteCache<Object, Object> clientCache = client.cache(DEFAULT_CACHE_NAME);
 
         assertTrue(((IgniteCacheProxy)cache0).context().store().configured());
         assertEquals(clientStore, ((IgniteCacheProxy) clientCache).context().store().configured());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartAbstractTest.java
index 44cd37e..9171db8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheStoreUsageMultinodeDynamicStartAbstractTest.java
@@ -157,12 +157,12 @@ public abstract class CacheStoreUsageMultinodeDynamicStartAbstractTest extends C
 
         try {
             if (nearCache)
-                client.createNearCache(null, new NearCacheConfiguration<>());
+                client.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration<>());
 
             checkStoreUpdate(true);
         }
         finally {
-            cache = srv.cache(null);
+            cache = srv.cache(DEFAULT_CACHE_NAME);
 
             if (cache != null)
                 cache.destroy();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxFastFinishTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxFastFinishTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxFastFinishTest.java
index cad65d4..9f4910a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxFastFinishTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheTxFastFinishTest.java
@@ -63,7 +63,7 @@ public class CacheTxFastFinishTest extends GridCommonAbstractTest {
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(TRANSACTIONAL);
@@ -144,7 +144,7 @@ public class CacheTxFastFinishTest extends GridCommonAbstractTest {
     private void fastFinishTx(Ignite ignite) {
         IgniteTransactions txs = ignite.transactions();
 
-        IgniteCache cache = ignite.cache(null);
+        IgniteCache cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         for (boolean commit : new boolean[]{true, false}) {
             for (TransactionConcurrency c : TransactionConcurrency.values()) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java
index aad6826..b64cf85 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheLockTest.java
@@ -54,12 +54,12 @@ public class CrossCacheLockTest extends GridCommonAbstractTest {
         if (igniteInstanceName.equals(getTestIgniteInstanceName(GRID_CNT - 1)))
             cfg.setClientMode(true);
 
-        CacheConfiguration ccfg1 = new CacheConfiguration();
+        CacheConfiguration ccfg1 = new CacheConfiguration(DEFAULT_CACHE_NAME);
         ccfg1.setName(CACHE1);
         ccfg1.setBackups(1);
         ccfg1.setAtomicityMode(TRANSACTIONAL);
 
-        CacheConfiguration ccfg2 = new CacheConfiguration();
+        CacheConfiguration ccfg2 = new CacheConfiguration(DEFAULT_CACHE_NAME);
         ccfg2.setName(CACHE2);
         ccfg2.setAtomicityMode(TRANSACTIONAL);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java
index abd126c..6c22b05 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CrossCacheTxRandomOperationsTest.java
@@ -159,7 +159,7 @@ public class CrossCacheTxRandomOperationsTest extends GridCommonAbstractTest {
         CacheMode cacheMode,
         CacheWriteSynchronizationMode writeSync,
         boolean nearCache) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(name);
         ccfg.setCacheMode(cacheMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/EntryVersionConsistencyReadThroughTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/EntryVersionConsistencyReadThroughTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/EntryVersionConsistencyReadThroughTest.java
index f86da12..a6ab938 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/EntryVersionConsistencyReadThroughTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/EntryVersionConsistencyReadThroughTest.java
@@ -70,7 +70,7 @@ public class EntryVersionConsistencyReadThroughTest extends GridCommonAbstractTe
      */
     @SuppressWarnings({"rawtypes", "unchecked"})
     private CacheConfiguration<String, List<Double>> createCacheConfiguration(CacheAtomicityMode atomicityMode) {
-        CacheConfiguration<String, List<Double>> cc = new CacheConfiguration<>();
+        CacheConfiguration<String, List<Double>> cc = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cc.setCacheMode(PARTITIONED);
         cc.setAtomicityMode(atomicityMode);
@@ -158,7 +158,7 @@ public class EntryVersionConsistencyReadThroughTest extends GridCommonAbstractTe
 
                 IgniteEx grid = grid(i);
 
-                final IgniteCache<String, Integer> cache = grid.cache(null);
+                final IgniteCache<String, Integer> cache = grid.cache(DEFAULT_CACHE_NAME);
 
                 if (single)
                     for (String key : keys)
@@ -168,7 +168,7 @@ public class EntryVersionConsistencyReadThroughTest extends GridCommonAbstractTe
 
                 // Check entry versions consistency.
                 for (String key : keys) {
-                    Collection<ClusterNode> nodes = grid.affinity(null).mapKeyToPrimaryAndBackups(key);
+                    Collection<ClusterNode> nodes = grid.affinity(DEFAULT_CACHE_NAME).mapKeyToPrimaryAndBackups(key);
 
                     List<IgniteEx> grids = grids(nodes);
 
@@ -176,7 +176,7 @@ public class EntryVersionConsistencyReadThroughTest extends GridCommonAbstractTe
                     Object val0 = null;
 
                     for (IgniteEx g : grids) {
-                        GridCacheAdapter<Object, Object> cx = g.context().cache().internalCache();
+                        GridCacheAdapter<Object, Object> cx = g.context().cache().internalCache(DEFAULT_CACHE_NAME);
 
                         GridCacheEntryEx e = cx.entryEx(key);
 
@@ -201,7 +201,7 @@ public class EntryVersionConsistencyReadThroughTest extends GridCommonAbstractTe
             }
         }
         finally {
-            grid(0).destroyCache(null);
+            grid(0).destroyCache(DEFAULT_CACHE_NAME);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
index 57a2420..de1848f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java
@@ -207,7 +207,7 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac
                         try {
                             final Ignite g = startGrid(name);
 
-                            IgniteCache<String, Object> cache = g.cache(null);
+                            IgniteCache<String, Object> cache = g.cache(DEFAULT_CACHE_NAME);
 
                             for (int k = half; k < ENTRY_CNT; k++) {
                                 String key = "key" + k;
@@ -384,6 +384,6 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac
      * @return Cache.
      */
     private IgniteCache<String,Integer> cache(Ignite g) {
-        return g.cache(null);
+        return g.cache(DEFAULT_CACHE_NAME);
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 93ed7a1..bf27e26 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -422,7 +422,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
             map.put("key" + i, i);
 
         // Put in primary nodes to avoid near readers which will prevent entry from being cleared.
-        Map<ClusterNode, Collection<String>> mapped = grid(0).<String>affinity(null).mapKeysToNodes(map.keySet());
+        Map<ClusterNode, Collection<String>> mapped = grid(0).<String>affinity(DEFAULT_CACHE_NAME).mapKeysToNodes(map.keySet());
 
         for (int i = 0; i < gridCount(); i++) {
             Collection<String> keys = mapped.get(grid(i).localNode());
@@ -435,7 +435,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         map.remove("key0");
 
-        mapped = grid(0).<String>affinity(null).mapKeysToNodes(map.keySet());
+        mapped = grid(0).<String>affinity(DEFAULT_CACHE_NAME).mapKeysToNodes(map.keySet());
 
         for (int i = 0; i < gridCount(); i++) {
             // Will actually delete entry from map.
@@ -1474,7 +1474,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         assertEquals(exp, cache.get(key));
 
         for (int i = 0; i < gridCount(); i++) {
-            if (ignite(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key))
+            if (ignite(i).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid(i).localNode(), key))
                 assertEquals(exp, peek(jcache(i), key));
         }
     }
@@ -2245,7 +2245,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         for (int i = 0; i < gridCount(); i++) {
             info("Peek on node [i=" + i + ", id=" + grid(i).localNode().id() + ", val=" +
-                grid(i).cache(null).localPeek("key", ONHEAP) + ']');
+                grid(i).cache(DEFAULT_CACHE_NAME).localPeek("key", ONHEAP) + ']');
         }
 
         assertEquals((Integer)1, cache.getAndPutIfAbsent("key", 2));
@@ -2700,10 +2700,10 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         for (int i = 0; i < gridCount(); i++) {
             info("Peek key on grid [i=" + i + ", nodeId=" + grid(i).localNode().id() +
-                ", peekVal=" + grid(i).cache(null).localPeek("key", ONHEAP) + ']');
+                ", peekVal=" + grid(i).cache(DEFAULT_CACHE_NAME).localPeek("key", ONHEAP) + ']');
 
             info("Peek key2 on grid [i=" + i + ", nodeId=" + grid(i).localNode().id() +
-                ", peekVal=" + grid(i).cache(null).localPeek("key2", ONHEAP) + ']');
+                ", peekVal=" + grid(i).cache(DEFAULT_CACHE_NAME).localPeek("key2", ONHEAP) + ']');
         }
 
         if (!isMultiJvm())
@@ -3051,7 +3051,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testGetAndRemoveObject() throws Exception {
-        IgniteCache<String, TestValue> cache = ignite(0).cache(null);
+        IgniteCache<String, TestValue> cache = ignite(0).cache(DEFAULT_CACHE_NAME);
 
         TestValue val1 = new TestValue(1);
         TestValue val2 = new TestValue(2);
@@ -3081,7 +3081,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testGetAndPutObject() throws Exception {
-        IgniteCache<String, TestValue> cache = ignite(0).cache(null);
+        IgniteCache<String, TestValue> cache = ignite(0).cache(DEFAULT_CACHE_NAME);
 
         TestValue val1 = new TestValue(1);
         TestValue val2 = new TestValue(2);
@@ -3140,13 +3140,13 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
             storeStgy.putToStore(key, Integer.parseInt(key));
 
         for (int g = 0; g < gridCount(); g++)
-            grid(g).cache(null).localLoadCache(null);
+            grid(g).cache(DEFAULT_CACHE_NAME).localLoadCache(null);
 
         for (int g = 0; g < gridCount(); g++) {
             for (int i = 0; i < cnt; i++) {
                 String key = String.valueOf(i);
 
-                if (grid(0).affinity(null).mapKeyToPrimaryAndBackups(key).contains(grid(g).localNode()))
+                if (grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToPrimaryAndBackups(key).contains(grid(g).localNode()))
                     assertEquals((Integer)i, peek(jcache(g), key));
                 else
                     assertNull(peek(jcache(g), key));
@@ -3174,13 +3174,13 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
             storeStgy.putToStore(key, Integer.parseInt(key));
 
         for (int g = 0; g < gridCount(); g++)
-            grid(g).cache(null).localLoadCacheAsync(null).get();
+            grid(g).cache(DEFAULT_CACHE_NAME).localLoadCacheAsync(null).get();
 
         for (int g = 0; g < gridCount(); g++) {
             for (int i = 0; i < cnt; i++) {
                 String key = String.valueOf(i);
 
-                if (grid(0).affinity(null).mapKeyToPrimaryAndBackups(key).contains(grid(g).localNode()))
+                if (grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToPrimaryAndBackups(key).contains(grid(g).localNode()))
                     assertEquals((Integer)i, peek(jcache(g), key));
                 else
                     assertNull(peek(jcache(g), key));
@@ -3452,7 +3452,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
             }
         }, NullPointerException.class, null);
 
-        assertEquals(0, grid(0).cache(null).localSize());
+        assertEquals(0, grid(0).cache(DEFAULT_CACHE_NAME).localSize());
 
         GridTestUtils.assertThrows(log, new Callable<Void>() {
             @Override public Void call() throws Exception {
@@ -3603,7 +3603,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     public void testRemoveAfterClear() throws Exception {
         IgniteEx ignite = grid(0);
 
-        boolean affNode = ignite.context().cache().internalCache(null).context().affinityNode();
+        boolean affNode = ignite.context().cache().internalCache(DEFAULT_CACHE_NAME).context().affinityNode();
 
         if (!affNode) {
             if (gridCount() < 2)
@@ -3612,14 +3612,14 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
             ignite = grid(1);
         }
 
-        IgniteCache<Integer, Integer> cache = ignite.cache(null);
+        IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         int key = 0;
 
         Collection<Integer> keys = new ArrayList<>();
 
         for (int k = 0; k < 2; k++) {
-            while (!ignite.affinity(null).isPrimary(ignite.localNode(), key))
+            while (!ignite.affinity(DEFAULT_CACHE_NAME).isPrimary(ignite.localNode(), key))
                 key++;
 
             keys.add(key);
@@ -3637,9 +3637,9 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         for (int g = 0; g < gridCount(); g++) {
             Ignite grid0 = grid(g);
 
-            grid0.cache(null).removeAll();
+            grid0.cache(DEFAULT_CACHE_NAME).removeAll();
 
-            assertTrue(grid0.cache(null).localSize() == 0);
+            assertTrue(grid0.cache(DEFAULT_CACHE_NAME).localSize() == 0);
         }
     }
 
@@ -3749,7 +3749,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
             @Override public boolean apply() {
                 try {
                     for (int i = 0; i < gridCount(); i++) {
-                        GridCacheAdapter<Object, Object> cache = ((IgniteKernal)ignite(i)).internalCache();
+                        GridCacheAdapter<Object, Object> cache = ((IgniteKernal)ignite(i)).internalCache(DEFAULT_CACHE_NAME);
 
                         for (String key : keys0) {
                             GridCacheEntryEx entry = cache.peekEx(key);
@@ -3958,7 +3958,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      */
     public void testPeek() throws Exception {
         Ignite ignite = primaryIgnite("key");
-        IgniteCache<String, Integer> cache = ignite.cache(null);
+        IgniteCache<String, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         assert peek(cache, "key") == null;
 
@@ -3990,7 +3990,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
     private void checkPeekTxRemove(TransactionConcurrency concurrency) throws Exception {
         if (txShouldBeUsed()) {
             Ignite ignite = primaryIgnite("key");
-            IgniteCache<String, Integer> cache = ignite.cache(null);
+            IgniteCache<String, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             cache.put("key", 1);
 
@@ -4034,9 +4034,9 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl));
 
-        grid(0).cache(null).withExpiryPolicy(expiry).put(key, 1);
+        grid(0).cache(DEFAULT_CACHE_NAME).withExpiryPolicy(expiry).put(key, 1);
 
-        final Affinity<String> aff = ignite(0).affinity(null);
+        final Affinity<String> aff = ignite(0).affinity(DEFAULT_CACHE_NAME);
 
         boolean wait = waitForCondition(new GridAbsPredicate() {
             @Override public boolean apply() {
@@ -4121,7 +4121,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
             try (Transaction tx = grid(0).transactions().txStart()) {
                 final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl));
 
-                grid(0).cache(null).withExpiryPolicy(expiry).put(key, 1);
+                grid(0).cache(DEFAULT_CACHE_NAME).withExpiryPolicy(expiry).put(key, 1);
 
                 tx.commit();
             }
@@ -4229,7 +4229,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         long[] expireTimes = new long[gridCount()];
 
         for (int i = 0; i < gridCount(); i++) {
-            if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key)) {
+            if (grid(i).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid(i).localNode(), key)) {
                 IgnitePair<Long> curEntryTtl = entryTtl(jcache(i), key);
 
                 assertNotNull(curEntryTtl.get1());
@@ -4258,7 +4258,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         }
 
         for (int i = 0; i < gridCount(); i++) {
-            if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key)) {
+            if (grid(i).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid(i).localNode(), key)) {
                 IgnitePair<Long> curEntryTtl = entryTtl(jcache(i), key);
 
                 assertNotNull(curEntryTtl.get1());
@@ -4287,7 +4287,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         }
 
         for (int i = 0; i < gridCount(); i++) {
-            if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key)) {
+            if (grid(i).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid(i).localNode(), key)) {
                 IgnitePair<Long> curEntryTtl = entryTtl(jcache(i), key);
 
                 assertNotNull(curEntryTtl.get1());
@@ -4320,7 +4320,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         log.info("Put 4 done");
 
         for (int i = 0; i < gridCount(); i++) {
-            if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key)) {
+            if (grid(i).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid(i).localNode(), key)) {
                 IgnitePair<Long> curEntryTtl = entryTtl(jcache(i), key);
 
                 assertNotNull(curEntryTtl.get1());
@@ -4436,7 +4436,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         loadAll(cache, ImmutableSet.of(key1, key2), true);
 
-        Affinity<String> aff = ignite(0).affinity(null);
+        Affinity<String> aff = ignite(0).affinity(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < gridCount(); i++) {
             if (aff.isPrimaryOrBackup(grid(i).cluster().localNode(), key1))
@@ -4475,7 +4475,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl));
 
-        grid(0).cache(null).withExpiryPolicy(expiry).put(key, 1);
+        grid(0).cache(DEFAULT_CACHE_NAME).withExpiryPolicy(expiry).put(key, 1);
 
         waitForCondition(new GridAbsPredicate() {
             @Override public boolean apply() {
@@ -4724,7 +4724,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      * @return Ignite instance for primary node.
      */
     protected Ignite primaryIgnite(String key) {
-        ClusterNode node = grid(0).affinity(null).mapKeyToNode(key);
+        ClusterNode node = grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key);
 
         if (node == null)
             throw new IgniteException("Failed to find primary node.");
@@ -4744,7 +4744,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      * @return Cache.
      */
     protected IgniteCache<String, Integer> primaryCache(String key) {
-        return primaryIgnite(key).cache(null);
+        return primaryIgnite(key).cache(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -4781,7 +4781,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testIterator() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         final int KEYS = 1000;
 
@@ -4790,7 +4790,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         // Try to initialize readers in case when near cache is enabled.
         for (int i = 0; i < gridCount(); i++) {
-            cache = grid(i).cache(null);
+            cache = grid(i).cache(DEFAULT_CACHE_NAME);
 
             for (int k = 0; k < KEYS; k++)
                 assertEquals((Object)k, cache.get(k));
@@ -5050,19 +5050,19 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         Ignite g = primaryIgnite(keyToRmv);
 
-        g.<String, Integer>cache(null).localClear(keyToRmv);
+        g.<String, Integer>cache(DEFAULT_CACHE_NAME).localClear(keyToRmv);
 
         checkLocalRemovedKey(keyToRmv);
 
-        g.<String, Integer>cache(null).put(keyToRmv, 1);
+        g.<String, Integer>cache(DEFAULT_CACHE_NAME).put(keyToRmv, 1);
 
         String keyToEvict = "key" + 30;
 
         g = primaryIgnite(keyToEvict);
 
-        g.<String, Integer>cache(null).localEvict(Collections.singleton(keyToEvict));
+        g.<String, Integer>cache(DEFAULT_CACHE_NAME).localEvict(Collections.singleton(keyToEvict));
 
-        g.<String, Integer>cache(null).localClear(keyToEvict);
+        g.<String, Integer>cache(DEFAULT_CACHE_NAME).localClear(keyToEvict);
 
         checkLocalRemovedKey(keyToEvict);
     }
@@ -5074,14 +5074,14 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         for (int i = 0; i < 500; ++i) {
             String key = "key" + i;
 
-            boolean found = primaryIgnite(key).cache(null).localPeek(key) != null;
+            boolean found = primaryIgnite(key).cache(DEFAULT_CACHE_NAME).localPeek(key) != null;
 
             if (keyToRmv.equals(key)) {
-                Collection<ClusterNode> nodes = grid(0).affinity(null).mapKeyToPrimaryAndBackups(key);
+                Collection<ClusterNode> nodes = grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToPrimaryAndBackups(key);
 
                 for (int j = 0; j < gridCount(); ++j) {
                     if (nodes.contains(grid(j).localNode()) && grid(j) != primaryIgnite(key))
-                        assertTrue("Not found on backup removed key ", grid(j).cache(null).localPeek(key) != null);
+                        assertTrue("Not found on backup removed key ", grid(j).cache(DEFAULT_CACHE_NAME).localPeek(key) != null);
                 }
 
                 assertFalse("Found removed key " + key, found);
@@ -5119,14 +5119,14 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         info("Will clear keys on node: " + g.cluster().localNode().id());
 
-        g.<String, Integer>cache(null).localClearAll(keysToRmv);
+        g.<String, Integer>cache(DEFAULT_CACHE_NAME).localClearAll(keysToRmv);
 
         for (int i = 0; i < 500; ++i) {
             String key = "key" + i;
 
             Ignite ignite = primaryIgnite(key);
 
-            boolean found = ignite.cache(null).localPeek(key) != null;
+            boolean found = ignite.cache(DEFAULT_CACHE_NAME).localPeek(key) != null;
 
             if (keysToRmv.contains(key))
                 assertFalse("Found removed key [key=" + key + ", node=" + ignite.cluster().localNode().id() + ']',
@@ -5154,7 +5154,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
             Ignite g = primaryIgnite(key);
 
-            g.cache(null).put(key, "value" + i);
+            g.cache(DEFAULT_CACHE_NAME).put(key, "value" + i);
 
             keys.get(g.name()).add(key);
         }
@@ -5218,7 +5218,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
             Ignite g = primaryIgnite(key);
 
-            g.cache(null).put(key, "value" + i);
+            g.cache(DEFAULT_CACHE_NAME).put(key, "value" + i);
         }
 
         if (async) {
@@ -5267,7 +5267,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      * @throws Exception If failed.
      */
     public void testWithSkipStore() throws Exception {
-        IgniteCache<String, Integer> cache = grid(0).cache(null);
+        IgniteCache<String, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         IgniteCache<String, Integer> cacheSkipStore = cache.withSkipStore();
 
@@ -5479,7 +5479,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         if (atomicityMode() == TRANSACTIONAL || (atomicityMode() == ATOMIC && nearEnabled())) // TODO IGNITE-373.
             return;
 
-        IgniteCache<String, Integer> cache = grid(0).cache(null);
+        IgniteCache<String, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         IgniteCache<String, Integer> cacheSkipStore = cache.withSkipStore();
 
@@ -5518,7 +5518,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
      */
     public void testWithSkipStoreTx() throws Exception {
         if (txShouldBeUsed()) {
-            IgniteCache<String, Integer> cache = grid(0).cache(null);
+            IgniteCache<String, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             IgniteCache<String, Integer> cacheSkipStore = cache.withSkipStore();
 
@@ -5844,7 +5844,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
         };
 
         try {
-            IgniteCache<String, Integer> cache = grid(0).cache(null);
+            IgniteCache<String, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             List<String> keys = primaryKeysForCache(cache, 2);
 
@@ -6327,7 +6327,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         /** {@inheritDoc} */
         @Override public void run(int idx) throws Exception {
-            GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache().context();
+            GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache(DEFAULT_CACHE_NAME).context();
 
             int size = 0;
 
@@ -6367,7 +6367,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         /** {@inheritDoc} */
         @Override public void run(int idx) throws Exception {
-            GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache().context();
+            GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache(DEFAULT_CACHE_NAME).context();
 
             int size = 0;
 
@@ -6461,7 +6461,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
          * @param idx Index.
          */
         @Override public Void call(int idx) throws Exception {
-            GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache().context();
+            GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache(DEFAULT_CACHE_NAME).context();
             GridCacheQueryManager queries = ctx.queries();
 
             ConcurrentMap<UUID, Map<Long, GridFutureAdapter<?>>> map = GridTestUtils.getFieldValue(queries,
@@ -6486,7 +6486,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
          * @param idx Index.
          */
         @Override public Void call(int idx) throws Exception {
-            GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache().context();
+            GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache(DEFAULT_CACHE_NAME).context();
             GridCacheQueryManager queries = ctx.queries();
 
             ConcurrentMap<UUID, Map<Long, GridFutureAdapter<?>>> map = GridTestUtils.getFieldValue(queries,
@@ -6538,11 +6538,11 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
             for (int i = 0; i < cnt; i++) {
                 String key = String.valueOf(i);
 
-                GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache().context();
+                GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache(DEFAULT_CACHE_NAME).context();
 
                 GridCacheEntryEx entry = ctx.isNear() ? ctx.near().dht().peekEx(key) : ctx.cache().peekEx(key);
 
-                if (ignite.affinity(null).mapKeyToPrimaryAndBackups(key).contains(((IgniteKernal)ignite).localNode())) {
+                if (ignite.affinity(DEFAULT_CACHE_NAME).mapKeyToPrimaryAndBackups(key).contains(((IgniteKernal)ignite).localNode())) {
                     assertNotNull(entry);
                     assertTrue(entry.deleted());
                 }
@@ -6568,7 +6568,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
 
         /** {@inheritDoc} */
         @Override public void run(int idx) throws Exception {
-            GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache().context();
+            GridCacheContext<String, Integer> ctx = ((IgniteKernal)ignite).<String, Integer>internalCache(DEFAULT_CACHE_NAME).context();
 
             int size = 0;
 
@@ -6576,7 +6576,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
                 if (ctx.affinity().keyLocalNode(key, ctx.discovery().topologyVersionEx()))
                     size++;
 
-            assertEquals("Incorrect key size on cache #" + idx, size, ignite.cache(null).localSize(ALL));
+            assertEquals("Incorrect key size on cache #" + idx, size, ignite.cache(DEFAULT_CACHE_NAME).localSize(ALL));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
index 83d2674..7dce36b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractLocalStoreSelfTest.java
@@ -114,7 +114,7 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration cacheCfg = cache(igniteInstanceName, null, 0);
+        CacheConfiguration cacheCfg = cache(igniteInstanceName, DEFAULT_CACHE_NAME, 0);
 
         cacheCfg.setAffinity(new RendezvousAffinityFunction());
 
@@ -217,7 +217,7 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst
     public void testEvict() throws Exception {
         Ignite ignite1 = startGrid(1);
 
-        IgniteCache<Object, Object> cache = ignite1.cache(null).withExpiryPolicy(new CreatedExpiryPolicy(
+        IgniteCache<Object, Object> cache = ignite1.cache(DEFAULT_CACHE_NAME).withExpiryPolicy(new CreatedExpiryPolicy(
             new Duration(TimeUnit.MILLISECONDS, 100L)));
 
         // Putting entry.
@@ -245,13 +245,13 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst
     public void testPrimaryNode() throws Exception {
         Ignite ignite1 = startGrid(1);
 
-        IgniteCache<Object, Object> cache = ignite1.cache(null);
+        IgniteCache<Object, Object> cache = ignite1.cache(DEFAULT_CACHE_NAME);
 
         // Populate cache and check that local store has all value.
         for (int i = 0; i < KEYS; i++)
             cache.put(i, i);
 
-        checkLocalStore(ignite1, LOCAL_STORE_1, null);
+        checkLocalStore(ignite1, LOCAL_STORE_1, DEFAULT_CACHE_NAME);
 
         final AtomicInteger evtCnt = new AtomicInteger(0);
 
@@ -271,7 +271,7 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst
             boolean wait = GridTestUtils.waitForCondition(new GridAbsPredicate() {
                 @Override public boolean apply() {
                     // Partition count which must be transferred to 2'nd node.
-                    int parts = ignite2.affinity(null).allPartitions(ignite2.cluster().localNode()).length;
+                    int parts = ignite2.affinity(DEFAULT_CACHE_NAME).allPartitions(ignite2.cluster().localNode()).length;
 
                     return evtCnt.get() >= parts;
                 }
@@ -282,8 +282,8 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst
 
         assertEquals(Ignition.allGrids().size(), 2);
 
-        checkLocalStore(ignite1, LOCAL_STORE_1, null);
-        checkLocalStore(ignite2, LOCAL_STORE_2, null);
+        checkLocalStore(ignite1, LOCAL_STORE_1, DEFAULT_CACHE_NAME);
+        checkLocalStore(ignite2, LOCAL_STORE_2, DEFAULT_CACHE_NAME);
     }
 
 
@@ -411,7 +411,7 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst
      * @throws Exception If failed.
      */
     public void testLocalStoreCorrespondsAffinityNoBackups() throws Exception {
-        testLocalStoreCorrespondsAffinity(null);
+        testLocalStoreCorrespondsAffinity(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -670,13 +670,13 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst
     public void testSwap() throws Exception {
         Ignite ignite1 = startGrid(1);
 
-        IgniteCache<Object, Object> cache = ignite1.cache(null);
+        IgniteCache<Object, Object> cache = ignite1.cache(DEFAULT_CACHE_NAME);
 
         // Populate cache and check that local store has all value.
         for (int i = 0; i < KEYS; i++)
             cache.put(i, i);
 
-        checkLocalStore(ignite1, LOCAL_STORE_1, null);
+        checkLocalStore(ignite1, LOCAL_STORE_1, DEFAULT_CACHE_NAME);
 
         // Push entry to swap.
         for (int i = 0; i < KEYS; i++)
@@ -703,7 +703,7 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst
             boolean wait = GridTestUtils.waitForCondition(new GridAbsPredicate() {
                 @Override public boolean apply() {
                     // Partition count which must be transferred to 2'nd node.
-                    int parts = ignite2.affinity(null).allPartitions(ignite2.cluster().localNode()).length;
+                    int parts = ignite2.affinity(DEFAULT_CACHE_NAME).allPartitions(ignite2.cluster().localNode()).length;
 
                     return evtCnt.get() >= parts;
                 }
@@ -714,8 +714,8 @@ public abstract class GridCacheAbstractLocalStoreSelfTest extends GridCommonAbst
 
         assertEquals(Ignition.allGrids().size(), 2);
 
-        checkLocalStore(ignite1, LOCAL_STORE_1, null);
-        checkLocalStore(ignite2, LOCAL_STORE_2, null);
+        checkLocalStore(ignite1, LOCAL_STORE_1, DEFAULT_CACHE_NAME);
+        checkLocalStore(ignite2, LOCAL_STORE_2, DEFAULT_CACHE_NAME);
     }
 
     /**


[27/51] [abbrv] ignite git commit: IGNITE-5088: Fixed OSGI test build instructions.

Posted by sb...@apache.org.
IGNITE-5088: Fixed OSGI test build instructions.


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

Branch: refs/heads/ignite-5075-cacheStart
Commit: 74f11e84daf3d953db8093357ffe94fe35a81c7b
Parents: 50fe5aa
Author: devozerov <vo...@gridgain.com>
Authored: Wed Apr 26 17:25:01 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Wed Apr 26 17:25:01 2017 +0300

----------------------------------------------------------------------
 modules/osgi/README.txt | 25 -------------------------
 1 file changed, 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/74f11e84/modules/osgi/README.txt
----------------------------------------------------------------------
diff --git a/modules/osgi/README.txt b/modules/osgi/README.txt
index 7e46032..439c450 100644
--- a/modules/osgi/README.txt
+++ b/modules/osgi/README.txt
@@ -33,28 +33,3 @@ dependency like this (replace '${ignite.version}' with actual Ignite version you
     </dependencies>
     ...
 </project>
-
-Running the tests in this module
---------------------------------
-
-We use the Pax Exam framework to fire up an Apache Karaf container (forked process) in order to execute the OSGi tests.
-
-Bundles are provisioned into the container via mvn: URLs. For this to work, you must have run a full build from the
-top directory of the Ignite source tree, including the install goal, which provisions the modules into your local
-Maven repository:
-
-   mvn clean install -Plgpl -Dmaven.javadoc.skip=true
-
-You may then run the OSGi test suite:
-
-   mvn test -Dtest=IgniteOsgiTestSuite
-
-NOTE: This test uses environment variables set by the maven-surefire-plugin configuration. If you are running the
-test suite from within an IDE, either run it via Maven or set these environment variables manually in your
-Run/Debug configuration:
-
-  - projectVersion
-  - karafVersion
-  - camelVersion
-
-See the pom.xml file of this module to understand which values to set.


[03/51] [abbrv] ignite git commit: ignite-1794 Refactored hibernate modules, switched to hibernate 5.1

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java
deleted file mode 100644
index c87f08f..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
- * 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.cache.store.hibernate;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicBoolean;
-import javax.cache.integration.CacheLoaderException;
-import javax.cache.integration.CacheWriterException;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cache.store.CacheStore;
-import org.apache.ignite.cache.store.CacheStoreAdapter;
-import org.apache.ignite.cache.store.CacheStoreSession;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.IgniteInterruptedCheckedException;
-import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.marshaller.jdk.JdkMarshaller;
-import org.apache.ignite.resources.CacheStoreSessionResource;
-import org.apache.ignite.resources.IgniteInstanceResource;
-import org.apache.ignite.resources.LoggerResource;
-import org.apache.ignite.transactions.Transaction;
-import org.hibernate.HibernateException;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.SharedSessionContract;
-import org.hibernate.cfg.Configuration;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * {@link CacheStore} implementation backed by Hibernate. This implementation
- * stores objects in underlying database in {@code BLOB} format.
- * <h2 class="header">Configuration</h2>
- * Either {@link #setSessionFactory(SessionFactory)} or
- * {@link #setHibernateConfigurationPath(String)} or
- * {@link #setHibernateProperties(Properties)} should be set.
- * <p>
- * If session factory is provided it should contain
- * {@link CacheHibernateBlobStoreEntry} persistent class (via provided
- * mapping file {@code GridCacheHibernateStoreEntry.hbm.xml} or by
- * adding {@link CacheHibernateBlobStoreEntry} to annotated classes
- * of session factory.
- * <p>
- * Path to hibernate configuration may be either an URL or a file path or
- * a classpath resource. This configuration file should include provided
- * mapping {@code GridCacheHibernateStoreEntry.hbm.xml} or include annotated
- * class {@link CacheHibernateBlobStoreEntry}.
- * <p>
- * If hibernate properties are provided, mapping
- * {@code GridCacheHibernateStoreEntry.hbm.xml} is included automatically.
- * <p>
- * Use {@link CacheHibernateBlobStoreFactory} factory to pass {@link CacheHibernateBlobStore} to {@link CacheConfiguration}.
- */
-public class CacheHibernateBlobStore<K, V> extends CacheStoreAdapter<K, V> {
-    /**
-     * Default connection URL
-     * (value is <tt>jdbc:h2:mem:hibernateCacheStore;DB_CLOSE_DELAY=-1;DEFAULT_LOCK_TIMEOUT=5000</tt>).
-     */
-    public static final String DFLT_CONN_URL = "jdbc:h2:mem:hibernateCacheStore;DB_CLOSE_DELAY=-1;" +
-        "DEFAULT_LOCK_TIMEOUT=5000";
-
-    /** Default show SQL property value (value is <tt>true</tt>). */
-    public static final String DFLT_SHOW_SQL = "true";
-
-    /** Default <tt>hibernate.hbm2ddl.auto</tt> property value (value is <tt>true</tt>). */
-    public static final String DFLT_HBM2DDL_AUTO = "update";
-
-    /** Session attribute name. */
-    private static final String ATTR_SES = "HIBERNATE_STORE_SESSION";
-
-    /** Name of Hibarname mapping resource. */
-    private static final String MAPPING_RESOURCE =
-            "org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml";
-
-    /** Marshaller. */
-    private static final Marshaller marsh = new JdkMarshaller();
-
-    /** Init guard. */
-    @GridToStringExclude
-    private final AtomicBoolean initGuard = new AtomicBoolean();
-
-    /** Init latch. */
-    @GridToStringExclude
-    private final CountDownLatch initLatch = new CountDownLatch(1);
-
-    /** Hibernate properties. */
-    @GridToStringExclude
-    private Properties hibernateProps;
-
-    /** Session factory. */
-    @GridToStringExclude
-    private SessionFactory sesFactory;
-
-    /** Path to hibernate configuration file. */
-    private String hibernateCfgPath;
-
-    /** Log. */
-    @LoggerResource
-    private IgniteLogger log;
-
-    /** Auto-injected store session. */
-    @CacheStoreSessionResource
-    private CacheStoreSession ses;
-
-    /** Ignite instance. */
-    @IgniteInstanceResource
-    private Ignite ignite;
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"unchecked", "RedundantTypeArguments"})
-    @Override public V load(K key) {
-        init();
-
-        Transaction tx = transaction();
-
-        if (log.isDebugEnabled())
-            log.debug("Store load [key=" + key + ", tx=" + tx + ']');
-
-        Session ses = session(tx);
-
-        try {
-            CacheHibernateBlobStoreEntry entry = (CacheHibernateBlobStoreEntry)
-                ses.get(CacheHibernateBlobStoreEntry.class, toBytes(key));
-
-            if (entry == null)
-                return null;
-
-            return fromBytes(entry.getValue());
-        }
-        catch (IgniteCheckedException | HibernateException e) {
-            rollback(ses, tx);
-
-            throw new CacheLoaderException("Failed to load value from cache store with key: " + key, e);
-        }
-        finally {
-            end(ses, tx);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void write(javax.cache.Cache.Entry<? extends K, ? extends V> entry) {
-        init();
-
-        Transaction tx = transaction();
-
-        K key = entry.getKey();
-        V val = entry.getValue();
-
-        if (log.isDebugEnabled())
-            log.debug("Store put [key=" + key + ", val=" + val + ", tx=" + tx + ']');
-
-        if (val == null) {
-            delete(key);
-
-            return;
-        }
-
-        Session ses = session(tx);
-
-        try {
-            CacheHibernateBlobStoreEntry entry0 = new CacheHibernateBlobStoreEntry(toBytes(key), toBytes(val));
-
-            ses.saveOrUpdate(entry0);
-        }
-        catch (IgniteCheckedException | HibernateException e) {
-            rollback(ses, tx);
-
-            throw new CacheWriterException("Failed to put value to cache store [key=" + key + ", val" + val + "]", e);
-        }
-        finally {
-            end(ses, tx);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"JpaQueryApiInspection", "JpaQlInspection"})
-    @Override public void delete(Object key) {
-        init();
-
-        Transaction tx = transaction();
-
-        if (log.isDebugEnabled())
-            log.debug("Store remove [key=" + key + ", tx=" + tx + ']');
-
-        Session ses = session(tx);
-
-        try {
-            Object obj = ses.get(CacheHibernateBlobStoreEntry.class, toBytes(key));
-
-            if (obj != null)
-                ses.delete(obj);
-        }
-        catch (IgniteCheckedException | HibernateException e) {
-            rollback(ses, tx);
-
-            throw new CacheWriterException("Failed to remove value from cache store with key: " + key, e);
-        }
-        finally {
-            end(ses, tx);
-        }
-    }
-
-    /**
-     * Rolls back hibernate session.
-     *
-     * @param ses Hibernate session.
-     * @param tx Cache ongoing transaction.
-     */
-    private void rollback(SharedSessionContract ses, Transaction tx) {
-        // Rollback only if there is no cache transaction,
-        // otherwise sessionEnd() will do all required work.
-        if (tx == null) {
-            org.hibernate.Transaction hTx = ses.getTransaction();
-
-            if (hTx != null && hTx.isActive())
-                hTx.rollback();
-        }
-    }
-
-    /**
-     * Ends hibernate session.
-     *
-     * @param ses Hibernate session.
-     * @param tx Cache ongoing transaction.
-     */
-    private void end(Session ses, Transaction tx) {
-        // Commit only if there is no cache transaction,
-        // otherwise sessionEnd() will do all required work.
-        if (tx == null) {
-            org.hibernate.Transaction hTx = ses.getTransaction();
-
-            if (hTx != null && hTx.isActive())
-                hTx.commit();
-
-            ses.close();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void sessionEnd(boolean commit) {
-        init();
-
-        Transaction tx = transaction();
-
-        Map<String, Session> props = session().properties();
-
-        Session ses = props.remove(ATTR_SES);
-
-        if (ses != null) {
-            org.hibernate.Transaction hTx = ses.getTransaction();
-
-            if (hTx != null) {
-                try {
-                    if (commit) {
-                        ses.flush();
-
-                        hTx.commit();
-                    }
-                    else
-                        hTx.rollback();
-
-                    if (log.isDebugEnabled())
-                        log.debug("Transaction ended [xid=" + tx.xid() + ", commit=" + commit + ']');
-                }
-                catch (HibernateException e) {
-                    throw new CacheWriterException("Failed to end transaction [xid=" + tx.xid() +
-                        ", commit=" + commit + ']', e);
-                }
-                finally {
-                    ses.close();
-                }
-            }
-        }
-    }
-
-    /**
-     * Gets Hibernate session.
-     *
-     * @param tx Cache transaction.
-     * @return Session.
-     */
-    Session session(@Nullable Transaction tx) {
-        Session ses;
-
-        if (tx != null) {
-            Map<String, Session> props = session().properties();
-
-            ses = props.get(ATTR_SES);
-
-            if (ses == null) {
-                ses = sesFactory.openSession();
-
-                ses.beginTransaction();
-
-                // Store session in transaction metadata, so it can be accessed
-                // for other operations on the same transaction.
-                props.put(ATTR_SES, ses);
-
-                if (log.isDebugEnabled())
-                    log.debug("Hibernate session open [ses=" + ses + ", tx=" + tx.xid() + "]");
-            }
-        }
-        else {
-            ses = sesFactory.openSession();
-
-            ses.beginTransaction();
-        }
-
-        return ses;
-    }
-
-    /**
-     * Sets session factory.
-     *
-     * @param sesFactory Session factory.
-     */
-    public void setSessionFactory(SessionFactory sesFactory) {
-        this.sesFactory = sesFactory;
-    }
-
-    /**
-     * Sets hibernate configuration path.
-     * <p>
-     * This may be either URL or file path or classpath resource.
-     *
-     * @param hibernateCfgPath URL or file path or classpath resource
-     *      pointing to hibernate configuration XML file.
-     */
-    public void setHibernateConfigurationPath(String hibernateCfgPath) {
-        this.hibernateCfgPath = hibernateCfgPath;
-    }
-
-    /**
-     * Sets Hibernate properties.
-     *
-     * @param hibernateProps Hibernate properties.
-     */
-    public void setHibernateProperties(Properties hibernateProps) {
-        this.hibernateProps = hibernateProps;
-    }
-
-    /**
-     * Initializes store.
-     *
-     * @throws IgniteException If failed to initialize.
-     */
-    private void init() throws IgniteException {
-        if (initGuard.compareAndSet(false, true)) {
-            if (log.isDebugEnabled())
-                log.debug("Initializing cache store.");
-
-            try {
-                if (sesFactory != null)
-                    // Session factory has been provided - nothing to do.
-                    return;
-
-                if (!F.isEmpty(hibernateCfgPath)) {
-                    try {
-                        URL url = new URL(hibernateCfgPath);
-
-                        sesFactory = new Configuration().configure(url).buildSessionFactory();
-
-                        if (log.isDebugEnabled())
-                            log.debug("Configured session factory using URL: " + url);
-
-                        // Session factory has been successfully initialized.
-                        return;
-                    }
-                    catch (MalformedURLException e) {
-                        if (log.isDebugEnabled())
-                            log.debug("Caught malformed URL exception: " + e.getMessage());
-                    }
-
-                    // Provided path is not a valid URL. File?
-                    File cfgFile = new File(hibernateCfgPath);
-
-                    if (cfgFile.exists()) {
-                        sesFactory = new Configuration().configure(cfgFile).buildSessionFactory();
-
-                        if (log.isDebugEnabled())
-                            log.debug("Configured session factory using file: " + hibernateCfgPath);
-
-                        // Session factory has been successfully initialized.
-                        return;
-                    }
-
-                    // Provided path is not a file. Classpath resource?
-                    sesFactory = new Configuration().configure(hibernateCfgPath).buildSessionFactory();
-
-                    if (log.isDebugEnabled())
-                        log.debug("Configured session factory using classpath resource: " + hibernateCfgPath);
-                }
-                else {
-                    if (hibernateProps == null) {
-                        U.warn(log, "No Hibernate configuration has been provided for store (will use default).");
-
-                        hibernateProps = new Properties();
-
-                        hibernateProps.setProperty("hibernate.connection.url", DFLT_CONN_URL);
-                        hibernateProps.setProperty("hibernate.show_sql", DFLT_SHOW_SQL);
-                        hibernateProps.setProperty("hibernate.hbm2ddl.auto", DFLT_HBM2DDL_AUTO);
-                    }
-
-                    Configuration cfg = new Configuration();
-
-                    cfg.setProperties(hibernateProps);
-
-                    assert resourceAvailable(MAPPING_RESOURCE) : MAPPING_RESOURCE;
-
-                    cfg.addResource(MAPPING_RESOURCE);
-
-                    sesFactory = cfg.buildSessionFactory();
-
-                    if (log.isDebugEnabled())
-                        log.debug("Configured session factory using properties: " + hibernateProps);
-                }
-            }
-            catch (HibernateException e) {
-                throw new IgniteException("Failed to initialize store.", e);
-            }
-            finally {
-                initLatch.countDown();
-            }
-        }
-        else if (initLatch.getCount() > 0) {
-            try {
-                U.await(initLatch);
-            }
-            catch (IgniteInterruptedCheckedException e) {
-                throw new IgniteException(e);
-            }
-        }
-
-        if (sesFactory == null)
-            throw new IgniteException("Cache store was not properly initialized.");
-    }
-
-    /**
-     * Checks availability of a classpath resource.
-     *
-     * @param name Resource name.
-     * @return {@code true} if resource is available and ready for read, {@code false} otherwise.
-     */
-    private boolean resourceAvailable(String name) {
-        InputStream cfgStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
-
-        if (cfgStream == null) {
-            log.error("Classpath resource not found: " + name);
-
-            return false;
-        }
-
-        try {
-            // Read a single byte to force actual content access by JVM.
-            cfgStream.read();
-
-            return true;
-        }
-        catch (IOException e) {
-            log.error("Failed to read classpath resource: " + name, e);
-
-            return false;
-        }
-        finally {
-            U.close(cfgStream, log);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(CacheHibernateBlobStore.class, this);
-    }
-
-    /**
-     * Serialize object to byte array using marshaller.
-     *
-     * @param obj Object to convert to byte array.
-     * @return Byte array.
-     * @throws IgniteCheckedException If failed to convert.
-     */
-    protected byte[] toBytes(Object obj) throws IgniteCheckedException {
-        return U.marshal(marsh, obj);
-    }
-
-    /**
-     * Deserialize object from byte array using marshaller.
-     *
-     * @param bytes Bytes to deserialize.
-     * @param <X> Result object type.
-     * @return Deserialized object.
-     * @throws IgniteCheckedException If failed.
-     */
-    protected <X> X fromBytes(byte[] bytes) throws IgniteCheckedException {
-        if (bytes == null || bytes.length == 0)
-            return null;
-
-        return U.unmarshal(marsh, bytes, getClass().getClassLoader());
-    }
-
-    /**
-     * @return Current transaction.
-     */
-    @Nullable private Transaction transaction() {
-        CacheStoreSession ses = session();
-
-        return ses != null ? ses.transaction() : null;
-    }
-
-    /**
-     * @return Store session.
-     */
-    private CacheStoreSession session() {
-        return ses;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml b/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml
deleted file mode 100644
index 5b0be43..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-
-<!DOCTYPE hibernate-mapping PUBLIC
-        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
-        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.apache.ignite.examples.datagrid.store" default-access="field">
-    <class name="org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreEntry" table="ENTRIES">
-        <id name="key"/>
-
-        <property name="val"/>
-    </class>
-</hibernate-mapping>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.java
deleted file mode 100644
index d40c5ef..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.cache.store.hibernate;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-/**
- * Entry that is used by {@link CacheHibernateBlobStore} implementation.
- * <p>
- * Note that this is a reference implementation for tests only.
- * When running on production systems use concrete key-value types to
- * get better performance.
- */
-@Entity
-@Table(name = "ENTRIES")
-public class CacheHibernateBlobStoreEntry {
-    /** Key (use concrete key type in production). */
-    @Id
-    @Column(length = 65535)
-    private byte[] key;
-
-    /** Value (use concrete value type in production). */
-    @Column(length = 65535)
-    private byte[] val;
-
-    /**
-     * Constructor.
-     */
-    CacheHibernateBlobStoreEntry() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param key Key.
-     * @param val Value.
-     */
-    CacheHibernateBlobStoreEntry(byte[] key, byte[] val) {
-        this.key = key;
-        this.val = val;
-    }
-
-    /**
-     * @return Key.
-     */
-    public byte[] getKey() {
-        return key;
-    }
-
-    /**
-     * @param key Key.
-     */
-    public void setKey(byte[] key) {
-        this.key = key;
-    }
-
-    /**
-     * @return Value.
-     */
-    public byte[] getValue() {
-        return val;
-    }
-
-    /**
-     * @param val Value.
-     */
-    public void setValue(byte[] val) {
-        this.val = val;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreFactory.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreFactory.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreFactory.java
deleted file mode 100644
index ea4df8a..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreFactory.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * 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.cache.store.hibernate;
-
-import java.util.Properties;
-import javax.cache.configuration.Factory;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.IgniteComponentType;
-import org.apache.ignite.internal.util.spring.IgniteSpringHelper;
-import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.resources.SpringApplicationContextResource;
-import org.hibernate.SessionFactory;
-
-/**
- * {@link Factory} implementation for {@link CacheHibernateBlobStore}.
- *
- * Use this factory to pass {@link CacheHibernateBlobStore} to {@link CacheConfiguration}.
- *
- * <h2 class="header">Java Example</h2>
- * In this example existing session factory is provided.
- * <pre name="code" class="java">
- *     ...
- *     CacheHibernateBlobStoreFactory&lt;String, String&gt; factory = new CacheHibernateBlobStoreFactory&lt;String, String&gt;();
- *
- *     factory.setSessionFactory(sesFactory);
- *     ...
- * </pre>
- *
- * <h2 class="header">Spring Example (using Spring ORM)</h2>
- * <pre name="code" class="xml">
- *   ...
- *   &lt;bean id=&quot;cache.hibernate.store.factory&quot;
- *       class=&quot;org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory&quot;&gt;
- *       &lt;property name=&quot;sessionFactory&quot;&gt;
- *           &lt;bean class=&quot;org.springframework.orm.hibernate3.LocalSessionFactoryBean&quot;&gt;
- *               &lt;property name=&quot;hibernateProperties&quot;&gt;
- *                   &lt;value&gt;
- *                       connection.url=jdbc:h2:mem:
- *                       show_sql=true
- *                       hbm2ddl.auto=true
- *                       hibernate.dialect=org.hibernate.dialect.H2Dialect
- *                   &lt;/value&gt;
- *               &lt;/property&gt;
- *               &lt;property name=&quot;mappingResources&quot;&gt;
- *                   &lt;list&gt;
- *                       &lt;value&gt;
- *                           org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml
- *                       &lt;/value&gt;
- *                   &lt;/list&gt;
- *               &lt;/property&gt;
- *           &lt;/bean&gt;
- *       &lt;/property&gt;
- *   &lt;/bean&gt;
- *   ...
- * </pre>
- *
- * <h2 class="header">Spring Example (using Spring ORM and persistent annotations)</h2>
- * <pre name="code" class="xml">
- *     ...
- *     &lt;bean id=&quot;cache.hibernate.store.factory1&quot;
- *         class=&quot;org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory&quot;&gt;
- *         &lt;property name=&quot;sessionFactory&quot;&gt;
- *             &lt;bean class=&quot;org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean&quot;&gt;
- *                 &lt;property name=&quot;hibernateProperties&quot;&gt;
- *                     &lt;value&gt;
- *                         connection.url=jdbc:h2:mem:
- *                         show_sql=true
- *                         hbm2ddl.auto=true
- *                         hibernate.dialect=org.hibernate.dialect.H2Dialect
- *                     &lt;/value&gt;
- *                 &lt;/property&gt;
- *                 &lt;property name=&quot;annotatedClasses&quot;&gt;
- *                     &lt;list&gt;
- *                         &lt;value&gt;
- *                             org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreEntry
- *                         &lt;/value&gt;
- *                     &lt;/list&gt;
- *                 &lt;/property&gt;
- *             &lt;/bean&gt;
- *         &lt;/property&gt;
- *     &lt;/bean&gt;
- *     ...
- * </pre>
- *
- * <h2 class="header">Spring Example</h2>
- * <pre name="code" class="xml">
- *     ...
- *     &lt;bean id=&quot;cache.hibernate.store.factory2&quot;
- *         class=&quot;org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory&quot;&gt;
- *         &lt;property name=&quot;hibernateProperties&quot;&gt;
- *             &lt;props&gt;
- *                 &lt;prop key=&quot;connection.url&quot;&gt;jdbc:h2:mem:&lt;/prop&gt;
- *                 &lt;prop key=&quot;hbm2ddl.auto&quot;&gt;update&lt;/prop&gt;
- *                 &lt;prop key=&quot;show_sql&quot;&gt;true&lt;/prop&gt;
- *             &lt;/props&gt;
- *         &lt;/property&gt;
- *     &lt;/bean&gt;
- *     ...
- * </pre>
- * <p>
- * <img src="http://ignite.apache.org/images/spring-small.png">
- * <br>
- * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
- */
-public class CacheHibernateBlobStoreFactory<K, V> implements Factory<CacheHibernateBlobStore<K, V>> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Session factory. */
-    @GridToStringExclude
-    private transient SessionFactory sesFactory;
-
-    /** Session factory bean name. */
-    private String sesFactoryBean;
-
-    /** Path to hibernate configuration file. */
-    private String hibernateCfgPath;
-
-    /** Hibernate properties. */
-    @GridToStringExclude
-    private Properties hibernateProps;
-
-    /** Application context. */
-    @SpringApplicationContextResource
-    private Object appContext;
-
-    /** {@inheritDoc} */
-    @Override public CacheHibernateBlobStore<K, V> create() {
-        CacheHibernateBlobStore<K, V> store = new CacheHibernateBlobStore<>();
-
-        store.setHibernateConfigurationPath(hibernateCfgPath);
-        store.setHibernateProperties(hibernateProps);
-
-        if (sesFactory != null)
-            store.setSessionFactory(sesFactory);
-        else if (sesFactoryBean != null) {
-            if (appContext == null)
-                throw new IgniteException("Spring application context resource is not injected.");
-
-            IgniteSpringHelper spring;
-
-            try {
-                spring = IgniteComponentType.SPRING.create(false);
-
-                SessionFactory sesFac = spring.loadBeanFromAppContext(appContext, sesFactoryBean);
-
-                store.setSessionFactory(sesFac);
-            }
-            catch (IgniteCheckedException e) {
-                throw new IgniteException("Failed to load bean in application context [beanName=" + sesFactoryBean +
-                        ", igniteConfig=" + appContext + ']');
-            }
-        }
-
-        return store;
-    }
-
-    /**
-     * Sets session factory.
-     *
-     * @param sesFactory Session factory.
-     * @return {@code This} for chaining.
-     * @see CacheHibernateBlobStore#setSessionFactory(SessionFactory)
-     */
-    public CacheHibernateBlobStoreFactory<K, V> setSessionFactory(SessionFactory sesFactory) {
-        this.sesFactory = sesFactory;
-
-        return this;
-    }
-
-    /**
-     * Sets name of the data source bean.
-     *
-     * @param sesFactory Session factory bean name.
-     * @return {@code This} for chaining.
-     * @see CacheHibernateBlobStore#setSessionFactory(SessionFactory)
-     */
-    public CacheHibernateBlobStoreFactory<K, V> setSessionFactoryBean(String sesFactory) {
-        this.sesFactoryBean = sesFactory;
-
-        return this;
-    }
-
-    /**
-     * Sets hibernate configuration path.
-     * <p>
-     * This may be either URL or file path or classpath resource.
-     *
-     * @param hibernateCfgPath URL or file path or classpath resource
-     *      pointing to hibernate configuration XML file.
-     * @return {@code This} for chaining.
-     * @see CacheHibernateBlobStore#setHibernateConfigurationPath(String)
-     */
-    public CacheHibernateBlobStoreFactory<K, V> setHibernateConfigurationPath(String hibernateCfgPath) {
-        this.hibernateCfgPath = hibernateCfgPath;
-
-        return this;
-    }
-
-    /**
-     * Sets Hibernate properties.
-     *
-     * @param hibernateProps Hibernate properties.
-     * @return {@code This} for chaining.
-     * @see CacheHibernateBlobStore#setHibernateProperties(Properties)
-     */
-    public CacheHibernateBlobStoreFactory<K, V> setHibernateProperties(Properties hibernateProps) {
-        this.hibernateProps = hibernateProps;
-
-        return this;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(CacheHibernateBlobStoreFactory.class, this);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListener.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListener.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListener.java
deleted file mode 100644
index 0f5a33c..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListener.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * 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.cache.store.hibernate;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import javax.cache.integration.CacheWriterException;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cache.store.CacheStore;
-import org.apache.ignite.cache.store.CacheStoreSession;
-import org.apache.ignite.cache.store.CacheStoreSessionListener;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lifecycle.LifecycleAware;
-import org.apache.ignite.resources.LoggerResource;
-import org.hibernate.HibernateException;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.cfg.Configuration;
-
-/**
- * Hibernate-based cache store session listener.
- * <p>
- * This listener creates a new Hibernate session for each store
- * session. If there is an ongoing cache transaction, a corresponding
- * Hibernate transaction is created as well.
- * <p>
- * The Hibernate session is saved as a store session
- * {@link CacheStoreSession#attachment() attachment}.
- * The listener guarantees that the session will be
- * available for any store operation. If there is an
- * ongoing cache transaction, all operations within this
- * transaction will share a DB transaction.
- * <p>
- * As an example, here is how the {@link CacheStore#write(javax.cache.Cache.Entry)}
- * method can be implemented if {@link CacheHibernateStoreSessionListener}
- * is configured:
- * <pre name="code" class="java">
- * private static class Store extends CacheStoreAdapter&lt;Integer, Integer&gt; {
- *     &#64;CacheStoreSessionResource
- *     private CacheStoreSession ses;
- *
- *     &#64;Override public void write(Cache.Entry&lt;? extends Integer, ? extends Integer&gt; entry) throws CacheWriterException {
- *         // Get Hibernate session from the current store session.
- *         Session hibSes = ses.attachment();
- *
- *         // Persist the value.
- *         hibSes.persist(entry.getValue());
- *     }
- * }
- * </pre>
- * Hibernate session will be automatically created by the listener
- * at the start of the session and closed when it ends.
- * <p>
- * {@link CacheHibernateStoreSessionListener} requires that either
- * {@link #setSessionFactory(SessionFactory)} session factory}
- * or {@link #setHibernateConfigurationPath(String) Hibernate configuration file}
- * is provided. If non of them is set, exception is thrown. Is both are provided,
- * session factory will be used.
- */
-public class CacheHibernateStoreSessionListener implements CacheStoreSessionListener, LifecycleAware {
-    /** Hibernate session factory. */
-    private SessionFactory sesFactory;
-
-    /** Hibernate configuration file path. */
-    private String hibernateCfgPath;
-
-    /** Logger. */
-    @LoggerResource
-    private IgniteLogger log;
-
-    /** Whether to close session on stop. */
-    private boolean closeSesOnStop;
-
-    /**
-     * Sets Hibernate session factory.
-     * <p>
-     * Either session factory or configuration file is required.
-     * If none is provided, exception will be thrown on startup.
-     *
-     * @param sesFactory Session factory.
-     */
-    public void setSessionFactory(SessionFactory sesFactory) {
-        this.sesFactory = sesFactory;
-    }
-
-    /**
-     * Gets Hibernate session factory.
-     *
-     * @return Session factory.
-     */
-    public SessionFactory getSessionFactory() {
-        return sesFactory;
-    }
-
-    /**
-     * Sets hibernate configuration path.
-     * <p>
-     * Either session factory or configuration file is required.
-     * If none is provided, exception will be thrown on startup.
-     *
-     * @param hibernateCfgPath Hibernate configuration path.
-     */
-    public void setHibernateConfigurationPath(String hibernateCfgPath) {
-        this.hibernateCfgPath = hibernateCfgPath;
-    }
-
-    /**
-     * Gets hibernate configuration path.
-     *
-     * @return Hibernate configuration path.
-     */
-    public String getHibernateConfigurationPath() {
-        return hibernateCfgPath;
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("deprecation")
-    @Override public void start() throws IgniteException {
-        if (sesFactory == null && F.isEmpty(hibernateCfgPath))
-            throw new IgniteException("Either session factory or Hibernate configuration file is required by " +
-                getClass().getSimpleName() + '.');
-
-        if (!F.isEmpty(hibernateCfgPath)) {
-            if (sesFactory == null) {
-                try {
-                    URL url = new URL(hibernateCfgPath);
-
-                    sesFactory = new Configuration().configure(url).buildSessionFactory();
-                }
-                catch (MalformedURLException ignored) {
-                    // No-op.
-                }
-
-                if (sesFactory == null) {
-                    File cfgFile = new File(hibernateCfgPath);
-
-                    if (cfgFile.exists())
-                        sesFactory = new Configuration().configure(cfgFile).buildSessionFactory();
-                }
-
-                if (sesFactory == null)
-                    sesFactory = new Configuration().configure(hibernateCfgPath).buildSessionFactory();
-
-                if (sesFactory == null)
-                    throw new IgniteException("Failed to resolve Hibernate configuration file: " + hibernateCfgPath);
-
-                closeSesOnStop = true;
-            }
-            else
-                U.warn(log, "Hibernate configuration file configured in " + getClass().getSimpleName() +
-                    " will be ignored (session factory is already set).");
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void stop() throws IgniteException {
-        if (closeSesOnStop && sesFactory != null && !sesFactory.isClosed())
-            sesFactory.close();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onSessionStart(CacheStoreSession ses) {
-        if (ses.attachment() == null) {
-            try {
-                Session hibSes = sesFactory.openSession();
-
-                ses.attach(hibSes);
-
-                if (ses.isWithinTransaction())
-                    hibSes.beginTransaction();
-            }
-            catch (HibernateException e) {
-                throw new CacheWriterException("Failed to start store session [tx=" + ses.transaction() + ']', e);
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onSessionEnd(CacheStoreSession ses, boolean commit) {
-        Session hibSes = ses.attach(null);
-
-        if (hibSes != null) {
-            try {
-                Transaction tx = hibSes.getTransaction();
-
-                if (commit) {
-                    if (hibSes.isDirty())
-                        hibSes.flush();
-
-                    if (tx.isActive())
-                        tx.commit();
-                }
-                else if (tx.isActive())
-                    tx.rollback();
-            }
-            catch (HibernateException e) {
-                throw new CacheWriterException("Failed to end store session [tx=" + ses.transaction() + ']', e);
-            }
-            finally {
-                hibSes.close();
-            }
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/package-info.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/package-info.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/package-info.java
deleted file mode 100644
index 891d99a..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/store/hibernate/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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 description. -->
- * Contains reference Hibernate-based cache store implementation.
- */
-package org.apache.ignite.cache.store.hibernate;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/test/config/factory-cache.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/test/config/factory-cache.xml b/modules/hibernate5/src/test/config/factory-cache.xml
deleted file mode 100644
index a251846..0000000
--- a/modules/hibernate5/src/test/config/factory-cache.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="
-        http://www.springframework.org/schema/beans
-        http://www.springframework.org/schema/beans/spring-beans.xsd">
-
-    <bean id="simpleSessionFactory"
-          class="org.apache.ignite.cache.store.hibernate.CacheHibernateStoreFactorySelfTest$DummySessionFactoryExt"/>
-
-    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
-        <property name="cacheConfiguration">
-            <list>
-                <bean class="org.apache.ignite.configuration.CacheConfiguration">
-                    <property name="name" value="test"/>
-                    <property name="atomicityMode" value="ATOMIC"/>
-                    <property name="backups" value="1"/>
-                    <property name="cacheStoreFactory">
-                        <bean class="org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory">
-                            <property name="sessionFactoryBean" value = "simpleSessionFactory"/>
-                        </bean>
-                    </property>
-                </bean>
-            </list>
-        </property>
-
-        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
-        <property name="discoverySpi">
-            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
-                <property name="ipFinder">
-                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
-                        <property name="addresses">
-                            <list>
-                                <value>127.0.0.1:47500..47509</value>
-                            </list>
-                        </property>
-                    </bean>
-                </property>
-            </bean>
-        </property>
-    </bean>
-</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/test/config/factory-cache1.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/test/config/factory-cache1.xml b/modules/hibernate5/src/test/config/factory-cache1.xml
deleted file mode 100644
index 7a53b1f..0000000
--- a/modules/hibernate5/src/test/config/factory-cache1.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="
-        http://www.springframework.org/schema/beans
-        http://www.springframework.org/schema/beans/spring-beans.xsd">
-
-    <bean id="simpleSessionFactory1"
-          class="org.apache.ignite.cache.store.hibernate.CacheHibernateStoreFactorySelfTest$DummySessionFactory"/>
-
-    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
-        <property name="igniteInstanceName" value="ignite1"/>
-
-        <property name="cacheConfiguration">
-            <list>
-                <bean class="org.apache.ignite.configuration.CacheConfiguration">
-                    <property name="name" value="test"/>
-                    <property name="atomicityMode" value="ATOMIC"/>
-                    <property name="backups" value="1"/>
-                    <property name="cacheStoreFactory">
-                        <bean class="org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory">
-                            <property name="sessionFactoryBean" value = "simpleSessionFactory1"/>
-                        </bean>
-                    </property>
-                </bean>
-            </list>
-        </property>
-
-        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
-        <property name="discoverySpi">
-            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
-                <property name="ipFinder">
-                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
-                        <property name="addresses">
-                            <list>
-                                <value>127.0.0.1:47500..47509</value>
-                            </list>
-                        </property>
-                    </bean>
-                </property>
-            </bean>
-        </property>
-    </bean>
-</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/test/config/factory-incorrect-store-cache.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/test/config/factory-incorrect-store-cache.xml b/modules/hibernate5/src/test/config/factory-incorrect-store-cache.xml
deleted file mode 100644
index 459930c..0000000
--- a/modules/hibernate5/src/test/config/factory-incorrect-store-cache.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="
-        http://www.springframework.org/schema/beans
-        http://www.springframework.org/schema/beans/spring-beans.xsd">
-
-    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
-        <property name="cacheConfiguration">
-            <list>
-                <bean class="org.apache.ignite.configuration.CacheConfiguration">
-                    <property name="name" value="test"/>
-                    <property name="atomicityMode" value="ATOMIC"/>
-                    <property name="backups" value="1"/>
-                    <property name="cacheStoreFactory">
-                        <bean class="org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory">
-                            <property name="sessionFactoryBean" value = "simpleSessionFactory1"/>
-                        </bean>
-                    </property>
-                </bean>
-            </list>
-        </property>
-
-        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
-        <property name="discoverySpi">
-            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
-                <property name="ipFinder">
-                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
-                        <property name="addresses">
-                            <list>
-                                <value>127.0.0.1:47500..47509</value>
-                            </list>
-                        </property>
-                    </bean>
-                </property>
-            </bean>
-        </property>
-    </bean>
-</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java b/modules/hibernate5/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java
deleted file mode 100644
index 0cb36e9..0000000
--- a/modules/hibernate5/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java
+++ /dev/null
@@ -1,409 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import javax.cache.Cache;
-import javax.persistence.Cacheable;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.annotations.CacheConcurrencyStrategy;
-import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cfg.Configuration;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.hibernate.HibernateRegionFactory.DFLT_ACCESS_TYPE_PROPERTY;
-import static org.apache.ignite.cache.hibernate.HibernateRegionFactory.DFLT_CACHE_NAME_PROPERTY;
-import static org.apache.ignite.cache.hibernate.HibernateRegionFactory.IGNITE_INSTANCE_NAME_PROPERTY;
-import static org.apache.ignite.cache.hibernate.HibernateRegionFactory.REGION_CACHE_PROPERTY;
-import static org.hibernate.cfg.AvailableSettings.CACHE_REGION_FACTORY;
-import static org.hibernate.cfg.AvailableSettings.GENERATE_STATISTICS;
-import static org.hibernate.cfg.AvailableSettings.HBM2DDL_AUTO;
-import static org.hibernate.cfg.AvailableSettings.RELEASE_CONNECTIONS;
-import static org.hibernate.cfg.AvailableSettings.USE_QUERY_CACHE;
-import static org.hibernate.cfg.AvailableSettings.USE_SECOND_LEVEL_CACHE;
-
-/**
- * Tests Hibernate L2 cache configuration.
- */
-public class HibernateL2CacheConfigurationSelfTest extends GridCommonAbstractTest {
-    /** */
-    public static final String ENTITY1_NAME = Entity1.class.getName();
-
-    /** */
-    public static final String ENTITY2_NAME = Entity2.class.getName();
-
-    /** */
-    public static final String ENTITY3_NAME = Entity3.class.getName();
-
-    /** */
-    public static final String ENTITY4_NAME = Entity4.class.getName();
-
-    /** */
-    public static final String TIMESTAMP_CACHE = "org.hibernate.cache.spi.UpdateTimestampsCache";
-
-    /** */
-    public static final String QUERY_CACHE = "org.hibernate.cache.internal.StandardQueryCache";
-
-    /** */
-    public static final String CONNECTION_URL = "jdbc:h2:mem:example;DB_CLOSE_DELAY=-1";
-
-    /** If {@code true} then sets default cache in configuration. */
-    private boolean dfltCache;
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGrid(0);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        for (IgniteCacheProxy<?, ?> cache : ((IgniteKernal)grid(0)).caches())
-            cache.clear();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
-        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
-
-        discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
-
-        cfg.setDiscoverySpi(discoSpi);
-
-        cfg.setCacheConfiguration(cacheConfiguration(ENTITY3_NAME), cacheConfiguration(ENTITY4_NAME),
-            cacheConfiguration("cache1"), cacheConfiguration("cache2"), cacheConfiguration("cache3"),
-            cacheConfiguration(TIMESTAMP_CACHE), cacheConfiguration(QUERY_CACHE));
-
-        return cfg;
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @return Cache configuration.
-     */
-    private CacheConfiguration cacheConfiguration(String cacheName) {
-        CacheConfiguration cfg = new CacheConfiguration();
-
-        cfg.setName(cacheName);
-
-        cfg.setCacheMode(PARTITIONED);
-
-        cfg.setAtomicityMode(ATOMIC);
-
-        return cfg;
-    }
-    /**
-     * @param igniteInstanceName Ignite instance name.
-     * @return Hibernate configuration.
-     */
-    protected Configuration hibernateConfiguration(String igniteInstanceName) {
-        Configuration cfg = new Configuration();
-
-        cfg.addAnnotatedClass(Entity1.class);
-        cfg.addAnnotatedClass(Entity2.class);
-        cfg.addAnnotatedClass(Entity3.class);
-        cfg.addAnnotatedClass(Entity4.class);
-
-        cfg.setProperty(DFLT_ACCESS_TYPE_PROPERTY, AccessType.NONSTRICT_READ_WRITE.name());
-
-        cfg.setProperty(HBM2DDL_AUTO, "create");
-
-        cfg.setProperty(GENERATE_STATISTICS, "true");
-
-        cfg.setProperty(USE_SECOND_LEVEL_CACHE, "true");
-
-        cfg.setProperty(USE_QUERY_CACHE, "true");
-
-        cfg.setProperty(CACHE_REGION_FACTORY, HibernateRegionFactory.class.getName());
-
-        cfg.setProperty(RELEASE_CONNECTIONS, "on_close");
-
-        cfg.setProperty(IGNITE_INSTANCE_NAME_PROPERTY, igniteInstanceName);
-
-        cfg.setProperty(REGION_CACHE_PROPERTY + ENTITY1_NAME, "cache1");
-        cfg.setProperty(REGION_CACHE_PROPERTY + ENTITY2_NAME, "cache2");
-        cfg.setProperty(REGION_CACHE_PROPERTY + TIMESTAMP_CACHE, TIMESTAMP_CACHE);
-        cfg.setProperty(REGION_CACHE_PROPERTY + QUERY_CACHE, QUERY_CACHE);
-
-        if (dfltCache)
-            cfg.setProperty(DFLT_CACHE_NAME_PROPERTY, "cache3");
-
-        return cfg;
-    }
-
-    /**
-     * Tests property {@link HibernateRegionFactory#REGION_CACHE_PROPERTY}.
-     */
-    public void testPerRegionCacheProperty() {
-        testCacheUsage(1, 1, 0, 1, 1);
-    }
-
-    /**
-     * Tests property {@link HibernateRegionFactory#DFLT_CACHE_NAME_PROPERTY}.
-     */
-    public void testDefaultCache() {
-        dfltCache = true;
-
-        testCacheUsage(1, 1, 2, 0, 0);
-    }
-
-    /**
-     * @param expCache1 Expected size of cache with name 'cache1'.
-     * @param expCache2 Expected size of cache with name 'cache2'.
-     * @param expCache3 Expected size of cache with name 'cache3'.
-     * @param expCacheE3 Expected size of cache with name {@link #ENTITY3_NAME}.
-     * @param expCacheE4 Expected size of cache with name {@link #ENTITY4_NAME}.
-     */
-    @SuppressWarnings("unchecked")
-    private void testCacheUsage(int expCache1, int expCache2, int expCache3, int expCacheE3, int expCacheE4) {
-        SessionFactory sesFactory = startHibernate(getTestIgniteInstanceName(0));
-
-        try {
-            Session ses = sesFactory.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                ses.save(new Entity1());
-                ses.save(new Entity2());
-                ses.save(new Entity3());
-                ses.save(new Entity4());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            ses = sesFactory.openSession();
-
-            try {
-                List<Entity1> list1 = ses.createCriteria(ENTITY1_NAME).list();
-
-                assertEquals(1, list1.size());
-
-                for (Entity1 e : list1) {
-                    ses.load(ENTITY1_NAME, e.getId());
-                    assertNotNull(e.getId());
-                }
-
-                List<Entity2> list2 = ses.createCriteria(ENTITY2_NAME).list();
-
-                assertEquals(1, list2.size());
-
-                for (Entity2 e : list2)
-                    assertNotNull(e.getId());
-
-                List<Entity3> list3 = ses.createCriteria(ENTITY3_NAME).list();
-
-                assertEquals(1, list3.size());
-
-                for (Entity3 e : list3)
-                    assertNotNull(e.getId());
-
-                List<Entity4> list4 = ses.createCriteria(ENTITY4_NAME).list();
-
-                assertEquals(1, list4.size());
-
-                for (Entity4 e : list4)
-                    assertNotNull(e.getId());
-            }
-            finally {
-                ses.close();
-            }
-
-            IgniteCache<Object, Object> cache1 = grid(0).cache("cache1");
-            IgniteCache<Object, Object> cache2 = grid(0).cache("cache2");
-            IgniteCache<Object, Object> cache3 = grid(0).cache("cache3");
-            IgniteCache<Object, Object> cacheE3 = grid(0).cache(ENTITY3_NAME);
-            IgniteCache<Object, Object> cacheE4 = grid(0).cache(ENTITY4_NAME);
-
-            assertEquals("Unexpected entries: " + toSet(cache1.iterator()), expCache1, cache1.size());
-            assertEquals("Unexpected entries: " + toSet(cache2.iterator()), expCache2, cache2.size());
-            assertEquals("Unexpected entries: " + toSet(cache3.iterator()), expCache3, cache3.size());
-            assertEquals("Unexpected entries: " + toSet(cacheE3.iterator()), expCacheE3, cacheE3.size());
-            assertEquals("Unexpected entries: " + toSet(cacheE4.iterator()), expCacheE4, cacheE4.size());
-        }
-        finally {
-            sesFactory.close();
-        }
-    }
-
-    /**
-     *
-     */
-    private <K, V> Set<Cache.Entry<K, V>> toSet(Iterator<Cache.Entry<K, V>> iter){
-        Set<Cache.Entry<K, V>> set = new HashSet<>();
-
-        while (iter.hasNext())
-            set.add(iter.next());
-
-        return set;
-    }
-
-    /**
-     * @param igniteInstanceName Name of the grid providing caches.
-     * @return Session factory.
-     */
-    private SessionFactory startHibernate(String igniteInstanceName) {
-        Configuration cfg = hibernateConfiguration(igniteInstanceName);
-
-        StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder();
-
-        builder.applySetting("hibernate.connection.url", CONNECTION_URL);
-        builder.applySetting("hibernate.show_sql", false);
-        builder.applySettings(cfg.getProperties());
-
-        return cfg.buildSessionFactory(builder.build());
-    }
-
-    /**
-     * Test Hibernate entity1.
-     */
-    @javax.persistence.Entity
-    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
-    @Cacheable
-    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
-    public static class Entity1 {
-        /** */
-        private int id;
-
-        /**
-         * @return ID.
-         */
-        @Id
-        @GeneratedValue
-        public int getId() {
-            return id;
-        }
-
-        /**
-         * @param id ID.
-         */
-        public void setId(int id) {
-            this.id = id;
-        }
-    }
-
-    /**
-     * Test Hibernate entity2.
-     */
-    @javax.persistence.Entity
-    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
-    @Cacheable
-    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
-    public static class Entity2 {
-        /** */
-        private int id;
-
-        /**
-         * @return ID.
-         */
-        @Id
-        @GeneratedValue
-        public int getId() {
-            return id;
-        }
-
-        /**
-         * @param id ID.
-         */
-        public void setId(int id) {
-            this.id = id;
-        }
-    }
-
-    /**
-     * Test Hibernate entity3.
-     */
-    @javax.persistence.Entity
-    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
-    @Cacheable
-    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
-    public static class Entity3 {
-        /** */
-        private int id;
-
-        /**
-         * @return ID.
-         */
-        @Id
-        @GeneratedValue
-        public int getId() {
-            return id;
-        }
-
-        /**
-         * @param id ID.
-         */
-        public void setId(int id) {
-            this.id = id;
-        }
-    }
-
-    /**
-     * Test Hibernate entity4.
-     */
-    @javax.persistence.Entity
-    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
-    @Cacheable
-    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
-    public static class Entity4 {
-        /** */
-        private int id;
-
-        /**
-         * @return ID.
-         */
-        @Id
-        @GeneratedValue
-        public int getId() {
-            return id;
-        }
-
-        /**
-         * @param id ID.
-         */
-        public void setId(int id) {
-            this.id = id;
-        }
-    }
-}
\ No newline at end of file


[17/51] [abbrv] ignite git commit: IGNITE-4539 - Added RocketMQ integration

Posted by sb...@apache.org.
IGNITE-4539 - Added RocketMQ integration


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

Branch: refs/heads/ignite-5075-cacheStart
Commit: 335f24317da9f0083834bb9e34622b85d282f42b
Parents: ee1b19d
Author: Roman Shtykh <rs...@yahoo.com>
Authored: Wed Apr 26 14:24:20 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Apr 26 14:25:12 2017 +0300

----------------------------------------------------------------------
 modules/rocketmq/README.txt                     |  25 +++
 modules/rocketmq/pom.xml                        |  81 +++++++
 .../stream/rocketmq/RocketMQStreamer.java       | 151 +++++++++++++
 .../ignite/stream/rocketmq/package-info.java    |  21 ++
 .../stream/rocketmq/RocketMQStreamerTest.java   | 214 +++++++++++++++++++
 .../rocketmq/RocketMQStreamerTestSuite.java     |  37 ++++
 .../stream/rocketmq/TestRocketMQServer.java     | 148 +++++++++++++
 .../ignite/stream/rocketmq/package-info.java    |  21 ++
 parent/pom.xml                                  |   5 +
 pom.xml                                         |   1 +
 10 files changed, 704 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/335f2431/modules/rocketmq/README.txt
----------------------------------------------------------------------
diff --git a/modules/rocketmq/README.txt b/modules/rocketmq/README.txt
new file mode 100644
index 0000000..55a117b
--- /dev/null
+++ b/modules/rocketmq/README.txt
@@ -0,0 +1,25 @@
+Apache Ignite RocketMQ Streamer Module
+--------------------------------------
+
+Apache Ignite RocketMQ Streamer module provides streaming from RocketMQ to Ignite cache.
+
+To use Ignite RocketMQ Streamer module, first import it to your Maven project.
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                        http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    ...
+    <dependencies>
+        ...
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-rocketmq</artifactId>
+            <version>${ignite.version}</version>
+        </dependency>
+        ...
+    </dependencies>
+    ...
+</project>
+
+Then, initialize and start it as, for instance, done in RocketMQStreamerTest.java.

http://git-wip-us.apache.org/repos/asf/ignite/blob/335f2431/modules/rocketmq/pom.xml
----------------------------------------------------------------------
diff --git a/modules/rocketmq/pom.xml b/modules/rocketmq/pom.xml
new file mode 100644
index 0000000..3b317fa
--- /dev/null
+++ b/modules/rocketmq/pom.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<!--
+    POM file.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.ignite</groupId>
+        <artifactId>ignite-parent</artifactId>
+        <version>1</version>
+        <relativePath>../../parent</relativePath>
+    </parent>
+
+    <artifactId>ignite-rocketmq</artifactId>
+    <version>2.0.0-SNAPSHOT</version>
+    <url>http://ignite.apache.org</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.rocketmq</groupId>
+            <artifactId>rocketmq-namesrv</artifactId>
+            <version>${rocketmq.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.rocketmq</groupId>
+            <artifactId>rocketmq-broker</artifactId>
+            <version>${rocketmq.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-spring</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-log4j</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/335f2431/modules/rocketmq/src/main/java/org/apache/ignite/stream/rocketmq/RocketMQStreamer.java
----------------------------------------------------------------------
diff --git a/modules/rocketmq/src/main/java/org/apache/ignite/stream/rocketmq/RocketMQStreamer.java b/modules/rocketmq/src/main/java/org/apache/ignite/stream/rocketmq/RocketMQStreamer.java
new file mode 100644
index 0000000..67f1ce5
--- /dev/null
+++ b/modules/rocketmq/src/main/java/org/apache/ignite/stream/rocketmq/RocketMQStreamer.java
@@ -0,0 +1,151 @@
+/*
+ * 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.stream.rocketmq;
+
+import java.util.List;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.stream.StreamAdapter;
+import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
+import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
+import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
+import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
+import org.apache.rocketmq.client.exception.MQClientException;
+import org.apache.rocketmq.common.consumer.ConsumeFromWhere;
+import org.apache.rocketmq.common.message.MessageExt;
+
+/**
+ * Streamer that subscribes to a RocketMQ topic amd feeds messages into {@link IgniteDataStreamer} instance.
+ */
+public class RocketMQStreamer<K, V> extends StreamAdapter<List<MessageExt>, K, V> implements MessageListenerConcurrently {
+    /** Logger. */
+    private IgniteLogger log;
+
+    /** RocketMQ consumer. */
+    private DefaultMQPushConsumer consumer;
+
+    /** State. */
+    private volatile boolean stopped = true;
+
+    /** Topic to subscribe to. */
+    private String topic;
+
+    /** Consumer group. */
+    private String consumerGrp;
+
+    /** Name server address. */
+    private String nameSrvAddr;
+
+    /**
+     * Starts streamer.
+     *
+     * @throws IgniteException If failed.
+     */
+    public void start() {
+        if (!stopped)
+            throw new IgniteException("Attempted to start an already started RocketMQ streamer");
+
+        // validate parameters.
+        A.notNull(getStreamer(), "streamer");
+        A.notNull(getIgnite(), "ignite");
+        A.notNull(topic, "topic");
+        A.notNull(consumerGrp, "consumer group");
+        A.notNullOrEmpty(nameSrvAddr, "nameserver address");
+        A.ensure(null != getMultipleTupleExtractor(), "Multiple tuple extractor must be configured");
+
+        log = getIgnite().log();
+
+        consumer = new DefaultMQPushConsumer(consumerGrp);
+
+        consumer.setNamesrvAddr(nameSrvAddr);
+        consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET);
+
+        try {
+            consumer.subscribe(topic, "*");
+        }
+        catch (MQClientException e) {
+            throw new IgniteException("Failed to subscribe to " + topic, e);
+        }
+
+        consumer.registerMessageListener(this);
+
+        try {
+            consumer.start();
+        }
+        catch (MQClientException e) {
+            throw new IgniteException("Failed to start the streamer", e);
+        }
+
+        stopped = false;
+    }
+
+    /**
+     * Stops streamer.
+     */
+    public void stop() {
+        if (consumer != null)
+            consumer.shutdown();
+
+        stopped = true;
+    }
+
+    /**
+     * Implements {@link MessageListenerConcurrently#consumeMessage(List, ConsumeConcurrentlyContext)} to receive
+     * messages.
+     *
+     * {@inheritDoc}
+     */
+    @Override public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs,
+        ConsumeConcurrentlyContext context) {
+        if (log.isDebugEnabled())
+            log.debug("Received " + msgs.size() + " messages");
+
+        addMessage(msgs);
+
+        return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
+    }
+
+    /**
+     * Sets the topic to subscribe to.
+     *
+     * @param topic The topic to subscribe to.
+     */
+    public void setTopic(String topic) {
+        this.topic = topic;
+    }
+
+    /**
+     * Sets the name of the consumer group.
+     *
+     * @param consumerGrp Consumer group name.
+     */
+    public void setConsumerGrp(String consumerGrp) {
+        this.consumerGrp = consumerGrp;
+    }
+
+    /**
+     * Sets the name server address.
+     *
+     * @param nameSrvAddr Name server address
+     */
+    public void setNameSrvAddr(String nameSrvAddr) {
+        this.nameSrvAddr = nameSrvAddr;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/335f2431/modules/rocketmq/src/main/java/org/apache/ignite/stream/rocketmq/package-info.java
----------------------------------------------------------------------
diff --git a/modules/rocketmq/src/main/java/org/apache/ignite/stream/rocketmq/package-info.java b/modules/rocketmq/src/main/java/org/apache/ignite/stream/rocketmq/package-info.java
new file mode 100644
index 0000000..f743696
--- /dev/null
+++ b/modules/rocketmq/src/main/java/org/apache/ignite/stream/rocketmq/package-info.java
@@ -0,0 +1,21 @@
+/*
+ *  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.
+ */
+
+/**
+ * Contains implementation of RocketMQStreamer tests.
+ */
+package org.apache.ignite.stream.rocketmq;

http://git-wip-us.apache.org/repos/asf/ignite/blob/335f2431/modules/rocketmq/src/test/java/org/apache/ignite/stream/rocketmq/RocketMQStreamerTest.java
----------------------------------------------------------------------
diff --git a/modules/rocketmq/src/test/java/org/apache/ignite/stream/rocketmq/RocketMQStreamerTest.java b/modules/rocketmq/src/test/java/org/apache/ignite/stream/rocketmq/RocketMQStreamerTest.java
new file mode 100644
index 0000000..59451e9
--- /dev/null
+++ b/modules/rocketmq/src/test/java/org/apache/ignite/stream/rocketmq/RocketMQStreamerTest.java
@@ -0,0 +1,214 @@
+/*
+ *  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.stream.rocketmq;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.cache.CachePeekMode;
+import org.apache.ignite.events.CacheEvent;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiPredicate;
+import org.apache.ignite.stream.StreamMultipleTupleExtractor;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.rocketmq.client.producer.DefaultMQProducer;
+import org.apache.rocketmq.common.TopicConfig;
+import org.apache.rocketmq.common.message.Message;
+import org.apache.rocketmq.common.message.MessageExt;
+import org.apache.rocketmq.tools.admin.DefaultMQAdminExt;
+
+import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT;
+import static org.apache.ignite.stream.rocketmq.TestRocketMQServer.NAME_SERVER_PORT;
+import static org.apache.ignite.stream.rocketmq.TestRocketMQServer.TEST_IP;
+
+/**
+ * Test for {@link RocketMQStreamer}.
+ */
+public class RocketMQStreamerTest extends GridCommonAbstractTest {
+    /** Test topic. */
+    private static final String TOPIC_NAME = "testTopic";
+
+    /** Test consumer group. */
+    private static final String CONSUMER_GRP = "testConsumerGrp";
+
+    /** Test server. */
+    private static TestRocketMQServer testRocketMQServer;
+
+    /** Number of events to handle. */
+    private static final int EVT_NUM = 1000;
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override protected void beforeTest() throws Exception {
+        grid().<Integer, String>getOrCreateCache(defaultCacheConfiguration());
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        grid().cache(null).clear();
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override protected void beforeTestsStarted() throws Exception {
+        testRocketMQServer = new TestRocketMQServer(log);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        if (testRocketMQServer != null)
+            testRocketMQServer.shutdown();
+    }
+
+    /** Constructor. */
+    public RocketMQStreamerTest() {
+        super(true);
+    }
+
+    /**
+     * Tests data is properly injected into the grid.
+     *
+     * @throws Exception If fails.
+     */
+    public void testStreamer() throws Exception {
+        RocketMQStreamer<String, byte[]> streamer = null;
+
+        Ignite ignite = grid();
+
+        try (IgniteDataStreamer<String, byte[]> dataStreamer = ignite.dataStreamer(null)) {
+            dataStreamer.allowOverwrite(true);
+            dataStreamer.autoFlushFrequency(10);
+
+            streamer = new RocketMQStreamer<>();
+
+            //configure.
+            streamer.setIgnite(ignite);
+            streamer.setStreamer(dataStreamer);
+            streamer.setNameSrvAddr(TEST_IP + ":" + NAME_SERVER_PORT);
+            streamer.setConsumerGrp(CONSUMER_GRP);
+            streamer.setTopic(TOPIC_NAME);
+            streamer.setMultipleTupleExtractor(new TestTupleExtractor());
+
+            streamer.start();
+
+            IgniteCache<String, String> cache = ignite.cache(null);
+
+            assertEquals(0, cache.size(CachePeekMode.PRIMARY));
+
+            final CountDownLatch latch = new CountDownLatch(EVT_NUM);
+
+            IgniteBiPredicate<UUID, CacheEvent> putLsnr = new IgniteBiPredicate<UUID, CacheEvent>() {
+                @Override public boolean apply(UUID uuid, CacheEvent evt) {
+                    assert evt != null;
+
+                    latch.countDown();
+
+                    return true;
+                }
+            };
+
+            ignite.events(ignite.cluster().forCacheNodes(null)).remoteListen(putLsnr, null, EVT_CACHE_OBJECT_PUT);
+
+            produceData();
+
+            assertTrue(latch.await(30, TimeUnit.SECONDS));
+
+            assertEquals(EVT_NUM, cache.size(CachePeekMode.PRIMARY));
+        }
+        finally {
+            if (streamer != null)
+                streamer.stop();
+        }
+    }
+
+    /**
+     * Test tuple extractor.
+     */
+    public static class TestTupleExtractor implements StreamMultipleTupleExtractor<List<MessageExt>, String, byte[]> {
+
+        /** {@inheritDoc} */
+        @Override public Map<String, byte[]> extract(List<MessageExt> msgs) {
+            final Map<String, byte[]> map = new HashMap<>();
+
+            for (MessageExt msg : msgs)
+                map.put(msg.getMsgId(), msg.getBody());
+
+            return map;
+        }
+    }
+
+    /**
+     * Adds data to RocketMQ.
+     *
+     * @throws Exception If fails.
+     */
+    private void produceData() throws Exception {
+        initTopic(TOPIC_NAME, TEST_IP + ":" + NAME_SERVER_PORT);
+
+        DefaultMQProducer producer = new DefaultMQProducer("testProducerGrp");
+
+        producer.setNamesrvAddr(TEST_IP + ":" + NAME_SERVER_PORT);
+
+        try {
+            producer.start();
+
+            for (int i = 0; i < EVT_NUM; i++)
+                producer.send(new Message(TOPIC_NAME, "", String.valueOf(i).getBytes("UTF-8")));
+        }
+        catch (Exception e) {
+            throw new Exception(e);
+        }
+        finally {
+            producer.shutdown();
+        }
+    }
+
+    /**
+     * Initializes RocketMQ topic.
+     *
+     * @param topic Topic.
+     * @param nsAddr Nameserver address.
+     * @throws IgniteInterruptedCheckedException If fails.
+     */
+    private void initTopic(String topic, String nsAddr) throws Exception {
+        DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt();
+        defaultMQAdminExt.setNamesrvAddr(nsAddr);
+        try {
+            defaultMQAdminExt.start();
+
+            TopicConfig topicConfig = new TopicConfig();
+            topicConfig.setTopicName(topic);
+            topicConfig.setReadQueueNums(4);
+            topicConfig.setWriteQueueNums(4);
+
+            defaultMQAdminExt.createAndUpdateTopicConfig(testRocketMQServer.getBrokerAddr(), topicConfig);
+
+            U.sleep(100);
+        }
+        finally {
+            defaultMQAdminExt.shutdown();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/335f2431/modules/rocketmq/src/test/java/org/apache/ignite/stream/rocketmq/RocketMQStreamerTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/rocketmq/src/test/java/org/apache/ignite/stream/rocketmq/RocketMQStreamerTestSuite.java b/modules/rocketmq/src/test/java/org/apache/ignite/stream/rocketmq/RocketMQStreamerTestSuite.java
new file mode 100644
index 0000000..e761f1b
--- /dev/null
+++ b/modules/rocketmq/src/test/java/org/apache/ignite/stream/rocketmq/RocketMQStreamerTestSuite.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.stream.rocketmq;
+
+import junit.framework.TestSuite;
+
+/**
+ * Apache RocketMQ streamers tests.
+ */
+public class RocketMQStreamerTestSuite extends TestSuite {
+    /**
+     * @return Test suite.
+     * @throws Exception Thrown in case of the failure.
+     */
+    public static TestSuite suite() throws Exception {
+        TestSuite suite = new TestSuite("Apache Kafka streamer Test Suite");
+
+        suite.addTest(new TestSuite(RocketMQStreamerTest.class));
+
+        return suite;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/335f2431/modules/rocketmq/src/test/java/org/apache/ignite/stream/rocketmq/TestRocketMQServer.java
----------------------------------------------------------------------
diff --git a/modules/rocketmq/src/test/java/org/apache/ignite/stream/rocketmq/TestRocketMQServer.java b/modules/rocketmq/src/test/java/org/apache/ignite/stream/rocketmq/TestRocketMQServer.java
new file mode 100644
index 0000000..beece8e
--- /dev/null
+++ b/modules/rocketmq/src/test/java/org/apache/ignite/stream/rocketmq/TestRocketMQServer.java
@@ -0,0 +1,148 @@
+/*
+ *  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.stream.rocketmq;
+
+import java.util.UUID;
+import org.apache.ignite.IgniteLogger;
+import org.apache.rocketmq.broker.BrokerController;
+import org.apache.rocketmq.common.BrokerConfig;
+import org.apache.rocketmq.common.namesrv.NamesrvConfig;
+import org.apache.rocketmq.namesrv.NamesrvController;
+import org.apache.rocketmq.remoting.netty.NettyClientConfig;
+import org.apache.rocketmq.remoting.netty.NettyServerConfig;
+import org.apache.rocketmq.store.config.MessageStoreConfig;
+
+import static java.io.File.separator;
+
+/**
+ * Test RocketMQ server handling a broker and a nameserver.
+ */
+class TestRocketMQServer {
+    /** Nameserver port. */
+    protected static final int NAME_SERVER_PORT = 9000;
+
+    /** Broker port. */
+    private static final int BROKER_PORT = 8000;
+
+    /** Broker HA port. */
+    private static final int HA_PORT = 8001;
+
+    /** Test ip address. */
+    protected static final String TEST_IP = "127.0.0.1";
+
+    /** Test broker name. */
+    private static final String TEST_BROKER = "testBroker";
+
+    /** Test cluster name. */
+    private static final String TEST_CLUSTER = "testCluster";
+
+    /** Nameserver. */
+    private static NamesrvController nameSrv;
+
+    /** Broker. */
+    private static BrokerController broker;
+
+    /** Logger. */
+    private final IgniteLogger log;
+
+    /**
+     * Test server constructor.
+     *
+     * @param log Logger.
+     */
+    TestRocketMQServer(IgniteLogger log) {
+        this.log = log;
+
+        try {
+            startNameServer();
+            startBroker();
+        }
+        catch (Exception e) {
+            throw new RuntimeException("Failed to start RocketMQ: " + e);
+        }
+    }
+
+    /**
+     * Starts a test nameserver.
+     *
+     * @throws Exception If fails.
+     */
+    private void startNameServer() throws Exception {
+        NamesrvConfig namesrvConfig = new NamesrvConfig();
+        NettyServerConfig nameServerNettyServerConfig = new NettyServerConfig();
+
+        namesrvConfig.setKvConfigPath(System.getProperty("java.io.tmpdir") + separator + "namesrv" + separator + "kvConfig.json");
+        nameServerNettyServerConfig.setListenPort(NAME_SERVER_PORT);
+
+        nameSrv = new NamesrvController(namesrvConfig, nameServerNettyServerConfig);
+
+        nameSrv.initialize();
+        nameSrv.start();
+
+        log.info("Started nameserver at " + NAME_SERVER_PORT);
+    }
+
+    /**
+     * Starts a test broker.
+     *
+     * @throws Exception If fails.
+     */
+    private void startBroker() throws Exception {
+        BrokerConfig brokerCfg = new BrokerConfig();
+        NettyServerConfig nettySrvCfg = new NettyServerConfig();
+        MessageStoreConfig storeCfg = new MessageStoreConfig();
+
+        brokerCfg.setBrokerName(TEST_BROKER);
+        brokerCfg.setBrokerClusterName(TEST_CLUSTER);
+        brokerCfg.setBrokerIP1(TEST_IP);
+        brokerCfg.setNamesrvAddr(TEST_IP + ":" + NAME_SERVER_PORT);
+
+        storeCfg.setStorePathRootDir(System.getProperty("java.io.tmpdir") + separator + "store-" + UUID.randomUUID());
+        storeCfg.setStorePathCommitLog(System.getProperty("java.io.tmpdir") + separator + "commitlog");
+        storeCfg.setHaListenPort(HA_PORT);
+
+        nettySrvCfg.setListenPort(BROKER_PORT);
+
+        broker = new BrokerController(brokerCfg, nettySrvCfg, new NettyClientConfig(), storeCfg);
+
+        broker.initialize();
+        broker.start();
+
+        log.info("Started broker [" + TEST_BROKER + "] at " + BROKER_PORT);
+    }
+
+    /**
+     * Obtains the broker address.
+     *
+     * @return Broker address.
+     */
+    String getBrokerAddr() {
+        return broker.getBrokerAddr();
+    }
+
+    /**
+     * Shuts test server down.
+     */
+    void shutdown() {
+        if (broker != null)
+            broker.shutdown();
+
+        if (nameSrv != null)
+            nameSrv.shutdown();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/335f2431/modules/rocketmq/src/test/java/org/apache/ignite/stream/rocketmq/package-info.java
----------------------------------------------------------------------
diff --git a/modules/rocketmq/src/test/java/org/apache/ignite/stream/rocketmq/package-info.java b/modules/rocketmq/src/test/java/org/apache/ignite/stream/rocketmq/package-info.java
new file mode 100644
index 0000000..eebf084
--- /dev/null
+++ b/modules/rocketmq/src/test/java/org/apache/ignite/stream/rocketmq/package-info.java
@@ -0,0 +1,21 @@
+/*
+ *  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.
+ */
+
+/**
+ * Contains implementation of RocketMQStreamer.
+ */
+package org.apache.ignite.stream.rocketmq;

http://git-wip-us.apache.org/repos/asf/ignite/blob/335f2431/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 3d0f413..a59d8c9 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -94,6 +94,7 @@
         <osgi.core.version>5.0.0</osgi.core.version>
         <osgi.enterprise.version>5.0.0</osgi.enterprise.version>
         <paho.version>1.0.2</paho.version>
+        <rocketmq.version>4.0.0-incubating</rocketmq.version>
         <scala210.jline.version>2.10.4</scala210.jline.version>
         <scala210.library.version>2.10.4</scala210.library.version>
         <scala211.library.version>2.11.7</scala211.library.version>
@@ -449,6 +450,10 @@
                                 <title>SpringData integration</title>
                                 <packages>org.apache.ignite.springdata.repository*</packages>
                             </group>
+                            <group>
+                                <title>RocketMQ integration</title>
+                                <packages>org.apache.ignite.rocketmq*</packages>
+                            </group>
                         </groups>
                         <header>
                             <![CDATA[

http://git-wip-us.apache.org/repos/asf/ignite/blob/335f2431/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 8a05342..9c6a0d7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -92,6 +92,7 @@
         <module>modules/kubernetes</module>
         <module>modules/zeromq</module>
         <module>modules/hibernate-core</module>
+        <module>modules/rocketmq</module>
     </modules>
 
     <profiles>


[13/51] [abbrv] ignite git commit: ignite-1794 Refactored hibernate modules, switched to hibernate 5.1

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListenerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListenerSelfTest.java b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListenerSelfTest.java
new file mode 100644
index 0000000..880d12a
--- /dev/null
+++ b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListenerSelfTest.java
@@ -0,0 +1,238 @@
+/*
+ * 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.cache.store.hibernate;
+
+import java.io.Serializable;
+import java.util.Map;
+import javax.cache.Cache;
+import javax.cache.configuration.Factory;
+import javax.cache.integration.CacheLoaderException;
+import javax.cache.integration.CacheWriterException;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.cache.store.CacheStoreAdapter;
+import org.apache.ignite.cache.store.CacheStoreSession;
+import org.apache.ignite.cache.store.CacheStoreSessionListener;
+import org.apache.ignite.cache.store.CacheStoreSessionListenerAbstractSelfTest;
+import org.apache.ignite.cache.store.jdbc.CacheJdbcStoreSessionListener;
+import org.apache.ignite.lang.IgniteBiInClosure;
+import org.apache.ignite.resources.CacheStoreSessionResource;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
+
+/**
+ * Tests for {@link CacheJdbcStoreSessionListener}.
+ */
+public class CacheHibernateStoreSessionListenerSelfTest extends CacheStoreSessionListenerAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected Factory<? extends CacheStore<Integer, Integer>> storeFactory() {
+        return new Factory<CacheStore<Integer, Integer>>() {
+            @Override public CacheStore<Integer, Integer> create() {
+                return new Store();
+            }
+        };
+    }
+
+    /** {@inheritDoc} */
+    @Override protected Factory<CacheStoreSessionListener> sessionListenerFactory() {
+        return new Factory<CacheStoreSessionListener>() {
+            @Override public CacheStoreSessionListener create() {
+                CacheHibernateStoreSessionListener lsnr = new CacheHibernateStoreSessionListener();
+
+                SessionFactory sesFactory = new Configuration().
+                    setProperty("hibernate.connection.url", URL).
+                    addAnnotatedClass(Table1.class).
+                    addAnnotatedClass(Table2.class).
+                    buildSessionFactory();
+
+                lsnr.setSessionFactory(sesFactory);
+
+                return lsnr;
+            }
+        };
+    }
+
+    /**
+     */
+    private static class Store extends CacheStoreAdapter<Integer, Integer> {
+        /** */
+        private static String SES_CONN_KEY = "ses_conn";
+
+        /** */
+        @CacheStoreSessionResource
+        private CacheStoreSession ses;
+
+        /** {@inheritDoc} */
+        @Override public void loadCache(IgniteBiInClosure<Integer, Integer> clo, Object... args) {
+            loadCacheCnt.incrementAndGet();
+
+            checkSession();
+        }
+
+        /** {@inheritDoc} */
+        @Override public Integer load(Integer key) throws CacheLoaderException {
+            loadCnt.incrementAndGet();
+
+            checkSession();
+
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void write(Cache.Entry<? extends Integer, ? extends Integer> entry)
+            throws CacheWriterException {
+            writeCnt.incrementAndGet();
+
+            checkSession();
+
+            if (write.get()) {
+                Session hibSes = ses.attachment();
+
+                switch (ses.cacheName()) {
+                    case "cache1":
+                        hibSes.save(new Table1(entry.getKey(), entry.getValue()));
+
+                        break;
+
+                    case "cache2":
+                        if (fail.get())
+                            throw new CacheWriterException("Expected failure.");
+
+                        hibSes.save(new Table2(entry.getKey(), entry.getValue()));
+
+                        break;
+
+                    default:
+                        throw new CacheWriterException("Wring cache: " + ses.cacheName());
+                }
+            }
+        }
+
+        /** {@inheritDoc} */
+        @Override public void delete(Object key) throws CacheWriterException {
+            deleteCnt.incrementAndGet();
+
+            checkSession();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void sessionEnd(boolean commit) {
+            assertNull(ses.attachment());
+        }
+
+        /**
+         */
+        private void checkSession() {
+            Session hibSes = ses.attachment();
+
+            assertNotNull(hibSes);
+
+            assertTrue(hibSes.isOpen());
+
+            Transaction tx = hibSes.getTransaction();
+
+            assertNotNull(tx);
+
+            if (ses.isWithinTransaction())
+                assertTrue(tx.isActive());
+            else
+                assertFalse(tx.isActive());
+
+            verifySameInstance(hibSes);
+        }
+
+        /**
+         * @param hibSes Session.
+         */
+        private void verifySameInstance(Session hibSes) {
+            Map<String, Session> props = ses.properties();
+
+            Session sesConn = props.get(SES_CONN_KEY);
+
+            if (sesConn == null)
+                props.put(SES_CONN_KEY, hibSes);
+            else {
+                assertSame(hibSes, sesConn);
+
+                reuseCnt.incrementAndGet();
+            }
+        }
+    }
+
+    /**
+     */
+    @Entity
+    @Table(name = "Table1")
+    private static class Table1 implements Serializable {
+        /** */
+        @Id @GeneratedValue
+        @Column(name = "id")
+        private Integer id;
+
+        /** */
+        @Column(name = "key")
+        private int key;
+
+        /** */
+        @Column(name = "value")
+        private int value;
+
+        /**
+         * @param key Key.
+         * @param value Value.
+         */
+        private Table1(int key, int value) {
+            this.key = key;
+            this.value = value;
+        }
+    }
+
+    /**
+     */
+    @Entity
+    @Table(name = "Table2")
+    private static class Table2 implements Serializable {
+        /** */
+        @Id @GeneratedValue
+        @Column(name = "id")
+        private Integer id;
+
+        /** */
+        @Column(name = "key")
+        private int key;
+
+        /** */
+        @Column(name = "value")
+        private int value;
+
+        /**
+         * @param key Key.
+         * @param value Value.
+         */
+        private Table2(int key, int value) {
+            this.key = key;
+            this.value = value;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml
new file mode 100644
index 0000000..3822b31
--- /dev/null
+++ b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+
+<!DOCTYPE hibernate-configuration PUBLIC
+        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+    <session-factory>
+        <!-- Show SQL. -->
+        <property name="show_sql">true</property>
+
+        <!-- Database connection settings (private in-memory database). -->
+        <property name="connection.url">jdbc:h2:mem:example;DB_CLOSE_DELAY=-1</property>
+
+        <!-- Only validate the database schema on startup in production mode. -->
+        <property name="hbm2ddl.auto">update</property>
+
+        <!-- H2 dialect. -->
+        <property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property>
+
+        <!-- Mappings. -->
+        <mapping resource="org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml"/>
+    </session-factory>
+</hibernate-configuration>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/package-info.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/package-info.java b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/package-info.java
new file mode 100644
index 0000000..8af9886
--- /dev/null
+++ b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains internal tests or test related classes and interfaces.
+ */
+package org.apache.ignite.cache.store.hibernate;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernateTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernateTestSuite.java b/modules/hibernate-4.2/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernateTestSuite.java
new file mode 100644
index 0000000..3791bae
--- /dev/null
+++ b/modules/hibernate-4.2/src/test/java/org/apache/ignite/testsuites/IgniteBinaryHibernateTestSuite.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.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.testframework.config.GridTestProperties;
+
+/**
+ *
+ */
+public class IgniteBinaryHibernateTestSuite extends TestSuite {
+    /**
+     * @return Test suite.
+     * @throws Exception If failed.
+     */
+    public static TestSuite suite() throws Exception {
+        GridTestProperties.setProperty(GridTestProperties.MARSH_CLASS_NAME, BinaryMarshaller.class.getName());
+
+        return IgniteHibernateTestSuite.suite();
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/test/java/org/apache/ignite/testsuites/IgniteHibernateTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/java/org/apache/ignite/testsuites/IgniteHibernateTestSuite.java b/modules/hibernate-4.2/src/test/java/org/apache/ignite/testsuites/IgniteHibernateTestSuite.java
new file mode 100644
index 0000000..99fea56
--- /dev/null
+++ b/modules/hibernate-4.2/src/test/java/org/apache/ignite/testsuites/IgniteHibernateTestSuite.java
@@ -0,0 +1,57 @@
+/*
+ * 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.testsuites;
+
+import junit.framework.TestSuite;
+import org.apache.ignite.cache.hibernate.HibernateL2CacheConfigurationSelfTest;
+import org.apache.ignite.cache.hibernate.HibernateL2CacheSelfTest;
+import org.apache.ignite.cache.hibernate.HibernateL2CacheTransactionalSelfTest;
+import org.apache.ignite.cache.hibernate.HibernateL2CacheTransactionalUseSyncSelfTest;
+import org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreNodeRestartTest;
+import org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreSelfTest;
+import org.apache.ignite.cache.store.hibernate.CacheHibernateStoreFactorySelfTest;
+import org.apache.ignite.cache.store.hibernate.CacheHibernateStoreSessionListenerSelfTest;
+
+/**
+ * Hibernate integration tests.
+ */
+public class IgniteHibernateTestSuite extends TestSuite {
+    /**
+     * @return Test suite.
+     * @throws Exception Thrown in case of the failure.
+     */
+    public static TestSuite suite() throws Exception {
+        TestSuite suite = new TestSuite("Hibernate Integration Test Suite");
+
+        // Hibernate L2 cache.
+        suite.addTestSuite(HibernateL2CacheSelfTest.class);
+        suite.addTestSuite(HibernateL2CacheTransactionalSelfTest.class);
+        suite.addTestSuite(HibernateL2CacheTransactionalUseSyncSelfTest.class);
+        suite.addTestSuite(HibernateL2CacheConfigurationSelfTest.class);
+
+        suite.addTestSuite(CacheHibernateBlobStoreSelfTest.class);
+
+        suite.addTestSuite(CacheHibernateBlobStoreNodeRestartTest.class);
+
+        suite.addTestSuite(CacheHibernateStoreSessionListenerSelfTest.class);
+
+        suite.addTestSuite(CacheHibernateStoreFactorySelfTest.class);
+
+        return suite;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/README.txt
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/README.txt b/modules/hibernate-5.1/README.txt
new file mode 100644
index 0000000..53c5d18
--- /dev/null
+++ b/modules/hibernate-5.1/README.txt
@@ -0,0 +1,48 @@
+Apache Ignite Hibernate Module
+------------------------------
+
+Apache Ignite Hibernate module provides Hibernate second-level cache (L2 cache) implementation based
+on Apache Ignite In-Memory Data Grid.
+
+To enable Hibernate module when starting a standalone node, move 'optional/ignite-hibernate5' folder to
+'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will
+be added to classpath in this case.
+
+Importing Hibernate Module In Maven Project
+-------------------------------------------
+
+If you are using Maven to manage dependencies of your project, you can add Hibernate module
+dependency like this (replace '${ignite.version}' with actual Ignite version you are
+interested in):
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                        http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    ...
+    <dependencies>
+        ...
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-hibernate_5.1</artifactId>
+            <version>${ignite.version}</version>
+        </dependency>
+        ...
+    </dependencies>
+    ...
+</project>
+
+
+LGPL dependencies
+-----------------
+
+Ignite includes the following optional LGPL dependencies:
+ - Hibernate L2 Cache Integration, http://hibernate.org/orm/
+ - JTS Topology Suite for Geospatial indexing, http://tsusiatsoftware.net/jts/main.html
+ - cron4j for cron-based task scheduling, http://www.sauronsoftware.it/projects/cron4j
+
+Apache binary releases cannot include LGPL dependencies. If you would like include
+optional LGPL dependencies into your release, you should download the source release
+from Ignite website and do the build with the following maven command:
+
+mvn clean package -DskipTests -Prelease,lgpl

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/licenses/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/licenses/apache-2.0.txt b/modules/hibernate-5.1/licenses/apache-2.0.txt
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/modules/hibernate-5.1/licenses/apache-2.0.txt
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/pom.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/pom.xml b/modules/hibernate-5.1/pom.xml
new file mode 100644
index 0000000..80299bc
--- /dev/null
+++ b/modules/hibernate-5.1/pom.xml
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<!--
+    POM file.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.ignite</groupId>
+        <artifactId>ignite-parent</artifactId>
+        <version>1</version>
+        <relativePath>../../parent</relativePath>
+    </parent>
+
+    <artifactId>ignite-hibernate_5.1</artifactId>
+    <version>2.0.0-SNAPSHOT</version>
+    <url>http://ignite.apache.org</url>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-hibernate-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-core</artifactId>
+            <version>5.1.5.Final</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-jta</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ow2.jotm</groupId>
+            <artifactId>jotm-core</artifactId>
+            <version>2.1.9</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-dbcp</groupId>
+            <artifactId>commons-dbcp</artifactId>
+            <version>1.4</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <version>${h2.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>javax.resource</groupId>
+            <artifactId>connector-api</artifactId>
+            <version>1.5</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-core</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-spring</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.ignite</groupId>
+            <artifactId>ignite-log4j</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
+            <version>${spring.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>${spring.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.thoughtworks.xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>1.4.8</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <testResources>
+            <testResource>
+                <directory>src/main/java</directory>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                </excludes>
+            </testResource>
+            <testResource>
+                <directory>src/test/java</directory>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                </excludes>
+            </testResource>
+        </testResources>
+
+        <plugins>
+            <!-- Generate the OSGi MANIFEST.MF for this bundle. -->
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateAbstractRegionAccessStrategy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateAbstractRegionAccessStrategy.java b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateAbstractRegionAccessStrategy.java
new file mode 100644
index 0000000..c5829bf
--- /dev/null
+++ b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateAbstractRegionAccessStrategy.java
@@ -0,0 +1,103 @@
+/*
+ * 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.cache.hibernate;
+
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.spi.access.RegionAccessStrategy;
+import org.hibernate.cache.spi.access.SoftLock;
+import org.hibernate.engine.spi.SessionImplementor;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Implementation of L2 cache access strategy delegating to {@link HibernateAccessStrategyAdapter}.
+ */
+public abstract class HibernateAbstractRegionAccessStrategy implements RegionAccessStrategy {
+    /** */
+    protected final HibernateAccessStrategyAdapter stgy;
+
+    /**
+     * @param stgy Access strategy implementation.
+     */
+    protected HibernateAbstractRegionAccessStrategy(HibernateAccessStrategyAdapter stgy) {
+        this.stgy = stgy;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public Object get(SessionImplementor ses, Object key, long txTs) throws CacheException {
+        return stgy.get(key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean putFromLoad(SessionImplementor ses, Object key, Object val, long txTs, Object ver) throws CacheException {
+        stgy.putFromLoad(key, val);
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean putFromLoad(SessionImplementor ses, Object key, Object val, long txTs, Object ver, boolean minimalPutOverride)
+        throws CacheException {
+        stgy.putFromLoad(key, val, minimalPutOverride);
+
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public SoftLock lockItem(SessionImplementor ses, Object key, Object ver) throws CacheException {
+        stgy.lock(key);
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public SoftLock lockRegion() throws CacheException {
+        stgy.lockRegion();
+
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void unlockRegion(SoftLock lock) throws CacheException {
+        stgy.unlockRegion();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void unlockItem(SessionImplementor ses, Object key, SoftLock lock) throws CacheException {
+        stgy.unlock(key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void remove(SessionImplementor ses, Object key) throws CacheException {
+        stgy.remove(key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void removeAll() throws CacheException {
+        stgy.removeAll();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void evict(Object key) throws CacheException {
+        stgy.evict(key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void evictAll() throws CacheException {
+        stgy.evictAll();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateCollectionRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateCollectionRegion.java b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateCollectionRegion.java
new file mode 100644
index 0000000..be99e98
--- /dev/null
+++ b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateCollectionRegion.java
@@ -0,0 +1,114 @@
+/*
+ * 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.cache.hibernate;
+
+import org.apache.ignite.Ignite;
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.spi.CacheDataDescription;
+import org.hibernate.cache.spi.CollectionRegion;
+import org.hibernate.cache.spi.access.AccessType;
+import org.hibernate.cache.spi.access.CollectionRegionAccessStrategy;
+import org.hibernate.engine.spi.SessionFactoryImplementor;
+import org.hibernate.persister.collection.CollectionPersister;
+
+/**
+ * Implementation of {@link CollectionRegion}. This region is used to store collection data.
+ * <p>
+ * L2 cache for collection can be enabled in the Hibernate configuration file:
+ * <pre name="code" class="xml">
+ * &lt;hibernate-configuration&gt;
+ *     &lt;!-- Enable L2 cache. --&gt;
+ *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
+ *
+ *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
+ *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
+ *
+ *     &lt;!-- Specify entities. --&gt;
+ *     &lt;mapping class="com.example.Entity"/&gt;
+ *     &lt;mapping class="com.example.ChildEntity"/&gt;
+ *
+ *     &lt;!-- Enable L2 cache with nonstrict-read-write access strategy for entities and collection. --&gt;
+ *     &lt;collection-cache collection="com.example.Entity" usage="nonstrict-read-write"/&gt;
+ *     &lt;collection-cache collection="com.example.ChildEntity" usage="nonstrict-read-write"/&gt;
+ *     &lt;collection-cache collection="com.example.Entity.children" usage="nonstrict-read-write"/&gt;
+ * &lt;/hibernate-configuration&gt;
+ * </pre>
+ * Also cache for collection can be enabled using annotations:
+ * <pre name="code" class="java">
+ * &#064;javax.persistence.Entity
+ * public class Entity {
+ *    ...
+ *
+ *    &#064;javax.persistence.OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
+ *    &#064;javax.persistence.JoinColumn(name="PARENT_ID")
+ *    &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+ *    public List&lt;ChildEntity&gt; getChildren() {...}
+ * }
+ * </pre>
+ * Note: the collection cache does not cache the state of the actual entities in the cache, it caches only identifier
+ * values. For this reason, the collection cache should always be used in conjunction with
+ * the second-level cache for those entities expected to be cached as part of a collection cache.
+ */
+public class HibernateCollectionRegion extends HibernateTransactionalDataRegion implements CollectionRegion {
+    /**
+     * @param factory Region factory.
+     * @param name Region name.
+     * @param ignite Grid.
+     * @param cache Region cache.
+     * @param dataDesc Region data description.
+     */
+    public HibernateCollectionRegion(HibernateRegionFactory factory, String name,
+        Ignite ignite, HibernateCacheProxy cache, CacheDataDescription dataDesc) {
+        super(factory, name, ignite, cache, dataDesc);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
+        return new AccessStrategy(createAccessStrategy(accessType));
+    }
+
+    /**
+     * Collection region access strategy.
+     */
+    private class AccessStrategy extends HibernateAbstractRegionAccessStrategy
+        implements CollectionRegionAccessStrategy {
+        /**
+         * @param stgy Access strategy implementation.
+         */
+        private AccessStrategy(HibernateAccessStrategyAdapter stgy) {
+            super(stgy);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object generateCacheKey(Object id,
+            CollectionPersister persister,
+            SessionFactoryImplementor factory, String tenantIdentifier) {
+            return HibernateKeyWrapper.staticCreateCollectionKey(id, persister, tenantIdentifier);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object getCacheKeyId(Object cacheKey) {
+            return ((HibernateKeyWrapper)cacheKey).id();
+        }
+
+        /** {@inheritDoc} */
+        @Override public CollectionRegion getRegion() {
+            return HibernateCollectionRegion.this;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateEntityRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateEntityRegion.java b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateEntityRegion.java
new file mode 100644
index 0000000..c669400
--- /dev/null
+++ b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateEntityRegion.java
@@ -0,0 +1,128 @@
+/*
+ * 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.cache.hibernate;
+
+import org.apache.ignite.Ignite;
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.spi.CacheDataDescription;
+import org.hibernate.cache.spi.EntityRegion;
+import org.hibernate.cache.spi.access.AccessType;
+import org.hibernate.cache.spi.access.EntityRegionAccessStrategy;
+import org.hibernate.cache.spi.access.SoftLock;
+import org.hibernate.engine.spi.SessionFactoryImplementor;
+import org.hibernate.engine.spi.SessionImplementor;
+import org.hibernate.persister.entity.EntityPersister;
+
+/**
+ * Implementation of {@link EntityRegion}. This region is used to store entity data.
+ * <p>
+ * L2 cache for entity can be enabled in the Hibernate configuration file:
+ * <pre name="code" class="xml">
+ * &lt;hibernate-configuration&gt;
+ *     &lt;!-- Enable L2 cache. --&gt;
+ *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
+ *
+ *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
+ *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
+ *
+ *     &lt;!-- Specify entity. --&gt;
+ *     &lt;mapping class="com.example.Entity"/&gt;
+ *
+ *     &lt;!-- Enable L2 cache with nonstrict-read-write access strategy for entity. --&gt;
+ *     &lt;class-cache class="com.example.Entity" usage="nonstrict-read-write"/&gt;
+ * &lt;/hibernate-configuration&gt;
+ * </pre>
+ * Also cache for entity can be enabled using annotations:
+ * <pre name="code" class="java">
+ * &#064;javax.persistence.Entity
+ * &#064;javax.persistence.Cacheable
+ * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+ * public class Entity { ... }
+ * </pre>
+ */
+public class HibernateEntityRegion extends HibernateTransactionalDataRegion implements EntityRegion {
+    /**
+     * @param factory Region factory.
+     * @param name Region name.
+     * @param ignite Grid.
+     * @param cache Region cache,
+     * @param dataDesc Region data description.
+     */
+    public HibernateEntityRegion(HibernateRegionFactory factory, String name, Ignite ignite,
+        HibernateCacheProxy cache, CacheDataDescription dataDesc) {
+        super(factory, name, ignite, cache, dataDesc);
+    }
+
+    /** {@inheritDoc} */
+    @Override public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
+        return new AccessStrategy(createAccessStrategy(accessType));
+    }
+
+    /**
+     * Entity region access strategy.
+     */
+    private class AccessStrategy extends HibernateAbstractRegionAccessStrategy
+        implements EntityRegionAccessStrategy {
+        /**
+         * @param stgy Access strategy implementation.
+         */
+        private AccessStrategy(HibernateAccessStrategyAdapter stgy) {
+            super(stgy);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object generateCacheKey(Object id,
+            EntityPersister persister,
+            SessionFactoryImplementor factory,
+            String tenantIdentifier) {
+            return HibernateKeyWrapper.staticCreateEntityKey(id, persister, tenantIdentifier);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object getCacheKeyId(Object cacheKey) {
+            return ((HibernateKeyWrapper)cacheKey).id();
+        }
+
+        /** {@inheritDoc} */
+        @Override public EntityRegion getRegion() {
+            return HibernateEntityRegion.this;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean insert(SessionImplementor ses, Object key, Object val, Object ver) throws CacheException {
+            return stgy.insert(key, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean afterInsert(SessionImplementor ses, Object key, Object val, Object ver) throws CacheException {
+            return stgy.afterInsert(key, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean update(SessionImplementor ses, Object key, Object val, Object currVer, Object previousVer)
+            throws CacheException {
+            return stgy.update(key, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean afterUpdate(SessionImplementor ses, Object key, Object val, Object currVer, Object previousVer, SoftLock lock)
+            throws CacheException {
+            return stgy.afterUpdate(key, val);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateGeneralDataRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateGeneralDataRegion.java b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateGeneralDataRegion.java
new file mode 100644
index 0000000..9365157
--- /dev/null
+++ b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateGeneralDataRegion.java
@@ -0,0 +1,79 @@
+/*
+ * 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.cache.hibernate;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.spi.GeneralDataRegion;
+import org.hibernate.cache.spi.QueryResultsRegion;
+import org.hibernate.cache.spi.TimestampsRegion;
+import org.hibernate.engine.spi.SessionImplementor;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Implementation of {@link GeneralDataRegion}. This interface defines common contract for {@link QueryResultsRegion}
+ * and {@link TimestampsRegion}.
+ */
+public class HibernateGeneralDataRegion extends HibernateRegion implements GeneralDataRegion {
+    /**
+     * @param factory Region factory.
+     * @param name Region name.
+     * @param ignite Grid.
+     * @param cache Region cache.
+     */
+    HibernateGeneralDataRegion(HibernateRegionFactory factory, String name,
+        Ignite ignite, HibernateCacheProxy cache) {
+        super(factory, name, ignite, cache);
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override public Object get(SessionImplementor ses, Object key) throws CacheException {
+        try {
+            return cache.get(key);
+        }
+        catch (IgniteCheckedException e) {
+            throw new CacheException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void put(SessionImplementor ses, Object key, Object val) throws CacheException {
+        try {
+            cache.put(key, val);
+        }
+        catch (IgniteCheckedException e) {
+            throw new CacheException(e);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void evict(Object key) throws CacheException {
+        HibernateAccessStrategyAdapter.evict(ignite, cache, key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void evictAll() throws CacheException {
+        try {
+            HibernateAccessStrategyAdapter.evictAll(cache);
+        }
+        catch (IgniteCheckedException e) {
+            throw HibernateRegionFactory.EXCEPTION_CONVERTER.convert(e);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyWrapper.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyWrapper.java b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyWrapper.java
new file mode 100644
index 0000000..45d00e4
--- /dev/null
+++ b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyWrapper.java
@@ -0,0 +1,109 @@
+/*
+ * 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.cache.hibernate;
+
+import java.io.Serializable;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.hibernate.cache.internal.DefaultCacheKeysFactory;
+import org.hibernate.engine.spi.SessionFactoryImplementor;
+import org.hibernate.persister.collection.CollectionPersister;
+import org.hibernate.persister.entity.EntityPersister;
+
+/**
+ * Hibernate cache key wrapper.
+ */
+public class HibernateKeyWrapper implements Serializable {
+    /** Key. */
+    private final Object key;
+
+    /** Entry. */
+    private final String entry;
+
+    /** */
+    private final String tenantId;
+
+    /**
+     * @param key Key.
+     * @param entry Entry.
+     * @param tenantId Tenant ID.
+     */
+    HibernateKeyWrapper(Object key, String entry, String tenantId) {
+        this.key = key;
+        this.entry = entry;
+        this.tenantId = tenantId;
+    }
+
+    /**
+     * @return ID.
+     */
+    Object id() {
+        return key;
+    }
+
+    /**
+     * @param id ID.
+     * @param persister Persister.
+     * @param tenantIdentifier Tenant ID.
+     * @return Cache key.
+     * @see DefaultCacheKeysFactory#staticCreateCollectionKey(Object, CollectionPersister, SessionFactoryImplementor, String)
+     */
+    static Object staticCreateCollectionKey(Object id,
+        CollectionPersister persister,
+        String tenantIdentifier) {
+        return new HibernateKeyWrapper(id, persister.getRole(), tenantIdentifier);
+    }
+
+    /**
+     * @param id ID.
+     * @param persister Persister.
+     * @param tenantIdentifier Tenant ID.
+     * @return Cache key.
+     * @see DefaultCacheKeysFactory#staticCreateEntityKey(Object, EntityPersister, SessionFactoryImplementor, String)
+     */
+    public static Object staticCreateEntityKey(Object id, EntityPersister persister, String tenantIdentifier) {
+        return new HibernateKeyWrapper(id, persister.getRootEntityName(), tenantIdentifier);
+    }
+
+
+    /** {@inheritDoc} */
+    @Override public boolean equals(Object o) {
+        if (this == o) return true;
+
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        HibernateKeyWrapper that = (HibernateKeyWrapper) o;
+
+        return (key != null ? key.equals(that.key) : that.key == null) &&
+            (entry != null ? entry.equals(that.entry) : that.entry == null) &&
+            (tenantId != null ? tenantId.equals(that.tenantId) : that.tenantId == null);
+    }
+
+    /** {@inheritDoc} */
+    @Override public int hashCode() {
+        int res = key != null ? key.hashCode() : 0;
+        res = 31 * res + (entry != null ? entry.hashCode() : 0);
+        res = 31 * res + (tenantId != null ? tenantId.hashCode() : 0);
+        return res;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(HibernateKeyWrapper.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateNaturalIdRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateNaturalIdRegion.java b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateNaturalIdRegion.java
new file mode 100644
index 0000000..68816de
--- /dev/null
+++ b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateNaturalIdRegion.java
@@ -0,0 +1,113 @@
+/*
+ * 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.cache.hibernate;
+
+import org.apache.ignite.Ignite;
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.internal.DefaultCacheKeysFactory;
+import org.hibernate.cache.spi.CacheDataDescription;
+import org.hibernate.cache.spi.NaturalIdRegion;
+import org.hibernate.cache.spi.access.AccessType;
+import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy;
+import org.hibernate.cache.spi.access.SoftLock;
+import org.hibernate.engine.spi.SessionImplementor;
+import org.hibernate.persister.entity.EntityPersister;
+
+/**
+ * Implementation of {@link NaturalIdRegion}. This region is used to store naturalId data.
+ * <p>
+ * L2 cache for entity naturalId and target cache region can be set using annotations:
+ * <pre name="code" class="java">
+ * &#064;javax.persistence.Entity
+ * &#064;javax.persistence.Cacheable
+ * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+ * &#064;org.hibernate.annotations.NaturalIdCache
+ * public class Entity {
+ *     &#064;org.hibernate.annotations.NaturalId
+ *     private String entityCode;
+ *
+ *     ...
+ * }
+ * </pre>
+ */
+public class HibernateNaturalIdRegion extends HibernateTransactionalDataRegion implements NaturalIdRegion {
+    /**
+     * @param factory Region factory.
+     * @param name Region name.
+     * @param ignite Grid.
+     * @param cache Region cache,
+     * @param dataDesc Region data description.
+     */
+    public HibernateNaturalIdRegion(HibernateRegionFactory factory, String name,
+        Ignite ignite, HibernateCacheProxy cache, CacheDataDescription dataDesc) {
+        super(factory, name, ignite, cache, dataDesc);
+    }
+
+    /** {@inheritDoc} */
+    @Override public NaturalIdRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
+        return new AccessStrategy(createAccessStrategy(accessType));
+    }
+
+    /**
+     * NaturalId region access strategy.
+     */
+    private class AccessStrategy extends HibernateAbstractRegionAccessStrategy implements
+        NaturalIdRegionAccessStrategy {
+        /**
+         * @param stgy Access strategy implementation.
+         */
+        private AccessStrategy(HibernateAccessStrategyAdapter stgy) {
+            super(stgy);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object generateCacheKey(Object[] naturalIdValues, EntityPersister persister, SessionImplementor ses) {
+            return DefaultCacheKeysFactory.staticCreateNaturalIdKey(naturalIdValues, persister, ses);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object[] getNaturalIdValues(Object cacheKey) {
+            return DefaultCacheKeysFactory.staticGetNaturalIdValues(cacheKey);
+        }
+
+        /** {@inheritDoc} */
+        @Override public NaturalIdRegion getRegion() {
+            return HibernateNaturalIdRegion.this;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean insert(SessionImplementor ses, Object key, Object val) throws CacheException {
+            return stgy.insert(key, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean afterInsert(SessionImplementor ses, Object key, Object val) throws CacheException {
+            return stgy.afterInsert(key, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean update(SessionImplementor ses, Object key, Object val) throws CacheException {
+            return stgy.update(key, val);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean afterUpdate(SessionImplementor ses, Object key, Object val, SoftLock lock) throws CacheException {
+            return stgy.afterUpdate(key, val);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateQueryResultsRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateQueryResultsRegion.java b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateQueryResultsRegion.java
new file mode 100644
index 0000000..0b9a43d
--- /dev/null
+++ b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateQueryResultsRegion.java
@@ -0,0 +1,70 @@
+/*
+ * 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.cache.hibernate;
+
+import org.apache.ignite.Ignite;
+import org.hibernate.Query;
+import org.hibernate.cache.spi.QueryResultsRegion;
+
+/**
+ * Implementation of {@link QueryResultsRegion}. This region is used to store query results.
+ * <p>
+ * Query results caching can be enabled in the Hibernate configuration file:
+ * <pre name="code" class="xml">
+ * &lt;hibernate-configuration&gt;
+ *     &lt;!-- Enable L2 cache. --&gt;
+ *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
+ *
+ *     &lt;!-- Enable query cache. --&gt;
+ *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
+
+ *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
+ *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
+ *
+ *     &lt;!-- Specify entity. --&gt;
+ *     &lt;mapping class="com.example.Entity"/&gt;
+ *
+ *     &lt;!-- Enable L2 cache with nonstrict-read-write access strategy for entity. --&gt;
+ *     &lt;class-cache class="com.example.Entity" usage="nonstrict-read-write"/&gt;
+ * &lt;/hibernate-configuration&gt;
+ * </pre>
+ * By default queries are not cached even after enabling query caching, to enable results caching for a particular
+ * query, call {@link Query#setCacheable(boolean)}:
+ * <pre name="code" class="java">
+ *     Session ses = getSession();
+ *
+ *     Query qry = ses.createQuery("...");
+ *
+ *     qry.setCacheable(true); // Enable L2 cache for query.
+ * </pre>
+ * Note: the query cache does not cache the state of the actual entities in the cache, it caches only identifier
+ * values. For this reason, the query cache should always be used in conjunction with
+ * the second-level cache for those entities expected to be cached as part of a query result cache
+ */
+public class HibernateQueryResultsRegion extends HibernateGeneralDataRegion implements QueryResultsRegion {
+    /**
+     * @param factory Region factory.
+     * @param name Region name.
+     * @param ignite Grid.
+     * @param cache Region cache.
+     */
+    public HibernateQueryResultsRegion(HibernateRegionFactory factory, String name,
+        Ignite ignite, HibernateCacheProxy cache) {
+        super(factory, name, ignite, cache);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegion.java b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegion.java
new file mode 100644
index 0000000..11a96d0
--- /dev/null
+++ b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegion.java
@@ -0,0 +1,99 @@
+/*
+ * 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.cache.hibernate;
+
+import java.util.Collections;
+import java.util.Map;
+import org.apache.ignite.Ignite;
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.spi.Region;
+
+/**
+ * Implementation of {@link Region}. This interface defines base contract for all L2 cache regions.
+ */
+public class HibernateRegion implements Region {
+    /** */
+    protected final HibernateRegionFactory factory;
+
+    /** */
+    private final String name;
+
+    /** Cache instance. */
+    protected final HibernateCacheProxy cache;
+
+    /** Grid instance. */
+    protected Ignite ignite;
+
+    /**
+     * @param factory Region factory.
+     * @param name Region name.
+     * @param ignite Grid.
+     * @param cache Region cache.
+     */
+    public HibernateRegion(HibernateRegionFactory factory, String name, Ignite ignite, HibernateCacheProxy cache) {
+        this.factory = factory;
+        this.name = name;
+        this.ignite = ignite;
+        this.cache = cache;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getName() {
+        return name;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void destroy() throws CacheException {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean contains(Object key) {
+        return cache.containsKey(key);
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSizeInMemory() {
+        return -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getElementCountInMemory() {
+        return cache.size();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getElementCountOnDisk() {
+        return -1;
+    }
+
+    /** {@inheritDoc} */
+    @Override public Map toMap() {
+        return Collections.emptyMap();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long nextTimestamp() {
+        return System.currentTimeMillis();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTimeout() {
+        return 0;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegionFactory.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegionFactory.java b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegionFactory.java
new file mode 100644
index 0000000..bf7d7e9
--- /dev/null
+++ b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegionFactory.java
@@ -0,0 +1,168 @@
+/*
+ * 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.cache.hibernate;
+
+import java.util.Properties;
+import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.hibernate.boot.spi.SessionFactoryOptions;
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.spi.CacheDataDescription;
+import org.hibernate.cache.spi.CollectionRegion;
+import org.hibernate.cache.spi.EntityRegion;
+import org.hibernate.cache.spi.NaturalIdRegion;
+import org.hibernate.cache.spi.QueryResultsRegion;
+import org.hibernate.cache.spi.RegionFactory;
+import org.hibernate.cache.spi.TimestampsRegion;
+import org.hibernate.cache.spi.access.AccessType;
+
+import static org.apache.ignite.cache.hibernate.HibernateAccessStrategyFactory.DFLT_ACCESS_TYPE_PROPERTY;
+import static org.hibernate.cache.spi.access.AccessType.NONSTRICT_READ_WRITE;
+
+/**
+ * Hibernate L2 cache region factory.
+ * <p>
+ * Following Hibernate settings should be specified to enable second level cache and to use this
+ * region factory for caching:
+ * <pre name="code" class="brush: xml; gutter: false;">
+ * hibernate.cache.use_second_level_cache=true
+ * hibernate.cache.region.factory_class=org.apache.ignite.cache.hibernate.HibernateRegionFactory
+ * </pre>
+ * Note that before region factory is started you need to start properly configured Ignite node in the same JVM.
+ * For example to start Ignite node one of loader provided in {@code org.apache.ignite.grid.startup} package can be used.
+ * <p>
+ * Name of Ignite instance to be used for region factory must be specified as following Hibernate property:
+ * <pre name="code" class="brush: xml; gutter: false;">
+ * org.apache.ignite.hibernate.ignite_instance_name=&lt;Ignite instance name&gt;
+ * </pre>
+ * Each Hibernate cache region must be associated with some {@link IgniteInternalCache}, by default it is assumed that
+ * for each cache region there is a {@link IgniteInternalCache} with the same name. Also it is possible to define
+ * region to cache mapping using properties with prefix {@code org.apache.ignite.hibernate.region_cache}.
+ * For example if for region with name "region1" cache with name "cache1" should be used then following
+ * Hibernate property should be specified:
+ * <pre name="code" class="brush: xml; gutter: false;">
+ * org.apache.ignite.hibernate.region_cache.region1=cache1
+ * </pre>
+ */
+public class HibernateRegionFactory implements RegionFactory {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    static final HibernateExceptionConverter EXCEPTION_CONVERTER = new HibernateExceptionConverter() {
+        @Override public RuntimeException convert(Exception e) {
+            return new CacheException(e);
+        }
+    };
+
+    /** Default region access type. */
+    private AccessType dfltAccessType;
+
+    /** Key transformer. */
+    private final HibernateKeyTransformer hibernate4transformer = new HibernateKeyTransformer() {
+        @Override public Object transform(Object key) {
+            return key;
+        }
+    };
+
+    /** */
+    private final HibernateAccessStrategyFactory accessStgyFactory =
+        new HibernateAccessStrategyFactory(hibernate4transformer, EXCEPTION_CONVERTER);
+
+    /** {@inheritDoc} */
+    @Override public void start(SessionFactoryOptions settings, Properties props) throws CacheException {
+        String accessType = props.getProperty(DFLT_ACCESS_TYPE_PROPERTY, NONSTRICT_READ_WRITE.name());
+
+        dfltAccessType = AccessType.valueOf(accessType);
+
+        accessStgyFactory.start(props);
+    }
+
+    /**
+     * @return Access strategy factory.
+     */
+    HibernateAccessStrategyFactory accessStrategyFactory() {
+        return accessStgyFactory;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop() {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isMinimalPutsEnabledByDefault() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public AccessType getDefaultAccessType() {
+        return dfltAccessType;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long nextTimestamp() {
+        return System.currentTimeMillis();
+    }
+
+    /** {@inheritDoc} */
+    @Override public EntityRegion buildEntityRegion(String regionName, Properties props, CacheDataDescription metadata)
+        throws CacheException {
+        return new HibernateEntityRegion(this,
+            regionName,
+            accessStgyFactory.node(),
+            accessStgyFactory.regionCache(regionName),
+            metadata);
+    }
+
+    /** {@inheritDoc} */
+    @Override public NaturalIdRegion buildNaturalIdRegion(String regionName, Properties props,
+                                                          CacheDataDescription metadata) throws CacheException {
+        return new HibernateNaturalIdRegion(this,
+            regionName,
+            accessStgyFactory.node(),
+            accessStgyFactory.regionCache(regionName),
+            metadata);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CollectionRegion buildCollectionRegion(String regionName, Properties props,
+                                                            CacheDataDescription metadata) throws CacheException {
+        return new HibernateCollectionRegion(this,
+            regionName,
+            accessStgyFactory.node(),
+            accessStgyFactory.regionCache(regionName),
+            metadata);
+    }
+
+    /** {@inheritDoc} */
+    @Override public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties props)
+        throws CacheException {
+        return new HibernateQueryResultsRegion(this,
+            regionName,
+            accessStgyFactory.node(),
+            accessStgyFactory.regionCache(regionName));
+    }
+
+    /** {@inheritDoc} */
+    @Override public TimestampsRegion buildTimestampsRegion(String regionName, Properties props) throws CacheException {
+        return new HibernateTimestampsRegion(this,
+            regionName,
+            accessStgyFactory.node(),
+            accessStgyFactory.regionCache(regionName));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateTimestampsRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateTimestampsRegion.java b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateTimestampsRegion.java
new file mode 100644
index 0000000..8b4c243
--- /dev/null
+++ b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateTimestampsRegion.java
@@ -0,0 +1,39 @@
+/*
+ * 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.cache.hibernate;
+
+import org.apache.ignite.Ignite;
+import org.hibernate.cache.spi.TimestampsRegion;
+
+/**
+ * Implementation of {@link TimestampsRegion}. This region is automatically created when query
+ * caching is enabled and it holds most recent updates timestamps to queryable tables.
+ * Name of timestamps region is {@code "org.hibernate.cache.spi.UpdateTimestampsCache"}.
+ */
+public class HibernateTimestampsRegion extends HibernateGeneralDataRegion implements TimestampsRegion {
+    /**
+     * @param factory Region factory.
+     * @param name Region name.
+     * @param ignite Grid.
+     * @param cache Region cache.
+     */
+    public HibernateTimestampsRegion(HibernateRegionFactory factory, String name,
+        Ignite ignite,  HibernateCacheProxy cache) {
+        super(factory, name, ignite, cache);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalDataRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalDataRegion.java b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalDataRegion.java
new file mode 100644
index 0000000..275ea9e
--- /dev/null
+++ b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalDataRegion.java
@@ -0,0 +1,84 @@
+/*
+ * 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.cache.hibernate;
+
+import org.apache.ignite.Ignite;
+import org.hibernate.cache.spi.CacheDataDescription;
+import org.hibernate.cache.spi.CollectionRegion;
+import org.hibernate.cache.spi.EntityRegion;
+import org.hibernate.cache.spi.NaturalIdRegion;
+import org.hibernate.cache.spi.TransactionalDataRegion;
+import org.hibernate.cache.spi.access.AccessType;
+
+/**
+ * Implementation of {@link TransactionalDataRegion} (transactional means that
+ * data in the region is updated in connection with database transaction).
+ * This interface defines base contract for {@link EntityRegion}, {@link CollectionRegion}
+ * and {@link NaturalIdRegion}.
+ */
+public class HibernateTransactionalDataRegion extends HibernateRegion implements TransactionalDataRegion {
+    /** */
+    private final CacheDataDescription dataDesc;
+
+    /**
+     * @param factory Region factory.
+     * @param name Region name.
+     * @param ignite Grid.
+     * @param cache Region cache.
+     * @param dataDesc Region data description.
+     */
+    HibernateTransactionalDataRegion(HibernateRegionFactory factory, String name,
+        Ignite ignite, HibernateCacheProxy cache, CacheDataDescription dataDesc) {
+        super(factory, name, ignite, cache);
+
+        this.dataDesc = dataDesc;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isTransactionAware() {
+        return false; // This method is not used by Hibernate.
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheDataDescription getCacheDataDescription() {
+        return dataDesc;
+    }
+
+    /**
+     * @param accessType Hibernate L2 cache access type.
+     * @return Access strategy for given access type.
+     */
+    HibernateAccessStrategyAdapter createAccessStrategy(AccessType accessType) {
+        switch (accessType) {
+            case READ_ONLY:
+                return factory.accessStrategyFactory().createReadOnlyStrategy(cache);
+
+            case NONSTRICT_READ_WRITE:
+                return factory.accessStrategyFactory().createNonStrictReadWriteStrategy(cache);
+
+            case READ_WRITE:
+                return factory.accessStrategyFactory().createReadWriteStrategy(cache);
+
+            case TRANSACTIONAL:
+                return factory.accessStrategyFactory().createTransactionalStrategy(cache);
+
+            default:
+                throw new IllegalArgumentException("Unknown Hibernate access type: " + accessType);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/package-info.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/package-info.java b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/package-info.java
new file mode 100644
index 0000000..1179aec
--- /dev/null
+++ b/modules/hibernate-5.1/src/main/java/org/apache/ignite/cache/hibernate/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * 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 description. -->
+ * Contains implementation of Hibernate L2 cache. Refer to
+ * <i>org.apache.ignite.examples.datagrid.hibernate.HibernateL2CacheExample</i> for more information on how to
+ * configure and use Ignite with Hibernate.
+ */
+package org.apache.ignite.cache.hibernate;
\ No newline at end of file


[21/51] [abbrv] ignite git commit: ignite-4799 TcpDiscoverySpi: removed missedHeartbeats properties, heartbeatFrequency (instead use IgiteConfiguration.metricsUpdateFrequency). Added IgiteConfiguration.clientFailureDetectionTimeout.

Posted by sb...@apache.org.
ignite-4799 TcpDiscoverySpi: removed missedHeartbeats properties, heartbeatFrequency (instead use IgiteConfiguration.metricsUpdateFrequency). Added IgiteConfiguration.clientFailureDetectionTimeout.


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

Branch: refs/heads/ignite-5075-cacheStart
Commit: 6998785a8861387b7ad83527a381dc5b772cf76f
Parents: c829aac
Author: Alexander Belyak <al...@xored.com>
Authored: Wed Apr 26 15:43:42 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Apr 26 15:43:42 2017 +0300

----------------------------------------------------------------------
 .../apache/ignite/gridify/AbstractAopTest.java  |   4 +-
 .../gridify/ExternalNonSpringAopSelfTest.java   |   6 +-
 .../clients/src/test/resources/spring-cache.xml |   1 -
 .../apache/ignite/cluster/ClusterMetrics.java   |   4 +-
 .../org/apache/ignite/cluster/ClusterNode.java  |  11 +-
 .../configuration/IgniteConfiguration.java      |  52 ++-
 .../org/apache/ignite/events/EventType.java     |   2 +-
 .../processors/job/GridJobProcessor.java        |  18 +-
 .../utils/PlatformConfigurationUtils.java       |  32 +-
 .../org/apache/ignite/spi/IgniteSpiAdapter.java |  32 ++
 .../spi/IgniteSpiOperationTimeoutHelper.java    |   8 +-
 .../jobstealing/JobStealingCollisionSpi.java    |   2 +-
 .../communication/tcp/TcpCommunicationSpi.java  |   6 +-
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  31 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 142 ++++----
 .../spi/discovery/tcp/TcpDiscoverySpi.java      | 143 ++------
 .../spi/discovery/tcp/TcpDiscoverySpiMBean.java |  26 +-
 .../tcp/internal/TcpDiscoveryNode.java          |  33 +-
 .../TcpDiscoveryClientHeartbeatMessage.java     |  72 ----
 .../TcpDiscoveryClientMetricsUpdateMessage.java |  72 ++++
 .../messages/TcpDiscoveryHeartbeatMessage.java  | 338 -------------------
 .../TcpDiscoveryMetricsUpdateMessage.java       | 338 +++++++++++++++++++
 .../adaptive/AdaptiveLoadBalancingSpi.java      |  12 +-
 .../resources/META-INF/classnames.properties    |   8 +-
 .../core/src/test/config/load/dsi-load-base.xml |   3 +-
 .../src/test/config/load/merge-sort-base.xml    |   7 +-
 .../config/streamer/spring-streamer-base.xml    |   5 +-
 .../java/org/apache/ignite/GridTestJob.java     |  19 ++
 .../java/org/apache/ignite/GridTestTask.java    |  18 +-
 .../internal/ClusterNodeMetricsSelfTest.java    |  10 +-
 .../ignite/internal/GridAffinityMappedTest.java |   5 +-
 .../internal/GridAffinityP2PSelfTest.java       |   3 +-
 .../ignite/internal/GridAffinitySelfTest.java   |   3 +-
 .../GridCancelledJobsMetricsSelfTest.java       |   4 +-
 ...ridFailFastNodeFailureDetectionSelfTest.java |   4 +-
 .../GridJobCollisionCancelSelfTest.java         |   2 +-
 .../GridDiscoveryManagerAliveCacheSelfTest.java |   4 +-
 .../GridCacheAbstractFailoverSelfTest.java      |   4 +-
 .../cache/GridCacheAbstractSelfTest.java        |   4 +-
 .../cache/GridCacheMvccManagerSelfTest.java     |   3 +-
 .../cache/IgniteCacheAbstractTest.java          |  10 +-
 .../binary/BinaryMetadataUpdatesFlowTest.java   |   4 +-
 .../CacheLateAffinityAssignmentTest.java        |   3 +-
 .../GridCacheNodeFailureAbstractTest.java       |   3 +-
 .../distributed/IgniteCache150ClientsTest.java  |   2 +-
 .../IgniteCacheNearRestartRollbackSelfTest.java |   2 +-
 ...dCacheColocatedTxSingleThreadedSelfTest.java |   2 +-
 .../dht/GridCacheDhtPreloadDelayedSelfTest.java |   2 +-
 .../GridCacheDhtPreloadMessageCountTest.java    |   2 +-
 .../atomic/IgniteCacheAtomicProtocolTest.java   |   2 +-
 .../near/GridCacheNearMultiGetSelfTest.java     |   2 +-
 .../near/GridCacheNearMultiNodeSelfTest.java    |   2 +-
 ...achePartitionedTxSingleThreadedSelfTest.java |   2 +-
 .../cache/query/IndexingSpiQuerySelfTest.java   |   4 +-
 .../service/GridServiceClientNodeTest.java      |   7 +-
 ...ridSingleSplitsNewNodesAbstractLoadTest.java |  11 +-
 ...idSingleSplitsNewNodesMulticastLoadTest.java |   9 +-
 .../p2p/GridP2PSameClassLoaderSelfTest.java     |   2 +-
 .../discovery/AbstractDiscoverySelfTest.java    |  19 +-
 ...lientDiscoverySpiFailureTimeoutSelfTest.java | 245 +++++++++++++-
 .../tcp/TcpClientDiscoverySpiSelfTest.java      |  79 ++++-
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java |  18 +-
 .../tcp/TcpDiscoverySpiConfigSelfTest.java      |   4 +-
 .../TcpDiscoverySpiFailureTimeoutSelfTest.java  |  51 +--
 .../testframework/junits/GridAbstractTest.java  |  10 +-
 .../webapp/META-INF/ignite-webapp-config.xml    |   1 -
 .../Cache/CacheMetricsTest.cs                   |   3 +-
 .../IgniteConfigurationSerializerTest.cs        |   1 -
 .../IgniteConfigurationTest.cs                  |   1 -
 .../Discovery/Tcp/TcpDiscoverySpi.cs            |  15 -
 .../IgniteConfigurationSection.xsd              |   5 -
 .../Datagrid/MultiTieredCacheExample.cs         |   2 +-
 .../ignite/p2p/GridP2PDisabledSelfTest.java     |   4 +-
 .../webapp2/META-INF/ignite-webapp-config.xml   |   1 -
 74 files changed, 1135 insertions(+), 886 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/aop/src/test/java/org/apache/ignite/gridify/AbstractAopTest.java
----------------------------------------------------------------------
diff --git a/modules/aop/src/test/java/org/apache/ignite/gridify/AbstractAopTest.java b/modules/aop/src/test/java/org/apache/ignite/gridify/AbstractAopTest.java
index 2008eff..33f2cdd 100644
--- a/modules/aop/src/test/java/org/apache/ignite/gridify/AbstractAopTest.java
+++ b/modules/aop/src/test/java/org/apache/ignite/gridify/AbstractAopTest.java
@@ -54,9 +54,9 @@ public abstract class AbstractAopTest extends GridCommonAbstractTest {
 
         cfg.setDeploymentSpi(new LocalDeploymentSpi());
 
-        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setHeartbeatFrequency(500);
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
 
+        cfg.setMetricsUpdateFrequency(500);
         cfg.setDeploymentMode(depMode);
 
         return cfg;
@@ -738,4 +738,4 @@ public abstract class AbstractAopTest extends GridCommonAbstractTest {
             return true;
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/aop/src/test/java/org/test/gridify/ExternalNonSpringAopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aop/src/test/java/org/test/gridify/ExternalNonSpringAopSelfTest.java b/modules/aop/src/test/java/org/test/gridify/ExternalNonSpringAopSelfTest.java
index b53501b..44fa48d 100644
--- a/modules/aop/src/test/java/org/test/gridify/ExternalNonSpringAopSelfTest.java
+++ b/modules/aop/src/test/java/org/test/gridify/ExternalNonSpringAopSelfTest.java
@@ -524,9 +524,7 @@ public class ExternalNonSpringAopSelfTest extends GridCommonAbstractTest {
         IgniteConfiguration cfg = super.getConfiguration();
         cfg.setDeploymentSpi(new LocalDeploymentSpi());
 
-        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setHeartbeatFrequency(500);
-
-        cfg.setDeploymentMode(depMode);
+        cfg.setMetricsUpdateFrequency(500);
 
         cfg.setDeploymentMode(depMode);
 
@@ -539,4 +537,4 @@ public class ExternalNonSpringAopSelfTest extends GridCommonAbstractTest {
     @Override public String getTestIgniteInstanceName() {
         return "ExternalAopTarget";
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/clients/src/test/resources/spring-cache.xml
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/resources/spring-cache.xml b/modules/clients/src/test/resources/spring-cache.xml
index 4dbae6e..8cbc688 100644
--- a/modules/clients/src/test/resources/spring-cache.xml
+++ b/modules/clients/src/test/resources/spring-cache.xml
@@ -148,7 +148,6 @@
                         <property name="bucketName" value="YOUR_BUCKET_NAME_IP_FINDER"/>
                     </bean>
                 </property>
-                <property name="heartbeatFrequency" value="2000"/>
             </bean>
         </property>
         -->

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java
index 50c09be..7dd4707 100644
--- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java
@@ -29,8 +29,8 @@ import org.apache.ignite.configuration.IgniteConfiguration;
  * <p>
  * Node metrics for any node can be accessed via {@link ClusterNode#metrics()}
  * method. Keep in mind that there will be a certain network delay (usually
- * equal to heartbeat delay) for the accuracy of node metrics. However, when accessing
- * metrics on local node {@link IgniteCluster#localNode() Grid.localNode().getMetrics()}
+ * equal to metrics update delay) for the accuracy of node metrics. However, when accessing
+ * metrics on local node {@link IgniteCluster#localNode() IgniteCluster.localNode().getMetrics()}
  * the metrics are always accurate and up to date.
  * <p>
  * Local node metrics are registered as {@code MBean} and can be accessed from

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
index bfc395d..e122ff6 100644
--- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
+++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
@@ -87,9 +87,8 @@ import org.jetbrains.annotations.Nullable;
  * <h1 class="header">Cluster Node Metrics</h1>
  * Cluster node metrics (see {@link #metrics()}) are updated frequently for all nodes
  * and can be used to get dynamic information about a node. The frequency of update
- * is often directly related to the heartbeat exchange between nodes. So if, for example,
- * default {@link org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi} is used,
- * the metrics data will be updated every {@code 2} seconds by default.
+ * is controlled by  {@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsUpdateFrequency()} parameter.
+ * The metrics data will be updated every {@code 2} seconds by default.
  * <p>
  * Grid node metrics provide information that can frequently change,
  * such as Heap and Non-Heap memory utilization, CPU load, number of active and waiting
@@ -145,9 +144,9 @@ public interface ClusterNode {
      * method and use it during {@link org.apache.ignite.compute.ComputeTask#map(List, Object)} or during collision
      * resolution.
      * <p>
-     * Node metrics are updated with some delay which is directly related to heartbeat
-     * frequency. For example, when used with default
-     * {@link org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi} the update will happen every {@code 2} seconds.
+     * Node metrics are updated with some delay which is controlled by
+     * {@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsUpdateFrequency()} parameter.
+     * By default the update will happen every {@code 2} seconds.
      *
      * @return Runtime metrics snapshot for this node.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index 17927b9..9f68399 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -200,6 +200,10 @@ public class IgniteConfiguration {
     @SuppressWarnings("UnnecessaryBoxing")
     public static final Long DFLT_FAILURE_DETECTION_TIMEOUT = new Long(10_000);
 
+    /** Default failure detection timeout for client nodes in millis. */
+    @SuppressWarnings("UnnecessaryBoxing")
+    public static final Long DFLT_CLIENT_FAILURE_DETECTION_TIMEOUT = new Long(30_000);
+
     /** Optional local Ignite instance name. */
     private String igniteInstanceName;
 
@@ -386,6 +390,9 @@ public class IgniteConfiguration {
     /** Failure detection timeout. */
     private Long failureDetectionTimeout = DFLT_FAILURE_DETECTION_TIMEOUT;
 
+    /** Failure detection timeout for client nodes. */
+    private Long clientFailureDetectionTimeout = DFLT_CLIENT_FAILURE_DETECTION_TIMEOUT;
+
     /** Property names to include into node attributes. */
     private String[] includeProps;
 
@@ -491,6 +498,7 @@ public class IgniteConfiguration {
         cacheSanityCheckEnabled = cfg.isCacheSanityCheckEnabled();
         callbackPoolSize = cfg.getAsyncCallbackPoolSize();
         classLdr = cfg.getClassLoader();
+        clientFailureDetectionTimeout = cfg.getClientFailureDetectionTimeout();
         clientMode = cfg.isClientMode();
         connectorCfg = cfg.getConnectorConfiguration();
         consistentId = cfg.getConsistentId();
@@ -1288,20 +1296,13 @@ public class IgniteConfiguration {
     }
 
     /**
-     * Gets job metrics update frequency in milliseconds.
+     * Gets Ignite metrics update frequency in milliseconds.
      * <p>
      * Updating metrics too frequently may have negative performance impact.
      * <p>
-     * The following values are accepted:
-     * <ul>
-     *     <li>{@code -1} job metrics are never updated.</li>
-     *     <li>{@code 0} job metrics are updated on each job start and finish.</li>
-     *     <li>Positive value defines the actual update frequency. If not provided, then default value
-     *     {@link #DFLT_METRICS_UPDATE_FREQ} is used.</li>
-     * </ul>
      * If not provided, then default value {@link #DFLT_METRICS_UPDATE_FREQ} is used.
      *
-     * @return Job metrics update frequency in milliseconds.
+     * @return Metrics update frequency in milliseconds.
      * @see #DFLT_METRICS_UPDATE_FREQ
      */
     public long getMetricsUpdateFrequency() {
@@ -1309,15 +1310,13 @@ public class IgniteConfiguration {
     }
 
     /**
-     * Sets job metrics update frequency in milliseconds.
+     * Sets Ignite metrics update frequency in milliseconds.
      * <p>
-     * If set to {@code -1} job metrics are never updated.
-     * If set to {@code 0} job metrics are updated on each job start and finish.
      * Positive value defines the actual update frequency.
      * If not provided, then default value
      * {@link #DFLT_METRICS_UPDATE_FREQ} is used.
      *
-     * @param metricsUpdateFreq Job metrics update frequency in milliseconds.
+     * @param metricsUpdateFreq Metrics update frequency in milliseconds.
      * @return {@code this} for chaining.
      */
     public IgniteConfiguration setMetricsUpdateFrequency(long metricsUpdateFreq) {
@@ -1835,6 +1834,33 @@ public class IgniteConfiguration {
     }
 
     /**
+     * Returns failure detection timeout for client nodes used by {@link TcpDiscoverySpi} and {@link TcpCommunicationSpi}.
+     * <p>
+     * Default is {@link #DFLT_CLIENT_FAILURE_DETECTION_TIMEOUT}.
+     *
+     * @see #setClientFailureDetectionTimeout(long)
+     * @return Failure detection timeout for client nodes in milliseconds.
+     */
+    public Long getClientFailureDetectionTimeout() {
+        return clientFailureDetectionTimeout;
+    }
+
+    /**
+     * Sets failure detection timeout to use in {@link TcpDiscoverySpi} and {@link TcpCommunicationSpi}.
+     * <p>
+     * Failure detection timeout is used to determine how long the communication or discovery SPIs should wait before
+     * considering a remote connection failed.
+     *
+     * @param clientFailureDetectionTimeout Failure detection timeout in milliseconds.
+     * @return {@code this} for chaining.
+     */
+    public IgniteConfiguration setClientFailureDetectionTimeout(long clientFailureDetectionTimeout) {
+        this.clientFailureDetectionTimeout = clientFailureDetectionTimeout;
+
+        return this;
+    }
+
+    /**
      * Returns failure detection timeout used by {@link TcpDiscoverySpi} and {@link TcpCommunicationSpi}.
      * <p>
      * Default is {@link #DFLT_FAILURE_DETECTION_TIMEOUT}.

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/events/EventType.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/events/EventType.java b/modules/core/src/main/java/org/apache/ignite/events/EventType.java
index e506371..1960692 100644
--- a/modules/core/src/main/java/org/apache/ignite/events/EventType.java
+++ b/modules/core/src/main/java/org/apache/ignite/events/EventType.java
@@ -136,7 +136,7 @@ public interface EventType {
      * Built-in event type: node metrics updated.
      * <br>
      * Generated when node's metrics are updated. In most cases this callback
-     * is invoked with every heartbeat received from a node (including local node).
+     * is invoked with every metrics update received from a node (including local node).
      * <p>
      * NOTE: all types in range <b>from 1 to 1000 are reserved</b> for
      * internal Ignite events and should not be used by user-defined events.

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
index 369ca22..e0bc4d2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobProcessor.java
@@ -855,8 +855,7 @@ public class GridJobProcessor extends GridProcessorAdapter {
                     }
                 });
 
-            if (metricsUpdateFreq > -1L)
-                updateJobMetrics();
+            updateJobMetrics();
         }
         finally {
             handlingCollision.set(Boolean.FALSE);
@@ -867,24 +866,21 @@ public class GridJobProcessor extends GridProcessorAdapter {
      *
      */
     private void updateJobMetrics() {
-        assert metricsUpdateFreq > -1L;
+        assert metricsUpdateFreq > 0L;
 
-        if (metricsUpdateFreq == 0L)
+        long now = U.currentTimeMillis();
+        long lastUpdate = metricsLastUpdateTstamp.get();
+
+        if (now - lastUpdate > metricsUpdateFreq && metricsLastUpdateTstamp.compareAndSet(lastUpdate, now))
             updateJobMetrics0();
-        else {
-            long now = U.currentTimeMillis();
-            long lastUpdate = metricsLastUpdateTstamp.get();
 
-            if (now - lastUpdate > metricsUpdateFreq && metricsLastUpdateTstamp.compareAndSet(lastUpdate, now))
-                updateJobMetrics0();
-        }
     }
 
     /**
      *
      */
     private void updateJobMetrics0() {
-        assert metricsUpdateFreq > -1L;
+        assert metricsUpdateFreq > 0L;
 
         GridJobMetricsSnapshot m = new GridJobMetricsSnapshot();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index 4186eb9..eb3e716 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
@@ -531,7 +531,8 @@ public class PlatformConfigurationUtils {
         if (in.readBoolean())
             cfg.setClientMode(in.readBoolean());
         int[] eventTypes = in.readIntArray();
-        if (eventTypes != null) cfg.setIncludeEventTypes(eventTypes);
+        if (eventTypes != null)
+            cfg.setIncludeEventTypes(eventTypes);
         if (in.readBoolean())
             cfg.setMetricsExpireTime(in.readLong());
         if (in.readBoolean())
@@ -556,8 +557,10 @@ public class PlatformConfigurationUtils {
             cfg.setDaemon(in.readBoolean());
         if (in.readBoolean())
             cfg.setLateAffinityAssignment(in.readBoolean());
-        if (in.readBoolean())
+        if (in.readBoolean()) {
+            cfg.setClientFailureDetectionTimeout(in.readLong());
             cfg.setFailureDetectionTimeout(in.readLong());
+        }
 
         readCacheConfigurations(in, cfg);
         readDiscoveryConfiguration(in, cfg);
@@ -752,12 +755,9 @@ public class PlatformConfigurationUtils {
         disco.setReconnectCount(in.readInt());
         disco.setLocalPort(in.readInt());
         disco.setLocalPortRange(in.readInt());
-        disco.setMaxMissedHeartbeats(in.readInt());
-        disco.setMaxMissedClientHeartbeats(in.readInt());
         disco.setStatisticsPrintFrequency(in.readLong());
         disco.setIpFinderCleanFrequency(in.readLong());
         disco.setThreadPriority(in.readInt());
-        disco.setHeartbeatFrequency(in.readLong());
         disco.setTopHistorySize(in.readInt());
 
         cfg.setDiscoverySpi(disco);
@@ -960,7 +960,8 @@ public class PlatformConfigurationUtils {
         w.writeLong(cfg.getMetricsUpdateFrequency());
         w.writeBoolean(true);
         w.writeInt(cfg.getNetworkSendRetryCount());
-        w.writeBoolean(true);w.writeLong(cfg.getNetworkSendRetryDelay());
+        w.writeBoolean(true);
+        w.writeLong(cfg.getNetworkSendRetryDelay());
         w.writeBoolean(true);
         w.writeLong(cfg.getNetworkTimeout());
         w.writeString(cfg.getWorkDirectory());
@@ -970,6 +971,7 @@ public class PlatformConfigurationUtils {
         w.writeBoolean(true);
         w.writeBoolean(cfg.isLateAffinityAssignment());
         w.writeBoolean(true);
+        w.writeLong(cfg.getClientFailureDetectionTimeout());
         w.writeLong(cfg.getFailureDetectionTimeout());
 
         CacheConfiguration[] cacheCfg = cfg.getCacheConfiguration();
@@ -1063,17 +1065,17 @@ public class PlatformConfigurationUtils {
         else
             w.writeBoolean(false);
 
-        EventStorageSpi eventStorageSpi = cfg.getEventStorageSpi();
+        EventStorageSpi evtStorageSpi = cfg.getEventStorageSpi();
 
-        if (eventStorageSpi == null) {
+        if (evtStorageSpi == null)
             w.writeByte((byte) 0);
-        } else if (eventStorageSpi instanceof NoopEventStorageSpi) {
+        else if (evtStorageSpi instanceof NoopEventStorageSpi)
             w.writeByte((byte) 1);
-        } else if (eventStorageSpi instanceof MemoryEventStorageSpi) {
+        else if (evtStorageSpi instanceof MemoryEventStorageSpi) {
             w.writeByte((byte) 2);
 
-            w.writeLong(((MemoryEventStorageSpi)eventStorageSpi).getExpireCount());
-            w.writeLong(((MemoryEventStorageSpi)eventStorageSpi).getExpireAgeMs());
+            w.writeLong(((MemoryEventStorageSpi)evtStorageSpi).getExpireCount());
+            w.writeLong(((MemoryEventStorageSpi)evtStorageSpi).getExpireAgeMs());
         }
 
         writeMemoryConfiguration(w, cfg.getMemoryConfiguration());
@@ -1135,9 +1137,8 @@ public class PlatformConfigurationUtils {
                     w.writeInt(ttl);
             }
         }
-        else {
+        else
             w.writeBoolean(false);
-        }
 
         w.writeLong(tcp.getSocketTimeout());
         w.writeLong(tcp.getAckTimeout());
@@ -1151,12 +1152,9 @@ public class PlatformConfigurationUtils {
         w.writeInt(tcp.getReconnectCount());
         w.writeInt(tcp.getLocalPort());
         w.writeInt(tcp.getLocalPortRange());
-        w.writeInt(tcp.getMaxMissedHeartbeats());
-        w.writeInt(tcp.getMaxMissedClientHeartbeats());
         w.writeLong(tcp.getStatisticsPrintFrequency());
         w.writeLong(tcp.getIpFinderCleanFrequency());
         w.writeInt(tcp.getThreadPriority());
-        w.writeLong(tcp.getHeartbeatFrequency());
         w.writeInt((int)tcp.getTopHistorySize());
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
index ec56f4f..81f5c28 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiAdapter.java
@@ -95,6 +95,12 @@ public abstract class IgniteSpiAdapter implements IgniteSpi {
     private boolean failureDetectionTimeoutEnabled = true;
 
     /**
+     * Failure detection timeout for client nodes. Initialized with the value of
+     * {@link IgniteConfiguration#getClientFailureDetectionTimeout()}.
+     */
+    private long clientFailureDetectionTimeout;
+
+    /**
      * Failure detection timeout. Initialized with the value of
      * {@link IgniteConfiguration#getFailureDetectionTimeout()}.
      */
@@ -648,12 +654,29 @@ public abstract class IgniteSpiAdapter implements IgniteSpi {
                 // Because U.currentTimeInMillis() is updated once in 10 milliseconds.
                 log.warning("Failure detection timeout is too low, it may lead to unpredictable behaviour " +
                     "[failureDetectionTimeout=" + failureDetectionTimeout + ']');
+            else if (failureDetectionTimeout <= ignite.configuration().getMetricsUpdateFrequency())
+                log.warning("'IgniteConfiguration.failureDetectionTimeout' should be greater then " +
+                    "'IgniteConfiguration.metricsUpdateFrequency' to prevent unnecessary status checking.");
         }
         // Intentionally compare references using '!=' below
         else if (ignite.configuration().getFailureDetectionTimeout() !=
                 IgniteConfiguration.DFLT_FAILURE_DETECTION_TIMEOUT)
             log.warning("Failure detection timeout will be ignored (one of SPI parameters has been set explicitly)");
 
+        clientFailureDetectionTimeout = ignite.configuration().getClientFailureDetectionTimeout();
+
+        if (clientFailureDetectionTimeout <= 0)
+            throw new IgniteSpiException("Invalid client failure detection timeout value: " +
+                clientFailureDetectionTimeout);
+        else if (clientFailureDetectionTimeout <= 10)
+            // Because U.currentTimeInMillis() is updated once in 10 milliseconds.
+            log.warning("Client failure detection timeout is too low, it may lead to unpredictable behaviour " +
+                "[clientFailureDetectionTimeout=" + clientFailureDetectionTimeout + ']');
+
+        if (clientFailureDetectionTimeout < ignite.configuration().getMetricsUpdateFrequency())
+            throw new IgniteSpiException("Inconsistent configuration " +
+                "('IgniteConfiguration.clientFailureDetectionTimeout' must be greater or equal to " +
+                "'IgniteConfiguration.metricsUpdateFrequency').");
     }
 
     /**
@@ -675,6 +698,15 @@ public abstract class IgniteSpiAdapter implements IgniteSpi {
     }
 
     /**
+     * Returns client failure detection timeout set to use for network related operations.
+     *
+     * @return client failure detection timeout in milliseconds or {@code 0} if the timeout is disabled.
+     */
+    public long clientFailureDetectionTimeout() {
+        return clientFailureDetectionTimeout;
+    }
+
+    /**
      * Returns failure detection timeout set to use for network related operations.
      *
      * @return failure detection timeout in milliseconds or {@code 0} if the timeout is disabled.

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutHelper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutHelper.java b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutHelper.java
index e17b0dd..c685ea9 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutHelper.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/IgniteSpiOperationTimeoutHelper.java
@@ -45,10 +45,12 @@ public class IgniteSpiOperationTimeoutHelper {
      * Constructor.
      *
      * @param adapter SPI adapter.
+     * @param srvOp {@code True} if communicates with server node.
      */
-    public IgniteSpiOperationTimeoutHelper(IgniteSpiAdapter adapter) {
+    public IgniteSpiOperationTimeoutHelper(IgniteSpiAdapter adapter, boolean srvOp) {
         failureDetectionTimeoutEnabled = adapter.failureDetectionTimeoutEnabled();
-        failureDetectionTimeout = adapter.failureDetectionTimeout();
+        failureDetectionTimeout = srvOp ? adapter.failureDetectionTimeout() :
+            adapter.clientFailureDetectionTimeout();
     }
 
     /**
@@ -99,4 +101,4 @@ public class IgniteSpiOperationTimeoutHelper {
         return e instanceof IgniteSpiOperationTimeoutException || e instanceof SocketTimeoutException ||
             X.hasCause(e, IgniteSpiOperationTimeoutException.class, SocketException.class);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingCollisionSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingCollisionSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingCollisionSpi.java
index 8a02225..6f2c099 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingCollisionSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/collision/jobstealing/JobStealingCollisionSpi.java
@@ -88,7 +88,7 @@ import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
  * {@link org.apache.ignite.spi.failover.jobstealing.JobStealingFailoverSpi JobStealingFailoverSpi}.
  * Also note that job metrics update should be enabled in order for this SPI
  * to work properly (i.e. {@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsUpdateFrequency() IgniteConfiguration#getMetricsUpdateFrequency()}
- * should be set to {@code 0} or greater value).
+ * should be set to positive value).
  * The responsibility of Job Stealing Failover SPI is to properly route <b>stolen</b>
  * jobs to the nodes that initially requested (<b>stole</b>) these jobs. The
  * SPI maintains a counter of how many times a jobs was stolen and

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 1fedf83..be897d6 100755
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -2727,7 +2727,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
 
         long connTimeout0 = connTimeout;
 
-        IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(this);
+        IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(this,
+            !node.isClient());
 
         while (true) {
             GridCommunicationClient client;
@@ -2918,7 +2919,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
 
             int attempt = 1;
 
-            IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(this);
+            IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(this,
+                !node.isClient());
 
             while (!conn) { // Reconnection on handshake timeout.
                 try {

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index 34ee414..b5b4c77 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -81,7 +81,7 @@ import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAuthFailedMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCheckFailedMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientAckResponse;
-import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientHeartbeatMessage;
+import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientMetricsUpdateMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientPingRequest;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientPingResponse;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientReconnectMessage;
@@ -89,7 +89,7 @@ import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCustomEventMessa
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryDuplicateIdMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryHandshakeRequest;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryHandshakeResponse;
-import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryHeartbeatMessage;
+import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryMetricsUpdateMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryJoinRequestMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeAddFinishedMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeAddedMessage;
@@ -272,9 +272,9 @@ class ClientImpl extends TcpDiscoveryImpl {
         }
 
         timer.schedule(
-            new HeartbeatSender(),
-            spi.hbFreq,
-            spi.hbFreq);
+            new MetricsSender(),
+            spi.metricsUpdateFreq,
+            spi.metricsUpdateFreq);
 
         spi.printStartInfo();
     }
@@ -597,7 +597,7 @@ class ClientImpl extends TcpDiscoveryImpl {
 
         UUID locNodeId = getLocalNodeId();
 
-        IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi);
+        IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi, true);
 
         while (true) {
             boolean openSock = false;
@@ -861,13 +861,14 @@ class ClientImpl extends TcpDiscoveryImpl {
     }
 
     /**
-     * Heartbeat sender.
+     * Metrics sender.
      */
-    private class HeartbeatSender extends TimerTask {
+    private class MetricsSender extends TimerTask {
         /** {@inheritDoc} */
         @Override public void run() {
             if (!spi.getSpiContext().isStopping() && sockWriter.isOnline()) {
-                TcpDiscoveryClientHeartbeatMessage msg = new TcpDiscoveryClientHeartbeatMessage(getLocalNodeId(),
+                TcpDiscoveryClientMetricsUpdateMessage msg = new TcpDiscoveryClientMetricsUpdateMessage(
+                    getLocalNodeId(),
                     spi.metricsProvider.metrics());
 
                 msg.client(true);
@@ -1829,8 +1830,8 @@ class ClientImpl extends TcpDiscoveryImpl {
                 processNodeLeftMessage((TcpDiscoveryNodeLeftMessage)msg);
             else if (msg instanceof TcpDiscoveryNodeFailedMessage)
                 processNodeFailedMessage((TcpDiscoveryNodeFailedMessage)msg);
-            else if (msg instanceof TcpDiscoveryHeartbeatMessage)
-                processHeartbeatMessage((TcpDiscoveryHeartbeatMessage)msg);
+            else if (msg instanceof TcpDiscoveryMetricsUpdateMessage)
+                processMetricsUpdateMessage((TcpDiscoveryMetricsUpdateMessage)msg);
             else if (msg instanceof TcpDiscoveryClientReconnectMessage)
                 processClientReconnectMessage((TcpDiscoveryClientReconnectMessage)msg);
             else if (msg instanceof TcpDiscoveryCustomEventMessage)
@@ -2152,7 +2153,7 @@ class ClientImpl extends TcpDiscoveryImpl {
         /**
          * @param msg Message.
          */
-        private void processHeartbeatMessage(TcpDiscoveryHeartbeatMessage msg) {
+        private void processMetricsUpdateMessage(TcpDiscoveryMetricsUpdateMessage msg) {
             if (spi.getSpiContext().isStopping())
                 return;
 
@@ -2160,16 +2161,16 @@ class ClientImpl extends TcpDiscoveryImpl {
                 assert msg.senderNodeId() != null;
 
                 if (log.isDebugEnabled())
-                    log.debug("Received heartbeat response: " + msg);
+                    log.debug("Received metrics response: " + msg);
             }
             else {
                 long tstamp = U.currentTimeMillis();
 
                 if (msg.hasMetrics()) {
-                    for (Map.Entry<UUID, TcpDiscoveryHeartbeatMessage.MetricsSet> e : msg.metrics().entrySet()) {
+                    for (Map.Entry<UUID, TcpDiscoveryMetricsUpdateMessage.MetricsSet> e : msg.metrics().entrySet()) {
                         UUID nodeId = e.getKey();
 
-                        TcpDiscoveryHeartbeatMessage.MetricsSet metricsSet = e.getValue();
+                        TcpDiscoveryMetricsUpdateMessage.MetricsSet metricsSet = e.getValue();
 
                         Map<Integer, CacheMetrics> cacheMetrics = msg.hasCacheMetrics(nodeId) ?
                             msg.cacheMetrics().get(nodeId) : Collections.<Integer, CacheMetrics>emptyMap();

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 47c13e1..6a10ec2 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -106,7 +106,7 @@ import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAbstractMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryAuthFailedMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryCheckFailedMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientAckResponse;
-import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientHeartbeatMessage;
+import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientMetricsUpdateMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientPingRequest;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientPingResponse;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryClientReconnectMessage;
@@ -116,7 +116,7 @@ import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryDiscardMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryDuplicateIdMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryHandshakeRequest;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryHandshakeResponse;
-import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryHeartbeatMessage;
+import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryMetricsUpdateMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryJoinRequestMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryLoopbackProblemMessage;
 import org.apache.ignite.spi.discovery.tcp.messages.TcpDiscoveryNodeAddFinishedMessage;
@@ -612,7 +612,8 @@ class ServerImpl extends TcpDiscoveryImpl {
 
         UUID locNodeId = getLocalNodeId();
 
-        IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi);
+        IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi,
+            clientNodeId == null);
 
         if (F.contains(spi.locNodeAddrs, addr)) {
             if (clientNodeId == null)
@@ -991,7 +992,9 @@ class ServerImpl extends TcpDiscoveryImpl {
 
             for (InetSocketAddress addr : addrs) {
                 try {
-                    Integer res = sendMessageDirectly(joinReq, addr);
+                    IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi, true);
+
+                    Integer res = sendMessageDirectly(joinReq, addr, timeoutHelper);
 
                     assert res != null;
 
@@ -1104,10 +1107,12 @@ class ServerImpl extends TcpDiscoveryImpl {
      *
      * @param msg Message to send.
      * @param addr Address to send message to.
+     * @param timeoutHelper Operation timeout helper.
      * @return Response read from the recipient or {@code null} if no response is supposed.
      * @throws IgniteSpiException If an error occurs.
      */
-    @Nullable private Integer sendMessageDirectly(TcpDiscoveryAbstractMessage msg, InetSocketAddress addr)
+    @Nullable private Integer sendMessageDirectly(TcpDiscoveryAbstractMessage msg, InetSocketAddress addr,
+        IgniteSpiOperationTimeoutHelper timeoutHelper)
         throws IgniteSpiException {
         assert msg != null;
         assert addr != null;
@@ -1124,8 +1129,6 @@ class ServerImpl extends TcpDiscoveryImpl {
 
         UUID locNodeId = getLocalNodeId();
 
-        IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi);
-
         int reconCnt = 0;
 
         while (true){
@@ -1731,7 +1734,7 @@ class ServerImpl extends TcpDiscoveryImpl {
      * @return {@code True} if recordable in debug mode.
      */
     private boolean recordable(TcpDiscoveryAbstractMessage msg) {
-        return !(msg instanceof TcpDiscoveryHeartbeatMessage) &&
+        return !(msg instanceof TcpDiscoveryMetricsUpdateMessage) &&
             !(msg instanceof TcpDiscoveryStatusCheckMessage) &&
             !(msg instanceof TcpDiscoveryDiscardMessage) &&
             !(msg instanceof TcpDiscoveryConnectionCheckMessage);
@@ -1759,7 +1762,7 @@ class ServerImpl extends TcpDiscoveryImpl {
      * @param msg Message.
      * @param nodeId Node ID.
      */
-    private static void removeMetrics(TcpDiscoveryHeartbeatMessage msg, UUID nodeId) {
+    private static void removeMetrics(TcpDiscoveryMetricsUpdateMessage msg, UUID nodeId) {
         msg.removeMetrics(nodeId);
         msg.removeCacheMetrics(nodeId);
     }
@@ -2384,11 +2387,11 @@ class ServerImpl extends TcpDiscoveryImpl {
         /** Last time status message has been sent. */
         private long lastTimeStatusMsgSent;
 
-        /** Incoming heartbeats check frequency. */
-        private long hbCheckFreq = (long)spi.maxMissedHbs * spi.hbFreq + 50;
+        /** Incoming metrics check frequency. */
+        private long metricsCheckFreq = 3 * spi.metricsUpdateFreq + 50;
 
-        /** Last time heartbeat message has been sent. */
-        private long lastTimeHbMsgSent;
+        /** Last time metrics update message has been sent. */
+        private long lastTimeMetricsUpdateMsgSent;
 
         /** Time when the last status message has been sent. */
         private long lastTimeConnCheckMsgSent;
@@ -2483,7 +2486,7 @@ class ServerImpl extends TcpDiscoveryImpl {
             if (spi.failureDetectionTimeoutEnabled())
                 connCheckThreshold = spi.failureDetectionTimeout();
             else
-                connCheckThreshold = Math.min(spi.getSocketTimeout(), spi.getHeartbeatFrequency());
+                connCheckThreshold = Math.min(spi.getSocketTimeout(), spi.metricsUpdateFreq);
 
             for (int i = 3; i > 0; i--) {
                 connCheckFreq = connCheckThreshold / i;
@@ -2502,7 +2505,7 @@ class ServerImpl extends TcpDiscoveryImpl {
          * @param msg Message to process.
          */
         @Override protected void processMessage(TcpDiscoveryAbstractMessage msg) {
-            sendHeartbeatMessage();
+            sendMetricsUpdateMessage();
 
             DebugLogger log = messageLogger(msg);
 
@@ -2555,8 +2558,8 @@ class ServerImpl extends TcpDiscoveryImpl {
             else if (msg instanceof TcpDiscoveryNodeFailedMessage)
                 processNodeFailedMessage((TcpDiscoveryNodeFailedMessage)msg);
 
-            else if (msg instanceof TcpDiscoveryHeartbeatMessage)
-                processHeartbeatMessage((TcpDiscoveryHeartbeatMessage)msg);
+            else if (msg instanceof TcpDiscoveryMetricsUpdateMessage)
+                processMetricsUpdateMessage((TcpDiscoveryMetricsUpdateMessage)msg);
 
             else if (msg instanceof TcpDiscoveryStatusCheckMessage)
                 processStatusCheckMessage((TcpDiscoveryStatusCheckMessage)msg);
@@ -2594,9 +2597,9 @@ class ServerImpl extends TcpDiscoveryImpl {
 
             checkConnection();
 
-            sendHeartbeatMessage();
+            sendMetricsUpdateMessage();
 
-            checkHeartbeatsReceiving();
+            checkMetricsReceiving();
 
             checkPendingCustomMessages();
 
@@ -2750,7 +2753,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                     while (true) {
                         if (sock == null) {
                             if (timeoutHelper == null)
-                                timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi);
+                                timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi, true);
 
                             nextNodeExists = false;
 
@@ -2918,7 +2921,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                                         pendingMsgs.discardId, pendingMsgs.customDiscardId);
 
                                     if (timeoutHelper == null)
-                                        timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi);
+                                        timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi, true);
 
                                     try {
                                         spi.writeToSocket(sock, out, pendingMsg, timeoutHelper.nextTimeoutChunk(
@@ -2958,7 +2961,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                                 long tstamp = U.currentTimeMillis();
 
                                 if (timeoutHelper == null)
-                                    timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi);
+                                    timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi, true);
 
                                 if (!failedNodes.isEmpty()) {
                                     for (TcpDiscoveryNode failedNode : failedNodes) {
@@ -3817,7 +3820,9 @@ class ServerImpl extends TcpDiscoveryImpl {
 
             for (InetSocketAddress addr : spi.getNodeAddresses(node, U.sameMacs(locNode, node))) {
                 try {
-                    sendMessageDirectly(msg, addr);
+                    IgniteSpiOperationTimeoutHelper timeoutHelper = new IgniteSpiOperationTimeoutHelper(spi, true);
+
+                    sendMessageDirectly(msg, addr, timeoutHelper);
 
                     node.lastSuccessfulAddress(addr);
 
@@ -3853,7 +3858,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                 if (node != null) {
                     node.clientRouterNodeId(msg.routerNodeId());
-                    node.aliveCheck(spi.maxMissedClientHbs);
+                    node.clientAliveTime(spi.clientFailureDetectionTimeout());
                 }
 
                 if (isLocalNodeCoordinator()) {
@@ -4083,7 +4088,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                 }
 
                 if (msg.client())
-                    node.aliveCheck(spi.maxMissedClientHbs);
+                    node.clientAliveTime(spi.clientFailureDetectionTimeout());
 
                 boolean topChanged = ring.add(node);
 
@@ -4830,7 +4835,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                 }
 
                 if (locNodeId.equals(msg.creatorNodeId()) && msg.senderNodeId() == null &&
-                    U.currentTimeMillis() - locNode.lastUpdateTime() < spi.hbFreq) {
+                    U.currentTimeMillis() - locNode.lastUpdateTime() < spi.metricsUpdateFreq) {
                     if (log.isDebugEnabled())
                         log.debug("Status check message discarded (local node receives updates).");
 
@@ -4873,11 +4878,11 @@ class ServerImpl extends TcpDiscoveryImpl {
         }
 
         /**
-         * Processes regular heartbeat message.
+         * Processes regular metrics update message.
          *
-         * @param msg Heartbeat message.
+         * @param msg Metrics update message.
          */
-        private void processHeartbeatMessage(TcpDiscoveryHeartbeatMessage msg) {
+        private void processMetricsUpdateMessage(TcpDiscoveryMetricsUpdateMessage msg) {
             assert msg != null;
 
             assert !msg.client();
@@ -4886,7 +4891,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
             if (ring.node(msg.creatorNodeId()) == null) {
                 if (log.isDebugEnabled())
-                    log.debug("Discarding heartbeat message issued by unknown node [msg=" + msg +
+                    log.debug("Discarding metrics update message issued by unknown node [msg=" + msg +
                         ", ring=" + ring + ']');
 
                 return;
@@ -4894,14 +4899,14 @@ class ServerImpl extends TcpDiscoveryImpl {
 
             if (isLocalNodeCoordinator() && !locNodeId.equals(msg.creatorNodeId())) {
                 if (log.isDebugEnabled())
-                    log.debug("Discarding heartbeat message issued by non-coordinator node: " + msg);
+                    log.debug("Discarding metrics update message issued by non-coordinator node: " + msg);
 
                 return;
             }
 
             if (!isLocalNodeCoordinator() && locNodeId.equals(msg.creatorNodeId())) {
                 if (log.isDebugEnabled())
-                    log.debug("Discarding heartbeat message issued by local node (node is no more coordinator): " +
+                    log.debug("Discarding metrics update message issued by local node (node is no more coordinator): " +
                         msg);
 
                 return;
@@ -4909,7 +4914,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
             if (locNodeId.equals(msg.creatorNodeId()) && !hasMetrics(msg, locNodeId) && msg.senderNodeId() != null) {
                 if (log.isTraceEnabled())
-                    log.trace("Discarding heartbeat message that has made two passes: " + msg);
+                    log.trace("Discarding metrics update message that has made two passes: " + msg);
 
                 return;
             }
@@ -4918,10 +4923,10 @@ class ServerImpl extends TcpDiscoveryImpl {
 
             if (spiStateCopy() == CONNECTED) {
                 if (msg.hasMetrics()) {
-                    for (Map.Entry<UUID, TcpDiscoveryHeartbeatMessage.MetricsSet> e : msg.metrics().entrySet()) {
+                    for (Map.Entry<UUID, TcpDiscoveryMetricsUpdateMessage.MetricsSet> e : msg.metrics().entrySet()) {
                         UUID nodeId = e.getKey();
 
-                        TcpDiscoveryHeartbeatMessage.MetricsSet metricsSet = e.getValue();
+                        TcpDiscoveryMetricsUpdateMessage.MetricsSet metricsSet = e.getValue();
 
                         Map<Integer, CacheMetrics> cacheMetrics = msg.hasCacheMetrics(nodeId) ?
                             msg.cacheMetrics().get(nodeId) : Collections.<Integer, CacheMetrics>emptyMap();
@@ -4960,11 +4965,11 @@ class ServerImpl extends TcpDiscoveryImpl {
                     for (TcpDiscoveryNode clientNode : ring.clientNodes()) {
                         if (clientNode.visible()) {
                             if (clientNodeIds.contains(clientNode.id()))
-                                clientNode.aliveCheck(spi.maxMissedClientHbs);
+                                clientNode.clientAliveTime(spi.clientFailureDetectionTimeout());
                             else {
-                                int aliveCheck = clientNode.decrementAliveCheck();
+                                boolean aliveCheck = clientNode.isClientAlive();
 
-                                if (aliveCheck <= 0 && isLocalNodeCoordinator()) {
+                                if (!aliveCheck && isLocalNodeCoordinator()) {
                                     boolean failedNode;
 
                                     synchronized (mux) {
@@ -4972,6 +4977,12 @@ class ServerImpl extends TcpDiscoveryImpl {
                                     }
 
                                     if (!failedNode) {
+                                        U.warn(log, "Failing client node due to not receiving metrics updates " +
+                                            "from client node within " +
+                                            "'IgniteConfiguration.clientFailureDetectionTimeout' " +
+                                            "(consider increasing configuration property) " +
+                                            "[timeout=" + spi.clientFailureDetectionTimeout() + ", node=" + clientNode + ']');
+
                                         TcpDiscoveryNodeFailedMessage nodeFailedMsg = new TcpDiscoveryNodeFailedMessage(
                                             locNodeId, clientNode.id(), clientNode.internalOrder());
 
@@ -5027,7 +5038,7 @@ class ServerImpl extends TcpDiscoveryImpl {
         /**
          * @param msg Message.
          */
-        private boolean hasMetrics(TcpDiscoveryHeartbeatMessage msg, UUID nodeId) {
+        private boolean hasMetrics(TcpDiscoveryMetricsUpdateMessage msg, UUID nodeId) {
             return msg.hasMetrics(nodeId) || msg.hasCacheMetrics(nodeId);
         }
 
@@ -5338,34 +5349,34 @@ class ServerImpl extends TcpDiscoveryImpl {
         }
 
         /**
-         * Sends heartbeat message if needed.
+         * Sends metrics update message if needed.
          */
-        private void sendHeartbeatMessage() {
-            long elapsed = (lastTimeHbMsgSent + spi.hbFreq) - U.currentTimeMillis();
+        private void sendMetricsUpdateMessage() {
+            long elapsed = (lastTimeMetricsUpdateMsgSent + spi.metricsUpdateFreq) - U.currentTimeMillis();
 
             if (elapsed > 0 || !isLocalNodeCoordinator())
                 return;
 
-            TcpDiscoveryHeartbeatMessage msg = new TcpDiscoveryHeartbeatMessage(getConfiguredNodeId());
+            TcpDiscoveryMetricsUpdateMessage msg = new TcpDiscoveryMetricsUpdateMessage(getConfiguredNodeId());
 
             msg.verify(getLocalNodeId());
 
             msgWorker.addMessage(msg);
 
-            lastTimeHbMsgSent = U.currentTimeMillis();
+            lastTimeMetricsUpdateMsgSent = U.currentTimeMillis();
         }
 
         /**
-         * Check the last time a heartbeat message received. If the time is bigger than {@code hbCheckTimeout} than
-         * {@link TcpDiscoveryStatusCheckMessage} is sent across the ring.
+         * Checks the last time a metrics update message received. If the time is bigger than {@code metricsCheckFreq}
+         * than {@link TcpDiscoveryStatusCheckMessage} is sent across the ring.
          */
-        private void checkHeartbeatsReceiving() {
+        private void checkMetricsReceiving() {
             if (lastTimeStatusMsgSent < locNode.lastUpdateTime())
                 lastTimeStatusMsgSent = locNode.lastUpdateTime();
 
             long updateTime = Math.max(lastTimeStatusMsgSent, lastRingMsgTime);
 
-            long elapsed = (updateTime + hbCheckFreq) - U.currentTimeMillis();
+            long elapsed = (updateTime + metricsCheckFreq) - U.currentTimeMillis();
 
             if (elapsed > 0)
                 return;
@@ -5548,6 +5559,8 @@ class ServerImpl extends TcpDiscoveryImpl {
 
             ClientMessageWorker clientMsgWrk = null;
 
+            boolean srvSock;
+
             try {
                 InputStream in;
 
@@ -5618,7 +5631,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                             TcpDiscoveryPingResponse res = new TcpDiscoveryPingResponse(locNodeId);
 
                             IgniteSpiOperationTimeoutHelper timeoutHelper =
-                                new IgniteSpiOperationTimeoutHelper(spi);
+                                new IgniteSpiOperationTimeoutHelper(spi, true);
 
                             if (req.clientNodeId() != null) {
                                 ClientMessageWorker clientWorker = clientMsgWorkers.get(req.clientNodeId());
@@ -5638,6 +5651,8 @@ class ServerImpl extends TcpDiscoveryImpl {
                     // Handshake.
                     TcpDiscoveryHandshakeRequest req = (TcpDiscoveryHandshakeRequest)msg;
 
+                    srvSock = !req.client();
+
                     UUID nodeId = req.creatorNodeId();
 
                     this.nodeId = nodeId;
@@ -5648,8 +5663,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                     if (req.client())
                         res.clientAck(true);
 
-                    spi.writeToSocket(sock, res, spi.failureDetectionTimeoutEnabled() ?
-                        spi.failureDetectionTimeout() : spi.getSocketTimeout());
+                    spi.writeToSocket(sock, res, spi.getEffectiveSocketTimeout(srvSock));
 
                     // It can happen if a remote node is stopped and it has a loopback address in the list of addresses,
                     // the local node sends a handshake request message on the loopback address, so we get here.
@@ -5764,8 +5778,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                     return;
                 }
 
-                long sockTimeout = spi.failureDetectionTimeoutEnabled() ? spi.failureDetectionTimeout() :
-                    spi.getSocketTimeout();
+                long sockTimeout = spi.getEffectiveSocketTimeout(srvSock);
 
                 while (!isInterrupted()) {
                     try {
@@ -5950,10 +5963,10 @@ class ServerImpl extends TcpDiscoveryImpl {
                             continue;
                         }
 
-                        TcpDiscoveryClientHeartbeatMessage heartbeatMsg = null;
+                        TcpDiscoveryClientMetricsUpdateMessage metricsUpdateMsg = null;
 
-                        if (msg instanceof TcpDiscoveryClientHeartbeatMessage)
-                            heartbeatMsg = (TcpDiscoveryClientHeartbeatMessage)msg;
+                        if (msg instanceof TcpDiscoveryClientMetricsUpdateMessage)
+                            metricsUpdateMsg = (TcpDiscoveryClientMetricsUpdateMessage)msg;
                         else
                             msgWorker.addMessage(msg);
 
@@ -5968,8 +5981,8 @@ class ServerImpl extends TcpDiscoveryImpl {
                         else
                             spi.writeToSocket(msg, sock, RES_OK, sockTimeout);
 
-                        if (heartbeatMsg != null)
-                            processClientHeartbeatMessage(heartbeatMsg);
+                        if (metricsUpdateMsg != null)
+                            processClientMetricsUpdateMessage(metricsUpdateMsg);
                     }
                     catch (IgniteCheckedException e) {
                         if (log.isDebugEnabled())
@@ -6037,11 +6050,11 @@ class ServerImpl extends TcpDiscoveryImpl {
         }
 
         /**
-         * Processes client heartbeat message.
+         * Processes client metrics update message.
          *
-         * @param msg Heartbeat message.
+         * @param msg Client metrics update message.
          */
-        private void processClientHeartbeatMessage(TcpDiscoveryClientHeartbeatMessage msg) {
+        private void processClientMetricsUpdateMessage(TcpDiscoveryClientMetricsUpdateMessage msg) {
             assert msg.client();
 
             ClientMessageWorker wrk = clientMsgWorkers.get(msg.creatorNodeId());
@@ -6049,7 +6062,7 @@ class ServerImpl extends TcpDiscoveryImpl {
             if (wrk != null)
                 wrk.metrics(msg.metrics());
             else if (log.isDebugEnabled())
-                log.debug("Received heartbeat message from unknown client node: " + msg);
+                log.debug("Received client metrics update message from unknown client node: " + msg);
         }
 
         /**
@@ -6286,7 +6299,7 @@ class ServerImpl extends TcpDiscoveryImpl {
                                 + getLocalNodeId() + ", rmtNodeId=" + clientNodeId + ", msg=" + msg + ']');
 
                         spi.writeToSocket(sock, msg, msgBytes, spi.failureDetectionTimeoutEnabled() ?
-                            spi.failureDetectionTimeout() : spi.getSocketTimeout());
+                            spi.clientFailureDetectionTimeout() : spi.getSocketTimeout());
                     }
                 }
                 else {
@@ -6296,8 +6309,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                     assert topologyInitialized(msg) : msg;
 
-                    spi.writeToSocket(sock, msg, msgBytes, spi.failureDetectionTimeoutEnabled() ?
-                        spi.failureDetectionTimeout() : spi.getSocketTimeout());
+                    spi.writeToSocket(sock, msg, msgBytes, spi.getEffectiveSocketTimeout(false));
                 }
 
                 boolean clientFailed = msg instanceof TcpDiscoveryNodeFailedMessage &&

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 25804c7..46d6f06 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -138,7 +138,6 @@ import static org.apache.ignite.IgniteSystemProperties.getBoolean;
  * configuration parameters may be used. As an example, for stable low-latency networks the following more aggressive
  * settings are recommended (which allows failure detection time ~200ms):
  * <ul>
- * <li>Heartbeat frequency (see {@link #setHeartbeatFrequency(long)}) - 100ms</li>
  * <li>Socket timeout (see {@link #setSocketTimeout(long)}) - 200ms</li>
  * <li>Message acknowledgement timeout (see {@link #setAckTimeout(long)}) - 50ms</li>
  * </ul>
@@ -166,8 +165,6 @@ import static org.apache.ignite.IgniteSystemProperties.getBoolean;
  * <li>Local port to bind to (see {@link #setLocalPort(int)})</li>
  * <li>Local port range to try binding to if previous ports are in use
  *      (see {@link #setLocalPortRange(int)})</li>
- * <li>Heartbeat frequency (see {@link #setHeartbeatFrequency(long)})</li>
- * <li>Max missed heartbeats (see {@link #setMaxMissedHeartbeats(int)})</li>
  * <li>Number of times node tries to (re)establish connection to another node
  *      (see {@link #setReconnectCount(int)})</li>
  * <li>Network timeout (see {@link #setNetworkTimeout(long)})</li>
@@ -241,8 +238,11 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi {
     /** Default value for thread priority (value is <tt>10</tt>). */
     public static final int DFLT_THREAD_PRI = 10;
 
-    /** Default heartbeat messages issuing frequency (value is <tt>2000ms</tt>). */
-    public static final long DFLT_HEARTBEAT_FREQ = 2000;
+    /**
+     * Default metrics update messages issuing frequency
+     * (value is {@link IgniteConfiguration#DFLT_METRICS_UPDATE_FREQ}).
+     */
+    public static final long DFLT_METRICS_UPDATE_FREQ = IgniteConfiguration.DFLT_METRICS_UPDATE_FREQ;
 
     /** Default size of topology snapshots history. */
     public static final int DFLT_TOP_HISTORY_SIZE = 1000;
@@ -262,12 +262,6 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi {
     /** Default reconnect attempts count (value is <tt>10</tt>). */
     public static final int DFLT_RECONNECT_CNT = 10;
 
-    /** Default max heartbeats count node can miss without initiating status check (value is <tt>1</tt>). */
-    public static final int DFLT_MAX_MISSED_HEARTBEATS = 1;
-
-    /** Default max heartbeats count node can miss without failing client node (value is <tt>5</tt>). */
-    public static final int DFLT_MAX_MISSED_CLIENT_HEARTBEATS = 5;
-
     /** Default IP finder clean frequency in milliseconds (value is <tt>60,000ms</tt>). */
     public static final long DFLT_IP_FINDER_CLEAN_FREQ = 60 * 1000;
 
@@ -302,8 +296,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi {
     /** Thread priority for all threads started by SPI. */
     protected int threadPri = DFLT_THREAD_PRI;
 
-    /** Heartbeat messages issuing frequency. */
-    protected long hbFreq = DFLT_HEARTBEAT_FREQ;
+    /** Metrics update messages issuing frequency. */
+    protected long metricsUpdateFreq = DFLT_METRICS_UPDATE_FREQ;
 
     /** Size of topology snapshots history. */
     protected int topHistSize = DFLT_TOP_HISTORY_SIZE;
@@ -361,12 +355,6 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi {
     /** Maximum message acknowledgement timeout. */
     private long maxAckTimeout = DFLT_MAX_ACK_TIMEOUT;
 
-    /** Max heartbeats count node can miss without initiating status check. */
-    protected int maxMissedHbs = DFLT_MAX_MISSED_HEARTBEATS;
-
-    /** Max heartbeats count node can miss without failing client node. */
-    protected int maxMissedClientHbs = DFLT_MAX_MISSED_CLIENT_HEARTBEATS;
-
     /** IP finder clean frequency. */
     @SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
     protected long ipFinderCleanFreq = DFLT_IP_FINDER_CLEAN_FREQ;
@@ -731,56 +719,6 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi {
     }
 
     /**
-     * Gets max heartbeats count node can miss without initiating status check.
-     *
-     * @return Max missed heartbeats.
-     */
-    public int getMaxMissedHeartbeats() {
-        return maxMissedHbs;
-    }
-
-    /**
-     * Sets max heartbeats count node can miss without initiating status check.
-     * <p>
-     * If not provided, default value is {@link #DFLT_MAX_MISSED_HEARTBEATS}.
-     * <p>
-     * Affected server nodes only.
-     *
-     * @param maxMissedHbs Max missed heartbeats.
-     * @return {@code this} for chaining.
-     */
-    @IgniteSpiConfiguration(optional = true)
-    public TcpDiscoverySpi setMaxMissedHeartbeats(int maxMissedHbs) {
-        this.maxMissedHbs = maxMissedHbs;
-
-        return this;
-    }
-
-    /**
-     * Gets max heartbeats count node can miss without failing client node.
-     *
-     * @return Max missed client heartbeats.
-     */
-    public int getMaxMissedClientHeartbeats() {
-        return maxMissedClientHbs;
-    }
-
-    /**
-     * Sets max heartbeats count node can miss without failing client node.
-     * <p>
-     * If not provided, default value is {@link #DFLT_MAX_MISSED_CLIENT_HEARTBEATS}.
-     *
-     * @param maxMissedClientHbs Max missed client heartbeats.
-     * @return {@code this} for chaining.
-     */
-    @IgniteSpiConfiguration(optional = true)
-    public TcpDiscoverySpi setMaxMissedClientHeartbeats(int maxMissedClientHbs) {
-        this.maxMissedClientHbs = maxMissedClientHbs;
-
-        return this;
-    }
-
-    /**
      * Gets statistics print frequency.
      *
      * @return Statistics print frequency in milliseconds.
@@ -966,22 +904,6 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi {
     }
 
     /**
-     * Sets delay between issuing of heartbeat messages. SPI sends heartbeat messages
-     * in configurable time interval to other nodes to notify them about its state.
-     * <p>
-     * If not provided, default value is {@link #DFLT_HEARTBEAT_FREQ}.
-     *
-     * @param hbFreq Heartbeat frequency in milliseconds.
-     * @return {@code this} for chaining.
-     */
-    @IgniteSpiConfiguration(optional = true)
-    public TcpDiscoverySpi setHeartbeatFrequency(long hbFreq) {
-        this.hbFreq = hbFreq;
-
-        return this;
-    }
-
-    /**
      * @return Size of topology snapshots history.
      */
     public long getTopHistorySize() {
@@ -1180,6 +1102,20 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi {
     }
 
     /**
+     * Gets effective or resulting socket timeout with considering failure detection timeout
+     *
+     * @param srvrOperation {@code True} if socket connect to server node,
+     *     {@code False} if socket connect to client node.
+     * @return Resulting socket timeout.
+     */
+    public long getEffectiveSocketTimeout(boolean srvrOperation) {
+        if (failureDetectionTimeoutEnabled())
+            return srvrOperation ? failureDetectionTimeout() : clientFailureDetectionTimeout();
+        else
+            return sockTimeout;
+    }
+
+    /**
      * Gets message acknowledgement timeout.
      *
      * @return Message acknowledgement timeout.
@@ -1207,19 +1143,11 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi {
     }
 
     /**
-     * Gets delay between heartbeat messages sent by coordinator.
-     *
-     * @return Time period in milliseconds.
-     */
-    public long getHeartbeatFrequency() {
-        return hbFreq;
-    }
-
-    /**
      * Gets {@link org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder} (string representation).
      *
      * @return IPFinder (string representation).
-     */public String getIpFinderFormatted() {
+     */
+    public String getIpFinderFormatted() {
         return ipFinder.toString();
     }
 
@@ -1939,6 +1867,8 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi {
             impl = new ServerImpl(this);
         }
 
+        metricsUpdateFreq = ignite.configuration().getMetricsUpdateFrequency();
+
         if (!failureDetectionTimeoutEnabled()) {
             assertParameter(sockTimeout > 0, "sockTimeout > 0");
             assertParameter(ackTimeout > 0, "ackTimeout > 0");
@@ -1948,14 +1878,13 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi {
 
         assertParameter(netTimeout > 0, "networkTimeout > 0");
         assertParameter(ipFinder != null, "ipFinder != null");
-        assertParameter(hbFreq > 0, "heartbeatFreq > 0");
+        assertParameter(metricsUpdateFreq > 0, "metricsUpdateFreq > 0" +
+            " (inited from igniteConfiguration.metricsUpdateFrequency)");
 
         assertParameter(ipFinderCleanFreq > 0, "ipFinderCleanFreq > 0");
         assertParameter(locPort > 1023, "localPort > 1023");
         assertParameter(locPortRange >= 0, "localPortRange >= 0");
         assertParameter(locPort + locPortRange <= 0xffff, "locPort + locPortRange <= 0xffff");
-        assertParameter(maxMissedHbs > 0, "maxMissedHeartbeats > 0");
-        assertParameter(maxMissedClientHbs > 0, "maxMissedClientHeartbeats > 0");
         assertParameter(threadPri > 0, "threadPri > 0");
         assertParameter(statsPrintFreq >= 0, "statsPrintFreq >= 0");
 
@@ -2000,8 +1929,7 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi {
 
             log.debug(configInfo("ipFinder", ipFinder));
             log.debug(configInfo("ipFinderCleanFreq", ipFinderCleanFreq));
-            log.debug(configInfo("heartbeatFreq", hbFreq));
-            log.debug(configInfo("maxMissedHeartbeats", maxMissedHbs));
+            log.debug(configInfo("metricsUpdateFreq", metricsUpdateFreq));
             log.debug(configInfo("statsPrintFreq", statsPrintFreq));
         }
 
@@ -2336,21 +2264,6 @@ public class TcpDiscoverySpi extends IgniteSpiAdapter implements DiscoverySpi {
         }
 
         /** {@inheritDoc} */
-        @Override public long getHeartbeatFrequency() {
-            return TcpDiscoverySpi.this.getHeartbeatFrequency();
-        }
-
-        /** {@inheritDoc} */
-        @Override public int getMaxMissedHeartbeats() {
-            return TcpDiscoverySpi.this.getMaxMissedHeartbeats();
-        }
-
-        /** {@inheritDoc} */
-        @Override public int getMaxMissedClientHeartbeats() {
-            return TcpDiscoverySpi.this.getMaxMissedClientHeartbeats();
-        }
-
-        /** {@inheritDoc} */
         @Override public long getStatisticsPrintFrequency() {
             return TcpDiscoverySpi.this.getStatisticsPrintFrequency();
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiMBean.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiMBean.java
index 1427929..a05ecde 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiMBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpiMBean.java
@@ -28,14 +28,6 @@ import org.jetbrains.annotations.Nullable;
  */
 public interface TcpDiscoverySpiMBean extends IgniteSpiManagementMBean {
     /**
-     * Gets delay between heartbeat messages sent by coordinator.
-     *
-     * @return Time period in milliseconds.
-     */
-    @MXBeanDescription("Heartbeat frequency.")
-    public long getHeartbeatFrequency();
-
-    /**
      * Gets current SPI state.
      *
      * @return Current SPI state.
@@ -84,22 +76,6 @@ public interface TcpDiscoverySpiMBean extends IgniteSpiManagementMBean {
     public int getLocalPortRange();
 
     /**
-     * Gets max heartbeats count node can miss without initiating status check.
-     *
-     * @return Max missed heartbeats.
-     */
-    @MXBeanDescription("Max missed heartbeats.")
-    public int getMaxMissedHeartbeats();
-
-    /**
-     * Gets max heartbeats count node can miss without failing client node.
-     *
-     * @return Max missed client heartbeats.
-     */
-    @MXBeanDescription("Max missed client heartbeats.")
-    public int getMaxMissedClientHeartbeats();
-
-    /**
      * Gets thread priority. All threads within SPI will be started with it.
      *
      * @return Thread priority.
@@ -281,4 +257,4 @@ public interface TcpDiscoverySpiMBean extends IgniteSpiManagementMBean {
      */
     @MXBeanDescription("Client mode.")
     public boolean isClientMode() throws IllegalStateException;
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
index d778854..6882821 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
@@ -102,7 +102,7 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste
     /** Node order in the topology (internal). */
     private volatile long intOrder;
 
-    /** The most recent time when heartbeat message was received from the node. */
+    /** The most recent time when metrics update message was received from the node. */
     @GridToStringExclude
     private volatile long lastUpdateTime = U.currentTimeMillis();
 
@@ -123,9 +123,9 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste
     /** Version. */
     private IgniteProductVersion ver;
 
-    /** Alive check (used by clients). */
+    /** Alive check time (used by clients). */
     @GridToStringExclude
-    private transient int aliveCheck;
+    private transient long aliveCheckTime;
 
     /** Client router node ID. */
     @GridToStringExclude
@@ -291,9 +291,8 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste
      * Gets collections of cache metrics for this node. Note that node cache metrics are constantly updated
      * and provide up to date information about caches.
      * <p>
-     * Cache metrics are updated with some delay which is directly related to heartbeat
-     * frequency. For example, when used with default
-     * {@link TcpDiscoverySpi} the update will happen every {@code 2} seconds.
+     * Cache metrics are updated with some delay which is directly related to metrics update
+     * frequency. For example, by default the update will happen every {@code 2} seconds.
      *
      * @return Runtime metrics snapshots for this node.
      */
@@ -414,7 +413,7 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste
     /**
      * Gets node last update time.
      *
-     * @return Time of the last heartbeat.
+     * @return Time of the last metrics update.
      */
     public long lastUpdateTime() {
         return lastUpdateTime;
@@ -473,23 +472,25 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste
     }
 
     /**
-     * Decrements alive check value and returns new one.
+     * Test alive check time value.
      *
-     * @return Alive check value.
+     * @return {@code True} if client alive, {@code False} otherwise.
      */
-    public int decrementAliveCheck() {
-        assert isClient();
+    public boolean isClientAlive() {
+        assert isClient() : this;
 
-        return --aliveCheck;
+        return (aliveCheckTime - U.currentTimeMillis()) >= 0;
     }
 
     /**
-     * @param aliveCheck Alive check value.
+     * Set client alive time.
+     *
+     * @param aliveTime Alive time interval.
      */
-    public void aliveCheck(int aliveCheck) {
-        assert isClient();
+    public void clientAliveTime(long aliveTime) {
+        assert isClient() : this;
 
-        this.aliveCheck = aliveCheck;
+        this.aliveCheckTime = U.currentTimeMillis() + aliveTime;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientHeartbeatMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientHeartbeatMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientHeartbeatMessage.java
deleted file mode 100644
index ade5468..0000000
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientHeartbeatMessage.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.spi.discovery.tcp.messages;
-
-import java.util.UUID;
-import org.apache.ignite.cluster.ClusterMetrics;
-import org.apache.ignite.internal.ClusterMetricsSnapshot;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * Heartbeat message.
- * <p>
- * Client sends his heartbeats in this message.
- */
-public class TcpDiscoveryClientHeartbeatMessage extends TcpDiscoveryAbstractMessage {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** */
-    private final byte[] metrics;
-
-    /**
-     * Constructor.
-     *
-     * @param creatorNodeId Creator node.
-     * @param metrics Metrics.
-     */
-    public TcpDiscoveryClientHeartbeatMessage(UUID creatorNodeId, ClusterMetrics metrics) {
-        super(creatorNodeId);
-
-        this.metrics = ClusterMetricsSnapshot.serialize(metrics);
-    }
-
-    /**
-     * Gets metrics map.
-     *
-     * @return Metrics map.
-     */
-    public ClusterMetrics metrics() {
-        return ClusterMetricsSnapshot.deserialize(metrics, 0);
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean highPriority() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean traceLogLevel() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(TcpDiscoveryClientHeartbeatMessage.class, this, "super", super.toString());
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/6998785a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientMetricsUpdateMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientMetricsUpdateMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientMetricsUpdateMessage.java
new file mode 100644
index 0000000..b56cd01
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryClientMetricsUpdateMessage.java
@@ -0,0 +1,72 @@
+/*
+ * 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.spi.discovery.tcp.messages;
+
+import java.util.UUID;
+import org.apache.ignite.cluster.ClusterMetrics;
+import org.apache.ignite.internal.ClusterMetricsSnapshot;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+/**
+ * Metrics update message.
+ * <p>
+ * Client sends his metrics in this message.
+ */
+public class TcpDiscoveryClientMetricsUpdateMessage extends TcpDiscoveryAbstractMessage {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private final byte[] metrics;
+
+    /**
+     * Constructor.
+     *
+     * @param creatorNodeId Creator node.
+     * @param metrics Metrics.
+     */
+    public TcpDiscoveryClientMetricsUpdateMessage(UUID creatorNodeId, ClusterMetrics metrics) {
+        super(creatorNodeId);
+
+        this.metrics = ClusterMetricsSnapshot.serialize(metrics);
+    }
+
+    /**
+     * Gets metrics map.
+     *
+     * @return Metrics map.
+     */
+    public ClusterMetrics metrics() {
+        return ClusterMetricsSnapshot.deserialize(metrics, 0);
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean highPriority() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean traceLogLevel() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(TcpDiscoveryClientMetricsUpdateMessage.class, this, "super", super.toString());
+    }
+}
\ No newline at end of file


[49/51] [abbrv] ignite git commit: IGNITE-4799 Fix broken .NET merge

Posted by sb...@apache.org.
IGNITE-4799 Fix broken .NET merge


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

Branch: refs/heads/ignite-5075-cacheStart
Commit: 96f5cf5af4d00c142c901ffd64379cb569fa87e1
Parents: 746f8eb
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Wed Apr 26 19:13:30 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Wed Apr 26 19:18:28 2017 +0300

----------------------------------------------------------------------
 .../utils/PlatformConfigurationUtils.java       |  9 ++++---
 .../IgniteConfigurationSerializerTest.cs        |  3 +--
 .../IgniteConfigurationTest.cs                  |  8 +++---
 .../Discovery/Tcp/TcpDiscoverySpi.cs            | 28 --------------------
 .../Apache.Ignite.Core/IgniteConfiguration.cs   | 21 +++++++++++++++
 .../IgniteConfigurationSection.xsd              | 17 +++++-------
 6 files changed, 38 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/96f5cf5a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index 9bbf5d6..6de5db8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
@@ -560,10 +560,10 @@ public class PlatformConfigurationUtils {
             cfg.setDaemon(in.readBoolean());
         if (in.readBoolean())
             cfg.setLateAffinityAssignment(in.readBoolean());
-        if (in.readBoolean()) {
-            cfg.setClientFailureDetectionTimeout(in.readLong());
+        if (in.readBoolean())
             cfg.setFailureDetectionTimeout(in.readLong());
-        }
+        if (in.readBoolean())
+            cfg.setClientFailureDetectionTimeout(in.readLong());
 
         readCacheConfigurations(in, cfg);
         readDiscoveryConfiguration(in, cfg);
@@ -977,8 +977,9 @@ public class PlatformConfigurationUtils {
         w.writeBoolean(true);
         w.writeBoolean(cfg.isLateAffinityAssignment());
         w.writeBoolean(true);
-        w.writeLong(cfg.getClientFailureDetectionTimeout());
         w.writeLong(cfg.getFailureDetectionTimeout());
+        w.writeBoolean(true);
+        w.writeLong(cfg.getClientFailureDetectionTimeout());
 
         CacheConfiguration[] cacheCfg = cfg.getCacheConfiguration();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/96f5cf5a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index 2600028..538153c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -732,8 +732,6 @@ namespace Apache.Ignite.Core.Tests
                     LocalAddress = "127.0.0.1",
                     LocalPort = 49900,
                     LocalPortRange = 13,
-                    MaxMissedClientHeartbeats = 9,
-                    MaxMissedHeartbeats = 7,
                     ReconnectCount = 11,
                     StatisticsPrintFrequency = TimeSpan.FromSeconds(20),
                     ThreadPriority = 6,
@@ -795,6 +793,7 @@ namespace Apache.Ignite.Core.Tests
                 SpringConfigUrl = "test",
                 Logger = new IgniteNLogLogger(),
                 FailureDetectionTimeout = TimeSpan.FromMinutes(2),
+                ClientFailureDetectionTimeout = TimeSpan.FromMinutes(3),
                 PluginConfigurations = new[] {new TestIgnitePluginConfiguration() },
                 EventStorageSpi = new MemoryEventStorageSpi
                 {

http://git-wip-us.apache.org/repos/asf/ignite/blob/96f5cf5a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
index b0ed0d2..5f4a8ca 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@ -107,8 +107,6 @@ namespace Apache.Ignite.Core.Tests
                 Assert.AreEqual(disco.LocalAddress, resDisco.LocalAddress);
                 Assert.AreEqual(disco.LocalPort, resDisco.LocalPort);
                 Assert.AreEqual(disco.LocalPortRange, resDisco.LocalPortRange);
-                Assert.AreEqual(disco.MaxMissedClientHeartbeats, resDisco.MaxMissedClientHeartbeats);
-                Assert.AreEqual(disco.MaxMissedHeartbeats, resDisco.MaxMissedHeartbeats);
                 Assert.AreEqual(disco.ReconnectCount, resDisco.ReconnectCount);
                 Assert.AreEqual(disco.StatisticsPrintFrequency, resDisco.StatisticsPrintFrequency);
                 Assert.AreEqual(disco.ThreadPriority, resDisco.ThreadPriority);
@@ -173,6 +171,7 @@ namespace Apache.Ignite.Core.Tests
                 Assert.AreEqual(com.UnacknowledgedMessagesBufferSize, resCom.UnacknowledgedMessagesBufferSize);
 
                 Assert.AreEqual(cfg.FailureDetectionTimeout, resCfg.FailureDetectionTimeout);
+                Assert.AreEqual(cfg.ClientFailureDetectionTimeout, resCfg.ClientFailureDetectionTimeout);
 
                 var binCfg = cfg.BinaryConfiguration;
                 Assert.IsFalse(binCfg.CompactFooter);
@@ -435,6 +434,8 @@ namespace Apache.Ignite.Core.Tests
             Assert.AreEqual(IgniteConfiguration.DefaultNetworkSendRetryCount, cfg.NetworkSendRetryCount);
             Assert.AreEqual(IgniteConfiguration.DefaultNetworkSendRetryDelay, cfg.NetworkSendRetryDelay);
             Assert.AreEqual(IgniteConfiguration.DefaultFailureDetectionTimeout, cfg.FailureDetectionTimeout);
+            Assert.AreEqual(IgniteConfiguration.DefaultClientFailureDetectionTimeout,
+                cfg.ClientFailureDetectionTimeout);
         }
 
         /// <summary>
@@ -484,8 +485,6 @@ namespace Apache.Ignite.Core.Tests
                     LocalAddress = "127.0.0.1",
                     LocalPort = 49900,
                     LocalPortRange = 13,
-                    MaxMissedClientHeartbeats = 9,
-                    MaxMissedHeartbeats = 7,
                     ReconnectCount = 11,
                     StatisticsPrintFrequency = TimeSpan.FromSeconds(20),
                     ThreadPriority = 6,
@@ -542,6 +541,7 @@ namespace Apache.Ignite.Core.Tests
                     UnacknowledgedMessagesBufferSize = 3450
                 },
                 FailureDetectionTimeout = TimeSpan.FromSeconds(3.5),
+                ClientFailureDetectionTimeout = TimeSpan.FromMinutes(12.3),
                 BinaryConfiguration = new BinaryConfiguration
                 {
                     CompactFooter = false,

http://git-wip-us.apache.org/repos/asf/ignite/blob/96f5cf5a/modules/platforms/dotnet/Apache.Ignite.Core/Discovery/Tcp/TcpDiscoverySpi.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Discovery/Tcp/TcpDiscoverySpi.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Discovery/Tcp/TcpDiscoverySpi.cs
index bdf5780..154124a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Discovery/Tcp/TcpDiscoverySpi.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Discovery/Tcp/TcpDiscoverySpi.cs
@@ -68,16 +68,6 @@ namespace Apache.Ignite.Core.Discovery.Tcp
         public const int DefaultLocalPortRange = 100;
 
         /// <summary>
-        /// Default value for the <see cref="MaxMissedHeartbeats"/> property.
-        /// </summary>
-        public const int DefaultMaxMissedHeartbeats = 1;
-
-        /// <summary>
-        /// Default value for the <see cref="MaxMissedClientHeartbeats"/> property.
-        /// </summary>
-        public const int DefaultMaxMissedClientHeartbeats = 5;
-
-        /// <summary>
         /// Default value for the <see cref="IpFinderCleanFrequency"/> property.
         /// </summary>
         public static readonly TimeSpan DefaultIpFinderCleanFrequency = TimeSpan.FromSeconds(60);
@@ -105,8 +95,6 @@ namespace Apache.Ignite.Core.Discovery.Tcp
             ReconnectCount = DefaultReconnectCount;
             LocalPort = DefaultLocalPort;
             LocalPortRange = DefaultLocalPortRange;
-            MaxMissedHeartbeats = DefaultMaxMissedHeartbeats;
-            MaxMissedClientHeartbeats = DefaultMaxMissedClientHeartbeats;
             IpFinderCleanFrequency = DefaultIpFinderCleanFrequency;
             ThreadPriority = DefaultThreadPriority;
             TopologyHistorySize = DefaultTopologyHistorySize;
@@ -132,8 +120,6 @@ namespace Apache.Ignite.Core.Discovery.Tcp
             ReconnectCount = reader.ReadInt();
             LocalPort = reader.ReadInt();
             LocalPortRange = reader.ReadInt();
-            MaxMissedHeartbeats = reader.ReadInt();
-            MaxMissedClientHeartbeats = reader.ReadInt();
             StatisticsPrintFrequency = reader.ReadLongAsTimespan();
             IpFinderCleanFrequency = reader.ReadLongAsTimespan();
             ThreadPriority = reader.ReadInt();
@@ -211,18 +197,6 @@ namespace Apache.Ignite.Core.Discovery.Tcp
         public int LocalPortRange { get; set; }
 
         /// <summary>
-        /// Gets or sets the maximum heartbeats count node can miss without initiating status check.
-        /// </summary>
-        [DefaultValue(DefaultMaxMissedHeartbeats)]
-        public int MaxMissedHeartbeats { get; set; }
-
-        /// <summary>
-        /// Gets or sets the maximum heartbeats count node can miss without failing client node.
-        /// </summary>
-        [DefaultValue(DefaultMaxMissedClientHeartbeats)]
-        public int MaxMissedClientHeartbeats { get; set; }
-
-        /// <summary>
         /// Gets or sets the statistics print frequency.
         /// <see cref="TimeSpan.Zero"/> for no statistics.
         /// </summary>
@@ -279,8 +253,6 @@ namespace Apache.Ignite.Core.Discovery.Tcp
             writer.WriteInt(ReconnectCount);
             writer.WriteInt(LocalPort);
             writer.WriteInt(LocalPortRange);
-            writer.WriteInt(MaxMissedHeartbeats);
-            writer.WriteInt(MaxMissedClientHeartbeats);
             writer.WriteLong((long) StatisticsPrintFrequency.TotalMilliseconds);
             writer.WriteLong((long) IpFinderCleanFrequency.TotalMilliseconds);
             writer.WriteInt(ThreadPriority);

http://git-wip-us.apache.org/repos/asf/ignite/blob/96f5cf5a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
index 1f7a184..2a6f5f7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
@@ -96,6 +96,11 @@ namespace Apache.Ignite.Core
         /// </summary>
         public static readonly TimeSpan DefaultFailureDetectionTimeout = TimeSpan.FromSeconds(10);
 
+        /// <summary>
+        /// Default failure detection timeout.
+        /// </summary>
+        public static readonly TimeSpan DefaultClientFailureDetectionTimeout = TimeSpan.FromSeconds(30);
+
         /** */
         private TimeSpan? _metricsExpireTime;
 
@@ -129,6 +134,9 @@ namespace Apache.Ignite.Core
         /** */
         private TimeSpan? _failureDetectionTimeout;
 
+        /** */
+        private TimeSpan? _clientFailureDetectionTimeout;
+
         /// <summary>
         /// Default network retry count.
         /// </summary>
@@ -210,6 +218,7 @@ namespace Apache.Ignite.Core
             writer.WriteBooleanNullable(_isDaemon);
             writer.WriteBooleanNullable(_isLateAffinityAssignment);
             writer.WriteTimeSpanAsLongNullable(_failureDetectionTimeout);
+            writer.WriteTimeSpanAsLongNullable(_clientFailureDetectionTimeout);
 
             // Cache config
             var caches = CacheConfiguration;
@@ -425,6 +434,7 @@ namespace Apache.Ignite.Core
             _isDaemon = r.ReadBooleanNullable();
             _isLateAffinityAssignment = r.ReadBooleanNullable();
             _failureDetectionTimeout = r.ReadTimeSpanNullable();
+            _clientFailureDetectionTimeout = r.ReadTimeSpanNullable();
 
             // Cache config
             var cacheCfgCount = r.ReadInt();
@@ -940,6 +950,17 @@ namespace Apache.Ignite.Core
         }
 
         /// <summary>
+        /// Gets or sets the failure detection timeout used by <see cref="TcpDiscoverySpi"/>
+        /// and <see cref="TcpCommunicationSpi"/> for client nodes.
+        /// </summary>
+        [DefaultValue(typeof(TimeSpan), "00:00:30")]
+        public TimeSpan ClientFailureDetectionTimeout
+        {
+            get { return _clientFailureDetectionTimeout ?? DefaultClientFailureDetectionTimeout; }
+            set { _clientFailureDetectionTimeout = value; }
+        }
+
+        /// <summary>
         /// Gets or sets the configurations for plugins to be started.
         /// </summary>
         [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]

http://git-wip-us.apache.org/repos/asf/ignite/blob/96f5cf5a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index 76c2068..8476f1f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -909,16 +909,6 @@
                                 </xs:documentation>
                             </xs:annotation>
                         </xs:attribute>
-                        <xs:attribute name="maxMissedClientHeartbeats" type="xs:int">
-                            <xs:annotation>
-                                <xs:documentation>Maximum heartbeats count node can miss without failing client node.</xs:documentation>
-                            </xs:annotation>
-                        </xs:attribute>
-                        <xs:attribute name="maxMissedHeartbeats" type="xs:int">
-                            <xs:annotation>
-                                <xs:documentation>Maximum heartbeats count node can miss without initiating status check.</xs:documentation>
-                            </xs:annotation>
-                        </xs:attribute>
                         <xs:attribute name="reconnectCount" type="xs:int">
                             <xs:annotation>
                                 <xs:documentation>Maximum number of reconnect attempts used when establishing connection with remote nodes.</xs:documentation>
@@ -1409,6 +1399,13 @@
                     </xs:documentation>
                 </xs:annotation>
             </xs:attribute>
+            <xs:attribute name="clientFailureDetectionTimeout" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        Failure detection timeout used by discovery and communication subsystems for client nodes.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:attribute>
         </xs:complexType>
     </xs:element>
 </xs:schema>


[44/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/config/spring-cache-load.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/spring-cache-load.xml b/modules/core/src/test/config/spring-cache-load.xml
index 48f662f..346c34a 100644
--- a/modules/core/src/test/config/spring-cache-load.xml
+++ b/modules/core/src/test/config/spring-cache-load.xml
@@ -49,6 +49,7 @@
 
         <property name="cacheConfiguration">
             <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                <property name="name" value="test-cache"/>
                 <property name="cacheMode" value="PARTITIONED"/>
 
                 <property name="rebalanceMode" value="SYNC"/>

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/config/spring-cache-swap.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/spring-cache-swap.xml b/modules/core/src/test/config/spring-cache-swap.xml
index 2e1dd36..6caaf32 100644
--- a/modules/core/src/test/config/spring-cache-swap.xml
+++ b/modules/core/src/test/config/spring-cache-swap.xml
@@ -30,6 +30,8 @@
 
         <property name="cacheConfiguration">
             <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                <property name="name" value="test-cache"/>
+
                 <property name="cacheMode" value="LOCAL"/>
 
                 <property name="swapEnabled" value="true"/>

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/config/spring-cache-teststore.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/spring-cache-teststore.xml b/modules/core/src/test/config/spring-cache-teststore.xml
index a17270b..a1698ab 100644
--- a/modules/core/src/test/config/spring-cache-teststore.xml
+++ b/modules/core/src/test/config/spring-cache-teststore.xml
@@ -30,6 +30,8 @@
 
         <property name="cacheConfiguration">
             <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                <property name="name" value="test-cache"/>
+
                 <property name="cacheMode" value="PARTITIONED"/>
 
                 <property name="swapEnabled" value="false"/>

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/config/store/jdbc/ignite-jdbc-type.xml
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/store/jdbc/ignite-jdbc-type.xml b/modules/core/src/test/config/store/jdbc/ignite-jdbc-type.xml
index 6b75041..9b2174a 100644
--- a/modules/core/src/test/config/store/jdbc/ignite-jdbc-type.xml
+++ b/modules/core/src/test/config/store/jdbc/ignite-jdbc-type.xml
@@ -28,6 +28,7 @@
                            http://www.springframework.org/schema/util
                            http://www.springframework.org/schema/util/spring-util.xsd">
     <bean class="org.apache.ignite.cache.store.jdbc.JdbcType">
+        <property name="cacheName" value="default"/>
         <property name="databaseSchema" value="PUBLIC"/>
         <property name="databaseTable" value="ORGANIZATION"/>
         <property name="keyType" value="org.apache.ignite.cache.store.jdbc.model.OrganizationKey"/>
@@ -75,6 +76,7 @@
     </bean>
 
     <bean class="org.apache.ignite.cache.store.jdbc.JdbcType">
+        <property name="cacheName" value="default"/>
         <property name="databaseSchema" value="PUBLIC"/>
         <property name="databaseTable" value="PERSON"/>
         <property name="keyType" value="org.apache.ignite.cache.store.jdbc.model.PersonKey"/>
@@ -122,6 +124,7 @@
     </bean>
 
     <bean class="org.apache.ignite.cache.store.jdbc.JdbcType">
+        <property name="cacheName" value="default"/>
         <property name="databaseSchema" value="PUBLIC"/>
         <property name="databaseTable" value="PERSON_COMPLEX"/>
         <property name="keyType" value="org.apache.ignite.cache.store.jdbc.model.PersonComplexKey"/>
@@ -193,6 +196,7 @@
     </bean>
 
     <bean class="org.apache.ignite.cache.store.jdbc.JdbcType">
+        <property name="cacheName" value="default"/>
         <property name="databaseSchema" value="PUBLIC"/>
         <property name="databaseTable" value="STRING_ENTRIES"/>
         <property name="keyType" value="java.lang.String"/>
@@ -220,6 +224,7 @@
     </bean>
 
     <bean class="org.apache.ignite.cache.store.jdbc.JdbcType">
+        <property name="cacheName" value="default"/>
         <property name="databaseSchema" value="PUBLIC"/>
         <property name="databaseTable" value="UUID_ENTRIES"/>
         <property name="keyType" value="java.util.UUID"/>
@@ -249,6 +254,7 @@
     </bean>
 
     <bean class="org.apache.ignite.cache.store.jdbc.JdbcType">
+        <property name="cacheName" value="default"/>
         <property name="databaseSchema" value="PUBLIC"/>
         <property name="databaseTable" value="TIMESTAMP_ENTRIES"/>
         <property name="keyType" value="java.sql.Timestamp"/>

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/GridCacheAffinityBackupsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/GridCacheAffinityBackupsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/GridCacheAffinityBackupsSelfTest.java
index b8a931f..5e7b4e2 100644
--- a/modules/core/src/test/java/org/apache/ignite/GridCacheAffinityBackupsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/GridCacheAffinityBackupsSelfTest.java
@@ -49,7 +49,7 @@ public class GridCacheAffinityBackupsSelfTest extends GridCommonAbstractTest {
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(CacheMode.PARTITIONED);
         ccfg.setBackups(backups);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/GridTestStoreNodeStartup.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/GridTestStoreNodeStartup.java b/modules/core/src/test/java/org/apache/ignite/GridTestStoreNodeStartup.java
index 1e4bbc9..03e60e2 100644
--- a/modules/core/src/test/java/org/apache/ignite/GridTestStoreNodeStartup.java
+++ b/modules/core/src/test/java/org/apache/ignite/GridTestStoreNodeStartup.java
@@ -40,7 +40,7 @@ public class GridTestStoreNodeStartup {
         try {
             Ignite g = G.start("modules/core/src/test/config/spring-cache-teststore.xml");
 
-            g.cache(null).loadCache(new P2<Object, Object>() {
+            g.cache("test-cache").loadCache(new P2<Object, Object>() {
                 @Override public boolean apply(Object o, Object o1) {
                     System.out.println("Key=" + o + ", Val=" + o1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java b/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
index 21e54db..cf54949 100644
--- a/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/IgniteCacheAffinitySelfTest.java
@@ -104,7 +104,7 @@ public class IgniteCacheAffinitySelfTest extends IgniteCacheAbstractTest {
      * Check CacheAffinityProxy methods.
      */
     private void checkAffinity() {
-        checkAffinity(grid(0).affinity(null), internalCache(1, null).affinity());
+        checkAffinity(grid(0).affinity(DEFAULT_CACHE_NAME), internalCache(1, DEFAULT_CACHE_NAME).affinity());
         checkAffinity(grid(0).affinity(CACHE2), internalCache(1, CACHE2).affinity());
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/cache/IgniteWarmupClosureSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/IgniteWarmupClosureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/IgniteWarmupClosureSelfTest.java
index 4c3c1ae..30e6072 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/IgniteWarmupClosureSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/IgniteWarmupClosureSelfTest.java
@@ -57,7 +57,7 @@ public class IgniteWarmupClosureSelfTest extends GridCommonAbstractTest {
 
         cfg.setWarmupClosure(warmupClosure);
 
-        CacheConfiguration<Integer, Integer> cacheCfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> cacheCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cacheCfg.setCacheMode(CacheMode.PARTITIONED);
         cacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/cache/LargeEntryUpdateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/LargeEntryUpdateTest.java b/modules/core/src/test/java/org/apache/ignite/cache/LargeEntryUpdateTest.java
index 592ba0f..be92761 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/LargeEntryUpdateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/LargeEntryUpdateTest.java
@@ -80,7 +80,7 @@ public class LargeEntryUpdateTest extends GridCommonAbstractTest {
         CacheConfiguration[] ccfgs = new CacheConfiguration[CACHE_COUNT];
 
         for (int i = 0; i < CACHE_COUNT; ++i) {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
             ccfg.setName(CACHE_PREFIX + i);
             ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
             ccfg.setCacheMode(CacheMode.PARTITIONED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityClientNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityClientNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityClientNodeSelfTest.java
index 04c6061..73302d9 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityClientNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityClientNodeSelfTest.java
@@ -62,26 +62,26 @@ public class AffinityClientNodeSelfTest extends GridCommonAbstractTest {
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
 
-        CacheConfiguration ccfg1 = new CacheConfiguration();
+        CacheConfiguration ccfg1 = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg1.setBackups(1);
         ccfg1.setName(CACHE1);
         ccfg1.setAffinity(new RendezvousAffinityFunction());
         ccfg1.setNodeFilter(new TestNodesFilter());
 
-        CacheConfiguration ccfg2 = new CacheConfiguration();
+        CacheConfiguration ccfg2 = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg2.setBackups(1);
         ccfg2.setName(CACHE2);
         ccfg2.setAffinity(new RendezvousAffinityFunction());
 
-        CacheConfiguration ccfg4 = new CacheConfiguration();
+        CacheConfiguration ccfg4 = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg4.setCacheMode(REPLICATED);
         ccfg4.setName(CACHE4);
         ccfg4.setNodeFilter(new TestNodesFilter());
 
-        CacheConfiguration ccfg5 = new CacheConfiguration();
+        CacheConfiguration ccfg5 = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg5.setBackups(1);
         ccfg5.setName(CACHE5);
@@ -125,7 +125,7 @@ public class AffinityClientNodeSelfTest extends GridCommonAbstractTest {
 
         Ignite client = ignite(NODE_CNT - 1);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setBackups(0);
 
@@ -134,7 +134,7 @@ public class AffinityClientNodeSelfTest extends GridCommonAbstractTest {
         IgniteCache<Integer, Integer> cache = client.createCache(ccfg);
 
         try {
-            checkCache(null, 1);
+            checkCache(DEFAULT_CACHE_NAME, 1);
         }
         finally {
             cache.destroy();
@@ -143,7 +143,7 @@ public class AffinityClientNodeSelfTest extends GridCommonAbstractTest {
         cache = client.createCache(ccfg, new NearCacheConfiguration());
 
         try {
-            checkCache(null, 1);
+            checkCache(DEFAULT_CACHE_NAME, 1);
         }
         finally {
             cache.destroy();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityFunctionBackupFilterAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityFunctionBackupFilterAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityFunctionBackupFilterAbstractSelfTest.java
index af969e9..2110c28 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityFunctionBackupFilterAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityFunctionBackupFilterAbstractSelfTest.java
@@ -182,11 +182,11 @@ public abstract class AffinityFunctionBackupFilterAbstractSelfTest extends GridC
      */
     @SuppressWarnings("ConstantConditions")
     private void checkPartitions() throws Exception {
-        AffinityFunction aff = cacheConfiguration(grid(0).configuration(), null).getAffinity();
+        AffinityFunction aff = cacheConfiguration(grid(0).configuration(), DEFAULT_CACHE_NAME).getAffinity();
 
         int partCnt = aff.partitions();
 
-        IgniteCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < partCnt; i++) {
             Collection<ClusterNode> nodes = affinity(cache).mapKeyToPrimaryAndBackups(i);
@@ -236,11 +236,11 @@ public abstract class AffinityFunctionBackupFilterAbstractSelfTest extends GridC
      */
     @SuppressWarnings("ConstantConditions")
     private void checkPartitionsWithAffinityBackupFilter() throws Exception {
-        AffinityFunction aff = cacheConfiguration(grid(0).configuration(), null).getAffinity();
+        AffinityFunction aff = cacheConfiguration(grid(0).configuration(), DEFAULT_CACHE_NAME).getAffinity();
 
         int partCnt = aff.partitions();
 
-        IgniteCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < partCnt; i++) {
             Collection<ClusterNode> nodes = affinity(cache).mapKeyToPrimaryAndBackups(i);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityFunctionExcludeNeighborsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityFunctionExcludeNeighborsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityFunctionExcludeNeighborsAbstractSelfTest.java
index 29576b1..900d4f5 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityFunctionExcludeNeighborsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityFunctionExcludeNeighborsAbstractSelfTest.java
@@ -122,7 +122,7 @@ public abstract class AffinityFunctionExcludeNeighborsAbstractSelfTest extends G
             for (int i = 0; i < grids; i++) {
                 final Ignite g = grid(i);
 
-                Affinity<Object> aff = g.affinity(null);
+                Affinity<Object> aff = g.affinity(DEFAULT_CACHE_NAME);
 
                 List<TcpDiscoveryNode> top = new ArrayList<>();
 
@@ -169,7 +169,7 @@ public abstract class AffinityFunctionExcludeNeighborsAbstractSelfTest extends G
         try {
             Object key = 12345;
 
-            Collection<? extends ClusterNode> affNodes = nodes(g.affinity(null), key);
+            Collection<? extends ClusterNode> affNodes = nodes(g.affinity(DEFAULT_CACHE_NAME), key);
 
             info("Affinity picture for grid: " + U.toShortString(affNodes));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityHistoryCleanupTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityHistoryCleanupTest.java b/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityHistoryCleanupTest.java
index 87b472d..87c2050 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityHistoryCleanupTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/affinity/AffinityHistoryCleanupTest.java
@@ -59,7 +59,7 @@ public class AffinityHistoryCleanupTest extends GridCommonAbstractTest {
         CacheConfiguration[] ccfgs = new CacheConfiguration[4];
 
         for (int i = 0; i < ccfgs.length; i++) {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             ccfg.setName("static-cache-" + i);
             ccfg.setAffinity(new RendezvousAffinityFunction());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/cache/affinity/local/LocalAffinityFunctionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/affinity/local/LocalAffinityFunctionTest.java b/modules/core/src/test/java/org/apache/ignite/cache/affinity/local/LocalAffinityFunctionTest.java
index fe3de71..768c986 100755
--- a/modules/core/src/test/java/org/apache/ignite/cache/affinity/local/LocalAffinityFunctionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/affinity/local/LocalAffinityFunctionTest.java
@@ -45,7 +45,7 @@ public class LocalAffinityFunctionTest extends GridCommonAbstractTest {
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setBackups(1);
         ccfg.setName(CACHE1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerAbstractSelfTest.java
index 790f24a..56e7dca 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreSessionListenerAbstractSelfTest.java
@@ -115,7 +115,7 @@ public abstract class CacheStoreSessionListenerAbstractSelfTest extends GridComm
      * @throws Exception If failed.
      */
     public void testAtomicCache() throws Exception {
-        CacheConfiguration<Integer, Integer> cfg = cacheConfiguration(null, CacheAtomicityMode.ATOMIC);
+        CacheConfiguration<Integer, Integer> cfg = cacheConfiguration(DEFAULT_CACHE_NAME, CacheAtomicityMode.ATOMIC);
 
         IgniteCache<Integer, Integer> cache = ignite(0).createCache(cfg);
 
@@ -140,7 +140,7 @@ public abstract class CacheStoreSessionListenerAbstractSelfTest extends GridComm
      * @throws Exception If failed.
      */
     public void testTransactionalCache() throws Exception {
-        CacheConfiguration<Integer, Integer> cfg = cacheConfiguration(null, CacheAtomicityMode.TRANSACTIONAL);
+        CacheConfiguration<Integer, Integer> cfg = cacheConfiguration(DEFAULT_CACHE_NAME, CacheAtomicityMode.TRANSACTIONAL);
 
         IgniteCache<Integer, Integer> cache = ignite(0).createCache(cfg);
 
@@ -165,7 +165,7 @@ public abstract class CacheStoreSessionListenerAbstractSelfTest extends GridComm
      * @throws Exception If failed.
      */
     public void testExplicitTransaction() throws Exception {
-        CacheConfiguration<Integer, Integer> cfg = cacheConfiguration(null, CacheAtomicityMode.TRANSACTIONAL);
+        CacheConfiguration<Integer, Integer> cfg = cacheConfiguration(DEFAULT_CACHE_NAME, CacheAtomicityMode.TRANSACTIONAL);
 
         IgniteCache<Integer, Integer> cache = ignite(0).createCache(cfg);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java
index bfbb08c..760f329 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/GridCacheBalancingStoreSelfTest.java
@@ -128,7 +128,7 @@ public class GridCacheBalancingStoreSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testConcurrentLoad() throws Exception {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         assertEquals(CacheStoreBalancingWrapper.DFLT_LOAD_ALL_THRESHOLD, cfg.getStoreConcurrentLoadAllThreshold());
 
@@ -139,7 +139,7 @@ public class GridCacheBalancingStoreSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testConcurrentLoadCustomThreshold() throws Exception {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setStoreConcurrentLoadAllThreshold(15);
 
@@ -180,7 +180,7 @@ public class GridCacheBalancingStoreSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testConcurrentLoadAll() throws Exception {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         assertEquals(CacheStoreBalancingWrapper.DFLT_LOAD_ALL_THRESHOLD, cfg.getStoreConcurrentLoadAllThreshold());
 
@@ -191,7 +191,7 @@ public class GridCacheBalancingStoreSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testConcurrentLoadAllCustomThreshold() throws Exception {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setStoreConcurrentLoadAllThreshold(15);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheExpiryStoreLoadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheExpiryStoreLoadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheExpiryStoreLoadSelfTest.java
index 6c1b02e..a6c9997 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheExpiryStoreLoadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/IgniteCacheExpiryStoreLoadSelfTest.java
@@ -160,7 +160,7 @@ public class IgniteCacheExpiryStoreLoadSelfTest extends GridCacheAbstractSelfTes
      * @throws Exception If failed.
      */
     public void testLoadAllWithExpiry() throws Exception {
-        IgniteCache<Integer, Integer> cache = ignite(0).<Integer, Integer>cache(null)
+        IgniteCache<Integer, Integer> cache = ignite(0).<Integer, Integer>cache(DEFAULT_CACHE_NAME)
             .withExpiryPolicy(new CreatedExpiryPolicy(new Duration(MILLISECONDS, TIME_TO_LIVE)));
 
         Set<Integer> keys = new HashSet<>();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/cache/store/StoreResourceInjectionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/StoreResourceInjectionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/StoreResourceInjectionSelfTest.java
index 0c4ea7d..f043746 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/StoreResourceInjectionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/StoreResourceInjectionSelfTest.java
@@ -34,7 +34,7 @@ public class StoreResourceInjectionSelfTest extends GridCommonAbstractTest {
     private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
 
     /** */
-    private CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>();
+    private CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreMultithreadedSelfTest.java
index df3a979..25b26a7 100644
--- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreMultithreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreMultithreadedSelfTest.java
@@ -73,11 +73,11 @@ public class GridCacheJdbcBlobStoreMultithreadedSelfTest extends GridCommonAbstr
 
         Ignite grid = startGrid(GRID_CNT - 2);
 
-        grid.createNearCache(null, new NearCacheConfiguration());
+        grid.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration());
 
         grid = startGrid(GRID_CNT - 1);
 
-        grid.cache(null);
+        grid.cache(DEFAULT_CACHE_NAME);
     }
 
     /** {@inheritDoc} */
@@ -192,7 +192,7 @@ public class GridCacheJdbcBlobStoreMultithreadedSelfTest extends GridCommonAbstr
                 for (int i = 0; i < TX_CNT; i++) {
                     IgniteEx ignite = grid(rnd.nextInt(GRID_CNT));
 
-                    IgniteCache<Object, Object> cache = ignite.cache(null);
+                    IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                     try (Transaction tx = ignite.transactions().txStart()) {
                         cache.put(1, "value");
@@ -249,7 +249,7 @@ public class GridCacheJdbcBlobStoreMultithreadedSelfTest extends GridCommonAbstr
         assertEquals(GRID_CNT, Ignition.allGrids().size());
 
         for (Ignite ignite : Ignition.allGrids()) {
-            GridCacheContext cctx = ((IgniteKernal)ignite).internalCache().context();
+            GridCacheContext cctx = ((IgniteKernal)ignite).internalCache(DEFAULT_CACHE_NAME).context();
 
             CacheStore store = cctx.store().configuredStore();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityMappedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityMappedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityMappedTest.java
index 7535228..68e2bb9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityMappedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityMappedTest.java
@@ -113,18 +113,18 @@ public class GridAffinityMappedTest extends GridCommonAbstractTest {
         //Key 0 is mapped to partition 0, first node.
         //Key 1 is mapped to partition 1, second node.
         //key 2 is mapped to partition 0, first node because mapper substitutes key 2 with affinity key 0.
-        Map<ClusterNode, Collection<Integer>> map = g1.<Integer>affinity(null).mapKeysToNodes(F.asList(0));
+        Map<ClusterNode, Collection<Integer>> map = g1.<Integer>affinity(DEFAULT_CACHE_NAME).mapKeysToNodes(F.asList(0));
 
         assertNotNull(map);
         assertEquals("Invalid map size: " + map.size(), 1, map.size());
         assertEquals(F.first(map.keySet()), first);
 
-        UUID id1 = g1.affinity(null).mapKeyToNode(1).id();
+        UUID id1 = g1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(1).id();
 
         assertNotNull(id1);
         assertEquals(second.id(),  id1);
 
-        UUID id2 = g1.affinity(null).mapKeyToNode(2).id();
+        UUID id2 = g1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(2).id();
 
         assertNotNull(id2);
         assertEquals(first.id(),  id2);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityP2PSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityP2PSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityP2PSelfTest.java
index 216c50e..35ebb0d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityP2PSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridAffinityP2PSelfTest.java
@@ -178,13 +178,13 @@ public class GridAffinityP2PSelfTest extends GridCommonAbstractTest {
             //Key 0 is mapped to partition 0, first node.
             //Key 1 is mapped to partition 1, second node.
             //key 2 is mapped to partition 0, first node because mapper substitutes key 2 with affinity key 0.
-            Map<ClusterNode, Collection<Integer>> map = g1.<Integer>affinity(null).mapKeysToNodes(F.asList(0));
+            Map<ClusterNode, Collection<Integer>> map = g1.<Integer>affinity(DEFAULT_CACHE_NAME).mapKeysToNodes(F.asList(0));
 
             assertNotNull(map);
             assertEquals("Invalid map size: " + map.size(), 1, map.size());
             assertEquals(F.first(map.keySet()), first);
 
-            ClusterNode n1 = g1.affinity(null).mapKeyToNode(1);
+            ClusterNode n1 = g1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(1);
 
             assertNotNull(n1);
 
@@ -193,7 +193,7 @@ public class GridAffinityP2PSelfTest extends GridCommonAbstractTest {
             assertNotNull(id1);
             assertEquals(second.id(), id1);
 
-            ClusterNode n2 = g1.affinity(null).mapKeyToNode(2);
+            ClusterNode n2 = g1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(2);
 
             assertNotNull(n2);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/GridAffinitySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinitySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridAffinitySelfTest.java
index 92933f9..7f7fbae 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridAffinitySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridAffinitySelfTest.java
@@ -95,18 +95,18 @@ public class GridAffinitySelfTest extends GridCommonAbstractTest {
 
         awaitPartitionMapExchange();
 
-        Map<ClusterNode, Collection<String>> map = g1.<String>affinity(null).mapKeysToNodes(F.asList("1"));
+        Map<ClusterNode, Collection<String>> map = g1.<String>affinity(DEFAULT_CACHE_NAME).mapKeysToNodes(F.asList("1"));
 
         assertNotNull(map);
         assertEquals("Invalid map size: " + map.size(), 1, map.size());
         assertEquals(F.first(map.keySet()), g2.cluster().localNode());
 
-        UUID id1 = g1.affinity(null).mapKeyToNode("2").id();
+        UUID id1 = g1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode("2").id();
 
         assertNotNull(id1);
         assertEquals(g2.cluster().localNode().id(), id1);
 
-        UUID id2 = g1.affinity(null).mapKeyToNode("3").id();
+        UUID id2 = g1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode("3").id();
 
         assertNotNull(id2);
         assertEquals(g2.cluster().localNode().id(), id2);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoverySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoverySelfTest.java
index c8e3143..5822ce7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoverySelfTest.java
@@ -297,7 +297,7 @@ public class GridDiscoverySelfTest extends GridCommonAbstractTest {
                 // 6          +     +
                 // 7          +       - only local node
 
-                Collection<ClusterNode> cacheNodes = discoMgr.cacheNodes(null, new AffinityTopologyVersion(ver));
+                Collection<ClusterNode> cacheNodes = discoMgr.cacheNodes(DEFAULT_CACHE_NAME, new AffinityTopologyVersion(ver));
 
                 Collection<UUID> act = new ArrayList<>(F.viewReadOnly(cacheNodes, new C1<ClusterNode, UUID>() {
                     @Override public UUID apply(ClusterNode n) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
index 0a55de1..cd6b2c0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridJobMasterLeaveAwareSelfTest.java
@@ -413,11 +413,11 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
     public void testAffinityRun() throws Exception {
         testMasterLeaveAwareCallback(1, new CX1<ClusterGroup, IgniteFuture<?>>() {
             @Override public IgniteFuture<?> applyx(ClusterGroup prj) {
-                Affinity<Object> aff = prj.ignite().affinity(null);
+                Affinity<Object> aff = prj.ignite().affinity(DEFAULT_CACHE_NAME);
 
                 ClusterNode node = F.first(prj.nodes());
 
-                return compute(prj).affinityRunAsync((String)null, keyForNode(aff, node), new TestRunnable());
+                return compute(prj).affinityRunAsync(DEFAULT_CACHE_NAME, keyForNode(aff, node), new TestRunnable());
             }
         });
     }
@@ -428,11 +428,11 @@ public class GridJobMasterLeaveAwareSelfTest extends GridCommonAbstractTest {
     public void testAffinityCall() throws Exception {
         testMasterLeaveAwareCallback(1, new CX1<ClusterGroup, IgniteFuture<?>>() {
             @Override public IgniteFuture<?> applyx(ClusterGroup prj) {
-                Affinity<Object> aff = prj.ignite().affinity(null);
+                Affinity<Object> aff = prj.ignite().affinity(DEFAULT_CACHE_NAME);
 
                 ClusterNode node = F.first(prj.nodes());
 
-                return compute(prj).affinityCallAsync((String)null, keyForNode(aff, node), new TestCallable());
+                return compute(prj).affinityCallAsync(DEFAULT_CACHE_NAME, keyForNode(aff, node), new TestCallable());
             }
         });
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java
index c4173d4..eea1c92 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java
@@ -33,6 +33,7 @@ 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 org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.cache.CacheMode.PARTITIONED;
@@ -59,7 +60,7 @@ public class GridProjectionForCachesSelfTest extends GridCommonAbstractTest {
         List<CacheConfiguration> ccfgs = new ArrayList<>();
 
         if (igniteInstanceName.equals(getTestIgniteInstanceName(0)))
-            ccfgs.add(cacheConfiguration(null, new AttributeFilter(getTestIgniteInstanceName(0)), false));
+            ccfgs.add(cacheConfiguration(DEFAULT_CACHE_NAME, new AttributeFilter(getTestIgniteInstanceName(0)), false));
         else if (igniteInstanceName.equals(getTestIgniteInstanceName(2)) ||
             igniteInstanceName.equals(getTestIgniteInstanceName(3)))
             ccfgs.add(cacheConfiguration(CACHE_NAME, new AttributeFilter(getTestIgniteInstanceName(2),
@@ -86,7 +87,7 @@ public class GridProjectionForCachesSelfTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     private CacheConfiguration cacheConfiguration(
-        @Nullable String cacheName,
+        @NotNull String cacheName,
         IgnitePredicate<ClusterNode> nodeFilter,
         boolean nearEnabled
     ) {
@@ -112,8 +113,8 @@ public class GridProjectionForCachesSelfTest extends GridCommonAbstractTest {
 
         grid(1).createNearCache(CACHE_NAME, new NearCacheConfiguration());
 
-        grid(2).cache(null);
-        grid(3).cache(null);
+        grid(2).cache(DEFAULT_CACHE_NAME);
+        grid(3).cache(DEFAULT_CACHE_NAME);
     }
 
     /** {@inheritDoc} */
@@ -130,7 +131,7 @@ public class GridProjectionForCachesSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testProjectionForDefaultCache() throws Exception {
-        ClusterGroup prj = ignite.cluster().forCacheNodes(null);
+        ClusterGroup prj = ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME);
 
         assertNotNull(prj);
         assertEquals(3, prj.nodes().size());
@@ -160,7 +161,7 @@ public class GridProjectionForCachesSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testProjectionForDataCaches() throws Exception {
-        ClusterGroup prj = ignite.cluster().forDataNodes(null);
+        ClusterGroup prj = ignite.cluster().forDataNodes(DEFAULT_CACHE_NAME);
 
         assert prj != null;
         assert prj.nodes().size() == 1;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
index cced946..d9cc732 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
@@ -88,7 +88,7 @@ public class GridProjectionLocalJobMultipleArgumentsSelfTest extends GridCommonA
         Collection<Integer> res = new ArrayList<>();
 
         for (int i : F.asList(1, 2, 3)) {
-            res.add(grid().compute().affinityCall((String)null, i, new IgniteCallable<Integer>() {
+            res.add(grid().compute().affinityCall(DEFAULT_CACHE_NAME, i, new IgniteCallable<Integer>() {
                 @Override public Integer call() {
                     ids.add(this);
 
@@ -106,7 +106,7 @@ public class GridProjectionLocalJobMultipleArgumentsSelfTest extends GridCommonA
      */
     public void testAffinityRun() throws Exception {
         for (int i : F.asList(1, 2, 3)) {
-            grid().compute().affinityRun((String)null, i, new IgniteRunnable() {
+            grid().compute().affinityRun(DEFAULT_CACHE_NAME, i, new IgniteRunnable() {
                 @Override public void run() {
                     ids.add(this);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/GridStartStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridStartStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridStartStopSelfTest.java
index 3d21d32..b6ad64c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridStartStopSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridStartStopSelfTest.java
@@ -79,7 +79,7 @@ public class GridStartStopSelfTest extends GridCommonAbstractTest {
 
         cfg.setIgniteInstanceName(getTestIgniteInstanceName(0));
 
-        CacheConfiguration cc = new CacheConfiguration();
+        CacheConfiguration cc = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cc.setAtomicityMode(TRANSACTIONAL);
 
@@ -91,7 +91,7 @@ public class GridStartStopSelfTest extends GridCommonAbstractTest {
 
         cfg.setIgniteInstanceName(getTestIgniteInstanceName(1));
 
-        cc = new CacheConfiguration();
+        cc = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cc.setAtomicityMode(TRANSACTIONAL);
 
@@ -105,7 +105,7 @@ public class GridStartStopSelfTest extends GridCommonAbstractTest {
             @Override public void run() {
                 try {
                     try (Transaction ignored = g0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
-                        g0.cache(null).get(1);
+                        g0.cache(DEFAULT_CACHE_NAME).get(1);
 
                         latch.countDown();
 
@@ -129,7 +129,7 @@ public class GridStartStopSelfTest extends GridCommonAbstractTest {
         info("Before remove.");
 
         try {
-            g1.cache(null).remove(1);
+            g1.cache(DEFAULT_CACHE_NAME).remove(1);
         }
         catch (CacheException ignore) {
             // No-op.

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java
index da6875c..1358936 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskFailoverAffinityRunTest.java
@@ -64,7 +64,7 @@ public class GridTaskFailoverAffinityRunTest extends GridCommonAbstractTest {
             ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);
         }
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -134,7 +134,7 @@ public class GridTaskFailoverAffinityRunTest extends GridCommonAbstractTest {
                 Collection<IgniteFuture<?>> futs = new ArrayList<>(1000);
 
                 for (int i = 0; i < 1000; i++) {
-                    IgniteFuture<?> fut0 = grid(0).compute().affinityCallAsync((String)null, i, new TestJob());
+                    IgniteFuture<?> fut0 = grid(0).compute().affinityCallAsync(DEFAULT_CACHE_NAME, i, new TestJob());
 
                     assertNotNull(fut0);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java
index 37ca6bd..07b655d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectApiExceptionTest.java
@@ -64,7 +64,7 @@ public class IgniteClientReconnectApiExceptionTest extends IgniteClientReconnect
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        cfg.setCacheConfiguration(new CacheConfiguration());
+        cfg.setCacheConfiguration(new CacheConfiguration(DEFAULT_CACHE_NAME));
 
         return cfg;
     }
@@ -219,7 +219,7 @@ public class IgniteClientReconnectApiExceptionTest extends IgniteClientReconnect
 
         final Ignite client = startGrid(serverCount());
 
-        final IgniteCache<Object, Object> dfltCache = client.cache(null);
+        final IgniteCache<Object, Object> dfltCache = client.cache(DEFAULT_CACHE_NAME);
 
         assertNotNull(dfltCache);
 
@@ -425,7 +425,7 @@ public class IgniteClientReconnectApiExceptionTest extends IgniteClientReconnect
                         boolean failed = false;
 
                         try {
-                            client.cache(null);
+                            client.cache(DEFAULT_CACHE_NAME);
                         }
                         catch (IgniteClientDisconnectedException e) {
                             failed = true;
@@ -435,7 +435,7 @@ public class IgniteClientReconnectApiExceptionTest extends IgniteClientReconnect
 
                         assertTrue(failed);
 
-                        return client.cache(null);
+                        return client.cache(DEFAULT_CACHE_NAME);
                     }
                 },
                 new C1<Object, Boolean>() {
@@ -459,7 +459,7 @@ public class IgniteClientReconnectApiExceptionTest extends IgniteClientReconnect
                         boolean failed = false;
 
                         try {
-                            client.dataStreamer(null);
+                            client.dataStreamer(DEFAULT_CACHE_NAME);
                         }
                         catch (IgniteClientDisconnectedException e) {
                             failed = true;
@@ -469,7 +469,7 @@ public class IgniteClientReconnectApiExceptionTest extends IgniteClientReconnect
 
                         assertTrue(failed);
 
-                        return client.dataStreamer(null);
+                        return client.dataStreamer(DEFAULT_CACHE_NAME);
                     }
                 },
                 new C1<Object, Boolean>() {
@@ -480,7 +480,7 @@ public class IgniteClientReconnectApiExceptionTest extends IgniteClientReconnect
 
                         streamer.close();
 
-                        assertEquals(2, client.cache(null).get(2));
+                        assertEquals(2, client.cache(DEFAULT_CACHE_NAME).get(2));
 
                         return true;
                     }
@@ -535,7 +535,7 @@ public class IgniteClientReconnectApiExceptionTest extends IgniteClientReconnect
 
         final Ignite client = startGrid(serverCount());
 
-        final IgniteCache<Object, Object> dfltCache = client.cache(null);
+        final IgniteCache<Object, Object> dfltCache = client.cache(DEFAULT_CACHE_NAME);
 
         final CountDownLatch recvLatch = new CountDownLatch(1);
 
@@ -766,7 +766,7 @@ public class IgniteClientReconnectApiExceptionTest extends IgniteClientReconnect
     @SuppressWarnings("unchecked")
     private void doTestIgniteOperationOnDisconnect(Ignite client, final List<T2<Callable, C1<Object, Boolean>>> ops)
         throws Exception {
-        assertNotNull(client.cache(null));
+        assertNotNull(client.cache(DEFAULT_CACHE_NAME));
 
         final TestTcpDiscoverySpi clientSpi = spi(client);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
index 5e3b896..264a837 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCacheTest.java
@@ -122,7 +122,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
             nodeId = null;
         }
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(STATIC_CACHE);
 
@@ -160,7 +160,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
         TestTcpDiscoverySpi srvSpi = spi(srv);
 
-        final IgniteCache<Object, Object> cache = client.getOrCreateCache(new CacheConfiguration<>());
+        final IgniteCache<Object, Object> cache = client.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
 
         final IgniteCache<Object, Object> staticCache = client.cache(STATIC_CACHE);
 
@@ -168,7 +168,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
         assertEquals(1, staticCache.get(1));
 
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
         ccfg.setName("nearCache");
@@ -289,7 +289,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
         IgniteEx srv2 = startGrid(SRV_CNT + 1);
 
-        Integer key = primaryKey(srv2.cache(null));
+        Integer key = primaryKey(srv2.cache(DEFAULT_CACHE_NAME));
 
         cache.put(key, 4);
 
@@ -320,7 +320,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
         Ignite srv = clientRouter(client);
 
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(TRANSACTIONAL);
         ccfg.setCacheMode(PARTITIONED);
@@ -387,7 +387,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
         IgniteEx client = startGrid(SRV_CNT);
 
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(TRANSACTIONAL);
         ccfg.setCacheMode(PARTITIONED);
@@ -544,7 +544,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
         final IgniteEx client = startGrid(SRV_CNT);
 
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(TRANSACTIONAL);
         ccfg.setCacheMode(PARTITIONED);
@@ -642,7 +642,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
             log.info("Expected error: " + e);
         }
 
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setName("newCache");
 
@@ -786,7 +786,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
         for (CacheAtomicityMode atomicityMode : CacheAtomicityMode.values()) {
             for (CacheWriteSynchronizationMode syncMode : CacheWriteSynchronizationMode.values()) {
-                CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+                CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
                 ccfg.setAtomicityMode(atomicityMode);
 
@@ -829,11 +829,11 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
         final Ignite srv = clientRouter(client);
 
-        final IgniteCache<Object, Object> clientCache = client.getOrCreateCache(new CacheConfiguration<>());
+        final IgniteCache<Object, Object> clientCache = client.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
 
         reconnectClientNode(client, srv, new Runnable() {
             @Override public void run() {
-                srv.destroyCache(null);
+                srv.destroyCache(DEFAULT_CACHE_NAME);
             }
         });
 
@@ -845,7 +845,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
         checkCacheDiscoveryData(srv, client, null, false, false, false);
 
-        IgniteCache<Object, Object> clientCache0 = client.getOrCreateCache(new CacheConfiguration<>());
+        IgniteCache<Object, Object> clientCache0 = client.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
 
         checkCacheDiscoveryData(srv, client, null, true, true, false);
 
@@ -866,16 +866,16 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
         final Ignite srv = clientRouter(client);
 
-        final IgniteCache<Object, Object> clientCache = client.getOrCreateCache(new CacheConfiguration<>());
+        final IgniteCache<Object, Object> clientCache = client.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
 
         assertEquals(ATOMIC,
             clientCache.getConfiguration(CacheConfiguration.class).getAtomicityMode());
 
         reconnectClientNode(client, srv, new Runnable() {
             @Override public void run() {
-                srv.destroyCache(null);
+                srv.destroyCache(DEFAULT_CACHE_NAME);
 
-                CacheConfiguration ccfg = new CacheConfiguration();
+                CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
                 ccfg.setAtomicityMode(TRANSACTIONAL);
 
@@ -891,7 +891,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
         checkCacheDiscoveryData(srv, client, null, true, false, false);
 
-        IgniteCache<Object, Object> clientCache0 = client.cache(null);
+        IgniteCache<Object, Object> clientCache0 = client.cache(DEFAULT_CACHE_NAME);
 
         checkCacheDiscoveryData(srv, client, null, true, true, false);
 
@@ -915,8 +915,8 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
         final Ignite srv = clientRouter(client);
 
-        final IgniteCache<Object, Object> clientCache = client.getOrCreateCache(new CacheConfiguration<>());
-        final IgniteCache<Object, Object> srvCache = srv.cache(null);
+        final IgniteCache<Object, Object> clientCache = client.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
+        final IgniteCache<Object, Object> srvCache = srv.cache(DEFAULT_CACHE_NAME);
 
         assertNotNull(srvCache);
 
@@ -958,7 +958,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
         final CountDownLatch disconnectLatch = new CountDownLatch(1);
         final CountDownLatch reconnectLatch = new CountDownLatch(1);
 
-        final IgniteCache<Object, Object> clientCache = client.getOrCreateCache(new CacheConfiguration<>());
+        final IgniteCache<Object, Object> clientCache = client.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
 
         clientCache.put(1, new TestClass1());
 
@@ -996,12 +996,12 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
             }
         }, IllegalStateException.class, null);
 
-        IgniteCache<Object, Object> srvCache = srv.getOrCreateCache(new CacheConfiguration<>());
+        IgniteCache<Object, Object> srvCache = srv.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
 
         srvCache.put(1, new TestClass1());
         srvCache.put(2, new TestClass2());
 
-        IgniteCache<Object, Object> clientCache2 = client.cache(null);
+        IgniteCache<Object, Object> clientCache2 = client.cache(DEFAULT_CACHE_NAME);
 
         assertNotNull(clientCache2);
 
@@ -1027,7 +1027,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
             addListener(client, disconnectLatch, reconnectLatch);
 
-            IgniteCache cache = client.getOrCreateCache(new CacheConfiguration<>());
+            IgniteCache cache = client.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
 
             assertNotNull(cache);
 
@@ -1058,11 +1058,11 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
         for (int i = 0; i < SRV_CNT + CLIENTS; i++) {
             Ignite ignite = grid(i);
 
-            ClusterGroup grp = ignite.cluster().forCacheNodes(null);
+            ClusterGroup grp = ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME);
 
             assertEquals(0, grp.nodes().size());
 
-            grp = ignite.cluster().forClientNodes(null);
+            grp = ignite.cluster().forClientNodes(DEFAULT_CACHE_NAME);
 
             assertEquals(0, grp.nodes().size());
         }
@@ -1087,7 +1087,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
      * @throws Exception If failed.
      */
     private void reconnectMultinode(boolean longHist) throws Exception {
-        grid(0).createCache(new CacheConfiguration<>());
+        grid(0).createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
 
         clientMode = true;
 
@@ -1098,7 +1098,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
         for (int i = 0; i < CLIENTS; i++) {
             Ignite client = startGrid(SRV_CNT + i);
 
-            assertNotNull(client.getOrCreateCache(new CacheConfiguration<>()));
+            assertNotNull(client.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME)));
 
             clients.add(client);
         }
@@ -1133,7 +1133,7 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
             final int expNodes = CLIENTS + srvNodes;
 
             for (final Ignite client : clients) {
-                IgniteCache<Object, Object> cache = client.cache(null);
+                IgniteCache<Object, Object> cache = client.cache(DEFAULT_CACHE_NAME);
 
                 assertNotNull(cache);
 
@@ -1143,17 +1143,17 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
                 GridTestUtils.waitForCondition(new GridAbsPredicate() {
                     @Override public boolean apply() {
-                        ClusterGroup grp = client.cluster().forCacheNodes(null);
+                        ClusterGroup grp = client.cluster().forCacheNodes(DEFAULT_CACHE_NAME);
 
                         return grp.nodes().size() == expNodes;
                     }
                 }, 5000);
 
-                ClusterGroup grp = client.cluster().forCacheNodes(null);
+                ClusterGroup grp = client.cluster().forCacheNodes(DEFAULT_CACHE_NAME);
 
                 assertEquals(CLIENTS + srvNodes, grp.nodes().size());
 
-                grp = client.cluster().forClientNodes(null);
+                grp = client.cluster().forClientNodes(DEFAULT_CACHE_NAME);
 
                 assertEquals(CLIENTS, grp.nodes().size());
             }
@@ -1163,17 +1163,17 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
                 GridTestUtils.waitForCondition(new GridAbsPredicate() {
                     @Override public boolean apply() {
-                        ClusterGroup grp = ignite.cluster().forCacheNodes(null);
+                        ClusterGroup grp = ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME);
 
                         return grp.nodes().size() == expNodes;
                     }
                 }, 5000);
 
-                ClusterGroup grp = ignite.cluster().forCacheNodes(null);
+                ClusterGroup grp = ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME);
 
                 assertEquals(CLIENTS + srvNodes, grp.nodes().size());
 
-                grp = ignite.cluster().forClientNodes(null);
+                grp = ignite.cluster().forClientNodes(DEFAULT_CACHE_NAME);
 
                 assertEquals(CLIENTS, grp.nodes().size());
             }
@@ -1198,10 +1198,10 @@ public class IgniteClientReconnectCacheTest extends IgniteClientReconnectAbstrac
 
         Ignite client = startGrid(SRV_CNT);
 
-        CacheConfiguration<Integer, Integer> ccfg1 = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg1 = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         ccfg1.setName("cache1");
 
-        CacheConfiguration<Integer, Integer> ccfg2 = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg2 = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         ccfg2.setName("cache2");
 
         final Ignite srv = grid(0);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectContinuousProcessorTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectContinuousProcessorTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectContinuousProcessorTest.java
index 0ff5883..ca0d889 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectContinuousProcessorTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectContinuousProcessorTest.java
@@ -216,7 +216,7 @@ public class IgniteClientReconnectContinuousProcessorTest extends IgniteClientRe
 
         assertTrue(client.cluster().localNode().isClient());
 
-        IgniteCache<Object, Object> clientCache = client.getOrCreateCache(new CacheConfiguration<>());
+        IgniteCache<Object, Object> clientCache = client.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
 
         CacheEventListener lsnr = new CacheEventListener();
 
@@ -253,7 +253,7 @@ public class IgniteClientReconnectContinuousProcessorTest extends IgniteClientRe
 
         assertTrue(client.cluster().localNode().isClient());
 
-        IgniteCache<Object, Object> clientCache = client.getOrCreateCache(new CacheConfiguration<>());
+        IgniteCache<Object, Object> clientCache = client.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
 
         CacheEventListener lsnr = new CacheEventListener();
 
@@ -273,7 +273,7 @@ public class IgniteClientReconnectContinuousProcessorTest extends IgniteClientRe
 
             lsnr.latch = new CountDownLatch(10);
 
-            IgniteCache<Object, Object> newSrvCache = newSrv.cache(null);
+            IgniteCache<Object, Object> newSrvCache = newSrv.cache(DEFAULT_CACHE_NAME);
 
             for (Integer key : primaryKeys(newSrvCache, 10))
                 newSrvCache.put(key, key);
@@ -289,7 +289,7 @@ public class IgniteClientReconnectContinuousProcessorTest extends IgniteClientRe
 
             lsnr.latch = new CountDownLatch(5);
 
-            IgniteCache<Object, Object> newSrvCache = newSrv.cache(null);
+            IgniteCache<Object, Object> newSrvCache = newSrv.cache(DEFAULT_CACHE_NAME);
 
             for (Integer key : primaryKeys(newSrvCache, 5))
                 newSrvCache.put(key, key);
@@ -343,7 +343,7 @@ public class IgniteClientReconnectContinuousProcessorTest extends IgniteClientRe
 
         lsnr.latch = new CountDownLatch(1);
 
-        srv.cache(null).put(2, 2);
+        srv.cache(DEFAULT_CACHE_NAME).put(2, 2);
 
         assertTrue(lsnr.latch.await(5000, MILLISECONDS));
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectFailoverTest.java
index 81b8ec2..57c2e93 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectFailoverTest.java
@@ -54,13 +54,13 @@ public class IgniteClientReconnectFailoverTest extends IgniteClientReconnectFail
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration ccfg1 = new CacheConfiguration();
+        CacheConfiguration ccfg1 = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg1.setName(ATOMIC_CACHE);
         ccfg1.setBackups(1);
         ccfg1.setAtomicityMode(ATOMIC);
 
-        CacheConfiguration ccfg2 = new CacheConfiguration();
+        CacheConfiguration ccfg2 = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg2.setName(TX_CACHE);
         ccfg2.setBackups(1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectStopTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectStopTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectStopTest.java
index 7a8f8fa..e863cdf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectStopTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectStopTest.java
@@ -83,7 +83,7 @@ public class IgniteClientReconnectStopTest extends IgniteClientReconnectAbstract
         IgniteFuture<?> reconnectFut = null;
 
         try {
-            client.getOrCreateCache(new CacheConfiguration<>());
+            client.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
 
             fail();
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java
index 489979f..2c70b5b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteComputeEmptyClusterGroupTest.java
@@ -82,11 +82,11 @@ public class IgniteComputeEmptyClusterGroupTest extends GridCommonAbstractTest {
 
         IgniteCompute comp = ignite(0).compute(empty);
 
-        checkFutureFails(comp.affinityRunAsync((String)null, 1, new FailRunnable()));
+        checkFutureFails(comp.affinityRunAsync(DEFAULT_CACHE_NAME, 1, new FailRunnable()));
 
         checkFutureFails(comp.applyAsync(new FailClosure(), new Object()));
 
-        checkFutureFails(comp.affinityCallAsync((String)null, 1, new FailCallable()));
+        checkFutureFails(comp.affinityCallAsync(DEFAULT_CACHE_NAME, 1, new FailCallable()));
 
         checkFutureFails(comp.broadcastAsync(new FailCallable()));
     }
@@ -104,7 +104,7 @@ public class IgniteComputeEmptyClusterGroupTest extends GridCommonAbstractTest {
         GridTestUtils.assertThrows(log, new Callable<Void>() {
             @Override
             public Void call() throws Exception {
-                comp.affinityRun((String)null, 1, new FailRunnable());
+                comp.affinityRun(DEFAULT_CACHE_NAME, 1, new FailRunnable());
 
                 return null;
             }
@@ -121,7 +121,7 @@ public class IgniteComputeEmptyClusterGroupTest extends GridCommonAbstractTest {
         GridTestUtils.assertThrows(log, new Callable<Void>() {
             @Override
             public Void call() throws Exception {
-                comp.affinityCall((String)null, 1, new FailCallable());
+                comp.affinityCall(DEFAULT_CACHE_NAME, 1, new FailCallable());
 
                 return null;
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/IgniteConcurrentEntryProcessorAccessStopTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteConcurrentEntryProcessorAccessStopTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteConcurrentEntryProcessorAccessStopTest.java
index 864c9dc..743bb98 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteConcurrentEntryProcessorAccessStopTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteConcurrentEntryProcessorAccessStopTest.java
@@ -46,7 +46,7 @@ public class IgniteConcurrentEntryProcessorAccessStopTest extends GridCommonAbst
      * @throws Exception If failed.
      */
     public void testConcurrentAccess() throws Exception {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         Ignite ignite = grid();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryEnumsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryEnumsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryEnumsSelfTest.java
index 6cac96c..a223022 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryEnumsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryEnumsSelfTest.java
@@ -90,7 +90,7 @@ public class BinaryEnumsSelfTest extends GridCommonAbstractTest {
 
         cfg.setMarshaller(new BinaryMarshaller());
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
         ccfg.setName(CACHE_NAME);
         ccfg.setCacheMode(CacheMode.PARTITIONED);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
index 6f2a103..145dbb4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryObjectBuilderAdditionalSelfTest.java
@@ -79,7 +79,7 @@ public class BinaryObjectBuilderAdditionalSelfTest extends GridCommonAbstractTes
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration cacheCfg = new CacheConfiguration();
+        CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
         cacheCfg.setCacheMode(REPLICATED);
 
         CacheConfiguration cacheCfg2 = new CacheConfiguration("partitioned");

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryTreeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryTreeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryTreeSelfTest.java
index 91b8498..9481340 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryTreeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/BinaryTreeSelfTest.java
@@ -236,7 +236,7 @@ public class BinaryTreeSelfTest extends GridCommonAbstractTest {
      * @return Cache.
      */
     private IgniteCache cache() {
-        return G.ignite(NODE_CLI).cache(null);
+        return G.ignite(NODE_CLI).cache(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -277,7 +277,7 @@ public class BinaryTreeSelfTest extends GridCommonAbstractTest {
 
         cfg.setDiscoverySpi(discoSpi);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(CacheMode.PARTITIONED);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/binary/GridBinaryAffinityKeySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/GridBinaryAffinityKeySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/GridBinaryAffinityKeySelfTest.java
index c6a5cd8..bdcb106 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/GridBinaryAffinityKeySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/GridBinaryAffinityKeySelfTest.java
@@ -78,7 +78,7 @@ public class GridBinaryAffinityKeySelfTest extends GridCommonAbstractTest {
         cfg.setMarshaller(new BinaryMarshaller());
 
         if (!igniteInstanceName.equals(getTestIgniteInstanceName(GRID_CNT))) {
-            CacheConfiguration cacheCfg = new CacheConfiguration();
+            CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             cacheCfg.setCacheMode(PARTITIONED);
 
@@ -108,7 +108,7 @@ public class GridBinaryAffinityKeySelfTest extends GridCommonAbstractTest {
 
         try (Ignite igniteNoCache = startGrid(GRID_CNT)) {
             try {
-                igniteNoCache.cache(null);
+                igniteNoCache.cache(DEFAULT_CACHE_NAME);
             }
             catch (IllegalArgumentException ignore) {
                 // Expected error.
@@ -123,14 +123,14 @@ public class GridBinaryAffinityKeySelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     private void checkAffinity(Ignite ignite) throws Exception {
-        Affinity<Object> aff = ignite.affinity(null);
+        Affinity<Object> aff = ignite.affinity(DEFAULT_CACHE_NAME);
 
         GridAffinityProcessor affProc = ((IgniteKernal)ignite).context().affinity();
 
         IgniteCacheObjectProcessor cacheObjProc = ((IgniteKernal)ignite).context().cacheObjects();
 
         CacheObjectContext cacheObjCtx = cacheObjProc.contextForCache(
-            ignite.cache(null).getConfiguration(CacheConfiguration.class));
+            ignite.cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class));
 
         for (int i = 0; i < 1000; i++) {
             assertEquals(i, aff.affinityKey(i));
@@ -155,17 +155,17 @@ public class GridBinaryAffinityKeySelfTest extends GridCommonAbstractTest {
 
             assertEquals(aff.mapKeyToNode(i), aff.mapKeyToNode(cacheObj));
 
-            assertEquals(i, affProc.affinityKey(null, i));
+            assertEquals(i, affProc.affinityKey(DEFAULT_CACHE_NAME, i));
 
-            assertEquals(i, affProc.affinityKey(null, new TestObject(i)));
+            assertEquals(i, affProc.affinityKey(DEFAULT_CACHE_NAME, new TestObject(i)));
 
-            assertEquals(i, affProc.affinityKey(null, cacheObj));
+            assertEquals(i, affProc.affinityKey(DEFAULT_CACHE_NAME, cacheObj));
 
-            assertEquals(affProc.mapKeyToNode(null, i), affProc.mapKeyToNode(null, new TestObject(i)));
+            assertEquals(affProc.mapKeyToNode(DEFAULT_CACHE_NAME, i), affProc.mapKeyToNode(DEFAULT_CACHE_NAME, new TestObject(i)));
 
-            assertEquals(affProc.mapKeyToNode(null, i), affProc.mapKeyToNode(null, cacheObj));
+            assertEquals(affProc.mapKeyToNode(DEFAULT_CACHE_NAME, i), affProc.mapKeyToNode(DEFAULT_CACHE_NAME, cacheObj));
 
-            assertEquals(affProc.mapKeyToNode(null, new AffinityKey(0, i)), affProc.mapKeyToNode(null, i));
+            assertEquals(affProc.mapKeyToNode(DEFAULT_CACHE_NAME, new AffinityKey(0, i)), affProc.mapKeyToNode(DEFAULT_CACHE_NAME, i));
         }
     }
 
@@ -173,12 +173,12 @@ public class GridBinaryAffinityKeySelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testAffinityRun() throws Exception {
-        Affinity<Object> aff = grid(0).affinity(null);
+        Affinity<Object> aff = grid(0).affinity(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < 1000; i++) {
             nodeId.set(null);
 
-            grid(0).compute().affinityRun((String)null, new TestObject(i), new IgniteRunnable() {
+            grid(0).compute().affinityRun(DEFAULT_CACHE_NAME, new TestObject(i), new IgniteRunnable() {
                 @IgniteInstanceResource
                 private Ignite ignite;
 
@@ -189,7 +189,7 @@ public class GridBinaryAffinityKeySelfTest extends GridCommonAbstractTest {
 
             assertEquals(aff.mapKeyToNode(i).id(), nodeId.get());
 
-            grid(0).compute().affinityRun((String)null, new AffinityKey(0, i), new IgniteRunnable() {
+            grid(0).compute().affinityRun(DEFAULT_CACHE_NAME, new AffinityKey(0, i), new IgniteRunnable() {
                 @IgniteInstanceResource
                 private Ignite ignite;
 
@@ -206,12 +206,12 @@ public class GridBinaryAffinityKeySelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testAffinityCall() throws Exception {
-        Affinity<Object> aff = grid(0).affinity(null);
+        Affinity<Object> aff = grid(0).affinity(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < 1000; i++) {
             nodeId.set(null);
 
-            grid(0).compute().affinityCall((String)null, new TestObject(i), new IgniteCallable<Object>() {
+            grid(0).compute().affinityCall(DEFAULT_CACHE_NAME, new TestObject(i), new IgniteCallable<Object>() {
                 @IgniteInstanceResource
                 private Ignite ignite;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/binary/GridDefaultBinaryMappersBinaryMetaDataSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/binary/GridDefaultBinaryMappersBinaryMetaDataSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/binary/GridDefaultBinaryMappersBinaryMetaDataSelfTest.java
index 04e80d4..0e3f799 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/binary/GridDefaultBinaryMappersBinaryMetaDataSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/binary/GridDefaultBinaryMappersBinaryMetaDataSelfTest.java
@@ -64,7 +64,7 @@ public class GridDefaultBinaryMappersBinaryMetaDataSelfTest extends GridCommonAb
 
         cfg.setMarshaller(new BinaryMarshaller());
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setCacheConfiguration(ccfg);
 
@@ -151,7 +151,7 @@ public class GridDefaultBinaryMappersBinaryMetaDataSelfTest extends GridCommonAb
                 assert false : meta.typeName();
         }
 
-        grid().cache(null).put(new AffinityKey<>(1, 1), 1);
+        grid().cache(DEFAULT_CACHE_NAME).put(new AffinityKey<>(1, 1), 1);
 
         metas = binaries().types();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteVariousConnectionNumberTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteVariousConnectionNumberTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteVariousConnectionNumberTest.java
index 9e955e3..9cc46d9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteVariousConnectionNumberTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/communication/IgniteVariousConnectionNumberTest.java
@@ -100,7 +100,7 @@ public class IgniteVariousConnectionNumberTest extends GridCommonAbstractTest {
 
         startGridsMultiThreaded(3, 3);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(REPLICATED);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
@@ -137,7 +137,7 @@ public class IgniteVariousConnectionNumberTest extends GridCommonAbstractTest {
             @Override public Void call() throws Exception {
                 Ignite node = ignite(idx.getAndIncrement() % NODES);
 
-                IgniteCache cache = node.cache(null);
+                IgniteCache cache = node.cache(DEFAULT_CACHE_NAME);
 
                 long stopTime = U.currentTimeMillis() + time;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/GridDeploymentMessageCountSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/GridDeploymentMessageCountSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/GridDeploymentMessageCountSelfTest.java
index 2038993..ce3f6a6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/GridDeploymentMessageCountSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/deployment/GridDeploymentMessageCountSelfTest.java
@@ -143,12 +143,12 @@ public class GridDeploymentMessageCountSelfTest extends GridCommonAbstractTest {
         try {
             startGrids(2);
 
-            IgniteCache<Object, Object> cache = grid(0).cache(null);
+            IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             cache.put("key", valCls.newInstance());
 
             for (int i = 0; i < 2; i++)
-                assertNotNull("For grid: " + i, grid(i).cache(null).localPeek("key", CachePeekMode.ONHEAP));
+                assertNotNull("For grid: " + i, grid(i).cache(DEFAULT_CACHE_NAME).localPeek("key", CachePeekMode.ONHEAP));
 
             for (MessageCountingCommunicationSpi spi : commSpis.values()) {
                 assertTrue(spi.deploymentMessageCount() > 0);
@@ -162,7 +162,7 @@ public class GridDeploymentMessageCountSelfTest extends GridCommonAbstractTest {
                 cache.put(key, valCls.newInstance());
 
                 for (int k = 0; k < 2; k++)
-                    assertNotNull(grid(k).cache(null).localPeek(key, CachePeekMode.ONHEAP));
+                    assertNotNull(grid(k).cache(DEFAULT_CACHE_NAME).localPeek(key, CachePeekMode.ONHEAP));
             }
 
             for (MessageCountingCommunicationSpi spi : commSpis.values())

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
index 1847303..3807939 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAliveCacheSelfTest.java
@@ -125,7 +125,7 @@ public class GridDiscoveryManagerAliveCacheSelfTest extends GridCommonAbstractTe
         }
 
         for (int i = 0; i < PERM_NODES_CNT + TMP_NODES_CNT; i++)
-            F.rand(alive).cache(null).put(i, String.valueOf(i));
+            F.rand(alive).cache(DEFAULT_CACHE_NAME).put(i, String.valueOf(i));
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/marshaller/optimized/OptimizedMarshallerNodeFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/marshaller/optimized/OptimizedMarshallerNodeFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/marshaller/optimized/OptimizedMarshallerNodeFailoverTest.java
index f842b5f..7bd0a5d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/marshaller/optimized/OptimizedMarshallerNodeFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/marshaller/optimized/OptimizedMarshallerNodeFailoverTest.java
@@ -67,7 +67,7 @@ public class OptimizedMarshallerNodeFailoverTest extends GridCommonAbstractTest
         cfg.setWorkDirectory(workDir);
 
         if (cache) {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             ccfg.setCacheMode(PARTITIONED);
             ccfg.setBackups(1);
@@ -106,7 +106,7 @@ public class OptimizedMarshallerNodeFailoverTest extends GridCommonAbstractTest
 
         cache = stopSrv;
 
-        IgniteCache<Integer, Object> cache0 = ignite(0).cache(null);
+        IgniteCache<Integer, Object> cache0 = ignite(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < 20; i++) {
             log.info("Iteration: " + i);
@@ -135,7 +135,7 @@ public class OptimizedMarshallerNodeFailoverTest extends GridCommonAbstractTest
 
         Ignite ignite = startGrid(2); // Check can start one more cache node.
 
-        assertNotNull(ignite.cache(null));
+        assertNotNull(ignite.cache(DEFAULT_CACHE_NAME));
     }
 
     /**


[04/51] [abbrv] ignite git commit: ignite-1794 Refactored hibernate modules, switched to hibernate 5.1

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateEntityRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateEntityRegion.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateEntityRegion.java
deleted file mode 100644
index 1842a63..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateEntityRegion.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.Ignite;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.internal.DefaultCacheKeysFactory;
-import org.hibernate.cache.spi.CacheDataDescription;
-import org.hibernate.cache.spi.EntityRegion;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cache.spi.access.EntityRegionAccessStrategy;
-import org.hibernate.cache.spi.access.SoftLock;
-import org.hibernate.engine.spi.SessionFactoryImplementor;
-import org.hibernate.engine.spi.SharedSessionContractImplementor;
-import org.hibernate.persister.entity.EntityPersister;
-
-/**
- * Implementation of {@link EntityRegion}. This region is used to store entity data.
- * <p>
- * L2 cache for entity can be enabled in the Hibernate configuration file:
- * <pre name="code" class="xml">
- * &lt;hibernate-configuration&gt;
- *     &lt;!-- Enable L2 cache. --&gt;
- *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
- *
- *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
- *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
- *
- *     &lt;!-- Specify entity. --&gt;
- *     &lt;mapping class="com.example.Entity"/&gt;
- *
- *     &lt;!-- Enable L2 cache with nonstrict-read-write access strategy for entity. --&gt;
- *     &lt;class-cache class="com.example.Entity" usage="nonstrict-read-write"/&gt;
- * &lt;/hibernate-configuration&gt;
- * </pre>
- * Also cache for entity can be enabled using annotations:
- * <pre name="code" class="java">
- * &#064;javax.persistence.Entity
- * &#064;javax.persistence.Cacheable
- * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
- * public class Entity { ... }
- * </pre>
- */
-public class HibernateEntityRegion extends HibernateTransactionalDataRegion implements EntityRegion {
-    /**
-     * @param factory Region factory.
-     * @param name Region name.
-     * @param ignite Grid.
-     * @param cache Region cache,
-     * @param dataDesc Region data description.
-     */
-    public HibernateEntityRegion(HibernateRegionFactory factory, String name, Ignite ignite,
-        HibernateCacheProxy cache, CacheDataDescription dataDesc) {
-        super(factory, name, ignite, cache, dataDesc);
-    }
-
-    /** {@inheritDoc} */
-    @Override public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
-        return new AccessStrategy(createAccessStrategy(accessType));
-    }
-
-    /**
-     * Entity region access strategy.
-     */
-    private class AccessStrategy extends HibernateAbstractRegionAccessStrategy
-        implements EntityRegionAccessStrategy {
-        /**
-         * @param stgy Access strategy implementation.
-         */
-        private AccessStrategy(HibernateAccessStrategyAdapter stgy) {
-            super(stgy);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object generateCacheKey(Object id,
-            EntityPersister persister,
-            SessionFactoryImplementor factory,
-            String tenantIdentifier) {
-            return HibernateKeyWrapper.staticCreateEntityKey(id, persister, tenantIdentifier);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object getCacheKeyId(Object cacheKey) {
-            return ((HibernateKeyWrapper)cacheKey).id();
-        }
-
-        /** {@inheritDoc} */
-        @Override public EntityRegion getRegion() {
-            return HibernateEntityRegion.this;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean insert(SharedSessionContractImplementor ses, Object key, Object val, Object ver) throws CacheException {
-            return stgy.insert(key, val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean afterInsert(SharedSessionContractImplementor ses, Object key, Object val, Object ver) throws CacheException {
-            return stgy.afterInsert(key, val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean update(SharedSessionContractImplementor ses, Object key, Object val, Object currVer, Object previousVer)
-            throws CacheException {
-            return stgy.update(key, val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean afterUpdate(SharedSessionContractImplementor ses, Object key, Object val, Object currVer, Object previousVer, SoftLock lock)
-            throws CacheException {
-            return stgy.afterUpdate(key, val, lock);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateGeneralDataRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateGeneralDataRegion.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateGeneralDataRegion.java
deleted file mode 100644
index 2b34804..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateGeneralDataRegion.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCheckedException;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.GeneralDataRegion;
-import org.hibernate.cache.spi.QueryResultsRegion;
-import org.hibernate.cache.spi.TimestampsRegion;
-import org.hibernate.engine.spi.SharedSessionContractImplementor;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Implementation of {@link GeneralDataRegion}. This interface defines common contract for {@link QueryResultsRegion}
- * and {@link TimestampsRegion}.
- */
-public class HibernateGeneralDataRegion extends HibernateRegion implements GeneralDataRegion {
-    /**
-     * @param factory Region factory.
-     * @param name Region name.
-     * @param ignite Grid.
-     * @param cache Region cache.
-     */
-    public HibernateGeneralDataRegion(HibernateRegionFactory factory, String name,
-        Ignite ignite, HibernateCacheProxy cache) {
-        super(factory, name, ignite, cache);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object get(SharedSessionContractImplementor ses, Object key) throws CacheException {
-        try {
-            return cache.get(key);
-        } catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void put(SharedSessionContractImplementor ses, Object key, Object val) throws CacheException {
-        try {
-            cache.put(key, val);
-        } catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void evict(Object key) throws CacheException {
-        HibernateAccessStrategyAdapter.evict(ignite, cache, key);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void evictAll() throws CacheException {
-        HibernateAccessStrategyAdapter.evictAll(cache);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyTransformer.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyTransformer.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyTransformer.java
deleted file mode 100644
index ecad0b6..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyTransformer.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-/**
- * An interface for transforming hibernate keys to Ignite keys.
- */
-public interface HibernateKeyTransformer {
-    /**
-     * @param key Hibernate key.
-     */
-    public Object transform(Object key);
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyWrapper.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyWrapper.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyWrapper.java
deleted file mode 100644
index ff52124..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyWrapper.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.hibernate.cache.internal.DefaultCacheKeysFactory;
-import org.hibernate.engine.spi.SessionFactoryImplementor;
-import org.hibernate.persister.collection.CollectionPersister;
-import org.hibernate.persister.entity.EntityPersister;
-
-/**
- * Hibernate cache key wrapper.
- */
-public class HibernateKeyWrapper {
-    /** Key. */
-    private final Object key;
-
-    /** Entry. */
-    private final String entry;
-
-    /** */
-    private final String tenantId;
-
-    /**
-     * @param key Key.
-     * @param entry Entry.
-     * @param tenantId Tenant ID.
-     */
-    HibernateKeyWrapper(Object key, String entry, String tenantId) {
-        this.key = key;
-        this.entry = entry;
-        this.tenantId = tenantId;
-    }
-
-    /**
-     * @return ID.
-     */
-    Object id() {
-        return key;
-    }
-
-    /**
-     * @param id ID.
-     * @param persister Persister.
-     * @param tenantIdentifier Tenant ID.
-     * @return Cache key.
-     * @see DefaultCacheKeysFactory#staticCreateCollectionKey(Object, CollectionPersister, SessionFactoryImplementor, String)
-     */
-    static Object staticCreateCollectionKey(Object id,
-        CollectionPersister persister,
-        String tenantIdentifier) {
-        return new HibernateKeyWrapper(id, persister.getRole(), tenantIdentifier);
-    }
-
-    /**
-     * @param id ID.
-     * @param persister Persister.
-     * @param tenantIdentifier Tenant ID.
-     * @return Cache key.
-     * @see DefaultCacheKeysFactory#staticCreateEntityKey(Object, EntityPersister, SessionFactoryImplementor, String)
-     */
-    public static Object staticCreateEntityKey(Object id, EntityPersister persister, String tenantIdentifier) {
-        return new HibernateKeyWrapper(id, persister.getRootEntityName(), tenantIdentifier);
-    }
-
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object o) {
-        if (this == o) return true;
-
-        if (o == null || getClass() != o.getClass())
-            return false;
-
-        HibernateKeyWrapper that = (HibernateKeyWrapper) o;
-
-        return (key != null ? key.equals(that.key) : that.key == null) &&
-            (entry != null ? entry.equals(that.entry) : that.entry == null) &&
-            (tenantId != null ? tenantId.equals(that.tenantId) : that.tenantId == null);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        int res = key != null ? key.hashCode() : 0;
-        res = 31 * res + (entry != null ? entry.hashCode() : 0);
-        res = 31 * res + (tenantId != null ? tenantId.hashCode() : 0);
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(HibernateKeyWrapper.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateNaturalIdRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateNaturalIdRegion.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateNaturalIdRegion.java
deleted file mode 100644
index 73ed23a..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateNaturalIdRegion.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.Ignite;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.internal.DefaultCacheKeysFactory;
-import org.hibernate.cache.spi.CacheDataDescription;
-import org.hibernate.cache.spi.NaturalIdRegion;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy;
-import org.hibernate.cache.spi.access.SoftLock;
-import org.hibernate.engine.spi.SharedSessionContractImplementor;
-import org.hibernate.persister.entity.EntityPersister;
-
-/**
- * Implementation of {@link NaturalIdRegion}. This region is used to store naturalId data.
- * <p>
- * L2 cache for entity naturalId and target cache region can be set using annotations:
- * <pre name="code" class="java">
- * &#064;javax.persistence.Entity
- * &#064;javax.persistence.Cacheable
- * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
- * &#064;org.hibernate.annotations.NaturalIdCache
- * public class Entity {
- *     &#064;org.hibernate.annotations.NaturalId
- *     private String entityCode;
- *
- *     ...
- * }
- * </pre>
- */
-public class HibernateNaturalIdRegion extends HibernateTransactionalDataRegion implements NaturalIdRegion {
-    /**
-     * @param factory Region factory.
-     * @param name Region name.
-     * @param ignite Grid.
-     * @param cache Region cache,
-     * @param dataDesc Region data description.
-     */
-    public HibernateNaturalIdRegion(HibernateRegionFactory factory, String name,
-        Ignite ignite, HibernateCacheProxy cache, CacheDataDescription dataDesc) {
-        super(factory, name, ignite, cache, dataDesc);
-    }
-
-    /** {@inheritDoc} */
-    @Override public NaturalIdRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
-        return new AccessStrategy(createAccessStrategy(accessType));
-    }
-
-    /**
-     * NaturalId region access strategy.
-     */
-    private class AccessStrategy extends HibernateAbstractRegionAccessStrategy implements
-        NaturalIdRegionAccessStrategy {
-        /**
-         * @param stgy Access strategy implementation.
-         */
-        private AccessStrategy(HibernateAccessStrategyAdapter stgy) {
-            super(stgy);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object generateCacheKey(Object[] naturalIdValues, EntityPersister persister, SharedSessionContractImplementor ses) {
-            return DefaultCacheKeysFactory.staticCreateNaturalIdKey(naturalIdValues, persister, ses);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object[] getNaturalIdValues(Object cacheKey) {
-            return DefaultCacheKeysFactory.staticGetNaturalIdValues(cacheKey);
-        }
-
-        /** {@inheritDoc} */
-        @Override public NaturalIdRegion getRegion() {
-            return HibernateNaturalIdRegion.this;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean insert(SharedSessionContractImplementor ses, Object key, Object val) throws CacheException {
-            return stgy.insert(key, val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean afterInsert(SharedSessionContractImplementor ses, Object key, Object val) throws CacheException {
-            return stgy.afterInsert(key, val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean update(SharedSessionContractImplementor ses, Object key, Object val) throws CacheException {
-            return stgy.update(key, val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean afterUpdate(SharedSessionContractImplementor ses, Object key, Object val, SoftLock lock) throws CacheException {
-            return stgy.afterUpdate(key, val, lock);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateNonStrictAccessStrategy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateNonStrictAccessStrategy.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateNonStrictAccessStrategy.java
deleted file mode 100644
index a36d7e7..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateNonStrictAccessStrategy.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import java.util.Map;
-import java.util.Set;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.util.GridLeanMap;
-import org.apache.ignite.internal.util.GridLeanSet;
-import org.apache.ignite.internal.util.typedef.F;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cache.spi.access.SoftLock;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Implementation of {@link AccessType#NONSTRICT_READ_WRITE} cache access strategy.
- * <p>
- * Configuration of L2 cache and per-entity cache access strategy can be set in the
- * Hibernate configuration file:
- * <pre name="code" class="xml">
- * &lt;hibernate-configuration&gt;
- *     &lt;!-- Enable L2 cache. --&gt;
- *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
- *
- *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
- *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
- *
- *     &lt;!-- Specify entity. --&gt;
- *     &lt;mapping class="com.example.Entity"/&gt;
- *
- *     &lt;!-- Enable L2 cache with nonstrict-read-write access strategy for entity. --&gt;
- *     &lt;class-cache class="com.example.Entity" usage="nonstrict-read-write"/&gt;
- * &lt;/hibernate-configuration&gt;
- * </pre>
- * Also cache access strategy can be set using annotations:
- * <pre name="code" class="java">
- * &#064;javax.persistence.Entity
- * &#064;javax.persistence.Cacheable
- * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
- * public class Entity { ... }
- * </pre>
- */
-public class HibernateNonStrictAccessStrategy extends HibernateAccessStrategyAdapter {
-    /** */
-    private final ThreadLocal<WriteContext> writeCtx;
-
-    /**
-     * @param ignite Grid.
-     * @param cache Cache.
-     * @param writeCtx Thread local instance used to track updates done during one Hibernate transaction.
-     */
-    protected HibernateNonStrictAccessStrategy(Ignite ignite, HibernateCacheProxy cache, ThreadLocal writeCtx) {
-        super(ignite, cache);
-
-        this.writeCtx = (ThreadLocal<WriteContext>)writeCtx;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected SoftLock lock(Object key) throws CacheException {
-        WriteContext ctx = writeCtx.get();
-
-        if (ctx == null)
-            writeCtx.set(ctx = new WriteContext());
-
-        ctx.locked(key);
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void unlock(Object key, SoftLock lock) throws CacheException {
-        try {
-            WriteContext ctx = writeCtx.get();
-
-            if (ctx != null && ctx.unlocked(key)) {
-                writeCtx.remove();
-
-                ctx.updateCache(cache);
-            }
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean update(Object key, Object val) throws CacheException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean afterUpdate(Object key, Object val, SoftLock lock) throws CacheException {
-        WriteContext ctx = writeCtx.get();
-
-        if (ctx != null) {
-            ctx.updated(key, val);
-
-            unlock(key, lock);
-
-            return true;
-        }
-
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean insert(Object key, Object val) throws CacheException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean afterInsert(Object key, Object val) throws CacheException {
-        try {
-            cache.put(key, val);
-
-            return true;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void remove(Object key) throws CacheException {
-        WriteContext ctx = writeCtx.get();
-
-        if (ctx != null)
-            ctx.removed(key);
-    }
-
-    /**
-     * Information about updates done during single database transaction.
-     */
-    @SuppressWarnings("TypeMayBeWeakened")
-    private static class WriteContext {
-        /** */
-        private Map<Object, Object> updates;
-
-        /** */
-        private Set<Object> rmvs;
-
-        /** */
-        private Set<Object> locked = new GridLeanSet<>();
-
-        /**
-         * Marks key as locked.
-         *
-         * @param key Key.
-         */
-        void locked(Object key) {
-            locked.add(key);
-        }
-
-        /**
-         * Marks key as unlocked.
-         *
-         * @param key Key.
-         * @return {@code True} if last locked key was unlocked.
-         */
-        boolean unlocked(Object key) {
-            locked.remove(key);
-
-            return locked.isEmpty();
-        }
-
-        /**
-         * Marks key as updated.
-         *
-         * @param key Key.
-         * @param val Value.
-         */
-        void updated(Object key, Object val) {
-            if (updates == null)
-                updates = new GridLeanMap<>();
-
-            updates.put(key, val);
-        }
-
-        /**
-         * Marks key as removed.
-         *
-         * @param key Key.
-         */
-        void removed(Object key) {
-            if (rmvs == null)
-                rmvs = new GridLeanSet<>();
-
-            rmvs.add(key);
-        }
-
-        /**
-         * Updates cache.
-         *
-         * @param cache Cache.
-         * @throws IgniteCheckedException If failed.
-         */
-        void updateCache(HibernateCacheProxy cache) throws IgniteCheckedException {
-            if (!F.isEmpty(rmvs))
-                cache.removeAll(rmvs);
-
-            if (!F.isEmpty(updates))
-                cache.putAll(updates);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateQueryResultsRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateQueryResultsRegion.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateQueryResultsRegion.java
deleted file mode 100644
index 0b9a43d..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateQueryResultsRegion.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.Ignite;
-import org.hibernate.Query;
-import org.hibernate.cache.spi.QueryResultsRegion;
-
-/**
- * Implementation of {@link QueryResultsRegion}. This region is used to store query results.
- * <p>
- * Query results caching can be enabled in the Hibernate configuration file:
- * <pre name="code" class="xml">
- * &lt;hibernate-configuration&gt;
- *     &lt;!-- Enable L2 cache. --&gt;
- *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
- *
- *     &lt;!-- Enable query cache. --&gt;
- *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
-
- *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
- *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
- *
- *     &lt;!-- Specify entity. --&gt;
- *     &lt;mapping class="com.example.Entity"/&gt;
- *
- *     &lt;!-- Enable L2 cache with nonstrict-read-write access strategy for entity. --&gt;
- *     &lt;class-cache class="com.example.Entity" usage="nonstrict-read-write"/&gt;
- * &lt;/hibernate-configuration&gt;
- * </pre>
- * By default queries are not cached even after enabling query caching, to enable results caching for a particular
- * query, call {@link Query#setCacheable(boolean)}:
- * <pre name="code" class="java">
- *     Session ses = getSession();
- *
- *     Query qry = ses.createQuery("...");
- *
- *     qry.setCacheable(true); // Enable L2 cache for query.
- * </pre>
- * Note: the query cache does not cache the state of the actual entities in the cache, it caches only identifier
- * values. For this reason, the query cache should always be used in conjunction with
- * the second-level cache for those entities expected to be cached as part of a query result cache
- */
-public class HibernateQueryResultsRegion extends HibernateGeneralDataRegion implements QueryResultsRegion {
-    /**
-     * @param factory Region factory.
-     * @param name Region name.
-     * @param ignite Grid.
-     * @param cache Region cache.
-     */
-    public HibernateQueryResultsRegion(HibernateRegionFactory factory, String name,
-        Ignite ignite, HibernateCacheProxy cache) {
-        super(factory, name, ignite, cache);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadOnlyAccessStrategy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadOnlyAccessStrategy.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadOnlyAccessStrategy.java
deleted file mode 100644
index cdef80e..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadOnlyAccessStrategy.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCheckedException;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cache.spi.access.SoftLock;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Implementation of {@link AccessType#READ_ONLY} cache access strategy.
- * <p>
- * Configuration of L2 cache and per-entity cache access strategy can be set in the
- * Hibernate configuration file:
- * <pre name="code" class="xml">
- * &lt;hibernate-configuration&gt;
- *     &lt;!-- Enable L2 cache. --&gt;
- *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
- *
- *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
- *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
- *
- *     &lt;!-- Specify entity. --&gt;
- *     &lt;mapping class="com.example.Entity"/&gt;
- *
- *     &lt;!-- Enable L2 cache with read-only access strategy for entity. --&gt;
- *     &lt;class-cache class="com.example.Entity" usage="read-only"/&gt;
- * &lt;/hibernate-configuration&gt;
- * </pre>
- * Also cache access strategy can be set using annotations:
- * <pre name="code" class="java">
- * &#064;javax.persistence.Entity
- * &#064;javax.persistence.Cacheable
- * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
- * public class Entity { ... }
- * </pre>
-
- *
- */
-public class HibernateReadOnlyAccessStrategy extends HibernateAccessStrategyAdapter {
-    /**
-     * @param ignite Grid.
-     * @param cache Cache.
-     */
-    public HibernateReadOnlyAccessStrategy(Ignite ignite, HibernateCacheProxy cache) {
-        super(ignite, cache);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean insert(Object key, Object val) throws CacheException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean afterInsert(Object key, Object val) throws CacheException {
-        try {
-            cache.put(key, val);
-
-            return true;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected SoftLock lock(Object key) throws CacheException {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void unlock(Object key, SoftLock lock) throws CacheException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void remove(Object key) throws CacheException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean update(Object key, Object val) throws CacheException {
-        throw new UnsupportedOperationException("Updates are not supported for read-only access strategy.");
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean afterUpdate(Object key, Object val, SoftLock lock) throws CacheException {
-        throw new UnsupportedOperationException("Updates are not supported for read-only access strategy.");
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadWriteAccessStrategy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadWriteAccessStrategy.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadWriteAccessStrategy.java
deleted file mode 100644
index ae9bd71..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadWriteAccessStrategy.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import java.util.Set;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
-import org.apache.ignite.internal.util.GridLeanSet;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cache.spi.access.SoftLock;
-
-import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
-import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
-
-/**
- * Implementation of {@link AccessType#READ_WRITE} cache access strategy.
- * <p>
- * Configuration of L2 cache and per-entity cache access strategy can be set in the
- * Hibernate configuration file:
- * <pre name="code" class="xml">
- * &lt;hibernate-configuration&gt;
- *     &lt;!-- Enable L2 cache. --&gt;
- *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
- *
- *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
- *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
- *
- *     &lt;!-- Specify entity. --&gt;
- *     &lt;mapping class="com.example.Entity"/&gt;
- *
- *     &lt;!-- Enable L2 cache with read-write access strategy for entity. --&gt;
- *     &lt;class-cache class="com.example.Entity" usage="read-write"/&gt;
- * &lt;/hibernate-configuration&gt;
- * </pre>
- * Also cache access strategy can be set using annotations:
- * <pre name="code" class="java">
- * &#064;javax.persistence.Entity
- * &#064;javax.persistence.Cacheable
- * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
- * public class Entity { ... }
- * </pre>
- */
-public class HibernateReadWriteAccessStrategy extends HibernateAccessStrategyAdapter {
-    /** */
-    private final ThreadLocal<TxContext> txCtx;
-
-    /**
-     * @param ignite Grid.
-     * @param cache Cache.
-     * @param txCtx Thread local instance used to track updates done during one Hibernate transaction.
-     */
-    protected HibernateReadWriteAccessStrategy(Ignite ignite, HibernateCacheProxy cache, ThreadLocal txCtx) {
-        super(ignite, cache);
-
-        this.txCtx = (ThreadLocal<TxContext>)txCtx;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected Object get(Object key) throws CacheException {
-        boolean success = false;
-
-        try {
-            Object o = cache.get(key);
-
-            success = true;
-
-            return o;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-        finally {
-            if (!success)
-                rollbackCurrentTx();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void putFromLoad(Object key, Object val) throws CacheException {
-        boolean success = false;
-
-        try {
-            cache.put(key, val);
-
-            success = true;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-        finally {
-            if (!success)
-                rollbackCurrentTx();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected SoftLock lock(Object key) throws CacheException {
-        boolean success = false;
-
-        try {
-            TxContext ctx = txCtx.get();
-
-            if (ctx == null)
-                txCtx.set(ctx = new TxContext());
-
-            lockKey(key);
-
-            ctx.locked(key);
-
-            success = true;
-
-            return null;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-        finally {
-            if (!success)
-                rollbackCurrentTx();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void unlock(Object key, SoftLock lock) throws CacheException {
-        boolean success = false;
-
-        try {
-            TxContext ctx = txCtx.get();
-
-            if (ctx != null)
-                unlock(ctx, key);
-
-            success = true;
-        }
-        catch (Exception e) {
-            throw new CacheException(e);
-        }
-        finally {
-            if (!success)
-                rollbackCurrentTx();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean update(Object key, Object val) throws CacheException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean afterUpdate(Object key, Object val, SoftLock lock) throws CacheException {
-        boolean success = false;
-        boolean res = false;
-
-        try {
-            TxContext ctx = txCtx.get();
-
-            if (ctx != null) {
-                cache.put(key, val);
-
-                unlock(ctx, key);
-
-                res = true;
-            }
-
-            success = true;
-
-            return res;
-        }
-        catch (Exception e) {
-            throw new CacheException(e);
-        }
-        finally {
-            if (!success)
-                rollbackCurrentTx();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean insert(Object key, Object val) throws CacheException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean afterInsert(Object key, Object val) throws CacheException {
-        boolean success = false;
-
-        try {
-            cache.put(key, val);
-
-            success = true;
-
-            return true;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-        finally {
-            if (!success)
-                rollbackCurrentTx();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void remove(Object key) throws CacheException {
-        boolean success = false;
-
-        try {
-            TxContext ctx = txCtx.get();
-
-            if (ctx != null)
-                cache.remove(key);
-
-            success = true;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-        finally {
-            if (!success)
-                rollbackCurrentTx();
-        }
-    }
-
-    /**
-     *
-     * @param ctx Transaction context.
-     * @param key Key.
-     * @throws CacheException If failed.
-     */
-    private void unlock(TxContext ctx, Object key) throws CacheException {
-        if (ctx.unlocked(key)) { // Finish transaction if last key is unlocked.
-            txCtx.remove();
-
-            GridNearTxLocal tx = cache.tx();
-
-            assert tx != null;
-
-            try {
-                tx.proxy().commit();
-            }
-            finally {
-                tx.proxy().close();
-            }
-
-            assert cache.tx() == null;
-        }
-    }
-
-    /**
-     * Roll backs current transaction.
-     */
-    private void rollbackCurrentTx() {
-        try {
-            TxContext ctx = txCtx.get();
-
-            if (ctx != null) {
-                txCtx.remove();
-
-                GridNearTxLocal tx = cache.tx();
-
-                if (tx != null)
-                    tx.proxy().rollback();
-            }
-        }
-        catch (IgniteException e) {
-            log.error("Failed to rollback cache transaction.", e);
-        }
-    }
-
-    /**
-     * @param key Key.
-     * @throws IgniteCheckedException If failed.
-     */
-    private void lockKey(Object key) throws IgniteCheckedException {
-        if (cache.tx() == null)
-            cache.txStart(PESSIMISTIC, REPEATABLE_READ);
-
-        cache.get(key); // Acquire distributed lock.
-    }
-
-    /**
-     * Information about updates done during single database transaction.
-     */
-    @SuppressWarnings("TypeMayBeWeakened")
-    private static class TxContext {
-        /** */
-        private Set<Object> locked = new GridLeanSet<>();
-
-        /**
-         * Marks key as locked.
-         *
-         * @param key Key.
-         */
-        void locked(Object key) {
-            locked.add(key);
-        }
-
-        /**
-         * Marks key as unlocked.
-         *
-         * @param key Key.
-         * @return {@code True} if last locked key was unlocked.
-         */
-        boolean unlocked(Object key) {
-            locked.remove(key);
-
-            return locked.isEmpty();
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegion.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegion.java
deleted file mode 100644
index 11a96d0..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegion.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import java.util.Collections;
-import java.util.Map;
-import org.apache.ignite.Ignite;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.Region;
-
-/**
- * Implementation of {@link Region}. This interface defines base contract for all L2 cache regions.
- */
-public class HibernateRegion implements Region {
-    /** */
-    protected final HibernateRegionFactory factory;
-
-    /** */
-    private final String name;
-
-    /** Cache instance. */
-    protected final HibernateCacheProxy cache;
-
-    /** Grid instance. */
-    protected Ignite ignite;
-
-    /**
-     * @param factory Region factory.
-     * @param name Region name.
-     * @param ignite Grid.
-     * @param cache Region cache.
-     */
-    public HibernateRegion(HibernateRegionFactory factory, String name, Ignite ignite, HibernateCacheProxy cache) {
-        this.factory = factory;
-        this.name = name;
-        this.ignite = ignite;
-        this.cache = cache;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String getName() {
-        return name;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void destroy() throws CacheException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean contains(Object key) {
-        return cache.containsKey(key);
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getSizeInMemory() {
-        return -1;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getElementCountInMemory() {
-        return cache.size();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getElementCountOnDisk() {
-        return -1;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Map toMap() {
-        return Collections.emptyMap();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long nextTimestamp() {
-        return System.currentTimeMillis();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTimeout() {
-        return 0;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegionFactory.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegionFactory.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegionFactory.java
deleted file mode 100644
index 0cf03d7..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegionFactory.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
-import org.apache.ignite.internal.util.typedef.G;
-import org.hibernate.boot.spi.SessionFactoryOptions;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.CacheDataDescription;
-import org.hibernate.cache.spi.CollectionRegion;
-import org.hibernate.cache.spi.EntityRegion;
-import org.hibernate.cache.spi.NaturalIdRegion;
-import org.hibernate.cache.spi.QueryResultsRegion;
-import org.hibernate.cache.spi.RegionFactory;
-import org.hibernate.cache.spi.TimestampsRegion;
-import org.hibernate.cache.spi.access.AccessType;
-
-import static org.hibernate.cache.spi.access.AccessType.NONSTRICT_READ_WRITE;
-
-/**
- * Hibernate L2 cache region factory.
- * <p>
- * Following Hibernate settings should be specified to enable second level cache and to use this
- * region factory for caching:
- * <pre name="code" class="brush: xml; gutter: false;">
- * hibernate.cache.use_second_level_cache=true
- * hibernate.cache.region.factory_class=org.apache.ignite.cache.hibernate.HibernateRegionFactory
- * </pre>
- * Note that before region factory is started you need to start properly configured Ignite node in the same JVM.
- * For example to start Ignite node one of loader provided in {@code org.apache.ignite.grid.startup} package can be used.
- * <p>
- * Name of Ignite instance to be used for region factory must be specified as following Hibernate property:
- * <pre name="code" class="brush: xml; gutter: false;">
- * org.apache.ignite.hibernate.ignite_instance_name=&lt;Ignite instance name&gt;
- * </pre>
- * Each Hibernate cache region must be associated with some {@link IgniteInternalCache}, by default it is assumed that
- * for each cache region there is a {@link IgniteInternalCache} with the same name. Also it is possible to define
- * region to cache mapping using properties with prefix {@code org.apache.ignite.hibernate.region_cache}.
- * For example if for region with name "region1" cache with name "cache1" should be used then following
- * Hibernate property should be specified:
- * <pre name="code" class="brush: xml; gutter: false;">
- * org.apache.ignite.hibernate.region_cache.region1=cache1
- * </pre>
- */
-public class HibernateRegionFactory implements RegionFactory {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     * Hibernate L2 cache grid name property name.
-     *
-     * @deprecated Use {@link #IGNITE_INSTANCE_NAME_PROPERTY}.
-     *      If {@link #IGNITE_INSTANCE_NAME_PROPERTY} is specified it takes precedence.
-     */
-    @Deprecated
-    public static final String GRID_NAME_PROPERTY = "org.apache.ignite.hibernate.grid_name";
-
-    /** Hibernate L2 cache Ignite instance name property name. */
-    public static final String IGNITE_INSTANCE_NAME_PROPERTY = "org.apache.ignite.hibernate.ignite_instance_name";
-
-    /** Default cache property name. */
-    public static final String DFLT_CACHE_NAME_PROPERTY = "org.apache.ignite.hibernate.default_cache";
-
-    /** Property prefix used to specify region name to cache name mapping. */
-    public static final String REGION_CACHE_PROPERTY = "org.apache.ignite.hibernate.region_cache.";
-
-    /** */
-    public static final String DFLT_ACCESS_TYPE_PROPERTY = "org.apache.ignite.hibernate.default_access_type";
-
-    /** */
-    public static final String GRID_CONFIG_PROPERTY = "org.apache.ignite.hibernate.grid_config";
-
-    /** Grid providing caches. */
-    private Ignite ignite;
-
-    /** Default cache. */
-    private HibernateCacheProxy dfltCache;
-
-    /** Default region access type. */
-    private AccessType dfltAccessType;
-
-    /** Region name to cache name mapping. */
-    private final Map<String, String> regionCaches = new HashMap<>();
-
-    /** Map needed to provide the same transaction context for different regions. */
-    private final ThreadLocal threadLoc = new ThreadLocal();
-
-    /** Key transformer. */
-    private final HibernateKeyTransformer hibernate4transformer = new HibernateKeyTransformer() {
-        @Override public Object transform(Object key) {
-            return key;
-        }
-    };
-
-    /** {@inheritDoc} */
-    @Override public void start(SessionFactoryOptions settings, Properties props) throws CacheException {
-        String gridCfg = props.getProperty(GRID_CONFIG_PROPERTY);
-        String igniteInstanceName = props.getProperty(IGNITE_INSTANCE_NAME_PROPERTY);
-
-        if (igniteInstanceName == null)
-            igniteInstanceName = props.getProperty(GRID_NAME_PROPERTY);
-
-        if (gridCfg != null) {
-            try {
-                ignite = G.start(gridCfg);
-            }
-            catch (IgniteException e) {
-                throw new CacheException(e);
-            }
-        }
-        else
-            ignite = Ignition.ignite(igniteInstanceName);
-
-        String accessType = props.getProperty(DFLT_ACCESS_TYPE_PROPERTY, NONSTRICT_READ_WRITE.name());
-
-        dfltAccessType = AccessType.valueOf(accessType);
-
-        for (Map.Entry<Object, Object> prop : props.entrySet()) {
-            String key = prop.getKey().toString();
-
-            if (key.startsWith(REGION_CACHE_PROPERTY)) {
-                String regionName = key.substring(REGION_CACHE_PROPERTY.length());
-
-                String cacheName = prop.getValue().toString();
-
-                if (((IgniteKernal)ignite).getCache(cacheName) == null)
-                    throw new CacheException("Cache '" + cacheName + "' specified for region '" + regionName + "' " +
-                        "is not configured.");
-
-                regionCaches.put(regionName, cacheName);
-            }
-        }
-
-        String dfltCacheName = props.getProperty(DFLT_CACHE_NAME_PROPERTY);
-
-        if (dfltCacheName != null) {
-            IgniteInternalCache<Object, Object> dfltCache = ((IgniteKernal)ignite).getCache(dfltCacheName);
-
-            if (dfltCache == null)
-                throw new CacheException("Cache specified as default is not configured: " + dfltCacheName);
-
-            this.dfltCache = new HibernateCacheProxy(dfltCache, hibernate4transformer);
-        }
-
-        IgniteLogger log = ignite.log().getLogger(HibernateRegionFactory.class);
-
-        if (log.isDebugEnabled())
-            log.debug("HibernateRegionFactory started [igniteInstanceName=" + igniteInstanceName + ']');
-    }
-
-    /** {@inheritDoc} */
-    @Override public void stop() {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isMinimalPutsEnabledByDefault() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public AccessType getDefaultAccessType() {
-        return dfltAccessType;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long nextTimestamp() {
-        return System.currentTimeMillis();
-    }
-
-    /** {@inheritDoc} */
-    @Override public EntityRegion buildEntityRegion(String regionName, Properties props, CacheDataDescription metadata)
-        throws CacheException {
-        return new HibernateEntityRegion(this, regionName, ignite, regionCache(regionName), metadata);
-    }
-
-    /** {@inheritDoc} */
-    @Override public NaturalIdRegion buildNaturalIdRegion(String regionName, Properties props,
-        CacheDataDescription metadata) throws CacheException {
-        return new HibernateNaturalIdRegion(this, regionName, ignite, regionCache(regionName), metadata);
-    }
-
-    /** {@inheritDoc} */
-    @Override public CollectionRegion buildCollectionRegion(String regionName, Properties props,
-        CacheDataDescription metadata) throws CacheException {
-        return new HibernateCollectionRegion(this, regionName, ignite, regionCache(regionName), metadata);
-    }
-
-    /** {@inheritDoc} */
-    @Override public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties props)
-        throws CacheException {
-        return new HibernateQueryResultsRegion(this, regionName, ignite, regionCache(regionName));
-    }
-
-    /** {@inheritDoc} */
-    @Override public TimestampsRegion buildTimestampsRegion(String regionName, Properties props) throws CacheException {
-        return new HibernateTimestampsRegion(this, regionName, ignite, regionCache(regionName));
-    }
-
-    /**
-     * Reuse same thread local for the same cache across different regions.
-     *
-     * @param cacheName Cache name.
-     * @return Thread local instance used to track updates done during one Hibernate transaction.
-     */
-    ThreadLocal threadLocalForCache(String cacheName) {
-        return threadLoc;
-    }
-
-    /**
-     * @param regionName L2 cache region name.
-     * @return Cache for given region.
-     * @throws CacheException If cache for given region is not configured.
-     */
-    private HibernateCacheProxy regionCache(String regionName) throws CacheException {
-        String cacheName = regionCaches.get(regionName);
-
-        if (cacheName == null) {
-            if (dfltCache != null)
-                return dfltCache;
-
-            cacheName = regionName;
-        }
-
-        IgniteInternalCache<Object, Object> cache = ((IgniteKernal)ignite).getCache(cacheName);
-
-        if (cache == null)
-            throw new CacheException("Cache '" + cacheName + "' for region '" + regionName + "' is not configured.");
-
-        return new HibernateCacheProxy(cache, hibernate4transformer);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateTimestampsRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateTimestampsRegion.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateTimestampsRegion.java
deleted file mode 100644
index 8b4c243..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateTimestampsRegion.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.Ignite;
-import org.hibernate.cache.spi.TimestampsRegion;
-
-/**
- * Implementation of {@link TimestampsRegion}. This region is automatically created when query
- * caching is enabled and it holds most recent updates timestamps to queryable tables.
- * Name of timestamps region is {@code "org.hibernate.cache.spi.UpdateTimestampsCache"}.
- */
-public class HibernateTimestampsRegion extends HibernateGeneralDataRegion implements TimestampsRegion {
-    /**
-     * @param factory Region factory.
-     * @param name Region name.
-     * @param ignite Grid.
-     * @param cache Region cache.
-     */
-    public HibernateTimestampsRegion(HibernateRegionFactory factory, String name,
-        Ignite ignite,  HibernateCacheProxy cache) {
-        super(factory, name, ignite, cache);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalAccessStrategy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalAccessStrategy.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalAccessStrategy.java
deleted file mode 100644
index ca52849..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalAccessStrategy.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cache.spi.access.SoftLock;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Implementation of {@link AccessType#TRANSACTIONAL} cache access strategy.
- * <p>
- * It is supposed that this strategy is used in JTA environment and Hibernate and
- * {@link IgniteInternalCache} corresponding to the L2 cache region are configured to use the same transaction manager.
- * <p>
- * Configuration of L2 cache and per-entity cache access strategy can be set in the
- * Hibernate configuration file:
- * <pre name="code" class="xml">
- * &lt;hibernate-configuration&gt;
- *     &lt;!-- Enable L2 cache. --&gt;
- *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
- *
- *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
- *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
- *
- *     &lt;!-- Specify entity. --&gt;
- *     &lt;mapping class="com.example.Entity"/&gt;
- *
- *     &lt;!-- Enable L2 cache with transactional access strategy for entity. --&gt;
- *     &lt;class-cache class="com.example.Entity" usage="transactional"/&gt;
- * &lt;/hibernate-configuration&gt;
- * </pre>
- * Also cache access strategy can be set using annotations:
- * <pre name="code" class="java">
- * &#064;javax.persistence.Entity
- * &#064;javax.persistence.Cacheable
- * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
- * public class Entity { ... }
- * </pre>
- */
-public class HibernateTransactionalAccessStrategy extends HibernateAccessStrategyAdapter {
-    /**
-     * @param ignite Grid.
-     * @param cache Cache.
-     */
-    public HibernateTransactionalAccessStrategy(Ignite ignite, HibernateCacheProxy cache) {
-        super(ignite, cache);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected Object get(Object key) throws CacheException {
-        try {
-            return cache.get(key);
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void putFromLoad(Object key, Object val) throws CacheException {
-        try {
-            cache.put(key, val);
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected SoftLock lock(Object key) throws CacheException {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void unlock(Object key, SoftLock lock) throws CacheException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean update(Object key, Object val) throws CacheException {
-        try {
-            cache.put(key, val);
-
-            return true;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean afterUpdate(Object key, Object val, SoftLock lock) throws CacheException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean insert(Object key, Object val) throws CacheException {
-        try {
-            cache.put(key, val);
-
-            return true;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean afterInsert(Object key, Object val) throws CacheException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void remove(Object key) throws CacheException {
-        try {
-            cache.remove(key);
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalDataRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalDataRegion.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalDataRegion.java
deleted file mode 100644
index 581076a..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalDataRegion.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.configuration.TransactionConfiguration;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.CacheDataDescription;
-import org.hibernate.cache.spi.CollectionRegion;
-import org.hibernate.cache.spi.EntityRegion;
-import org.hibernate.cache.spi.NaturalIdRegion;
-import org.hibernate.cache.spi.TransactionalDataRegion;
-import org.hibernate.cache.spi.access.AccessType;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-
-/**
- * Implementation of {@link TransactionalDataRegion} (transactional means that
- * data in the region is updated in connection with database transaction).
- * This interface defines base contract for {@link EntityRegion}, {@link CollectionRegion}
- * and {@link NaturalIdRegion}.
- */
-public class HibernateTransactionalDataRegion extends HibernateRegion implements TransactionalDataRegion {
-    /** */
-    private final CacheDataDescription dataDesc;
-
-    /**
-     * @param factory Region factory.
-     * @param name Region name.
-     * @param ignite Grid.
-     * @param cache Region cache.
-     * @param dataDesc Region data description.
-     */
-    public HibernateTransactionalDataRegion(HibernateRegionFactory factory, String name,
-        Ignite ignite, HibernateCacheProxy cache, CacheDataDescription dataDesc) {
-        super(factory, name, ignite, cache);
-
-        this.dataDesc = dataDesc;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isTransactionAware() {
-        return false; // This method is not used by Hibernate.
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheDataDescription getCacheDataDescription() {
-        return dataDesc;
-    }
-
-    /**
-     * @param accessType Hibernate L2 cache access type.
-     * @return Access strategy for given access type.
-     */
-    protected HibernateAccessStrategyAdapter createAccessStrategy(AccessType accessType) {
-        switch (accessType) {
-            case READ_ONLY:
-                return new HibernateReadOnlyAccessStrategy(ignite, cache);
-
-            case NONSTRICT_READ_WRITE:
-                return new HibernateNonStrictAccessStrategy(ignite, cache, factory.threadLocalForCache(cache.name()));
-
-            case READ_WRITE:
-                if (cache.configuration().getAtomicityMode() != TRANSACTIONAL)
-                    throw new CacheException("Hibernate READ-WRITE access strategy must have Ignite cache with " +
-                        "'TRANSACTIONAL' atomicity mode: " + cache.name());
-
-                return new HibernateReadWriteAccessStrategy(ignite, cache, factory.threadLocalForCache(cache.name()));
-
-            case TRANSACTIONAL:
-                if (cache.configuration().getAtomicityMode() != TRANSACTIONAL)
-                    throw new CacheException("Hibernate TRANSACTIONAL access strategy must have Ignite cache with " +
-                        "'TRANSACTIONAL' atomicity mode: " + cache.name());
-
-                TransactionConfiguration txCfg = ignite.configuration().getTransactionConfiguration();
-
-                if (txCfg == null ||
-                    (txCfg.getTxManagerFactory() == null
-                    && txCfg.getTxManagerLookupClassName() == null
-                    && cache.configuration().getTransactionManagerLookupClassName() == null)) {
-                    throw new CacheException("Hibernate TRANSACTIONAL access strategy must have Ignite with " +
-                                "Factory<TransactionManager> configured (see IgniteConfiguration." +
-                                "getTransactionConfiguration().setTxManagerFactory()): " + cache.name());
-                }
-
-                return new HibernateTransactionalAccessStrategy(ignite, cache);
-
-            default:
-                throw new IllegalArgumentException("Unknown Hibernate access type: " + accessType);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/package-info.java
----------------------------------------------------------------------
diff --git a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/package-info.java b/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/package-info.java
deleted file mode 100644
index 1179aec..0000000
--- a/modules/hibernate5/src/main/java/org/apache/ignite/cache/hibernate/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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 description. -->
- * Contains implementation of Hibernate L2 cache. Refer to
- * <i>org.apache.ignite.examples.datagrid.hibernate.HibernateL2CacheExample</i> for more information on how to
- * configure and use Ignite with Hibernate.
- */
-package org.apache.ignite.cache.hibernate;
\ No newline at end of file


[23/51] [abbrv] ignite git commit: IGNITE-3487: hidden _key and _val columns - Fixes #1865.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
index b9394ec..a00ea90 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
@@ -19,7 +19,7 @@ package org.apache.ignite.internal.processors.query.h2.opt;
 
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.TimeUnit;
@@ -34,6 +34,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheContext;
 import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.processors.query.h2.database.H2RowFactory;
+import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex;
 import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.lang.IgniteBiTuple;
@@ -41,6 +42,7 @@ import org.h2.command.ddl.CreateTableData;
 import org.h2.engine.Session;
 import org.h2.index.Index;
 import org.h2.index.IndexType;
+import org.h2.index.SpatialIndex;
 import org.h2.message.DbException;
 import org.h2.result.Row;
 import org.h2.result.SearchRow;
@@ -152,6 +154,14 @@ public class GridH2Table extends TableBase {
 
         assert idxs != null;
 
+        List<Index> clones = new ArrayList<>(idxs.size());
+        for (Index index: idxs) {
+            Index clone = createDuplicateIndexIfNeeded(index);
+            if (clone != null)
+               clones.add(clone);
+        }
+        idxs.addAll(clones);
+
         // Add scan index at 0 which is required by H2.
         if (idxs.size() >= 2 && index(0).getIndexType().isHash())
             idxs.add(0, new GridH2PrimaryScanIndex(this, index(1), index(0)));
@@ -365,6 +375,9 @@ public class GridH2Table extends TableBase {
 
             boolean reuseExisting = s != null;
 
+            if (!(idxs.get(i) instanceof GridH2IndexBase))
+                continue;
+
             s = index(i).takeSnapshot(s, qctx);
 
             if (reuseExisting && s == null) { // Existing snapshot was invalidated before we were able to reserve it.
@@ -373,7 +386,8 @@ public class GridH2Table extends TableBase {
                     qctx.clearSnapshots();
 
                 for (int j = 2; j < i; j++)
-                    index(j).releaseSnapshot();
+                    if ((idxs.get(j) instanceof GridH2IndexBase))
+                        index(j).releaseSnapshot();
 
                 // Drop invalidated snapshot.
                 actualSnapshot.compareAndSet(snapshots, null);
@@ -406,7 +420,8 @@ public class GridH2Table extends TableBase {
             destroyed = true;
 
             for (int i = 1, len = idxs.size(); i < len; i++)
-                index(i).destroy();
+                if (idxs.get(i) instanceof GridH2IndexBase)
+                    index(i).destroy();
         }
         finally {
             unlock(true);
@@ -561,6 +576,8 @@ public class GridH2Table extends TableBase {
                 // Put row if absent to all indexes sequentially.
                 // Start from 3 because 0 - Scan (don't need to update), 1 - PK hash (already updated), 2 - PK (already updated).
                 while (++i < len) {
+                    if (!(idxs.get(i) instanceof GridH2IndexBase))
+                        continue;
                     GridH2IndexBase idx = index(i);
 
                     addToIndex(idx, pk, row, old, false);
@@ -577,6 +594,8 @@ public class GridH2Table extends TableBase {
                     // Remove row from all indexes.
                     // Start from 3 because 0 - Scan (don't need to update), 1 - PK hash (already updated), 2 - PK (already updated).
                     for (int i = 3, len = idxs.size(); i < len; i++) {
+                        if (!(idxs.get(i) instanceof GridH2IndexBase))
+                            continue;
                         Row res = index(i).remove(old);
 
                         assert eq(pk, res, old) : "\n" + old + "\n" + res + "\n" + i + " -> " + index(i).getName();
@@ -650,7 +669,8 @@ public class GridH2Table extends TableBase {
         ArrayList<GridH2IndexBase> res = new ArrayList<>(idxs.size() - 2);
 
         for (int i = 2, len = idxs.size(); i < len; i++)
-            res.add(index(i));
+            if (idxs.get(i) instanceof GridH2IndexBase)
+                res.add(index(i));
 
         return res;
     }
@@ -721,16 +741,24 @@ public class GridH2Table extends TableBase {
 
             assert idx != null;
 
-            ArrayList<Index> newIdxs = new ArrayList<>(idxs.size() + 1);
+            Index cloneIdx = createDuplicateIndexIfNeeded(idx);
+
+            ArrayList<Index> newIdxs = new ArrayList<>(
+                    idxs.size() + ((cloneIdx == null) ? 1 : 2));
 
             newIdxs.addAll(idxs);
 
             newIdxs.add(idx);
+            if (cloneIdx != null)
+                newIdxs.add(cloneIdx);
 
             idxs = newIdxs;
 
             database.addSchemaObject(ses, idx);
 
+            if (cloneIdx != null)
+                database.addSchemaObject(ses, cloneIdx);
+
             setModified();
 
             return idx;
@@ -762,23 +790,42 @@ public class GridH2Table extends TableBase {
 
     /** {@inheritDoc} */
     @Override public void removeIndex(Index h2Idx) {
+        throw DbException.getUnsupportedException("must use removeIndex(session, idx)");
+    }
+
+    /**
+     * Remove the given index from the list.
+     *
+     * @param h2Idx the index to remove
+     */
+    public void removeIndex(Session session, Index h2Idx) {
         lock(true);
 
         try {
             ArrayList<Index> idxs = new ArrayList<>(this.idxs);
 
-            for (int i = 2; i < idxs.size(); i++) {
-                GridH2IndexBase idx = (GridH2IndexBase)idxs.get(i);
+            Index targetIdx = (h2Idx instanceof GridH2ProxyIndex)?
+                    ((GridH2ProxyIndex)h2Idx).underlyingIndex(): h2Idx;
 
-                if (idx != h2Idx)
-                    continue;
+            for (int i = 2; i < idxs.size(); ) {
+                Index idx = idxs.get(i);
 
-                idxs.remove(i);
+                if (idx == targetIdx || (idx instanceof GridH2ProxyIndex &&
+                   ((GridH2ProxyIndex)idx).underlyingIndex() == targetIdx)) {
 
-                this.idxs = idxs;
+                    idxs.remove(i);
 
-                return;
+                    if (idx instanceof GridH2ProxyIndex &&
+                        idx.getSchema().findIndex(session, idx.getName()) != null)
+                        database.removeSchemaObject(session, idx);
+
+                    continue;
+                }
+
+                i++;
             }
+
+            this.idxs = idxs;
         }
         finally {
             unlock(true);
@@ -912,4 +959,47 @@ public class GridH2Table extends TableBase {
         return rowFactory;
     }
 
+    /**
+     * Creates proxy index for given target index.
+     * Proxy index refers to alternative key and val columns.
+     *
+     * @param target Index to clone.
+     * @return Proxy index.
+     */
+    public Index createDuplicateIndexIfNeeded(Index target) {
+        if (!(target instanceof H2TreeIndex) &&
+            !(target instanceof SpatialIndex))
+            return null;
+
+        IndexColumn[] cols = target.getIndexColumns();
+        List<IndexColumn> proxyCols = new ArrayList<>(cols.length);
+        boolean modified = false;
+        for (int i = 0; i < cols.length; i++) {
+            IndexColumn col = cols[i];
+            IndexColumn proxyCol = new IndexColumn();
+            proxyCol.columnName = col.columnName;
+            proxyCol.column = col.column;
+            proxyCol.sortType = col.sortType;
+
+            int altColId = desc.getAlternativeColumnId(proxyCol.column.getColumnId());
+            if (altColId != proxyCol.column.getColumnId()) {
+                proxyCol.column = getColumn(altColId);
+                proxyCol.columnName = proxyCol.column.getName();
+                modified = true;
+            }
+
+            proxyCols.add(proxyCol);
+        }
+
+        if (modified) {
+            String proxyName = target.getName() + "_proxy";
+
+            if (target.getIndexType().isSpatial())
+                return new GridH2ProxySpatialIndex(this, proxyName, proxyCols, target);
+
+            return new GridH2ProxyIndex(this, proxyName, proxyCols, target);
+        }
+
+        return null;
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneIndex.java
index 4395024..6671dc6 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridLuceneIndex.java
@@ -54,8 +54,8 @@ import org.apache.lucene.util.Version;
 import org.h2.util.JdbcUtils;
 import org.jetbrains.annotations.Nullable;
 
-import static org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.KEY_FIELD_NAME;
-import static org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.VAL_FIELD_NAME;
+import static org.apache.ignite.internal.processors.query.QueryUtils.KEY_FIELD_NAME;
+import static org.apache.ignite.internal.processors.query.QueryUtils.VAL_FIELD_NAME;
 
 /**
  * Lucene fulltext index.

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/DmlAstUtils.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/DmlAstUtils.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/DmlAstUtils.java
index 91694ae..5a1d412 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/DmlAstUtils.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/sql/DmlAstUtils.java
@@ -24,7 +24,6 @@ import java.util.Set;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.internal.processors.query.IgniteSQLException;
-import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
 import org.apache.ignite.internal.processors.query.h2.dml.FastUpdateArgument;
 import org.apache.ignite.internal.processors.query.h2.dml.FastUpdateArguments;
 import org.apache.ignite.internal.processors.query.h2.opt.GridH2AbstractKeyValueRow;
@@ -175,8 +174,15 @@ public final class DmlAstUtils {
         if (filter == null)
             return null;
 
-        if (update.cols().size() != 1 ||
-            !IgniteH2Indexing.VAL_FIELD_NAME.equalsIgnoreCase(update.cols().get(0).columnName()))
+        if (update.cols().size() != 1)
+            return null;
+
+        Table tbl = update.cols().get(0).column().getTable();
+        if (!(tbl instanceof GridH2Table))
+            return null;
+
+        GridH2RowDescriptor desc = ((GridH2Table)tbl).rowDescriptor();
+        if (!desc.isValueColumn(update.cols().get(0).column().getColumnId()))
             return null;
 
         GridSqlElement set = update.set().get(update.cols().get(0).columnName());
@@ -268,19 +274,29 @@ public final class DmlAstUtils {
 
     /**
      * @param op Operation.
-     * @param colName Column name to check.
+     * @param key true - check for key equality condition,
+     *            otherwise check for value equality condition
      * @return Whether this condition is of form {@code colName} = ?
      */
-    private static boolean isEqualityCondition(GridSqlOperation op, String colName) {
+    private static boolean isEqualityCondition(GridSqlOperation op, boolean key) {
         if (op.operationType() != GridSqlOperationType.EQUAL)
             return false;
 
         GridSqlElement left = op.child(0);
         GridSqlElement right = op.child(1);
 
-        return left instanceof GridSqlColumn &&
-            colName.equals(((GridSqlColumn) left).columnName()) &&
-            (right instanceof GridSqlConst || right instanceof GridSqlParameter);
+        if (!(left instanceof GridSqlColumn))
+            return false;
+
+        GridSqlColumn column = (GridSqlColumn)left;
+        if (!(column.column().getTable() instanceof GridH2Table))
+            return false;
+
+        GridH2RowDescriptor desc =((GridH2Table) column.column().getTable()).rowDescriptor();
+
+        return  (key ? desc.isKeyColumn(column.column().getColumnId()) :
+                       desc.isValueColumn(column.column().getColumnId())) &&
+                (right instanceof GridSqlConst || right instanceof GridSqlParameter);
     }
 
     /**
@@ -288,7 +304,7 @@ public final class DmlAstUtils {
      * @return Whether this condition is of form _key = ?
      */
     private static boolean isKeyEqualityCondition(GridSqlOperation op) {
-        return isEqualityCondition(op, IgniteH2Indexing.KEY_FIELD_NAME);
+        return isEqualityCondition(op, true);
     }
 
     /**
@@ -296,7 +312,7 @@ public final class DmlAstUtils {
      * @return Whether this condition is of form _val = ?
      */
     private static boolean isValueEqualityCondition(GridSqlOperation op) {
-        return isEqualityCondition(op, IgniteH2Indexing.VAL_FIELD_NAME);
+        return isEqualityCondition(op, false);
     }
 
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java
index 9d18b62..c845496 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectQueryArgumentsTest.java
@@ -292,7 +292,7 @@ public class IgniteBinaryObjectQueryArgumentsTest extends GridCommonAbstractTest
 
         final SqlQuery<T, Person> qry = new SqlQuery<>(Person.class, "where _key=?");
 
-        final SqlFieldsQuery fieldsQry = new SqlFieldsQuery("select * from Person where _key=?");
+        final SqlFieldsQuery fieldsQry = new SqlFieldsQuery("select _key, _val, * from Person where _key=?");
 
         qry.setLocal(isLocal());
         fieldsQry.setLocal(isLocal());
@@ -335,7 +335,7 @@ public class IgniteBinaryObjectQueryArgumentsTest extends GridCommonAbstractTest
 
         final SqlQuery<Person, T> qry = new SqlQuery<>(valType, "where _val=?");
 
-        final SqlFieldsQuery fieldsQry = new SqlFieldsQuery("select * from " + valType.getSimpleName() + " where _val=?");
+        final SqlFieldsQuery fieldsQry = new SqlFieldsQuery("select _key, _val, * from " + valType.getSimpleName() + " where _val=?");
 
         qry.setLocal(isLocal());
         fieldsQry.setLocal(isLocal());

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
index fedeef6..fed8980 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
@@ -249,17 +249,13 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
                     Map<String, String> fields = meta.fields("Person");
 
                     assert fields != null;
-                    assert fields.size() == 5;
+                    assert fields.size() == 3;
 
                     if (binaryMarshaller) {
-                        assert Object.class.getName().equals(fields.get("_KEY"));
-                        assert Object.class.getName().equals(fields.get("_VAL"));
                         assert Integer.class.getName().equals(fields.get("AGE"));
                         assert Integer.class.getName().equals(fields.get("ORGID"));
                     }
                     else {
-                        assert AffinityKey.class.getName().equals(fields.get("_KEY"));
-                        assert Person.class.getName().equals(fields.get("_VAL"));
                         assert int.class.getName().equals(fields.get("AGE"));
                         assert int.class.getName().equals(fields.get("ORGID"));
                     }
@@ -310,18 +306,15 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
                     Map<String, String> fields = meta.fields("Organization");
 
                     assert fields != null;
-                    assertEquals("Fields: " + fields, 4, fields.size());
+                    assertEquals("Fields: " + fields, 2, fields.size());
 
                     if (binaryMarshaller) {
-                        assert Object.class.getName().equals(fields.get("_VAL"));
                         assert Integer.class.getName().equals(fields.get("ID"));
                     }
                     else {
-                        assert Organization.class.getName().equals(fields.get("_VAL"));
                         assert int.class.getName().equals(fields.get("ID"));
                     }
 
-                    assert String.class.getName().equals(fields.get("_KEY"));
                     assert String.class.getName().equals(fields.get("NAME"));
                 }
                 else if (intCache.getName().equals(meta.cacheName())) {
@@ -587,7 +580,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
     public void testSelectAllJoined() throws Exception {
         QueryCursor<List<?>> qry =
             personCache.query(sqlFieldsQuery(
-                String.format("select * from \"%s\".Person p, \"%s\".Organization o where p.orgId = o.id",
+                String.format("select p._key, p._val, p.*, o._key, o._val, o.* from \"%s\".Person p, \"%s\".Organization o where p.orgId = o.id",
                     personCache.getName(), orgCache.getName())));
 
         List<List<?>> res = new ArrayList<>(qry.getAll());
@@ -768,7 +761,7 @@ public abstract class IgniteCacheAbstractFieldsQuerySelfTest extends GridCommonA
 
         cache.put(key, val);
 
-        Collection<List<?>> res = cache.query(sqlFieldsQuery("select * from Person")).getAll();
+        Collection<List<?>> res = cache.query(sqlFieldsQuery("select _key, _val, * from Person")).getAll();
 
         assertEquals(1, res.size());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDeleteSqlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDeleteSqlQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDeleteSqlQuerySelfTest.java
index 12662db..92c40b8 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDeleteSqlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheDeleteSqlQuerySelfTest.java
@@ -39,7 +39,7 @@ public class IgniteCacheDeleteSqlQuerySelfTest extends IgniteCacheAbstractSqlDml
 
         c.iterator();
 
-        c = p.query(new SqlFieldsQuery("select * from Person order by id"));
+        c = p.query(new SqlFieldsQuery("select _key, _val, * from Person order by id"));
 
         List<List<?>> leftovers = c.getAll();
 
@@ -63,7 +63,7 @@ public class IgniteCacheDeleteSqlQuerySelfTest extends IgniteCacheAbstractSqlDml
 
         c.iterator();
 
-        c = p.query(new SqlFieldsQuery("select * from Person order by id, _key"));
+        c = p.query(new SqlFieldsQuery("select _key, _val, * from Person order by id, _key"));
 
         List<List<?>> leftovers = c.getAll();
 
@@ -91,7 +91,7 @@ public class IgniteCacheDeleteSqlQuerySelfTest extends IgniteCacheAbstractSqlDml
 
         c.iterator();
 
-        c = p.query(new SqlFieldsQuery("select * from Person order by id"));
+        c = p.query(new SqlFieldsQuery("select _key, _val, * from Person order by id"));
 
         List<List<?>> leftovers = c.getAll();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java
index 3626341..20cbe3a 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheUpdateSqlQuerySelfTest.java
@@ -73,7 +73,7 @@ public class IgniteCacheUpdateSqlQuerySelfTest extends IgniteCacheAbstractSqlDml
 
         c.iterator();
 
-        c = p.query(new SqlFieldsQuery("select * from Person order by _key, id"));
+        c = p.query(new SqlFieldsQuery("select _key, _val, * from Person order by _key, id"));
 
         List<List<?>> leftovers = c.getAll();
 
@@ -103,7 +103,7 @@ public class IgniteCacheUpdateSqlQuerySelfTest extends IgniteCacheAbstractSqlDml
 
         c.iterator();
 
-        c = p.query(new SqlFieldsQuery("select * from Person order by id, _key"));
+        c = p.query(new SqlFieldsQuery("select _key, _val, * from Person order by id, _key"));
 
         List<List<?>> leftovers = c.getAll();
 
@@ -133,7 +133,7 @@ public class IgniteCacheUpdateSqlQuerySelfTest extends IgniteCacheAbstractSqlDml
 
         c.iterator();
 
-        c = p.query(new SqlFieldsQuery("select * from Person order by _key, id"));
+        c = p.query(new SqlFieldsQuery("select _key, _val, * from Person order by _key, id"));
 
         List<List<?>> leftovers = c.getAll();
 
@@ -163,7 +163,7 @@ public class IgniteCacheUpdateSqlQuerySelfTest extends IgniteCacheAbstractSqlDml
 
         c.iterator();
 
-        c = p.query(new SqlFieldsQuery("select * from Person order by _key, id"));
+        c = p.query(new SqlFieldsQuery("select _key, _val, * from Person order by _key, id"));
 
         List<List<?>> leftovers = c.getAll();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java
index 19d6f54..1f50244 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/AbstractSchemaSelfTest.java
@@ -82,6 +82,9 @@ public class AbstractSchemaSelfTest extends GridCommonAbstractTest {
     /** Field 3. */
     protected static final String FIELD_NAME_3 = "field3";
 
+    /** Key alias */
+    protected static final String FIELD_KEY_ALIAS = "key";
+
     /**
      * Get type on the given node for the given cache and table name. Type must exist.
      *

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
index 1ed7426..3db3050 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/DynamicIndexAbstractSelfTest.java
@@ -157,6 +157,9 @@ public abstract class DynamicIndexAbstractSelfTest extends AbstractSchemaSelfTes
         entity.setKeyType(KeyClass.class.getName());
         entity.setValueType(ValueClass.class.getName());
 
+        entity.setKeyFieldName(FIELD_KEY_ALIAS);
+        entity.addQueryField(FIELD_KEY_ALIAS, entity.getKeyType(), null);
+
         entity.addQueryField(FIELD_KEY, Long.class.getName(), null);
         entity.addQueryField(FIELD_NAME_1, Long.class.getName(), null);
         entity.addQueryField(FIELD_NAME_2, Long.class.getName(), null);

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlKeyValueFieldsTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlKeyValueFieldsTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlKeyValueFieldsTest.java
new file mode 100644
index 0000000..d63be7c
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlKeyValueFieldsTest.java
@@ -0,0 +1,392 @@
+/*
+ * 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.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.cache.query.QueryCursor;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+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 java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.concurrent.Callable;
+
+/**
+ * Test hidden _key, _val, _ver columns
+ */
+public class IgniteSqlKeyValueFieldsTest  extends GridCommonAbstractTest {
+
+    /** IP finder. */
+    private static final TcpDiscoveryVmIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    private static String NODE_BAD_CONF_MISS_KEY_FIELD = "badConf1";
+    /** */
+    private static String NODE_BAD_CONF_MISS_VAL_FIELD = "badConf2";
+    /** */
+    private static String NODE_CLIENT = "client";
+
+    /** */
+    private static String CACHE_PERSON_NO_KV = "PersonNoKV";
+    /** */
+    private static String CACHE_INT_NO_KV_TYPE = "IntNoKVType";
+    /** */
+    private static String CACHE_PERSON = "Person";
+    /** */
+    private static String CACHE_JOB = "Job";
+
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration c = super.getConfiguration(gridName);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(IP_FINDER);
+
+        c.setDiscoverySpi(disco);
+
+        c.setMarshaller(new BinaryMarshaller());
+
+        List<CacheConfiguration> ccfgs = new ArrayList<>();
+        CacheConfiguration ccfg = buildCacheConfiguration(gridName);
+        if (ccfg != null)
+            ccfgs.add(ccfg);
+
+        ccfgs.add(buildCacheConfiguration(CACHE_PERSON_NO_KV));
+        ccfgs.add(buildCacheConfiguration(CACHE_INT_NO_KV_TYPE));
+        ccfgs.add(buildCacheConfiguration(CACHE_PERSON));
+        ccfgs.add(buildCacheConfiguration(CACHE_JOB));
+
+        c.setCacheConfiguration(ccfgs.toArray(new CacheConfiguration[ccfgs.size()]));
+        if (gridName.equals(NODE_CLIENT))
+            c.setClientMode(true);
+
+        return c;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        startGrid(0);
+        startGrid(NODE_CLIENT);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+    }
+
+    private CacheConfiguration buildCacheConfiguration(String name) {
+        if (name.equals(NODE_BAD_CONF_MISS_KEY_FIELD)) {
+            CacheConfiguration ccfg = new CacheConfiguration(NODE_BAD_CONF_MISS_KEY_FIELD);
+            QueryEntity qe = new QueryEntity(Object.class.getName(), Object.class.getName());
+            qe.setKeyFieldName("k");
+            qe.addQueryField("a", Integer.class.getName(), null);
+            ccfg.setQueryEntities(F.asList(qe));
+            return ccfg;
+        }
+        else if (name.equals(NODE_BAD_CONF_MISS_VAL_FIELD)) {
+            CacheConfiguration ccfg = new CacheConfiguration(NODE_BAD_CONF_MISS_VAL_FIELD);
+            QueryEntity qe = new QueryEntity(Object.class.getName(), Object.class.getName());
+            qe.setValueFieldName("v");
+            qe.addQueryField("a", Integer.class.getName(), null);
+            ccfg.setQueryEntities(F.asList(qe));
+            return ccfg;
+        }
+        else if (name.equals(CACHE_PERSON_NO_KV)) {
+            CacheConfiguration ccfg = new CacheConfiguration(CACHE_PERSON_NO_KV);
+
+            QueryEntity entity = new QueryEntity();
+
+            entity.setKeyType(Integer.class.getName());
+            entity.setValueType(Person.class.getName());
+
+            LinkedHashMap<String, String> fields = new LinkedHashMap<>();
+            fields.put("name", String.class.getName());
+            fields.put("age", Integer.class.getName());
+
+            entity.setFields(fields);
+
+            ccfg.setQueryEntities(Arrays.asList(entity));
+            return ccfg;
+        }
+        else if (name.equals(CACHE_INT_NO_KV_TYPE)) {
+            CacheConfiguration ccfg = new CacheConfiguration(CACHE_INT_NO_KV_TYPE);
+            QueryEntity entity = new QueryEntity();
+
+            entity.setKeyType(null);
+            entity.setValueType(null);
+
+            entity.setKeyFieldName("id");
+            entity.setValueFieldName("v");
+
+            LinkedHashMap<String, String> fields = new LinkedHashMap<>();
+            fields.put("id", Integer.class.getName());
+            fields.put("v", Integer.class.getName());
+
+            entity.setFields(fields);
+
+            ccfg.setQueryEntities(Arrays.asList(entity));
+            return ccfg;
+        }
+        else if (name.equals(CACHE_PERSON)) {
+            CacheConfiguration ccfg = new CacheConfiguration(CACHE_PERSON);
+
+            QueryEntity entity = new QueryEntity();
+
+            entity.setKeyType(Integer.class.getName());
+            entity.setValueType(Person.class.getName());
+
+            entity.setKeyFieldName("id");
+            entity.setValueFieldName("v");
+
+            LinkedHashMap<String, String> fields = new LinkedHashMap<>();
+            fields.put("name", String.class.getName());
+            fields.put("age", Integer.class.getName());
+
+            fields.put(entity.getKeyFieldName(), entity.getKeyType());
+            fields.put(entity.getValueFieldName(), entity.getValueType());
+
+            entity.setFields(fields);
+
+            ccfg.setQueryEntities(Arrays.asList(entity));
+            return ccfg;
+        }
+        else if (name.equals(CACHE_JOB)) {
+            CacheConfiguration ccfg = new CacheConfiguration(CACHE_JOB);
+            ccfg.setIndexedTypes(Integer.class, Integer.class);
+            return ccfg;
+        }
+        return null;
+    }
+
+    /** Test for setIndexedTypes() primitive types */
+    public void testSetIndexTypesPrimitive() throws Exception {
+        IgniteCache<Integer, Integer> cache = grid(NODE_CLIENT).cache(CACHE_JOB);
+
+        checkInsert(cache, "insert into Integer (_key, _val) values (?,?)", 1, 100);
+
+        checkSelect(cache, "select * from Integer", 1, 100);
+        checkSelect(cache, "select _key, _val from Integer", 1, 100);
+    }
+
+    /** Test configuration error : keyFieldName is missing from fields */
+    public void testErrorKeyFieldMissingFromFields() throws Exception {
+        checkCacheStartupError(NODE_BAD_CONF_MISS_KEY_FIELD);
+    }
+
+    /** Test configuration error : valueFieldName is missing from fields */
+    public void testErrorValueFieldMissingFromFields() throws Exception {
+        checkCacheStartupError(NODE_BAD_CONF_MISS_VAL_FIELD);
+    }
+
+    /** */
+    private void checkCacheStartupError(final String name) {
+        GridTestUtils.assertThrows(log, new Callable<Void>() {
+            @Override public Void call() throws Exception {
+                startGrid(name);
+
+                return null;
+            }
+        }, IgniteCheckedException.class, null);
+    }
+
+    /**
+     * Check that it is allowed to leave QE.keyType and QE.valueType unset
+     * in case keyFieldName and valueFieldName are set and present in fields
+     */
+    public void testQueryEntityAutoKeyValTypes() throws Exception {
+        IgniteCache<Integer, Integer> cache = grid(NODE_CLIENT).cache(CACHE_INT_NO_KV_TYPE);
+
+        checkInsert(cache, "insert into Integer (_key, _val) values (?,?)", 1, 100);
+
+        checkSelect(cache, "select * from Integer where id = 1", 1, 100);
+
+        checkSelect(cache, "select * from Integer", 1, 100);
+        checkSelect(cache, "select _key, _val from Integer", 1, 100);
+        checkSelect(cache, "select id, v from Integer", 1, 100);
+    }
+
+    /** Check that it is possible to not have keyFieldName and valueFieldName */
+    public void testNoKeyValueAliases() throws Exception {
+        IgniteCache<Integer, Person> cache = grid(NODE_CLIENT).cache(CACHE_PERSON_NO_KV);
+
+        Person alice = new Person("Alice", 1);
+        checkInsert(cache, "insert into Person (_key, _val) values (?,?)", 1, alice);
+
+        checkSelect(cache, "select * from Person", alice.name, alice.age);
+        checkSelect(cache, "select _key, _val from Person", 1, alice);
+    }
+
+    /** Check keyFieldName and valueFieldName columns access */
+    public void testKeyValueAlias() throws Exception {
+        //_key, _val, _ver | name, age, id, v
+        Person alice = new Person("Alice", 1);
+        Person bob = new Person("Bob", 2);
+
+        IgniteCache<Integer, Person> cache = grid(NODE_CLIENT).cache(CACHE_PERSON);
+
+        checkInsert(cache, "insert into Person (_key, _val) values (?,?)", 1, alice);
+        checkInsert(cache, "insert into Person (id, v) values (?,?)", 2, bob);
+
+        checkSelect(cache, "select * from Person where _key=1", alice.name, alice.age, 1, alice);
+        checkSelect(cache, "select _key, _val from Person where id=1", 1, alice);
+
+        checkSelect(cache, "select * from Person where _key=2", bob.name, bob.age, 2, bob);
+        checkSelect(cache, "select _key, _val from Person where id=2", 2, bob);
+
+        checkInsert(cache, "update Person set age = ? where id = ?", 3, 1);
+        checkSelect(cache, "select _key, age from Person where id=1", 1, 3);
+
+        checkInsert(cache, "update Person set v = ? where id = ?", alice, 1);
+        checkSelect(cache, "select _key, _val from Person where id=1", 1, alice);
+    }
+
+    /** Check _ver version field is accessible */
+    public void testVersionField() throws Exception {
+        Person alice = new Person("Alice", 1);
+        Person bob = new Person("Bob", 2);
+
+        IgniteCache<Integer, Person> cache = grid(NODE_CLIENT).cache(CACHE_PERSON);
+
+        checkInsert(cache, "insert into Person (id, v) values (?,?)", 1, alice);
+        assertNotNull(getVersion(cache, 1));
+
+        checkInsert(cache, "insert into Person (id, v) values (?,?)", 2, bob);
+        assertNotNull(getVersion(cache, 2));
+
+        GridCacheVersion v1 = getVersion(cache, 1);
+
+        checkInsert(cache, "update Person set age = ? where id = ?", 3, 1);
+
+        GridCacheVersion v2 = getVersion(cache, 1);
+
+        assertFalse( v1.equals(v2) );
+    }
+
+    /** Check that joins are working on keyFieldName, valueFieldName columns */
+    public void testJoinKeyValFields() throws Exception {
+        IgniteEx client = grid(NODE_CLIENT);
+        IgniteCache<Integer, Person> cache = client.cache(CACHE_PERSON);
+        IgniteCache<Integer, Integer> cache2 = client.cache(CACHE_JOB);
+
+        checkInsert(cache, "insert into Person (id, v) values (?, ?)", 1, new Person("Bob", 30));
+        checkInsert(cache, "insert into Person (id, v) values (?, ?)", 2, new Person("David", 35));
+        checkInsert(cache2, "insert into Integer (_key, _val) values (?, ?)", 100, 1);
+        checkInsert(cache2, "insert into Integer (_key, _val) values (?, ?)", 200, 2);
+
+        QueryCursor<List<?>> cursor = cache.query(new SqlFieldsQuery("select p.id, j._key from Person p, \""+ CACHE_JOB +"\".Integer j where p.id = j._val"));
+        List<List<?>> results = cursor.getAll();
+        assertEquals(2, results.size());
+        assertEquals(1, results.get(0).get(0));
+        assertEquals(100, results.get(0).get(1));
+        assertEquals(2, results.get(1).get(0));
+        assertEquals(200, results.get(1).get(1));
+    }
+
+    /** Check automatic addition of index for keyFieldName column */
+    public void testAutoKeyFieldIndex() throws Exception {
+        IgniteEx client = grid(NODE_CLIENT);
+        IgniteCache<Integer, Person> cache = client.cache(CACHE_PERSON);
+
+        QueryCursor<List<?>> cursor = cache.query(new SqlFieldsQuery("explain select * from Person where id = 1"));
+        List<List<?>> results = cursor.getAll();
+        assertEquals(2, results.size());
+        assertTrue(((String)results.get(0).get(0)).contains("\"_key_PK_proxy\""));
+
+        cursor = cache.query(new SqlFieldsQuery("explain select * from Person where _key = 1"));
+        results = cursor.getAll();
+        assertEquals(2, results.size());
+        assertTrue(((String)results.get(0).get(0)).contains("\"_key_PK\""));
+    }
+
+    /** */
+    private GridCacheVersion getVersion(IgniteCache<?, ?> cache, int key) {
+        QueryCursor<List<?>> cursor = cache.query(new SqlFieldsQuery("select _ver from Person where id = ?").setArgs(key));
+        List<List<?>> results = cursor.getAll();
+        assertEquals(1, results.size());
+        return ((GridCacheVersion) results.get(0).get(0));
+    }
+
+    /** */
+    private void checkInsert(IgniteCache<?, ?> cache, String qry, Object ... args) throws Exception {
+        QueryCursor<List<?>> cursor = cache.query(new SqlFieldsQuery(qry).setArgs(args));
+        assertEquals(1, ((Number) cursor.getAll().get(0).get(0)).intValue());
+    }
+
+    /** */
+    private void checkSelect(IgniteCache<?, ?> cache, String selectQry, Object ... expected) {
+        QueryCursor<List<?>> cursor = cache.query(new SqlFieldsQuery(selectQry));
+
+        List<List<?>> results = cursor.getAll();
+
+        assertEquals(1, results.size());
+
+        List<?> row0 = results.get(0);
+        for(int col = 0; col < expected.length; ++col)
+            assertEquals(expected[col], row0.get(col));
+    }
+
+    /** */
+    private static class Person {
+        /** */
+        private String name;
+
+        /** */
+        private int age;
+
+        /** */
+        public Person(String name, int age) {
+            this.name = name;
+            this.age = age;
+        }
+
+        /** */
+        @Override public int hashCode() {
+            return name.hashCode() ^ age;
+        }
+
+        /** */
+        @Override public boolean equals(Object o) {
+            if (this == o)
+                return true;
+            if (!(o instanceof Person))
+                return false;
+            Person other = (Person)o;
+            return name.equals(other.name) && age == other.age;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
index fa4eded..6110faa 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
@@ -799,14 +799,14 @@ public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
                 false,
                 0,
                 "select p._key k1, o._key k2 " +
-                    "from \"persPart\".Person2 p, (select * from \"orgRepl\".Organization) o " +
+                    "from \"persPart\".Person2 p, (select _key, _val, * from \"orgRepl\".Organization) o " +
                     "where p.orgId = o._key");
 
             checkQueryPlan(persPart,
                 false,
                 0,
                 "select p._key k1, o._key k2 " +
-                    "from (select * from \"orgRepl\".Organization) o, \"persPart\".Person2 p " +
+                    "from (select _key, _val, * from \"orgRepl\".Organization) o, \"persPart\".Person2 p " +
                     "where p.orgId = o._key");
 
             checkQueryPlan(persPart,
@@ -1019,7 +1019,7 @@ public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
                     sql);
 
                 sql = "select p1._key k1, p2._key k2, o._key k3 " +
-                    "from (select * from \"orgRepl\".Organization) o, \"persPartAff\".Person2 p1, \"persPart\".Person2 p2 " +
+                    "from (select _key, _val, * from \"orgRepl\".Organization) o, \"persPartAff\".Person2 p1, \"persPart\".Person2 p2 " +
                     "where p1._key=p2.name and p2.orgId = o._key";
 
                 checkQueryPlan(persPart,
@@ -1029,7 +1029,7 @@ public class IgniteSqlSplitterSelfTest extends GridCommonAbstractTest {
                     "batched:unicast");
 
                 sql = "select p1._key k1, p2._key k2, o._key k3 " +
-                    "from (select * from \"orgRepl\".Organization) o, \"persPartAff\".Person2 p1, \"persPart\".Person2 p2 " +
+                    "from (select _key, _val, * from \"orgRepl\".Organization) o, \"persPartAff\".Person2 p1, \"persPart\".Person2 p2 " +
                     "where p1._key=p2._key and p2.orgId = o._key";
 
                 checkQueryPlan(persPart,

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
index e62199a..7e2026b 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
@@ -682,6 +682,16 @@ public abstract class GridIndexingSpiAbstractSelfTest extends GridCommonAbstract
         @Override public int typeId() {
             return 0;
         }
+
+        /** {@inheritDoc} */
+        @Override public String keyFieldName() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String valueFieldName() {
+            return null;
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
index 9782f28..7423c9b 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
@@ -506,7 +506,7 @@ public class GridQueryParsingTest extends GridCommonAbstractTest {
 
         // Schemas for index and table must match
         assertParseThrows("create index if not exists sch2.idx on sch1.Person (name)",
-            DbException.class, "Schema name must match [90080-195]");
+            DbException.class, "Schema name must match");
 
         assertParseThrows("create hash index if not exists idx on Person (name)",
             IgniteSQLException.class, "Only SPATIAL modifier is supported for CREATE INDEX");

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index 032e544..6370cd0 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -108,6 +108,7 @@ import org.apache.ignite.internal.processors.cache.query.IndexingSpiQuerySelfTes
 import org.apache.ignite.internal.processors.cache.query.IndexingSpiQueryTxSelfTest;
 import org.apache.ignite.internal.processors.query.IgniteQueryDedicatedPoolTest;
 import org.apache.ignite.internal.processors.query.IgniteSqlEntryCacheModeAgnosticTest;
+import org.apache.ignite.internal.processors.query.IgniteSqlKeyValueFieldsTest;
 import org.apache.ignite.internal.processors.query.IgniteSqlSchemaIndexingTest;
 import org.apache.ignite.internal.processors.query.IgniteSqlSegmentedIndexMultiNodeSelfTest;
 import org.apache.ignite.internal.processors.query.IgniteSqlSegmentedIndexSelfTest;
@@ -283,6 +284,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
         suite.addTestSuite(IgniteCacheDistributedPartitionQuerySelfTest.class);
         suite.addTestSuite(IgniteCacheDistributedPartitionQueryNodeRestartsSelfTest.class);
         suite.addTestSuite(IgniteCacheDistributedPartitionQueryConfigurationSelfTest.class);
+        suite.addTestSuite(IgniteSqlKeyValueFieldsTest.class);
 
         return suite;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/platforms/cpp/core-test/config/cache-query-default.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/config/cache-query-default.xml b/modules/platforms/cpp/core-test/config/cache-query-default.xml
index 366435c..1c1e5f3 100644
--- a/modules/platforms/cpp/core-test/config/cache-query-default.xml
+++ b/modules/platforms/cpp/core-test/config/cache-query-default.xml
@@ -50,8 +50,14 @@
                         <list>
                             <bean class="org.apache.ignite.cache.QueryEntity">
                                 <property name="valueType" value="QueryPerson"/>
+
+                                <property name="keyFieldName" value="k"/>
+                                <property name="valueFieldName" value="v"/>
+
                                 <property name="fields">
                                     <map>
+                                        <entry key="k" value="java.lang.Integer"/>
+                                        <entry key="v" value="QueryPerson"/>
                                         <entry key="name" value="java.lang.String"/>
                                         <entry key="age" value="java.lang.Integer"/>
                                         <entry key="birthday" value="java.util.Date"/>

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/platforms/cpp/core-test/src/cache_query_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core-test/src/cache_query_test.cpp b/modules/platforms/cpp/core-test/src/cache_query_test.cpp
index 259a9a1..e9c4610 100644
--- a/modules/platforms/cpp/core-test/src/cache_query_test.cpp
+++ b/modules/platforms/cpp/core-test/src/cache_query_test.cpp
@@ -163,6 +163,29 @@ public:
         return recordCreated;
     }
 
+    /**
+     * @return true if objects are equal.
+     */
+    friend bool operator==(QueryPerson const& lhs, QueryPerson const& rhs)
+    {
+        return lhs.GetName() == rhs.GetName() && lhs.GetAge() == rhs.GetAge() &&
+            lhs.GetBirthday() == rhs.GetBirthday() && lhs.GetCreationTime() == rhs.GetCreationTime();
+    }
+
+    /**
+     * Outputs the object to stream.
+     *
+     * @return Stream.
+     */
+    friend std::ostream& operator<<(std::ostream& str, QueryPerson const& obj)
+    {
+        str << "QueryPerson::name: " << obj.GetName()
+            << "QueryPerson::age: " << obj.GetAge()
+            << "QueryPerson::birthday: " << obj.GetBirthday().GetMilliseconds()
+            << "QueryPerson::recordCreated: " << obj.GetCreationTime().GetSeconds() << "." << obj.GetCreationTime().GetSecondFraction();
+        return str;
+    }
+
 private:
     /** Name. */
     char* name;
@@ -1811,4 +1834,63 @@ BOOST_AUTO_TEST_CASE(TestFieldsQueryPageZero)
     BOOST_CHECK_THROW(CheckFieldsQueryPages(0, 100, 0), IgniteError);
 }
 
+/**
+ * Test query for key and value fields.
+ */
+BOOST_AUTO_TEST_CASE(TestKeyValFields)
+{
+    Cache<int, QueryPerson> cache = GetPersonCache();
+
+    QueryPerson person("John", 30, MakeDateGmt(1987), MakeTimestampGmt(2017, 1, 1, 1, 1));
+
+    cache.Put(1, person);
+
+    for (int i = 0; i < 2; i++)
+    {
+        SqlFieldsQuery qry(i == 0 ?
+            "select _key, _val, k, v, name, age, birthday, recordCreated from QueryPerson" :
+            "select _key, _val, * from QueryPerson");
+
+        QueryFieldsCursor cursor = cache.Query(qry);
+
+        BOOST_REQUIRE(cursor.HasNext());
+
+        QueryFieldsRow row = cursor.GetNext();
+
+        BOOST_REQUIRE(row.HasNext());
+        int id = row.GetNext<int>();
+        BOOST_CHECK_EQUAL(1, id);
+
+        BOOST_REQUIRE(row.HasNext());
+        QueryPerson p = row.GetNext<QueryPerson>();
+        BOOST_CHECK_EQUAL(p, person);
+
+        BOOST_REQUIRE(row.HasNext());
+        id = row.GetNext<int>();
+        BOOST_CHECK_EQUAL(1, id);
+
+        BOOST_REQUIRE(row.HasNext());
+        p = row.GetNext<QueryPerson>();
+        BOOST_CHECK_EQUAL(p, person);
+
+        BOOST_REQUIRE(row.HasNext());
+        std::string name = row.GetNext<std::string>();
+        BOOST_CHECK_EQUAL(name, person.GetName());
+
+        BOOST_REQUIRE(row.HasNext());
+        int age = row.GetNext<int>();
+        BOOST_CHECK_EQUAL(age, person.GetAge());
+
+        BOOST_REQUIRE(row.HasNext());
+        Date birthday = row.GetNext<Date>();
+        BOOST_CHECK(birthday == person.GetBirthday());
+
+        BOOST_REQUIRE(row.HasNext());
+        Timestamp recordCreated = row.GetNext<Timestamp>();
+        BOOST_CHECK(recordCreated == person.GetCreationTime());
+
+        BOOST_CHECK(!row.HasNext());
+    }
+}
+
 BOOST_AUTO_TEST_SUITE_END()

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/platforms/cpp/odbc-test/config/queries-default.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/config/queries-default.xml b/modules/platforms/cpp/odbc-test/config/queries-default.xml
index c1eaea8..56040f1 100644
--- a/modules/platforms/cpp/odbc-test/config/queries-default.xml
+++ b/modules/platforms/cpp/odbc-test/config/queries-default.xml
@@ -95,8 +95,13 @@
                                 <property name="keyType" value="java.lang.Long"/>
                                 <property name="valueType" value="ComplexType"/>
 
+                                <property name="keyFieldName" value="k"/>
+                                <property name="valueFieldName" value="v"/>
+
                                 <property name="fields">
                                     <map>
+                                        <entry key="k" value="java.lang.Long"/>
+                                        <entry key="v" value="ComplexType"/>
                                         <entry key="i32Field" value="java.lang.Integer"/>
                                         <entry key="objField" value="TestObject"/>
                                         <entry key="strField" value="java.lang.String"/>

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/platforms/cpp/odbc-test/include/complex_type.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/include/complex_type.h b/modules/platforms/cpp/odbc-test/include/complex_type.h
index d844cd5..8a1bd59 100644
--- a/modules/platforms/cpp/odbc-test/include/complex_type.h
+++ b/modules/platforms/cpp/odbc-test/include/complex_type.h
@@ -50,6 +50,31 @@ namespace ignite
         TestObject objField;
         std::string strField;
     };
+
+    bool operator==(TestObject const& lhs, TestObject const& rhs)
+    {
+        return lhs.f1 == rhs.f1 && lhs.f2 == rhs.f2;
+    }
+
+    bool operator==(ComplexType const& lhs, ComplexType const& rhs)
+    {
+        return lhs.i32Field == rhs.i32Field && lhs.objField == rhs.objField && lhs.strField == rhs.strField;
+    }
+
+    std::ostream& operator<<(std::ostream& str, TestObject const& obj)
+    {
+        str << "TestObject::f1: " << obj.f1
+            << "TestObject::f2: " << obj.f2;
+        return str;
+    }
+
+    std::ostream& operator<<(std::ostream& str, ComplexType const& obj)
+    {
+        str << "ComplexType::i32Field: " << obj.i32Field
+            << "ComplexType::objField: " << obj.objField
+            << "ComplexType::strField: " << obj.strField;
+        return str;
+    }
 }
 
 namespace ignite

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/platforms/cpp/odbc-test/src/queries_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/odbc-test/src/queries_test.cpp b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
index eb0904f..fdf3503 100644
--- a/modules/platforms/cpp/odbc-test/src/queries_test.cpp
+++ b/modules/platforms/cpp/odbc-test/src/queries_test.cpp
@@ -35,6 +35,7 @@
 #include "ignite/ignite.h"
 #include "ignite/ignition.h"
 #include "ignite/impl/binary/binary_utils.h"
+#include "ignite/binary/binary_object.h"
 
 #include "test_type.h"
 #include "complex_type.h"
@@ -45,6 +46,9 @@ using namespace ignite::cache;
 using namespace ignite::cache::query;
 using namespace ignite::common;
 using namespace ignite_test;
+using namespace ignite::binary;
+using namespace ignite::impl::binary;
+using namespace ignite::impl::interop;
 
 using namespace boost::unit_test;
 
@@ -1414,4 +1418,148 @@ BOOST_AUTO_TEST_CASE(TestTablesMeta)
     BOOST_CHECK(ret == SQL_NO_DATA);
 }
 
+template<typename T>
+void CheckObjectData(int8_t* data, int32_t len, T const& value)
+{
+    InteropUnpooledMemory mem(len);
+    mem.Length(len);
+    memcpy(mem.Data(), data, len);
+
+    BinaryObject obj(BinaryObjectImpl::FromMemory(mem, 0, 0));
+
+    T actual = obj.Deserialize<T>();
+    
+    BOOST_CHECK_EQUAL(value, actual);
+}
+
+BOOST_AUTO_TEST_CASE(TestKeyVal)
+{
+    Connect("DRIVER={Apache Ignite};ADDRESS=127.0.0.1:11110;CACHE=cache2");
+
+    SQLRETURN ret;
+
+    ComplexType obj;
+
+    obj.i32Field = 123;
+    obj.strField = "Some string";
+
+    obj.objField.f1 = 54321;
+    obj.objField.f2 = "Hello Ignite";
+
+    cache2.Put(1, obj);
+
+    //_key
+    int64_t column1 = 0;
+    //_val
+    int8_t column2[ODBC_BUFFER_SIZE] = { 0 };
+    //k
+    int64_t column3 = 0;
+    //v
+    int8_t column4[ODBC_BUFFER_SIZE] = { 0 };
+    //i32Field
+    int64_t column5 = 0;
+    //objField
+    int8_t column6[ODBC_BUFFER_SIZE] = { 0 };
+    //strField
+    char column7[ODBC_BUFFER_SIZE] = { 0 };
+    
+    SQLLEN column1Len = sizeof(column1);
+    SQLLEN column2Len = sizeof(column2);
+    SQLLEN column3Len = sizeof(column3);
+    SQLLEN column4Len = sizeof(column4);
+    SQLLEN column5Len = sizeof(column5);
+    SQLLEN column6Len = sizeof(column6);
+    SQLLEN column7Len = sizeof(column7);
+
+    // Binding columns.
+    ret = SQLBindCol(stmt, 1, SQL_C_SLONG, &column1, column1Len, &column1Len);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLBindCol(stmt, 2, SQL_C_BINARY, &column2, column2Len, &column2Len);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLBindCol(stmt, 3, SQL_C_SLONG, &column3, column3Len, &column3Len);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLBindCol(stmt, 4, SQL_C_BINARY, &column4, column4Len, &column4Len);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLBindCol(stmt, 5, SQL_C_SLONG, &column5, column5Len, &column5Len);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLBindCol(stmt, 6, SQL_C_BINARY, &column6, column6Len, &column6Len);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLBindCol(stmt, 7, SQL_C_CHAR, &column7, column7Len, &column7Len);
+
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    SQLCHAR request[] = "SELECT _key, _val, k, v, i32Field, objField, strField FROM ComplexType";
+
+    ret = SQLExecDirect(stmt, request, SQL_NTS);
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLFetch(stmt);
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    BOOST_CHECK_EQUAL(column1, 1);
+
+    CheckObjectData(column2, static_cast<int32_t>(column2Len), obj);
+
+    BOOST_CHECK_EQUAL(column3, 1);
+
+    CheckObjectData(column4, static_cast<int32_t>(column4Len), obj);
+
+    BOOST_CHECK_EQUAL(column5, obj.i32Field);
+    
+    CheckObjectData(column6, static_cast<int32_t>(column6Len), obj.objField);
+
+    BOOST_CHECK_EQUAL(column7, obj.strField);
+
+    ret = SQLFetch(stmt);
+    BOOST_CHECK(ret == SQL_NO_DATA);
+
+    SQLCHAR requestStar[] = "SELECT _key, _val, * FROM ComplexType";
+
+    ret = SQLExecDirect(stmt, requestStar, SQL_NTS);
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    ret = SQLFetch(stmt);
+    if (!SQL_SUCCEEDED(ret))
+        BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
+
+    BOOST_CHECK_EQUAL(column1, 1);
+
+    CheckObjectData(column2, static_cast<int32_t>(column2Len), obj);
+
+    BOOST_CHECK_EQUAL(column3, 1);
+
+    CheckObjectData(column4, static_cast<int32_t>(column4Len), obj);
+
+    BOOST_CHECK_EQUAL(column5, obj.i32Field);
+
+    CheckObjectData(column6, static_cast<int32_t>(column6Len), obj.objField);
+
+    BOOST_CHECK_EQUAL(column7, obj.strField);
+
+    ret = SQLFetch(stmt);
+    BOOST_CHECK(ret == SQL_NO_DATA);
+}
+
 BOOST_AUTO_TEST_SUITE_END()

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
index b2213d8..c638449 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
@@ -1423,6 +1423,13 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
                         {
                             new QueryAlias("AliasTest", "Person_AliasTest"),
                             new QueryAlias("Address.AliasTest", "Addr_AliasTest")
+                        },
+                        KeyFieldName = "MyKey",
+                        ValueFieldName = "MyValue",
+                        Fields =
+                        {
+                            new QueryField("MyKey", typeof(int)),
+                            new QueryField("MyValue", typeof(T)),
                         }
                     },
                     new QueryEntity(typeof (int), typeof (Organization))) {CacheMode = CacheMode.Replicated});

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
index 0b13bf9..1fa993b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
@@ -622,6 +622,58 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
         }
 
         /// <summary>
+        /// Tests custom key and value field names.
+        /// </summary>
+        [Test]
+        public void TestCustomKeyValueFieldNames()
+        {
+            // Check select * with default config - does not include _key, _val.
+            var cache = Cache();
+
+            cache[1] = new QueryPerson("Joe", 48);
+
+            var row = cache.QueryFields(new SqlFieldsQuery("select * from QueryPerson")).GetAll()[0];
+            Assert.AreEqual(2, row.Count);
+            Assert.AreEqual(48, row[0]);
+            Assert.AreEqual("Joe", row[1]);
+
+            // Check select * with custom names - fields are included.
+            cache = GetIgnite().GetOrCreateCache<int, QueryPerson>(
+                new CacheConfiguration("customKeyVal")
+                {
+                    QueryEntities = new[]
+                    {
+                        new QueryEntity(typeof(int), typeof(QueryPerson))
+                        {
+                            Fields = new[]
+                            {
+                                new QueryField("age", "int"),
+                                new QueryField("FullKey", "int"),
+                                new QueryField("FullVal", "QueryPerson")
+                            },
+                            KeyFieldName = "FullKey",
+                            ValueFieldName = "FullVal"
+                        }
+                    }
+                });
+
+            cache[1] = new QueryPerson("John", 33);
+
+            row = cache.QueryFields(new SqlFieldsQuery("select * from QueryPerson")).GetAll()[0];
+            
+            Assert.AreEqual(3, row.Count);
+            Assert.AreEqual(33, row[0]);
+            Assert.AreEqual(1, row[1]);
+
+            var person = (QueryPerson) row[2];
+            Assert.AreEqual("John", person.Name);
+
+            // Check explicit select.
+            row = cache.QueryFields(new SqlFieldsQuery("select FullKey from QueryPerson")).GetAll()[0];
+            Assert.AreEqual(1, row[0]);
+        }
+
+        /// <summary>
         /// Validates the query results.
         /// </summary>
         /// <param name="cache">Cache.</param>

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index 0524c05..2600028 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -661,7 +661,9 @@ namespace Apache.Ignite.Core.Tests
                                 },
                                 KeyType = typeof (string),
                                 ValueType = typeof (long),
-                                TableName = "table-1"
+                                TableName = "table-1",
+                                KeyFieldName = "k",
+                                ValueFieldName = "v"
                             },
                         },
                         ReadFromBackup = false,

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
index 8aadf0e..b6163ee 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
@@ -148,6 +148,20 @@ namespace Apache.Ignite.Core.Cache.Configuration
         }
 
         /// <summary>
+        /// Gets or sets the name of the field that is used to denote the entire key.
+        /// <para />
+        /// By default, entite key can be accessed with a special "_key" field name.
+        /// </summary>
+        public string KeyFieldName { get; set; }
+
+        /// <summary>
+        /// Gets or sets the name of the field that is used to denote the entire value.
+        /// <para />
+        /// By default, entite value can be accessed with a special "_val" field name.
+        /// </summary>
+        public string ValueFieldName { get; set; }
+
+        /// <summary>
         /// Gets or sets the name of the SQL table.
         /// When not set, value type name is used.
         /// </summary>
@@ -197,6 +211,9 @@ namespace Apache.Ignite.Core.Cache.Configuration
 
             count = reader.ReadInt();
             Indexes = count == 0 ? null : Enumerable.Range(0, count).Select(x => new QueryIndex(reader)).ToList();
+
+            KeyFieldName = reader.ReadString();
+            ValueFieldName = reader.ReadString();
         }
 
         /// <summary>
@@ -250,6 +267,9 @@ namespace Apache.Ignite.Core.Cache.Configuration
             }
             else
                 writer.WriteInt(0);
+
+            writer.WriteString(KeyFieldName);
+            writer.WriteString(ValueFieldName);
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index 728e62b..76c2068 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -417,6 +417,20 @@
                                                                     </xs:documentation>
                                                                 </xs:annotation>
                                                             </xs:attribute>
+                                                            <xs:attribute name="keyFieldName" type="xs:string">
+                                                                <xs:annotation>
+                                                                    <xs:documentation>
+                                                                        Name of the field that denotes the key.
+                                                                    </xs:documentation>
+                                                                </xs:annotation>
+                                                            </xs:attribute>
+                                                            <xs:attribute name="valueFieldName" type="xs:string">
+                                                                <xs:annotation>
+                                                                    <xs:documentation>
+                                                                        Name of the field that denotes the value.
+                                                                    </xs:documentation>
+                                                                </xs:annotation>
+                                                            </xs:attribute>
                                                         </xs:complexType>
                                                     </xs:element>
                                                 </xs:sequence>

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryExpressionVisitor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryExpressionVisitor.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryExpressionVisitor.cs
index 3659158..2d14ec4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryExpressionVisitor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryExpressionVisitor.cs
@@ -51,18 +51,24 @@ namespace Apache.Ignite.Linq.Impl
         private static readonly CopyOnWriteConcurrentDictionary<MemberInfo, string> FieldNameMap =
             new CopyOnWriteConcurrentDictionary<MemberInfo, string>();
 
+        /** */
+        private readonly bool _includeAllFields;
+
         /// <summary>
         /// Initializes a new instance of the <see cref="CacheQueryExpressionVisitor" /> class.
         /// </summary>
         /// <param name="modelVisitor">The _model visitor.</param>
         /// <param name="useStar">Flag indicating that star '*' qualifier should be used
         /// for the whole-table select instead of _key, _val.</param>
-        public CacheQueryExpressionVisitor(CacheQueryModelVisitor modelVisitor, bool useStar)
+        /// <param name="includeAllFields">Flag indicating that star '*' qualifier should be used
+        /// for the whole-table select as well as _key, _val.</param>
+        public CacheQueryExpressionVisitor(CacheQueryModelVisitor modelVisitor, bool useStar, bool includeAllFields)
         {
             Debug.Assert(modelVisitor != null);
 
             _modelVisitor = modelVisitor;
             _useStar = useStar;
+            _includeAllFields = includeAllFields;
         }
 
         /// <summary>
@@ -271,7 +277,11 @@ namespace Apache.Ignite.Linq.Impl
         {
             // Count, sum, max, min expect a single field or *
             // In other cases we need both parts of cache entry
-            var format = _useStar ? "{0}.*" : "{0}._key, {0}._val";
+            var format = _includeAllFields
+                ? "{0}.*, {0}._key, {0}._val"
+                : _useStar
+                    ? "{0}.*"
+                    : "{0}._key, {0}._val";
 
             var tableName = Aliases.GetTableAlias(expression);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/efb7abce/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryModelVisitor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryModelVisitor.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryModelVisitor.cs
index 2cf4420..f74ccc7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryModelVisitor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryModelVisitor.cs
@@ -107,7 +107,7 @@ namespace Apache.Ignite.Linq.Impl
         /// <summary>
         /// Visits the query model.
         /// </summary>
-        private void VisitQueryModel(QueryModel queryModel, bool forceStar)
+        private void VisitQueryModel(QueryModel queryModel, bool includeAllFields)
         {
             _aliases.Push();
 
@@ -115,7 +115,7 @@ namespace Apache.Ignite.Linq.Impl
             _builder.Append("select ");
 
             // TOP 1 FLD1, FLD2
-            VisitSelectors(queryModel, forceStar);
+            VisitSelectors(queryModel, includeAllFields);
 
             // FROM ... WHERE ... JOIN ...
             base.VisitQueryModel(queryModel);
@@ -129,14 +129,14 @@ namespace Apache.Ignite.Linq.Impl
         /// <summary>
         /// Visits the selectors.
         /// </summary>
-        public void VisitSelectors(QueryModel queryModel, bool forceStar)
+        public void VisitSelectors(QueryModel queryModel, bool includeAllFields)
         {
             var parenCount = ProcessResultOperatorsBegin(queryModel);
 
             if (parenCount >= 0)
             {
                 // FIELD1, FIELD2
-                BuildSqlExpression(queryModel.SelectClause.Selector, forceStar || parenCount > 0);
+                BuildSqlExpression(queryModel.SelectClause.Selector, parenCount > 0, includeAllFields);
                 _builder.Append(')', parenCount).Append(" ");
             }
         }
@@ -512,9 +512,9 @@ namespace Apache.Ignite.Linq.Impl
         /// <summary>
         /// Builds the SQL expression.
         /// </summary>
-        private void BuildSqlExpression(Expression expression, bool useStar = false)
+        private void BuildSqlExpression(Expression expression, bool useStar = false, bool includeAllFields = false)
         {
-            new CacheQueryExpressionVisitor(this, useStar).Visit(expression);
+            new CacheQueryExpressionVisitor(this, useStar, includeAllFields).Visit(expression);
         }
     }
 }


[33/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java
index 396083e..a91c5b6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionTouchSelfTest.java
@@ -127,7 +127,7 @@ public class GridCacheEvictionTouchSelfTest extends GridCommonAbstractTest {
         try {
             Ignite ignite = startGrid(1);
 
-            final IgniteCache<Integer, Integer> cache = ignite.cache(null);
+            final IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             final Random rnd = new Random();
 
@@ -182,7 +182,7 @@ public class GridCacheEvictionTouchSelfTest extends GridCommonAbstractTest {
         try {
             Ignite ignite = startGrid(1);
 
-            final IgniteCache<Integer, Integer> cache = ignite.cache(null);
+            final IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < 100; i++)
                 cache.put(i, i);
@@ -212,7 +212,7 @@ public class GridCacheEvictionTouchSelfTest extends GridCommonAbstractTest {
         try {
             Ignite ignite = startGrid(1);
 
-            final IgniteCache<Integer, Integer> cache = ignite.cache(null);
+            final IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             Collection<Integer> keys = new ArrayList<>(100);
 
@@ -247,7 +247,7 @@ public class GridCacheEvictionTouchSelfTest extends GridCommonAbstractTest {
         try {
             Ignite ignite = startGrid(1);
 
-            final IgniteCache<Integer, Integer> cache = ignite.cache(null);
+            final IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < 10000; i++)
                 load(cache, i, true);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearEvictionPolicySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearEvictionPolicySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearEvictionPolicySelfTest.java
index 0eb7a42..33ec6d9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearEvictionPolicySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearEvictionPolicySelfTest.java
@@ -56,7 +56,7 @@ public class LruNearEvictionPolicySelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration cc = new CacheConfiguration();
+        CacheConfiguration cc = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cc.setCacheMode(PARTITIONED);
         cc.setAtomicityMode(atomicityMode);
@@ -115,7 +115,7 @@ public class LruNearEvictionPolicySelfTest extends GridCommonAbstractTest {
 
             info("Inserting " + cnt + " keys to cache.");
 
-            try (IgniteDataStreamer<Integer, String> ldr = grid(0).dataStreamer(null)) {
+            try (IgniteDataStreamer<Integer, String> ldr = grid(0).dataStreamer(DEFAULT_CACHE_NAME)) {
                 for (int i = 0; i < cnt; i++)
                     ldr.addData(i, Integer.toString(i));
             }
@@ -127,7 +127,7 @@ public class LruNearEvictionPolicySelfTest extends GridCommonAbstractTest {
             info("Getting " + cnt + " keys from cache.");
 
             for (int i = 0; i < cnt; i++) {
-                IgniteCache<Integer, String> cache = grid(rand.nextInt(GRID_COUNT)).cache(null);
+                IgniteCache<Integer, String> cache = grid(rand.nextInt(GRID_COUNT)).cache(DEFAULT_CACHE_NAME);
 
                 assertTrue(cache.get(i).equals(Integer.toString(i)));
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearOnlyNearEvictionPolicySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearOnlyNearEvictionPolicySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearOnlyNearEvictionPolicySelfTest.java
index 5b0a12c..90f007a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearOnlyNearEvictionPolicySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/lru/LruNearOnlyNearEvictionPolicySelfTest.java
@@ -73,7 +73,7 @@ public class LruNearOnlyNearEvictionPolicySelfTest extends GridCommonAbstractTes
         if (cnt == 0)
             c.setClientMode(true);
         else {
-            CacheConfiguration cc = new CacheConfiguration();
+            CacheConfiguration cc = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             cc.setCacheMode(cacheMode);
             cc.setAtomicityMode(atomicityMode);
@@ -146,13 +146,13 @@ public class LruNearOnlyNearEvictionPolicySelfTest extends GridCommonAbstractTes
 
             nearCfg.setNearEvictionPolicy(plc);
 
-            grid(0).createNearCache(null, nearCfg);
+            grid(0).createNearCache(DEFAULT_CACHE_NAME, nearCfg);
 
             int cnt = 1000;
 
             info("Inserting " + cnt + " keys to cache.");
 
-            try (IgniteDataStreamer<Integer, String> ldr = grid(1).dataStreamer(null)) {
+            try (IgniteDataStreamer<Integer, String> ldr = grid(1).dataStreamer(DEFAULT_CACHE_NAME)) {
                 for (int i = 0; i < cnt; i++)
                     ldr.addData(i, Integer.toString(i));
             }
@@ -163,7 +163,7 @@ public class LruNearOnlyNearEvictionPolicySelfTest extends GridCommonAbstractTes
             info("Getting " + cnt + " keys from cache.");
 
             for (int i = 0; i < cnt; i++) {
-                IgniteCache<Integer, String> cache = grid(0).cache(null);
+                IgniteCache<Integer, String> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
                 assertTrue(cache.get(i).equals(Integer.toString(i)));
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java
index 20edd4e..3aee941 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/paged/PageEvictionAbstractTest.java
@@ -29,6 +29,7 @@ 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 org.jetbrains.annotations.NotNull;
 
 /**
  *
@@ -102,13 +103,13 @@ public class PageEvictionAbstractTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     protected static CacheConfiguration<Object, Object> cacheConfig(
-        String name,
+        @NotNull String name,
         String memoryPlcName,
         CacheMode cacheMode,
         CacheAtomicityMode atomicityMode,
         CacheWriteSynchronizationMode writeSynchronizationMode
     ) {
-        CacheConfiguration<Object, Object> cacheConfiguration = new CacheConfiguration<>()
+        CacheConfiguration<Object, Object> cacheConfiguration = new CacheConfiguration<>(DEFAULT_CACHE_NAME)
             .setName(name)
             .setAffinity(new RendezvousAffinityFunction(false, 32))
             .setCacheMode(cacheMode)

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/sorted/SortedEvictionPolicyPerformanceTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/sorted/SortedEvictionPolicyPerformanceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/sorted/SortedEvictionPolicyPerformanceTest.java
index a3a61a2..f7ad491 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/sorted/SortedEvictionPolicyPerformanceTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/sorted/SortedEvictionPolicyPerformanceTest.java
@@ -99,7 +99,7 @@ public class SortedEvictionPolicyPerformanceTest extends GridCommonAbstractTest
         final int pPut = P_PUT;
         final int pGet = P_PUT + P_GET;
 
-        final IgniteCache<Integer, Integer> cache = ignite.cache(null);
+        final IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         multithreadedAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheClientNearCacheExpiryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheClientNearCacheExpiryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheClientNearCacheExpiryTest.java
index 44ff4ab..3acdf9f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheClientNearCacheExpiryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheClientNearCacheExpiryTest.java
@@ -86,7 +86,7 @@ public class IgniteCacheClientNearCacheExpiryTest extends IgniteCacheAbstractTes
 
         assertTrue(ignite.configuration().isClientMode());
 
-        IgniteCache<Object, Object> cache = ignite.cache(null);
+        IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         assertTrue(((IgniteCacheProxy)cache).context().isNear());
 
@@ -109,7 +109,7 @@ public class IgniteCacheClientNearCacheExpiryTest extends IgniteCacheAbstractTes
         // Check size of near entries via reflection because entries is filtered for size() API call.
         IgniteEx igniteEx = (IgniteEx)ignite;
         GridCacheConcurrentMap map = GridTestUtils.getFieldValue(
-            ((GridCacheProxyImpl)igniteEx.cachex(null)).delegate(),
+            ((GridCacheProxyImpl)igniteEx.cachex(DEFAULT_CACHE_NAME)).delegate(),
             GridCacheAdapter.class,
             "map");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
index 5d01716..8ef7281 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyAbstractTest.java
@@ -135,13 +135,13 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
             info("PUT DONE");
         }
 
-        long pSize = grid(0).context().cache().internalCache(null).context().ttl().pendingSize();
+        long pSize = grid(0).context().cache().internalCache(DEFAULT_CACHE_NAME).context().ttl().pendingSize();
 
         assertTrue("Too many pending entries: " + pSize, pSize <= 1);
 
         cache.remove(key);
 
-        pSize = grid(0).context().cache().internalCache(null).context().ttl().pendingSize();
+        pSize = grid(0).context().cache().internalCache(DEFAULT_CACHE_NAME).context().ttl().pendingSize();
 
         assertEquals(0, pSize);
     }
@@ -996,7 +996,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
         checkTtl(key, 60_000L);
 
         IgniteCache<Object, Object> cache =
-            grid(0).affinity(null).isPrimary(grid(1).localNode(), key) ? jcache(1) : jcache(2);
+            grid(0).affinity(DEFAULT_CACHE_NAME).isPrimary(grid(1).localNode(), key) ? jcache(1) : jcache(2);
 
         assertEquals(1, cache.get(key));
 
@@ -1024,7 +1024,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
 
         Ignite client = startGrid("client", clientCfg);
 
-        IgniteCache<Object, Object> cache = client.cache(null);
+        IgniteCache<Object, Object> cache = client.cache(DEFAULT_CACHE_NAME);
 
         Integer key = 1;
 
@@ -1194,7 +1194,7 @@ public abstract class IgniteCacheExpiryPolicyAbstractTest extends IgniteCacheAbs
         for (int i = 0; i < gridCount(); i++) {
             IgniteKernal grid = (IgniteKernal)grid(i);
 
-            GridCacheAdapter<Object, Object> cache = grid.context().cache().internalCache();
+            GridCacheAdapter<Object, Object> cache = grid.context().cache().internalCache(DEFAULT_CACHE_NAME);
 
             if (cache.context().isNear())
                 cache = cache.context().near().dht();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java
index 54357a0..2b8a9ec 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheExpiryPolicyWithStoreAbstractTest.java
@@ -296,7 +296,7 @@ public abstract class IgniteCacheExpiryPolicyWithStoreAbstractTest extends Ignit
         for (int i = 0; i < gridCount(); i++) {
             IgniteKernal grid = (IgniteKernal)grid(i);
 
-            GridCacheAdapter<Object, Object> cache = grid.context().cache().internalCache();
+            GridCacheAdapter<Object, Object> cache = grid.context().cache().internalCache(DEFAULT_CACHE_NAME);
 
             GridCacheEntryEx e = null;
 
@@ -317,9 +317,9 @@ public abstract class IgniteCacheExpiryPolicyWithStoreAbstractTest extends Ignit
 
             if (e == null) {
                 if (primaryOnly)
-                    assertTrue("Not found " + key, !grid.affinity(null).isPrimary(grid.localNode(), key));
+                    assertTrue("Not found " + key, !grid.affinity(DEFAULT_CACHE_NAME).isPrimary(grid.localNode(), key));
                 else
-                    assertTrue("Not found " + key, !grid.affinity(null).isPrimaryOrBackup(grid.localNode(), key));
+                    assertTrue("Not found " + key, !grid.affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid.localNode(), key));
             }
             else {
                 found = true;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheLargeValueExpireTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheLargeValueExpireTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheLargeValueExpireTest.java
index 1017a67..71d809a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheLargeValueExpireTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheLargeValueExpireTest.java
@@ -76,14 +76,14 @@ public class IgniteCacheLargeValueExpireTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     private void checkExpire(Ignite ignite, boolean eagerTtl) throws Exception {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
         ccfg.setEagerTtl(eagerTtl);
 
         ignite.createCache(ccfg);
 
         try {
             IgniteCache<Object, Object> cache =
-                ignite.cache(null).withExpiryPolicy(new TouchedExpiryPolicy(new Duration(0, 500)));
+                ignite.cache(DEFAULT_CACHE_NAME).withExpiryPolicy(new TouchedExpiryPolicy(new Duration(0, 500)));
 
             ThreadLocalRandom rnd = ThreadLocalRandom.current();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheOnlyOneTtlCleanupThreadExistsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheOnlyOneTtlCleanupThreadExistsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheOnlyOneTtlCleanupThreadExistsTest.java
index 84f5144..f47de7d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheOnlyOneTtlCleanupThreadExistsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheOnlyOneTtlCleanupThreadExistsTest.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache.expiry;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jetbrains.annotations.NotNull;
 
 /**
  * Checks that one and only one Ttl cleanup worker thread must exists, and only
@@ -70,8 +71,8 @@ public class IgniteCacheOnlyOneTtlCleanupThreadExistsTest extends GridCommonAbst
      * @param eagerTtl Eager ttl falg.
      * @return Cache configuration.
      */
-    private CacheConfiguration createCacheConfiguration(String name, boolean eagerTtl) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+    private CacheConfiguration createCacheConfiguration(@NotNull String name, boolean eagerTtl) {
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setEagerTtl(eagerTtl);
         ccfg.setName(name);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheTtlCleanupSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheTtlCleanupSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheTtlCleanupSelfTest.java
index e162c93..9d21823 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheTtlCleanupSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/expiry/IgniteCacheTtlCleanupSelfTest.java
@@ -59,13 +59,13 @@ public class IgniteCacheTtlCleanupSelfTest extends GridCacheAbstractSelfTest {
      * @throws Exception If failed.
      */
     public void testDeferredDeleteTtl() throws Exception {
-        IgniteCache<Object, Object> cache = grid(0).cache(null)
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME)
             .withExpiryPolicy(new CreatedExpiryPolicy(new Duration(TimeUnit.SECONDS, 5)));
 
         int cnt = GridDhtLocalPartition.MAX_DELETE_QUEUE_SIZE / PART_NUM + 100;
 
         for (long i = 0; i < cnt; i++)
-            grid(0).cache(null).put(i * PART_NUM, i);
+            grid(0).cache(DEFAULT_CACHE_NAME).put(i * PART_NUM, i);
 
         for (int i = 0; i < cnt; i++)
             cache.put(i * PART_NUM, i);
@@ -73,9 +73,9 @@ public class IgniteCacheTtlCleanupSelfTest extends GridCacheAbstractSelfTest {
         // Wait 5 seconds.
         Thread.sleep(6_000);
 
-        assertEquals(cnt, grid(0).cache(null).size());
+        assertEquals(cnt, grid(0).cache(DEFAULT_CACHE_NAME).size());
 
-        GridCacheAdapter<Object, Object> cacheAdapter = ((IgniteKernal)grid(0)).internalCache(null);
+        GridCacheAdapter<Object, Object> cacheAdapter = ((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME);
 
         IgniteCacheObjectProcessor cacheObjects = cacheAdapter.context().cacheObjects();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoadAllAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoadAllAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoadAllAbstractTest.java
index d072692..2e9753f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoadAllAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheLoadAllAbstractTest.java
@@ -174,7 +174,7 @@ public abstract class IgniteCacheLoadAllAbstractTest extends IgniteCacheAbstract
      * @param expVals Expected values.
      */
     private void checkValues(int keys, Map<Integer, String> expVals) {
-        Affinity<Object> aff = grid(0).affinity(null);
+        Affinity<Object> aff = grid(0).affinity(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < gridCount(); i++) {
             ClusterNode node = ignite(i).cluster().localNode();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java
index cde1a89..40e36c2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionAbstractTest.java
@@ -41,6 +41,7 @@ import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.lang.IgniteBiInClosure;
 import org.apache.ignite.resources.CacheStoreSessionResource;
 import org.apache.ignite.resources.IgniteInstanceResource;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -113,7 +114,7 @@ public abstract class IgniteCacheStoreSessionAbstractTest extends IgniteCacheAbs
      * @throws Exception If failed.
      */
     public void testStoreSession() throws Exception {
-        assertNull(jcache(0).getName());
+        assertEquals(DEFAULT_CACHE_NAME, jcache(0).getName());
 
         assertEquals(CACHE_NAME1, ignite(0).cache(CACHE_NAME1).getName());
 
@@ -227,7 +228,7 @@ public abstract class IgniteCacheStoreSessionAbstractTest extends IgniteCacheAbs
          * @param expProps Expected properties.
          * @param expCacheName Expected cache name.
          */
-        ExpectedData(boolean tx, String expMtd, Map<Object, Object> expProps, String expCacheName) {
+        ExpectedData(boolean tx, String expMtd, Map<Object, Object> expProps, @NotNull String expCacheName) {
             this.tx = tx;
             this.expMtd = expMtd;
             this.expProps = expProps;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionWriteBehindAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionWriteBehindAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionWriteBehindAbstractTest.java
index 53d9849..dcbb63f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionWriteBehindAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheStoreSessionWriteBehindAbstractTest.java
@@ -106,7 +106,7 @@ public abstract class IgniteCacheStoreSessionWriteBehindAbstractTest extends Ign
      * @throws Exception If failed.
      */
     public void testSession() throws Exception {
-        testCache(null);
+        testCache(DEFAULT_CACHE_NAME);
 
         testCache(CACHE_NAME1);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
index 6424b8b..b9e884b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheTxStoreSessionTest.java
@@ -110,9 +110,9 @@ public class IgniteCacheTxStoreSessionTest extends IgniteCacheStoreSessionAbstra
 
             cache.remove(key3);
 
-            expData.add(new ExpectedData(true, "writeAll", new HashMap<>(), null));
-            expData.add(new ExpectedData(true, "delete", F.<Object, Object>asMap(0, "writeAll"), null));
-            expData.add(new ExpectedData(true, "sessionEnd", F.<Object, Object>asMap(0, "writeAll", 1, "delete"), null));
+            expData.add(new ExpectedData(true, "writeAll", new HashMap<>(), DEFAULT_CACHE_NAME));
+            expData.add(new ExpectedData(true, "delete", F.<Object, Object>asMap(0, "writeAll"), DEFAULT_CACHE_NAME));
+            expData.add(new ExpectedData(true, "sessionEnd", F.<Object, Object>asMap(0, "writeAll", 1, "delete"), DEFAULT_CACHE_NAME));
 
             log.info("Do tx commit.");
 
@@ -206,8 +206,8 @@ public class IgniteCacheTxStoreSessionTest extends IgniteCacheStoreSessionAbstra
 
             cache.remove(key1, key1);
 
-            expData.add(new ExpectedData(true, "delete", new HashMap<>(), null));
-            expData.add(new ExpectedData(true, "sessionEnd", F.<Object, Object>asMap(0, "delete"), null));
+            expData.add(new ExpectedData(true, "delete", new HashMap<>(), DEFAULT_CACHE_NAME));
+            expData.add(new ExpectedData(true, "sessionEnd", F.<Object, Object>asMap(0, "delete"), DEFAULT_CACHE_NAME));
 
             log.info("Do tx commit.");
 
@@ -228,8 +228,8 @@ public class IgniteCacheTxStoreSessionTest extends IgniteCacheStoreSessionAbstra
 
             cache.remove(key3, key3);
 
-            expData.add(new ExpectedData(true, "deleteAll", new HashMap<>(), null));
-            expData.add(new ExpectedData(true, "sessionEnd", F.<Object, Object>asMap(0, "deleteAll"), null));
+            expData.add(new ExpectedData(true, "deleteAll", new HashMap<>(), DEFAULT_CACHE_NAME));
+            expData.add(new ExpectedData(true, "sessionEnd", F.<Object, Object>asMap(0, "deleteAll"), DEFAULT_CACHE_NAME));
 
             log.info("Do tx commit.");
 
@@ -257,7 +257,7 @@ public class IgniteCacheTxStoreSessionTest extends IgniteCacheStoreSessionAbstra
      * @throws Exception If failed.
      */
     public void testSessionCrossCacheTx() throws Exception {
-        IgniteCache<Object, Object> cache0 = ignite(0).cache(null);
+        IgniteCache<Object, Object> cache0 = ignite(0).cache(DEFAULT_CACHE_NAME);
 
         IgniteCache<Object, Object> cache1 = ignite(0).cache(CACHE_NAME1);
 
@@ -269,9 +269,9 @@ public class IgniteCacheTxStoreSessionTest extends IgniteCacheStoreSessionAbstra
 
             cache1.put(key2, 0);
 
-            expData.add(new ExpectedData(true, "write", new HashMap<>(), null));
+            expData.add(new ExpectedData(true, "write", new HashMap<>(), DEFAULT_CACHE_NAME));
             expData.add(new ExpectedData(true, "write", F.<Object, Object>asMap(0, "write"), CACHE_NAME1));
-            expData.add(new ExpectedData(true, "sessionEnd", F.<Object, Object>asMap(0, "write", 1, "write"), null));
+            expData.add(new ExpectedData(true, "sessionEnd", F.<Object, Object>asMap(0, "write", 1, "write"), DEFAULT_CACHE_NAME));
 
             tx.commit();
         }
@@ -284,7 +284,7 @@ public class IgniteCacheTxStoreSessionTest extends IgniteCacheStoreSessionAbstra
             cache0.put(key2, 0);
 
             expData.add(new ExpectedData(true, "write", new HashMap<>(), CACHE_NAME1));
-            expData.add(new ExpectedData(true, "write", F.<Object, Object>asMap(0, "write"), null));
+            expData.add(new ExpectedData(true, "write", F.<Object, Object>asMap(0, "write"), DEFAULT_CACHE_NAME));
             expData.add(new ExpectedData(true, "sessionEnd", F.<Object, Object>asMap(0, "write", 1, "write"), CACHE_NAME1));
 
             tx.commit();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheAtomicLocalTckMetricsSelfTestImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheAtomicLocalTckMetricsSelfTestImpl.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheAtomicLocalTckMetricsSelfTestImpl.java
index fa21de9..1f42a6f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheAtomicLocalTckMetricsSelfTestImpl.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheAtomicLocalTckMetricsSelfTestImpl.java
@@ -30,7 +30,7 @@ public class GridCacheAtomicLocalTckMetricsSelfTestImpl extends GridCacheAtomicL
      * @throws Exception If failed.
      */
     public void testEntryProcessorRemove() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.put(1, 20);
 
@@ -64,7 +64,7 @@ public class GridCacheAtomicLocalTckMetricsSelfTestImpl extends GridCacheAtomicL
      * @throws Exception If failed.
      */
     public void testCacheStatistics() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.put(1, 10);
 
@@ -104,7 +104,7 @@ public class GridCacheAtomicLocalTckMetricsSelfTestImpl extends GridCacheAtomicL
      * @throws Exception If failed.
      */
     public void testConditionReplace() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         long hitCount = 0;
         long missCount = 0;
@@ -154,7 +154,7 @@ public class GridCacheAtomicLocalTckMetricsSelfTestImpl extends GridCacheAtomicL
      * @throws Exception If failed.
      */
     public void testPutIfAbsent() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         long hitCount = 0;
         long missCount = 0;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalByteArrayValuesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalByteArrayValuesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalByteArrayValuesSelfTest.java
index 1ad8d75..c206c22 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalByteArrayValuesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalByteArrayValuesSelfTest.java
@@ -53,7 +53,7 @@ public class GridCacheLocalByteArrayValuesSelfTest extends GridCacheAbstractByte
 
         c.getTransactionConfiguration().setTxSerializableEnabled(true);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(CACHE_REGULAR);
         ccfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java
index ae34cb6..0c7a217 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalFullApiSelfTest.java
@@ -56,7 +56,7 @@ public class GridCacheLocalFullApiSelfTest extends GridCacheAbstractFullApiSelfT
         cache.put("key1", 1);
         cache.put("key2", 2);
 
-        Map<ClusterNode, Collection<String>> map = grid(0).<String>affinity(null).mapKeysToNodes(F.asList("key1", "key2"));
+        Map<ClusterNode, Collection<String>> map = grid(0).<String>affinity(DEFAULT_CACHE_NAME).mapKeysToNodes(F.asList("key1", "key2"));
 
         assert map.size() == 1;
 
@@ -68,7 +68,7 @@ public class GridCacheLocalFullApiSelfTest extends GridCacheAbstractFullApiSelfT
         for (String key : keys)
             assert "key1".equals(key) || "key2".equals(key);
 
-        map = grid(0).<String>affinity(null).mapKeysToNodes(F.asList("key1", "key2"));
+        map = grid(0).<String>affinity(DEFAULT_CACHE_NAME).mapKeysToNodes(F.asList("key1", "key2"));
 
         assert map.size() == 1;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalLockSelfTest.java
index a871182..f4160ed 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalLockSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalLockSelfTest.java
@@ -81,7 +81,7 @@ public class GridCacheLocalLockSelfTest extends GridCommonAbstractTest {
      * @throws IgniteCheckedException If test failed.
      */
     public void testLockReentry() throws IgniteCheckedException {
-        IgniteCache<Integer, String> cache = ignite.cache(null);
+        IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         assert !cache.isLocalLocked(1, false);
         assert !cache.isLocalLocked(1, true);
@@ -126,7 +126,7 @@ public class GridCacheLocalLockSelfTest extends GridCommonAbstractTest {
      * @throws Exception If test failed.
      */
     public void testLock() throws Throwable {
-        final IgniteCache<Integer, String> cache = ignite.cache(null);
+        final IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         final CountDownLatch latch1 = new CountDownLatch(1);
         final CountDownLatch latch2 = new CountDownLatch(1);
@@ -244,7 +244,7 @@ public class GridCacheLocalLockSelfTest extends GridCommonAbstractTest {
      * @throws Exception If test failed.
      */
     public void testLockAndPut() throws Throwable {
-        final IgniteCache<Integer, String> cache = ignite.cache(null);
+        final IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         final CountDownLatch latch1 = new CountDownLatch(1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java
index 3551bb4..f6dc535 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java
@@ -56,7 +56,7 @@ public class GridCacheLocalMultithreadedSelfTest extends GridCommonAbstractTest
     @Override protected void beforeTest() throws Exception {
         Ignite ignite = grid();
 
-        cache = ignite.cache(null);
+        cache = ignite.cache(DEFAULT_CACHE_NAME);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxTimeoutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxTimeoutSelfTest.java
index e27207d..160e251 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxTimeoutSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxTimeoutSelfTest.java
@@ -141,7 +141,7 @@ public class GridCacheLocalTxTimeoutSelfTest extends GridCommonAbstractTest {
         Transaction tx = null;
 
         try {
-            IgniteCache<Integer, String> cache = ignite.cache(null);
+            IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             tx = ignite.transactions().txStart(concurrency, isolation, 50, 0);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/BinaryTxCacheLocalEntriesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/BinaryTxCacheLocalEntriesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/BinaryTxCacheLocalEntriesSelfTest.java
index 74d415f7..e89c73d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/BinaryTxCacheLocalEntriesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/portable/BinaryTxCacheLocalEntriesSelfTest.java
@@ -59,7 +59,7 @@ public class BinaryTxCacheLocalEntriesSelfTest extends GridCacheAbstractSelfTest
      * @throws Exception If failed.
      */
     public void testLocalEntries() throws Exception {
-        IgniteCache<Integer, BinaryObject> cache = grid(0).cache(null).withKeepBinary();
+        IgniteCache<Integer, BinaryObject> cache = grid(0).cache(DEFAULT_CACHE_NAME).withKeepBinary();
 
         final int ENTRY_CNT = 10;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousBatchAckTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousBatchAckTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousBatchAckTest.java
index 612043f..d8f1c1a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousBatchAckTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousBatchAckTest.java
@@ -252,7 +252,7 @@ public class CacheContinuousBatchAckTest extends GridCommonAbstractTest implemen
         int backups,
         CacheAtomicityMode atomicityMode,
         boolean filter) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java
index 1345dfe..8c76bbd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryAsyncFilterListenerTest.java
@@ -768,7 +768,7 @@ public class CacheContinuousQueryAsyncFilterListenerTest extends GridCommonAbstr
         CacheMode cacheMode,
         int backups,
         CacheAtomicityMode atomicityMode) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setName("test-cache-" + atomicityMode + "-" + cacheMode + "-" + backups);
         ccfg.setAtomicityMode(atomicityMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryExecuteInPrimaryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryExecuteInPrimaryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryExecuteInPrimaryTest.java
index c713bb5..a0969d7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryExecuteInPrimaryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryExecuteInPrimaryTest.java
@@ -82,7 +82,7 @@ public class CacheContinuousQueryExecuteInPrimaryTest extends GridCommonAbstract
     protected CacheConfiguration<Integer, String> cacheConfiguration(
         CacheAtomicityMode cacheAtomicityMode,
         CacheMode cacheMode) {
-        CacheConfiguration<Integer, String> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, String> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(cacheAtomicityMode);
         ccfg.setCacheMode(cacheMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/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 6b1a498..befd1d7 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
@@ -85,6 +85,7 @@ import org.apache.ignite.internal.util.typedef.PA;
 import org.apache.ignite.internal.util.typedef.PAX;
 import org.apache.ignite.internal.util.typedef.T2;
 import org.apache.ignite.internal.util.typedef.T3;
+import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteAsyncCallback;
 import org.apache.ignite.lang.IgniteInClosure;
@@ -149,7 +150,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         cfg.setEventStorageSpi(evtSpi);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(cacheMode());
         ccfg.setAtomicityMode(atomicityMode());
@@ -223,7 +224,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         client = false;
 
-        IgniteCache<Object, Object> qryClnCache = qryClient.cache(null);
+        IgniteCache<Object, Object> qryClnCache = qryClient.cache(DEFAULT_CACHE_NAME);
 
         final CacheEventListener3 lsnr = new CacheEventListener3();
 
@@ -234,7 +235,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
         qry.setRemoteFilter(new CacheEventFilter());
 
         try (QueryCursor<?> cur = qryClnCache.query(qry)) {
-            List<Integer> keys = testKeys(grid(0).cache(null), 1);
+            List<Integer> keys = testKeys(grid(0).cache(DEFAULT_CACHE_NAME), 1);
 
             for (Integer key : keys)
                 qryClnCache.put(key, -1);
@@ -259,13 +260,13 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         int minorVer = ignite0.configuration().isLateAffinityAssignment() ? 1 : 0;
 
-        GridDhtPartitionTopology top0 = ((IgniteKernal)ignite0).context().cache().context().cacheContext(1).topology();
+        GridDhtPartitionTopology top0 = ((IgniteKernal)ignite0).context().cache().context().cacheContext(CU.cacheId(DEFAULT_CACHE_NAME)).topology();
 
         assertTrue(top0.rebalanceFinished(new AffinityTopologyVersion(1)));
         assertFalse(top0.rebalanceFinished(new AffinityTopologyVersion(2)));
 
         Ignite ignite1 = startGrid(1);
-        GridDhtPartitionTopology top1 = ((IgniteKernal)ignite1).context().cache().context().cacheContext(1).topology();
+        GridDhtPartitionTopology top1 = ((IgniteKernal)ignite1).context().cache().context().cacheContext(CU.cacheId(DEFAULT_CACHE_NAME)).topology();
 
         waitRebalanceFinished(ignite0, 2, minorVer);
         waitRebalanceFinished(ignite1, 2, minorVer);
@@ -274,7 +275,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
         assertFalse(top1.rebalanceFinished(new AffinityTopologyVersion(3)));
 
         Ignite ignite2 = startGrid(2);
-        GridDhtPartitionTopology top2 = ((IgniteKernal)ignite2).context().cache().context().cacheContext(1).topology();
+        GridDhtPartitionTopology top2 = ((IgniteKernal)ignite2).context().cache().context().cacheContext(CU.cacheId(DEFAULT_CACHE_NAME)).topology();
 
         waitRebalanceFinished(ignite0, 3, minorVer);
         waitRebalanceFinished(ignite1, 3, minorVer);
@@ -287,7 +288,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
         client = true;
 
         Ignite ignite3 = startGrid(3);
-        GridDhtPartitionTopology top3 = ((IgniteKernal)ignite3).context().cache().context().cacheContext(1).topology();
+        GridDhtPartitionTopology top3 = ((IgniteKernal)ignite3).context().cache().context().cacheContext(CU.cacheId(DEFAULT_CACHE_NAME)).topology();
 
         assertTrue(top0.rebalanceFinished(new AffinityTopologyVersion(4)));
         assertTrue(top1.rebalanceFinished(new AffinityTopologyVersion(4)));
@@ -406,7 +407,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
         final AffinityTopologyVersion topVer0 = new AffinityTopologyVersion(topVer, minorVer);
 
         final GridDhtPartitionTopology top =
-            ((IgniteKernal)ignite).context().cache().context().cacheContext(1).topology();
+            ((IgniteKernal)ignite).context().cache().context().cacheContext(CU.cacheId(DEFAULT_CACHE_NAME)).topology();
 
         GridTestUtils.waitForCondition(new GridAbsPredicate() {
             @Override public boolean apply() {
@@ -454,19 +455,19 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
         int killedNode = rnd.nextInt(SRV_NODES);
 
         for (int i = 0; i < 10; i++) {
-            List<Integer> keys = testKeys(grid(0).cache(null), 10);
+            List<Integer> keys = testKeys(grid(0).cache(DEFAULT_CACHE_NAME), 10);
 
             for (Integer key : keys) {
                 IgniteCache<Object, Object> cache = null;
 
                 if (rnd.nextBoolean())
-                    cache = qryClient.cache(null);
+                    cache = qryClient.cache(DEFAULT_CACHE_NAME);
                 else {
                     for (int j = 0; j < 1000; j++) {
                         int nodeIdx = rnd.nextInt(SRV_NODES);
 
                         if (killedNode != nodeIdx) {
-                            cache = grid(nodeIdx).cache(null);
+                            cache = grid(nodeIdx).cache(DEFAULT_CACHE_NAME);
 
                             break;
                         }
@@ -478,7 +479,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
                 cache.put(key, key);
 
-                int part = qryClient.affinity(null).partition(key);
+                int part = qryClient.affinity(DEFAULT_CACHE_NAME).partition(key);
 
                 Long cntr = updateCntrs.get(part);
 
@@ -517,9 +518,9 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
             if (i == killedNodeIdx)
                 continue;
 
-            Affinity<Object> aff = grid(i).affinity(null);
+            Affinity<Object> aff = grid(i).affinity(DEFAULT_CACHE_NAME);
 
-            Map<Integer, T2<Long, Long>> act = grid(i).cachex(null).context().topology().updateCounters(false);
+            Map<Integer, T2<Long, Long>> act = grid(i).cachex(DEFAULT_CACHE_NAME).context().topology().updateCounters(false);
 
             for (Map.Entry<Integer, Long> e : updCntrs.entrySet()) {
                 if (aff.mapPartitionToPrimaryAndBackups(e.getKey()).contains(grid(i).localNode()))
@@ -546,7 +547,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         client = false;
 
-        IgniteCache<Object, Object> clnCache = qryClient.cache(null);
+        IgniteCache<Object, Object> clnCache = qryClient.cache(DEFAULT_CACHE_NAME);
 
         IgniteOutClosure<IgniteCache<Integer, Integer>> rndCache =
             new IgniteOutClosure<IgniteCache<Integer, Integer>>() {
@@ -555,13 +556,13 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
                 @Override public IgniteCache<Integer, Integer> apply() {
                     ++cnt;
 
-                    return grid(cnt % SRV_NODES + 1).cache(null);
+                    return grid(cnt % SRV_NODES + 1).cache(DEFAULT_CACHE_NAME);
                 }
             };
 
         Ignite igniteSrv = ignite(0);
 
-        IgniteCache<Object, Object> srvCache = igniteSrv.cache(null);
+        IgniteCache<Object, Object> srvCache = igniteSrv.cache(DEFAULT_CACHE_NAME);
 
         List<Integer> keys = testKeys(srvCache, 3);
 
@@ -661,13 +662,13 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         qry.setRemoteFilter(lsnr);
 
-        IgniteCache<Object, Object> clnCache = qryClient.cache(null);
+        IgniteCache<Object, Object> clnCache = qryClient.cache(DEFAULT_CACHE_NAME);
 
         QueryCursor<Cache.Entry<Object, Object>> qryCur = clnCache.query(qry);
 
         Ignite igniteSrv = ignite(0);
 
-        IgniteCache<Object, Object> srvCache = igniteSrv.cache(null);
+        IgniteCache<Object, Object> srvCache = igniteSrv.cache(DEFAULT_CACHE_NAME);
 
         Affinity<Object> aff = affinity(srvCache);
 
@@ -807,12 +808,12 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         client = false;
 
-        IgniteCache<Object, Object> qryClientCache = qryClient.cache(null);
+        IgniteCache<Object, Object> qryClientCache = qryClient.cache(DEFAULT_CACHE_NAME);
 
         if (cacheMode() != REPLICATED)
             assertEquals(backups, qryClientCache.getConfiguration(CacheConfiguration.class).getBackups());
 
-        Affinity<Object> aff = qryClient.affinity(null);
+        Affinity<Object> aff = qryClient.affinity(DEFAULT_CACHE_NAME);
 
         ContinuousQuery<Object, Object> qry = new ContinuousQuery<>();
 
@@ -837,7 +838,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
             Ignite ignite = ignite(i);
 
-            IgniteCache<Object, Object> cache = ignite.cache(null);
+            IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             List<Integer> keys = testKeys(cache, PARTS);
 
@@ -932,9 +933,9 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         client = false;
 
-        IgniteCache<Object, Object> qryClientCache = qryClient.cache(null);
+        IgniteCache<Object, Object> qryClientCache = qryClient.cache(DEFAULT_CACHE_NAME);
 
-        Affinity<Object> aff = qryClient.affinity(null);
+        Affinity<Object> aff = qryClient.affinity(DEFAULT_CACHE_NAME);
 
         CacheEventListener1 lsnr = asyncCallback() ? new CacheEventAsyncListener1(false)
             : new CacheEventListener1(false);
@@ -958,7 +959,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
             Ignite ignite = ignite(i);
 
-            IgniteCache<Object, Object> cache = ignite.cache(null);
+            IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             List<Integer> keys = testKeys(cache, PARTS);
 
@@ -1044,7 +1045,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
             Ignite ignite = startGrid(i);
 
-            IgniteCache<Object, Object> cache = ignite.cache(null);
+            IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             List<Integer> keys = testKeys(cache, PARTS);
 
@@ -1344,13 +1345,13 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         qry.setLocalListener(lsnr);
 
-        QueryCursor<?> cur = qryClient.cache(null).query(qry);
+        QueryCursor<?> cur = qryClient.cache(DEFAULT_CACHE_NAME).query(qry);
 
         final Collection<Object> backupQueue = backupQueue(ignite(1));
 
         assertEquals(0, backupQueue.size());
 
-        IgniteCache<Object, Object> cache0 = ignite(0).cache(null);
+        IgniteCache<Object, Object> cache0 = ignite(0).cache(DEFAULT_CACHE_NAME);
 
         List<Integer> keys = primaryKeys(cache0, BACKUP_ACK_THRESHOLD);
 
@@ -1418,7 +1419,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         qry.setLocalListener(lsnr);
 
-        QueryCursor<?> cur = qryClient.cache(null).query(qry);
+        QueryCursor<?> cur = qryClient.cache(DEFAULT_CACHE_NAME).query(qry);
 
         final Collection<Object> backupQueue = backupQueue(ignite(0));
 
@@ -1428,9 +1429,9 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl));
 
-        final IgniteCache<Object, Object> cache0 = ignite(2).cache(null).withExpiryPolicy(expiry);
+        final IgniteCache<Object, Object> cache0 = ignite(2).cache(DEFAULT_CACHE_NAME).withExpiryPolicy(expiry);
 
-        final List<Integer> keys = primaryKeys(ignite(1).cache(null), BACKUP_ACK_THRESHOLD);
+        final List<Integer> keys = primaryKeys(ignite(1).cache(DEFAULT_CACHE_NAME), BACKUP_ACK_THRESHOLD);
 
         CountDownLatch latch = new CountDownLatch(keys.size());
 
@@ -1489,7 +1490,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         qry.setLocalListener(lsnr);
 
-        IgniteCache<Object, Object> cache = qryClient.cache(null);
+        IgniteCache<Object, Object> cache = qryClient.cache(DEFAULT_CACHE_NAME);
 
         QueryCursor<?> cur = cache.query(qry);
 
@@ -1537,7 +1538,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
         for (Object info : infos.values()) {
             GridContinuousHandler hnd = GridTestUtils.getFieldValue(info, "hnd");
 
-            if (hnd.isQuery() && hnd.cacheName() == null) {
+            if (hnd.isQuery() && DEFAULT_CACHE_NAME.equals(hnd.cacheName())) {
                 backupQueue = GridTestUtils.getFieldValue(hnd, CacheContinuousQueryHandler.class, "backupQueue");
 
                 break;
@@ -1572,9 +1573,9 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         client = false;
 
-        IgniteCache<Object, Object> qryClnCache = qryClient.cache(null);
+        IgniteCache<Object, Object> qryClnCache = qryClient.cache(DEFAULT_CACHE_NAME);
 
-        Affinity<Object> aff = qryClient.affinity(null);
+        Affinity<Object> aff = qryClient.affinity(DEFAULT_CACHE_NAME);
 
         final CacheEventListener2 lsnr = new CacheEventListener2();
 
@@ -1632,7 +1633,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         client = false;
 
-        IgniteCache<Object, Object> qryClnCache = qryClient.cache(null);
+        IgniteCache<Object, Object> qryClnCache = qryClient.cache(DEFAULT_CACHE_NAME);
 
         final CacheEventListener2 lsnr = new CacheEventListener2();
 
@@ -1704,7 +1705,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
             // Start new filter each 5 sec.
             long startFilterTime = System.currentTimeMillis() + 5_000;
 
-            final int PARTS = qryClient.affinity(null).partitions();
+            final int PARTS = qryClient.affinity(DEFAULT_CACHE_NAME).partitions();
 
             ThreadLocalRandom rnd = ThreadLocalRandom.current();
 
@@ -1842,7 +1843,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         List<T3<Object, Object, Object>> afterRestEvts = new ArrayList<>();
 
-        for (int i = 0; i < qryClient.affinity(null).partitions(); i++) {
+        for (int i = 0; i < qryClient.affinity(DEFAULT_CACHE_NAME).partitions(); i++) {
             Integer oldVal = (Integer)qryClnCache.get(i);
 
             qryClnCache.put(i, i);
@@ -1879,7 +1880,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         client = false;
 
-        final IgniteCache<Object, Object> qryClnCache = qryCln.cache(null);
+        final IgniteCache<Object, Object> qryClnCache = qryCln.cache(DEFAULT_CACHE_NAME);
 
         final CacheEventListener2 lsnr = asyncCallback() ? new CacheEventAsyncListener2() : new CacheEventListener2();
 
@@ -2071,7 +2072,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         Ignite qryClient = startGrid(SRV_NODES);
 
-        final IgniteCache<Object, Object> cache = qryClient.cache(null);
+        final IgniteCache<Object, Object> cache = qryClient.cache(DEFAULT_CACHE_NAME);
 
         CacheEventListener1 lsnr = new CacheEventListener1(true);
 
@@ -2085,7 +2086,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         final int SRV_IDX = SRV_NODES - 1;
 
-        List<Integer> keys = primaryKeys(ignite(SRV_IDX).cache(null), 10);
+        List<Integer> keys = primaryKeys(ignite(SRV_IDX).cache(DEFAULT_CACHE_NAME), 10);
 
         final int THREADS = 10;
 
@@ -2256,7 +2257,7 @@ public abstract class CacheContinuousQueryFailoverAbstractSelfTest extends GridC
 
         qry.setLocalListener(lsnr);
 
-        IgniteCache<Integer, Integer> cache = qryClient.cache(null);
+        IgniteCache<Integer, Integer> cache = qryClient.cache(DEFAULT_CACHE_NAME);
 
         QueryCursor<?> cur = cache.query(qry);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationFromCallbackTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationFromCallbackTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationFromCallbackTest.java
index beb8882..a880353 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationFromCallbackTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationFromCallbackTest.java
@@ -519,7 +519,7 @@ public class CacheContinuousQueryOperationFromCallbackTest extends GridCommonAbs
         int backups,
         CacheAtomicityMode atomicityMode,
         CacheWriteSynchronizationMode writeMode) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setName("test-cache-" + atomicityMode + "-" + cacheMode + "-" + writeMode + "-" + backups);
         ccfg.setAtomicityMode(atomicityMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationP2PTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationP2PTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationP2PTest.java
index 0d88ef1..f099951 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationP2PTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOperationP2PTest.java
@@ -274,7 +274,7 @@ public class CacheContinuousQueryOperationP2PTest extends GridCommonAbstractTest
         CacheMode cacheMode,
         int backups,
         CacheAtomicityMode atomicityMode) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOrderingEventTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOrderingEventTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOrderingEventTest.java
index dba995e..70d834e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOrderingEventTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryOrderingEventTest.java
@@ -515,7 +515,7 @@ public class CacheContinuousQueryOrderingEventTest extends GridCommonAbstractTes
         int backups,
         CacheAtomicityMode atomicityMode,
         CacheWriteSynchronizationMode writeMode) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setName("test-cache-" + atomicityMode + "-" + cacheMode + "-" + backups + "-" + UUID.randomUUID());
         // TODO GG-11220 (remove setName when fixed).

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryRandomOperationsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryRandomOperationsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryRandomOperationsTest.java
index 66454fa..142ff35 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryRandomOperationsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryRandomOperationsTest.java
@@ -1397,7 +1397,7 @@ public class CacheContinuousQueryRandomOperationsTest extends GridCommonAbstract
         int backups,
         CacheAtomicityMode atomicityMode,
         boolean store) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setName("cache-" + UUID.randomUUID()); // TODO GG-11220 (remove setName when fixed).
         ccfg.setAtomicityMode(atomicityMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java
index 95cd3fd..b095b2d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheKeepBinaryIterationTest.java
@@ -278,7 +278,7 @@ public class CacheKeepBinaryIterationTest extends GridCommonAbstractTest {
         CacheMode cacheMode,
         int backups,
         CacheAtomicityMode atomicityMode) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(cacheMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ClientReconnectContinuousQueryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ClientReconnectContinuousQueryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ClientReconnectContinuousQueryTest.java
index 12821f3..c8b3bb6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ClientReconnectContinuousQueryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ClientReconnectContinuousQueryTest.java
@@ -96,7 +96,7 @@ public class ClientReconnectContinuousQueryTest extends GridCommonAbstractTest {
 
             client.events().localListen(new ReconnectListener(), EventType.EVT_CLIENT_NODE_RECONNECTED);
 
-            IgniteCache cache = client.cache(null);
+            IgniteCache cache = client.cache(DEFAULT_CACHE_NAME);
 
             ContinuousQuery qry = new ContinuousQuery();
 
@@ -179,7 +179,7 @@ public class ClientReconnectContinuousQueryTest extends GridCommonAbstractTest {
     private void putSomeKeys(int cnt) {
         IgniteEx ignite = grid(0);
 
-        IgniteCache<Object, Object> srvCache = ignite.cache(null);
+        IgniteCache<Object, Object> srvCache = ignite.cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < cnt; i++)
             srvCache.put(0, i);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ContinuousQueryRemoteFilterMissingInClassPathSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ContinuousQueryRemoteFilterMissingInClassPathSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ContinuousQueryRemoteFilterMissingInClassPathSelfTest.java
index 2c226b3..92c1760 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ContinuousQueryRemoteFilterMissingInClassPathSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/ContinuousQueryRemoteFilterMissingInClassPathSelfTest.java
@@ -78,7 +78,7 @@ public class ContinuousQueryRemoteFilterMissingInClassPathSelfTest extends GridC
 
         cfg.setClientMode(clientMode);
 
-        CacheConfiguration cacheCfg = new CacheConfiguration();
+        CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cacheCfg.setName("simple");
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java
index abd7036..a1467bf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java
@@ -179,7 +179,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
         for (int i = 0; i < gridCount(); i++) {
             for (int j = 0; j < 5; j++) {
                 try {
-                    IgniteCache<Object, Object> cache = grid(i).cache(null);
+                    IgniteCache<Object, Object> cache = grid(i).cache(DEFAULT_CACHE_NAME);
 
                     for (Cache.Entry<Object, Object> entry : cache.localEntries(new CachePeekMode[] {CachePeekMode.ALL}))
                         cache.remove(entry.getKey());
@@ -198,6 +198,20 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
             }
         }
 
+        // Wait for all routines are unregistered
+        GridTestUtils.waitForCondition(new PA() {
+            @Override public boolean apply() {
+                for (int i = 0; i < gridCount(); i++) {
+                    GridContinuousProcessor proc = grid(i).context().continuous();
+
+                    if(((Map)U.field(proc, "rmtInfos")).size() > 0)
+                        return false;
+                }
+
+                return true;
+            }
+        }, 3000);
+
         for (int i = 0; i < gridCount(); i++) {
             GridContinuousProcessor proc = grid(i).context().continuous();
 
@@ -207,7 +221,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
             assertEquals(String.valueOf(i), 0, ((Map)U.field(proc, "stopFuts")).size());
             assertEquals(String.valueOf(i), 0, ((Map)U.field(proc, "bufCheckThreads")).size());
 
-            CacheContinuousQueryManager mgr = grid(i).context().cache().internalCache().context().continuousQueries();
+            CacheContinuousQueryManager mgr = grid(i).context().cache().internalCache(DEFAULT_CACHE_NAME).context().continuousQueries();
 
             assertEquals(0, ((Map)U.field(mgr, "lsnrs")).size());
         }
@@ -277,7 +291,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
      * @throws Exception If failed.
      */
     public void testAllEntries() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>();
 
@@ -343,7 +357,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
      * @throws Exception If failed.
      */
     public void testFilterException() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>();
 
@@ -372,8 +386,8 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
         if (cacheMode() == LOCAL)
             return;
 
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
-        IgniteCache<Integer, Integer> cache1 = grid(1).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
+        IgniteCache<Integer, Integer> cache1 = grid(1).cache(DEFAULT_CACHE_NAME);
 
         final AtomicInteger cntr = new AtomicInteger(0);
         final AtomicInteger cntr1 = new AtomicInteger(0);
@@ -398,7 +412,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
         try (QueryCursor<Cache.Entry<Integer, Integer>> qryCur2 = cache1.query(qry2);
              QueryCursor<Cache.Entry<Integer, Integer>> qryCur1 = cache.query(qry1)) {
             for (int i = 0; i < gridCount(); i++) {
-                IgniteCache<Object, Object> cache0 = grid(i).cache(null);
+                IgniteCache<Object, Object> cache0 = grid(i).cache(DEFAULT_CACHE_NAME);
 
                 cache0.put(1, 1);
                 cache0.put(2, 2);
@@ -427,9 +441,9 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
         if (cacheMode() == LOCAL)
             return;
 
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
-        final int parts = grid(0).affinity(null).partitions();
+        final int parts = grid(0).affinity(DEFAULT_CACHE_NAME).partitions();
 
         final int keyCnt = parts * 2;
 
@@ -477,7 +491,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
      * @throws Exception If failed.
      */
     public void testEntriesByFilter() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>();
 
@@ -546,9 +560,9 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
      * @throws Exception If failed.
      */
     public void testLocalNodeOnly() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
-        if (grid(0).cache(null).getConfiguration(CacheConfiguration.class).getCacheMode() != PARTITIONED)
+        if (grid(0).cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getCacheMode() != PARTITIONED)
             return;
 
         ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>();
@@ -583,7 +597,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
             int key = 0;
 
             while (true) {
-                ClusterNode n = grid(0).affinity(null).mapKeyToNode(key);
+                ClusterNode n = grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key);
 
                 assert n != null;
 
@@ -617,10 +631,10 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
      * @throws Exception If failed.
      */
     public void testBuffering() throws Exception {
-        if (grid(0).cache(null).getConfiguration(CacheConfiguration.class).getCacheMode() != PARTITIONED)
+        if (grid(0).cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getCacheMode() != PARTITIONED)
             return;
 
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>();
 
@@ -657,7 +671,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
             int key = 0;
 
             while (true) {
-                ClusterNode n = grid(0).affinity(null).mapKeyToNode(key);
+                ClusterNode n = grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key);
 
                 assert n != null;
 
@@ -702,7 +716,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
      * @throws Exception If failed.
      */
     public void testTimeInterval() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         if (cache.getConfiguration(CacheConfiguration.class).getCacheMode() != PARTITIONED)
             return;
@@ -743,7 +757,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
             int key = 0;
 
             while (true) {
-                ClusterNode n = grid(0).affinity(null).mapKeyToNode(key);
+                ClusterNode n = grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key);
 
                 assert n != null;
 
@@ -782,7 +796,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
      * @throws Exception If failed.
      */
     public void testInitialQuery() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>();
 
@@ -827,7 +841,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
      * @throws Exception If failed.
      */
     public void testInitialQueryAndUpdates() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>();
 
@@ -889,7 +903,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
      * @throws Exception If failed.
      */
     public void testLoadCache() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>();
 
@@ -925,7 +939,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
         if (atomicityMode() == ATOMIC)
             return;
 
-        IgniteCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         ContinuousQuery<Object, Object> qry = new ContinuousQuery<>();
 
@@ -962,7 +976,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
      */
     @SuppressWarnings("TryFinallyCanBeTryWithResources")
     public void testNodeJoinWithoutCache() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>();
 
@@ -1005,7 +1019,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
                 CacheQueryReadEvent qe = (CacheQueryReadEvent)evt;
 
                 assertEquals(CONTINUOUS.name(), qe.queryType());
-                assertNull(qe.cacheName());
+                assertEquals(DEFAULT_CACHE_NAME, qe.cacheName());
 
                 assertEquals(grid(0).localNode().id(), qe.subjectId());
 
@@ -1029,7 +1043,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
                 CacheQueryExecutedEvent qe = (CacheQueryExecutedEvent)evt;
 
                 assertEquals(CONTINUOUS.name(), qe.queryType());
-                assertNull(qe.cacheName());
+                assertEquals(DEFAULT_CACHE_NAME, qe.cacheName());
 
                 assertEquals(grid(0).localNode().id(), qe.subjectId());
 
@@ -1051,7 +1065,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
                 grid(i).events().localListen(execLsnr, EVT_CACHE_QUERY_EXECUTED);
             }
 
-            IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+            IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>();
 
@@ -1089,7 +1103,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
      * @throws Exception If failed.
      */
     public void testExpired() throws Exception {
-        IgniteCache<Object, Object> cache = grid(0).cache(null).
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME).
             withExpiryPolicy(new CreatedExpiryPolicy(new Duration(MILLISECONDS, 1000)));
 
         final Map<Object, Object> map = new ConcurrentHashMap8<>();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryNodesFilteringTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryNodesFilteringTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryNodesFilteringTest.java
index 5a066fa..e444a72 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryNodesFilteringTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryNodesFilteringTest.java
@@ -88,7 +88,7 @@ public class GridCacheContinuousQueryNodesFilteringTest extends GridCommonAbstra
     private Ignite startNodeWithCache() throws Exception {
         Ignite node1 = startGrid("node1", getConfiguration("node1", true, null));
 
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         ccfg.setName("attrsTestCache");
         ccfg.setNodeFilter(new IgnitePredicate<ClusterNode>() {
             /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedSelfTest.java
index 73acbe5..863bc80 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryReplicatedSelfTest.java
@@ -49,8 +49,8 @@ public class GridCacheContinuousQueryReplicatedSelfTest extends GridCacheContinu
      * @throws Exception If failed.
      */
     public void testRemoteNodeCallback() throws Exception {
-        IgniteCache<Integer, Integer> cache1 = grid(0).cache(null);
-        IgniteCache<Integer, Integer> cache2 = grid(1).cache(null);
+        IgniteCache<Integer, Integer> cache1 = grid(0).cache(DEFAULT_CACHE_NAME);
+        IgniteCache<Integer, Integer> cache2 = grid(1).cache(DEFAULT_CACHE_NAME);
 
         ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>();
 
@@ -89,8 +89,8 @@ public class GridCacheContinuousQueryReplicatedSelfTest extends GridCacheContinu
      */
     public void testCrossCallback() throws Exception {
         // Prepare.
-        IgniteCache<Integer, Integer> cache1 = grid(0).cache(null);
-        IgniteCache<Integer, Integer> cache2 = grid(1).cache(null);
+        IgniteCache<Integer, Integer> cache1 = grid(0).cache(DEFAULT_CACHE_NAME);
+        IgniteCache<Integer, Integer> cache2 = grid(1).cache(DEFAULT_CACHE_NAME);
 
         final int key1 = primaryKey(cache1);
         final int key2 = primaryKey(cache2);


[51/51] [abbrv] ignite git commit: Merge remote-tracking branch 'remotes/origin/ignite-2.0' into ignite-5075-cacheStart

Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-2.0' into ignite-5075-cacheStart

# Conflicts:
#	modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java


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

Branch: refs/heads/ignite-5075-cacheStart
Commit: 07aa9bbe2fe598b97988c28ea533f0bb3c2d09a9
Parents: c73e1c9 4d26061
Author: sboikov <sb...@gridgain.com>
Authored: Wed Apr 26 20:37:38 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Apr 26 20:37:38 2017 +0300

----------------------------------------------------------------------
 assembly/dependencies-fabric.xml                |    5 +-
 examples/config/example-cache.xml               |    1 +
 examples/pom-standalone-lgpl.xml                |    2 +-
 examples/pom-standalone.xml                     |    2 +-
 examples/pom.xml                                |   38 +-
 .../hibernate/HibernateL2CacheExample.java      |   12 +-
 .../apache/ignite/gridify/AbstractAopTest.java  |    4 +-
 .../gridify/ExternalNonSpringAopSelfTest.java   |    6 +-
 .../jmh/cache/JmhCacheAbstractBenchmark.java    |    7 +-
 .../stream/camel/IgniteCamelStreamerTest.java   |   10 +-
 .../ClientAbstractMultiThreadedSelfTest.java    |   37 +-
 .../client/ClientDefaultCacheSelfTest.java      |    2 +-
 .../ClientAbstractMultiNodeSelfTest.java        |   25 +-
 .../integration/ClientAbstractSelfTest.java     |    9 +-
 .../jdbc2/JdbcAbstractDmlStatementSelfTest.java |   16 +-
 .../jdbc2/JdbcComplexQuerySelfTest.java         |    5 +-
 .../internal/jdbc2/JdbcConnectionSelfTest.java  |    5 +-
 .../jdbc2/JdbcDistributedJoinsQueryTest.java    |    6 +-
 .../jdbc2/JdbcDynamicIndexAbstractSelfTest.java |   14 +-
 .../jdbc2/JdbcInsertStatementSelfTest.java      |    4 +-
 .../jdbc2/JdbcMergeStatementSelfTest.java       |    4 +-
 .../internal/jdbc2/JdbcMetadataSelfTest.java    |   31 +-
 .../internal/jdbc2/JdbcNoDefaultCacheTest.java  |   45 +-
 .../jdbc2/JdbcPreparedStatementSelfTest.java    |    4 +-
 .../internal/jdbc2/JdbcResultSetSelfTest.java   |    4 +-
 .../internal/jdbc2/JdbcStatementSelfTest.java   |    4 +-
 .../internal/jdbc2/JdbcStreamingSelfTest.java   |   14 +-
 .../rest/AbstractRestProcessorSelfTest.java     |    2 +-
 .../JettyRestProcessorAbstractSelfTest.java     |  184 +-
 .../rest/JettyRestProcessorSignedSelfTest.java  |    4 +-
 .../rest/RestBinaryProtocolSelfTest.java        |  101 +-
 .../rest/RestMemcacheProtocolSelfTest.java      |   47 +-
 .../processors/rest/RestProcessorTest.java      |    2 +-
 .../rest/TaskCommandHandlerSelfTest.java        |    7 +-
 .../processors/rest/TestBinaryClient.java       |   23 +-
 .../tcp/redis/RedisProtocolSelfTest.java        |    8 +-
 .../jdbc/AbstractJdbcPojoQuerySelfTest.java     |    2 +-
 .../ignite/jdbc/JdbcConnectionSelfTest.java     |    5 +-
 .../ignite/jdbc/JdbcMetadataSelfTest.java       |    8 +-
 .../ignite/jdbc/JdbcNoDefaultCacheTest.java     |    3 +-
 .../ignite/jdbc/JdbcPojoQuerySelfTest.java      |    2 +-
 .../jdbc/JdbcPreparedStatementSelfTest.java     |    2 +-
 .../ignite/jdbc/JdbcResultSetSelfTest.java      |    2 +-
 .../ignite/jdbc/JdbcStatementSelfTest.java      |    2 +-
 .../clients/src/test/resources/spring-cache.xml |    1 -
 .../src/main/java/org/apache/ignite/Ignite.java |   10 +-
 .../java/org/apache/ignite/IgniteCompute.java   |    8 +-
 .../org/apache/ignite/cache/QueryEntity.java    |   81 +
 .../apache/ignite/cluster/ClusterMetrics.java   |    4 +-
 .../org/apache/ignite/cluster/ClusterNode.java  |   11 +-
 .../configuration/CacheConfiguration.java       |   18 +-
 .../configuration/IgniteConfiguration.java      |   52 +-
 .../org/apache/ignite/events/EventType.java     |    2 +-
 .../ignite/internal/IgniteComputeImpl.java      |   37 +-
 .../org/apache/ignite/internal/IgniteEx.java    |   12 +-
 .../apache/ignite/internal/IgniteKernal.java    |   76 +-
 .../internal/cluster/ClusterGroupAdapter.java   |   23 +-
 .../ignite/internal/cluster/ClusterGroupEx.java |    5 +-
 .../affinity/GridAffinityProcessor.java         |   67 +-
 .../cache/DynamicCacheDescriptor.java           |   24 +
 .../processors/cache/GridCacheProcessor.java    |  170 +-
 .../cache/GridCacheSharedContext.java           |   18 +-
 .../processors/cache/GridCacheUtils.java        |   30 +-
 .../cache/query/GridCacheQueryManager.java      |   14 +-
 .../cache/transactions/IgniteTxManager.java     |   20 +-
 .../cache/transactions/TxDeadlock.java          |   19 +-
 .../cache/transactions/TxLocksResponse.java     |   37 +-
 .../datastructures/GridCacheLockImpl.java       |    6 +
 .../processors/job/GridJobProcessor.java        |   18 +-
 .../utils/PlatformConfigurationUtils.java       |   37 +-
 .../processors/query/GridQueryIndexing.java     |   23 +-
 .../query/GridQueryTypeDescriptor.java          |   12 +
 .../query/QueryTypeDescriptorImpl.java          |   34 +-
 .../internal/processors/query/QueryUtils.java   |  134 +-
 .../handlers/cache/GridCacheCommandHandler.java |    4 +-
 .../redis/GridRedisRestCommandHandler.java      |    3 +
 .../redis/key/GridRedisDelCommandHandler.java   |    1 +
 .../key/GridRedisExistsCommandHandler.java      |    1 +
 .../server/GridRedisDbSizeCommandHandler.java   |    1 +
 .../string/GridRedisAppendCommandHandler.java   |    3 +
 .../string/GridRedisGetCommandHandler.java      |    1 +
 .../string/GridRedisGetRangeCommandHandler.java |    1 +
 .../string/GridRedisGetSetCommandHandler.java   |    1 +
 .../string/GridRedisIncrDecrCommandHandler.java |    2 +
 .../string/GridRedisMGetCommandHandler.java     |    1 +
 .../string/GridRedisMSetCommandHandler.java     |    1 +
 .../string/GridRedisSetCommandHandler.java      |    1 +
 .../string/GridRedisSetRangeCommandHandler.java |    2 +
 .../string/GridRedisStrlenCommandHandler.java   |    1 +
 .../tcp/GridTcpMemcachedNioListener.java        |    5 +-
 .../visor/node/VisorBasicConfiguration.java     |   13 +
 .../org/apache/ignite/spi/IgniteSpiAdapter.java |   32 +
 .../spi/IgniteSpiOperationTimeoutHelper.java    |    8 +-
 .../jobstealing/JobStealingCollisionSpi.java    |    2 +-
 .../communication/tcp/TcpCommunicationSpi.java  |    6 +-
 .../ignite/spi/discovery/tcp/ClientImpl.java    |   31 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  142 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |  143 +-
 .../spi/discovery/tcp/TcpDiscoverySpiMBean.java |   26 +-
 .../tcp/internal/TcpDiscoveryNode.java          |   33 +-
 .../TcpDiscoveryClientHeartbeatMessage.java     |   72 -
 .../TcpDiscoveryClientMetricsUpdateMessage.java |   72 +
 .../messages/TcpDiscoveryHeartbeatMessage.java  |  338 ---
 .../TcpDiscoveryMetricsUpdateMessage.java       |  338 +++
 .../spi/indexing/IndexingQueryFilter.java       |    2 +-
 .../adaptive/AdaptiveLoadBalancingSpi.java      |   12 +-
 .../resources/META-INF/classnames.properties    |    8 +-
 .../core/src/test/config/discovery-stress.xml   |    2 +-
 .../core/src/test/config/load/dsi-load-base.xml |    3 +-
 .../src/test/config/load/merge-sort-base.xml    |    7 +-
 .../core/src/test/config/spring-cache-load.xml  |    1 +
 .../core/src/test/config/spring-cache-swap.xml  |    2 +
 .../src/test/config/spring-cache-teststore.xml  |    2 +
 .../test/config/store/jdbc/ignite-jdbc-type.xml |    6 +
 .../config/streamer/spring-streamer-base.xml    |    5 +-
 .../GridCacheAffinityBackupsSelfTest.java       |    2 +-
 .../java/org/apache/ignite/GridTestJob.java     |   19 +
 .../apache/ignite/GridTestStoreNodeStartup.java |    2 +-
 .../java/org/apache/ignite/GridTestTask.java    |   18 +-
 .../ignite/IgniteCacheAffinitySelfTest.java     |    2 +-
 .../cache/IgniteWarmupClosureSelfTest.java      |    2 +-
 .../ignite/cache/LargeEntryUpdateTest.java      |    2 +-
 .../affinity/AffinityClientNodeSelfTest.java    |   14 +-
 ...ityFunctionBackupFilterAbstractSelfTest.java |    8 +-
 ...unctionExcludeNeighborsAbstractSelfTest.java |    4 +-
 .../affinity/AffinityHistoryCleanupTest.java    |    2 +-
 .../local/LocalAffinityFunctionTest.java        |    2 +-
 ...cheStoreSessionListenerAbstractSelfTest.java |    6 +-
 .../store/GridCacheBalancingStoreSelfTest.java  |    8 +-
 .../IgniteCacheExpiryStoreLoadSelfTest.java     |    2 +-
 .../store/StoreResourceInjectionSelfTest.java   |    2 +-
 ...CacheJdbcBlobStoreMultithreadedSelfTest.java |    8 +-
 .../internal/ClusterNodeMetricsSelfTest.java    |   10 +-
 .../ignite/internal/GridAffinityMappedTest.java |   11 +-
 .../internal/GridAffinityP2PSelfTest.java       |    9 +-
 .../ignite/internal/GridAffinitySelfTest.java   |    9 +-
 .../GridCancelledJobsMetricsSelfTest.java       |    4 +-
 .../ignite/internal/GridDiscoverySelfTest.java  |    2 +-
 ...ridFailFastNodeFailureDetectionSelfTest.java |    4 +-
 .../GridJobCollisionCancelSelfTest.java         |    2 +-
 .../GridJobMasterLeaveAwareSelfTest.java        |    8 +-
 .../GridProjectionForCachesSelfTest.java        |   13 +-
 ...ectionLocalJobMultipleArgumentsSelfTest.java |    4 +-
 .../ignite/internal/GridStartStopSelfTest.java  |    8 +-
 .../GridTaskFailoverAffinityRunTest.java        |    4 +-
 .../IgniteClientReconnectApiExceptionTest.java  |   18 +-
 .../IgniteClientReconnectCacheTest.java         |   70 +-
 ...eClientReconnectContinuousProcessorTest.java |   10 +-
 .../IgniteClientReconnectFailoverTest.java      |    4 +-
 .../internal/IgniteClientReconnectStopTest.java |    2 +-
 .../IgniteComputeEmptyClusterGroupTest.java     |    8 +-
 ...eConcurrentEntryProcessorAccessStopTest.java |    2 +-
 .../internal/binary/BinaryEnumsSelfTest.java    |    2 +-
 .../BinaryObjectBuilderAdditionalSelfTest.java  |    2 +-
 .../internal/binary/BinaryTreeSelfTest.java     |    4 +-
 .../binary/GridBinaryAffinityKeySelfTest.java   |   30 +-
 ...aultBinaryMappersBinaryMetaDataSelfTest.java |    4 +-
 .../IgniteVariousConnectionNumberTest.java      |    4 +-
 .../GridDeploymentMessageCountSelfTest.java     |    6 +-
 .../GridDiscoveryManagerAliveCacheSelfTest.java |    6 +-
 .../OptimizedMarshallerNodeFailoverTest.java    |    6 +-
 .../GridCacheTxLoadFromStoreOnLockSelfTest.java |    2 +-
 .../GridAffinityProcessorAbstractSelfTest.java  |    2 +-
 .../CacheAtomicSingleMessageCountSelfTest.java  |    4 +-
 .../cache/CacheClientStoreSelfTest.java         |    2 +-
 .../cache/CacheConcurrentReadThroughTest.java   |    2 +-
 .../cache/CacheConfigurationLeakTest.java       |    2 +-
 .../cache/CacheDeferredDeleteQueueTest.java     |    4 +-
 .../CacheDeferredDeleteSanitySelfTest.java      |    4 +-
 ...cheDhtLocalPartitionAfterRemoveSelfTest.java |    6 +-
 .../cache/CacheEnumOperationsAbstractTest.java  |    2 +-
 ...CacheExchangeMessageDuplicatedStateTest.java |   10 +-
 .../cache/CacheFutureExceptionSelfTest.java     |    2 +-
 .../cache/CacheGetEntryAbstractTest.java        |   16 +-
 .../processors/cache/CacheGetFromJobTest.java   |    2 +-
 ...erceptorPartitionCounterLocalSanityTest.java |    2 +-
 ...torPartitionCounterRandomOperationsTest.java |    2 +-
 .../CacheMemoryPolicyConfigurationTest.java     |   10 +-
 .../processors/cache/CacheNamesSelfTest.java    |    8 +-
 .../CacheNamesWithSpecialCharactersTest.java    |    4 +-
 .../cache/CacheNearReaderUpdateTest.java        |    2 +-
 ...cheNearUpdateTopologyChangeAbstractTest.java |    8 +-
 .../cache/CacheOffheapMapEntrySelfTest.java     |    2 +-
 .../processors/cache/CachePutIfAbsentTest.java  |    2 +-
 .../cache/CacheReadThroughRestartSelfTest.java  |    8 +-
 .../cache/CacheRebalancingSelfTest.java         |    4 +-
 .../cache/CacheRemoveAllSelfTest.java           |    4 +-
 .../CacheSerializableTransactionsTest.java      |    6 +-
 .../CacheStartupInDeploymentModesTest.java      |    4 +-
 .../CacheStoreUsageMultinodeAbstractTest.java   |    8 +-
 ...eUsageMultinodeDynamicStartAbstractTest.java |    4 +-
 .../processors/cache/CacheTxFastFinishTest.java |    4 +-
 .../processors/cache/CrossCacheLockTest.java    |    4 +-
 .../cache/CrossCacheTxRandomOperationsTest.java |    2 +-
 .../EntryVersionConsistencyReadThroughTest.java |   10 +-
 .../GridCacheAbstractFailoverSelfTest.java      |    8 +-
 .../cache/GridCacheAbstractFullApiSelfTest.java |  114 +-
 .../GridCacheAbstractLocalStoreSelfTest.java    |   26 +-
 .../cache/GridCacheAbstractMetricsSelfTest.java |  102 +-
 .../GridCacheAbstractRemoveFailureTest.java     |    6 +-
 .../cache/GridCacheAbstractSelfTest.java        |    8 +-
 ...acheAbstractUsersAffinityMapperSelfTest.java |    7 +-
 .../cache/GridCacheAffinityApiSelfTest.java     |   26 +-
 .../cache/GridCacheAffinityRoutingSelfTest.java |   10 +-
 ...eAtomicEntryProcessorDeploymentSelfTest.java |    2 +-
 .../GridCacheAtomicMessageCountSelfTest.java    |    6 +-
 .../cache/GridCacheBasicApiAbstractTest.java    |   30 +-
 .../cache/GridCacheClearLocallySelfTest.java    |    8 +-
 .../cache/GridCacheConcurrentMapSelfTest.java   |   10 +-
 .../GridCacheConcurrentTxMultiNodeTest.java     |   10 +-
 .../GridCacheConditionalDeploymentSelfTest.java |    4 +-
 ...idCacheConfigurationConsistencySelfTest.java |    2 +-
 .../GridCacheDaemonNodeAbstractSelfTest.java    |    8 +-
 .../cache/GridCacheDeploymentSelfTest.java      |   46 +-
 .../cache/GridCacheEntryMemorySizeSelfTest.java |    4 +-
 .../cache/GridCacheEntryVersionSelfTest.java    |   16 +-
 .../GridCacheEvictionEventAbstractTest.java     |    2 +-
 .../GridCacheFinishPartitionsSelfTest.java      |   16 +-
 ...CacheFullTextQueryMultithreadedSelfTest.java |    2 +-
 .../cache/GridCacheIncrementTransformTest.java  |    4 +-
 .../GridCacheInterceptorAbstractSelfTest.java   |    8 +-
 .../cache/GridCacheIteratorPerformanceTest.java |    6 +-
 .../cache/GridCacheKeyCheckSelfTest.java        |    6 +-
 .../GridCacheMarshallerTxAbstractTest.java      |   10 +-
 .../GridCacheMarshallingNodeJoinSelfTest.java   |    4 +-
 .../GridCacheMissingCommitVersionSelfTest.java  |    2 +-
 ...GridCacheMixedPartitionExchangeSelfTest.java |    4 +-
 .../cache/GridCacheMultiUpdateLockSelfTest.java |    6 +-
 ...ridCacheMultinodeUpdateAbstractSelfTest.java |    6 +-
 .../cache/GridCacheMvccFlagsTest.java           |    4 +-
 .../cache/GridCacheMvccManagerSelfTest.java     |    9 +-
 .../cache/GridCacheMvccPartitionedSelfTest.java |   34 +-
 .../processors/cache/GridCacheMvccSelfTest.java |   58 +-
 .../cache/GridCacheNestedTxAbstractTest.java    |   12 +-
 .../cache/GridCacheObjectToStringSelfTest.java  |    4 +-
 ...HeapMultiThreadedUpdateAbstractSelfTest.java |   20 +-
 ...CacheOffHeapMultiThreadedUpdateSelfTest.java |   14 +-
 .../cache/GridCacheOffheapUpdateSelfTest.java   |   14 +-
 .../cache/GridCachePartitionedGetSelfTest.java  |   16 +-
 ...hePartitionedProjectionAffinitySelfTest.java |    8 +-
 .../GridCachePreloadingEvictionsSelfTest.java   |   14 +-
 .../GridCacheQueryIndexingDisabledSelfTest.java |    2 +-
 .../GridCacheQueryInternalKeysSelfTest.java     |    6 +-
 .../GridCacheReferenceCleanupSelfTest.java      |   10 +-
 ...ridCacheReplicatedSynchronousCommitTest.java |    6 +-
 .../GridCacheReturnValueTransferSelfTest.java   |    4 +-
 .../processors/cache/GridCacheStopSelfTest.java |    8 +-
 ...ridCacheStoreManagerDeserializationTest.java |    3 +
 .../cache/GridCacheStorePutxSelfTest.java       |    2 +-
 .../cache/GridCacheStoreValueBytesSelfTest.java |    4 +-
 .../cache/GridCacheSwapPreloadSelfTest.java     |   10 +-
 ...acheTcpClientDiscoveryMultiThreadedTest.java |    4 +-
 ...cheTransactionalAbstractMetricsSelfTest.java |    8 +-
 .../GridCacheTtlManagerEvictionSelfTest.java    |    6 +-
 .../cache/GridCacheTtlManagerLoadTest.java      |    4 +-
 .../GridCacheTtlManagerNotificationTest.java    |    8 +-
 .../cache/GridCacheTtlManagerSelfTest.java      |   12 +-
 .../GridCacheValueBytesPreloadingSelfTest.java  |   12 +-
 ...idCacheValueConsistencyAbstractSelfTest.java |   14 +-
 .../GridCacheVariableTopologySelfTest.java      |    4 +-
 .../cache/GridCacheVersionMultinodeTest.java    |    2 +-
 .../GridCacheVersionTopologyChangeTest.java     |    2 +-
 ...ProjectionForCachesOnDaemonNodeSelfTest.java |   16 +-
 .../IgniteCacheAbstractStopBusySelfTest.java    |    3 +-
 .../cache/IgniteCacheAbstractTest.java          |   12 +-
 ...IgniteCacheBinaryEntryProcessorSelfTest.java |    6 +-
 ...teCacheConfigurationDefaultTemplateTest.java |    6 +-
 .../IgniteCacheConfigurationTemplateTest.java   |   29 +-
 ...niteCacheCopyOnReadDisabledAbstractTest.java |    2 +-
 .../cache/IgniteCacheDynamicStopSelfTest.java   |   10 +-
 .../IgniteCacheEntryListenerAbstractTest.java   |    6 +-
 ...niteCacheEntryListenerExpiredEventsTest.java |    2 +-
 .../IgniteCacheEntryProcessorCallTest.java      |    8 +-
 .../IgniteCacheEntryProcessorNodeJoinTest.java  |   16 +-
 ...niteCacheExpireAndUpdateConsistencyTest.java |    2 +-
 ...IgniteCacheGetCustomCollectionsSelfTest.java |    2 +-
 .../cache/IgniteCacheIncrementTxTest.java       |   10 +-
 .../cache/IgniteCacheInvokeAbstractTest.java    |    2 +-
 ...gniteCacheInvokeReadThroughAbstractTest.java |    2 +-
 ...gniteCacheLoadRebalanceEvictionSelfTest.java |    6 +-
 .../IgniteCacheManyAsyncOperationsTest.java     |    2 +-
 .../cache/IgniteCacheObjectPutSelfTest.java     |    2 +-
 ...CacheP2pUnmarshallingRebalanceErrorTest.java |    4 +-
 .../IgniteCachePartitionMapUpdateTest.java      |    4 +-
 .../cache/IgniteCachePeekModesAbstractTest.java |   22 +-
 .../IgniteCacheReadThroughStoreCallTest.java    |    2 +-
 ...iteCacheScanPredicateDeploymentSelfTest.java |    2 +-
 .../cache/IgniteCacheSerializationSelfTest.java |    4 +-
 .../cache/IgniteCacheStartStopLoadTest.java     |    2 +-
 .../cache/IgniteCacheStoreCollectionTest.java   |    4 +-
 .../IgniteCacheStoreValueAbstractTest.java      |   30 +-
 .../cache/IgniteCacheTxPreloadNoWriteTest.java  |   12 +-
 .../IgniteClientAffinityAssignmentSelfTest.java |   22 +-
 .../IgniteDaemonNodeMarshallerCacheTest.java    |    2 +-
 .../cache/IgniteDynamicCacheAndNodeStop.java    |    4 +-
 .../cache/IgniteDynamicCacheFilterTest.java     |   10 +-
 ...eDynamicCacheStartNoExchangeTimeoutTest.java |   34 +-
 .../cache/IgniteDynamicCacheStartSelfTest.java  |   36 +-
 ...niteDynamicCacheStartStopConcurrentTest.java |    6 +-
 .../IgniteDynamicClientCacheStartSelfTest.java  |   44 +-
 .../cache/IgniteExchangeFutureHistoryTest.java  |    2 +-
 ...iteMarshallerCacheClassNameConflictTest.java |    8 +-
 ...lerCacheClientRequestsMappingOnMissTest.java |   22 +-
 ...eMarshallerCacheConcurrentReadWriteTest.java |    8 +-
 .../cache/IgniteOnePhaseCommitNearSelfTest.java |    8 +-
 .../cache/IgnitePutAllLargeBatchSelfTest.java   |   12 +-
 ...tAllUpdateNonPreloadedPartitionSelfTest.java |    6 +-
 .../IgniteStartCacheInTransactionSelfTest.java  |   18 +-
 .../cache/IgniteStaticCacheStartSelfTest.java   |    2 +-
 ...gniteTopologyValidatorAbstractCacheTest.java |   37 +-
 ...iteTopologyValidatorAbstractTxCacheTest.java |   20 +-
 ...niteTopologyValidatorGridSplitCacheTest.java |    2 +-
 .../processors/cache/IgniteTxAbstractTest.java  |    6 +-
 .../IgniteTxConcurrentGetAbstractTest.java      |    6 +-
 .../cache/IgniteTxConfigCacheSelfTest.java      |    2 +-
 .../IgniteTxExceptionAbstractSelfTest.java      |   36 +-
 .../cache/IgniteTxMultiNodeAbstractTest.java    |   58 +-
 .../IgniteTxMultiThreadedAbstractTest.java      |    4 +-
 .../cache/IgniteTxReentryAbstractSelfTest.java  |    2 +-
 .../IgniteTxStoreExceptionAbstractSelfTest.java |   34 +-
 .../binary/BinaryMetadataUpdatesFlowTest.java   |   14 +-
 .../CacheKeepBinaryWithInterceptorTest.java     |    6 +-
 ...yAtomicEntryProcessorDeploymentSelfTest.java |    6 +-
 ...naryObjectMetadataExchangeMultinodeTest.java |   16 +-
 ...acheBinaryObjectUserClassloaderSelfTest.java |    4 +-
 ...naryObjectsAbstractDataStreamerSelfTest.java |    4 +-
 ...aryObjectsAbstractMultiThreadedSelfTest.java |    2 +-
 .../GridCacheBinaryObjectsAbstractSelfTest.java |    8 +-
 .../GridCacheBinaryStoreAbstractSelfTest.java   |    2 +-
 ...ntNodeBinaryObjectMetadataMultinodeTest.java |    8 +-
 ...CacheClientNodeBinaryObjectMetadataTest.java |    4 +-
 .../GridDataStreamerImplSelfTest.java           |   20 +-
 ...IgniteCacheAbstractExecutionContextTest.java |    4 +-
 ...eAbstractDataStructuresFailoverSelfTest.java |   66 +-
 ...CacheAtomicReferenceApiSelfAbstractTest.java |    2 +-
 ...idCacheAtomicStampedApiSelfAbstractTest.java |    2 +-
 .../GridCacheQueueApiSelfAbstractTest.java      |    2 +-
 .../GridCacheQueueCleanupSelfTest.java          |   10 +-
 .../GridCacheSequenceApiSelfAbstractTest.java   |    2 +-
 .../GridCacheSetAbstractSelfTest.java           |    2 +-
 .../GridCacheSetFailoverAbstractSelfTest.java   |    2 +-
 .../IgniteAtomicLongApiAbstractSelfTest.java    |    2 +-
 .../IgniteCountDownLatchAbstractSelfTest.java   |    2 +-
 .../IgniteLockAbstractSelfTest.java             |    2 +-
 .../IgniteSemaphoreAbstractSelfTest.java        |    2 +-
 ...achePartitionedAtomicSequenceTxSelfTest.java |    2 +-
 ...idCachePartitionedNodeRestartTxSelfTest.java |   24 +-
 ...PartitionedQueueCreateMultiNodeSelfTest.java |    4 +-
 ...acheAsyncOperationsFailoverAbstractTest.java |    4 +-
 .../distributed/CacheAsyncOperationsTest.java   |    2 +-
 .../CacheGetFutureHangsSelfTest.java            |    4 +-
 .../CacheGetInsideLockChangingTopologyTest.java |    2 +-
 .../CacheLateAffinityAssignmentTest.java        |   11 +-
 ...CacheLoadingConcurrentGridStartSelfTest.java |   20 +-
 .../CacheLockReleaseNodeLeaveTest.java          |   26 +-
 .../CachePutAllFailoverAbstractTest.java        |    2 +-
 .../CacheTryLockMultithreadedTest.java          |    4 +-
 .../GridCacheAbstractJobExecutionTest.java      |   14 +-
 ...tractPartitionedByteArrayValuesSelfTest.java |    2 +-
 .../GridCacheAbstractPrimarySyncSelfTest.java   |    6 +-
 .../GridCacheBasicOpAbstractTest.java           |   26 +-
 .../GridCacheClientModesAbstractSelfTest.java   |   20 +-
 .../GridCacheEntrySetAbstractSelfTest.java      |    2 +-
 .../distributed/GridCacheLockAbstractTest.java  |    6 +-
 .../distributed/GridCacheMixedModeSelfTest.java |    4 +-
 .../GridCacheMultiNodeAbstractTest.java         |   10 +-
 .../GridCacheMultiNodeLockAbstractTest.java     |   27 +-
 ...dCacheMultithreadedFailoverAbstractTest.java |    2 +-
 .../GridCacheNodeFailureAbstractTest.java       |    9 +-
 ...ridCachePartitionNotLoadedEventSelfTest.java |    4 +-
 ...chePartitionedReloadAllAbstractSelfTest.java |    8 +-
 .../GridCachePreloadEventsAbstractSelfTest.java |    4 +-
 .../GridCacheTransformEventSelfTest.java        |    2 +-
 ...niteBinaryMetadataUpdateNodeRestartTest.java |    2 +-
 .../distributed/IgniteCache150ClientsTest.java  |    4 +-
 ...niteCacheClientNodeChangingTopologyTest.java |  130 +-
 .../IgniteCacheClientNodeConcurrentStart.java   |    2 +-
 ...teCacheClientNodePartitionsExchangeTest.java |   16 +-
 .../IgniteCacheClientReconnectTest.java         |    2 +-
 .../IgniteCacheConnectionRecoveryTest.java      |    2 +-
 .../distributed/IgniteCacheCreatePutTest.java   |    6 +-
 .../distributed/IgniteCacheGetRestartTest.java  |    2 +-
 .../distributed/IgniteCacheManyClientsTest.java |    6 +-
 .../IgniteCacheMessageRecoveryAbstractTest.java |    4 +-
 ...eCacheMessageRecoveryIdleConnectionTest.java |    2 +-
 .../IgniteCacheNearRestartRollbackSelfTest.java |    6 +-
 .../distributed/IgniteCachePrimarySyncTest.java |    4 +-
 .../IgniteCacheReadFromBackupTest.java          |    2 +-
 .../IgniteCacheServerNodeConcurrentStart.java   |    6 +-
 .../IgniteCacheSingleGetMessageTest.java        |    2 +-
 .../IgniteCacheSizeFailoverTest.java            |    6 +-
 .../IgniteCacheSystemTransactionsSelfTest.java  |    6 +-
 .../IgniteNoClassOnServerAbstractTest.java      |    2 +-
 .../IgniteTxCachePrimarySyncTest.java           |   45 +-
 ...teSynchronizationModesMultithreadedTest.java |   15 +-
 ...iteTxConsistencyRestartAbstractSelfTest.java |   12 +-
 ...xOriginatingNodeFailureAbstractSelfTest.java |   10 +-
 ...cOriginatingNodeFailureAbstractSelfTest.java |   22 +-
 .../IgniteTxTimeoutAbstractTest.java            |    2 +-
 ...heAbstractTransformWriteThroughSelfTest.java |    2 +-
 .../dht/GridCacheAtomicNearCacheSelfTest.java   |   50 +-
 .../dht/GridCacheColocatedDebugTest.java        |  112 +-
 ...eColocatedOptimisticTransactionSelfTest.java |    2 +-
 ...dCacheColocatedTxSingleThreadedSelfTest.java |    2 +-
 .../dht/GridCacheDhtEntrySelfTest.java          |    6 +-
 ...GridCacheDhtEvictionNearReadersSelfTest.java |    8 +-
 .../dht/GridCacheDhtMappingSelfTest.java        |    4 +-
 .../dht/GridCacheDhtPreloadBigDataSelfTest.java |   10 +-
 .../dht/GridCacheDhtPreloadDelayedSelfTest.java |   26 +-
 .../GridCacheDhtPreloadDisabledSelfTest.java    |   10 +-
 .../GridCacheDhtPreloadMessageCountTest.java    |    8 +-
 .../dht/GridCacheDhtPreloadPutGetSelfTest.java  |    4 +-
 .../dht/GridCacheDhtPreloadSelfTest.java        |   18 +-
 .../GridCacheDhtPreloadStartStopSelfTest.java   |    4 +-
 .../dht/GridCacheDhtPreloadUnloadSelfTest.java  |   24 +-
 ...ePartitionedNearDisabledMetricsSelfTest.java |   12 +-
 ...idCachePartitionedPreloadEventsSelfTest.java |    6 +-
 ...dCachePartitionedTopologyChangeSelfTest.java |   18 +-
 ...itionedTxOriginatingNodeFailureSelfTest.java |   10 +-
 ...ridCachePartitionedUnloadEventsSelfTest.java |   10 +-
 .../dht/GridCacheTxNodeFailureSelfTest.java     |   12 +-
 .../IgniteCacheCommitDelayTxRecoveryTest.java   |   22 +-
 .../dht/IgniteCacheConcurrentPutGetRemove.java  |    2 +-
 .../IgniteCacheCrossCacheTxFailoverTest.java    |    5 +-
 .../dht/IgniteCacheLockFailoverSelfTest.java    |    8 +-
 .../dht/IgniteCacheMultiTxLockSelfTest.java     |    2 +-
 ...artitionedBackupNodeFailureRecoveryTest.java |    6 +-
 ...ePrimaryNodeFailureRecoveryAbstractTest.java |   12 +-
 .../IgniteCachePutRetryAbstractSelfTest.java    |    8 +-
 .../dht/IgniteCachePutRetryAtomicSelfTest.java  |    4 +-
 ...gniteCachePutRetryTransactionalSelfTest.java |    6 +-
 .../dht/IgniteCacheTxRecoveryRollbackTest.java  |   20 +-
 .../dht/IgniteTxReentryColocatedSelfTest.java   |    2 +-
 ...eAtomicInvalidPartitionHandlingSelfTest.java |   12 +-
 .../atomic/GridCacheAtomicPreloadSelfTest.java  |   10 +-
 .../atomic/IgniteCacheAtomicProtocolTest.java   |    4 +-
 ...tomicClientOnlyMultiNodeFullApiSelfTest.java |    6 +-
 ...eAtomicNearOnlyMultiNodeFullApiSelfTest.java |    2 +-
 ...AtomicPartitionedTckMetricsSelfTestImpl.java |    8 +-
 .../near/GridCacheGetStoreErrorSelfTest.java    |    4 +-
 .../near/GridCacheNearEvictionSelfTest.java     |    6 +-
 .../near/GridCacheNearMetricsSelfTest.java      |   32 +-
 .../near/GridCacheNearMultiGetSelfTest.java     |    6 +-
 .../near/GridCacheNearMultiNodeSelfTest.java    |   14 +-
 ...idCacheNearOnlyMultiNodeFullApiSelfTest.java |   10 +-
 .../near/GridCacheNearOnlyTopologySelfTest.java |   16 +-
 .../GridCacheNearPartitionedClearSelfTest.java  |    2 +-
 .../GridCacheNearReaderPreloadSelfTest.java     |    2 +-
 .../near/GridCacheNearReadersSelfTest.java      |   36 +-
 .../near/GridCacheNearTxForceKeyTest.java       |    8 +-
 .../near/GridCacheNearTxMultiNodeSelfTest.java  |   18 +-
 ...AffinityExcludeNeighborsPerformanceTest.java |    2 +-
 .../GridCachePartitionedAffinitySelfTest.java   |    8 +-
 ...ionedClientOnlyNoPrimaryFullApiSelfTest.java |    4 +-
 .../GridCachePartitionedEvictionSelfTest.java   |    2 +-
 ...titionedExplicitLockNodeFailureSelfTest.java |    4 +-
 ...GridCachePartitionedFilteredPutSelfTest.java |    2 +-
 .../GridCachePartitionedFullApiSelfTest.java    |    8 +-
 ...idCachePartitionedHitsAndMissesSelfTest.java |    4 +-
 .../GridCachePartitionedLoadCacheSelfTest.java  |    2 +-
 ...achePartitionedMultiNodeCounterSelfTest.java |   24 +-
 ...achePartitionedMultiNodeFullApiSelfTest.java |   34 +-
 ...ePartitionedMultiThreadedPutGetSelfTest.java |    8 +-
 .../GridCachePartitionedStorePutSelfTest.java   |    6 +-
 .../GridCachePartitionedTxSalvageSelfTest.java  |    2 +-
 ...achePartitionedTxSingleThreadedSelfTest.java |    2 +-
 .../near/GridCachePutArrayValueSelfTest.java    |    2 +-
 ...idCacheRendezvousAffinityClientSelfTest.java |    2 +-
 .../near/GridPartitionedBackupLoadSelfTest.java |    4 +-
 .../near/IgniteCacheNearOnlyTxTest.java         |   24 +-
 .../near/IgniteCacheNearReadCommittedTest.java  |    4 +-
 .../near/IgniteTxReentryNearSelfTest.java       |    2 +-
 .../near/NearCacheMultithreadedUpdateTest.java  |    8 +-
 .../near/NearCachePutAllMultinodeTest.java      |    4 +-
 .../near/NearCacheSyncUpdateTest.java           |    4 +-
 .../near/NoneRebalanceModeSelfTest.java         |    4 +-
 ...cingDelayedPartitionMapExchangeSelfTest.java |    8 +-
 .../GridCacheRebalancingOrderingTest.java       |    2 +-
 .../GridCacheRebalancingSyncCheckDataTest.java  |    6 +-
 .../GridCacheRebalancingSyncSelfTest.java       |   10 +-
 ...eRebalancingUnmarshallingFailedSelfTest.java |    2 +-
 ...stractReplicatedByteArrayValuesSelfTest.java |    2 +-
 .../GridCacheSyncReplicatedPreloadSelfTest.java |   14 +-
 .../GridCacheReplicatedPreloadSelfTest.java     |   50 +-
 ...eplicatedPreloadStartStopEventsSelfTest.java |    2 +-
 .../cache/eviction/EvictionAbstractTest.java    |   12 +-
 ...heConcurrentEvictionConsistencySelfTest.java |    2 +-
 .../GridCacheConcurrentEvictionsSelfTest.java   |    2 +-
 .../GridCacheEmptyEntriesAbstractSelfTest.java  |    2 +-
 .../GridCacheEvictionFilterSelfTest.java        |    4 +-
 .../GridCacheEvictionTouchSelfTest.java         |    8 +-
 .../lru/LruNearEvictionPolicySelfTest.java      |    6 +-
 .../LruNearOnlyNearEvictionPolicySelfTest.java  |    8 +-
 .../paged/PageEvictionAbstractTest.java         |    5 +-
 .../SortedEvictionPolicyPerformanceTest.java    |    2 +-
 .../IgniteCacheClientNearCacheExpiryTest.java   |    4 +-
 .../IgniteCacheExpiryPolicyAbstractTest.java    |   10 +-
 ...eCacheExpiryPolicyWithStoreAbstractTest.java |    6 +-
 .../expiry/IgniteCacheLargeValueExpireTest.java |    4 +-
 ...eCacheOnlyOneTtlCleanupThreadExistsTest.java |    5 +-
 .../expiry/IgniteCacheTtlCleanupSelfTest.java   |    8 +-
 .../IgniteCacheLoadAllAbstractTest.java         |    2 +-
 .../IgniteCacheStoreSessionAbstractTest.java    |    5 +-
 ...acheStoreSessionWriteBehindAbstractTest.java |    2 +-
 .../IgniteCacheTxStoreSessionTest.java          |   22 +-
 ...dCacheAtomicLocalTckMetricsSelfTestImpl.java |    8 +-
 .../GridCacheLocalByteArrayValuesSelfTest.java  |    2 +-
 .../local/GridCacheLocalFullApiSelfTest.java    |    4 +-
 .../cache/local/GridCacheLocalLockSelfTest.java |    6 +-
 .../GridCacheLocalMultithreadedSelfTest.java    |    2 +-
 .../local/GridCacheLocalTxTimeoutSelfTest.java  |    2 +-
 .../BinaryTxCacheLocalEntriesSelfTest.java      |    2 +-
 .../cache/query/IndexingSpiQuerySelfTest.java   |    4 +-
 .../continuous/CacheContinuousBatchAckTest.java |    2 +-
 ...eContinuousQueryAsyncFilterListenerTest.java |    2 +-
 ...acheContinuousQueryExecuteInPrimaryTest.java |    2 +-
 ...ContinuousQueryFailoverAbstractSelfTest.java |   85 +-
 ...ontinuousQueryOperationFromCallbackTest.java |    2 +-
 .../CacheContinuousQueryOperationP2PTest.java   |    2 +-
 .../CacheContinuousQueryOrderingEventTest.java  |    2 +-
 ...acheContinuousQueryRandomOperationsTest.java |    2 +-
 .../CacheKeepBinaryIterationTest.java           |    2 +-
 .../ClientReconnectContinuousQueryTest.java     |    4 +-
 ...yRemoteFilterMissingInClassPathSelfTest.java |    2 +-
 ...ridCacheContinuousQueryAbstractSelfTest.java |   68 +-
 ...dCacheContinuousQueryNodesFilteringTest.java |    2 +-
 ...dCacheContinuousQueryReplicatedSelfTest.java |    8 +-
 ...eContinuousQueryReplicatedTxOneNodeTest.java |    4 +-
 ...CacheContinuousQueryClientReconnectTest.java |    6 +-
 .../IgniteCacheContinuousQueryClientTest.java   |   18 +-
 ...eCacheContinuousQueryImmutableEntryTest.java |   10 +-
 ...teCacheContinuousQueryNoUnsubscribeTest.java |   14 +-
 ...IgniteCacheContinuousQueryReconnectTest.java |    8 +-
 ...BehindStorePartitionedMultiNodeSelfTest.java |    6 +-
 .../IgniteCacheWriteBehindNoUpdateSelfTest.java |    2 +-
 ...CacheClientWriteBehindStoreAbstractTest.java |    2 +-
 ...ClientWriteBehindStoreNonCoalescingTest.java |    2 +-
 ...DeadlockDetectionMessageMarshallingTest.java |  116 ++
 .../TxDeadlockDetectionUnmasrhalErrorsTest.java |  225 ++
 ...simisticDeadlockDetectionCrossCacheTest.java |    3 +-
 .../CacheVersionedEntryAbstractTest.java        |   10 +-
 .../database/IgniteDbAbstractTest.java          |    2 +-
 .../database/IgniteDbDynamicCacheSelfTest.java  |    4 +-
 .../database/IgniteDbPutGetAbstractTest.java    |   64 +-
 .../DataStreamProcessorSelfTest.java            |   58 +-
 .../datastreamer/DataStreamerImplSelfTest.java  |   10 +-
 .../DataStreamerMultiThreadedSelfTest.java      |    2 +-
 .../DataStreamerUpdateAfterLoadTest.java        |    5 +-
 .../IgniteDataStreamerPerformanceTest.java      |    2 +-
 ...lockMessageSystemPoolStarvationSelfTest.java |    4 +-
 .../processors/igfs/IgfsCacheSelfTest.java      |    3 +-
 .../igfs/IgfsDataManagerSelfTest.java           |    3 +-
 .../processors/igfs/IgfsIgniteMock.java         |    7 -
 .../igfs/IgfsMetaManagerSelfTest.java           |    3 +-
 .../processors/igfs/IgfsOneClientNodeTest.java  |    7 +-
 .../processors/igfs/IgfsProcessorSelfTest.java  |    3 +-
 .../processors/igfs/IgfsStartCacheTest.java     |    4 +-
 .../processors/igfs/IgfsStreamsSelfTest.java    |    3 +-
 .../processors/igfs/IgfsTaskSelfTest.java       |    4 +-
 .../IgfsAbstractRecordResolverSelfTest.java     |    4 +-
 .../cache/GridCacheCommandHandlerSelfTest.java  |    4 +
 .../query/GridQueryCommandHandlerTest.java      |    2 +-
 .../service/GridServiceClientNodeTest.java      |    7 +-
 .../GridServiceProcessorAbstractSelfTest.java   |    2 +-
 .../ServicePredicateAccessCacheTest.java        |    2 +-
 .../IgniteOffheapReadWriteLockSelfTest.java     |   18 +-
 .../cache/GridCacheAbstractLoadTest.java        |    5 +-
 .../cache/GridCacheDataStructuresLoadTest.java  |    2 +-
 .../loadtests/cache/GridCacheLoadTest.java      |    4 +-
 .../capacity/GridCapacityLoadTest.java          |    2 +-
 .../capacity/spring-capacity-cache.xml          |    2 +
 .../GridContinuousOperationsLoadTest.java       |    2 +-
 .../GridCachePartitionedAtomicLongLoadTest.java |    2 +-
 ...ridSingleSplitsNewNodesAbstractLoadTest.java |   11 +-
 ...idSingleSplitsNewNodesMulticastLoadTest.java |    9 +-
 .../loadtests/discovery/GridGcTimeoutTest.java  |    2 +-
 .../marshaller/GridMarshallerAbstractTest.java  |   10 +-
 .../p2p/GridP2PSameClassLoaderSelfTest.java     |    2 +-
 .../platform/PlatformComputeEchoTask.java       |   11 +-
 .../ignite/platform/PlatformSqlQueryTask.java   |    2 +-
 .../CacheCheckpointSpiSecondCacheSelfTest.java  |    7 +-
 .../communication/GridCacheMessageSelfTest.java |    2 +-
 .../tcp/GridCacheDhtLockBackupSelfTest.java     |    6 +-
 .../discovery/AbstractDiscoverySelfTest.java    |   19 +-
 ...gniteClientReconnectMassiveShutdownTest.java |    4 +-
 ...lientDiscoverySpiFailureTimeoutSelfTest.java |  245 ++-
 .../tcp/TcpClientDiscoverySpiSelfTest.java      |   79 +-
 .../tcp/TcpDiscoveryMultiThreadedTest.java      |   12 +-
 .../spi/discovery/tcp/TcpDiscoverySelfTest.java |   34 +-
 .../tcp/TcpDiscoverySpiConfigSelfTest.java      |    4 +-
 .../TcpDiscoverySpiFailureTimeoutSelfTest.java  |   51 +-
 .../stream/socket/SocketStreamerSelfTest.java   |    6 +-
 .../ignite/testframework/GridTestUtils.java     |    2 +-
 .../testframework/junits/GridAbstractTest.java  |   15 +-
 .../junits/common/GridCommonAbstractTest.java   |   23 +-
 .../multijvm/IgniteClusterProcessProxy.java     |    9 +-
 .../junits/multijvm/IgniteProcessProxy.java     |    5 -
 .../testframework/test/ParametersTest.java      |    7 +-
 .../TxDeadlockDetectionTestSuite.java           |    4 +
 .../webapp/META-INF/ignite-webapp-config.xml    |    1 -
 .../tests/p2p/CacheDeploymentTestTask1.java     |    2 +-
 .../tests/p2p/CacheDeploymentTestTask3.java     |    2 +-
 .../p2p/GridP2PContinuousDeploymentTask1.java   |    2 +-
 .../CacheNoValueClassOnServerTestClient.java    |    2 +-
 .../sink/flink/FlinkIgniteSinkSelfTest.java     |    4 +-
 .../query/h2/H2IndexingAbstractGeoSelfTest.java |    3 +-
 .../hadoop/impl/HadoopAbstractSelfTest.java     |    4 +-
 modules/hibernate-4.2/README.txt                |   48 +
 modules/hibernate-4.2/licenses/apache-2.0.txt   |  202 ++
 modules/hibernate-4.2/pom.xml                   |  159 ++
 .../HibernateAbstractRegionAccessStrategy.java  |  102 +
 .../hibernate/HibernateCollectionRegion.java    |  100 +
 .../cache/hibernate/HibernateEntityRegion.java  |  112 +
 .../hibernate/HibernateGeneralDataRegion.java   |   76 +
 .../cache/hibernate/HibernateKeyWrapper.java    |   73 +
 .../hibernate/HibernateNaturalIdRegion.java     |  103 +
 .../hibernate/HibernateQueryResultsRegion.java  |   70 +
 .../ignite/cache/hibernate/HibernateRegion.java |   99 +
 .../cache/hibernate/HibernateRegionFactory.java |  179 ++
 .../hibernate/HibernateTimestampsRegion.java    |   39 +
 .../HibernateTransactionalDataRegion.java       |   84 +
 .../ignite/cache/hibernate/package-info.java    |   24 +
 .../hibernate/CacheHibernateBlobStore.java      |  542 +++++
 .../CacheHibernateBlobStoreEntry.hbm.xml        |   31 +
 .../hibernate/CacheHibernateBlobStoreEntry.java |   89 +
 .../CacheHibernateBlobStoreFactory.java         |  235 +++
 .../CacheHibernateStoreSessionListener.java     |  222 ++
 .../cache/store/hibernate/package-info.java     |   22 +
 .../src/test/config/factory-cache.xml           |   59 +
 .../src/test/config/factory-cache1.xml          |   61 +
 .../config/factory-incorrect-store-cache.xml    |   56 +
 .../HibernateL2CacheConfigurationSelfTest.java  |  409 ++++
 .../hibernate/HibernateL2CacheMultiJvmTest.java |  440 ++++
 .../hibernate/HibernateL2CacheSelfTest.java     | 1954 +++++++++++++++++
 .../HibernateL2CacheTransactionalSelfTest.java  |  154 ++
 ...nateL2CacheTransactionalUseSyncSelfTest.java |   31 +
 .../CacheHibernateBlobStoreNodeRestartTest.java |   46 +
 .../CacheHibernateBlobStoreSelfTest.java        |  113 +
 .../CacheHibernateStoreFactorySelfTest.java     |  288 +++
 ...heHibernateStoreSessionListenerSelfTest.java |  238 +++
 .../cache/store/hibernate/hibernate.cfg.xml     |   42 +
 .../cache/store/hibernate/package-info.java     |   22 +
 .../IgniteBinaryHibernateTestSuite.java         |   37 +
 .../testsuites/IgniteHibernateTestSuite.java    |   57 +
 modules/hibernate-5.1/README.txt                |   48 +
 modules/hibernate-5.1/licenses/apache-2.0.txt   |  202 ++
 modules/hibernate-5.1/pom.xml                   |  159 ++
 .../HibernateAbstractRegionAccessStrategy.java  |  103 +
 .../hibernate/HibernateCollectionRegion.java    |  114 +
 .../cache/hibernate/HibernateEntityRegion.java  |  128 ++
 .../hibernate/HibernateGeneralDataRegion.java   |   79 +
 .../cache/hibernate/HibernateKeyWrapper.java    |  109 +
 .../hibernate/HibernateNaturalIdRegion.java     |  113 +
 .../hibernate/HibernateQueryResultsRegion.java  |   70 +
 .../ignite/cache/hibernate/HibernateRegion.java |   99 +
 .../cache/hibernate/HibernateRegionFactory.java |  168 ++
 .../hibernate/HibernateTimestampsRegion.java    |   39 +
 .../HibernateTransactionalDataRegion.java       |   84 +
 .../ignite/cache/hibernate/package-info.java    |   24 +
 .../hibernate/CacheHibernateBlobStore.java      |  543 +++++
 .../CacheHibernateBlobStoreEntry.hbm.xml        |   31 +
 .../hibernate/CacheHibernateBlobStoreEntry.java |   89 +
 .../CacheHibernateBlobStoreFactory.java         |  235 +++
 .../CacheHibernateStoreSessionListener.java     |  224 ++
 .../cache/store/hibernate/package-info.java     |   22 +
 .../src/test/config/factory-cache.xml           |   59 +
 .../src/test/config/factory-cache1.xml          |   61 +
 .../config/factory-incorrect-store-cache.xml    |   56 +
 .../HibernateL2CacheConfigurationSelfTest.java  |  407 ++++
 .../hibernate/HibernateL2CacheMultiJvmTest.java |  429 ++++
 .../hibernate/HibernateL2CacheSelfTest.java     | 1960 ++++++++++++++++++
 .../HibernateL2CacheTransactionalSelfTest.java  |  154 ++
 ...nateL2CacheTransactionalUseSyncSelfTest.java |   31 +
 .../CacheHibernateBlobStoreNodeRestartTest.java |   46 +
 .../CacheHibernateBlobStoreSelfTest.java        |  114 +
 .../CacheHibernateStoreFactorySelfTest.java     |  256 +++
 ...heHibernateStoreSessionListenerSelfTest.java |  242 +++
 .../cache/store/hibernate/hibernate.cfg.xml     |   42 +
 .../cache/store/hibernate/package-info.java     |   22 +
 .../IgniteBinaryHibernate5TestSuite.java        |   37 +
 .../testsuites/IgniteHibernate5TestSuite.java   |   57 +
 modules/hibernate-core/pom.xml                  |   76 +
 .../HibernateAccessStrategyAdapter.java         |  340 +++
 .../HibernateAccessStrategyFactory.java         |  235 +++
 .../cache/hibernate/HibernateCacheProxy.java    |  801 +++++++
 .../hibernate/HibernateExceptionConverter.java  |   29 +
 .../hibernate/HibernateKeyTransformer.java      |   29 +
 .../HibernateNonStrictAccessStrategy.java       |  230 ++
 .../HibernateReadOnlyAccessStrategy.java        |  105 +
 .../HibernateReadWriteAccessStrategy.java       |  326 +++
 .../HibernateTransactionalAccessStrategy.java   |  141 ++
 .../ignite/cache/hibernate/package-info.java    |   24 +
 modules/hibernate/README.txt                    |   48 -
 modules/hibernate/licenses/apache-2.0.txt       |  202 --
 modules/hibernate/pom.xml                       |  146 --
 .../HibernateAbstractRegionAccessStrategy.java  |   98 -
 .../HibernateAccessStrategyAdapter.java         |  379 ----
 .../cache/hibernate/HibernateCacheProxy.java    |  801 -------
 .../hibernate/HibernateCollectionRegion.java    |  100 -
 .../cache/hibernate/HibernateEntityRegion.java  |  112 -
 .../hibernate/HibernateGeneralDataRegion.java   |   71 -
 .../hibernate/HibernateKeyTransformer.java      |   28 -
 .../cache/hibernate/HibernateKeyWrapper.java    |   72 -
 .../hibernate/HibernateNaturalIdRegion.java     |  100 -
 .../HibernateNonStrictAccessStrategy.java       |  222 --
 .../hibernate/HibernateQueryResultsRegion.java  |   70 -
 .../HibernateReadOnlyAccessStrategy.java        |  107 -
 .../HibernateReadWriteAccessStrategy.java       |  328 ---
 .../ignite/cache/hibernate/HibernateRegion.java |   99 -
 .../cache/hibernate/HibernateRegionFactory.java |  266 ---
 .../hibernate/HibernateTimestampsRegion.java    |   39 -
 .../HibernateTransactionalAccessStrategy.java   |  141 --
 .../HibernateTransactionalDataRegion.java       |  107 -
 .../ignite/cache/hibernate/package-info.java    |   24 -
 .../hibernate/CacheHibernateBlobStore.java      |  542 -----
 .../CacheHibernateBlobStoreEntry.hbm.xml        |   31 -
 .../hibernate/CacheHibernateBlobStoreEntry.java |   89 -
 .../CacheHibernateBlobStoreFactory.java         |  235 ---
 .../CacheHibernateStoreSessionListener.java     |  222 --
 .../cache/store/hibernate/package-info.java     |   22 -
 .../hibernate/src/test/config/factory-cache.xml |   59 -
 .../src/test/config/factory-cache1.xml          |   61 -
 .../config/factory-incorrect-store-cache.xml    |   56 -
 .../HibernateL2CacheConfigurationSelfTest.java  |  408 ----
 .../hibernate/HibernateL2CacheSelfTest.java     | 1949 -----------------
 .../HibernateL2CacheTransactionalSelfTest.java  |  154 --
 ...nateL2CacheTransactionalUseSyncSelfTest.java |   31 -
 .../CacheHibernateBlobStoreNodeRestartTest.java |   46 -
 .../CacheHibernateBlobStoreSelfTest.java        |  113 -
 .../CacheHibernateStoreFactorySelfTest.java     |  285 ---
 ...heHibernateStoreSessionListenerSelfTest.java |  238 ---
 .../cache/store/hibernate/hibernate.cfg.xml     |   42 -
 .../cache/store/hibernate/package-info.java     |   22 -
 .../IgniteBinaryHibernateTestSuite.java         |   37 -
 .../testsuites/IgniteHibernateTestSuite.java    |   57 -
 modules/hibernate5/README.txt                   |   48 -
 modules/hibernate5/licenses/apache-2.0.txt      |  202 --
 modules/hibernate5/pom.xml                      |  146 --
 .../HibernateAbstractRegionAccessStrategy.java  |   99 -
 .../HibernateAccessStrategyAdapter.java         |  379 ----
 .../cache/hibernate/HibernateCacheProxy.java    |  801 -------
 .../hibernate/HibernateCollectionRegion.java    |  114 -
 .../cache/hibernate/HibernateEntityRegion.java  |  129 --
 .../hibernate/HibernateGeneralDataRegion.java   |   72 -
 .../hibernate/HibernateKeyTransformer.java      |   28 -
 .../cache/hibernate/HibernateKeyWrapper.java    |  108 -
 .../hibernate/HibernateNaturalIdRegion.java     |  113 -
 .../HibernateNonStrictAccessStrategy.java       |  222 --
 .../hibernate/HibernateQueryResultsRegion.java  |   70 -
 .../HibernateReadOnlyAccessStrategy.java        |  107 -
 .../HibernateReadWriteAccessStrategy.java       |  328 ---
 .../ignite/cache/hibernate/HibernateRegion.java |   99 -
 .../cache/hibernate/HibernateRegionFactory.java |  255 ---
 .../hibernate/HibernateTimestampsRegion.java    |   39 -
 .../HibernateTransactionalAccessStrategy.java   |  141 --
 .../HibernateTransactionalDataRegion.java       |  107 -
 .../ignite/cache/hibernate/package-info.java    |   24 -
 .../hibernate/CacheHibernateBlobStore.java      |  542 -----
 .../CacheHibernateBlobStoreEntry.hbm.xml        |   31 -
 .../hibernate/CacheHibernateBlobStoreEntry.java |   89 -
 .../CacheHibernateBlobStoreFactory.java         |  235 ---
 .../CacheHibernateStoreSessionListener.java     |  223 --
 .../cache/store/hibernate/package-info.java     |   22 -
 .../src/test/config/factory-cache.xml           |   59 -
 .../src/test/config/factory-cache1.xml          |   61 -
 .../config/factory-incorrect-store-cache.xml    |   56 -
 .../HibernateL2CacheConfigurationSelfTest.java  |  409 ----
 .../hibernate/HibernateL2CacheSelfTest.java     | 1948 -----------------
 .../HibernateL2CacheTransactionalSelfTest.java  |  154 --
 ...nateL2CacheTransactionalUseSyncSelfTest.java |   31 -
 .../CacheHibernateBlobStoreNodeRestartTest.java |   46 -
 .../CacheHibernateBlobStoreSelfTest.java        |  113 -
 .../CacheHibernateStoreFactorySelfTest.java     |  326 ---
 ...heHibernateStoreSessionListenerSelfTest.java |  241 ---
 .../cache/store/hibernate/hibernate.cfg.xml     |   42 -
 .../cache/store/hibernate/package-info.java     |   22 -
 .../IgniteBinaryHibernate5TestSuite.java        |   37 -
 .../testsuites/IgniteHibernate5TestSuite.java   |   57 -
 .../query/h2/DmlStatementsProcessor.java        |   17 +-
 .../processors/query/h2/IgniteH2Indexing.java   |  223 +-
 .../query/h2/dml/UpdatePlanBuilder.java         |   32 +-
 .../query/h2/opt/GridH2AbstractKeyValueRow.java |   78 +-
 .../query/h2/opt/GridH2CollocationModel.java    |    4 +-
 .../query/h2/opt/GridH2IndexBase.java           |   15 +-
 .../query/h2/opt/GridH2KeyValueRowOffheap.java  |    6 +-
 .../query/h2/opt/GridH2KeyValueRowOnheap.java   |    6 +-
 .../query/h2/opt/GridH2ProxyIndex.java          |  204 ++
 .../query/h2/opt/GridH2ProxySpatialIndex.java   |   70 +
 .../query/h2/opt/GridH2RowDescriptor.java       |   67 +
 .../processors/query/h2/opt/GridH2Table.java    |  114 +-
 .../query/h2/opt/GridLuceneIndex.java           |    4 +-
 .../processors/query/h2/sql/DmlAstUtils.java    |   36 +-
 .../cache/BinarySerializationQuerySelfTest.java |    5 +-
 .../CacheBinaryKeyConcurrentQueryTest.java      |    2 +-
 .../cache/CacheIndexStreamerTest.java           |    4 +-
 .../CacheOffheapBatchIndexingBaseTest.java      |    2 +-
 .../CacheOperationsWithExpirationTest.java      |    2 +-
 .../cache/CacheQueryBuildValueTest.java         |    4 +-
 .../cache/CacheQueryEvictDataLostTest.java      |    2 +-
 .../cache/CacheQueryFilterExpiredTest.java      |    2 +-
 .../CacheRandomOperationsMultithreadedTest.java |    2 +-
 ...CacheScanPartitionQueryFallbackSelfTest.java |   12 +-
 .../cache/CacheSqlQueryValueCopySelfTest.java   |   18 +-
 .../cache/GridCacheOffHeapSelfTest.java         |    4 +-
 .../GridCacheOffheapIndexEntryEvictTest.java    |    4 +-
 .../cache/GridCacheQuerySimpleBenchmark.java    |    2 +-
 .../cache/GridIndexingWithNoopSwapSelfTest.java |    2 +-
 .../IgniteBinaryObjectFieldsQuerySelfTest.java  |    9 +-
 .../IgniteBinaryObjectQueryArgumentsTest.java   |    8 +-
 ...eBinaryWrappedObjectFieldsQuerySelfTest.java |    3 +-
 .../IgniteCacheAbstractFieldsQuerySelfTest.java |   17 +-
 ...niteCacheAbstractInsertSqlQuerySelfTest.java |    2 +-
 .../cache/IgniteCacheAbstractQuerySelfTest.java |    6 +-
 .../IgniteCacheAbstractSqlDmlQuerySelfTest.java |    2 +-
 .../IgniteCacheCollocatedQuerySelfTest.java     |    6 +-
 ...acheConfigurationPrimitiveTypesSelfTest.java |   14 +-
 .../IgniteCacheCrossCacheJoinRandomTest.java    |    2 +-
 .../IgniteCacheDeleteSqlQuerySelfTest.java      |    6 +-
 ...acheDistributedJoinCollocatedAndNotTest.java |    2 +-
 ...acheDistributedJoinCustomAffinityMapper.java |    2 +-
 .../IgniteCacheDistributedJoinNoIndexTest.java  |    2 +-
 ...ributedJoinPartitionedAndReplicatedTest.java |    2 +-
 ...CacheDistributedJoinQueryConditionsTest.java |    2 +-
 .../cache/IgniteCacheDistributedJoinTest.java   |    6 +-
 .../IgniteCacheFieldsQueryNoDataSelfTest.java   |    2 +-
 ...teCacheFullTextQueryNodeJoiningSelfTest.java |    6 +-
 ...PartitionedAndReplicatedCollocationTest.java |    2 +-
 ...teCacheJoinPartitionedAndReplicatedTest.java |    2 +-
 ...IgniteCacheJoinQueryWithAffinityKeyTest.java |    2 +-
 .../cache/IgniteCacheLargeResultSelfTest.java   |    4 +-
 ...eLockPartitionOnAffinityRunAbstractTest.java |    4 +
 .../IgniteCacheMultipleIndexedTypesTest.java    |    2 +-
 .../IgniteCacheObjectKeyIndexingSelfTest.java   |    6 +-
 .../cache/IgniteCacheOffheapEvictQueryTest.java |    2 +-
 .../cache/IgniteCacheOffheapIndexScanTest.java  |    4 +-
 ...hePartitionedQueryMultiThreadedSelfTest.java |    4 +-
 .../cache/IgniteCacheQueriesLoadTest1.java      |    2 +-
 .../IgniteCacheQueryH2IndexingLeakTest.java     |    4 +-
 .../cache/IgniteCacheQueryIndexSelfTest.java    |    4 +-
 .../cache/IgniteCacheQueryLoadSelfTest.java     |   14 +-
 .../IgniteCacheQueryMultiThreadedSelfTest.java  |   15 +-
 ...gniteCacheSqlQueryMultiThreadedSelfTest.java |    6 +-
 .../IgniteCacheStarvationOnRebalanceTest.java   |    2 +-
 .../IgniteCacheUpdateSqlQuerySelfTest.java      |    8 +-
 ...ClientReconnectCacheQueriesFailoverTest.java |   10 +-
 .../cache/IgniteCrossCachesJoinsQueryTest.java  |    2 +-
 .../cache/QueryEntityCaseMismatchTest.java      |    2 +-
 .../cache/SqlFieldsQuerySelfTest.java           |    2 +-
 ...niteCacheDistributedQueryCancelSelfTest.java |    6 +-
 ...butedQueryStopOnCancelOrTimeoutSelfTest.java |    6 +-
 .../IgniteCachePartitionedQuerySelfTest.java    |    2 +-
 .../IgniteCacheQueryNoRebalanceSelfTest.java    |    4 +-
 .../near/IgniteCacheQueryNodeFailTest.java      |    4 +-
 .../IgniteCacheQueryNodeRestartSelfTest.java    |    2 +-
 .../cache/index/AbstractSchemaSelfTest.java     |    3 +
 .../DynamicIndexAbstractConcurrentSelfTest.java |    5 +-
 .../index/DynamicIndexAbstractSelfTest.java     |    3 +
 ...eCacheLocalQueryCancelOrTimeoutSelfTest.java |    6 +-
 .../cache/ttl/CacheTtlAbstractSelfTest.java     |    6 +-
 .../query/IgniteQueryDedicatedPoolTest.java     |    2 +-
 .../query/IgniteSqlDistributedJoinSelfTest.java |    2 +-
 .../query/IgniteSqlKeyValueFieldsTest.java      |  392 ++++
 .../query/IgniteSqlSchemaIndexingTest.java      |    2 +-
 .../query/IgniteSqlSplitterSelfTest.java        |   10 +-
 .../h2/GridIndexingSpiAbstractSelfTest.java     |   14 +-
 .../query/h2/IgniteSqlQueryMinMaxTest.java      |    4 +-
 .../query/h2/sql/GridQueryParsingTest.java      |    9 +-
 .../IgniteCacheQuerySelfTestSuite.java          |    2 +
 .../stream/jms11/IgniteJmsStreamerTest.java     |   28 +-
 ...CacheJtaConfigurationValidationSelfTest.java |    2 +-
 ...CacheJtaFactoryConfigValidationSelfTest.java |    2 +-
 ...titionedCacheJtaLookupClassNameSelfTest.java |    2 +-
 .../kafka/KafkaIgniteStreamerSelfTest.java      |    8 +-
 .../stream/mqtt/IgniteMqttStreamerTest.java     |   12 +-
 .../osgi-karaf/src/main/resources/features.xml  |    2 +-
 modules/osgi/README.txt                         |   30 -
 .../core-test/config/cache-query-default.xml    |    6 +
 .../cpp/core-test/src/cache_query_test.cpp      |   82 +
 .../cpp/odbc-test/config/queries-default.xml    |    5 +
 .../cpp/odbc-test/include/complex_type.h        |   25 +
 .../cpp/odbc-test/src/queries_test.cpp          |  148 ++
 .../Binary/BinaryCompactFooterInteropTest.cs    |    2 +-
 .../Binary/BinaryDynamicRegistrationTest.cs     |   18 +-
 .../Binary/JavaBinaryInteropTest.cs             |    6 +-
 .../BinaryConfigurationTest.cs                  |    2 +-
 .../Cache/Affinity/AffinityFieldTest.cs         |    4 +-
 .../Cache/Affinity/AffinityTest.cs              |    4 +-
 .../Cache/CacheConfigurationTest.cs             |   11 +-
 .../Cache/CacheForkedTest.cs                    |    2 +-
 .../Cache/CacheMetricsTest.cs                   |    3 +-
 .../Cache/CacheNearTest.cs                      |   34 +-
 .../Cache/Query/CacheLinqTest.cs                |   30 +-
 .../Cache/Query/CacheQueriesTest.cs             |   52 +
 .../Compute/CancellationTest.cs                 |    4 +-
 .../Compute/ComputeApiTest.cs                   |   30 +-
 .../Config/Compute/compute-grid1.xml            |    1 +
 .../Config/Compute/compute-standalone.xml       |    4 +-
 .../Config/cache-binarizables.xml               |    4 +-
 .../native-client-test-cache-affinity.xml       |    1 +
 .../Apache.Ignite.Core.Tests/EventsTest.cs      |   13 +-
 .../IgniteConfigurationSerializerTest.cs        |    8 +-
 .../IgniteConfigurationTest.cs                  |    9 +-
 .../IgniteStartStopTest.cs                      |    2 +-
 .../Apache.Ignite.Core.Tests/MarshallerTest.cs  |   24 +-
 .../Apache.Ignite.Core.Tests/TestUtils.cs       |    4 +-
 .../Cache/Configuration/QueryEntity.cs          |   20 +
 .../Discovery/Tcp/TcpDiscoverySpi.cs            |   43 -
 .../dotnet/Apache.Ignite.Core/IIgnite.cs        |    3 +-
 .../Apache.Ignite.Core/IgniteConfiguration.cs   |   21 +
 .../IgniteConfigurationSection.xsd              |   36 +-
 .../Apache.Ignite.Core/Impl/Compute/Compute.cs  |   12 +
 .../Impl/Compute/ComputeImpl.cs                 |    2 +
 .../dotnet/Apache.Ignite.Core/Impl/Ignite.cs    |   14 +
 .../Impl/CacheQueryExpressionVisitor.cs         |   14 +-
 .../Impl/CacheQueryModelVisitor.cs              |   12 +-
 .../Datagrid/MultiTieredCacheExample.cs         |    2 +-
 modules/rocketmq/README.txt                     |   25 +
 modules/rocketmq/pom.xml                        |   81 +
 .../stream/rocketmq/RocketMQStreamer.java       |  151 ++
 .../ignite/stream/rocketmq/package-info.java    |   21 +
 .../stream/rocketmq/RocketMQStreamerTest.java   |  214 ++
 .../rocketmq/RocketMQStreamerTestSuite.java     |   37 +
 .../stream/rocketmq/TestRocketMQServer.java     |  148 ++
 .../ignite/stream/rocketmq/package-info.java    |   21 +
 .../scala/org/apache/ignite/scalar/scalar.scala |   19 +-
 .../scalar/src/test/resources/spring-cache.xml  |    1 +
 .../scalar/tests/ScalarCacheQueriesSpec.scala   |    2 +-
 .../spark/JavaEmbeddedIgniteRDDSelfTest.java    |    2 +-
 .../spark/JavaStandaloneIgniteRDDSelfTest.java  |    2 +-
 .../spring/GridSpringCacheManagerSelfTest.java  |    6 +-
 .../jdbc/CacheJdbcBlobStoreFactorySelfTest.java |    2 +-
 .../jdbc/CacheJdbcPojoStoreFactorySelfTest.java |    4 +-
 .../internal/IgniteDynamicCacheConfigTest.java  |    2 +-
 .../GridTransformSpringInjectionSelfTest.java   |    2 +-
 .../p2p/GridP2PUserVersionChangeSelfTest.java   |    8 +-
 .../IgniteStartFromStreamConfigurationTest.java |    4 +-
 .../GridSpringTransactionManagerSelfTest.java   |    2 +-
 .../twitter/IgniteTwitterStreamerTest.java      |    8 +-
 .../ignite/p2p/GridP2PDisabledSelfTest.java     |    4 +-
 .../cache/VisorCacheClearCommandSpec.scala      |   24 +-
 .../commands/cache/VisorCacheCommandSpec.scala  |    2 +-
 .../cache/VisorCacheResetCommandSpec.scala      |    8 +-
 .../list-of-registered-users.column-defs.js     |   26 +-
 .../list-of-registered-users.controller.js      |  163 +-
 .../list-of-registered-users.tpl.pug            |   25 +-
 .../frontend/app/primitives/badge/index.scss    |    1 +
 .../frontend/app/primitives/btn/index.scss      |   24 +-
 .../frontend/app/primitives/dropdown/index.pug  |    2 +-
 .../frontend/app/primitives/dropdown/index.scss |   26 +-
 .../frontend/app/primitives/panel/index.scss    |    2 +-
 .../app/primitives/ui-grid-header/index.scss    |   10 +-
 .../app/primitives/ui-grid-header/index.tpl.pug |   10 +-
 .../app/primitives/ui-grid-settings/index.scss  |   58 +-
 .../frontend/app/primitives/ui-grid/index.scss  |  149 +-
 .../frontend/gulpfile.babel.js/paths.js         |    1 +
 .../frontend/gulpfile.babel.js/tasks/bundle.js  |    2 +-
 .../webpack/environments/development.js         |    4 +-
 .../frontend/public/images/icons/cross.svg      |    1 +
 .../frontend/public/images/icons/export.svg     |    1 +
 .../frontend/public/images/icons/gear.svg       |    1 +
 .../stylesheets/_bootstrap-variables.scss       |    4 +-
 modules/web-console/licenses/cc-by-3.0.txt      |  319 +++
 .../webapp2/META-INF/ignite-webapp-config.xml   |    1 -
 .../stream/zeromq/IgniteZeroMqStreamerTest.java |   12 +-
 .../tcp/ipfinder/zk/ZookeeperIpFinderTest.java  |    5 +-
 parent/pom.xml                                  |    5 +
 pom.xml                                         |   10 +-
 967 files changed, 23690 insertions(+), 21068 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/07aa9bbe/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/07aa9bbe/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index ecbf475,a01bac6..ea9dfa5
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@@ -653,13 -705,11 +652,14 @@@ public class GridCacheProcessor extend
  
      /**
       * @param cfg Cache configuration.
 +     * @param caches Caches map.
 +     * @param templates Templates map.
       * @throws IgniteCheckedException If failed.
       */
 -    private void registerCache(CacheConfiguration<?, ?> cfg) throws IgniteCheckedException {
 +    private void registerCache(CacheConfiguration cfg,
 +        Map<String, CacheJoinNodeDiscoveryData.CacheInfo> caches,
 +        Map<String, CacheJoinNodeDiscoveryData.CacheInfo> templates) throws IgniteCheckedException {
+         assert cfg.getName() != null;
 -
          cloneCheckSerializable(cfg);
  
          CacheObjectContext cacheObjCtx = ctx.cacheObjects().contextForCache(cfg);
@@@ -667,19 -717,18 +667,19 @@@
          // Initialize defaults.
          initialize(cfg, cacheObjCtx);
  
-         boolean template = cfg.getName() != null && cfg.getName().endsWith("*");
 -        String cacheName = cfg.getName();
++        boolean template = cfg.getName().endsWith("*");
  
 -        if (cacheDescriptor(cfg.getName()) != null) {
 -            throw new IgniteCheckedException("Duplicate cache name found (check configuration and " +
 -                "assign unique name to each cache): " + cacheName);
 -        }
 +        if (!template) {
 +            if (caches.containsKey(cfg.getName())) {
 +                throw new IgniteCheckedException("Duplicate cache name found (check configuration and " +
 +                    "assign unique name to each cache): " + cfg.getName());
 +            }
  
 -        CacheType cacheType;
 +            CacheType cacheType;
  
-             if (CU.isUtilityCache(cfg.getName()))
+         if (CU.isUtilityCache(cfg.getName()))
                  cacheType = CacheType.UTILITY;
-             else if (internalCaches.contains(maskNull(cfg.getName())))
+             else if (internalCaches.contains(cfg.getName()))
                  cacheType = CacheType.INTERNAL;
              else
                  cacheType = CacheType.USER;
@@@ -910,45 -861,45 +912,45 @@@
              ctx.query().onCacheKernalStart();
  
              // Start dynamic caches received from collect discovery data.
 -            for (DynamicCacheDescriptor desc : cacheDescriptors()) {
 -                if (ctx.config().isDaemon())
 -                    continue;
 -
 -                desc.clearRemoteConfigurations();
 -
 -                CacheConfiguration ccfg = desc.cacheConfiguration();
 -
 -                IgnitePredicate filter = ccfg.getNodeFilter();
 -
 -                boolean loc = desc.locallyConfigured();
 -
 -                if (loc || (desc.receivedOnDiscovery() && CU.affinityNode(locNode, filter))) {
 -                    boolean started = desc.onStart();
 -
 -                    assert started : "Failed to change started flag for locally configured cache: " + desc;
 -
 -                    CacheObjectContext cacheObjCtx = ctx.cacheObjects().contextForCache(ccfg);
 -
 -                    CachePluginManager pluginMgr = desc.pluginManager();
 -
 -                    GridCacheContext ctx = createCache(
 -                        ccfg, pluginMgr, desc.cacheType(), cacheObjCtx, desc.updatesAllowed());
 -
 -                    ctx.dynamicDeploymentId(desc.deploymentId());
 -
 -                    sharedCtx.addCacheContext(ctx);
 -
 -                    GridCacheAdapter cache = ctx.cache();
 -
 -                    String name = ccfg.getName();
 -
 -                    caches.put(name, cache);
 -
 -                    startCache(cache, desc.schema());
 -
 -                    jCacheProxies.put(name, new IgniteCacheProxy(ctx, cache, null, false));
 -                }
 -            }
 +//            for (DynamicCacheDescriptor desc : cacheDescriptors()) {
 +//                if (ctx.config().isDaemon())
 +//                    continue;
 +//
 +//                desc.clearRemoteConfigurations();
 +//
 +//                CacheConfiguration ccfg = desc.cacheConfiguration();
 +//
 +//                IgnitePredicate filter = ccfg.getNodeFilter();
 +//
 +//                boolean loc = desc.locallyConfigured();
 +//
 +//                if (loc || (desc.receivedOnDiscovery() && CU.affinityNode(locNode, filter))) {
 +//                    boolean started = desc.onStart();
 +//
 +//                    assert started : "Failed to change started flag for locally configured cache: " + desc;
 +//
 +//                    CacheObjectContext cacheObjCtx = ctx.cacheObjects().contextForCache(ccfg);
 +//
 +//                    CachePluginManager pluginMgr = desc.pluginManager();
 +//
 +//                    GridCacheContext ctx = createCache(
 +//                        ccfg, pluginMgr, desc.cacheType(), cacheObjCtx, desc.updatesAllowed());
 +//
 +//                    ctx.dynamicDeploymentId(desc.deploymentId());
 +//
 +//                    sharedCtx.addCacheContext(ctx);
 +//
 +//                    GridCacheAdapter cache = ctx.cache();
 +//
 +//                    String name = ccfg.getName();
 +//
- //                    caches.put(maskNull(name), cache);
++//                    caches.put(name, cache);
 +//
 +//                    startCache(cache, desc.schema());
 +//
- //                    jCacheProxies.put(maskNull(name), new IgniteCacheProxy(ctx, cache, null, false));
++//                    jCacheProxies.put(name, new IgniteCacheProxy(ctx, cache, null, false));
 +//                }
 +//            }
          }
          finally {
              cacheStartedLatch.countDown();
@@@ -2817,13 -3030,13 +2829,13 @@@
  
                  assert ccfg != null : req;
  
-                 DynamicCacheDescriptor desc = cachesInfo.registeredTemplates().get(maskNull(req.cacheName()));
 -                DynamicCacheDescriptor desc = registeredTemplates.get(req.cacheName());
++                DynamicCacheDescriptor desc = cachesInfo.registeredTemplates().get(req.cacheName());
  
                  if (desc == null) {
                      DynamicCacheDescriptor templateDesc = new DynamicCacheDescriptor(ctx, ccfg, req.cacheType(), true,
                          req.deploymentId(), req.schema());
  
-                     DynamicCacheDescriptor old = cachesInfo.registeredTemplates().put(maskNull(ccfg.getName()), templateDesc);
 -                    DynamicCacheDescriptor old = registeredTemplates.put(ccfg.getName(), templateDesc);
++                    DynamicCacheDescriptor old = cachesInfo.registeredTemplates().put(ccfg.getName(), templateDesc);
  
                      assert old == null :
                          "Dynamic cache map was concurrently modified [new=" + templateDesc + ", old=" + old + ']';
@@@ -2947,7 -3159,7 +2959,7 @@@
  
                  if (desc != null) {
                      if (req.stop()) {
-                         DynamicCacheDescriptor old = cachesInfo.registeredCaches().remove(maskNull(req.cacheName()));
 -                        DynamicCacheDescriptor old = registeredCaches.remove(req.cacheName());
++                        DynamicCacheDescriptor old = cachesInfo.registeredCaches().remove(req.cacheName());
  
                          assert old != null : "Dynamic cache map was concurrently modified [req=" + req + ']';
  
@@@ -3437,9 -3661,11 +3446,11 @@@
       * @throws IgniteCheckedException If failed.
       */
      public void addCacheConfiguration(CacheConfiguration cacheCfg) throws IgniteCheckedException {
-         String masked = maskNull(cacheCfg.getName());
+         assert cacheCfg.getName() != null;
+ 
+         String masked = cacheCfg.getName();
  
 -        DynamicCacheDescriptor desc = registeredTemplates.get(masked);
 +        DynamicCacheDescriptor desc = cachesInfo.registeredTemplates().get(masked);
  
          if (desc != null)
              return;


[15/51] [abbrv] ignite git commit: ignite-1794 Refactored hibernate modules, switched to hibernate 5.1

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java
new file mode 100644
index 0000000..c87f08f
--- /dev/null
+++ b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java
@@ -0,0 +1,542 @@
+/*
+ * 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.cache.store.hibernate;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicBoolean;
+import javax.cache.integration.CacheLoaderException;
+import javax.cache.integration.CacheWriterException;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.cache.store.CacheStoreAdapter;
+import org.apache.ignite.cache.store.CacheStoreSession;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.marshaller.jdk.JdkMarshaller;
+import org.apache.ignite.resources.CacheStoreSessionResource;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.resources.LoggerResource;
+import org.apache.ignite.transactions.Transaction;
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.SharedSessionContract;
+import org.hibernate.cfg.Configuration;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * {@link CacheStore} implementation backed by Hibernate. This implementation
+ * stores objects in underlying database in {@code BLOB} format.
+ * <h2 class="header">Configuration</h2>
+ * Either {@link #setSessionFactory(SessionFactory)} or
+ * {@link #setHibernateConfigurationPath(String)} or
+ * {@link #setHibernateProperties(Properties)} should be set.
+ * <p>
+ * If session factory is provided it should contain
+ * {@link CacheHibernateBlobStoreEntry} persistent class (via provided
+ * mapping file {@code GridCacheHibernateStoreEntry.hbm.xml} or by
+ * adding {@link CacheHibernateBlobStoreEntry} to annotated classes
+ * of session factory.
+ * <p>
+ * Path to hibernate configuration may be either an URL or a file path or
+ * a classpath resource. This configuration file should include provided
+ * mapping {@code GridCacheHibernateStoreEntry.hbm.xml} or include annotated
+ * class {@link CacheHibernateBlobStoreEntry}.
+ * <p>
+ * If hibernate properties are provided, mapping
+ * {@code GridCacheHibernateStoreEntry.hbm.xml} is included automatically.
+ * <p>
+ * Use {@link CacheHibernateBlobStoreFactory} factory to pass {@link CacheHibernateBlobStore} to {@link CacheConfiguration}.
+ */
+public class CacheHibernateBlobStore<K, V> extends CacheStoreAdapter<K, V> {
+    /**
+     * Default connection URL
+     * (value is <tt>jdbc:h2:mem:hibernateCacheStore;DB_CLOSE_DELAY=-1;DEFAULT_LOCK_TIMEOUT=5000</tt>).
+     */
+    public static final String DFLT_CONN_URL = "jdbc:h2:mem:hibernateCacheStore;DB_CLOSE_DELAY=-1;" +
+        "DEFAULT_LOCK_TIMEOUT=5000";
+
+    /** Default show SQL property value (value is <tt>true</tt>). */
+    public static final String DFLT_SHOW_SQL = "true";
+
+    /** Default <tt>hibernate.hbm2ddl.auto</tt> property value (value is <tt>true</tt>). */
+    public static final String DFLT_HBM2DDL_AUTO = "update";
+
+    /** Session attribute name. */
+    private static final String ATTR_SES = "HIBERNATE_STORE_SESSION";
+
+    /** Name of Hibarname mapping resource. */
+    private static final String MAPPING_RESOURCE =
+            "org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml";
+
+    /** Marshaller. */
+    private static final Marshaller marsh = new JdkMarshaller();
+
+    /** Init guard. */
+    @GridToStringExclude
+    private final AtomicBoolean initGuard = new AtomicBoolean();
+
+    /** Init latch. */
+    @GridToStringExclude
+    private final CountDownLatch initLatch = new CountDownLatch(1);
+
+    /** Hibernate properties. */
+    @GridToStringExclude
+    private Properties hibernateProps;
+
+    /** Session factory. */
+    @GridToStringExclude
+    private SessionFactory sesFactory;
+
+    /** Path to hibernate configuration file. */
+    private String hibernateCfgPath;
+
+    /** Log. */
+    @LoggerResource
+    private IgniteLogger log;
+
+    /** Auto-injected store session. */
+    @CacheStoreSessionResource
+    private CacheStoreSession ses;
+
+    /** Ignite instance. */
+    @IgniteInstanceResource
+    private Ignite ignite;
+
+    /** {@inheritDoc} */
+    @SuppressWarnings({"unchecked", "RedundantTypeArguments"})
+    @Override public V load(K key) {
+        init();
+
+        Transaction tx = transaction();
+
+        if (log.isDebugEnabled())
+            log.debug("Store load [key=" + key + ", tx=" + tx + ']');
+
+        Session ses = session(tx);
+
+        try {
+            CacheHibernateBlobStoreEntry entry = (CacheHibernateBlobStoreEntry)
+                ses.get(CacheHibernateBlobStoreEntry.class, toBytes(key));
+
+            if (entry == null)
+                return null;
+
+            return fromBytes(entry.getValue());
+        }
+        catch (IgniteCheckedException | HibernateException e) {
+            rollback(ses, tx);
+
+            throw new CacheLoaderException("Failed to load value from cache store with key: " + key, e);
+        }
+        finally {
+            end(ses, tx);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void write(javax.cache.Cache.Entry<? extends K, ? extends V> entry) {
+        init();
+
+        Transaction tx = transaction();
+
+        K key = entry.getKey();
+        V val = entry.getValue();
+
+        if (log.isDebugEnabled())
+            log.debug("Store put [key=" + key + ", val=" + val + ", tx=" + tx + ']');
+
+        if (val == null) {
+            delete(key);
+
+            return;
+        }
+
+        Session ses = session(tx);
+
+        try {
+            CacheHibernateBlobStoreEntry entry0 = new CacheHibernateBlobStoreEntry(toBytes(key), toBytes(val));
+
+            ses.saveOrUpdate(entry0);
+        }
+        catch (IgniteCheckedException | HibernateException e) {
+            rollback(ses, tx);
+
+            throw new CacheWriterException("Failed to put value to cache store [key=" + key + ", val" + val + "]", e);
+        }
+        finally {
+            end(ses, tx);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings({"JpaQueryApiInspection", "JpaQlInspection"})
+    @Override public void delete(Object key) {
+        init();
+
+        Transaction tx = transaction();
+
+        if (log.isDebugEnabled())
+            log.debug("Store remove [key=" + key + ", tx=" + tx + ']');
+
+        Session ses = session(tx);
+
+        try {
+            Object obj = ses.get(CacheHibernateBlobStoreEntry.class, toBytes(key));
+
+            if (obj != null)
+                ses.delete(obj);
+        }
+        catch (IgniteCheckedException | HibernateException e) {
+            rollback(ses, tx);
+
+            throw new CacheWriterException("Failed to remove value from cache store with key: " + key, e);
+        }
+        finally {
+            end(ses, tx);
+        }
+    }
+
+    /**
+     * Rolls back hibernate session.
+     *
+     * @param ses Hibernate session.
+     * @param tx Cache ongoing transaction.
+     */
+    private void rollback(SharedSessionContract ses, Transaction tx) {
+        // Rollback only if there is no cache transaction,
+        // otherwise sessionEnd() will do all required work.
+        if (tx == null) {
+            org.hibernate.Transaction hTx = ses.getTransaction();
+
+            if (hTx != null && hTx.isActive())
+                hTx.rollback();
+        }
+    }
+
+    /**
+     * Ends hibernate session.
+     *
+     * @param ses Hibernate session.
+     * @param tx Cache ongoing transaction.
+     */
+    private void end(Session ses, Transaction tx) {
+        // Commit only if there is no cache transaction,
+        // otherwise sessionEnd() will do all required work.
+        if (tx == null) {
+            org.hibernate.Transaction hTx = ses.getTransaction();
+
+            if (hTx != null && hTx.isActive())
+                hTx.commit();
+
+            ses.close();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void sessionEnd(boolean commit) {
+        init();
+
+        Transaction tx = transaction();
+
+        Map<String, Session> props = session().properties();
+
+        Session ses = props.remove(ATTR_SES);
+
+        if (ses != null) {
+            org.hibernate.Transaction hTx = ses.getTransaction();
+
+            if (hTx != null) {
+                try {
+                    if (commit) {
+                        ses.flush();
+
+                        hTx.commit();
+                    }
+                    else
+                        hTx.rollback();
+
+                    if (log.isDebugEnabled())
+                        log.debug("Transaction ended [xid=" + tx.xid() + ", commit=" + commit + ']');
+                }
+                catch (HibernateException e) {
+                    throw new CacheWriterException("Failed to end transaction [xid=" + tx.xid() +
+                        ", commit=" + commit + ']', e);
+                }
+                finally {
+                    ses.close();
+                }
+            }
+        }
+    }
+
+    /**
+     * Gets Hibernate session.
+     *
+     * @param tx Cache transaction.
+     * @return Session.
+     */
+    Session session(@Nullable Transaction tx) {
+        Session ses;
+
+        if (tx != null) {
+            Map<String, Session> props = session().properties();
+
+            ses = props.get(ATTR_SES);
+
+            if (ses == null) {
+                ses = sesFactory.openSession();
+
+                ses.beginTransaction();
+
+                // Store session in transaction metadata, so it can be accessed
+                // for other operations on the same transaction.
+                props.put(ATTR_SES, ses);
+
+                if (log.isDebugEnabled())
+                    log.debug("Hibernate session open [ses=" + ses + ", tx=" + tx.xid() + "]");
+            }
+        }
+        else {
+            ses = sesFactory.openSession();
+
+            ses.beginTransaction();
+        }
+
+        return ses;
+    }
+
+    /**
+     * Sets session factory.
+     *
+     * @param sesFactory Session factory.
+     */
+    public void setSessionFactory(SessionFactory sesFactory) {
+        this.sesFactory = sesFactory;
+    }
+
+    /**
+     * Sets hibernate configuration path.
+     * <p>
+     * This may be either URL or file path or classpath resource.
+     *
+     * @param hibernateCfgPath URL or file path or classpath resource
+     *      pointing to hibernate configuration XML file.
+     */
+    public void setHibernateConfigurationPath(String hibernateCfgPath) {
+        this.hibernateCfgPath = hibernateCfgPath;
+    }
+
+    /**
+     * Sets Hibernate properties.
+     *
+     * @param hibernateProps Hibernate properties.
+     */
+    public void setHibernateProperties(Properties hibernateProps) {
+        this.hibernateProps = hibernateProps;
+    }
+
+    /**
+     * Initializes store.
+     *
+     * @throws IgniteException If failed to initialize.
+     */
+    private void init() throws IgniteException {
+        if (initGuard.compareAndSet(false, true)) {
+            if (log.isDebugEnabled())
+                log.debug("Initializing cache store.");
+
+            try {
+                if (sesFactory != null)
+                    // Session factory has been provided - nothing to do.
+                    return;
+
+                if (!F.isEmpty(hibernateCfgPath)) {
+                    try {
+                        URL url = new URL(hibernateCfgPath);
+
+                        sesFactory = new Configuration().configure(url).buildSessionFactory();
+
+                        if (log.isDebugEnabled())
+                            log.debug("Configured session factory using URL: " + url);
+
+                        // Session factory has been successfully initialized.
+                        return;
+                    }
+                    catch (MalformedURLException e) {
+                        if (log.isDebugEnabled())
+                            log.debug("Caught malformed URL exception: " + e.getMessage());
+                    }
+
+                    // Provided path is not a valid URL. File?
+                    File cfgFile = new File(hibernateCfgPath);
+
+                    if (cfgFile.exists()) {
+                        sesFactory = new Configuration().configure(cfgFile).buildSessionFactory();
+
+                        if (log.isDebugEnabled())
+                            log.debug("Configured session factory using file: " + hibernateCfgPath);
+
+                        // Session factory has been successfully initialized.
+                        return;
+                    }
+
+                    // Provided path is not a file. Classpath resource?
+                    sesFactory = new Configuration().configure(hibernateCfgPath).buildSessionFactory();
+
+                    if (log.isDebugEnabled())
+                        log.debug("Configured session factory using classpath resource: " + hibernateCfgPath);
+                }
+                else {
+                    if (hibernateProps == null) {
+                        U.warn(log, "No Hibernate configuration has been provided for store (will use default).");
+
+                        hibernateProps = new Properties();
+
+                        hibernateProps.setProperty("hibernate.connection.url", DFLT_CONN_URL);
+                        hibernateProps.setProperty("hibernate.show_sql", DFLT_SHOW_SQL);
+                        hibernateProps.setProperty("hibernate.hbm2ddl.auto", DFLT_HBM2DDL_AUTO);
+                    }
+
+                    Configuration cfg = new Configuration();
+
+                    cfg.setProperties(hibernateProps);
+
+                    assert resourceAvailable(MAPPING_RESOURCE) : MAPPING_RESOURCE;
+
+                    cfg.addResource(MAPPING_RESOURCE);
+
+                    sesFactory = cfg.buildSessionFactory();
+
+                    if (log.isDebugEnabled())
+                        log.debug("Configured session factory using properties: " + hibernateProps);
+                }
+            }
+            catch (HibernateException e) {
+                throw new IgniteException("Failed to initialize store.", e);
+            }
+            finally {
+                initLatch.countDown();
+            }
+        }
+        else if (initLatch.getCount() > 0) {
+            try {
+                U.await(initLatch);
+            }
+            catch (IgniteInterruptedCheckedException e) {
+                throw new IgniteException(e);
+            }
+        }
+
+        if (sesFactory == null)
+            throw new IgniteException("Cache store was not properly initialized.");
+    }
+
+    /**
+     * Checks availability of a classpath resource.
+     *
+     * @param name Resource name.
+     * @return {@code true} if resource is available and ready for read, {@code false} otherwise.
+     */
+    private boolean resourceAvailable(String name) {
+        InputStream cfgStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
+
+        if (cfgStream == null) {
+            log.error("Classpath resource not found: " + name);
+
+            return false;
+        }
+
+        try {
+            // Read a single byte to force actual content access by JVM.
+            cfgStream.read();
+
+            return true;
+        }
+        catch (IOException e) {
+            log.error("Failed to read classpath resource: " + name, e);
+
+            return false;
+        }
+        finally {
+            U.close(cfgStream, log);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(CacheHibernateBlobStore.class, this);
+    }
+
+    /**
+     * Serialize object to byte array using marshaller.
+     *
+     * @param obj Object to convert to byte array.
+     * @return Byte array.
+     * @throws IgniteCheckedException If failed to convert.
+     */
+    protected byte[] toBytes(Object obj) throws IgniteCheckedException {
+        return U.marshal(marsh, obj);
+    }
+
+    /**
+     * Deserialize object from byte array using marshaller.
+     *
+     * @param bytes Bytes to deserialize.
+     * @param <X> Result object type.
+     * @return Deserialized object.
+     * @throws IgniteCheckedException If failed.
+     */
+    protected <X> X fromBytes(byte[] bytes) throws IgniteCheckedException {
+        if (bytes == null || bytes.length == 0)
+            return null;
+
+        return U.unmarshal(marsh, bytes, getClass().getClassLoader());
+    }
+
+    /**
+     * @return Current transaction.
+     */
+    @Nullable private Transaction transaction() {
+        CacheStoreSession ses = session();
+
+        return ses != null ? ses.transaction() : null;
+    }
+
+    /**
+     * @return Store session.
+     */
+    private CacheStoreSession session() {
+        return ses;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml
new file mode 100644
index 0000000..5b0be43
--- /dev/null
+++ b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+
+<!DOCTYPE hibernate-mapping PUBLIC
+        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping package="org.apache.ignite.examples.datagrid.store" default-access="field">
+    <class name="org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreEntry" table="ENTRIES">
+        <id name="key"/>
+
+        <property name="val"/>
+    </class>
+</hibernate-mapping>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.java b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.java
new file mode 100644
index 0000000..d40c5ef
--- /dev/null
+++ b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.java
@@ -0,0 +1,89 @@
+/*
+ * 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.cache.store.hibernate;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+/**
+ * Entry that is used by {@link CacheHibernateBlobStore} implementation.
+ * <p>
+ * Note that this is a reference implementation for tests only.
+ * When running on production systems use concrete key-value types to
+ * get better performance.
+ */
+@Entity
+@Table(name = "ENTRIES")
+public class CacheHibernateBlobStoreEntry {
+    /** Key (use concrete key type in production). */
+    @Id
+    @Column(length = 65535)
+    private byte[] key;
+
+    /** Value (use concrete value type in production). */
+    @Column(length = 65535)
+    private byte[] val;
+
+    /**
+     * Constructor.
+     */
+    CacheHibernateBlobStoreEntry() {
+        // No-op.
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param key Key.
+     * @param val Value.
+     */
+    CacheHibernateBlobStoreEntry(byte[] key, byte[] val) {
+        this.key = key;
+        this.val = val;
+    }
+
+    /**
+     * @return Key.
+     */
+    public byte[] getKey() {
+        return key;
+    }
+
+    /**
+     * @param key Key.
+     */
+    public void setKey(byte[] key) {
+        this.key = key;
+    }
+
+    /**
+     * @return Value.
+     */
+    public byte[] getValue() {
+        return val;
+    }
+
+    /**
+     * @param val Value.
+     */
+    public void setValue(byte[] val) {
+        this.val = val;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreFactory.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreFactory.java b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreFactory.java
new file mode 100644
index 0000000..ea4df8a
--- /dev/null
+++ b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreFactory.java
@@ -0,0 +1,235 @@
+/*
+ * 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.cache.store.hibernate;
+
+import java.util.Properties;
+import javax.cache.configuration.Factory;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.IgniteComponentType;
+import org.apache.ignite.internal.util.spring.IgniteSpringHelper;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.resources.SpringApplicationContextResource;
+import org.hibernate.SessionFactory;
+
+/**
+ * {@link Factory} implementation for {@link CacheHibernateBlobStore}.
+ *
+ * Use this factory to pass {@link CacheHibernateBlobStore} to {@link CacheConfiguration}.
+ *
+ * <h2 class="header">Java Example</h2>
+ * In this example existing session factory is provided.
+ * <pre name="code" class="java">
+ *     ...
+ *     CacheHibernateBlobStoreFactory&lt;String, String&gt; factory = new CacheHibernateBlobStoreFactory&lt;String, String&gt;();
+ *
+ *     factory.setSessionFactory(sesFactory);
+ *     ...
+ * </pre>
+ *
+ * <h2 class="header">Spring Example (using Spring ORM)</h2>
+ * <pre name="code" class="xml">
+ *   ...
+ *   &lt;bean id=&quot;cache.hibernate.store.factory&quot;
+ *       class=&quot;org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory&quot;&gt;
+ *       &lt;property name=&quot;sessionFactory&quot;&gt;
+ *           &lt;bean class=&quot;org.springframework.orm.hibernate3.LocalSessionFactoryBean&quot;&gt;
+ *               &lt;property name=&quot;hibernateProperties&quot;&gt;
+ *                   &lt;value&gt;
+ *                       connection.url=jdbc:h2:mem:
+ *                       show_sql=true
+ *                       hbm2ddl.auto=true
+ *                       hibernate.dialect=org.hibernate.dialect.H2Dialect
+ *                   &lt;/value&gt;
+ *               &lt;/property&gt;
+ *               &lt;property name=&quot;mappingResources&quot;&gt;
+ *                   &lt;list&gt;
+ *                       &lt;value&gt;
+ *                           org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml
+ *                       &lt;/value&gt;
+ *                   &lt;/list&gt;
+ *               &lt;/property&gt;
+ *           &lt;/bean&gt;
+ *       &lt;/property&gt;
+ *   &lt;/bean&gt;
+ *   ...
+ * </pre>
+ *
+ * <h2 class="header">Spring Example (using Spring ORM and persistent annotations)</h2>
+ * <pre name="code" class="xml">
+ *     ...
+ *     &lt;bean id=&quot;cache.hibernate.store.factory1&quot;
+ *         class=&quot;org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory&quot;&gt;
+ *         &lt;property name=&quot;sessionFactory&quot;&gt;
+ *             &lt;bean class=&quot;org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean&quot;&gt;
+ *                 &lt;property name=&quot;hibernateProperties&quot;&gt;
+ *                     &lt;value&gt;
+ *                         connection.url=jdbc:h2:mem:
+ *                         show_sql=true
+ *                         hbm2ddl.auto=true
+ *                         hibernate.dialect=org.hibernate.dialect.H2Dialect
+ *                     &lt;/value&gt;
+ *                 &lt;/property&gt;
+ *                 &lt;property name=&quot;annotatedClasses&quot;&gt;
+ *                     &lt;list&gt;
+ *                         &lt;value&gt;
+ *                             org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreEntry
+ *                         &lt;/value&gt;
+ *                     &lt;/list&gt;
+ *                 &lt;/property&gt;
+ *             &lt;/bean&gt;
+ *         &lt;/property&gt;
+ *     &lt;/bean&gt;
+ *     ...
+ * </pre>
+ *
+ * <h2 class="header">Spring Example</h2>
+ * <pre name="code" class="xml">
+ *     ...
+ *     &lt;bean id=&quot;cache.hibernate.store.factory2&quot;
+ *         class=&quot;org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory&quot;&gt;
+ *         &lt;property name=&quot;hibernateProperties&quot;&gt;
+ *             &lt;props&gt;
+ *                 &lt;prop key=&quot;connection.url&quot;&gt;jdbc:h2:mem:&lt;/prop&gt;
+ *                 &lt;prop key=&quot;hbm2ddl.auto&quot;&gt;update&lt;/prop&gt;
+ *                 &lt;prop key=&quot;show_sql&quot;&gt;true&lt;/prop&gt;
+ *             &lt;/props&gt;
+ *         &lt;/property&gt;
+ *     &lt;/bean&gt;
+ *     ...
+ * </pre>
+ * <p>
+ * <img src="http://ignite.apache.org/images/spring-small.png">
+ * <br>
+ * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
+ */
+public class CacheHibernateBlobStoreFactory<K, V> implements Factory<CacheHibernateBlobStore<K, V>> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Session factory. */
+    @GridToStringExclude
+    private transient SessionFactory sesFactory;
+
+    /** Session factory bean name. */
+    private String sesFactoryBean;
+
+    /** Path to hibernate configuration file. */
+    private String hibernateCfgPath;
+
+    /** Hibernate properties. */
+    @GridToStringExclude
+    private Properties hibernateProps;
+
+    /** Application context. */
+    @SpringApplicationContextResource
+    private Object appContext;
+
+    /** {@inheritDoc} */
+    @Override public CacheHibernateBlobStore<K, V> create() {
+        CacheHibernateBlobStore<K, V> store = new CacheHibernateBlobStore<>();
+
+        store.setHibernateConfigurationPath(hibernateCfgPath);
+        store.setHibernateProperties(hibernateProps);
+
+        if (sesFactory != null)
+            store.setSessionFactory(sesFactory);
+        else if (sesFactoryBean != null) {
+            if (appContext == null)
+                throw new IgniteException("Spring application context resource is not injected.");
+
+            IgniteSpringHelper spring;
+
+            try {
+                spring = IgniteComponentType.SPRING.create(false);
+
+                SessionFactory sesFac = spring.loadBeanFromAppContext(appContext, sesFactoryBean);
+
+                store.setSessionFactory(sesFac);
+            }
+            catch (IgniteCheckedException e) {
+                throw new IgniteException("Failed to load bean in application context [beanName=" + sesFactoryBean +
+                        ", igniteConfig=" + appContext + ']');
+            }
+        }
+
+        return store;
+    }
+
+    /**
+     * Sets session factory.
+     *
+     * @param sesFactory Session factory.
+     * @return {@code This} for chaining.
+     * @see CacheHibernateBlobStore#setSessionFactory(SessionFactory)
+     */
+    public CacheHibernateBlobStoreFactory<K, V> setSessionFactory(SessionFactory sesFactory) {
+        this.sesFactory = sesFactory;
+
+        return this;
+    }
+
+    /**
+     * Sets name of the data source bean.
+     *
+     * @param sesFactory Session factory bean name.
+     * @return {@code This} for chaining.
+     * @see CacheHibernateBlobStore#setSessionFactory(SessionFactory)
+     */
+    public CacheHibernateBlobStoreFactory<K, V> setSessionFactoryBean(String sesFactory) {
+        this.sesFactoryBean = sesFactory;
+
+        return this;
+    }
+
+    /**
+     * Sets hibernate configuration path.
+     * <p>
+     * This may be either URL or file path or classpath resource.
+     *
+     * @param hibernateCfgPath URL or file path or classpath resource
+     *      pointing to hibernate configuration XML file.
+     * @return {@code This} for chaining.
+     * @see CacheHibernateBlobStore#setHibernateConfigurationPath(String)
+     */
+    public CacheHibernateBlobStoreFactory<K, V> setHibernateConfigurationPath(String hibernateCfgPath) {
+        this.hibernateCfgPath = hibernateCfgPath;
+
+        return this;
+    }
+
+    /**
+     * Sets Hibernate properties.
+     *
+     * @param hibernateProps Hibernate properties.
+     * @return {@code This} for chaining.
+     * @see CacheHibernateBlobStore#setHibernateProperties(Properties)
+     */
+    public CacheHibernateBlobStoreFactory<K, V> setHibernateProperties(Properties hibernateProps) {
+        this.hibernateProps = hibernateProps;
+
+        return this;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(CacheHibernateBlobStoreFactory.class, this);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListener.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListener.java b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListener.java
new file mode 100644
index 0000000..917641c
--- /dev/null
+++ b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListener.java
@@ -0,0 +1,222 @@
+/*
+ * 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.cache.store.hibernate;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import javax.cache.integration.CacheWriterException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.cache.store.CacheStoreSession;
+import org.apache.ignite.cache.store.CacheStoreSessionListener;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lifecycle.LifecycleAware;
+import org.apache.ignite.resources.LoggerResource;
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
+
+/**
+ * Hibernate-based cache store session listener.
+ * <p>
+ * This listener creates a new Hibernate session for each store
+ * session. If there is an ongoing cache transaction, a corresponding
+ * Hibernate transaction is created as well.
+ * <p>
+ * The Hibernate session is saved as a store session
+ * {@link CacheStoreSession#attachment() attachment}.
+ * The listener guarantees that the session will be
+ * available for any store operation. If there is an
+ * ongoing cache transaction, all operations within this
+ * transaction will share a DB transaction.
+ * <p>
+ * As an example, here is how the {@link CacheStore#write(javax.cache.Cache.Entry)}
+ * method can be implemented if {@link CacheHibernateStoreSessionListener}
+ * is configured:
+ * <pre name="code" class="java">
+ * private static class Store extends CacheStoreAdapter&lt;Integer, Integer&gt; {
+ *     &#64;CacheStoreSessionResource
+ *     private CacheStoreSession ses;
+ *
+ *     &#64;Override public void write(Cache.Entry&lt;? extends Integer, ? extends Integer&gt; entry) throws CacheWriterException {
+ *         // Get Hibernate session from the current store session.
+ *         Session hibSes = ses.attachment();
+ *
+ *         // Persist the value.
+ *         hibSes.persist(entry.getValue());
+ *     }
+ * }
+ * </pre>
+ * Hibernate session will be automatically created by the listener
+ * at the start of the session and closed when it ends.
+ * <p>
+ * {@link CacheHibernateStoreSessionListener} requires that either
+ * {@link #setSessionFactory(SessionFactory)} session factory}
+ * or {@link #setHibernateConfigurationPath(String) Hibernate configuration file}
+ * is provided. If non of them is set, exception is thrown. Is both are provided,
+ * session factory will be used.
+ */
+public class CacheHibernateStoreSessionListener implements CacheStoreSessionListener, LifecycleAware {
+    /** Hibernate session factory. */
+    private SessionFactory sesFactory;
+
+    /** Hibernate configuration file path. */
+    private String hibernateCfgPath;
+
+    /** Logger. */
+    @LoggerResource
+    private IgniteLogger log;
+
+    /** Whether to close session on stop. */
+    private boolean closeSesOnStop;
+
+    /**
+     * Sets Hibernate session factory.
+     * <p>
+     * Either session factory or configuration file is required.
+     * If none is provided, exception will be thrown on startup.
+     *
+     * @param sesFactory Session factory.
+     */
+    public void setSessionFactory(SessionFactory sesFactory) {
+        this.sesFactory = sesFactory;
+    }
+
+    /**
+     * Gets Hibernate session factory.
+     *
+     * @return Session factory.
+     */
+    public SessionFactory getSessionFactory() {
+        return sesFactory;
+    }
+
+    /**
+     * Sets hibernate configuration path.
+     * <p>
+     * Either session factory or configuration file is required.
+     * If none is provided, exception will be thrown on startup.
+     *
+     * @param hibernateCfgPath Hibernate configuration path.
+     */
+    public void setHibernateConfigurationPath(String hibernateCfgPath) {
+        this.hibernateCfgPath = hibernateCfgPath;
+    }
+
+    /**
+     * Gets hibernate configuration path.
+     *
+     * @return Hibernate configuration path.
+     */
+    public String getHibernateConfigurationPath() {
+        return hibernateCfgPath;
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("deprecation")
+    @Override public void start() throws IgniteException {
+        if (sesFactory == null && F.isEmpty(hibernateCfgPath))
+            throw new IgniteException("Either session factory or Hibernate configuration file is required by " +
+                getClass().getSimpleName() + '.');
+
+        if (!F.isEmpty(hibernateCfgPath)) {
+            if (sesFactory == null) {
+                try {
+                    URL url = new URL(hibernateCfgPath);
+
+                    sesFactory = new Configuration().configure(url).buildSessionFactory();
+                }
+                catch (MalformedURLException ignored) {
+                    // No-op.
+                }
+
+                if (sesFactory == null) {
+                    File cfgFile = new File(hibernateCfgPath);
+
+                    if (cfgFile.exists())
+                        sesFactory = new Configuration().configure(cfgFile).buildSessionFactory();
+                }
+
+                if (sesFactory == null)
+                    sesFactory = new Configuration().configure(hibernateCfgPath).buildSessionFactory();
+
+                if (sesFactory == null)
+                    throw new IgniteException("Failed to resolve Hibernate configuration file: " + hibernateCfgPath);
+
+                closeSesOnStop = true;
+            }
+            else
+                U.warn(log, "Hibernate configuration file configured in " + getClass().getSimpleName() +
+                    " will be ignored (session factory is already set).");
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void stop() throws IgniteException {
+        if (closeSesOnStop && sesFactory != null && !sesFactory.isClosed())
+            sesFactory.close();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onSessionStart(CacheStoreSession ses) {
+        if (ses.attachment() == null) {
+            try {
+                Session hibSes = sesFactory.openSession();
+
+                ses.attach(hibSes);
+
+                if (ses.isWithinTransaction())
+                    hibSes.beginTransaction();
+            }
+            catch (HibernateException e) {
+                throw new CacheWriterException("Failed to start store session [tx=" + ses.transaction() + ']', e);
+            }
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void onSessionEnd(CacheStoreSession ses, boolean commit) {
+        Session hibSes = ses.attach(null);
+
+        if (hibSes != null) {
+            try {
+                Transaction tx = hibSes.getTransaction();
+
+                if (commit) {
+                    hibSes.flush();
+
+                    if (tx.isActive())
+                        tx.commit();
+                }
+                else if (tx.isActive())
+                    tx.rollback();
+            }
+            catch (HibernateException e) {
+                throw new CacheWriterException("Failed to end store session [tx=" + ses.transaction() + ']', e);
+            }
+            finally {
+                hibSes.close();
+            }
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/package-info.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/package-info.java b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/package-info.java
new file mode 100644
index 0000000..891d99a
--- /dev/null
+++ b/modules/hibernate-4.2/src/main/java/org/apache/ignite/cache/store/hibernate/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * 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 description. -->
+ * Contains reference Hibernate-based cache store implementation.
+ */
+package org.apache.ignite.cache.store.hibernate;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/test/config/factory-cache.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/config/factory-cache.xml b/modules/hibernate-4.2/src/test/config/factory-cache.xml
new file mode 100644
index 0000000..a251846
--- /dev/null
+++ b/modules/hibernate-4.2/src/test/config/factory-cache.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean id="simpleSessionFactory"
+          class="org.apache.ignite.cache.store.hibernate.CacheHibernateStoreFactorySelfTest$DummySessionFactoryExt"/>
+
+    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+        <property name="cacheConfiguration">
+            <list>
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="test"/>
+                    <property name="atomicityMode" value="ATOMIC"/>
+                    <property name="backups" value="1"/>
+                    <property name="cacheStoreFactory">
+                        <bean class="org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory">
+                            <property name="sessionFactoryBean" value = "simpleSessionFactory"/>
+                        </bean>
+                    </property>
+                </bean>
+            </list>
+        </property>
+
+        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <value>127.0.0.1:47500..47509</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/test/config/factory-cache1.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/config/factory-cache1.xml b/modules/hibernate-4.2/src/test/config/factory-cache1.xml
new file mode 100644
index 0000000..7a53b1f
--- /dev/null
+++ b/modules/hibernate-4.2/src/test/config/factory-cache1.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean id="simpleSessionFactory1"
+          class="org.apache.ignite.cache.store.hibernate.CacheHibernateStoreFactorySelfTest$DummySessionFactory"/>
+
+    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+        <property name="igniteInstanceName" value="ignite1"/>
+
+        <property name="cacheConfiguration">
+            <list>
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="test"/>
+                    <property name="atomicityMode" value="ATOMIC"/>
+                    <property name="backups" value="1"/>
+                    <property name="cacheStoreFactory">
+                        <bean class="org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory">
+                            <property name="sessionFactoryBean" value = "simpleSessionFactory1"/>
+                        </bean>
+                    </property>
+                </bean>
+            </list>
+        </property>
+
+        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <value>127.0.0.1:47500..47509</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/test/config/factory-incorrect-store-cache.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/config/factory-incorrect-store-cache.xml b/modules/hibernate-4.2/src/test/config/factory-incorrect-store-cache.xml
new file mode 100644
index 0000000..459930c
--- /dev/null
+++ b/modules/hibernate-4.2/src/test/config/factory-incorrect-store-cache.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
+        <property name="cacheConfiguration">
+            <list>
+                <bean class="org.apache.ignite.configuration.CacheConfiguration">
+                    <property name="name" value="test"/>
+                    <property name="atomicityMode" value="ATOMIC"/>
+                    <property name="backups" value="1"/>
+                    <property name="cacheStoreFactory">
+                        <bean class="org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory">
+                            <property name="sessionFactoryBean" value = "simpleSessionFactory1"/>
+                        </bean>
+                    </property>
+                </bean>
+            </list>
+        </property>
+
+        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
+        <property name="discoverySpi">
+            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
+                <property name="ipFinder">
+                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
+                        <property name="addresses">
+                            <list>
+                                <value>127.0.0.1:47500..47509</value>
+                            </list>
+                        </property>
+                    </bean>
+                </property>
+            </bean>
+        </property>
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java
new file mode 100644
index 0000000..cb179c4
--- /dev/null
+++ b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java
@@ -0,0 +1,409 @@
+/*
+ * 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.cache.hibernate;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import javax.cache.Cache;
+import javax.persistence.Cacheable;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+import org.hibernate.cache.spi.access.AccessType;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.service.ServiceRegistryBuilder;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.hibernate.HibernateAccessStrategyFactory.DFLT_ACCESS_TYPE_PROPERTY;
+import static org.apache.ignite.cache.hibernate.HibernateAccessStrategyFactory.DFLT_CACHE_NAME_PROPERTY;
+import static org.apache.ignite.cache.hibernate.HibernateAccessStrategyFactory.IGNITE_INSTANCE_NAME_PROPERTY;
+import static org.apache.ignite.cache.hibernate.HibernateAccessStrategyFactory.REGION_CACHE_PROPERTY;
+import static org.hibernate.cfg.AvailableSettings.CACHE_REGION_FACTORY;
+import static org.hibernate.cfg.AvailableSettings.GENERATE_STATISTICS;
+import static org.hibernate.cfg.AvailableSettings.HBM2DDL_AUTO;
+import static org.hibernate.cfg.AvailableSettings.RELEASE_CONNECTIONS;
+import static org.hibernate.cfg.AvailableSettings.USE_QUERY_CACHE;
+import static org.hibernate.cfg.AvailableSettings.USE_SECOND_LEVEL_CACHE;
+
+/**
+ * Tests Hibernate L2 cache configuration.
+ */
+public class HibernateL2CacheConfigurationSelfTest extends GridCommonAbstractTest {
+    /** */
+    public static final String ENTITY1_NAME = Entity1.class.getName();
+
+    /** */
+    public static final String ENTITY2_NAME = Entity2.class.getName();
+
+    /** */
+    public static final String ENTITY3_NAME = Entity3.class.getName();
+
+    /** */
+    public static final String ENTITY4_NAME = Entity4.class.getName();
+
+    /** */
+    public static final String TIMESTAMP_CACHE = "org.hibernate.cache.spi.UpdateTimestampsCache";
+
+    /** */
+    public static final String QUERY_CACHE = "org.hibernate.cache.internal.StandardQueryCache";
+
+    /** */
+    public static final String CONNECTION_URL = "jdbc:h2:mem:example;DB_CLOSE_DELAY=-1";
+
+    /** If {@code true} then sets default cache in configuration. */
+    private boolean dfltCache;
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGrid(0);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        for (IgniteCacheProxy<?, ?> cache : ((IgniteKernal)grid(0)).caches())
+            cache.clear();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+        discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
+
+        cfg.setDiscoverySpi(discoSpi);
+
+        cfg.setCacheConfiguration(cacheConfiguration(ENTITY3_NAME), cacheConfiguration(ENTITY4_NAME),
+            cacheConfiguration("cache1"), cacheConfiguration("cache2"), cacheConfiguration("cache3"),
+            cacheConfiguration(TIMESTAMP_CACHE), cacheConfiguration(QUERY_CACHE));
+
+        return cfg;
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @return Cache configuration.
+     */
+    private CacheConfiguration cacheConfiguration(String cacheName) {
+        CacheConfiguration cfg = new CacheConfiguration();
+
+        cfg.setName(cacheName);
+
+        cfg.setCacheMode(PARTITIONED);
+
+        cfg.setAtomicityMode(ATOMIC);
+
+        return cfg;
+    }
+
+    /**
+     * @param igniteInstanceName Ignite instance name.
+     * @return Hibernate configuration.
+     */
+    protected Configuration hibernateConfiguration(String igniteInstanceName) {
+        Configuration cfg = new Configuration();
+
+        cfg.addAnnotatedClass(Entity1.class);
+        cfg.addAnnotatedClass(Entity2.class);
+        cfg.addAnnotatedClass(Entity3.class);
+        cfg.addAnnotatedClass(Entity4.class);
+
+        cfg.setProperty(DFLT_ACCESS_TYPE_PROPERTY, AccessType.NONSTRICT_READ_WRITE.name());
+
+        cfg.setProperty(HBM2DDL_AUTO, "create");
+
+        cfg.setProperty(GENERATE_STATISTICS, "true");
+
+        cfg.setProperty(USE_SECOND_LEVEL_CACHE, "true");
+
+        cfg.setProperty(USE_QUERY_CACHE, "true");
+
+        cfg.setProperty(CACHE_REGION_FACTORY, HibernateRegionFactory.class.getName());
+
+        cfg.setProperty(RELEASE_CONNECTIONS, "on_close");
+
+        cfg.setProperty(IGNITE_INSTANCE_NAME_PROPERTY, igniteInstanceName);
+
+        cfg.setProperty(REGION_CACHE_PROPERTY + ENTITY1_NAME, "cache1");
+        cfg.setProperty(REGION_CACHE_PROPERTY + ENTITY2_NAME, "cache2");
+        cfg.setProperty(REGION_CACHE_PROPERTY + TIMESTAMP_CACHE, TIMESTAMP_CACHE);
+        cfg.setProperty(REGION_CACHE_PROPERTY + QUERY_CACHE, QUERY_CACHE);
+
+        if (dfltCache)
+            cfg.setProperty(DFLT_CACHE_NAME_PROPERTY, "cache3");
+
+        return cfg;
+    }
+
+    /**
+     * Tests property {@link HibernateAccessStrategyFactory#REGION_CACHE_PROPERTY}.
+     */
+    public void testPerRegionCacheProperty() {
+        testCacheUsage(1, 1, 0, 1, 1);
+    }
+
+    /**
+     * Tests property {@link HibernateAccessStrategyFactory#DFLT_CACHE_NAME_PROPERTY}.
+     */
+    public void testDefaultCache() {
+        dfltCache = true;
+
+        testCacheUsage(1, 1, 2, 0, 0);
+    }
+
+    /**
+     * @param expCache1 Expected size of cache with name 'cache1'.
+     * @param expCache2 Expected size of cache with name 'cache2'.
+     * @param expCache3 Expected size of cache with name 'cache3'.
+     * @param expCacheE3 Expected size of cache with name {@link #ENTITY3_NAME}.
+     * @param expCacheE4 Expected size of cache with name {@link #ENTITY4_NAME}.
+     */
+    @SuppressWarnings("unchecked")
+    private void testCacheUsage(int expCache1, int expCache2, int expCache3, int expCacheE3, int expCacheE4) {
+        SessionFactory sesFactory = startHibernate(getTestIgniteInstanceName(0));
+
+        try {
+            Session ses = sesFactory.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                ses.save(new Entity1());
+                ses.save(new Entity2());
+                ses.save(new Entity3());
+                ses.save(new Entity4());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            ses = sesFactory.openSession();
+
+            try {
+                List<Entity1> list1 = ses.createCriteria(ENTITY1_NAME).list();
+
+                assertEquals(1, list1.size());
+
+                for (Entity1 e : list1) {
+                    ses.load(ENTITY1_NAME, e.getId());
+                    assertNotNull(e.getId());
+                }
+
+                List<Entity2> list2 = ses.createCriteria(ENTITY2_NAME).list();
+
+                assertEquals(1, list2.size());
+
+                for (Entity2 e : list2)
+                    assertNotNull(e.getId());
+
+                List<Entity3> list3 = ses.createCriteria(ENTITY3_NAME).list();
+
+                assertEquals(1, list3.size());
+
+                for (Entity3 e : list3)
+                    assertNotNull(e.getId());
+
+                List<Entity4> list4 = ses.createCriteria(ENTITY4_NAME).list();
+
+                assertEquals(1, list4.size());
+
+                for (Entity4 e : list4)
+                    assertNotNull(e.getId());
+            }
+            finally {
+                ses.close();
+            }
+
+            IgniteCache<Object, Object> cache1 = grid(0).cache("cache1");
+            IgniteCache<Object, Object> cache2 = grid(0).cache("cache2");
+            IgniteCache<Object, Object> cache3 = grid(0).cache("cache3");
+            IgniteCache<Object, Object> cacheE3 = grid(0).cache(ENTITY3_NAME);
+            IgniteCache<Object, Object> cacheE4 = grid(0).cache(ENTITY4_NAME);
+
+            assertEquals("Unexpected entries: " + toSet(cache1.iterator()), expCache1, cache1.size());
+            assertEquals("Unexpected entries: " + toSet(cache2.iterator()), expCache2, cache2.size());
+            assertEquals("Unexpected entries: " + toSet(cache3.iterator()), expCache3, cache3.size());
+            assertEquals("Unexpected entries: " + toSet(cacheE3.iterator()), expCacheE3, cacheE3.size());
+            assertEquals("Unexpected entries: " + toSet(cacheE4.iterator()), expCacheE4, cacheE4.size());
+        }
+        finally {
+            sesFactory.close();
+        }
+    }
+
+    /**
+     *
+     */
+    private <K, V> Set<Cache.Entry<K, V>> toSet(Iterator<Cache.Entry<K, V>> iter){
+        Set<Cache.Entry<K, V>> set = new HashSet<>();
+
+        while (iter.hasNext())
+            set.add(iter.next());
+
+        return set;
+    }
+
+    /**
+     * @param igniteInstanceName Name of the grid providing caches.
+     * @return Session factory.
+     */
+    private SessionFactory startHibernate(String igniteInstanceName) {
+        Configuration cfg = hibernateConfiguration(igniteInstanceName);
+
+        ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
+
+        builder.applySetting("hibernate.connection.url", CONNECTION_URL);
+        builder.applySetting("hibernate.show_sql", false);
+
+        return cfg.buildSessionFactory(builder.buildServiceRegistry());
+    }
+
+    /**
+     * Test Hibernate entity1.
+     */
+    @javax.persistence.Entity
+    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
+    @Cacheable
+    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+    public static class Entity1 {
+        /** */
+        private int id;
+
+        /**
+         * @return ID.
+         */
+        @Id
+        @GeneratedValue
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+    }
+
+    /**
+     * Test Hibernate entity2.
+     */
+    @javax.persistence.Entity
+    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
+    @Cacheable
+    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+    public static class Entity2 {
+        /** */
+        private int id;
+
+        /**
+         * @return ID.
+         */
+        @Id
+        @GeneratedValue
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+    }
+
+    /**
+     * Test Hibernate entity3.
+     */
+    @javax.persistence.Entity
+    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
+    @Cacheable
+    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+    public static class Entity3 {
+        /** */
+        private int id;
+
+        /**
+         * @return ID.
+         */
+        @Id
+        @GeneratedValue
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+    }
+
+    /**
+     * Test Hibernate entity4.
+     */
+    @javax.persistence.Entity
+    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
+    @Cacheable
+    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+    public static class Entity4 {
+        /** */
+        private int id;
+
+        /**
+         * @return ID.
+         */
+        @Id
+        @GeneratedValue
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheMultiJvmTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheMultiJvmTest.java b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheMultiJvmTest.java
new file mode 100644
index 0000000..5160220
--- /dev/null
+++ b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheMultiJvmTest.java
@@ -0,0 +1,440 @@
+/*
+ * 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.cache.hibernate;
+
+import java.util.Map;
+import javax.persistence.Cacheable;
+import javax.persistence.Id;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCompute;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.binary.BinaryMarshaller;
+import org.apache.ignite.lang.IgniteRunnable;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.resources.LoggerResource;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.service.ServiceRegistryBuilder;
+
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+import static org.apache.ignite.cache.hibernate.HibernateAccessStrategyFactory.DFLT_CACHE_NAME_PROPERTY;
+import static org.apache.ignite.cache.hibernate.HibernateL2CacheSelfTest.CONNECTION_URL;
+import static org.apache.ignite.cache.hibernate.HibernateL2CacheSelfTest.hibernateProperties;
+import static org.hibernate.cache.spi.access.AccessType.NONSTRICT_READ_WRITE;
+
+/**
+ *
+ */
+public class HibernateL2CacheMultiJvmTest extends GridCommonAbstractTest {
+    /** */
+    private static final String CACHE_NAME = "hibernateCache";
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        if (!getTestIgniteInstanceName(0).equals(igniteInstanceName))
+            cfg.setClientMode(true);
+
+        CacheConfiguration ccfg = new CacheConfiguration();
+
+        ccfg.setName(CACHE_NAME);
+        ccfg.setWriteSynchronizationMode(FULL_SYNC);
+
+        cfg.setCacheConfiguration(ccfg);
+
+        cfg.setMarshaller(new BinaryMarshaller());
+
+        cfg.setPeerClassLoadingEnabled(false);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean isMultiJvm() {
+        return true;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
+        startGrid(0);
+
+        startGrid(1);
+        startGrid(2);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+
+        super.afterTestsStopped();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testL2Cache() throws Exception {
+        Ignite srv = ignite(0);
+
+        {
+            IgniteCompute client1Compute =
+                srv.compute(srv.cluster().forNodeId(ignite(1).cluster().localNode().id()));
+
+            client1Compute.run(new HibernateInsertRunnable());
+        }
+
+        {
+            IgniteCompute client2Compute =
+                srv.compute(srv.cluster().forNodeId(ignite(2).cluster().localNode().id()));
+
+            client2Compute.run(new HibernateLoadRunnable());
+        }
+
+        {
+            IgniteCompute srvCompute = srv.compute(srv.cluster().forLocal());
+
+            srvCompute.run(new HibernateLoadRunnable());
+        }
+    }
+
+    /**
+     *
+     */
+    private static class HibernateInsertRunnable extends HibernateBaseRunnable {
+        /** {@inheritDoc} */
+        @Override public void run() {
+            SessionFactory sesFactory = startHibernate(ignite.name());
+
+            Session ses = sesFactory.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                for (int i = 0; i < 1; i++) {
+                    {
+                        Entity1 e = new Entity1();
+                        e.setId(i);
+                        e.setName("name-" + i);
+
+                        ses.save(e);
+                    }
+
+                    {
+                        Entity2 e = new Entity2();
+                        e.setId(String.valueOf(i));
+                        e.setName("name-" + i);
+
+                        ses.save(e);
+                    }
+
+                    {
+                        Entity3 e = new Entity3();
+                        e.setId(i);
+                        e.setName("name-" + i);
+
+                        ses.save(e);
+                    }
+                }
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+        }
+    }
+
+    /**
+     *
+     */
+    private static class HibernateLoadRunnable extends HibernateBaseRunnable {
+        /** {@inheritDoc} */
+        @Override public void run() {
+            SessionFactory sesFactory = startHibernate(ignite.name());
+
+            Session ses = sesFactory.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                for (int i = 0; i < 1; i++) {
+                    {
+                        Entity1 e = (Entity1)ses.load(Entity1.class, i);
+
+                        log.info("Found: " + e.getName());
+                    }
+                    {
+                        Entity2 e = (Entity2)ses.load(Entity2.class, String.valueOf(i));
+
+                        log.info("Found: " + e.getName());
+                    }
+                    {
+                        Entity3 e = (Entity3)ses.load(Entity3.class, (double)i);
+
+                        log.info("Found: " + e.getName());
+                    }
+                }
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+        }
+    }
+
+    /**
+     *
+     */
+    private abstract static class HibernateBaseRunnable implements IgniteRunnable {
+        /** */
+        @IgniteInstanceResource
+        protected Ignite ignite;
+
+        /** */
+        @LoggerResource
+        IgniteLogger log;
+
+        /**
+         * @param igniteInstanceName Name of the grid providing caches.
+         * @return Session factory.
+         */
+        SessionFactory startHibernate(String igniteInstanceName) {
+            log.info("Start hibernate on node: " + igniteInstanceName);
+
+            Configuration cfg = hibernateConfiguration(igniteInstanceName);
+
+            ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
+
+            builder.applySetting("hibernate.connection.url", CONNECTION_URL);
+
+            return cfg.buildSessionFactory(builder.buildServiceRegistry());
+        }
+
+        /**
+         * @param nodeName Ignite instance name.
+         * @return Hibernate configuration.
+         */
+        private Configuration hibernateConfiguration(String nodeName) {
+            Configuration cfg = new Configuration();
+
+            cfg.addAnnotatedClass(Entity1.class);
+            cfg.addAnnotatedClass(Entity2.class);
+            cfg.addAnnotatedClass(Entity3.class);
+
+            for (Map.Entry<String, String> e : hibernateProperties(nodeName, NONSTRICT_READ_WRITE.name()).entrySet())
+                cfg.setProperty(e.getKey(), e.getValue());
+
+            cfg.setProperty(DFLT_CACHE_NAME_PROPERTY, CACHE_NAME);
+
+            return cfg;
+        }
+    }
+
+    /**
+     * Test Hibernate entity1.
+     */
+    @javax.persistence.Entity
+    @Cacheable
+    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+    public static class Entity1 {
+        /** */
+        @Id
+        private int id;
+
+        /** */
+        private String name;
+
+        /**
+         * @return ID.
+         */
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+
+        /**
+         * @return Name.
+         */
+        public String getName() {
+            return name;
+        }
+
+        /**
+         * @param name Name.
+         */
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (this == o)
+                return true;
+
+            if (o == null || getClass() != o.getClass())
+                return false;
+
+            Entity1 entity1 = (Entity1)o;
+
+            return id == entity1.id;
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            return id;
+        }
+    }
+
+    /**
+     * Test Hibernate entity1.
+     */
+    @javax.persistence.Entity
+    @Cacheable
+    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+    public static class Entity2 {
+        /** */
+        @Id
+        private String id;
+
+        /** */
+        private String name;
+
+        /**
+         * @return ID.
+         */
+        public String getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(String id) {
+            this.id = id;
+        }
+
+        /**
+         * @return Name.
+         */
+        public String getName() {
+            return name;
+        }
+
+        /**
+         * @param name Name.
+         */
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (this == o)
+                return true;
+
+            if (o == null || getClass() != o.getClass())
+                return false;
+
+            Entity2 entity2 = (Entity2)o;
+
+            return id.equals(entity2.id);
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            return id.hashCode();
+        }
+    }
+
+    /**
+     * Test Hibernate entity1.
+     */
+    @javax.persistence.Entity
+    @Cacheable
+    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
+    public static class Entity3 {
+        /** */
+        @Id
+        private double id;
+
+        /** */
+        private String name;
+
+        /**
+         * @return ID.
+         */
+        public double getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(double id) {
+            this.id = id;
+        }
+
+        /**
+         * @return Name.
+         */
+        public String getName() {
+            return name;
+        }
+
+        /**
+         * @param name Name.
+         */
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (this == o)
+                return true;
+
+            if (o == null || getClass() != o.getClass())
+                return false;
+
+            Entity3 entity3 = (Entity3)o;
+
+            return Double.compare(entity3.id, id) == 0;
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            long temp = Double.doubleToLongBits(id);
+            return (int)(temp ^ (temp >>> 32));
+        }
+    }
+}


[28/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheResetCommandSpec.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheResetCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheResetCommandSpec.scala
index abb0024..4b96035 100644
--- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheResetCommandSpec.scala
+++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/cache/VisorCacheResetCommandSpec.scala
@@ -25,7 +25,7 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder
 import org.apache.ignite.visor.commands.cache.VisorCacheCommand._
 import org.apache.ignite.visor.{VisorRuntimeBaseSpec, visor}
-import org.jetbrains.annotations.Nullable
+import org.jetbrains.annotations.NotNull
 
 import scala.collection.JavaConversions._
 
@@ -47,7 +47,7 @@ class VisorCacheResetCommandSpec extends VisorRuntimeBaseSpec(2) {
 
         cfg.setIgniteInstanceName(name)
         cfg.setLocalHost("127.0.0.1")
-        cfg.setCacheConfiguration(cacheConfig(null), cacheConfig("cache"))
+        cfg.setCacheConfiguration(cacheConfig("default"), cacheConfig("cache"))
 
         val discoSpi = new TcpDiscoverySpi()
 
@@ -62,7 +62,7 @@ class VisorCacheResetCommandSpec extends VisorRuntimeBaseSpec(2) {
      * @param name Cache name.
      * @return Cache Configuration.
      */
-    def cacheConfig(@Nullable name: String): CacheConfiguration[Object, Object] = {
+    def cacheConfig(@NotNull name: String): CacheConfiguration[Object, Object] = {
         val cfg = new CacheConfiguration[Object, Object]
 
         cfg.setCacheMode(REPLICATED)
@@ -76,7 +76,7 @@ class VisorCacheResetCommandSpec extends VisorRuntimeBaseSpec(2) {
         it("should show correct result for default cache") {
             Ignition.ignite("node-1").cache[Int, Int](null).putAll(Map(1 -> 1, 2 -> 2, 3 -> 3))
 
-            val lock = Ignition.ignite("node-1").cache[Int, Int](null).lock(1)
+            val lock = Ignition.ignite("node-1").cache[Int, Int]("default").lock(1)
 
             lock.lock()
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/zeromq/src/test/java/org/apache/ignite/stream/zeromq/IgniteZeroMqStreamerTest.java
----------------------------------------------------------------------
diff --git a/modules/zeromq/src/test/java/org/apache/ignite/stream/zeromq/IgniteZeroMqStreamerTest.java b/modules/zeromq/src/test/java/org/apache/ignite/stream/zeromq/IgniteZeroMqStreamerTest.java
index c635c20..763212d 100644
--- a/modules/zeromq/src/test/java/org/apache/ignite/stream/zeromq/IgniteZeroMqStreamerTest.java
+++ b/modules/zeromq/src/test/java/org/apache/ignite/stream/zeromq/IgniteZeroMqStreamerTest.java
@@ -68,7 +68,7 @@ public class IgniteZeroMqStreamerTest extends GridCommonAbstractTest {
      * @throws Exception Test exception.
      */
     public void testZeroMqPairSocket() throws Exception {
-        try (IgniteDataStreamer<Integer, String> dataStreamer = grid().dataStreamer(null)) {
+        try (IgniteDataStreamer<Integer, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) {
             try (IgniteZeroMqStreamer streamer = newStreamerInstance(
                 dataStreamer, 1, ZeroMqTypeSocket.PAIR, ADDR, null);) {
                 executeStreamer(streamer, ZMQ.PAIR, null);
@@ -80,7 +80,7 @@ public class IgniteZeroMqStreamerTest extends GridCommonAbstractTest {
      * @throws Exception Test exception.
      */
     public void testZeroMqSubSocket() throws Exception {
-        try (IgniteDataStreamer<Integer, String> dataStreamer = grid().dataStreamer(null)) {
+        try (IgniteDataStreamer<Integer, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) {
             try (IgniteZeroMqStreamer streamer = newStreamerInstance(
                 dataStreamer, 3, ZeroMqTypeSocket.SUB, ADDR, TOPIC);) {
                 executeStreamer(streamer, ZMQ.PUB, TOPIC);
@@ -92,7 +92,7 @@ public class IgniteZeroMqStreamerTest extends GridCommonAbstractTest {
      * @throws Exception Test exception.
      */
     public void testZeroMqPullSocket() throws Exception {
-        try (IgniteDataStreamer<Integer, String> dataStreamer = grid().dataStreamer(null)) {
+        try (IgniteDataStreamer<Integer, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) {
             try (IgniteZeroMqStreamer streamer = newStreamerInstance(
                 dataStreamer, 4, ZeroMqTypeSocket.PULL, ADDR, null);) {
                 executeStreamer(streamer, ZMQ.PUSH, null);
@@ -113,7 +113,7 @@ public class IgniteZeroMqStreamerTest extends GridCommonAbstractTest {
         byte[] topic) throws Exception {
         streamer.setSingleTupleExtractor(new ZeroMqStringSingleTupleExtractor());
 
-        IgniteCache<Integer, String> cache = grid().cache(null);
+        IgniteCache<Integer, String> cache = grid().cache(DEFAULT_CACHE_NAME);
 
         CacheListener listener = subscribeToPutEvents();
 
@@ -192,7 +192,7 @@ public class IgniteZeroMqStreamerTest extends GridCommonAbstractTest {
         // Listen to cache PUT events and expect as many as messages as test data items.
         CacheListener listener = new CacheListener();
 
-        ignite.events(ignite.cluster().forCacheNodes(null)).localListen(listener, EVT_CACHE_OBJECT_PUT);
+        ignite.events(ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME)).localListen(listener, EVT_CACHE_OBJECT_PUT);
 
         return listener;
     }
@@ -203,7 +203,7 @@ public class IgniteZeroMqStreamerTest extends GridCommonAbstractTest {
     private void unsubscribeToPutEvents(CacheListener listener) {
         Ignite ignite = grid();
 
-        ignite.events(ignite.cluster().forCacheNodes(null)).stopLocalListen(listener, EVT_CACHE_OBJECT_PUT);
+        ignite.events(ignite.cluster().forCacheNodes(DEFAULT_CACHE_NAME)).stopLocalListen(listener, EVT_CACHE_OBJECT_PUT);
     }
 
     /**


[34/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java
index 9c08f0d..0ca10f8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxMultiNodeSelfTest.java
@@ -104,8 +104,8 @@ public class GridCacheNearTxMultiNodeSelfTest extends GridCommonAbstractTest {
         try {
             Integer mainKey = 0;
 
-            ClusterNode priNode = ignite.affinity(null).mapKeyToNode(mainKey);
-            ClusterNode backupNode = F.first(F.view(ignite.affinity(null).mapKeyToPrimaryAndBackups(mainKey),
+            ClusterNode priNode = ignite.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(mainKey);
+            ClusterNode backupNode = F.first(F.view(ignite.affinity(DEFAULT_CACHE_NAME).mapKeyToPrimaryAndBackups(mainKey),
                 F.notIn(F.asList(priNode))));
             ClusterNode otherNode = F.first(ignite.cluster().forPredicate(F.notIn(F.asList(priNode, backupNode))).nodes());
 
@@ -123,7 +123,7 @@ public class GridCacheNearTxMultiNodeSelfTest extends GridCommonAbstractTest {
 
             // Update main key from all nodes.
             for (Ignite g : ignites)
-                g.cache(null).put(mainKey, ++cntr);
+                g.cache(DEFAULT_CACHE_NAME).put(mainKey, ++cntr);
 
             info("Updated mainKey from all nodes.");
 
@@ -137,10 +137,10 @@ public class GridCacheNearTxMultiNodeSelfTest extends GridCommonAbstractTest {
 
                 Ignite g = F.rand(ignites);
 
-                g.cache(null).put(new AffinityKey<>(i, mainKey), Integer.toString(cntr++));
+                g.cache(DEFAULT_CACHE_NAME).put(new AffinityKey<>(i, mainKey), Integer.toString(cntr++));
             }
 
-            IgniteCache cache = priIgnite.cache(null);
+            IgniteCache cache = priIgnite.cache(DEFAULT_CACHE_NAME);
 
             Transaction tx = priIgnite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ);
 
@@ -169,7 +169,7 @@ public class GridCacheNearTxMultiNodeSelfTest extends GridCommonAbstractTest {
             ignites = F.asList(otherIgnite, newIgnite);
 
             for (Ignite g : ignites) {
-                GridNearCacheAdapter near = ((IgniteKernal)g).internalCache().context().near();
+                GridNearCacheAdapter near = ((IgniteKernal)g).internalCache(DEFAULT_CACHE_NAME).context().near();
                 GridDhtCacheAdapter dht = near.dht();
 
                 checkTm(g, near.context().tm());
@@ -204,7 +204,7 @@ public class GridCacheNearTxMultiNodeSelfTest extends GridCommonAbstractTest {
      */
     private void testReadersUpdate(TransactionConcurrency concurrency, TransactionIsolation isolation) throws Exception {
         Ignite ignite = grid(0);
-        IgniteCache<Integer, Integer> cache = ignite.cache(null);
+        IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         try (Transaction tx = ignite.transactions().txStart(concurrency, isolation)) {
             for (int i = 0; i < 100; i++)
@@ -215,7 +215,7 @@ public class GridCacheNearTxMultiNodeSelfTest extends GridCommonAbstractTest {
 
         // Create readers.
         for (int g = 0; g < GRID_CNT; g++) {
-            IgniteCache<Integer, Integer> c = grid(g).cache(null);
+            IgniteCache<Integer, Integer> c = grid(g).cache(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < 100; i++)
                 assertEquals((Integer)1, c.get(i));
@@ -229,7 +229,7 @@ public class GridCacheNearTxMultiNodeSelfTest extends GridCommonAbstractTest {
         }
 
         for (int g = 0; g < GRID_CNT; g++) {
-            IgniteCache<Integer, Integer> c = grid(g).cache(null);
+            IgniteCache<Integer, Integer> c = grid(g).cache(DEFAULT_CACHE_NAME);
 
             for (int i = 0; i < 100; i++)
                 assertEquals((Integer)2, c.get(i));

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedAffinityExcludeNeighborsPerformanceTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedAffinityExcludeNeighborsPerformanceTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedAffinityExcludeNeighborsPerformanceTest.java
index c5ba890..4bcaf88 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedAffinityExcludeNeighborsPerformanceTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedAffinityExcludeNeighborsPerformanceTest.java
@@ -93,7 +93,7 @@ public class GridCachePartitionedAffinityExcludeNeighborsPerformanceTest extends
      * @return Affinity.
      */
     static Affinity<Object> affinity(Ignite ignite) {
-        return ignite.affinity(null);
+        return ignite.affinity(DEFAULT_CACHE_NAME);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedAffinitySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedAffinitySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedAffinitySelfTest.java
index db3954a..b53177b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedAffinitySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedAffinitySelfTest.java
@@ -104,7 +104,7 @@ public class GridCachePartitionedAffinitySelfTest extends GridCommonAbstractTest
      * @return Affinity.
      */
     static Affinity<Object> affinity(Ignite ignite) {
-        return ignite.affinity(null);
+        return ignite.affinity(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -159,13 +159,13 @@ public class GridCachePartitionedAffinitySelfTest extends GridCommonAbstractTest
     /** @param g Grid. */
     private static void partitionMap(Ignite g) {
         X.println(">>> Full partition map for grid: " + g.name());
-        X.println(">>> " + dht(g.cache(null)).topology().partitionMap(false).toFullString());
+        X.println(">>> " + dht(g.cache(DEFAULT_CACHE_NAME)).topology().partitionMap(false).toFullString());
     }
 
     /** @throws Exception If failed. */
     @SuppressWarnings("BusyWait")
     private void waitTopologyUpdate() throws Exception {
-        GridTestUtils.waitTopologyUpdate(null, BACKUPS, log());
+        GridTestUtils.waitTopologyUpdate(DEFAULT_CACHE_NAME, BACKUPS, log());
     }
 
     /** @throws Exception If failed. */
@@ -174,7 +174,7 @@ public class GridCachePartitionedAffinitySelfTest extends GridCommonAbstractTest
 
         Ignite mg = grid(0);
 
-        IgniteCache<Integer, String> mc = mg.cache(null);
+        IgniteCache<Integer, String> mc = mg.cache(DEFAULT_CACHE_NAME);
 
         int keyCnt = 10;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedClientOnlyNoPrimaryFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedClientOnlyNoPrimaryFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedClientOnlyNoPrimaryFullApiSelfTest.java
index 29c2643..eef5aeb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedClientOnlyNoPrimaryFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedClientOnlyNoPrimaryFullApiSelfTest.java
@@ -50,14 +50,14 @@ public class GridCachePartitionedClientOnlyNoPrimaryFullApiSelfTest extends Grid
      *
      */
     public void testMapKeysToNodes() {
-        grid(0).affinity(null).mapKeysToNodes(Arrays.asList("1", "2"));
+        grid(0).affinity(DEFAULT_CACHE_NAME).mapKeysToNodes(Arrays.asList("1", "2"));
     }
 
     /**
      *
      */
     public void testMapKeyToNode() {
-        assert grid(0).affinity(null).mapKeyToNode("1") == null;
+        assert grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToNode("1") == null;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEvictionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEvictionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEvictionSelfTest.java
index f5ec2c2..d6f9baf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEvictionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedEvictionSelfTest.java
@@ -109,7 +109,7 @@ public class GridCachePartitionedEvictionSelfTest extends GridCacheAbstractSelfT
      * @return Cache.
      */
     private IgniteCache<String, Integer> cache(ClusterNode node) {
-        return G.ignite(node.id()).cache(null);
+        return G.ignite(node.id()).cache(DEFAULT_CACHE_NAME);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java
index 29979cf..3c57957 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java
@@ -92,10 +92,10 @@ public class GridCachePartitionedExplicitLockNodeFailureSelfTest extends GridCom
 
         Integer key = 0;
 
-        while (grid(idx).affinity(null).mapKeyToNode(key).id().equals(grid(0).localNode().id()))
+        while (grid(idx).affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key).id().equals(grid(0).localNode().id()))
             key++;
 
-        ClusterNode node = grid(idx).affinity(null).mapKeyToNode(key);
+        ClusterNode node = grid(idx).affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key);
 
         info("Primary node for key [id=" + node.id() + ", order=" + node.order() + ", key=" + key + ']');
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFilteredPutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFilteredPutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFilteredPutSelfTest.java
index 8b1d479..20c32c1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFilteredPutSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFilteredPutSelfTest.java
@@ -104,7 +104,7 @@ public class GridCachePartitionedFilteredPutSelfTest extends GridCommonAbstractT
         doPutAndRollback();
 
         GridCacheAdapter<Integer, Integer> c =
-            ((GridNearCacheAdapter<Integer, Integer>)((IgniteKernal)grid()).internalCache().<Integer, Integer>cache()).dht();
+            ((GridNearCacheAdapter<Integer, Integer>)((IgniteKernal)grid()).internalCache(DEFAULT_CACHE_NAME).<Integer, Integer>cache()).dht();
 
         assert c.entrySet().isEmpty() : "Actual size: " + c.entrySet().size();
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java
index b790975..c10e348 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFullApiSelfTest.java
@@ -60,7 +60,7 @@ public class GridCachePartitionedFullApiSelfTest extends GridCacheAbstractFullAp
      * @throws Exception If failed.
      */
     public void testPartitionEntrySetToString() throws Exception {
-        GridCacheAdapter<String, Integer> cache = ((IgniteKernal)grid(0)).internalCache();
+        GridCacheAdapter<String, Integer> cache = ((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < 100; i++) {
             String key = String.valueOf(i);
@@ -79,15 +79,15 @@ public class GridCachePartitionedFullApiSelfTest extends GridCacheAbstractFullAp
      */
     public void testUpdate() throws Exception {
         if (gridCount() > 1) {
-            IgniteCache<Object, Object> cache = grid(0).cache(null);
+            IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             Integer key = nearKey(cache);
 
-            primaryCache(key, null).put(key, 1);
+            primaryCache(key, DEFAULT_CACHE_NAME).put(key, 1);
 
             assertEquals(1, cache.get(key));
 
-            primaryCache(key, null).put(key, 2);
+            primaryCache(key, DEFAULT_CACHE_NAME).put(key, 2);
 
             if (cache.getConfiguration(CacheConfiguration.class).getNearConfiguration() != null)
                 assertEquals(2, cache.localPeek(key));

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java
index 19decc9..0c48e78 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedHitsAndMissesSelfTest.java
@@ -114,7 +114,7 @@ public class GridCachePartitionedHitsAndMissesSelfTest extends GridCommonAbstrac
             long misses = 0;
 
             for (int i = 0; i < GRID_CNT; i++) {
-                CacheMetrics m = grid(i).cache(null).localMetrics();
+                CacheMetrics m = grid(i).cache(DEFAULT_CACHE_NAME).localMetrics();
 
                 hits += m.getCacheHits();
                 misses += m.getCacheMisses();
@@ -135,7 +135,7 @@ public class GridCachePartitionedHitsAndMissesSelfTest extends GridCommonAbstrac
      * @param g Grid.
      */
     private static void realTimePopulate(final Ignite g) {
-        try (IgniteDataStreamer<Integer, Long> ldr = g.dataStreamer(null)) {
+        try (IgniteDataStreamer<Integer, Long> ldr = g.dataStreamer(DEFAULT_CACHE_NAME)) {
             // Sets max values to 1 so cache metrics have correct values.
             ldr.perNodeParallelOperations(1);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java
index 69310a7..9474950 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedLoadCacheSelfTest.java
@@ -103,7 +103,7 @@ public class GridCachePartitionedLoadCacheSelfTest extends GridCommonAbstractTes
             else
                 cache.localLoadCache(null, PUT_CNT);
 
-            Affinity<Integer> aff = grid(0).affinity(null);
+            Affinity<Integer> aff = grid(0).affinity(DEFAULT_CACHE_NAME);
 
             int[] parts = aff.allPartitions(grid(0).localNode());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java
index 403a770..6d5302f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeCounterSelfTest.java
@@ -143,7 +143,7 @@ public class GridCachePartitionedMultiNodeCounterSelfTest extends GridCommonAbst
      * @return Near cache.
      */
     private static GridNearCacheAdapter<String, Integer> near(Ignite g) {
-        return (GridNearCacheAdapter<String, Integer>)((IgniteKernal)g).<String, Integer>internalCache();
+        return (GridNearCacheAdapter<String, Integer>)((IgniteKernal)g).<String, Integer>internalCache(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -245,7 +245,7 @@ public class GridCachePartitionedMultiNodeCounterSelfTest extends GridCommonAbst
         X.println("*** Retries: " + RETRIES);
         X.println("*** Log frequency: " + LOG_FREQ);
 
-        Affinity<String> aff = affinity(grid(0).<String, Integer>cache(null));
+        Affinity<String> aff = affinity(grid(0).<String, Integer>cache(DEFAULT_CACHE_NAME));
 
         Collection<ClusterNode> affNodes = aff.mapKeyToPrimaryAndBackups(CNTR_KEY);
 
@@ -265,8 +265,8 @@ public class GridCachePartitionedMultiNodeCounterSelfTest extends GridCommonAbst
         final UUID priId = pri.cluster().localNode().id();
 
         // Initialize.
-        pri.cache(null).put(CNTR_KEY, 0);
-//        nears.get(0).cache(null).put(CNTR_KEY, 0);
+        pri.cache(DEFAULT_CACHE_NAME).put(CNTR_KEY, 0);
+//        nears.get(0).cache(DEFAULT_CACHE_NAME).put(CNTR_KEY, 0);
 
         assertNull(near(pri).peekEx(CNTR_KEY));
 
@@ -312,7 +312,7 @@ public class GridCachePartitionedMultiNodeCounterSelfTest extends GridCommonAbst
                                 if (DEBUG)
                                     info("***");
 
-                                IgniteCache<String, Integer> c = pri.cache(null);
+                                IgniteCache<String, Integer> c = pri.cache(DEFAULT_CACHE_NAME);
 
                                 Integer oldCntr = c.localPeek(CNTR_KEY, CachePeekMode.ONHEAP);
 
@@ -411,7 +411,7 @@ public class GridCachePartitionedMultiNodeCounterSelfTest extends GridCommonAbst
                                     if (DEBUG)
                                         info("***");
 
-                                    IgniteCache<String, Integer> c = near.cache(null);
+                                    IgniteCache<String, Integer> c = near.cache(DEFAULT_CACHE_NAME);
 
                                     Integer oldCntr = c.localPeek(CNTR_KEY, CachePeekMode.ONHEAP);
 
@@ -496,7 +496,7 @@ public class GridCachePartitionedMultiNodeCounterSelfTest extends GridCommonAbst
             dht(g).context().tm().printMemoryStats();
             near(g).context().tm().printMemoryStats();
 
-            IgniteCache<String, Integer> cache = grid(i).cache(null);
+            IgniteCache<String, Integer> cache = grid(i).cache(DEFAULT_CACHE_NAME);
 
             int cntr = nearThreads > 0 && nears.contains(g) ? cache.get(CNTR_KEY) : cache.localPeek(CNTR_KEY);
 
@@ -541,7 +541,7 @@ public class GridCachePartitionedMultiNodeCounterSelfTest extends GridCommonAbst
      * @throws Exception If failed.
      */
     private void checkNearAndPrimaryMultiNode(int gridCnt) throws Exception {
-        Affinity<String> aff = affinity(grid(0).<String, Integer>cache(null));
+        Affinity<String> aff = affinity(grid(0).<String, Integer>cache(DEFAULT_CACHE_NAME));
 
         Collection<ClusterNode> affNodes = aff.mapKeyToPrimaryAndBackups(CNTR_KEY);
 
@@ -550,7 +550,7 @@ public class GridCachePartitionedMultiNodeCounterSelfTest extends GridCommonAbst
         Ignite pri = G.ignite(F.first(affNodes).id());
 
         // Initialize.
-        pri.cache(null).put(CNTR_KEY, 0);
+        pri.cache(DEFAULT_CACHE_NAME).put(CNTR_KEY, 0);
 
         assertNull(near(pri).peekEx(CNTR_KEY));
 
@@ -576,7 +576,7 @@ public class GridCachePartitionedMultiNodeCounterSelfTest extends GridCommonAbst
         for (int i = 0; i < gridCnt; i++) {
             Ignite g = grid(i);
 
-            IgniteCache<String, Integer> cache = grid(i).cache(null);
+            IgniteCache<String, Integer> cache = grid(i).cache(DEFAULT_CACHE_NAME);
 
             int cntr = cache.localPeek(CNTR_KEY);
 
@@ -640,7 +640,7 @@ public class GridCachePartitionedMultiNodeCounterSelfTest extends GridCommonAbst
                     if (DEBUG)
                         log.info("***");
 
-                    IgniteCache<String, Integer> c = near.cache(null);
+                    IgniteCache<String, Integer> c = near.cache(DEFAULT_CACHE_NAME);
 
                     Integer oldCntr = c.localPeek(CNTR_KEY, CachePeekMode.ONHEAP);
 
@@ -711,7 +711,7 @@ public class GridCachePartitionedMultiNodeCounterSelfTest extends GridCommonAbst
                     if (DEBUG)
                         log.info("***");
 
-                    IgniteCache<String, Integer> c = pri.cache(null);
+                    IgniteCache<String, Integer> c = pri.cache(DEFAULT_CACHE_NAME);
 
                     Integer oldCntr = c.localPeek(CNTR_KEY, CachePeekMode.ONHEAP);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
index e5b72f8..4450eb6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiNodeFullApiSelfTest.java
@@ -79,8 +79,8 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
         for (int i = 0; i < size; i++)
             putMap.put(i, i * i);
 
-        IgniteCache<Object, Object> c0 = grid(0).cache(null);
-        IgniteCache<Object, Object> c1 = grid(1).cache(null);
+        IgniteCache<Object, Object> c0 = grid(0).cache(DEFAULT_CACHE_NAME);
+        IgniteCache<Object, Object> c1 = grid(1).cache(DEFAULT_CACHE_NAME);
 
         c0.putAll(putMap);
 
@@ -106,8 +106,8 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
         for (int i = 0; i < size; i++)
             putMap.put(i, i);
 
-        IgniteCache<Object, Object> prj0 = grid(0).cache(null);
-        IgniteCache<Object, Object> prj1 = grid(1).cache(null);
+        IgniteCache<Object, Object> prj0 = grid(0).cache(DEFAULT_CACHE_NAME);
+        IgniteCache<Object, Object> prj1 = grid(1).cache(DEFAULT_CACHE_NAME);
 
         prj0.putAll(putMap);
 
@@ -140,7 +140,7 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
 
         final int size = 10;
 
-        IgniteCache<Object, Object> cache0 = grid(0).cache(null);
+        IgniteCache<Object, Object> cache0 = grid(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < size; i++) {
             info("Putting value [i=" + i + ']');
@@ -183,7 +183,7 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
 
             Integer nearPeekVal = nearEnabled ? 1 : null;
 
-            Affinity<Object> aff = ignite(i).affinity(null);
+            Affinity<Object> aff = ignite(i).affinity(DEFAULT_CACHE_NAME);
 
             info("Affinity nodes [nodes=" + F.nodeIds(aff.mapKeyToPrimaryAndBackups("key")) +
                 ", locNode=" + ignite(i).cluster().localNode().id() + ']');
@@ -217,12 +217,12 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
 
             IgniteCache<String, Integer> c = jcache(i);
 
-            if (grid(i).affinity(null).isBackup(grid(i).localNode(), "key")) {
+            if (grid(i).affinity(DEFAULT_CACHE_NAME).isBackup(grid(i).localNode(), "key")) {
                 assert c.localPeek("key", NEAR) == null;
 
                 assert c.localPeek("key", PRIMARY, BACKUP) == 1;
             }
-            else if (!grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), "key")) {
+            else if (!grid(i).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid(i).localNode(), "key")) {
                 // Initialize near reader.
                 assertEquals((Integer)1, jcache(i).get("key"));
 
@@ -269,15 +269,15 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
 
         info("Generating keys for test [nodes=" + ignite0.name() + ", " + ignite1.name() + ", " + ignite2.name() + ']');
 
-        IgniteCache<String, Integer> cache0 = ignite0.cache(null);
+        IgniteCache<String, Integer> cache0 = ignite0.cache(DEFAULT_CACHE_NAME);
 
         int val = 0;
 
         for (int i = 0; i < 10_000 && keys.size() < 5; i++) {
             String key = String.valueOf(i);
 
-            if (ignite(0).affinity(null).isPrimary(ignite0.localNode(), key) &&
-                ignite(0).affinity(null).isBackup(ignite1.localNode(), key)) {
+            if (ignite(0).affinity(DEFAULT_CACHE_NAME).isPrimary(ignite0.localNode(), key) &&
+                ignite(0).affinity(DEFAULT_CACHE_NAME).isBackup(ignite1.localNode(), key)) {
                 keys.add(key);
 
                 cache0.put(key, val++);
@@ -288,7 +288,7 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
 
         info("Finished generating keys for test.");
 
-        IgniteCache<String, Integer> cache2 = ignite2.cache(null);
+        IgniteCache<String, Integer> cache2 = ignite2.cache(DEFAULT_CACHE_NAME);
 
         assertEquals(Integer.valueOf(0), cache2.get(keys.get(0)));
         assertEquals(Integer.valueOf(1), cache2.get(keys.get(1)));
@@ -296,7 +296,7 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
         assertEquals(0, cache0.localSize(NEAR));
         assertEquals(5, cache0.localSize(CachePeekMode.ALL) - cache0.localSize(NEAR));
 
-        IgniteCache<String, Integer> cache1 = ignite1.cache(null);
+        IgniteCache<String, Integer> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
 
         assertEquals(0, cache1.localSize(NEAR));
         assertEquals(5, cache1.localSize(CachePeekMode.ALL) - cache1.localSize(NEAR));
@@ -344,7 +344,7 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
         if (!isMultiJvm())
             info("All affinity nodes: " + affinityNodes());
 
-        IgniteCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         info("Cache affinity nodes: " + affinity(cache).mapKeyToPrimaryAndBackups(key));
 
@@ -412,9 +412,9 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
 
         /** {@inheritDoc} */
         @Override public void run(int idx) throws Exception {
-            assertEquals(0, ((IgniteKernal)ignite).<String, Integer>internalCache().context().tm().idMapSize());
+            assertEquals(0, ((IgniteKernal)ignite).<String, Integer>internalCache(DEFAULT_CACHE_NAME).context().tm().idMapSize());
 
-            IgniteCache<Object, Object> cache = ignite.cache(null);
+            IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME);
             ClusterNode node = ((IgniteKernal)ignite).localNode();
 
             for (int k = 0; k < size; k++) {
@@ -431,7 +431,7 @@ public class GridCachePartitionedMultiNodeFullApiSelfTest extends GridCacheParti
     private static class IsNearTask extends TestIgniteIdxRunnable {
         /** {@inheritDoc} */
         @Override public void run(int idx) throws Exception {
-            assertTrue(((IgniteKernal)ignite).internalCache().context().isNear());
+            assertTrue(((IgniteKernal)ignite).internalCache(DEFAULT_CACHE_NAME).context().isNear());
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiThreadedPutGetSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiThreadedPutGetSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiThreadedPutGetSelfTest.java
index 86b2217..8fc41ce 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiThreadedPutGetSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedMultiThreadedPutGetSelfTest.java
@@ -112,12 +112,12 @@ public class GridCachePartitionedMultiThreadedPutGetSelfTest extends GridCommonA
         super.afterTest();
 
         if (GRID_CNT > 0)
-            grid(0).cache(null).removeAll();
+            grid(0).cache(DEFAULT_CACHE_NAME).removeAll();
 
         for (int i = 0; i < GRID_CNT; i++) {
-            grid(i).cache(null).clear();
+            grid(i).cache(DEFAULT_CACHE_NAME).clear();
 
-            assert grid(i).cache(null).localSize() == 0;
+            assert grid(i).cache(DEFAULT_CACHE_NAME).localSize() == 0;
         }
     }
 
@@ -188,7 +188,7 @@ public class GridCachePartitionedMultiThreadedPutGetSelfTest extends GridCommonA
         multithreaded(new CAX() {
             @SuppressWarnings({"BusyWait"})
             @Override public void applyx() {
-                IgniteCache<Integer, Integer> c = grid(0).cache(null);
+                IgniteCache<Integer, Integer> c = grid(0).cache(DEFAULT_CACHE_NAME);
 
                 for (int i = 0; i < TX_CNT; i++) {
                     int kv = cntr.incrementAndGet();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedStorePutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedStorePutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedStorePutSelfTest.java
index 32d5bfb..96d4603 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedStorePutSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedStorePutSelfTest.java
@@ -95,9 +95,9 @@ public class GridCachePartitionedStorePutSelfTest extends GridCommonAbstractTest
 
     /** {@inheritDoc} */
     @Override protected void beforeTest() throws Exception {
-        cache1 = startGrid(1).cache(null);
-        cache2 = startGrid(2).cache(null);
-        cache3 = startGrid(3).cache(null);
+        cache1 = startGrid(1).cache(DEFAULT_CACHE_NAME);
+        cache2 = startGrid(2).cache(DEFAULT_CACHE_NAME);
+        cache3 = startGrid(3).cache(DEFAULT_CACHE_NAME);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSalvageSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSalvageSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSalvageSelfTest.java
index 9cc3988..06fbe8f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSalvageSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedTxSalvageSelfTest.java
@@ -203,7 +203,7 @@ public class GridCachePartitionedTxSalvageSelfTest extends GridCommonAbstractTes
     private void startTxAndPutKeys(final TransactionConcurrency mode, final boolean prepare) throws Exception {
         Ignite ignite = grid(0);
 
-        final Collection<Integer> keys = nearKeys(ignite.cache(null), KEY_CNT, 0);
+        final Collection<Integer> keys = nearKeys(ignite.cache(DEFAULT_CACHE_NAME), KEY_CNT, 0);
 
         IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
             @Override public void run() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePutArrayValueSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePutArrayValueSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePutArrayValueSelfTest.java
index cad13ca..14a0c0f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePutArrayValueSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePutArrayValueSelfTest.java
@@ -54,7 +54,7 @@ public class GridCachePutArrayValueSelfTest extends GridCacheAbstractSelfTest {
     public void testInternalKeys() throws Exception {
         assert gridCount() >= 2;
 
-        IgniteCache<InternalKey, Object> jcache = grid(0).cache(null);
+        IgniteCache<InternalKey, Object> jcache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         final InternalKey key = new InternalKey(0); // Hangs on the first remote put.
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheRendezvousAffinityClientSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheRendezvousAffinityClientSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheRendezvousAffinityClientSelfTest.java
index 3fe2cd7..51c2fc2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheRendezvousAffinityClientSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheRendezvousAffinityClientSelfTest.java
@@ -80,7 +80,7 @@ public class GridCacheRendezvousAffinityClientSelfTest extends GridCommonAbstrac
             Map<Integer, Collection<UUID>> mapping = new HashMap<>();
 
             for (int i = 0; i < 4; i++) {
-                IgniteCache<Object, Object> cache = grid(i).cache(null);
+                IgniteCache<Object, Object> cache = grid(i).cache(DEFAULT_CACHE_NAME);
 
                 Affinity<Object> aff = affinity(cache);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridPartitionedBackupLoadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridPartitionedBackupLoadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridPartitionedBackupLoadSelfTest.java
index d35f2ffc..23b0e18 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridPartitionedBackupLoadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridPartitionedBackupLoadSelfTest.java
@@ -103,14 +103,14 @@ public class GridPartitionedBackupLoadSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testBackupLoad() throws Exception {
-        grid(0).cache(null).put(1, 1);
+        grid(0).cache(DEFAULT_CACHE_NAME).put(1, 1);
 
         assert store.get(1) == 1;
 
         for (int i = 0; i < GRID_CNT; i++) {
             IgniteCache<Integer, Integer> cache = jcache(i);
 
-            if (grid(i).affinity(null).isBackup(grid(i).localNode(), 1)) {
+            if (grid(i).affinity(DEFAULT_CACHE_NAME).isBackup(grid(i).localNode(), 1)) {
                 assert cache.localPeek(1) == 1;
 
                 jcache(i).localClear(1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java
index 9ea7446..ca12a99 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearOnlyTxTest.java
@@ -17,8 +17,6 @@
 
 package org.apache.ignite.internal.processors.cache.distributed.near;
 
-import java.util.ArrayList;
-import java.util.Collection;
 import java.util.concurrent.Callable;
 import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.ignite.Ignite;
@@ -83,14 +81,14 @@ public class IgniteCacheNearOnlyTxTest extends IgniteCacheAbstractTest {
 
         assertTrue(ignite1.configuration().isClientMode());
 
-        ignite1.createNearCache(null, new NearCacheConfiguration<>());
+        ignite1.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration<>());
 
         final Integer key = 1;
 
         final AtomicInteger idx = new AtomicInteger();
 
-        IgniteCache<Integer, Integer> cache0 = ignite(0).cache(null);
-        IgniteCache<Integer, Integer> cache1 = ignite1.cache(null);
+        IgniteCache<Integer, Integer> cache0 = ignite(0).cache(DEFAULT_CACHE_NAME);
+        IgniteCache<Integer, Integer> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < 5; i++) {
             log.info("Iteration: " + i);
@@ -99,7 +97,7 @@ public class IgniteCacheNearOnlyTxTest extends IgniteCacheAbstractTest {
                 @Override public Object call() throws Exception {
                     int val = idx.getAndIncrement();
 
-                    IgniteCache<Integer, Integer> cache = ignite1.cache(null);
+                    IgniteCache<Integer, Integer> cache = ignite1.cache(DEFAULT_CACHE_NAME);
 
                     for (int i = 0; i < 100; i++)
                         cache.put(key, val);
@@ -135,21 +133,21 @@ public class IgniteCacheNearOnlyTxTest extends IgniteCacheAbstractTest {
 
         assertTrue(ignite1.configuration().isClientMode());
 
-        ignite1.createNearCache(null, new NearCacheConfiguration<>());
+        ignite1.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration<>());
 
         final AtomicInteger idx = new AtomicInteger();
 
         final Integer key = 1;
 
-        IgniteCache<Integer, Integer> cache0 = ignite(0).cache(null);
-        IgniteCache<Integer, Integer> cache1 = ignite1.cache(null);
+        IgniteCache<Integer, Integer> cache0 = ignite(0).cache(DEFAULT_CACHE_NAME);
+        IgniteCache<Integer, Integer> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < 5; i++) {
             log.info("Iteration: " + i);
 
             GridTestUtils.runMultiThreaded(new Callable<Object>() {
                 @Override public Object call() throws Exception {
-                    IgniteCache<Integer, Integer> cache = ignite1.cache(null);
+                    IgniteCache<Integer, Integer> cache = ignite1.cache(DEFAULT_CACHE_NAME);
 
                     IgniteTransactions txs = ignite1.transactions();
 
@@ -181,13 +179,13 @@ public class IgniteCacheNearOnlyTxTest extends IgniteCacheAbstractTest {
 
         assertTrue(ignite1.configuration().isClientMode());
 
-        ignite1.createNearCache(null, new NearCacheConfiguration<>());
+        ignite1.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration<>());
 
         final Integer key = 1;
 
         IgniteInternalFuture<?> fut1 = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {
-                IgniteCache<Integer, Integer> cache = ignite1.cache(null);
+                IgniteCache<Integer, Integer> cache = ignite1.cache(DEFAULT_CACHE_NAME);
 
                 for (int i = 0; i < 100; i++)
                     cache.put(key, 1);
@@ -198,7 +196,7 @@ public class IgniteCacheNearOnlyTxTest extends IgniteCacheAbstractTest {
 
         IgniteInternalFuture<?> fut2 = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {
-                IgniteCache<Integer, Integer> cache = ignite1.cache(null);
+                IgniteCache<Integer, Integer> cache = ignite1.cache(DEFAULT_CACHE_NAME);
 
                 IgniteTransactions txs = ignite1.transactions();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java
index d7ab309..ad9bce0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCacheNearReadCommittedTest.java
@@ -52,7 +52,7 @@ public class IgniteCacheNearReadCommittedTest extends GridCacheAbstractSelfTest
      * @throws Exception If failed.
      */
     public void testReadCommittedCacheCleanup() throws Exception {
-        IgniteCache<Integer, Integer> cache = ignite(0).cache(null);
+        IgniteCache<Integer, Integer> cache = ignite(0).cache(DEFAULT_CACHE_NAME);
 
         Integer key = backupKey(cache);
 
@@ -66,7 +66,7 @@ public class IgniteCacheNearReadCommittedTest extends GridCacheAbstractSelfTest
             tx.commit();
         }
 
-        ignite(1).cache(null).remove(key); // Remove from primary node.
+        ignite(1).cache(DEFAULT_CACHE_NAME).remove(key); // Remove from primary node.
 
         assertEquals(0, cache.localSize(CachePeekMode.ALL));
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteTxReentryNearSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteTxReentryNearSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteTxReentryNearSelfTest.java
index 0820370..7cfe690 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteTxReentryNearSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteTxReentryNearSelfTest.java
@@ -43,7 +43,7 @@ public class IgniteTxReentryNearSelfTest extends IgniteTxReentryAbstractSelfTest
     @Override protected int testKey() {
         int key = 0;
 
-        IgniteCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         while (true) {
             Collection<ClusterNode> nodes = affinity(cache).mapKeyToPrimaryAndBackups(key);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheMultithreadedUpdateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheMultithreadedUpdateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheMultithreadedUpdateTest.java
index 8f26c6e..4e4aa58 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheMultithreadedUpdateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheMultithreadedUpdateTest.java
@@ -117,7 +117,7 @@ public class NearCacheMultithreadedUpdateTest extends GridCommonAbstractTest {
     private void updateMultithreaded(CacheAtomicityMode atomicityMode, boolean restart) throws Exception {
         Ignite srv = ignite(0);
 
-        srv.destroyCache(null);
+        srv.destroyCache(DEFAULT_CACHE_NAME);
 
         IgniteCache<Integer, Integer> srvCache = srv.createCache(cacheConfiguration(atomicityMode));
 
@@ -126,14 +126,14 @@ public class NearCacheMultithreadedUpdateTest extends GridCommonAbstractTest {
         assertTrue(client.configuration().isClientMode());
 
         final IgniteCache<Integer, Integer> clientCache =
-            client.createNearCache(null, new NearCacheConfiguration<Integer, Integer>());
+            client.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration<Integer, Integer>());
 
         final AtomicBoolean stop = new AtomicBoolean();
 
         IgniteInternalFuture<?> restartFut = null;
 
         // Primary key for restarted node.
-        final Integer key0 = primaryKey(ignite(SRV_CNT - 1).cache(null));
+        final Integer key0 = primaryKey(ignite(SRV_CNT - 1).cache(DEFAULT_CACHE_NAME));
 
         if (restart) {
             restartFut = GridTestUtils.runAsync(new Callable<Void>() {
@@ -206,7 +206,7 @@ public class NearCacheMultithreadedUpdateTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     private CacheConfiguration<Integer, Integer> cacheConfiguration(CacheAtomicityMode atomicityMode) {
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCachePutAllMultinodeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCachePutAllMultinodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCachePutAllMultinodeTest.java
index 2283560..ca60060 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCachePutAllMultinodeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCachePutAllMultinodeTest.java
@@ -95,11 +95,11 @@ public class NearCachePutAllMultinodeTest extends GridCommonAbstractTest {
 
         Ignite grid = startGrid(GRID_CNT - 2);
 
-        grid.createNearCache(null, new NearCacheConfiguration());
+        grid.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration());
 
         grid = startGrid(GRID_CNT - 1);
 
-        grid.cache(null);
+        grid.cache(DEFAULT_CACHE_NAME);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java
index 359b12b..d253013 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NearCacheSyncUpdateTest.java
@@ -130,7 +130,7 @@ public class NearCacheSyncUpdateTest extends GridCommonAbstractTest {
             }, 10, "update-thread");
         }
         finally {
-            ignite(0).destroyCache(null);
+            ignite(0).destroyCache(DEFAULT_CACHE_NAME);
         }
     }
 
@@ -139,7 +139,7 @@ public class NearCacheSyncUpdateTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     private CacheConfiguration<Integer, Integer> cacheConfiguration(CacheAtomicityMode atomicityMode) {
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NoneRebalanceModeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NoneRebalanceModeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NoneRebalanceModeSelfTest.java
index 4d6586a..f3fb814 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NoneRebalanceModeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/NoneRebalanceModeSelfTest.java
@@ -58,11 +58,11 @@ public class NoneRebalanceModeSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testRemoveAll() throws Exception {
-        GridNearTransactionalCache cache = (GridNearTransactionalCache)((IgniteKernal)grid(0)).internalCache(null);
+        GridNearTransactionalCache cache = (GridNearTransactionalCache)((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME);
 
         for (GridDhtLocalPartition part : cache.dht().topology().localPartitions())
             assertEquals(OWNING, part.state());
 
-        grid(0).cache(null).removeAll();
+        grid(0).cache(DEFAULT_CACHE_NAME).removeAll();
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRabalancingDelayedPartitionMapExchangeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRabalancingDelayedPartitionMapExchangeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRabalancingDelayedPartitionMapExchangeSelfTest.java
index db7875f..dc141db 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRabalancingDelayedPartitionMapExchangeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRabalancingDelayedPartitionMapExchangeSelfTest.java
@@ -45,9 +45,6 @@ public class GridCacheRabalancingDelayedPartitionMapExchangeSelfTest extends Gri
     /** */
     protected static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
 
-    /** partitioned cache name. */
-    protected static String CACHE = null;
-
     /** */
     private final ConcurrentHashMap8<UUID, Runnable> rs = new ConcurrentHashMap8<>();
 
@@ -102,9 +99,8 @@ public class GridCacheRabalancingDelayedPartitionMapExchangeSelfTest extends Gri
     public void test() throws Exception {
         IgniteKernal ignite = (IgniteKernal)startGrid(0);
 
-        CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> cfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
-        cfg.setName(CACHE);
         cfg.setCacheMode(CacheMode.PARTITIONED);
         cfg.setRebalanceMode(CacheRebalanceMode.SYNC);
         cfg.setBackups(1);
@@ -142,7 +138,7 @@ public class GridCacheRabalancingDelayedPartitionMapExchangeSelfTest extends Gri
             U.sleep(10);
         }
 
-        ignite(0).destroyCache(CACHE);
+        ignite(0).destroyCache(DEFAULT_CACHE_NAME);
 
         ignite(0).getOrCreateCache(cfg);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingOrderingTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingOrderingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingOrderingTest.java
index 64ec3ec..d8a7605 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingOrderingTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingOrderingTest.java
@@ -151,7 +151,7 @@ public class GridCacheRebalancingOrderingTest extends GridCommonAbstractTest {
      * @see #getConfiguration().
      */
     protected CacheConfiguration<IntegerKey, Integer> getCacheConfiguration() {
-        CacheConfiguration<IntegerKey, Integer> cfg = new CacheConfiguration<>();
+        CacheConfiguration<IntegerKey, Integer> cfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cfg.setAtomicityMode(TRANSACTIONAL ? CacheAtomicityMode.TRANSACTIONAL : CacheAtomicityMode.ATOMIC);
         cfg.setCacheMode(CacheMode.PARTITIONED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncCheckDataTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncCheckDataTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncCheckDataTest.java
index 1e0b390..d842e84 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncCheckDataTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncCheckDataTest.java
@@ -45,7 +45,7 @@ public class GridCacheRebalancingSyncCheckDataTest extends GridCommonAbstractTes
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
 
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         ccfg.setCacheMode(REPLICATED);
         ccfg.setRebalanceMode(SYNC);
 
@@ -70,7 +70,7 @@ public class GridCacheRebalancingSyncCheckDataTest extends GridCommonAbstractTes
 
         final int KEYS = 10_000;
 
-        IgniteCache<Object, Object> cache = ignite.cache(null);
+        IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < KEYS; i++)
             cache.put(i, i);
@@ -84,7 +84,7 @@ public class GridCacheRebalancingSyncCheckDataTest extends GridCommonAbstractTes
             GridTestUtils.runMultiThreaded(new Callable<Void>() {
                 @Override public Void call() throws Exception {
                     try(Ignite ignite = startGrid(idx.getAndIncrement())) {
-                        IgniteCache<Object, Object> cache = ignite.cache(null);
+                        IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                         for (int i = 0; i < KEYS; i++)
                             assertNotNull(cache.localPeek(i));

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
index a9df85c..f6667f3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingSyncSelfTest.java
@@ -112,7 +112,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
         if (getTestIgniteInstanceName(10).equals(igniteInstanceName))
             iCfg.setClientMode(true);
 
-        CacheConfiguration<Integer, Integer> cachePCfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> cachePCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cachePCfg.setName(CACHE_NAME_DHT_PARTITIONED);
         cachePCfg.setCacheMode(CacheMode.PARTITIONED);
@@ -122,7 +122,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
         cachePCfg.setRebalanceBatchesPrefetchCount(1);
         cachePCfg.setRebalanceOrder(2);
 
-        CacheConfiguration<Integer, Integer> cachePCfg2 = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> cachePCfg2 = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cachePCfg2.setName(CACHE_NAME_DHT_PARTITIONED_2);
         cachePCfg2.setCacheMode(CacheMode.PARTITIONED);
@@ -131,7 +131,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
         cachePCfg2.setRebalanceOrder(2);
         //cachePCfg2.setRebalanceDelay(5000);//Known issue, possible deadlock in case of low priority cache rebalancing delayed.
 
-        CacheConfiguration<Integer, Integer> cacheRCfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> cacheRCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cacheRCfg.setName(CACHE_NAME_DHT_REPLICATED);
         cacheRCfg.setCacheMode(CacheMode.REPLICATED);
@@ -140,7 +140,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
         cacheRCfg.setRebalanceBatchesPrefetchCount(Integer.MAX_VALUE);
         ((TcpCommunicationSpi)iCfg.getCommunicationSpi()).setSharedMemoryPort(-1);//Shmem fail fix for Integer.MAX_VALUE.
 
-        CacheConfiguration<Integer, Integer> cacheRCfg2 = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> cacheRCfg2 = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cacheRCfg2.setName(CACHE_NAME_DHT_REPLICATED_2);
         cacheRCfg2.setCacheMode(CacheMode.REPLICATED);
@@ -502,7 +502,7 @@ public class GridCacheRebalancingSyncSelfTest extends GridCommonAbstractTest {
                     waitForRebalancing(4, 5, 0);
 
                     //New cache should start rebalancing.
-                    CacheConfiguration<Integer, Integer> cacheRCfg = new CacheConfiguration<>();
+                    CacheConfiguration<Integer, Integer> cacheRCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
                     cacheRCfg.setName(CACHE_NAME_DHT_PARTITIONED + "_NEW");
                     cacheRCfg.setCacheMode(CacheMode.PARTITIONED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingUnmarshallingFailedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingUnmarshallingFailedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingUnmarshallingFailedSelfTest.java
index d745dcd..6d72a52 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingUnmarshallingFailedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/GridCacheRebalancingUnmarshallingFailedSelfTest.java
@@ -103,7 +103,7 @@ public class GridCacheRebalancingUnmarshallingFailedSelfTest extends GridCommonA
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration iCfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration<TestKey, Integer> cfg = new CacheConfiguration<>();
+        CacheConfiguration<TestKey, Integer> cfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cfg.setName(CACHE);
         cfg.setCacheMode(CacheMode.PARTITIONED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheAbstractReplicatedByteArrayValuesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheAbstractReplicatedByteArrayValuesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheAbstractReplicatedByteArrayValuesSelfTest.java
index b4e58fc..9fd2f29 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheAbstractReplicatedByteArrayValuesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheAbstractReplicatedByteArrayValuesSelfTest.java
@@ -41,7 +41,7 @@ public abstract class GridCacheAbstractReplicatedByteArrayValuesSelfTest extends
 
     /** {@inheritDoc} */
     @Override protected CacheConfiguration cacheConfiguration0() {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setCacheMode(REPLICATED);
         cfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheSyncReplicatedPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheSyncReplicatedPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheSyncReplicatedPreloadSelfTest.java
index dd1e73b..e55a434 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheSyncReplicatedPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheSyncReplicatedPreloadSelfTest.java
@@ -94,17 +94,17 @@ public class GridCacheSyncReplicatedPreloadSelfTest extends GridCommonAbstractTe
         Ignite g1 = startGrid(1);
 
         for (int i = 0; i < keyCnt; i++)
-            g0.cache(null).put(i, i);
+            g0.cache(DEFAULT_CACHE_NAME).put(i, i);
 
-        assertEquals(keyCnt, ((IgniteKernal)g0).internalCache(null).size());
-        assertEquals(keyCnt, ((IgniteKernal)g1).internalCache(null).size());
+        assertEquals(keyCnt, ((IgniteKernal)g0).internalCache(DEFAULT_CACHE_NAME).size());
+        assertEquals(keyCnt, ((IgniteKernal)g1).internalCache(DEFAULT_CACHE_NAME).size());
 
         for (int n = 0; n < retries; n++) {
             info("Starting additional grid node...");
 
             Ignite g2 = startGrid(2);
 
-            assertEquals(keyCnt, ((IgniteKernal)g2).internalCache(null).size());
+            assertEquals(keyCnt, ((IgniteKernal)g2).internalCache(DEFAULT_CACHE_NAME).size());
 
             info("Stopping additional grid node...");
 
@@ -125,10 +125,10 @@ public class GridCacheSyncReplicatedPreloadSelfTest extends GridCommonAbstractTe
         Ignite g1 = startGrid(1);
 
         for (int i = 0; i < keyCnt; i++)
-            g0.cache(null).put(i, i);
+            g0.cache(DEFAULT_CACHE_NAME).put(i, i);
 
-        assertEquals(keyCnt, ((IgniteKernal)g0).internalCache(null).size());
-        assertEquals(keyCnt, ((IgniteKernal)g1).internalCache(null).size());
+        assertEquals(keyCnt, ((IgniteKernal)g0).internalCache(DEFAULT_CACHE_NAME).size());
+        assertEquals(keyCnt, ((IgniteKernal)g1).internalCache(DEFAULT_CACHE_NAME).size());
 
         final AtomicInteger cnt = new AtomicInteger();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
index 7f4f2fa..346f908 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadSelfTest.java
@@ -240,7 +240,7 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
         try {
             Ignite g1 = startGrid(1);
 
-            GridCacheAdapter<Integer, String> cache1 = ((IgniteKernal)g1).internalCache(null);
+            GridCacheAdapter<Integer, String> cache1 = ((IgniteKernal)g1).internalCache(DEFAULT_CACHE_NAME);
 
             cache1.getAndPut(1, "val1");
             cache1.getAndPut(2, "val2");
@@ -275,12 +275,12 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
             assertEquals(EVT_CACHE_REBALANCE_STARTED, iter.next().type());
             assertEquals(EVT_CACHE_REBALANCE_STOPPED, iter.next().type());
 
-            IgniteCache<Integer, String> cache2 = g2.cache(null);
+            IgniteCache<Integer, String> cache2 = g2.cache(DEFAULT_CACHE_NAME);
 
             assertEquals("val1", cache2.localPeek(1));
             assertEquals("val2", cache2.localPeek(2));
 
-            GridCacheAdapter<Integer, String> cacheAdapter2 = ((IgniteKernal)g2).internalCache(null);
+            GridCacheAdapter<Integer, String> cacheAdapter2 = ((IgniteKernal)g2).internalCache(DEFAULT_CACHE_NAME);
 
             GridCacheEntryEx e2 = cacheAdapter2.entryEx(1);
 
@@ -312,8 +312,8 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
             Ignite g1 = startGrid(1);
             Ignite g2 = startGrid(2);
 
-            IgniteCache<Integer, Object> cache1 = g1.cache(null);
-            IgniteCache<Integer, Object> cache2 = g2.cache(null);
+            IgniteCache<Integer, Object> cache1 = g1.cache(DEFAULT_CACHE_NAME);
+            IgniteCache<Integer, Object> cache2 = g2.cache(DEFAULT_CACHE_NAME);
 
             ClassLoader ldr = grid(1).configuration().getClassLoader();
 
@@ -357,7 +357,7 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
 
             Ignite g3 = startGrid(3);
 
-            IgniteCache<Integer, Object> cache3 = g3.cache(null);
+            IgniteCache<Integer, Object> cache3 = g3.cache(DEFAULT_CACHE_NAME);
 
             Object v3 = cache3.localPeek(1, CachePeekMode.ONHEAP);
 
@@ -392,9 +392,9 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
 
             Ignite g3 = startGrid(3);
 
-            IgniteCache<Integer, Object> cache1 = g1.cache(null);
-            IgniteCache<Integer, Object> cache2 = g2.cache(null);
-            IgniteCache<Integer, Object> cache3 = g3.cache(null);
+            IgniteCache<Integer, Object> cache1 = g1.cache(DEFAULT_CACHE_NAME);
+            IgniteCache<Integer, Object> cache2 = g2.cache(DEFAULT_CACHE_NAME);
+            IgniteCache<Integer, Object> cache3 = g3.cache(DEFAULT_CACHE_NAME);
 
             final Class<CacheEntryListener> cls1 = (Class<CacheEntryListener>) getExternalClassLoader().
                 loadClass("org.apache.ignite.tests.p2p.CacheDeploymentCacheEntryListener");
@@ -601,7 +601,7 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
             g1.events().remoteListen(null, (IgnitePredicate)cls2.newInstance(), EVT_CACHE_OBJECT_PUT);
             g1.events().remoteListen(null, new EventListener(), EVT_CACHE_OBJECT_PUT);
 
-            g1.cache(null).put("1", cls.newInstance());
+            g1.cache(DEFAULT_CACHE_NAME).put("1", cls.newInstance());
 
             latch.await();
         }
@@ -622,14 +622,14 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
         batchSize = 512;
 
         try {
-            IgniteCache<Integer, String> cache1 = startGrid(1).cache(null);
+            IgniteCache<Integer, String> cache1 = startGrid(1).cache(DEFAULT_CACHE_NAME);
 
             int keyCnt = 1000;
 
             for (int i = 0; i < keyCnt; i++)
                 cache1.put(i, "val" + i);
 
-            IgniteCache<Integer, String> cache2 = startGrid(2).cache(null);
+            IgniteCache<Integer, String> cache2 = startGrid(2).cache(DEFAULT_CACHE_NAME);
 
             assertEquals(keyCnt, cache2.localSize(CachePeekMode.ALL));
         }
@@ -646,14 +646,14 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
         batchSize = 256;
 
         try {
-            IgniteCache<Integer, String> cache1 = startGrid(1).cache(null);
+            IgniteCache<Integer, String> cache1 = startGrid(1).cache(DEFAULT_CACHE_NAME);
 
             int keyCnt = 2000;
 
             for (int i = 0; i < keyCnt; i++)
                 cache1.put(i, "val" + i);
 
-            IgniteCache<Integer, String> cache2 = startGrid(2).cache(null);
+            IgniteCache<Integer, String> cache2 = startGrid(2).cache(DEFAULT_CACHE_NAME);
 
             int size = cache2.localSize(CachePeekMode.ALL);
 
@@ -701,14 +701,14 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
         batchSize = 1; // 1 byte but one entry should be in batch anyway.
 
         try {
-            IgniteCache<Integer, String> cache1 = startGrid(1).cache(null);
+            IgniteCache<Integer, String> cache1 = startGrid(1).cache(DEFAULT_CACHE_NAME);
 
             int cnt = 100;
 
             for (int i = 0; i < cnt; i++)
                 cache1.put(i, "val" + i);
 
-            IgniteCache<Integer, String> cache2 = startGrid(2).cache(null);
+            IgniteCache<Integer, String> cache2 = startGrid(2).cache(DEFAULT_CACHE_NAME);
 
             assertEquals(cnt, cache2.localSize(CachePeekMode.ALL));
         }
@@ -725,14 +725,14 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
         batchSize = 1000; // 1000 bytes.
 
         try {
-            IgniteCache<Integer, String> cache1 = startGrid(1).cache(null);
+            IgniteCache<Integer, String> cache1 = startGrid(1).cache(DEFAULT_CACHE_NAME);
 
             int cnt = 100;
 
             for (int i = 0; i < cnt; i++)
                 cache1.put(i, "val" + i);
 
-            IgniteCache<Integer, String> cache2 = startGrid(2).cache(null);
+            IgniteCache<Integer, String> cache2 = startGrid(2).cache(DEFAULT_CACHE_NAME);
 
             assertEquals(cnt, cache2.localSize(CachePeekMode.ALL));
         }
@@ -749,14 +749,14 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
         batchSize = 10000; // 10000 bytes.
 
         try {
-            IgniteCache<Integer, String> cache1 = startGrid(1).cache(null);
+            IgniteCache<Integer, String> cache1 = startGrid(1).cache(DEFAULT_CACHE_NAME);
 
             int cnt = 100;
 
             for (int i = 0; i < cnt; i++)
                 cache1.put(i, "val" + i);
 
-            IgniteCache<Integer, String> cache2 = startGrid(2).cache(null);
+            IgniteCache<Integer, String> cache2 = startGrid(2).cache(DEFAULT_CACHE_NAME);
 
             assertEquals(cnt, cache2.localSize(CachePeekMode.ALL));
         }
@@ -787,7 +787,7 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
             for (int i = 0; i < cnt; i++) {
                 if (i % 100 == 0) {
                     if (map != null && !map.isEmpty()) {
-                        grid(0).cache(null).putAll(map);
+                        grid(0).cache(DEFAULT_CACHE_NAME).putAll(map);
 
                         info("Put entries count: " + i);
                     }
@@ -799,16 +799,16 @@ public class GridCacheReplicatedPreloadSelfTest extends GridCommonAbstractTest {
             }
 
             if (map != null && !map.isEmpty())
-                grid(0).cache(null).putAll(map);
+                grid(0).cache(DEFAULT_CACHE_NAME).putAll(map);
 
             for (int gridIdx = 0; gridIdx < gridCnt; gridIdx++) {
-                assert grid(gridIdx).cache(null).localSize(CachePeekMode.ALL) == cnt :
-                    "Actual size: " + grid(gridIdx).cache(null).localSize(CachePeekMode.ALL);
+                assert grid(gridIdx).cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.ALL) == cnt :
+                    "Actual size: " + grid(gridIdx).cache(DEFAULT_CACHE_NAME).localSize(CachePeekMode.ALL);
 
                 info("Cache size is OK for grid index: " + gridIdx);
             }
 
-            IgniteCache<Integer, String> lastCache = startGrid(gridCnt).cache(null);
+            IgniteCache<Integer, String> lastCache = startGrid(gridCnt).cache(DEFAULT_CACHE_NAME);
 
             // Let preloading start.
             Thread.sleep(1000);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadStartStopEventsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadStartStopEventsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadStartStopEventsSelfTest.java
index 2073d68..07c50d3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadStartStopEventsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/preloader/GridCacheReplicatedPreloadStartStopEventsSelfTest.java
@@ -52,7 +52,7 @@ public class GridCacheReplicatedPreloadStartStopEventsSelfTest extends GridCommo
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(REPLICATED);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java
index b6fcebc..abb553d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/EvictionAbstractTest.java
@@ -481,7 +481,7 @@ public abstract class EvictionAbstractTest<T extends EvictionPolicy<?, ?>>
         try {
             Ignite ignite = startGrid();
 
-            IgniteCache<Object, Object> cache = ignite.cache(null);
+            IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             int cnt = 500;
 
@@ -596,7 +596,7 @@ public abstract class EvictionAbstractTest<T extends EvictionPolicy<?, ?>>
     /** @return Policy. */
     @SuppressWarnings({"unchecked"})
     protected T policy() {
-        return (T)grid().cache(null).getConfiguration(CacheConfiguration.class).getEvictionPolicy();
+        return (T)grid().cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getEvictionPolicy();
     }
 
     /**
@@ -605,7 +605,7 @@ public abstract class EvictionAbstractTest<T extends EvictionPolicy<?, ?>>
      */
     @SuppressWarnings({"unchecked"})
     protected T policy(int i) {
-        return (T)grid(i).cache(null).getConfiguration(CacheConfiguration.class).getEvictionPolicy();
+        return (T)grid(i).cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getEvictionPolicy();
     }
 
     /**
@@ -614,7 +614,7 @@ public abstract class EvictionAbstractTest<T extends EvictionPolicy<?, ?>>
      */
     @SuppressWarnings({"unchecked"})
     protected T nearPolicy(int i) {
-        CacheConfiguration cfg = grid(i).cache(null).getConfiguration(CacheConfiguration.class);
+        CacheConfiguration cfg = grid(i).cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class);
 
         NearCacheConfiguration nearCfg = cfg.getNearConfiguration();
 
@@ -745,7 +745,7 @@ public abstract class EvictionAbstractTest<T extends EvictionPolicy<?, ?>>
             int cnt = 500;
 
             for (int i = 0; i < cnt; i++) {
-                IgniteCache<Integer, String> cache = grid(rand.nextInt(2)).cache(null);
+                IgniteCache<Integer, String> cache = grid(rand.nextInt(2)).cache(DEFAULT_CACHE_NAME);
 
                 int key = rand.nextInt(100);
                 String val = Integer.toString(key);
@@ -814,7 +814,7 @@ public abstract class EvictionAbstractTest<T extends EvictionPolicy<?, ?>>
                     for (int i = 0; i < cnt && !Thread.currentThread().isInterrupted(); i++) {
                         IgniteEx grid = grid(rand.nextInt(2));
 
-                        IgniteCache<Integer, String> cache = grid.cache(null);
+                        IgniteCache<Integer, String> cache = grid.cache(DEFAULT_CACHE_NAME);
 
                         int key = rand.nextInt(1000);
                         String val = Integer.toString(key);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java
index e61bef6..5ff0be2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionConsistencySelfTest.java
@@ -238,7 +238,7 @@ public class GridCacheConcurrentEvictionConsistencySelfTest extends GridCommonAb
         try {
             final Ignite ignite = startGrid(1);
 
-            final IgniteCache<Integer, Integer> cache = ignite.cache(null);
+            final IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             long start = System.currentTimeMillis();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionsSelfTest.java
index 31d7c26..45d98bf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheConcurrentEvictionsSelfTest.java
@@ -150,7 +150,7 @@ public class GridCacheConcurrentEvictionsSelfTest extends GridCommonAbstractTest
         try {
             Ignite ignite = startGrid(1);
 
-            final IgniteCache<Integer, Integer> cache = ignite.cache(null);
+            final IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             // Warm up.
             for (int i = 0; i < warmUpPutsCnt; i++) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java
index c97f2ca..f28e56b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEmptyEntriesAbstractSelfTest.java
@@ -174,7 +174,7 @@ public abstract class GridCacheEmptyEntriesAbstractSelfTest extends GridCommonAb
 
                 Ignite g = startGrids();
 
-                IgniteCache<String, String> cache = g.cache(null);
+                IgniteCache<String, String> cache = g.cache(DEFAULT_CACHE_NAME);
 
                 try {
                     info(">>> Checking policy [txConcurrency=" + txConcurrency + ", txIsolation=" + txIsolation +

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java
index eb675ad..b432c2d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/eviction/GridCacheEvictionFilterSelfTest.java
@@ -143,7 +143,7 @@ public class GridCacheEvictionFilterSelfTest extends GridCommonAbstractTest {
         try {
             Ignite g = grid(0);
 
-            IgniteCache<Object, Object> c = g.cache(null);
+            IgniteCache<Object, Object> c = g.cache(DEFAULT_CACHE_NAME);
 
             int cnt = 1;
 
@@ -198,7 +198,7 @@ public class GridCacheEvictionFilterSelfTest extends GridCommonAbstractTest {
 
         Ignite g = startGrid();
 
-        IgniteCache<Object, Object> cache = g.cache(null);
+        IgniteCache<Object, Object> cache = g.cache(DEFAULT_CACHE_NAME);
 
         try {
             int id = 1;


[07/51] [abbrv] ignite git commit: ignite-1794 Refactored hibernate modules, switched to hibernate 5.1

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java
deleted file mode 100644
index c87f08f..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStore.java
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
- * 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.cache.store.hibernate;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicBoolean;
-import javax.cache.integration.CacheLoaderException;
-import javax.cache.integration.CacheWriterException;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cache.store.CacheStore;
-import org.apache.ignite.cache.store.CacheStoreAdapter;
-import org.apache.ignite.cache.store.CacheStoreSession;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.IgniteInterruptedCheckedException;
-import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.Marshaller;
-import org.apache.ignite.marshaller.jdk.JdkMarshaller;
-import org.apache.ignite.resources.CacheStoreSessionResource;
-import org.apache.ignite.resources.IgniteInstanceResource;
-import org.apache.ignite.resources.LoggerResource;
-import org.apache.ignite.transactions.Transaction;
-import org.hibernate.HibernateException;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.SharedSessionContract;
-import org.hibernate.cfg.Configuration;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * {@link CacheStore} implementation backed by Hibernate. This implementation
- * stores objects in underlying database in {@code BLOB} format.
- * <h2 class="header">Configuration</h2>
- * Either {@link #setSessionFactory(SessionFactory)} or
- * {@link #setHibernateConfigurationPath(String)} or
- * {@link #setHibernateProperties(Properties)} should be set.
- * <p>
- * If session factory is provided it should contain
- * {@link CacheHibernateBlobStoreEntry} persistent class (via provided
- * mapping file {@code GridCacheHibernateStoreEntry.hbm.xml} or by
- * adding {@link CacheHibernateBlobStoreEntry} to annotated classes
- * of session factory.
- * <p>
- * Path to hibernate configuration may be either an URL or a file path or
- * a classpath resource. This configuration file should include provided
- * mapping {@code GridCacheHibernateStoreEntry.hbm.xml} or include annotated
- * class {@link CacheHibernateBlobStoreEntry}.
- * <p>
- * If hibernate properties are provided, mapping
- * {@code GridCacheHibernateStoreEntry.hbm.xml} is included automatically.
- * <p>
- * Use {@link CacheHibernateBlobStoreFactory} factory to pass {@link CacheHibernateBlobStore} to {@link CacheConfiguration}.
- */
-public class CacheHibernateBlobStore<K, V> extends CacheStoreAdapter<K, V> {
-    /**
-     * Default connection URL
-     * (value is <tt>jdbc:h2:mem:hibernateCacheStore;DB_CLOSE_DELAY=-1;DEFAULT_LOCK_TIMEOUT=5000</tt>).
-     */
-    public static final String DFLT_CONN_URL = "jdbc:h2:mem:hibernateCacheStore;DB_CLOSE_DELAY=-1;" +
-        "DEFAULT_LOCK_TIMEOUT=5000";
-
-    /** Default show SQL property value (value is <tt>true</tt>). */
-    public static final String DFLT_SHOW_SQL = "true";
-
-    /** Default <tt>hibernate.hbm2ddl.auto</tt> property value (value is <tt>true</tt>). */
-    public static final String DFLT_HBM2DDL_AUTO = "update";
-
-    /** Session attribute name. */
-    private static final String ATTR_SES = "HIBERNATE_STORE_SESSION";
-
-    /** Name of Hibarname mapping resource. */
-    private static final String MAPPING_RESOURCE =
-            "org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml";
-
-    /** Marshaller. */
-    private static final Marshaller marsh = new JdkMarshaller();
-
-    /** Init guard. */
-    @GridToStringExclude
-    private final AtomicBoolean initGuard = new AtomicBoolean();
-
-    /** Init latch. */
-    @GridToStringExclude
-    private final CountDownLatch initLatch = new CountDownLatch(1);
-
-    /** Hibernate properties. */
-    @GridToStringExclude
-    private Properties hibernateProps;
-
-    /** Session factory. */
-    @GridToStringExclude
-    private SessionFactory sesFactory;
-
-    /** Path to hibernate configuration file. */
-    private String hibernateCfgPath;
-
-    /** Log. */
-    @LoggerResource
-    private IgniteLogger log;
-
-    /** Auto-injected store session. */
-    @CacheStoreSessionResource
-    private CacheStoreSession ses;
-
-    /** Ignite instance. */
-    @IgniteInstanceResource
-    private Ignite ignite;
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"unchecked", "RedundantTypeArguments"})
-    @Override public V load(K key) {
-        init();
-
-        Transaction tx = transaction();
-
-        if (log.isDebugEnabled())
-            log.debug("Store load [key=" + key + ", tx=" + tx + ']');
-
-        Session ses = session(tx);
-
-        try {
-            CacheHibernateBlobStoreEntry entry = (CacheHibernateBlobStoreEntry)
-                ses.get(CacheHibernateBlobStoreEntry.class, toBytes(key));
-
-            if (entry == null)
-                return null;
-
-            return fromBytes(entry.getValue());
-        }
-        catch (IgniteCheckedException | HibernateException e) {
-            rollback(ses, tx);
-
-            throw new CacheLoaderException("Failed to load value from cache store with key: " + key, e);
-        }
-        finally {
-            end(ses, tx);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void write(javax.cache.Cache.Entry<? extends K, ? extends V> entry) {
-        init();
-
-        Transaction tx = transaction();
-
-        K key = entry.getKey();
-        V val = entry.getValue();
-
-        if (log.isDebugEnabled())
-            log.debug("Store put [key=" + key + ", val=" + val + ", tx=" + tx + ']');
-
-        if (val == null) {
-            delete(key);
-
-            return;
-        }
-
-        Session ses = session(tx);
-
-        try {
-            CacheHibernateBlobStoreEntry entry0 = new CacheHibernateBlobStoreEntry(toBytes(key), toBytes(val));
-
-            ses.saveOrUpdate(entry0);
-        }
-        catch (IgniteCheckedException | HibernateException e) {
-            rollback(ses, tx);
-
-            throw new CacheWriterException("Failed to put value to cache store [key=" + key + ", val" + val + "]", e);
-        }
-        finally {
-            end(ses, tx);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"JpaQueryApiInspection", "JpaQlInspection"})
-    @Override public void delete(Object key) {
-        init();
-
-        Transaction tx = transaction();
-
-        if (log.isDebugEnabled())
-            log.debug("Store remove [key=" + key + ", tx=" + tx + ']');
-
-        Session ses = session(tx);
-
-        try {
-            Object obj = ses.get(CacheHibernateBlobStoreEntry.class, toBytes(key));
-
-            if (obj != null)
-                ses.delete(obj);
-        }
-        catch (IgniteCheckedException | HibernateException e) {
-            rollback(ses, tx);
-
-            throw new CacheWriterException("Failed to remove value from cache store with key: " + key, e);
-        }
-        finally {
-            end(ses, tx);
-        }
-    }
-
-    /**
-     * Rolls back hibernate session.
-     *
-     * @param ses Hibernate session.
-     * @param tx Cache ongoing transaction.
-     */
-    private void rollback(SharedSessionContract ses, Transaction tx) {
-        // Rollback only if there is no cache transaction,
-        // otherwise sessionEnd() will do all required work.
-        if (tx == null) {
-            org.hibernate.Transaction hTx = ses.getTransaction();
-
-            if (hTx != null && hTx.isActive())
-                hTx.rollback();
-        }
-    }
-
-    /**
-     * Ends hibernate session.
-     *
-     * @param ses Hibernate session.
-     * @param tx Cache ongoing transaction.
-     */
-    private void end(Session ses, Transaction tx) {
-        // Commit only if there is no cache transaction,
-        // otherwise sessionEnd() will do all required work.
-        if (tx == null) {
-            org.hibernate.Transaction hTx = ses.getTransaction();
-
-            if (hTx != null && hTx.isActive())
-                hTx.commit();
-
-            ses.close();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void sessionEnd(boolean commit) {
-        init();
-
-        Transaction tx = transaction();
-
-        Map<String, Session> props = session().properties();
-
-        Session ses = props.remove(ATTR_SES);
-
-        if (ses != null) {
-            org.hibernate.Transaction hTx = ses.getTransaction();
-
-            if (hTx != null) {
-                try {
-                    if (commit) {
-                        ses.flush();
-
-                        hTx.commit();
-                    }
-                    else
-                        hTx.rollback();
-
-                    if (log.isDebugEnabled())
-                        log.debug("Transaction ended [xid=" + tx.xid() + ", commit=" + commit + ']');
-                }
-                catch (HibernateException e) {
-                    throw new CacheWriterException("Failed to end transaction [xid=" + tx.xid() +
-                        ", commit=" + commit + ']', e);
-                }
-                finally {
-                    ses.close();
-                }
-            }
-        }
-    }
-
-    /**
-     * Gets Hibernate session.
-     *
-     * @param tx Cache transaction.
-     * @return Session.
-     */
-    Session session(@Nullable Transaction tx) {
-        Session ses;
-
-        if (tx != null) {
-            Map<String, Session> props = session().properties();
-
-            ses = props.get(ATTR_SES);
-
-            if (ses == null) {
-                ses = sesFactory.openSession();
-
-                ses.beginTransaction();
-
-                // Store session in transaction metadata, so it can be accessed
-                // for other operations on the same transaction.
-                props.put(ATTR_SES, ses);
-
-                if (log.isDebugEnabled())
-                    log.debug("Hibernate session open [ses=" + ses + ", tx=" + tx.xid() + "]");
-            }
-        }
-        else {
-            ses = sesFactory.openSession();
-
-            ses.beginTransaction();
-        }
-
-        return ses;
-    }
-
-    /**
-     * Sets session factory.
-     *
-     * @param sesFactory Session factory.
-     */
-    public void setSessionFactory(SessionFactory sesFactory) {
-        this.sesFactory = sesFactory;
-    }
-
-    /**
-     * Sets hibernate configuration path.
-     * <p>
-     * This may be either URL or file path or classpath resource.
-     *
-     * @param hibernateCfgPath URL or file path or classpath resource
-     *      pointing to hibernate configuration XML file.
-     */
-    public void setHibernateConfigurationPath(String hibernateCfgPath) {
-        this.hibernateCfgPath = hibernateCfgPath;
-    }
-
-    /**
-     * Sets Hibernate properties.
-     *
-     * @param hibernateProps Hibernate properties.
-     */
-    public void setHibernateProperties(Properties hibernateProps) {
-        this.hibernateProps = hibernateProps;
-    }
-
-    /**
-     * Initializes store.
-     *
-     * @throws IgniteException If failed to initialize.
-     */
-    private void init() throws IgniteException {
-        if (initGuard.compareAndSet(false, true)) {
-            if (log.isDebugEnabled())
-                log.debug("Initializing cache store.");
-
-            try {
-                if (sesFactory != null)
-                    // Session factory has been provided - nothing to do.
-                    return;
-
-                if (!F.isEmpty(hibernateCfgPath)) {
-                    try {
-                        URL url = new URL(hibernateCfgPath);
-
-                        sesFactory = new Configuration().configure(url).buildSessionFactory();
-
-                        if (log.isDebugEnabled())
-                            log.debug("Configured session factory using URL: " + url);
-
-                        // Session factory has been successfully initialized.
-                        return;
-                    }
-                    catch (MalformedURLException e) {
-                        if (log.isDebugEnabled())
-                            log.debug("Caught malformed URL exception: " + e.getMessage());
-                    }
-
-                    // Provided path is not a valid URL. File?
-                    File cfgFile = new File(hibernateCfgPath);
-
-                    if (cfgFile.exists()) {
-                        sesFactory = new Configuration().configure(cfgFile).buildSessionFactory();
-
-                        if (log.isDebugEnabled())
-                            log.debug("Configured session factory using file: " + hibernateCfgPath);
-
-                        // Session factory has been successfully initialized.
-                        return;
-                    }
-
-                    // Provided path is not a file. Classpath resource?
-                    sesFactory = new Configuration().configure(hibernateCfgPath).buildSessionFactory();
-
-                    if (log.isDebugEnabled())
-                        log.debug("Configured session factory using classpath resource: " + hibernateCfgPath);
-                }
-                else {
-                    if (hibernateProps == null) {
-                        U.warn(log, "No Hibernate configuration has been provided for store (will use default).");
-
-                        hibernateProps = new Properties();
-
-                        hibernateProps.setProperty("hibernate.connection.url", DFLT_CONN_URL);
-                        hibernateProps.setProperty("hibernate.show_sql", DFLT_SHOW_SQL);
-                        hibernateProps.setProperty("hibernate.hbm2ddl.auto", DFLT_HBM2DDL_AUTO);
-                    }
-
-                    Configuration cfg = new Configuration();
-
-                    cfg.setProperties(hibernateProps);
-
-                    assert resourceAvailable(MAPPING_RESOURCE) : MAPPING_RESOURCE;
-
-                    cfg.addResource(MAPPING_RESOURCE);
-
-                    sesFactory = cfg.buildSessionFactory();
-
-                    if (log.isDebugEnabled())
-                        log.debug("Configured session factory using properties: " + hibernateProps);
-                }
-            }
-            catch (HibernateException e) {
-                throw new IgniteException("Failed to initialize store.", e);
-            }
-            finally {
-                initLatch.countDown();
-            }
-        }
-        else if (initLatch.getCount() > 0) {
-            try {
-                U.await(initLatch);
-            }
-            catch (IgniteInterruptedCheckedException e) {
-                throw new IgniteException(e);
-            }
-        }
-
-        if (sesFactory == null)
-            throw new IgniteException("Cache store was not properly initialized.");
-    }
-
-    /**
-     * Checks availability of a classpath resource.
-     *
-     * @param name Resource name.
-     * @return {@code true} if resource is available and ready for read, {@code false} otherwise.
-     */
-    private boolean resourceAvailable(String name) {
-        InputStream cfgStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
-
-        if (cfgStream == null) {
-            log.error("Classpath resource not found: " + name);
-
-            return false;
-        }
-
-        try {
-            // Read a single byte to force actual content access by JVM.
-            cfgStream.read();
-
-            return true;
-        }
-        catch (IOException e) {
-            log.error("Failed to read classpath resource: " + name, e);
-
-            return false;
-        }
-        finally {
-            U.close(cfgStream, log);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(CacheHibernateBlobStore.class, this);
-    }
-
-    /**
-     * Serialize object to byte array using marshaller.
-     *
-     * @param obj Object to convert to byte array.
-     * @return Byte array.
-     * @throws IgniteCheckedException If failed to convert.
-     */
-    protected byte[] toBytes(Object obj) throws IgniteCheckedException {
-        return U.marshal(marsh, obj);
-    }
-
-    /**
-     * Deserialize object from byte array using marshaller.
-     *
-     * @param bytes Bytes to deserialize.
-     * @param <X> Result object type.
-     * @return Deserialized object.
-     * @throws IgniteCheckedException If failed.
-     */
-    protected <X> X fromBytes(byte[] bytes) throws IgniteCheckedException {
-        if (bytes == null || bytes.length == 0)
-            return null;
-
-        return U.unmarshal(marsh, bytes, getClass().getClassLoader());
-    }
-
-    /**
-     * @return Current transaction.
-     */
-    @Nullable private Transaction transaction() {
-        CacheStoreSession ses = session();
-
-        return ses != null ? ses.transaction() : null;
-    }
-
-    /**
-     * @return Store session.
-     */
-    private CacheStoreSession session() {
-        return ses;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml b/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml
deleted file mode 100644
index 5b0be43..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-
-
-<!DOCTYPE hibernate-mapping PUBLIC
-        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
-        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping package="org.apache.ignite.examples.datagrid.store" default-access="field">
-    <class name="org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreEntry" table="ENTRIES">
-        <id name="key"/>
-
-        <property name="val"/>
-    </class>
-</hibernate-mapping>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.java
deleted file mode 100644
index d40c5ef..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.cache.store.hibernate;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-/**
- * Entry that is used by {@link CacheHibernateBlobStore} implementation.
- * <p>
- * Note that this is a reference implementation for tests only.
- * When running on production systems use concrete key-value types to
- * get better performance.
- */
-@Entity
-@Table(name = "ENTRIES")
-public class CacheHibernateBlobStoreEntry {
-    /** Key (use concrete key type in production). */
-    @Id
-    @Column(length = 65535)
-    private byte[] key;
-
-    /** Value (use concrete value type in production). */
-    @Column(length = 65535)
-    private byte[] val;
-
-    /**
-     * Constructor.
-     */
-    CacheHibernateBlobStoreEntry() {
-        // No-op.
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param key Key.
-     * @param val Value.
-     */
-    CacheHibernateBlobStoreEntry(byte[] key, byte[] val) {
-        this.key = key;
-        this.val = val;
-    }
-
-    /**
-     * @return Key.
-     */
-    public byte[] getKey() {
-        return key;
-    }
-
-    /**
-     * @param key Key.
-     */
-    public void setKey(byte[] key) {
-        this.key = key;
-    }
-
-    /**
-     * @return Value.
-     */
-    public byte[] getValue() {
-        return val;
-    }
-
-    /**
-     * @param val Value.
-     */
-    public void setValue(byte[] val) {
-        this.val = val;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreFactory.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreFactory.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreFactory.java
deleted file mode 100644
index ea4df8a..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreFactory.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * 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.cache.store.hibernate;
-
-import java.util.Properties;
-import javax.cache.configuration.Factory;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.internal.IgniteComponentType;
-import org.apache.ignite.internal.util.spring.IgniteSpringHelper;
-import org.apache.ignite.internal.util.tostring.GridToStringExclude;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.resources.SpringApplicationContextResource;
-import org.hibernate.SessionFactory;
-
-/**
- * {@link Factory} implementation for {@link CacheHibernateBlobStore}.
- *
- * Use this factory to pass {@link CacheHibernateBlobStore} to {@link CacheConfiguration}.
- *
- * <h2 class="header">Java Example</h2>
- * In this example existing session factory is provided.
- * <pre name="code" class="java">
- *     ...
- *     CacheHibernateBlobStoreFactory&lt;String, String&gt; factory = new CacheHibernateBlobStoreFactory&lt;String, String&gt;();
- *
- *     factory.setSessionFactory(sesFactory);
- *     ...
- * </pre>
- *
- * <h2 class="header">Spring Example (using Spring ORM)</h2>
- * <pre name="code" class="xml">
- *   ...
- *   &lt;bean id=&quot;cache.hibernate.store.factory&quot;
- *       class=&quot;org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory&quot;&gt;
- *       &lt;property name=&quot;sessionFactory&quot;&gt;
- *           &lt;bean class=&quot;org.springframework.orm.hibernate3.LocalSessionFactoryBean&quot;&gt;
- *               &lt;property name=&quot;hibernateProperties&quot;&gt;
- *                   &lt;value&gt;
- *                       connection.url=jdbc:h2:mem:
- *                       show_sql=true
- *                       hbm2ddl.auto=true
- *                       hibernate.dialect=org.hibernate.dialect.H2Dialect
- *                   &lt;/value&gt;
- *               &lt;/property&gt;
- *               &lt;property name=&quot;mappingResources&quot;&gt;
- *                   &lt;list&gt;
- *                       &lt;value&gt;
- *                           org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreEntry.hbm.xml
- *                       &lt;/value&gt;
- *                   &lt;/list&gt;
- *               &lt;/property&gt;
- *           &lt;/bean&gt;
- *       &lt;/property&gt;
- *   &lt;/bean&gt;
- *   ...
- * </pre>
- *
- * <h2 class="header">Spring Example (using Spring ORM and persistent annotations)</h2>
- * <pre name="code" class="xml">
- *     ...
- *     &lt;bean id=&quot;cache.hibernate.store.factory1&quot;
- *         class=&quot;org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory&quot;&gt;
- *         &lt;property name=&quot;sessionFactory&quot;&gt;
- *             &lt;bean class=&quot;org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean&quot;&gt;
- *                 &lt;property name=&quot;hibernateProperties&quot;&gt;
- *                     &lt;value&gt;
- *                         connection.url=jdbc:h2:mem:
- *                         show_sql=true
- *                         hbm2ddl.auto=true
- *                         hibernate.dialect=org.hibernate.dialect.H2Dialect
- *                     &lt;/value&gt;
- *                 &lt;/property&gt;
- *                 &lt;property name=&quot;annotatedClasses&quot;&gt;
- *                     &lt;list&gt;
- *                         &lt;value&gt;
- *                             org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreEntry
- *                         &lt;/value&gt;
- *                     &lt;/list&gt;
- *                 &lt;/property&gt;
- *             &lt;/bean&gt;
- *         &lt;/property&gt;
- *     &lt;/bean&gt;
- *     ...
- * </pre>
- *
- * <h2 class="header">Spring Example</h2>
- * <pre name="code" class="xml">
- *     ...
- *     &lt;bean id=&quot;cache.hibernate.store.factory2&quot;
- *         class=&quot;org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory&quot;&gt;
- *         &lt;property name=&quot;hibernateProperties&quot;&gt;
- *             &lt;props&gt;
- *                 &lt;prop key=&quot;connection.url&quot;&gt;jdbc:h2:mem:&lt;/prop&gt;
- *                 &lt;prop key=&quot;hbm2ddl.auto&quot;&gt;update&lt;/prop&gt;
- *                 &lt;prop key=&quot;show_sql&quot;&gt;true&lt;/prop&gt;
- *             &lt;/props&gt;
- *         &lt;/property&gt;
- *     &lt;/bean&gt;
- *     ...
- * </pre>
- * <p>
- * <img src="http://ignite.apache.org/images/spring-small.png">
- * <br>
- * For information about Spring framework visit <a href="http://www.springframework.org/">www.springframework.org</a>
- */
-public class CacheHibernateBlobStoreFactory<K, V> implements Factory<CacheHibernateBlobStore<K, V>> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Session factory. */
-    @GridToStringExclude
-    private transient SessionFactory sesFactory;
-
-    /** Session factory bean name. */
-    private String sesFactoryBean;
-
-    /** Path to hibernate configuration file. */
-    private String hibernateCfgPath;
-
-    /** Hibernate properties. */
-    @GridToStringExclude
-    private Properties hibernateProps;
-
-    /** Application context. */
-    @SpringApplicationContextResource
-    private Object appContext;
-
-    /** {@inheritDoc} */
-    @Override public CacheHibernateBlobStore<K, V> create() {
-        CacheHibernateBlobStore<K, V> store = new CacheHibernateBlobStore<>();
-
-        store.setHibernateConfigurationPath(hibernateCfgPath);
-        store.setHibernateProperties(hibernateProps);
-
-        if (sesFactory != null)
-            store.setSessionFactory(sesFactory);
-        else if (sesFactoryBean != null) {
-            if (appContext == null)
-                throw new IgniteException("Spring application context resource is not injected.");
-
-            IgniteSpringHelper spring;
-
-            try {
-                spring = IgniteComponentType.SPRING.create(false);
-
-                SessionFactory sesFac = spring.loadBeanFromAppContext(appContext, sesFactoryBean);
-
-                store.setSessionFactory(sesFac);
-            }
-            catch (IgniteCheckedException e) {
-                throw new IgniteException("Failed to load bean in application context [beanName=" + sesFactoryBean +
-                        ", igniteConfig=" + appContext + ']');
-            }
-        }
-
-        return store;
-    }
-
-    /**
-     * Sets session factory.
-     *
-     * @param sesFactory Session factory.
-     * @return {@code This} for chaining.
-     * @see CacheHibernateBlobStore#setSessionFactory(SessionFactory)
-     */
-    public CacheHibernateBlobStoreFactory<K, V> setSessionFactory(SessionFactory sesFactory) {
-        this.sesFactory = sesFactory;
-
-        return this;
-    }
-
-    /**
-     * Sets name of the data source bean.
-     *
-     * @param sesFactory Session factory bean name.
-     * @return {@code This} for chaining.
-     * @see CacheHibernateBlobStore#setSessionFactory(SessionFactory)
-     */
-    public CacheHibernateBlobStoreFactory<K, V> setSessionFactoryBean(String sesFactory) {
-        this.sesFactoryBean = sesFactory;
-
-        return this;
-    }
-
-    /**
-     * Sets hibernate configuration path.
-     * <p>
-     * This may be either URL or file path or classpath resource.
-     *
-     * @param hibernateCfgPath URL or file path or classpath resource
-     *      pointing to hibernate configuration XML file.
-     * @return {@code This} for chaining.
-     * @see CacheHibernateBlobStore#setHibernateConfigurationPath(String)
-     */
-    public CacheHibernateBlobStoreFactory<K, V> setHibernateConfigurationPath(String hibernateCfgPath) {
-        this.hibernateCfgPath = hibernateCfgPath;
-
-        return this;
-    }
-
-    /**
-     * Sets Hibernate properties.
-     *
-     * @param hibernateProps Hibernate properties.
-     * @return {@code This} for chaining.
-     * @see CacheHibernateBlobStore#setHibernateProperties(Properties)
-     */
-    public CacheHibernateBlobStoreFactory<K, V> setHibernateProperties(Properties hibernateProps) {
-        this.hibernateProps = hibernateProps;
-
-        return this;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(CacheHibernateBlobStoreFactory.class, this);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListener.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListener.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListener.java
deleted file mode 100644
index 917641c..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreSessionListener.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * 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.cache.store.hibernate;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import javax.cache.integration.CacheWriterException;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cache.store.CacheStore;
-import org.apache.ignite.cache.store.CacheStoreSession;
-import org.apache.ignite.cache.store.CacheStoreSessionListener;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lifecycle.LifecycleAware;
-import org.apache.ignite.resources.LoggerResource;
-import org.hibernate.HibernateException;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.cfg.Configuration;
-
-/**
- * Hibernate-based cache store session listener.
- * <p>
- * This listener creates a new Hibernate session for each store
- * session. If there is an ongoing cache transaction, a corresponding
- * Hibernate transaction is created as well.
- * <p>
- * The Hibernate session is saved as a store session
- * {@link CacheStoreSession#attachment() attachment}.
- * The listener guarantees that the session will be
- * available for any store operation. If there is an
- * ongoing cache transaction, all operations within this
- * transaction will share a DB transaction.
- * <p>
- * As an example, here is how the {@link CacheStore#write(javax.cache.Cache.Entry)}
- * method can be implemented if {@link CacheHibernateStoreSessionListener}
- * is configured:
- * <pre name="code" class="java">
- * private static class Store extends CacheStoreAdapter&lt;Integer, Integer&gt; {
- *     &#64;CacheStoreSessionResource
- *     private CacheStoreSession ses;
- *
- *     &#64;Override public void write(Cache.Entry&lt;? extends Integer, ? extends Integer&gt; entry) throws CacheWriterException {
- *         // Get Hibernate session from the current store session.
- *         Session hibSes = ses.attachment();
- *
- *         // Persist the value.
- *         hibSes.persist(entry.getValue());
- *     }
- * }
- * </pre>
- * Hibernate session will be automatically created by the listener
- * at the start of the session and closed when it ends.
- * <p>
- * {@link CacheHibernateStoreSessionListener} requires that either
- * {@link #setSessionFactory(SessionFactory)} session factory}
- * or {@link #setHibernateConfigurationPath(String) Hibernate configuration file}
- * is provided. If non of them is set, exception is thrown. Is both are provided,
- * session factory will be used.
- */
-public class CacheHibernateStoreSessionListener implements CacheStoreSessionListener, LifecycleAware {
-    /** Hibernate session factory. */
-    private SessionFactory sesFactory;
-
-    /** Hibernate configuration file path. */
-    private String hibernateCfgPath;
-
-    /** Logger. */
-    @LoggerResource
-    private IgniteLogger log;
-
-    /** Whether to close session on stop. */
-    private boolean closeSesOnStop;
-
-    /**
-     * Sets Hibernate session factory.
-     * <p>
-     * Either session factory or configuration file is required.
-     * If none is provided, exception will be thrown on startup.
-     *
-     * @param sesFactory Session factory.
-     */
-    public void setSessionFactory(SessionFactory sesFactory) {
-        this.sesFactory = sesFactory;
-    }
-
-    /**
-     * Gets Hibernate session factory.
-     *
-     * @return Session factory.
-     */
-    public SessionFactory getSessionFactory() {
-        return sesFactory;
-    }
-
-    /**
-     * Sets hibernate configuration path.
-     * <p>
-     * Either session factory or configuration file is required.
-     * If none is provided, exception will be thrown on startup.
-     *
-     * @param hibernateCfgPath Hibernate configuration path.
-     */
-    public void setHibernateConfigurationPath(String hibernateCfgPath) {
-        this.hibernateCfgPath = hibernateCfgPath;
-    }
-
-    /**
-     * Gets hibernate configuration path.
-     *
-     * @return Hibernate configuration path.
-     */
-    public String getHibernateConfigurationPath() {
-        return hibernateCfgPath;
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings("deprecation")
-    @Override public void start() throws IgniteException {
-        if (sesFactory == null && F.isEmpty(hibernateCfgPath))
-            throw new IgniteException("Either session factory or Hibernate configuration file is required by " +
-                getClass().getSimpleName() + '.');
-
-        if (!F.isEmpty(hibernateCfgPath)) {
-            if (sesFactory == null) {
-                try {
-                    URL url = new URL(hibernateCfgPath);
-
-                    sesFactory = new Configuration().configure(url).buildSessionFactory();
-                }
-                catch (MalformedURLException ignored) {
-                    // No-op.
-                }
-
-                if (sesFactory == null) {
-                    File cfgFile = new File(hibernateCfgPath);
-
-                    if (cfgFile.exists())
-                        sesFactory = new Configuration().configure(cfgFile).buildSessionFactory();
-                }
-
-                if (sesFactory == null)
-                    sesFactory = new Configuration().configure(hibernateCfgPath).buildSessionFactory();
-
-                if (sesFactory == null)
-                    throw new IgniteException("Failed to resolve Hibernate configuration file: " + hibernateCfgPath);
-
-                closeSesOnStop = true;
-            }
-            else
-                U.warn(log, "Hibernate configuration file configured in " + getClass().getSimpleName() +
-                    " will be ignored (session factory is already set).");
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void stop() throws IgniteException {
-        if (closeSesOnStop && sesFactory != null && !sesFactory.isClosed())
-            sesFactory.close();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onSessionStart(CacheStoreSession ses) {
-        if (ses.attachment() == null) {
-            try {
-                Session hibSes = sesFactory.openSession();
-
-                ses.attach(hibSes);
-
-                if (ses.isWithinTransaction())
-                    hibSes.beginTransaction();
-            }
-            catch (HibernateException e) {
-                throw new CacheWriterException("Failed to start store session [tx=" + ses.transaction() + ']', e);
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void onSessionEnd(CacheStoreSession ses, boolean commit) {
-        Session hibSes = ses.attach(null);
-
-        if (hibSes != null) {
-            try {
-                Transaction tx = hibSes.getTransaction();
-
-                if (commit) {
-                    hibSes.flush();
-
-                    if (tx.isActive())
-                        tx.commit();
-                }
-                else if (tx.isActive())
-                    tx.rollback();
-            }
-            catch (HibernateException e) {
-                throw new CacheWriterException("Failed to end store session [tx=" + ses.transaction() + ']', e);
-            }
-            finally {
-                hibSes.close();
-            }
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/package-info.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/package-info.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/package-info.java
deleted file mode 100644
index 891d99a..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/store/hibernate/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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 description. -->
- * Contains reference Hibernate-based cache store implementation.
- */
-package org.apache.ignite.cache.store.hibernate;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/test/config/factory-cache.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/test/config/factory-cache.xml b/modules/hibernate/src/test/config/factory-cache.xml
deleted file mode 100644
index a251846..0000000
--- a/modules/hibernate/src/test/config/factory-cache.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="
-        http://www.springframework.org/schema/beans
-        http://www.springframework.org/schema/beans/spring-beans.xsd">
-
-    <bean id="simpleSessionFactory"
-          class="org.apache.ignite.cache.store.hibernate.CacheHibernateStoreFactorySelfTest$DummySessionFactoryExt"/>
-
-    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
-        <property name="cacheConfiguration">
-            <list>
-                <bean class="org.apache.ignite.configuration.CacheConfiguration">
-                    <property name="name" value="test"/>
-                    <property name="atomicityMode" value="ATOMIC"/>
-                    <property name="backups" value="1"/>
-                    <property name="cacheStoreFactory">
-                        <bean class="org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory">
-                            <property name="sessionFactoryBean" value = "simpleSessionFactory"/>
-                        </bean>
-                    </property>
-                </bean>
-            </list>
-        </property>
-
-        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
-        <property name="discoverySpi">
-            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
-                <property name="ipFinder">
-                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
-                        <property name="addresses">
-                            <list>
-                                <value>127.0.0.1:47500..47509</value>
-                            </list>
-                        </property>
-                    </bean>
-                </property>
-            </bean>
-        </property>
-    </bean>
-</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/test/config/factory-cache1.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/test/config/factory-cache1.xml b/modules/hibernate/src/test/config/factory-cache1.xml
deleted file mode 100644
index 7a53b1f..0000000
--- a/modules/hibernate/src/test/config/factory-cache1.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="
-        http://www.springframework.org/schema/beans
-        http://www.springframework.org/schema/beans/spring-beans.xsd">
-
-    <bean id="simpleSessionFactory1"
-          class="org.apache.ignite.cache.store.hibernate.CacheHibernateStoreFactorySelfTest$DummySessionFactory"/>
-
-    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
-        <property name="igniteInstanceName" value="ignite1"/>
-
-        <property name="cacheConfiguration">
-            <list>
-                <bean class="org.apache.ignite.configuration.CacheConfiguration">
-                    <property name="name" value="test"/>
-                    <property name="atomicityMode" value="ATOMIC"/>
-                    <property name="backups" value="1"/>
-                    <property name="cacheStoreFactory">
-                        <bean class="org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory">
-                            <property name="sessionFactoryBean" value = "simpleSessionFactory1"/>
-                        </bean>
-                    </property>
-                </bean>
-            </list>
-        </property>
-
-        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
-        <property name="discoverySpi">
-            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
-                <property name="ipFinder">
-                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
-                        <property name="addresses">
-                            <list>
-                                <value>127.0.0.1:47500..47509</value>
-                            </list>
-                        </property>
-                    </bean>
-                </property>
-            </bean>
-        </property>
-    </bean>
-</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/test/config/factory-incorrect-store-cache.xml
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/test/config/factory-incorrect-store-cache.xml b/modules/hibernate/src/test/config/factory-incorrect-store-cache.xml
deleted file mode 100644
index 459930c..0000000
--- a/modules/hibernate/src/test/config/factory-incorrect-store-cache.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="
-        http://www.springframework.org/schema/beans
-        http://www.springframework.org/schema/beans/spring-beans.xsd">
-
-    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
-        <property name="cacheConfiguration">
-            <list>
-                <bean class="org.apache.ignite.configuration.CacheConfiguration">
-                    <property name="name" value="test"/>
-                    <property name="atomicityMode" value="ATOMIC"/>
-                    <property name="backups" value="1"/>
-                    <property name="cacheStoreFactory">
-                        <bean class="org.apache.ignite.cache.store.hibernate.CacheHibernateBlobStoreFactory">
-                            <property name="sessionFactoryBean" value = "simpleSessionFactory1"/>
-                        </bean>
-                    </property>
-                </bean>
-            </list>
-        </property>
-
-        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
-        <property name="discoverySpi">
-            <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
-                <property name="ipFinder">
-                    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
-                        <property name="addresses">
-                            <list>
-                                <value>127.0.0.1:47500..47509</value>
-                            </list>
-                        </property>
-                    </bean>
-                </property>
-            </bean>
-        </property>
-    </bean>
-</beans>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java b/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java
deleted file mode 100644
index b018d0b..0000000
--- a/modules/hibernate/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheConfigurationSelfTest.java
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import javax.cache.Cache;
-import javax.persistence.Cacheable;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.annotations.CacheConcurrencyStrategy;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.service.ServiceRegistryBuilder;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
-import static org.apache.ignite.cache.CacheMode.PARTITIONED;
-import static org.apache.ignite.cache.hibernate.HibernateRegionFactory.DFLT_ACCESS_TYPE_PROPERTY;
-import static org.apache.ignite.cache.hibernate.HibernateRegionFactory.DFLT_CACHE_NAME_PROPERTY;
-import static org.apache.ignite.cache.hibernate.HibernateRegionFactory.IGNITE_INSTANCE_NAME_PROPERTY;
-import static org.apache.ignite.cache.hibernate.HibernateRegionFactory.REGION_CACHE_PROPERTY;
-import static org.hibernate.cfg.AvailableSettings.CACHE_REGION_FACTORY;
-import static org.hibernate.cfg.AvailableSettings.GENERATE_STATISTICS;
-import static org.hibernate.cfg.AvailableSettings.HBM2DDL_AUTO;
-import static org.hibernate.cfg.AvailableSettings.RELEASE_CONNECTIONS;
-import static org.hibernate.cfg.AvailableSettings.USE_QUERY_CACHE;
-import static org.hibernate.cfg.AvailableSettings.USE_SECOND_LEVEL_CACHE;
-
-/**
- * Tests Hibernate L2 cache configuration.
- */
-public class HibernateL2CacheConfigurationSelfTest extends GridCommonAbstractTest {
-    /** */
-    public static final String ENTITY1_NAME = Entity1.class.getName();
-
-    /** */
-    public static final String ENTITY2_NAME = Entity2.class.getName();
-
-    /** */
-    public static final String ENTITY3_NAME = Entity3.class.getName();
-
-    /** */
-    public static final String ENTITY4_NAME = Entity4.class.getName();
-
-    /** */
-    public static final String TIMESTAMP_CACHE = "org.hibernate.cache.spi.UpdateTimestampsCache";
-
-    /** */
-    public static final String QUERY_CACHE = "org.hibernate.cache.internal.StandardQueryCache";
-
-    /** */
-    public static final String CONNECTION_URL = "jdbc:h2:mem:example;DB_CLOSE_DELAY=-1";
-
-    /** If {@code true} then sets default cache in configuration. */
-    private boolean dfltCache;
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGrid(0);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        for (IgniteCacheProxy<?, ?> cache : ((IgniteKernal)grid(0)).caches())
-            cache.clear();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
-        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
-
-        discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
-
-        cfg.setDiscoverySpi(discoSpi);
-
-        cfg.setCacheConfiguration(cacheConfiguration(ENTITY3_NAME), cacheConfiguration(ENTITY4_NAME),
-            cacheConfiguration("cache1"), cacheConfiguration("cache2"), cacheConfiguration("cache3"),
-            cacheConfiguration(TIMESTAMP_CACHE), cacheConfiguration(QUERY_CACHE));
-
-        return cfg;
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @return Cache configuration.
-     */
-    private CacheConfiguration cacheConfiguration(String cacheName) {
-        CacheConfiguration cfg = new CacheConfiguration();
-
-        cfg.setName(cacheName);
-
-        cfg.setCacheMode(PARTITIONED);
-
-        cfg.setAtomicityMode(ATOMIC);
-
-        return cfg;
-    }
-    /**
-     * @param igniteInstanceName Ignite instance name.
-     * @return Hibernate configuration.
-     */
-    protected Configuration hibernateConfiguration(String igniteInstanceName) {
-        Configuration cfg = new Configuration();
-
-        cfg.addAnnotatedClass(Entity1.class);
-        cfg.addAnnotatedClass(Entity2.class);
-        cfg.addAnnotatedClass(Entity3.class);
-        cfg.addAnnotatedClass(Entity4.class);
-
-        cfg.setProperty(DFLT_ACCESS_TYPE_PROPERTY, AccessType.NONSTRICT_READ_WRITE.name());
-
-        cfg.setProperty(HBM2DDL_AUTO, "create");
-
-        cfg.setProperty(GENERATE_STATISTICS, "true");
-
-        cfg.setProperty(USE_SECOND_LEVEL_CACHE, "true");
-
-        cfg.setProperty(USE_QUERY_CACHE, "true");
-
-        cfg.setProperty(CACHE_REGION_FACTORY, HibernateRegionFactory.class.getName());
-
-        cfg.setProperty(RELEASE_CONNECTIONS, "on_close");
-
-        cfg.setProperty(IGNITE_INSTANCE_NAME_PROPERTY, igniteInstanceName);
-
-        cfg.setProperty(REGION_CACHE_PROPERTY + ENTITY1_NAME, "cache1");
-        cfg.setProperty(REGION_CACHE_PROPERTY + ENTITY2_NAME, "cache2");
-        cfg.setProperty(REGION_CACHE_PROPERTY + TIMESTAMP_CACHE, TIMESTAMP_CACHE);
-        cfg.setProperty(REGION_CACHE_PROPERTY + QUERY_CACHE, QUERY_CACHE);
-
-        if (dfltCache)
-            cfg.setProperty(DFLT_CACHE_NAME_PROPERTY, "cache3");
-
-        return cfg;
-    }
-
-    /**
-     * Tests property {@link HibernateRegionFactory#REGION_CACHE_PROPERTY}.
-     */
-    public void testPerRegionCacheProperty() {
-        testCacheUsage(1, 1, 0, 1, 1);
-    }
-
-    /**
-     * Tests property {@link HibernateRegionFactory#DFLT_CACHE_NAME_PROPERTY}.
-     */
-    public void testDefaultCache() {
-        dfltCache = true;
-
-        testCacheUsage(1, 1, 2, 0, 0);
-    }
-
-    /**
-     * @param expCache1 Expected size of cache with name 'cache1'.
-     * @param expCache2 Expected size of cache with name 'cache2'.
-     * @param expCache3 Expected size of cache with name 'cache3'.
-     * @param expCacheE3 Expected size of cache with name {@link #ENTITY3_NAME}.
-     * @param expCacheE4 Expected size of cache with name {@link #ENTITY4_NAME}.
-     */
-    @SuppressWarnings("unchecked")
-    private void testCacheUsage(int expCache1, int expCache2, int expCache3, int expCacheE3, int expCacheE4) {
-        SessionFactory sesFactory = startHibernate(getTestIgniteInstanceName(0));
-
-        try {
-            Session ses = sesFactory.openSession();
-
-            try {
-                Transaction tx = ses.beginTransaction();
-
-                ses.save(new Entity1());
-                ses.save(new Entity2());
-                ses.save(new Entity3());
-                ses.save(new Entity4());
-
-                tx.commit();
-            }
-            finally {
-                ses.close();
-            }
-
-            ses = sesFactory.openSession();
-
-            try {
-                List<Entity1> list1 = ses.createCriteria(ENTITY1_NAME).list();
-
-                assertEquals(1, list1.size());
-
-                for (Entity1 e : list1) {
-                    ses.load(ENTITY1_NAME, e.getId());
-                    assertNotNull(e.getId());
-                }
-
-                List<Entity2> list2 = ses.createCriteria(ENTITY2_NAME).list();
-
-                assertEquals(1, list2.size());
-
-                for (Entity2 e : list2)
-                    assertNotNull(e.getId());
-
-                List<Entity3> list3 = ses.createCriteria(ENTITY3_NAME).list();
-
-                assertEquals(1, list3.size());
-
-                for (Entity3 e : list3)
-                    assertNotNull(e.getId());
-
-                List<Entity4> list4 = ses.createCriteria(ENTITY4_NAME).list();
-
-                assertEquals(1, list4.size());
-
-                for (Entity4 e : list4)
-                    assertNotNull(e.getId());
-            }
-            finally {
-                ses.close();
-            }
-
-            IgniteCache<Object, Object> cache1 = grid(0).cache("cache1");
-            IgniteCache<Object, Object> cache2 = grid(0).cache("cache2");
-            IgniteCache<Object, Object> cache3 = grid(0).cache("cache3");
-            IgniteCache<Object, Object> cacheE3 = grid(0).cache(ENTITY3_NAME);
-            IgniteCache<Object, Object> cacheE4 = grid(0).cache(ENTITY4_NAME);
-
-            assertEquals("Unexpected entries: " + toSet(cache1.iterator()), expCache1, cache1.size());
-            assertEquals("Unexpected entries: " + toSet(cache2.iterator()), expCache2, cache2.size());
-            assertEquals("Unexpected entries: " + toSet(cache3.iterator()), expCache3, cache3.size());
-            assertEquals("Unexpected entries: " + toSet(cacheE3.iterator()), expCacheE3, cacheE3.size());
-            assertEquals("Unexpected entries: " + toSet(cacheE4.iterator()), expCacheE4, cacheE4.size());
-        }
-        finally {
-            sesFactory.close();
-        }
-    }
-
-    /**
-     *
-     */
-    private <K, V> Set<Cache.Entry<K, V>> toSet(Iterator<Cache.Entry<K, V>> iter){
-        Set<Cache.Entry<K, V>> set = new HashSet<>();
-
-        while (iter.hasNext())
-            set.add(iter.next());
-
-        return set;
-    }
-
-    /**
-     * @param igniteInstanceName Name of the grid providing caches.
-     * @return Session factory.
-     */
-    private SessionFactory startHibernate(String igniteInstanceName) {
-        Configuration cfg = hibernateConfiguration(igniteInstanceName);
-
-        ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
-
-        builder.applySetting("hibernate.connection.url", CONNECTION_URL);
-        builder.applySetting("hibernate.show_sql", false);
-
-        return cfg.buildSessionFactory(builder.buildServiceRegistry());
-    }
-
-    /**
-     * Test Hibernate entity1.
-     */
-    @javax.persistence.Entity
-    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
-    @Cacheable
-    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
-    public static class Entity1 {
-        /** */
-        private int id;
-
-        /**
-         * @return ID.
-         */
-        @Id
-        @GeneratedValue
-        public int getId() {
-            return id;
-        }
-
-        /**
-         * @param id ID.
-         */
-        public void setId(int id) {
-            this.id = id;
-        }
-    }
-
-    /**
-     * Test Hibernate entity2.
-     */
-    @javax.persistence.Entity
-    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
-    @Cacheable
-    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
-    public static class Entity2 {
-        /** */
-        private int id;
-
-        /**
-         * @return ID.
-         */
-        @Id
-        @GeneratedValue
-        public int getId() {
-            return id;
-        }
-
-        /**
-         * @param id ID.
-         */
-        public void setId(int id) {
-            this.id = id;
-        }
-    }
-
-    /**
-     * Test Hibernate entity3.
-     */
-    @javax.persistence.Entity
-    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
-    @Cacheable
-    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
-    public static class Entity3 {
-        /** */
-        private int id;
-
-        /**
-         * @return ID.
-         */
-        @Id
-        @GeneratedValue
-        public int getId() {
-            return id;
-        }
-
-        /**
-         * @param id ID.
-         */
-        public void setId(int id) {
-            this.id = id;
-        }
-    }
-
-    /**
-     * Test Hibernate entity4.
-     */
-    @javax.persistence.Entity
-    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
-    @Cacheable
-    @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
-    public static class Entity4 {
-        /** */
-        private int id;
-
-        /**
-         * @return ID.
-         */
-        @Id
-        @GeneratedValue
-        public int getId() {
-            return id;
-        }
-
-        /**
-         * @param id ID.
-         */
-        public void setId(int id) {
-            this.id = id;
-        }
-    }
-}
\ No newline at end of file


[35/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java
index 1016b28..2051616 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java
@@ -165,7 +165,7 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra
                     futs.add(multithreadedAsync(new Runnable() {
                         @Override public void run() {
                             try {
-                                Lock lock = node.cache(null).lock(key);
+                                Lock lock = node.cache(DEFAULT_CACHE_NAME).lock(key);
 
                                 lock.lock();
 
@@ -177,7 +177,7 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra
 
                                     info(">>> Acquiring explicit lock for key: " + key * 10);
 
-                                    Lock lock10 = node.cache(null).lock(key * 10);
+                                    Lock lock10 = node.cache(DEFAULT_CACHE_NAME).lock(key * 10);
 
                                     lock10.lock();
 
@@ -273,7 +273,7 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra
                 for (final Integer key : keysMap.values()) {
                     futs.add(multithreadedAsync(new Runnable() {
                         @Override public void run() {
-                            IgniteCache<Integer, Integer> cache = node.cache(null);
+                            IgniteCache<Integer, Integer> cache = node.cache(DEFAULT_CACHE_NAME);
 
                             try {
                                 try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
@@ -342,7 +342,7 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra
             for (final Ignite g : nodes) {
                 txFuts.add(multithreadedAsync(new Runnable() {
                     @Override public void run() {
-                        IgniteCache<Integer, Integer> cache = g.cache(null);
+                        IgniteCache<Integer, Integer> cache = g.cache(DEFAULT_CACHE_NAME);
 
                         int key = (int)Thread.currentThread().getId();
 
@@ -427,7 +427,7 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra
                 for (final Integer key : keysMap.values()) {
                     futs.add(multithreadedAsync(new Runnable() {
                         @Override public void run() {
-                            IgniteCache<Integer, Integer> cache = node.cache(null);
+                            IgniteCache<Integer, Integer> cache = node.cache(DEFAULT_CACHE_NAME);
 
                             try {
                                 try (Transaction tx = node.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
@@ -478,7 +478,7 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra
             for (final Ignite g : nodes) {
                 txFuts.add(multithreadedAsync(new Runnable() {
                     @Override public void run() {
-                        IgniteCache<Integer, Integer> cache = g.cache(null);
+                        IgniteCache<Integer, Integer> cache = g.cache(DEFAULT_CACHE_NAME);
 
                         int key = (int)Thread.currentThread().getId();
 
@@ -513,7 +513,7 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra
                 txFut.get(1000);
 
             for (int i = 0; i < 3; i++) {
-                Affinity affinity = grid(i).affinity(null);
+                Affinity affinity = grid(i).affinity(DEFAULT_CACHE_NAME);
 
                 ConcurrentMap addedNodes = U.field(affinity, "addedNodes");
 
@@ -554,7 +554,7 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra
      * @return Map from partition to key.
      */
     private Map<Integer, Integer> keysFor(IgniteKernal node, Iterable<Integer> parts) {
-        GridCacheContext<Object, Object> ctx = node.internalCache().context();
+        GridCacheContext<Object, Object> ctx = node.internalCache(DEFAULT_CACHE_NAME).context();
 
         Map<Integer, Integer> res = new HashMap<>();
 
@@ -579,7 +579,7 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra
     private List<Integer> partitions(Ignite node, int partType) {
         List<Integer> res = new LinkedList<>();
 
-        Affinity<Object> aff = node.affinity(null);
+        Affinity<Object> aff = node.affinity(DEFAULT_CACHE_NAME);
 
         for (int partCnt = aff.partitions(), i = 0; i < partCnt; i++) {
             ClusterNode locNode = node.cluster().localNode();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTxOriginatingNodeFailureSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTxOriginatingNodeFailureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTxOriginatingNodeFailureSelfTest.java
index 9b14143..07bbf6c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTxOriginatingNodeFailureSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedTxOriginatingNodeFailureSelfTest.java
@@ -64,7 +64,7 @@ public class GridCachePartitionedTxOriginatingNodeFailureSelfTest extends
         Integer key = null;
 
         for (int i = 0; i < Integer.MAX_VALUE; i++) {
-            if (grid(originatingNode()).affinity(null).isPrimary(txNode, i)) {
+            if (grid(originatingNode()).affinity(DEFAULT_CACHE_NAME).isPrimary(txNode, i)) {
                 key = i;
 
                 break;
@@ -85,7 +85,7 @@ public class GridCachePartitionedTxOriginatingNodeFailureSelfTest extends
         Integer key = null;
 
         for (int i = 0; i < Integer.MAX_VALUE; i++) {
-            if (grid(originatingNode()).affinity(null).isBackup(txNode, i)) {
+            if (grid(originatingNode()).affinity(DEFAULT_CACHE_NAME).isBackup(txNode, i)) {
                 key = i;
 
                 break;
@@ -106,8 +106,8 @@ public class GridCachePartitionedTxOriginatingNodeFailureSelfTest extends
         Integer key = null;
 
         for (int i = 0; i < Integer.MAX_VALUE; i++) {
-            if (!grid(originatingNode()).affinity(null).isPrimary(txNode, i)
-                && !grid(originatingNode()).affinity(null).isBackup(txNode, i)) {
+            if (!grid(originatingNode()).affinity(DEFAULT_CACHE_NAME).isPrimary(txNode, i)
+                && !grid(originatingNode()).affinity(DEFAULT_CACHE_NAME).isBackup(txNode, i)) {
                 key = i;
 
                 break;
@@ -134,7 +134,7 @@ public class GridCachePartitionedTxOriginatingNodeFailureSelfTest extends
             for (Iterator<ClusterNode> iter = allNodes.iterator(); iter.hasNext();) {
                 ClusterNode node = iter.next();
 
-                if (grid(originatingNode()).affinity(null).isPrimary(node, i)) {
+                if (grid(originatingNode()).affinity(DEFAULT_CACHE_NAME).isPrimary(node, i)) {
                     keys.add(i);
 
                     iter.remove();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedUnloadEventsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedUnloadEventsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedUnloadEventsSelfTest.java
index dcc8160..2f15b72 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedUnloadEventsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedUnloadEventsSelfTest.java
@@ -80,7 +80,7 @@ public class GridCachePartitionedUnloadEventsSelfTest extends GridCommonAbstract
 
         Collection<Integer> allKeys = new ArrayList<>(100);
 
-        IgniteCache<Integer, String> cache = g1.cache(null);
+        IgniteCache<Integer, String> cache = g1.cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < 100; i++) {
             cache.put(i, "val");
@@ -91,7 +91,7 @@ public class GridCachePartitionedUnloadEventsSelfTest extends GridCommonAbstract
 
         awaitPartitionMapExchange();
 
-        Map<ClusterNode, Collection<Object>> keysMap = g1.affinity(null).mapKeysToNodes(allKeys);
+        Map<ClusterNode, Collection<Object>> keysMap = g1.affinity(DEFAULT_CACHE_NAME).mapKeysToNodes(allKeys);
         Collection<Object> g2Keys = keysMap.get(g2.cluster().localNode());
 
         assertNotNull(g2Keys);
@@ -107,7 +107,7 @@ public class GridCachePartitionedUnloadEventsSelfTest extends GridCommonAbstract
         Collection <Event> partEvts =
             g1.events().localQuery(F.<Event>alwaysTrue(), EVT_CACHE_REBALANCE_PART_UNLOADED);
 
-        checkPartitionUnloadEvents(partEvts, g1, dht(g2.cache(null)).topology().localPartitions());
+        checkPartitionUnloadEvents(partEvts, g1, dht(g2.cache(DEFAULT_CACHE_NAME)).topology().localPartitions());
     }
 
     /**
@@ -122,7 +122,7 @@ public class GridCachePartitionedUnloadEventsSelfTest extends GridCommonAbstract
             CacheEvent cacheEvt = ((CacheEvent)evt);
 
             assertEquals(EVT_CACHE_REBALANCE_OBJECT_UNLOADED, cacheEvt.type());
-            assertEquals(g.cache(null).getName(), cacheEvt.cacheName());
+            assertEquals(g.cache(DEFAULT_CACHE_NAME).getName(), cacheEvt.cacheName());
             assertEquals(g.cluster().localNode().id(), cacheEvt.node().id());
             assertEquals(g.cluster().localNode().id(), cacheEvt.eventNode().id());
             assertTrue("Unexpected key: " + cacheEvt.key(), keys.contains(cacheEvt.key()));
@@ -151,7 +151,7 @@ public class GridCachePartitionedUnloadEventsSelfTest extends GridCommonAbstract
                     }
                 }));
 
-            assertEquals(g.cache(null).getName(), unloadEvt.cacheName());
+            assertEquals(g.cache(DEFAULT_CACHE_NAME).getName(), unloadEvt.cacheName());
             assertEquals(g.cluster().localNode().id(), unloadEvt.node().id());
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
index 742e365..9b3033a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheTxNodeFailureSelfTest.java
@@ -93,7 +93,7 @@ public class GridCacheTxNodeFailureSelfTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     protected CacheConfiguration cacheConfiguration(String igniteInstanceName) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(TRANSACTIONAL);
@@ -210,11 +210,11 @@ public class GridCacheTxNodeFailureSelfTest extends GridCommonAbstractTest {
 
             final Ignite ignite = ignite(0);
 
-            final IgniteCache<Object, Object> cache = ignite.cache(null).withNoRetries();
+            final IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME).withNoRetries();
 
             final int key = generateKey(ignite, backup);
 
-            IgniteEx backupNode = (IgniteEx)backupNode(key, null);
+            IgniteEx backupNode = (IgniteEx)backupNode(key, DEFAULT_CACHE_NAME);
 
             assertNotNull(backupNode);
 
@@ -327,12 +327,12 @@ public class GridCacheTxNodeFailureSelfTest extends GridCommonAbstractTest {
     private void dataCheck(IgniteKernal orig, IgniteKernal backup, int key, boolean commit) throws Exception {
         GridNearCacheEntry nearEntry = null;
 
-        GridCacheAdapter origCache = orig.internalCache(null);
+        GridCacheAdapter origCache = orig.internalCache(DEFAULT_CACHE_NAME);
 
         if (origCache.isNear())
             nearEntry = (GridNearCacheEntry)origCache.peekEx(key);
 
-        GridCacheAdapter backupCache = backup.internalCache(null);
+        GridCacheAdapter backupCache = backup.internalCache(DEFAULT_CACHE_NAME);
 
         if (backupCache.isNear())
             backupCache = backupCache.context().near().dht();
@@ -378,7 +378,7 @@ public class GridCacheTxNodeFailureSelfTest extends GridCommonAbstractTest {
      *      {@code ignite(1)}.
      */
     private int generateKey(Ignite ignite, boolean backup) {
-        Affinity<Object> aff = ignite.affinity(null);
+        Affinity<Object> aff = ignite.affinity(DEFAULT_CACHE_NAME);
 
         for (int key = 0;;key++) {
             if (backup) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCommitDelayTxRecoveryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCommitDelayTxRecoveryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCommitDelayTxRecoveryTest.java
index d091ea9..b61d718 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCommitDelayTxRecoveryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCommitDelayTxRecoveryTest.java
@@ -154,11 +154,11 @@ public class IgniteCacheCommitDelayTxRecoveryTest extends GridCommonAbstractTest
         assertFalse(srv.configuration().isClientMode());
 
         for (Boolean pessimistic : Arrays.asList(false, true)) {
-            checkRecovery(backupKey(srv.cache(null)), srv, pessimistic, useStore);
+            checkRecovery(backupKey(srv.cache(DEFAULT_CACHE_NAME)), srv, pessimistic, useStore);
 
-            checkRecovery(nearKey(srv.cache(null)), srv, pessimistic, useStore);
+            checkRecovery(nearKey(srv.cache(DEFAULT_CACHE_NAME)), srv, pessimistic, useStore);
 
-            checkRecovery(nearKey(clientNode.cache(null)), clientNode, pessimistic, useStore);
+            checkRecovery(nearKey(clientNode.cache(DEFAULT_CACHE_NAME)), clientNode, pessimistic, useStore);
 
             srv = ignite(0);
 
@@ -177,11 +177,11 @@ public class IgniteCacheCommitDelayTxRecoveryTest extends GridCommonAbstractTest
         final Ignite ignite,
         final boolean pessimistic,
         final boolean useStore) throws Exception {
-        Ignite primary = primaryNode(key, null);
+        Ignite primary = primaryNode(key, DEFAULT_CACHE_NAME);
 
         assertNotSame(ignite, primary);
 
-        List<Ignite> backups = backupNodes(key, null);
+        List<Ignite> backups = backupNodes(key, DEFAULT_CACHE_NAME);
 
         assertFalse(backups.isEmpty());
 
@@ -196,7 +196,7 @@ public class IgniteCacheCommitDelayTxRecoveryTest extends GridCommonAbstractTest
             ", backups=" + backupNames +
             ", node=" + ignite.name() + ']');
 
-        final IgniteCache<Integer, Integer> cache = ignite.cache(null);
+        final IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         cache.put(key, 0);
 
@@ -253,22 +253,22 @@ public class IgniteCacheCommitDelayTxRecoveryTest extends GridCommonAbstractTest
         fut.get();
 
         for (Ignite node : G.allGrids())
-            assertEquals(1, node.cache(null).get(key));
+            assertEquals(1, node.cache(DEFAULT_CACHE_NAME).get(key));
 
         cache.put(key, 2);
 
         for (Ignite node : G.allGrids())
-            assertEquals(2, node.cache(null).get(key));
+            assertEquals(2, node.cache(DEFAULT_CACHE_NAME).get(key));
 
         startGrid(primary.name());
 
         for (Ignite node : G.allGrids())
-            assertEquals(2, node.cache(null).get(key));
+            assertEquals(2, node.cache(DEFAULT_CACHE_NAME).get(key));
 
         cache.put(key, 3);
 
         for (Ignite node : G.allGrids())
-            assertEquals(3, node.cache(null).get(key));
+            assertEquals(3, node.cache(DEFAULT_CACHE_NAME).get(key));
 
         awaitPartitionMapExchange();
     }
@@ -336,7 +336,7 @@ public class IgniteCacheCommitDelayTxRecoveryTest extends GridCommonAbstractTest
      * @return Cache configuration.
      */
     private CacheConfiguration<Object, Object> cacheConfiguration(int backups, boolean useStore) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(TRANSACTIONAL);
         ccfg.setBackups(backups);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheConcurrentPutGetRemove.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheConcurrentPutGetRemove.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheConcurrentPutGetRemove.java
index 3b64487..a83e999 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheConcurrentPutGetRemove.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheConcurrentPutGetRemove.java
@@ -167,7 +167,7 @@ public class IgniteCacheConcurrentPutGetRemove extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     private CacheConfiguration cacheConfiguration(CacheAtomicityMode atomicityMode, int backups) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setBackups(backups);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
index 0831d1e..6638626 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheCrossCacheTxFailoverTest.java
@@ -47,6 +47,7 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -115,10 +116,10 @@ public class IgniteCacheCrossCacheTxFailoverTest extends GridCommonAbstractTest
      * @param parts Number of partitions.
      * @return Cache configuration.
      */
-    private CacheConfiguration cacheConfiguration(String name,
+    private CacheConfiguration cacheConfiguration(@NotNull String name,
         CacheMode cacheMode,
         int parts) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(name);
         ccfg.setCacheMode(cacheMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java
index f68f088..f813ef8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheLockFailoverSelfTest.java
@@ -86,7 +86,7 @@ public class IgniteCacheLockFailoverSelfTest extends GridCacheAbstractSelfTest {
      * @throws Exception If failed.
      */
     public void testLockFailover() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         Integer key = backupKey(cache);
 
@@ -117,7 +117,7 @@ public class IgniteCacheLockFailoverSelfTest extends GridCacheAbstractSelfTest {
 
                 iter++;
 
-                GridCacheAdapter<Object, Object> adapter = ((IgniteKernal)grid(0)).internalCache(null);
+                GridCacheAdapter<Object, Object> adapter = ((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME);
 
                 IgniteInternalFuture<Boolean> fut = adapter.lockAsync(key, 0);
 
@@ -150,9 +150,9 @@ public class IgniteCacheLockFailoverSelfTest extends GridCacheAbstractSelfTest {
      * @throws Exception If failed.
      */
     public void testUnlockPrimaryLeft() throws Exception {
-        GridCacheAdapter<Integer, Integer> cache = ((IgniteKernal)grid(0)).internalCache(null);
+        GridCacheAdapter<Integer, Integer> cache = ((IgniteKernal)grid(0)).internalCache(DEFAULT_CACHE_NAME);
 
-        Integer key = backupKey(grid(0).cache(null));
+        Integer key = backupKey(grid(0).cache(DEFAULT_CACHE_NAME));
 
         cache.lock(key, 0);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheMultiTxLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheMultiTxLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheMultiTxLockSelfTest.java
index 1b9b0d0..1e0eaad 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheMultiTxLockSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheMultiTxLockSelfTest.java
@@ -73,7 +73,7 @@ public class IgniteCacheMultiTxLockSelfTest extends GridCommonAbstractTest {
 
         c.setDiscoverySpi(disco);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(CACHE_NAME);
         ccfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePartitionedBackupNodeFailureRecoveryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePartitionedBackupNodeFailureRecoveryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePartitionedBackupNodeFailureRecoveryTest.java
index 9f948f6..98520ab 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePartitionedBackupNodeFailureRecoveryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePartitionedBackupNodeFailureRecoveryTest.java
@@ -87,9 +87,9 @@ public class IgniteCachePartitionedBackupNodeFailureRecoveryTest extends IgniteC
 
         awaitPartitionMapExchange();
 
-        final IgniteCache<Integer, Integer> cache1 = node1.cache(null);
+        final IgniteCache<Integer, Integer> cache1 = node1.cache(DEFAULT_CACHE_NAME);
 
-        Affinity<Integer> aff = node1.affinity(null);
+        Affinity<Integer> aff = node1.affinity(DEFAULT_CACHE_NAME);
 
         Integer key0 = null;
 
@@ -143,7 +143,7 @@ public class IgniteCachePartitionedBackupNodeFailureRecoveryTest extends IgniteC
 
                         IgniteEx backUp = startGrid(2);
 
-                        final IgniteCache<Integer, Integer> cache3 = backUp.cache(null);
+                        final IgniteCache<Integer, Integer> cache3 = backUp.cache(DEFAULT_CACHE_NAME);
 
                         lock.lock();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java
index 7ca3914..cf898c5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePrimaryNodeFailureRecoveryAbstractTest.java
@@ -174,7 +174,7 @@ public abstract class IgniteCachePrimaryNodeFailureRecoveryAbstractTest extends
         IgniteCache<Integer, Integer> cache0 = jcache(0);
         IgniteCache<Integer, Integer> cache2 = jcache(2);
 
-        Affinity<Integer> aff = ignite(0).affinity(null);
+        Affinity<Integer> aff = ignite(0).affinity(DEFAULT_CACHE_NAME);
 
         Integer key0 = null;
 
@@ -331,7 +331,7 @@ public abstract class IgniteCachePrimaryNodeFailureRecoveryAbstractTest extends
         IgniteCache<Integer, Integer> cache0 = jcache(0);
         IgniteCache<Integer, Integer> cache2 = jcache(2);
 
-        Affinity<Integer> aff = ignite(0).affinity(null);
+        Affinity<Integer> aff = ignite(0).affinity(DEFAULT_CACHE_NAME);
 
         Integer key0 = null;
 
@@ -422,13 +422,13 @@ public abstract class IgniteCachePrimaryNodeFailureRecoveryAbstractTest extends
     private void checkKey(Integer key, Collection<ClusterNode> keyNodes) {
         if (keyNodes == null) {
             for (Ignite ignite : G.allGrids()) {
-                IgniteCache<Integer, Integer> cache = ignite.cache(null);
+                IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                 assertNull("Unexpected value for: " + ignite.name(), cache.localPeek(key));
             }
 
             for (Ignite ignite : G.allGrids()) {
-                IgniteCache<Integer, Integer> cache = ignite.cache(null);
+                IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                 assertNull("Unexpected value for: " + ignite.name(), cache.get(key));
             }
@@ -442,7 +442,7 @@ public abstract class IgniteCachePrimaryNodeFailureRecoveryAbstractTest extends
 
                     found = true;
 
-                    ignite.cache(null);
+                    ignite.cache(DEFAULT_CACHE_NAME);
 
                     assertEquals("Unexpected value for: " + ignite.name(), key, key);
                 }
@@ -454,7 +454,7 @@ public abstract class IgniteCachePrimaryNodeFailureRecoveryAbstractTest extends
             assertTrue("Failed to find key node.", found);
 
             for (Ignite ignite : G.allGrids()) {
-                IgniteCache<Integer, Integer> cache = ignite.cache(null);
+                IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                 assertEquals("Unexpected value for: " + ignite.name(), key, cache.get(key));
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
index abec33c..d9b9663 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAbstractSelfTest.java
@@ -89,7 +89,7 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
      */
     @SuppressWarnings("unchecked")
     protected CacheConfiguration cacheConfiguration(boolean evict, boolean store) throws Exception {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setAtomicityMode(atomicityMode());
         cfg.setWriteSynchronizationMode(FULL_SYNC);
@@ -157,7 +157,7 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
             checkInternalCleanup();
         }
         finally {
-            ignite(0).destroyCache(null);
+            ignite(0).destroyCache(DEFAULT_CACHE_NAME);
         }
     }
 
@@ -261,7 +261,7 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
             }
         });
 
-        final IgniteCache<Integer, Integer> cache = ignite(0).cache(null);
+        final IgniteCache<Integer, Integer> cache = ignite(0).cache(DEFAULT_CACHE_NAME);
 
         int iter = 0;
 
@@ -507,7 +507,7 @@ public abstract class IgniteCachePutRetryAbstractSelfTest extends GridCommonAbst
 
             boolean eThrown = false;
 
-            IgniteCache<Object, Object> cache = ignite(0).cache(null).withNoRetries();
+            IgniteCache<Object, Object> cache = ignite(0).cache(DEFAULT_CACHE_NAME).withNoRetries();
 
             long stopTime = System.currentTimeMillis() + 60_000;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAtomicSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAtomicSelfTest.java
index 8f5b88d..d7e9981 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAtomicSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryAtomicSelfTest.java
@@ -49,7 +49,7 @@ public class IgniteCachePutRetryAtomicSelfTest extends IgniteCachePutRetryAbstra
     public void testPutInsideTransaction() throws Exception {
         ignite(0).createCache(cacheConfiguration(false, false));
 
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setName("tx-cache");
         ccfg.setAtomicityMode(TRANSACTIONAL);
@@ -74,7 +74,7 @@ public class IgniteCachePutRetryAtomicSelfTest extends IgniteCachePutRetryAbstra
             try {
                 IgniteTransactions txs = ignite(0).transactions();
 
-                IgniteCache<Object, Object> cache = ignite(0).cache(null);
+                IgniteCache<Object, Object> cache = ignite(0).cache(DEFAULT_CACHE_NAME);
 
                 long stopTime = System.currentTimeMillis() + 60_000;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryTransactionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryTransactionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryTransactionalSelfTest.java
index 8e4b3a4..161025f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryTransactionalSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCachePutRetryTransactionalSelfTest.java
@@ -143,7 +143,7 @@ public class IgniteCachePutRetryTransactionalSelfTest extends IgniteCachePutRetr
                 int base = th * FACTOR;
 
                 Ignite ignite = ignite(0);
-                final IgniteCache<Object, Object> cache = ignite.cache(null);
+                final IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                 try {
                     for (int i = 0; i < FACTOR; i++) {
@@ -179,7 +179,7 @@ public class IgniteCachePutRetryTransactionalSelfTest extends IgniteCachePutRetr
 
         // Verify contents of the cache.
         for (int g = 0; g < GRID_CNT; g++) {
-            IgniteCache<Object, Object> cache = ignite(g).cache(null);
+            IgniteCache<Object, Object> cache = ignite(g).cache(DEFAULT_CACHE_NAME);
 
             for (int th = 0; th < threads; th++) {
                 int base = th * FACTOR;
@@ -234,7 +234,7 @@ public class IgniteCachePutRetryTransactionalSelfTest extends IgniteCachePutRetr
 
                 while (!finished.get()) {
                     try {
-                        IgniteCache<Integer, Integer> cache = ignite(0).cache(null);
+                        IgniteCache<Integer, Integer> cache = ignite(0).cache(DEFAULT_CACHE_NAME);
 
                         Integer val = ++iter;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTxRecoveryRollbackTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTxRecoveryRollbackTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTxRecoveryRollbackTest.java
index 7e7d341..b644cda 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTxRecoveryRollbackTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteCacheTxRecoveryRollbackTest.java
@@ -154,13 +154,13 @@ public class IgniteCacheTxRecoveryRollbackTest extends GridCommonAbstractTest {
         Ignite client1 = startGrid(4);
         final Ignite client2 = startGrid(5);
 
-        final Integer key = primaryKey(srv0.cache(null));
+        final Integer key = primaryKey(srv0.cache(DEFAULT_CACHE_NAME));
 
         final IgniteCache<Integer, Integer> cache1 =
-            client1.createNearCache(null, new NearCacheConfiguration<Integer, Integer>());
+            client1.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration<Integer, Integer>());
 
         final IgniteCache<Integer, Integer> cache2 =
-            client2.createNearCache(null, new NearCacheConfiguration<Integer, Integer>());
+            client2.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration<Integer, Integer>());
 
         cache1.put(key, 1);
 
@@ -251,13 +251,13 @@ public class IgniteCacheTxRecoveryRollbackTest extends GridCommonAbstractTest {
         Ignite client1 = startGrid(4);
         final Ignite client2 = startGrid(5);
 
-        final Integer key = primaryKey(srv0.cache(null));
+        final Integer key = primaryKey(srv0.cache(DEFAULT_CACHE_NAME));
 
         final IgniteCache<Integer, Integer> cache1 =
-            client1.createNearCache(null, new NearCacheConfiguration<Integer, Integer>());
+            client1.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration<Integer, Integer>());
 
         final IgniteCache<Integer, Integer> cache2 =
-            client2.createNearCache(null, new NearCacheConfiguration<Integer, Integer>());
+            client2.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration<Integer, Integer>());
 
         cache1.put(key, 1);
 
@@ -305,7 +305,7 @@ public class IgniteCacheTxRecoveryRollbackTest extends GridCommonAbstractTest {
             // No-op.
         }
 
-        final IgniteCache<Integer, Integer> srvCache = grid(1).cache(null);
+        final IgniteCache<Integer, Integer> srvCache = grid(1).cache(DEFAULT_CACHE_NAME);
 
         GridTestUtils.waitForCondition(new GridAbsPredicate() {
             @Override public boolean apply() {
@@ -382,7 +382,7 @@ public class IgniteCacheTxRecoveryRollbackTest extends GridCommonAbstractTest {
 
         testSpi(srv0).blockMessages(GridNearTxPrepareResponse.class, client.name());
 
-        final IgniteCache<Integer, Integer> clientCache = client.cache(null);
+        final IgniteCache<Integer, Integer> clientCache = client.cache(DEFAULT_CACHE_NAME);
 
         IgniteInternalFuture<?> fut = GridTestUtils.runAsync(new Callable<Void>() {
             @Override public Void call() throws Exception {
@@ -432,7 +432,7 @@ public class IgniteCacheTxRecoveryRollbackTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     private CacheConfiguration<Integer, Integer> cacheConfiguration(int backups, boolean store, boolean writeThrough) {
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(TRANSACTIONAL);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
@@ -459,7 +459,7 @@ public class IgniteCacheTxRecoveryRollbackTest extends GridCommonAbstractTest {
         assertFalse(nodes.isEmpty());
 
         for (Ignite node : nodes) {
-            IgniteCache<Integer, Integer> cache = node.cache(null);
+            IgniteCache<Integer, Integer> cache = node.cache(DEFAULT_CACHE_NAME);
 
             for (Map.Entry<Integer, Integer> e : expData.entrySet()) {
                 assertEquals("Invalid value [key=" + e.getKey() + ", node=" + node.name() + ']',

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteTxReentryColocatedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteTxReentryColocatedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteTxReentryColocatedSelfTest.java
index 81ed247..bed179c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteTxReentryColocatedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/IgniteTxReentryColocatedSelfTest.java
@@ -43,7 +43,7 @@ public class IgniteTxReentryColocatedSelfTest extends IgniteTxReentryAbstractSel
     @Override protected int testKey() {
         int key = 0;
 
-        IgniteCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         while (true) {
             Collection<ClusterNode> nodes = affinity(cache).mapKeyToPrimaryAndBackups(key);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
index a35a561..f94e34b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicInvalidPartitionHandlingSelfTest.java
@@ -102,7 +102,7 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
 
     /** {@inheritDoc} */
     protected CacheConfiguration cacheConfiguration() {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
 
@@ -171,13 +171,13 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
         try {
             assertEquals(testClientNode(), (boolean)grid(0).configuration().isClientMode());
 
-            final IgniteCache<Object, Object> cache = grid(0).cache(null);
+            final IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             final int range = 100_000;
 
             final Set<Integer> keys = new LinkedHashSet<>();
 
-            try (IgniteDataStreamer<Integer, Integer> streamer = grid(0).dataStreamer(null)) {
+            try (IgniteDataStreamer<Integer, Integer> streamer = grid(0).dataStreamer(DEFAULT_CACHE_NAME)) {
                 streamer.allowOverwrite(true);
 
                 for (int i = 0; i < range; i++) {
@@ -190,7 +190,7 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
                 }
             }
 
-            final Affinity<Integer> aff = grid(0).affinity(null);
+            final Affinity<Integer> aff = grid(0).affinity(DEFAULT_CACHE_NAME);
 
             boolean putDone = GridTestUtils.waitForCondition(new GridAbsPredicate() {
                 @Override public boolean apply() {
@@ -204,7 +204,7 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
                         for (int i = 0; i < gridCnt; i++) {
                             ClusterNode locNode = grid(i).localNode();
 
-                            IgniteCache<Object, Object> cache = grid(i).cache(null);
+                            IgniteCache<Object, Object> cache = grid(i).cache(DEFAULT_CACHE_NAME);
 
                             Object val = cache.localPeek(key);
 
@@ -298,7 +298,7 @@ public class GridCacheAtomicInvalidPartitionHandlingSelfTest extends GridCommonA
                 for (int i = 0; i < gridCnt; i++) {
                     ClusterNode locNode = grid(i).localNode();
 
-                    GridCacheAdapter<Object, Object> c = ((IgniteKernal)grid(i)).internalCache();
+                    GridCacheAdapter<Object, Object> c = ((IgniteKernal)grid(i)).internalCache(DEFAULT_CACHE_NAME);
 
                     GridCacheEntryEx entry = null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPreloadSelfTest.java
index 4a20bd9..a14c3ef 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridCacheAtomicPreloadSelfTest.java
@@ -52,7 +52,7 @@ public class GridCacheAtomicPreloadSelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration cacheCfg = new CacheConfiguration();
+        CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cacheCfg.setCacheMode(CacheMode.PARTITIONED);
         cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
@@ -104,7 +104,7 @@ public class GridCacheAtomicPreloadSelfTest extends GridCommonAbstractTest {
 
             awaitPartitionMapExchange();
 
-            IgniteCache<Object, Object> cache = grid(0).cache(null);
+            IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
             List<Integer> keys = generateKeys(grid(0).localNode(), cache);
 
@@ -173,10 +173,10 @@ public class GridCacheAtomicPreloadSelfTest extends GridCommonAbstractTest {
 
             ClusterNode node = grid.localNode();
 
-            IgniteCache<Object, Object> cache = grid.cache(null);
+            IgniteCache<Object, Object> cache = grid.cache(DEFAULT_CACHE_NAME);
 
-            boolean primary = grid.affinity(null).isPrimary(node, key);
-            boolean backup = grid.affinity(null).isBackup(node, key);
+            boolean primary = grid.affinity(DEFAULT_CACHE_NAME).isPrimary(node, key);
+            boolean backup = grid.affinity(DEFAULT_CACHE_NAME).isBackup(node, key);
 
             if (primary || backup)
                 assertEquals("Invalid cache value [nodeId=" + node.id() + ", primary=" + primary +

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
index 6fdb354..888fae3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/IgniteCacheAtomicProtocolTest.java
@@ -785,7 +785,7 @@ public class IgniteCacheAtomicProtocolTest extends GridCommonAbstractTest {
      */
     private CacheConfiguration<Integer, Integer> cacheConfiguration(int backups,
         CacheWriteSynchronizationMode writeSync) {
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setName(TEST_CACHE);
         ccfg.setAtomicityMode(ATOMIC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
index 15eec59..5de7af0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest.java
@@ -196,7 +196,7 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache
 
         long ttl = 500;
 
-        grid(0).cache(null).
+        grid(0).cache(DEFAULT_CACHE_NAME).
             withExpiryPolicy(new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl))).put(key, 1);
 
         boolean wait = waitForCondition(new GridAbsPredicate() {
@@ -221,7 +221,7 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache
 
         // Force reload on primary node.
         for (int i = 0; i < gridCount(); i++) {
-            if (ignite(i).affinity(null).isPrimary(ignite(i).cluster().localNode(), key))
+            if (ignite(i).affinity(DEFAULT_CACHE_NAME).isPrimary(ignite(i).cluster().localNode(), key))
                 load(jcache(i), key, true);
         }
 
@@ -294,7 +294,7 @@ public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCache
 
         long ttl = 500;
 
-        grid(0).cache(null).
+        grid(0).cache(DEFAULT_CACHE_NAME).
             withExpiryPolicy(new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl))).put(key, 1);
 
         Thread.sleep(ttl + 100);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
index 2909a1d..c78c976 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest.java
@@ -76,7 +76,7 @@ public class GridCacheAtomicNearOnlyMultiNodeFullApiSelfTest extends GridCacheNe
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
         for (int i = 0; i < gridCount(); i++)
-            grid(i).cache(null).removeAll();
+            grid(i).cache(DEFAULT_CACHE_NAME).removeAll();
 
         super.afterTest();
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPartitionedTckMetricsSelfTestImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPartitionedTckMetricsSelfTestImpl.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPartitionedTckMetricsSelfTestImpl.java
index 9e4be22..7f59079 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPartitionedTckMetricsSelfTestImpl.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheAtomicPartitionedTckMetricsSelfTestImpl.java
@@ -35,7 +35,7 @@ public class GridCacheAtomicPartitionedTckMetricsSelfTestImpl extends GridCacheA
      * @throws Exception If failed.
      */
     public void testEntryProcessorRemove() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.put(1, 20);
 
@@ -69,7 +69,7 @@ public class GridCacheAtomicPartitionedTckMetricsSelfTestImpl extends GridCacheA
      * @throws Exception If failed.
      */
     public void testCacheStatistics() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.put(1, 10);
 
@@ -109,7 +109,7 @@ public class GridCacheAtomicPartitionedTckMetricsSelfTestImpl extends GridCacheA
      * @throws Exception If failed.
      */
     public void testConditionReplace() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         long hitCount = 0;
         long missCount = 0;
@@ -159,7 +159,7 @@ public class GridCacheAtomicPartitionedTckMetricsSelfTestImpl extends GridCacheA
      * @throws Exception If failed.
      */
     public void testPutIfAbsent() throws Exception {
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         long hitCount = 0;
         long missCount = 0;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGetStoreErrorSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGetStoreErrorSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGetStoreErrorSelfTest.java
index a8711e1..cb537ee 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGetStoreErrorSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheGetStoreErrorSelfTest.java
@@ -121,7 +121,7 @@ public class GridCacheGetStoreErrorSelfTest extends GridCommonAbstractTest {
         try {
             GridTestUtils.assertThrows(log, new Callable<Object>() {
                 @Override public Object call() throws Exception {
-                    grid(0).cache(null).get(nearKey());
+                    grid(0).cache(DEFAULT_CACHE_NAME).get(nearKey());
 
                     return null;
                 }
@@ -139,7 +139,7 @@ public class GridCacheGetStoreErrorSelfTest extends GridCommonAbstractTest {
         for (int i = 0; i < 1000; i++) {
             key = String.valueOf(i);
 
-            if (!grid(0).affinity(null).isPrimaryOrBackup(grid(0).localNode(), key))
+            if (!grid(0).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid(0).localNode(), key))
                 break;
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
index e46b7bd..1b09cff 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearEvictionSelfTest.java
@@ -89,7 +89,7 @@ public class GridCacheNearEvictionSelfTest extends GridCommonAbstractTest {
         startGridsMultiThreaded(gridCnt);
 
         try {
-            IgniteCache<Integer, String> c = grid(0).cache(null);
+            IgniteCache<Integer, String> c = grid(0).cache(DEFAULT_CACHE_NAME);
 
             int cnt = 100;
 
@@ -119,7 +119,7 @@ public class GridCacheNearEvictionSelfTest extends GridCommonAbstractTest {
                 private Ignite ignite;
 
                 @Override public Object call() throws Exception {
-                    IgniteCache<Integer, String> c = ignite.cache(null);
+                    IgniteCache<Integer, String> c = ignite.cache(DEFAULT_CACHE_NAME);
 
                     for (int i = 0; i < cnt; i++)
                         c.put(i, Integer.toString(i));
@@ -152,7 +152,7 @@ public class GridCacheNearEvictionSelfTest extends GridCommonAbstractTest {
                 private Ignite ignite;
 
                 @Override public Object call() throws Exception {
-                    IgniteCache<Integer, String> c = ignite.cache(null);
+                    IgniteCache<Integer, String> c = ignite.cache(DEFAULT_CACHE_NAME);
 
                     for (int i = 0; i < cnt; i++)
                         c.put(i, Integer.toString(i));

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
index a7b7400..30e9146 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMetricsSelfTest.java
@@ -68,11 +68,11 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
         for (int i = 0; i < gridCount(); i++) {
             Ignite g = grid(i);
 
-            g.cache(null).removeAll();
+            g.cache(DEFAULT_CACHE_NAME).removeAll();
 
-            assert g.cache(null).localSize() == 0;
+            assert g.cache(DEFAULT_CACHE_NAME).localSize() == 0;
 
-            g.cache(null).localMxBean().clear();
+            g.cache(DEFAULT_CACHE_NAME).localMxBean().clear();
         }
     }
 
@@ -83,7 +83,7 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
         for (int i = 0; i < gridCount(); i++) {
             Ignite g = grid(i);
 
-            g.cache(null).getConfiguration(CacheConfiguration.class).setStatisticsEnabled(true);
+            g.cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).setStatisticsEnabled(true);
         }
     }
 
@@ -103,7 +103,7 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
     public void testPrimaryPut() throws Exception {
         Ignite g0 = grid(0);
 
-        IgniteCache<Integer, Integer> cache0 = g0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = g0.cache(DEFAULT_CACHE_NAME);
 
         int key;
 
@@ -129,7 +129,7 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
 
             info("Checking grid: " + g.name());
 
-            IgniteCache<Object, Object> jcache = g.cache(null);
+            IgniteCache<Object, Object> jcache = g.cache(DEFAULT_CACHE_NAME);
 
             info("Puts: " + jcache.localMetrics().getCachePuts());
             info("Reads: " + jcache.localMetrics().getCacheGets());
@@ -158,7 +158,7 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
     public void testBackupPut() throws Exception {
         Ignite g0 = grid(0);
 
-        IgniteCache<Integer, Integer> cache0 = g0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = g0.cache(DEFAULT_CACHE_NAME);
 
         int key;
 
@@ -181,7 +181,7 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
 
         for (int j = 0; j < gridCount(); j++) {
             Ignite g = grid(j);
-            IgniteCache<Object, Object> jcache = g.cache(null);
+            IgniteCache<Object, Object> jcache = g.cache(DEFAULT_CACHE_NAME);
 
             if (affinity(jcache).isPrimaryOrBackup(g.cluster().localNode(), key))
                 assertEquals(1, jcache.localMetrics().getCachePuts());
@@ -212,7 +212,7 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
     public void testNearPut() throws Exception {
         Ignite g0 = grid(0);
 
-        IgniteCache<Integer, Integer> cache0 = g0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = g0.cache(DEFAULT_CACHE_NAME);
 
         int key;
 
@@ -236,7 +236,7 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
         for (int j = 0; j < gridCount(); j++) {
             Ignite g = grid(j);
 
-            IgniteCache<Object, Object> jcache = g.cache(null);
+            IgniteCache<Object, Object> jcache = g.cache(DEFAULT_CACHE_NAME);
 
             assertEquals(1, jcache.localMetrics().getCachePuts());
 
@@ -264,7 +264,7 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
     public void testPrimaryRead() throws Exception {
         Ignite g0 = grid(0);
 
-        IgniteCache<Integer, Integer> cache0 = g0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = g0.cache(DEFAULT_CACHE_NAME);
 
         int key;
 
@@ -294,7 +294,7 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
 
             info("Checking grid: " + g.name());
 
-            IgniteCache<Object, Object> jcache = g.cache(null);
+            IgniteCache<Object, Object> jcache = g.cache(DEFAULT_CACHE_NAME);
 
             info("Writes: " + jcache.localMetrics().getCachePuts());
             info("Reads: " + jcache.localMetrics().getCacheGets());
@@ -320,7 +320,7 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
     public void testBackupRead() throws Exception {
         Ignite g0 = grid(0);
 
-        IgniteCache<Integer, Integer> cache0 = g0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = g0.cache(DEFAULT_CACHE_NAME);
 
         int key;
 
@@ -348,7 +348,7 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
         for (int j = 0; j < gridCount(); j++) {
             Ignite g = grid(j);
 
-            IgniteCache<Object, Object> jcache = g.cache(null);
+            IgniteCache<Object, Object> jcache = g.cache(DEFAULT_CACHE_NAME);
 
             assertEquals(0, jcache.localMetrics().getCachePuts());
 
@@ -371,7 +371,7 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
     public void testNearRead() throws Exception {
         Ignite g0 = grid(0);
 
-        IgniteCache<Integer, Integer> cache0 = g0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = g0.cache(DEFAULT_CACHE_NAME);
 
         int key;
 
@@ -396,7 +396,7 @@ public class GridCacheNearMetricsSelfTest extends GridCacheAbstractSelfTest {
         for (int j = 0; j < gridCount(); j++) {
             Ignite g = grid(j);
 
-            IgniteCache<Object, Object> jcache = g.cache(null);
+            IgniteCache<Object, Object> jcache = g.cache(DEFAULT_CACHE_NAME);
 
             assertEquals(0, jcache.localMetrics().getCachePuts());
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java
index 61cc580..461a29e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiGetSelfTest.java
@@ -110,7 +110,7 @@ public class GridCacheNearMultiGetSelfTest extends GridCommonAbstractTest {
         for (int i = 0; i < GRID_CNT; i++) {
             Ignite g = grid(i);
 
-            IgniteCache<Integer, String> c = g.cache(null);
+            IgniteCache<Integer, String> c = g.cache(DEFAULT_CACHE_NAME);
 
             c.removeAll();
 
@@ -229,7 +229,7 @@ public class GridCacheNearMultiGetSelfTest extends GridCommonAbstractTest {
     private void checkDoubleGet(TransactionConcurrency concurrency, TransactionIsolation isolation, boolean put)
         throws Exception {
         IgniteEx ignite = grid(0);
-        IgniteCache<Integer, String> cache = ignite.cache(null);
+        IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         Integer key = 1;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
index a6b8d79..6f23865 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
@@ -202,7 +202,7 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
      */
     @SuppressWarnings({"unchecked", "TypeMayBeWeakened"})
     private GridDhtCacheAdapter<Integer, String> dht(Ignite g) {
-        return ((GridNearCacheAdapter)((IgniteKernal)g).internalCache()).dht();
+        return ((GridNearCacheAdapter)((IgniteKernal)g).internalCache(DEFAULT_CACHE_NAME)).dht();
     }
 
     /**
@@ -210,7 +210,7 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
      * @return Affinity.
      */
     private Affinity<Object> affinity(int idx) {
-        return grid(idx).affinity(null);
+        return grid(idx).affinity(DEFAULT_CACHE_NAME);
     }
 
     /** @param cnt Count. */
@@ -330,11 +330,11 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
             backup = grid(0);
         }
 
-        assertEquals(String.valueOf(key), backup.cache(null).get(key));
+        assertEquals(String.valueOf(key), backup.cache(DEFAULT_CACHE_NAME).get(key));
 
-        primary.cache(null).put(key, "a");
+        primary.cache(DEFAULT_CACHE_NAME).put(key, "a");
 
-        assertEquals("a", backup.cache(null).get(key));
+        assertEquals("a", backup.cache(DEFAULT_CACHE_NAME).get(key));
     }
 
     /** @throws Exception If failed. */
@@ -655,7 +655,7 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
 
         String val = Integer.toString(key);
 
-        Collection<ClusterNode> affNodes = grid(0).affinity(null).mapKeyToPrimaryAndBackups(key);
+        Collection<ClusterNode> affNodes = grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToPrimaryAndBackups(key);
 
         info("Affinity for key [nodeId=" + U.nodeIds(affNodes) + ", key=" + key + ']');
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
index eed4b98..1c8bede 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
@@ -73,9 +73,9 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
         for (int i = 0; i < gridCount(); i++) {
             if (ignite(i).configuration().isClientMode()) {
                 if (clientHasNearCache())
-                    ignite(i).createNearCache(null, new NearCacheConfiguration<>());
+                    ignite(i).createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration<>());
                 else
-                    ignite(i).cache(null);
+                    ignite(i).cache(DEFAULT_CACHE_NAME);
 
                 break;
             }
@@ -289,7 +289,7 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
 
             IgnitePair<Long> entryTtl = null;
 
-            if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key))
+            if (grid(i).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid(i).localNode(), key))
                 entryTtl = entryTtl(jcache(i), key);
             else if (i == nearIdx)
                 entryTtl = nearEntryTtl(jcache(i), key);
@@ -322,7 +322,7 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
         for (int i = 0; i < gridCount(); i++) {
             IgnitePair<Long> entryTtl = null;
 
-            if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key))
+            if (grid(i).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid(i).localNode(), key))
                 entryTtl = entryTtl(jcache(i), key);
             else if (i == nearIdx)
                 entryTtl = nearEntryTtl(jcache(i), key);
@@ -352,7 +352,7 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
         for (int i = 0; i < gridCount(); i++) {
             IgnitePair<Long> entryTtl = null;
 
-            if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key))
+            if (grid(i).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid(i).localNode(), key))
                 entryTtl = entryTtl(jcache(i), key);
             else if (i == nearIdx)
                 entryTtl = nearEntryTtl(jcache(i), key);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyTopologySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyTopologySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyTopologySelfTest.java
index 2ac25a6..2124bc8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyTopologySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearOnlyTopologySelfTest.java
@@ -117,11 +117,11 @@ public class GridCacheNearOnlyTopologySelfTest extends GridCommonAbstractTest {
                 Ignite ignite = startGrid(i);
 
                 if (cilent)
-                    ignite.createNearCache(null, new NearCacheConfiguration());
+                    ignite.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration());
             }
 
             for (int i = 0; i < 100; i++)
-                assertFalse("For key: " + i, grid(0).affinity(null).isPrimaryOrBackup(grid(0).localNode(), i));
+                assertFalse("For key: " + i, grid(0).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid(0).localNode(), i));
         }
         finally {
             stopAllGrids();
@@ -139,7 +139,7 @@ public class GridCacheNearOnlyTopologySelfTest extends GridCommonAbstractTest {
                 Ignite ignite = startGrid(i);
 
                 if (cilent)
-                    ignite.createNearCache(null, new NearCacheConfiguration());
+                    ignite.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration());
             }
 
             cache = false;
@@ -148,7 +148,7 @@ public class GridCacheNearOnlyTopologySelfTest extends GridCommonAbstractTest {
             Ignite compute = startGrid(4);
 
             for (int i = 0; i < 100; i++) {
-                ClusterNode node = compute.affinity(null).mapKeyToNode(i);
+                ClusterNode node = compute.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(i);
 
                 assertFalse("For key: " + i, node.id().equals(compute.cluster().localNode().id()));
                 assertFalse("For key: " + i, node.id().equals(grid(0).localNode().id()));
@@ -170,14 +170,14 @@ public class GridCacheNearOnlyTopologySelfTest extends GridCommonAbstractTest {
                 Ignite ignite = startGrid(i);
 
                 if (cilent)
-                    ignite.createNearCache(null, new NearCacheConfiguration());
+                    ignite.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration());
             }
 
             for (int i = 0; i < 10; i++)
-                grid(1).cache(null).put(i, i);
+                grid(1).cache(DEFAULT_CACHE_NAME).put(i, i);
 
             final Ignite igniteNearOnly = grid(0);
-            final IgniteCache<Object, Object> nearOnly = igniteNearOnly.cache(null);
+            final IgniteCache<Object, Object> nearOnly = igniteNearOnly.cache(DEFAULT_CACHE_NAME);
 
             // Populate near cache.
             for (int i = 0; i < 10; i++) {
@@ -243,7 +243,7 @@ public class GridCacheNearOnlyTopologySelfTest extends GridCommonAbstractTest {
                 Ignite ignite = startGrid(i);
 
                 if (cilent)
-                    ignite.createNearCache(null, new NearCacheConfiguration());
+                    ignite.createNearCache(DEFAULT_CACHE_NAME, new NearCacheConfiguration());
             }
         }
         finally {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearPartitionedClearSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearPartitionedClearSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearPartitionedClearSelfTest.java
index 7254f28..cbdc855 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearPartitionedClearSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearPartitionedClearSelfTest.java
@@ -78,7 +78,7 @@ public class GridCacheNearPartitionedClearSelfTest extends GridCommonAbstractTes
 
         cfg.setDiscoverySpi(discoSpi);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(CACHE_NAME);
         ccfg.setCacheMode(PARTITIONED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReaderPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReaderPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReaderPreloadSelfTest.java
index 81dacde..e143260 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReaderPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReaderPreloadSelfTest.java
@@ -122,7 +122,7 @@ public class GridCacheNearReaderPreloadSelfTest extends GridCommonAbstractTest {
      */
     private IgniteConfiguration dataNode(TcpDiscoveryIpFinder ipFinder, String igniteInstanceName)
         throws Exception {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(CACHE_NAME);
         ccfg.setCacheMode(PARTITIONED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
index 03fb8c4..40a3af2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
@@ -158,8 +158,8 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
         Ignite g1 = grid(n1.id());
         Ignite g2 = grid(n2.id());
 
-        IgniteCache<Integer, String> cache1 = g1.cache(null);
-        IgniteCache<Integer, String> cache2 = g2.cache(null);
+        IgniteCache<Integer, String> cache1 = g1.cache(DEFAULT_CACHE_NAME);
+        IgniteCache<Integer, String> cache2 = g2.cache(DEFAULT_CACHE_NAME);
 
         // Store some values in cache.
         assertNull(cache1.getAndPut(1, "v1"));
@@ -253,11 +253,11 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
 
         awaitPartitionMapExchange();
 
-        GridCacheContext ctx = ((IgniteKernal) g1).internalCache(null).context();
+        GridCacheContext ctx = ((IgniteKernal) g1).internalCache(DEFAULT_CACHE_NAME).context();
 
         List<KeyCacheObject> cacheKeys = F.asList(ctx.toCacheKeyObject(1), ctx.toCacheKeyObject(2));
 
-        IgniteInternalFuture<Object> f1 = ((IgniteKernal)g1).internalCache(null).preloader().request(
+        IgniteInternalFuture<Object> f1 = ((IgniteKernal)g1).internalCache(DEFAULT_CACHE_NAME).preloader().request(
             cacheKeys,
             new AffinityTopologyVersion(2));
 
@@ -265,21 +265,21 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
             f1.get();
 
 
-        IgniteInternalFuture<Object> f2 = ((IgniteKernal)g2).internalCache(null).preloader().request(
+        IgniteInternalFuture<Object> f2 = ((IgniteKernal)g2).internalCache(DEFAULT_CACHE_NAME).preloader().request(
             cacheKeys,
             new AffinityTopologyVersion(2));
 
         if (f2 != null)
             f2.get();
 
-        IgniteCache<Integer, String> cache1 = g1.cache(null);
-        IgniteCache<Integer, String> cache2 = g2.cache(null);
+        IgniteCache<Integer, String> cache1 = g1.cache(DEFAULT_CACHE_NAME);
+        IgniteCache<Integer, String> cache2 = g2.cache(DEFAULT_CACHE_NAME);
 
-        assertEquals(g1.affinity(null).mapKeyToNode(1), g1.cluster().localNode());
-        assertFalse(g1.affinity(null).mapKeyToNode(2).equals(g1.cluster().localNode()));
+        assertEquals(g1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(1), g1.cluster().localNode());
+        assertFalse(g1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(2).equals(g1.cluster().localNode()));
 
-        assertEquals(g1.affinity(null).mapKeyToNode(2), g2.cluster().localNode());
-        assertFalse(g2.affinity(null).mapKeyToNode(1).equals(g2.cluster().localNode()));
+        assertEquals(g1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(2), g2.cluster().localNode());
+        assertFalse(g2.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(1).equals(g2.cluster().localNode()));
 
         // Store first value in cache.
         assertNull(cache1.getAndPut(1, "v1"));
@@ -355,8 +355,8 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
         startGrids();
 
         try {
-            IgniteCache<Object, Object> prj0 = grid(0).cache(null);
-            IgniteCache<Object, Object> prj1 = grid(1).cache(null);
+            IgniteCache<Object, Object> prj0 = grid(0).cache(DEFAULT_CACHE_NAME);
+            IgniteCache<Object, Object> prj1 = grid(1).cache(DEFAULT_CACHE_NAME);
 
             Map<Integer, Integer> putMap = new HashMap<>();
 
@@ -391,9 +391,9 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
         startGrids();
 
         try {
-            IgniteCache<Object, Object> prj0 = grid(0).cache(null);
-            IgniteCache<Object, Object> prj1 = grid(1).cache(null);
-            IgniteCache<Object, Object> prj2 = grid(2).cache(null);
+            IgniteCache<Object, Object> prj0 = grid(0).cache(DEFAULT_CACHE_NAME);
+            IgniteCache<Object, Object> prj1 = grid(1).cache(DEFAULT_CACHE_NAME);
+            IgniteCache<Object, Object> prj2 = grid(2).cache(DEFAULT_CACHE_NAME);
 
             Map<Integer, Integer> putMap = new HashMap<>();
 
@@ -449,8 +449,8 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
 
         assertFalse("Nodes cannot be equal: " + primary, primary.equals(backup));
 
-        IgniteCache<Integer, String> cache1 = grid(primary.id()).cache(null);
-        IgniteCache<Integer, String> cache2 = grid(backup.id()).cache(null);
+        IgniteCache<Integer, String> cache1 = grid(primary.id()).cache(DEFAULT_CACHE_NAME);
+        IgniteCache<Integer, String> cache2 = grid(backup.id()).cache(DEFAULT_CACHE_NAME);
 
         // Store a values in cache.
         assertNull(cache1.getAndPut(1, "v1"));

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java
index be8f1bc..77aa75e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxForceKeyTest.java
@@ -44,7 +44,7 @@ public class GridCacheNearTxForceKeyTest extends GridCommonAbstractTest {
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(TRANSACTIONAL);
         ccfg.setWriteSynchronizationMode(FULL_SYNC);
@@ -66,18 +66,18 @@ public class GridCacheNearTxForceKeyTest extends GridCommonAbstractTest {
     public void testNearTx() throws Exception {
         Ignite ignite0 = startGrid(0);
 
-        IgniteCache<Integer, Integer> cache = ignite0.cache(null);
+        IgniteCache<Integer, Integer> cache = ignite0.cache(DEFAULT_CACHE_NAME);
 
         Ignite ignite1 = startGrid(1);
 
         awaitPartitionMapExchange();
 
         // This key should become primary for ignite1.
-        final Integer key = primaryKey(ignite1.cache(null));
+        final Integer key = primaryKey(ignite1.cache(DEFAULT_CACHE_NAME));
 
         assertNull(cache.getAndPut(key, key));
 
-        assertTrue(ignite0.affinity(null).isPrimary(ignite1.cluster().localNode(), key));
+        assertTrue(ignite0.affinity(DEFAULT_CACHE_NAME).isPrimary(ignite1.cluster().localNode(), key));
     }
 
     /** {@inheritDoc} */


[14/51] [abbrv] ignite git commit: ignite-1794 Refactored hibernate modules, switched to hibernate 5.1

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java
new file mode 100644
index 0000000..7ac790c
--- /dev/null
+++ b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheSelfTest.java
@@ -0,0 +1,1954 @@
+/*
+ * 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.cache.hibernate;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
+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.hibernate.ObjectNotFoundException;
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.StaleObjectStateException;
+import org.hibernate.Transaction;
+import org.hibernate.annotations.NaturalId;
+import org.hibernate.annotations.NaturalIdCache;
+import org.hibernate.cache.spi.GeneralDataRegion;
+import org.hibernate.cache.spi.TransactionalDataRegion;
+import org.hibernate.cache.spi.access.AccessType;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.exception.ConstraintViolationException;
+import org.hibernate.service.ServiceRegistryBuilder;
+import org.hibernate.stat.NaturalIdCacheStatistics;
+import org.hibernate.stat.SecondLevelCacheStatistics;
+
+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.CacheWriteSynchronizationMode.FULL_SYNC;
+import static org.apache.ignite.cache.hibernate.HibernateAccessStrategyFactory.DFLT_ACCESS_TYPE_PROPERTY;
+import static org.apache.ignite.cache.hibernate.HibernateAccessStrategyFactory.IGNITE_INSTANCE_NAME_PROPERTY;
+import static org.apache.ignite.cache.hibernate.HibernateAccessStrategyFactory.REGION_CACHE_PROPERTY;
+import static org.hibernate.cfg.Environment.CACHE_REGION_FACTORY;
+import static org.hibernate.cfg.Environment.GENERATE_STATISTICS;
+import static org.hibernate.cfg.Environment.HBM2DDL_AUTO;
+import static org.hibernate.cfg.Environment.RELEASE_CONNECTIONS;
+import static org.hibernate.cfg.Environment.USE_QUERY_CACHE;
+import static org.hibernate.cfg.Environment.USE_SECOND_LEVEL_CACHE;
+
+/**
+ *
+ * Tests Hibernate L2 cache.
+ */
+public class HibernateL2CacheSelfTest extends GridCommonAbstractTest {
+    /** */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    public static final String CONNECTION_URL = "jdbc:h2:mem:example;DB_CLOSE_DELAY=-1";
+
+    /** */
+    public static final String ENTITY_NAME = Entity.class.getName();
+
+    /** */
+    public static final String ENTITY2_NAME = Entity2.class.getName();
+
+    /** */
+    public static final String VERSIONED_ENTITY_NAME = VersionedEntity.class.getName();
+
+    /** */
+    public static final String PARENT_ENTITY_NAME = ParentEntity.class.getName();
+
+    /** */
+    public static final String CHILD_COLLECTION_REGION = ENTITY_NAME + ".children";
+
+    /** */
+    public static final String NATURAL_ID_REGION =
+        "org.apache.ignite.cache.hibernate.HibernateL2CacheSelfTest$Entity##NaturalId";
+
+    /** */
+    public static final String NATURAL_ID_REGION2 =
+        "org.apache.ignite.cache.hibernate.HibernateL2CacheSelfTest$Entity2##NaturalId";
+
+    /** */
+    private SessionFactory sesFactory1;
+
+    /** */
+    private SessionFactory sesFactory2;
+
+    /**
+     * First Hibernate test entity.
+     */
+    @javax.persistence.Entity
+    @NaturalIdCache
+    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
+    public static class Entity {
+        /** */
+        private int id;
+
+        /** */
+        private String name;
+
+        /** */
+        private Collection<ChildEntity> children;
+
+        /**
+         * Default constructor required by Hibernate.
+         */
+        public Entity() {
+            // No-op.
+        }
+
+        /**
+         * @param id ID.
+         * @param name Name.
+         */
+        public Entity(int id, String name) {
+            this.id = id;
+            this.name = name;
+        }
+
+        /**
+         * @return ID.
+         */
+        @Id
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+
+        /**
+         * @return Name.
+         */
+        @NaturalId(mutable = true)
+        public String getName() {
+            return name;
+        }
+
+        /**
+         * @param name Name.
+         */
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        /**
+         * @return Children.
+         */
+        @OneToMany(cascade=javax.persistence.CascadeType.ALL, fetch=FetchType.LAZY)
+        @JoinColumn(name="ENTITY_ID")
+        public Collection<ChildEntity> getChildren() {
+            return children;
+        }
+
+        /**
+         * @param children Children.
+         */
+        public void setChildren(Collection<ChildEntity> children) {
+            this.children = children;
+        }
+    }
+
+    /**
+     * Second Hibernate test entity.
+     */
+    @javax.persistence.Entity
+    @NaturalIdCache
+    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
+    public static class Entity2 {
+        /** */
+        private int id;
+
+        /** */
+        private String name;
+
+        /** */
+        private Collection<ChildEntity> children;
+
+        /**
+         * Default constructor required by Hibernate.
+         */
+        public Entity2() {
+            // No-op.
+        }
+
+        /**
+         * @param id ID.
+         * @param name Name.
+         */
+        public Entity2(int id, String name) {
+            this.id = id;
+            this.name = name;
+        }
+
+        /**
+         * @return ID.
+         */
+        @Id
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+
+        /**
+         * @return Name.
+         */
+        @NaturalId(mutable = true)
+        public String getName() {
+            return name;
+        }
+
+        /**
+         * @param name Name.
+         */
+        public void setName(String name) {
+            this.name = name;
+        }
+    }
+
+    /**
+     * Hibernate child entity referenced by {@link Entity}.
+     */
+    @javax.persistence.Entity
+    @SuppressWarnings("PublicInnerClass")
+    public static class ChildEntity {
+        /** */
+        private int id;
+
+        /**
+         * Default constructor required by Hibernate.
+         */
+        public ChildEntity() {
+            // No-op.
+        }
+
+        /**
+         * @param id ID.
+         */
+        public ChildEntity(int id) {
+            this.id = id;
+        }
+
+        /**
+         * @return ID.
+         */
+        @Id
+        @GeneratedValue
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+    }
+
+    /**
+     * Hibernate entity referencing {@link Entity}.
+     */
+    @javax.persistence.Entity
+    @SuppressWarnings("PublicInnerClass")
+    public static class ParentEntity {
+        /** */
+        private int id;
+
+        /** */
+        private Entity entity;
+
+        /**
+         * Default constructor required by Hibernate.
+         */
+        public ParentEntity() {
+            // No-op.
+        }
+
+        /**
+         * @param id ID.
+         * @param entity Referenced entity.
+         */
+        public ParentEntity(int id, Entity entity) {
+            this.id = id;
+            this.entity = entity;
+        }
+
+        /**
+         * @return ID.
+         */
+        @Id
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+
+        /**
+         * @return Referenced entity.
+         */
+        @OneToOne
+        public Entity getEntity() {
+            return entity;
+        }
+
+        /**
+         * @param entity Referenced entity.
+         */
+        public void setEntity(Entity entity) {
+            this.entity = entity;
+        }
+    }
+
+    /**
+     * Hibernate entity.
+     */
+    @javax.persistence.Entity
+    @SuppressWarnings({"PublicInnerClass", "UnnecessaryFullyQualifiedName"})
+    public static class VersionedEntity {
+        /** */
+        private int id;
+
+        /** */
+        private long ver;
+
+        /**
+         * Default constructor required by Hibernate.
+         */
+        public VersionedEntity() {
+        }
+
+        /**
+         * @param id ID.
+         */
+        public VersionedEntity(int id) {
+            this.id = id;
+        }
+
+        /**
+         * @return ID.
+         */
+        @Id
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+
+        /**
+         * @return Version.
+         */
+        @javax.persistence.Version
+        public long getVersion() {
+            return ver;
+        }
+
+        /**
+         * @param ver Version.
+         */
+        public void setVersion(long ver) {
+            this.ver = ver;
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+        discoSpi.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(discoSpi);
+
+        cfg.setCacheConfiguration(generalRegionConfiguration("org.hibernate.cache.spi.UpdateTimestampsCache"),
+            generalRegionConfiguration("org.hibernate.cache.internal.StandardQueryCache"),
+            transactionalRegionConfiguration(ENTITY_NAME),
+            transactionalRegionConfiguration(ENTITY2_NAME),
+            transactionalRegionConfiguration(VERSIONED_ENTITY_NAME),
+            transactionalRegionConfiguration(PARENT_ENTITY_NAME),
+            transactionalRegionConfiguration(CHILD_COLLECTION_REGION),
+            transactionalRegionConfiguration(NATURAL_ID_REGION),
+            transactionalRegionConfiguration(NATURAL_ID_REGION2));
+
+        return cfg;
+    }
+
+    /**
+     * @param regionName Region name.
+     * @return Cache configuration for {@link GeneralDataRegion}.
+     */
+    private CacheConfiguration generalRegionConfiguration(String regionName) {
+        CacheConfiguration cfg = new CacheConfiguration();
+
+        cfg.setName(regionName);
+
+        cfg.setCacheMode(PARTITIONED);
+
+        cfg.setAtomicityMode(ATOMIC);
+
+        cfg.setWriteSynchronizationMode(FULL_SYNC);
+
+        cfg.setBackups(1);
+
+        cfg.setAffinity(new RendezvousAffinityFunction(false, 10));
+
+        return cfg;
+    }
+
+    /**
+     * @param regionName Region name.
+     * @return Cache configuration for {@link TransactionalDataRegion}.
+     */
+    protected CacheConfiguration transactionalRegionConfiguration(String regionName) {
+        CacheConfiguration cfg = new CacheConfiguration();
+
+        cfg.setName(regionName);
+
+        cfg.setCacheMode(PARTITIONED);
+
+        cfg.setAtomicityMode(TRANSACTIONAL);
+
+        cfg.setWriteSynchronizationMode(FULL_SYNC);
+
+        cfg.setBackups(1);
+
+        cfg.setAffinity(new RendezvousAffinityFunction(false, 10));
+
+        return cfg;
+    }
+
+    /**
+     * @param accessType Hibernate L2 cache access type.
+     * @param igniteInstanceName Ignite instance name.
+     * @return Hibernate configuration.
+     */
+    private Configuration hibernateConfiguration(AccessType accessType,
+        String igniteInstanceName) {
+        Configuration cfg = new Configuration();
+
+        cfg.addAnnotatedClass(Entity.class);
+        cfg.addAnnotatedClass(Entity2.class);
+        cfg.addAnnotatedClass(VersionedEntity.class);
+        cfg.addAnnotatedClass(ChildEntity.class);
+        cfg.addAnnotatedClass(ParentEntity.class);
+
+        cfg.setCacheConcurrencyStrategy(ENTITY_NAME, accessType.getExternalName());
+        cfg.setCacheConcurrencyStrategy(ENTITY2_NAME, accessType.getExternalName());
+        cfg.setCacheConcurrencyStrategy(VERSIONED_ENTITY_NAME, accessType.getExternalName());
+        cfg.setCacheConcurrencyStrategy(PARENT_ENTITY_NAME, accessType.getExternalName());
+        cfg.setCollectionCacheConcurrencyStrategy(CHILD_COLLECTION_REGION, accessType.getExternalName());
+
+        for (Map.Entry<String, String> e : hibernateProperties(igniteInstanceName, accessType.name()).entrySet())
+            cfg.setProperty(e.getKey(), e.getValue());
+
+        // Use the same cache for Entity and Entity2.
+        cfg.setProperty(REGION_CACHE_PROPERTY + ENTITY2_NAME, ENTITY_NAME);
+
+        return cfg;
+    }
+
+    /**
+     * @return Hibernate registry builder.
+     */
+    protected ServiceRegistryBuilder registryBuilder() {
+        ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
+
+        builder.applySetting("hibernate.connection.url", CONNECTION_URL);
+
+        return builder;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGrids(2);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        cleanup();
+    }
+
+    /**
+     * @return Hibernate L2 cache access types to test.
+     */
+    protected AccessType[] accessTypes() {
+        return new AccessType[]{AccessType.READ_ONLY, AccessType.NONSTRICT_READ_WRITE, AccessType.READ_WRITE};
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCollectionCache() throws Exception {
+        for (AccessType accessType : accessTypes())
+            testCollectionCache(accessType);
+    }
+
+    /**
+     * @param accessType Cache access type.
+     * @throws Exception If failed.
+     */
+    @SuppressWarnings("unchecked")
+    private void testCollectionCache(AccessType accessType) throws Exception {
+        createSessionFactories(accessType);
+
+        Map<Integer, Integer> idToChildCnt = new HashMap<>();
+
+        try {
+            Session ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                for (int i = 0; i < 3; i++) {
+                    Entity e = new Entity(i, "name-" + i);
+
+                    Collection<ChildEntity> children = new ArrayList<>();
+
+                    for (int j = 0; j < 3; j++)
+                        children.add(new ChildEntity());
+
+                    e.setChildren(children);
+
+                    idToChildCnt.put(e.getId(), e.getChildren().size());
+
+                    ses.save(e);
+                }
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            // Load children, this should populate cache.
+
+            ses = sesFactory1.openSession();
+
+            try {
+                List<Entity> list = ses.createCriteria(ENTITY_NAME).list();
+
+                assertEquals(idToChildCnt.size(), list.size());
+
+                for (Entity e : list)
+                    assertEquals((int)idToChildCnt.get(e.getId()), e.getChildren().size());
+            }
+            finally {
+                ses.close();
+            }
+
+            assertCollectionCache(sesFactory2, idToChildCnt, 3, 0);
+            assertCollectionCache(sesFactory1, idToChildCnt, 3, 0);
+
+            if (accessType == AccessType.READ_ONLY)
+                return;
+
+            // Update children for one entity.
+
+            ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                Entity e1 = (Entity)ses.load(Entity.class, 1);
+
+                e1.getChildren().remove(e1.getChildren().iterator().next());
+
+                ses.update(e1);
+
+                idToChildCnt.put(e1.getId(), e1.getChildren().size());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertCollectionCache(sesFactory2, idToChildCnt, 2, 1); // After update collection cache entry is removed.
+            assertCollectionCache(sesFactory1, idToChildCnt, 3, 0); // 'assertCollectionCache' loads children in cache.
+
+            // Update children for the same entity using another SessionFactory.
+
+            ses = sesFactory2.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                Entity e1 = (Entity)ses.load(Entity.class, 1);
+
+                e1.getChildren().remove(e1.getChildren().iterator().next());
+
+                ses.update(e1);
+
+                idToChildCnt.put(e1.getId(), e1.getChildren().size());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertCollectionCache(sesFactory2, idToChildCnt, 2, 1); // After update collection cache entry is removed.
+            assertCollectionCache(sesFactory1, idToChildCnt, 3, 0); // 'assertCollectionCache' loads children in cache.
+        }
+        finally {
+            cleanup();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testEntityCache() throws Exception {
+        for (AccessType accessType : accessTypes())
+            testEntityCache(accessType);
+    }
+
+    /**
+     * @param accessType Cache access type.
+     * @throws Exception If failed.
+     */
+    private void testEntityCache(AccessType accessType) throws Exception {
+        createSessionFactories(accessType);
+
+        Map<Integer, String> idToName = new HashMap<>();
+
+        try {
+            Session ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                for (int i = 0; i < 2; i++) {
+                    String name = "name-" + i;
+
+                    ses.save(new Entity(i, name));
+
+                    idToName.put(i, name);
+                }
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 100);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 100);
+
+            if (accessType == AccessType.READ_ONLY)
+                return;
+
+            ses = sesFactory1.openSession();
+
+            try {
+                // Updates and inserts in single transaction.
+
+                Transaction tx = ses.beginTransaction();
+
+                Entity e0 = (Entity)ses.load(Entity.class, 0);
+
+                e0.setName("name-0-changed1");
+
+                ses.update(e0);
+
+                idToName.put(0, e0.getName());
+
+                ses.save(new Entity(2, "name-2"));
+
+                idToName.put(2, "name-2");
+
+                Entity e1 = (Entity)ses.load(Entity.class, 1);
+
+                e1.setName("name-1-changed1");
+
+                ses.update(e1);
+
+                idToName.put(1, e1.getName());
+
+                ses.save(new Entity(3, "name-3"));
+
+                idToName.put(3, "name-3");
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName);
+
+            ses = sesFactory1.openSession();
+
+            try {
+                // Updates, inserts and deletes in single transaction.
+
+                Transaction tx = ses.beginTransaction();
+
+                ses.save(new Entity(4, "name-4"));
+
+                idToName.put(4, "name-4");
+
+                Entity e0 = (Entity)ses.load(Entity.class, 0);
+
+                e0.setName("name-0-changed2");
+
+                ses.update(e0);
+
+                idToName.put(e0.getId(), e0.getName());
+
+                ses.delete(ses.load(Entity.class, 1));
+
+                idToName.remove(1);
+
+                Entity e2 = (Entity)ses.load(Entity.class, 2);
+
+                e2.setName("name-2-changed1");
+
+                ses.update(e2);
+
+                idToName.put(e2.getId(), e2.getName());
+
+                ses.delete(ses.load(Entity.class, 3));
+
+                idToName.remove(3);
+
+                ses.save(new Entity(5, "name-5"));
+
+                idToName.put(5, "name-5");
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 1, 3);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 1, 3);
+
+            // Try to update the same entity using another SessionFactory.
+
+            ses = sesFactory2.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                Entity e0 = (Entity)ses.load(Entity.class, 0);
+
+                e0.setName("name-0-changed3");
+
+                ses.update(e0);
+
+                idToName.put(e0.getId(), e0.getName());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName);
+        }
+        finally {
+            cleanup();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testTwoEntitiesSameCache() throws Exception {
+        for (AccessType accessType : accessTypes())
+            testTwoEntitiesSameCache(accessType);
+    }
+
+    /**
+     * @param accessType Cache access type.
+     * @throws Exception If failed.
+     */
+    private void testTwoEntitiesSameCache(AccessType accessType) throws Exception {
+        createSessionFactories(accessType);
+
+        try {
+            Session ses = sesFactory1.openSession();
+
+            Map<Integer, String> idToName1 = new HashMap<>();
+            Map<Integer, String> idToName2 = new HashMap<>();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                for (int i = 0; i < 2; i++) {
+                    String name = "name-" + i;
+
+                    ses.save(new Entity(i, name));
+                    ses.save(new Entity2(i, name));
+
+                    idToName1.put(i, name);
+                    idToName2.put(i, name);
+                }
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 100);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 100);
+
+            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 100);
+            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 100);
+
+            if (accessType == AccessType.READ_ONLY)
+                return;
+
+            ses = sesFactory1.openSession();
+
+            try {
+                // Updates both entities in single transaction.
+
+                Transaction tx = ses.beginTransaction();
+
+                Entity e = (Entity)ses.load(Entity.class, 0);
+
+                e.setName("name-0-changed1");
+
+                ses.update(e);
+
+                Entity2 e2 = (Entity2)ses.load(Entity2.class, 0);
+
+                e2.setName("name-e2-0-changed1");
+
+                ses.update(e2);
+
+                idToName1.put(0, e.getName());
+                idToName2.put(0, e2.getName());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 100);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 100);
+
+            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 100);
+            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 100);
+
+            ses = sesFactory1.openSession();
+
+            try {
+                // Remove entity1 and insert entity2 in single transaction.
+
+                Transaction tx = ses.beginTransaction();
+
+                Entity e = (Entity)ses.load(Entity.class, 0);
+
+                ses.delete(e);
+
+                Entity2 e2 = new Entity2(2, "name-2");
+
+                ses.save(e2);
+
+                idToName1.remove(0);
+                idToName2.put(2, e2.getName());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 0, 100);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 0, 100);
+
+            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 100);
+            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 100);
+
+            ses = sesFactory1.openSession();
+
+            Transaction tx = ses.beginTransaction();
+
+            try {
+                // Update, remove, insert in single transaction, transaction fails.
+
+                Entity e = (Entity)ses.load(Entity.class, 1);
+
+                e.setName("name-1-changed1");
+
+                ses.update(e); // Valid update.
+
+                ses.save(new Entity(2, "name-2")); // Valid insert.
+
+                ses.delete(ses.load(Entity2.class, 0)); // Valid delete.
+
+                Entity2 e2 = (Entity2)ses.load(Entity2.class, 1);
+
+                e2.setName("name-2");  // Invalid update, not-unique name.
+
+                ses.update(e2);
+
+                tx.commit();
+
+                fail("Commit must fail.");
+            }
+            catch (ConstraintViolationException e) {
+                log.info("Expected exception: " + e);
+
+                tx.rollback();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 0, 2, 100);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 0, 2, 100);
+
+            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 100);
+            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 100);
+
+            ses = sesFactory2.openSession();
+
+            try {
+                // Update, remove, insert in single transaction.
+
+                tx = ses.beginTransaction();
+
+                Entity e = (Entity)ses.load(Entity.class, 1);
+
+                e.setName("name-1-changed1");
+
+                ses.update(e);
+
+                idToName1.put(1, e.getName());
+
+                ses.save(new Entity(2, "name-2"));
+
+                idToName1.put(2, "name-2");
+
+                ses.delete(ses.load(Entity2.class, 0));
+
+                idToName2.remove(0);
+
+                Entity2 e2 = (Entity2)ses.load(Entity2.class, 1);
+
+                e2.setName("name-e2-2-changed");
+
+                ses.update(e2);
+
+                idToName2.put(1, e2.getName());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName1, 0, 100);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName1, 0, 100);
+
+            assertEntityCache(ENTITY2_NAME, sesFactory2, idToName2, 0, 100);
+            assertEntityCache(ENTITY2_NAME, sesFactory1, idToName2, 0, 100);
+        }
+        finally {
+            cleanup();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testVersionedEntity() throws Exception {
+        for (AccessType accessType : accessTypes())
+            testVersionedEntity(accessType);
+    }
+
+    /**
+     * @param accessType Cache access type.
+     * @throws Exception If failed.
+     */
+    private void testVersionedEntity(AccessType accessType) throws Exception {
+        createSessionFactories(accessType);
+
+        try {
+            Session ses = sesFactory1.openSession();
+
+            VersionedEntity e0 = new VersionedEntity(0);
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                ses.save(e0);
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            ses = sesFactory1.openSession();
+
+            long ver;
+
+            try {
+                ver = ((VersionedEntity)ses.load(VersionedEntity.class, 0)).getVersion();
+            }
+            finally {
+                ses.close();
+            }
+
+            SecondLevelCacheStatistics stats1 =
+                sesFactory1.getStatistics().getSecondLevelCacheStatistics(VERSIONED_ENTITY_NAME);
+            SecondLevelCacheStatistics stats2 =
+                sesFactory2.getStatistics().getSecondLevelCacheStatistics(VERSIONED_ENTITY_NAME);
+
+            assertEquals(1, stats1.getElementCountInMemory());
+            assertEquals(1, stats2.getElementCountInMemory());
+
+            ses = sesFactory2.openSession();
+
+            try {
+                assertEquals(ver, ((VersionedEntity)ses.load(VersionedEntity.class, 0)).getVersion());
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEquals(1, stats2.getElementCountInMemory());
+            assertEquals(1, stats2.getHitCount());
+
+            if (accessType == AccessType.READ_ONLY)
+                return;
+
+            e0.setVersion(ver - 1);
+
+            ses = sesFactory1.openSession();
+
+            Transaction tx = ses.beginTransaction();
+
+            try {
+                ses.update(e0);
+
+                tx.commit();
+
+                fail("Commit must fail.");
+            }
+            catch (StaleObjectStateException e) {
+                log.info("Expected exception: " + e);
+            }
+            finally {
+                tx.rollback();
+
+                ses.close();
+            }
+
+            sesFactory1.getStatistics().clear();
+
+            stats1 = sesFactory1.getStatistics().getSecondLevelCacheStatistics(VERSIONED_ENTITY_NAME);
+
+            ses = sesFactory1.openSession();
+
+            try {
+                assertEquals(ver, ((VersionedEntity)ses.load(VersionedEntity.class, 0)).getVersion());
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEquals(1, stats1.getElementCountInMemory());
+            assertEquals(1, stats1.getHitCount());
+            assertEquals(1, stats2.getElementCountInMemory());
+            assertEquals(1, stats2.getHitCount());
+        }
+        finally {
+            cleanup();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNaturalIdCache() throws Exception {
+        for (AccessType accessType : accessTypes())
+            testNaturalIdCache(accessType);
+    }
+
+    /**
+     * @param accessType Cache access type.
+     * @throws Exception If failed.
+     */
+    private void testNaturalIdCache(AccessType accessType) throws Exception {
+        createSessionFactories(accessType);
+
+        Map<String, Integer> nameToId = new HashMap<>();
+
+        try {
+            Session ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                for (int i = 0; i < 3; i++) {
+                    String name = "name-" + i;
+
+                    ses.save(new Entity(i, name));
+
+                    nameToId.put(name, i);
+                }
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            ses = sesFactory1.openSession();
+
+            try {
+                for (Map.Entry<String, Integer> e : nameToId.entrySet())
+                    ((Entity)ses.bySimpleNaturalId(Entity.class).load(e.getKey())).getId();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertNaturalIdCache(sesFactory2, nameToId, "name-100");
+            assertNaturalIdCache(sesFactory1, nameToId, "name-100");
+
+            if (accessType == AccessType.READ_ONLY)
+                return;
+
+            // Update naturalId.
+
+            ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                Entity e1 = (Entity)ses.load(Entity.class, 1);
+
+                nameToId.remove(e1.getName());
+
+                e1.setName("name-1-changed1");
+
+                nameToId.put(e1.getName(), e1.getId());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertNaturalIdCache(sesFactory2, nameToId, "name-1");
+            assertNaturalIdCache(sesFactory1, nameToId, "name-1");
+
+            // Update entity using another SessionFactory.
+
+            ses = sesFactory2.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                Entity e1 = (Entity)ses.load(Entity.class, 1);
+
+                nameToId.remove(e1.getName());
+
+                e1.setName("name-1-changed2");
+
+                nameToId.put(e1.getName(), e1.getId());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertNaturalIdCache(sesFactory2, nameToId, "name-1-changed1");
+            assertNaturalIdCache(sesFactory1, nameToId, "name-1-changed1");
+
+            // Try invalid NaturalId update.
+
+            ses = sesFactory1.openSession();
+
+            Transaction tx = ses.beginTransaction();
+
+            try {
+                Entity e1 = (Entity)ses.load(Entity.class, 1);
+
+                e1.setName("name-0"); // Invalid update (duplicated name).
+
+                tx.commit();
+
+                fail("Commit must fail.");
+            }
+            catch (ConstraintViolationException e) {
+                log.info("Expected exception: " + e);
+
+                tx.rollback();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertNaturalIdCache(sesFactory2, nameToId);
+            assertNaturalIdCache(sesFactory1, nameToId);
+
+            // Delete entity.
+
+            ses = sesFactory2.openSession();
+
+            try {
+                tx = ses.beginTransaction();
+
+                Entity e2 = (Entity)ses.load(Entity.class, 2);
+
+                ses.delete(e2);
+
+                nameToId.remove(e2.getName());
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertNaturalIdCache(sesFactory2, nameToId, "name-2");
+            assertNaturalIdCache(sesFactory1, nameToId, "name-2");
+        }
+        finally {
+            cleanup();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testEntityCacheTransactionFails() throws Exception {
+        for (AccessType accessType : accessTypes())
+            testEntityCacheTransactionFails(accessType);
+    }
+
+    /**
+     * @param accessType Cache access type.
+     * @throws Exception If failed.
+     */
+    private void testEntityCacheTransactionFails(AccessType accessType) throws Exception {
+        createSessionFactories(accessType);
+
+        Map<Integer, String> idToName = new HashMap<>();
+
+        try {
+            Session ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                for (int i = 0; i < 3; i++) {
+                    String name = "name-" + i;
+
+                    ses.save(new Entity(i, name));
+
+                    idToName.put(i, name);
+                }
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 100);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 100);
+
+            ses = sesFactory1.openSession();
+
+            Transaction tx = ses.beginTransaction();
+
+            try {
+                ses.save(new Entity(3, "name-3")); // Valid insert.
+
+                ses.save(new Entity(0, "name-0")); // Invalid insert (duplicated ID).
+
+                tx.commit();
+
+                fail("Commit must fail.");
+            }
+            catch (ConstraintViolationException e) {
+                log.info("Expected exception: " + e);
+
+                tx.rollback();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 3);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 3);
+
+            if (accessType == AccessType.READ_ONLY)
+                return;
+
+            ses = sesFactory1.openSession();
+
+            tx = ses.beginTransaction();
+
+            try {
+                Entity e0 = (Entity)ses.load(Entity.class, 0);
+                Entity e1 = (Entity)ses.load(Entity.class, 1);
+
+                e0.setName("name-10"); // Valid update.
+                e1.setName("name-2"); // Invalid update (violates unique constraint).
+
+                ses.update(e0);
+                ses.update(e1);
+
+                tx.commit();
+
+                fail("Commit must fail.");
+            }
+            catch (ConstraintViolationException e) {
+                log.info("Expected exception: " + e);
+
+                tx.rollback();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName);
+
+            ses = sesFactory1.openSession();
+
+            try {
+                // Create parent entity referencing Entity with ID = 0.
+
+                tx = ses.beginTransaction();
+
+                ses.save(new ParentEntity(0, (Entity) ses.load(Entity.class, 0)));
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            ses = sesFactory1.openSession();
+
+            tx = ses.beginTransaction();
+
+            try {
+                ses.save(new Entity(3, "name-3")); // Valid insert.
+
+                Entity e1 = (Entity)ses.load(Entity.class, 1);
+
+                e1.setName("name-10"); // Valid update.
+
+                ses.delete(ses.load(Entity.class, 0)); // Invalid delete (there is a parent entity referencing it).
+
+                tx.commit();
+
+                fail("Commit must fail.");
+            }
+            catch (ConstraintViolationException e) {
+                log.info("Expected exception: " + e);
+
+                tx.rollback();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName, 3);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName, 3);
+
+            ses = sesFactory1.openSession();
+
+            tx = ses.beginTransaction();
+
+            try {
+                ses.delete(ses.load(Entity.class, 1)); // Valid delete.
+
+                idToName.remove(1);
+
+                ses.delete(ses.load(Entity.class, 0)); // Invalid delete (there is a parent entity referencing it).
+
+                tx.commit();
+
+                fail("Commit must fail.");
+            }
+            catch (ConstraintViolationException e) {
+                log.info("Expected exception: " + e);
+
+                tx.rollback();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEntityCache(ENTITY_NAME, sesFactory2, idToName);
+            assertEntityCache(ENTITY_NAME, sesFactory1, idToName);
+        }
+        finally {
+            cleanup();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testQueryCache() throws Exception {
+        for (AccessType accessType : accessTypes())
+            testQueryCache(accessType);
+    }
+
+    /**
+     * @param accessType Cache access type.
+     * @throws Exception If failed.
+     */
+    private void testQueryCache(AccessType accessType) throws Exception {
+        createSessionFactories(accessType);
+
+        try {
+            Session ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                for (int i = 0; i < 5; i++)
+                    ses.save(new Entity(i, "name-" + i));
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            // Run some queries.
+
+            ses = sesFactory1.openSession();
+
+            try {
+                Query qry1 = ses.createQuery("from " + ENTITY_NAME + " where id > 2");
+
+                qry1.setCacheable(true);
+
+                assertEquals(2, qry1.list().size());
+
+                Query qry2 = ses.createQuery("from " + ENTITY_NAME + " where name = 'name-0'");
+
+                qry2.setCacheable(true);
+
+                assertEquals(1, qry2.list().size());
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEquals(0, sesFactory1.getStatistics().getQueryCacheHitCount());
+            assertEquals(2, sesFactory1.getStatistics().getQueryCacheMissCount());
+            assertEquals(2, sesFactory1.getStatistics().getQueryCachePutCount());
+
+            // Run queries using another SessionFactory.
+
+            ses = sesFactory2.openSession();
+
+            try {
+                Query qry1 = ses.createQuery("from " + ENTITY_NAME + " where id > 2");
+
+                qry1.setCacheable(true);
+
+                assertEquals(2, qry1.list().size());
+
+                Query qry2 = ses.createQuery("from " + ENTITY_NAME + " where name = 'name-0'");
+
+                qry2.setCacheable(true);
+
+                assertEquals(1, qry2.list().size());
+
+                Query qry3 = ses.createQuery("from " + ENTITY_NAME + " where id > 1");
+
+                qry3.setCacheable(true);
+
+                assertEquals(3, qry3.list().size());
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEquals(2, sesFactory2.getStatistics().getQueryCacheHitCount());
+            assertEquals(1, sesFactory2.getStatistics().getQueryCacheMissCount());
+            assertEquals(1, sesFactory2.getStatistics().getQueryCachePutCount());
+
+            // Update entity, it should invalidate query cache.
+
+            ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                ses.save(new Entity(5, "name-5"));
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            // Run queries.
+
+            ses = sesFactory1.openSession();
+
+            sesFactory1.getStatistics().clear();
+
+            try {
+                Query qry1 = ses.createQuery("from " + ENTITY_NAME + " where id > 2");
+
+                qry1.setCacheable(true);
+
+                assertEquals(3, qry1.list().size());
+
+                Query qry2 = ses.createQuery("from " + ENTITY_NAME + " where name = 'name-0'");
+
+                qry2.setCacheable(true);
+
+                assertEquals(1, qry2.list().size());
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEquals(0, sesFactory1.getStatistics().getQueryCacheHitCount());
+            assertEquals(2, sesFactory1.getStatistics().getQueryCacheMissCount());
+            assertEquals(2, sesFactory1.getStatistics().getQueryCachePutCount());
+
+            // Clear query cache using another SessionFactory.
+
+            sesFactory2.getCache().evictDefaultQueryRegion();
+
+            ses = sesFactory1.openSession();
+
+            // Run queries again.
+
+            sesFactory1.getStatistics().clear();
+
+            try {
+                Query qry1 = ses.createQuery("from " + ENTITY_NAME + " where id > 2");
+
+                qry1.setCacheable(true);
+
+                assertEquals(3, qry1.list().size());
+
+                Query qry2 = ses.createQuery("from " + ENTITY_NAME + " where name = 'name-0'");
+
+                qry2.setCacheable(true);
+
+                assertEquals(1, qry2.list().size());
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEquals(0, sesFactory1.getStatistics().getQueryCacheHitCount());
+            assertEquals(2, sesFactory1.getStatistics().getQueryCacheMissCount());
+            assertEquals(2, sesFactory1.getStatistics().getQueryCachePutCount());
+        }
+        finally {
+            cleanup();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testRegionClear() throws Exception {
+        for (AccessType accessType : accessTypes())
+            testRegionClear(accessType);
+    }
+
+    /**
+     * @param accessType Cache access type.
+     * @throws Exception If failed.
+     */
+    private void testRegionClear(AccessType accessType) throws Exception {
+        createSessionFactories(accessType);
+
+        try {
+            final int ENTITY_CNT = 100;
+
+            Session ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                for (int i = 0; i < ENTITY_CNT; i++) {
+                    Entity e = new Entity(i, "name-" + i);
+
+                    Collection<ChildEntity> children = new ArrayList<>();
+
+                    for (int j = 0; j < 3; j++)
+                        children.add(new ChildEntity());
+
+                    e.setChildren(children);
+
+                    ses.save(e);
+                }
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            loadEntities(sesFactory2, ENTITY_CNT);
+
+            SecondLevelCacheStatistics stats1 = sesFactory1.getStatistics().getSecondLevelCacheStatistics(ENTITY_NAME);
+            SecondLevelCacheStatistics stats2 = sesFactory2.getStatistics().getSecondLevelCacheStatistics(ENTITY_NAME);
+
+            NaturalIdCacheStatistics idStats1 =
+                sesFactory1.getStatistics().getNaturalIdCacheStatistics(NATURAL_ID_REGION);
+            NaturalIdCacheStatistics idStats2 =
+                sesFactory2.getStatistics().getNaturalIdCacheStatistics(NATURAL_ID_REGION);
+
+            SecondLevelCacheStatistics colStats1 =
+                sesFactory1.getStatistics().getSecondLevelCacheStatistics(CHILD_COLLECTION_REGION);
+            SecondLevelCacheStatistics colStats2 =
+                sesFactory2.getStatistics().getSecondLevelCacheStatistics(CHILD_COLLECTION_REGION);
+
+            assertEquals(ENTITY_CNT, stats1.getElementCountInMemory());
+            assertEquals(ENTITY_CNT, stats2.getElementCountInMemory());
+
+            assertEquals(ENTITY_CNT, idStats1.getElementCountInMemory());
+            assertEquals(ENTITY_CNT, idStats2.getElementCountInMemory());
+
+            assertEquals(ENTITY_CNT, colStats1.getElementCountInMemory());
+            assertEquals(ENTITY_CNT, colStats2.getElementCountInMemory());
+
+            // Test cache is cleared after update query.
+
+            ses = sesFactory1.openSession();
+
+            try {
+                Transaction tx = ses.beginTransaction();
+
+                ses.createQuery("delete from " + ENTITY_NAME + " where name='no such name'").executeUpdate();
+
+                ses.createQuery("delete from " + ChildEntity.class.getName() + " where id=-1").executeUpdate();
+
+                tx.commit();
+            }
+            finally {
+                ses.close();
+            }
+
+            assertEquals(0, stats1.getElementCountInMemory());
+            assertEquals(0, stats2.getElementCountInMemory());
+
+            assertEquals(0, idStats1.getElementCountInMemory());
+            assertEquals(0, idStats2.getElementCountInMemory());
+
+            assertEquals(0, colStats1.getElementCountInMemory());
+            assertEquals(0, colStats2.getElementCountInMemory());
+
+            // Load some data in cache.
+
+            loadEntities(sesFactory1, 10);
+
+            assertEquals(10, stats1.getElementCountInMemory());
+            assertEquals(10, stats2.getElementCountInMemory());
+            assertEquals(10, idStats1.getElementCountInMemory());
+            assertEquals(10, idStats2.getElementCountInMemory());
+
+            // Test evictAll method.
+
+            sesFactory2.getCache().evictEntityRegion(ENTITY_NAME);
+
+            assertEquals(0, stats1.getElementCountInMemory());
+            assertEquals(0, stats2.getElementCountInMemory());
+
+            sesFactory2.getCache().evictNaturalIdRegion(ENTITY_NAME);
+
+            assertEquals(0, idStats1.getElementCountInMemory());
+            assertEquals(0, idStats2.getElementCountInMemory());
+
+            sesFactory2.getCache().evictCollectionRegion(CHILD_COLLECTION_REGION);
+
+            assertEquals(0, colStats1.getElementCountInMemory());
+            assertEquals(0, colStats2.getElementCountInMemory());
+        }
+        finally {
+            cleanup();
+        }
+    }
+
+    /**
+     * @param sesFactory Session factory.
+     * @param nameToId Name-ID mapping.
+     * @param absentNames Absent entities' names.
+     */
+    private void assertNaturalIdCache(SessionFactory sesFactory, Map<String, Integer> nameToId, String... absentNames) {
+        sesFactory.getStatistics().clear();
+
+        NaturalIdCacheStatistics stats =
+            sesFactory.getStatistics().getNaturalIdCacheStatistics(NATURAL_ID_REGION);
+
+        long hitBefore = stats.getHitCount();
+
+        long missBefore = stats.getMissCount();
+
+        final Session ses = sesFactory.openSession();
+
+        try {
+            for (Map.Entry<String, Integer> e : nameToId.entrySet())
+                assertEquals((int)e.getValue(), ((Entity)ses.bySimpleNaturalId(Entity.class).load(e.getKey())).getId());
+
+            for (String name : absentNames)
+                assertNull((ses.bySimpleNaturalId(Entity.class).load(name)));
+
+            assertEquals(nameToId.size() + hitBefore, stats.getHitCount());
+
+            assertEquals(absentNames.length + missBefore, stats.getMissCount());
+        }
+        finally {
+            ses.close();
+        }
+    }
+
+    /**
+     * @param sesFactory Session factory.
+     * @param idToChildCnt Number of children per entity.
+     * @param expHit Expected cache hits.
+     * @param expMiss Expected cache misses.
+     */
+    @SuppressWarnings("unchecked")
+    private void assertCollectionCache(SessionFactory sesFactory, Map<Integer, Integer> idToChildCnt, int expHit,
+        int expMiss) {
+        sesFactory.getStatistics().clear();
+
+        Session ses = sesFactory.openSession();
+
+        try {
+            for(Map.Entry<Integer, Integer> e : idToChildCnt.entrySet()) {
+                Entity entity = (Entity)ses.load(Entity.class, e.getKey());
+
+                assertEquals((int)e.getValue(), entity.getChildren().size());
+            }
+        }
+        finally {
+            ses.close();
+        }
+
+        SecondLevelCacheStatistics stats =
+            sesFactory.getStatistics().getSecondLevelCacheStatistics(CHILD_COLLECTION_REGION);
+
+        assertEquals(expHit, stats.getHitCount());
+
+        assertEquals(expMiss, stats.getMissCount());
+    }
+
+    /**
+     * @param sesFactory Session factory.
+     * @param cnt Number of entities to load.
+     */
+    private void loadEntities(SessionFactory sesFactory, int cnt) {
+        Session ses = sesFactory.openSession();
+
+        try {
+            for (int i = 0; i < cnt; i++) {
+                Entity e = (Entity)ses.load(Entity.class, i);
+
+                assertEquals("name-" + i, e.getName());
+
+                assertFalse(e.getChildren().isEmpty());
+
+                ses.bySimpleNaturalId(Entity.class).load(e.getName());
+            }
+        }
+        finally {
+            ses.close();
+        }
+    }
+
+    /**
+     * @param entityName Entity name.
+     * @param sesFactory Session factory.
+     * @param idToName ID to name mapping.
+     * @param absentIds Absent entities' IDs.
+     */
+    private void assertEntityCache(String entityName, SessionFactory sesFactory, Map<Integer, String> idToName,
+        Integer... absentIds) {
+        assert entityName.equals(ENTITY_NAME) || entityName.equals(ENTITY2_NAME) : entityName;
+
+        sesFactory.getStatistics().clear();
+
+        final Session ses = sesFactory.openSession();
+
+        final boolean entity1 = entityName.equals(ENTITY_NAME);
+
+        try {
+            if (entity1) {
+                for (Map.Entry<Integer, String> e : idToName.entrySet())
+                    assertEquals(e.getValue(), ((Entity)ses.load(Entity.class, e.getKey())).getName());
+            }
+            else {
+                for (Map.Entry<Integer, String> e : idToName.entrySet())
+                    assertEquals(e.getValue(), ((Entity2)ses.load(Entity2.class, e.getKey())).getName());
+            }
+
+            for (final int id : absentIds) {
+                GridTestUtils.assertThrows(log, new Callable<Void>() {
+                    @Override public Void call() throws Exception {
+                        if (entity1)
+                            ((Entity)ses.load(Entity.class, id)).getName();
+                        else
+                            ((Entity2)ses.load(Entity2.class, id)).getName();
+
+                        return null;
+                    }
+                }, ObjectNotFoundException.class, null);
+            }
+
+            SecondLevelCacheStatistics stats = sesFactory.getStatistics().getSecondLevelCacheStatistics(entityName);
+
+            assertEquals(idToName.size(), stats.getHitCount());
+
+            assertEquals(absentIds.length, stats.getMissCount());
+        }
+        finally {
+            ses.close();
+        }
+    }
+
+    /**
+     * Creates session factories.
+     *
+     * @param accessType Cache access type.
+     */
+    private void createSessionFactories(AccessType accessType) {
+        sesFactory1 = startHibernate(accessType, getTestIgniteInstanceName(0));
+
+        sesFactory2 = startHibernate(accessType, getTestIgniteInstanceName(1));
+    }
+
+    /**
+     * Starts Hibernate.
+     *
+     * @param accessType Cache access type.
+     * @param igniteInstanceName Ignite instance name.
+     * @return Session factory.
+     */
+    private SessionFactory startHibernate(AccessType accessType, String igniteInstanceName) {
+        Configuration cfg = hibernateConfiguration(accessType, igniteInstanceName);
+
+        ServiceRegistryBuilder builder = registryBuilder();
+
+        builder.applySetting("hibernate.show_sql", false);
+
+        return cfg.buildSessionFactory(builder.buildServiceRegistry());
+    }
+
+    /**
+     * Closes session factories and clears data from caches.
+     *
+     * @throws Exception If failed.
+     */
+    private void cleanup() throws Exception {
+        if (sesFactory1 != null)
+            sesFactory1.close();
+
+        sesFactory1 = null;
+
+        if (sesFactory2 != null)
+            sesFactory2.close();
+
+        sesFactory2 = null;
+
+        for (IgniteCacheProxy<?, ?> cache : ((IgniteKernal)grid(0)).caches())
+            cache.clear();
+    }
+
+    /**
+     * @param igniteInstanceName Node name.
+     * @param dfltAccessType Default cache access type.
+     * @return Properties map.
+     */
+    static Map<String, String> hibernateProperties(String igniteInstanceName, String dfltAccessType) {
+        Map<String, String> map = new HashMap<>();
+
+        map.put(HBM2DDL_AUTO, "create");
+        map.put(GENERATE_STATISTICS, "true");
+        map.put(USE_SECOND_LEVEL_CACHE, "true");
+        map.put(USE_QUERY_CACHE, "true");
+        map.put(CACHE_REGION_FACTORY, HibernateRegionFactory.class.getName());
+        map.put(RELEASE_CONNECTIONS, "on_close");
+        map.put(IGNITE_INSTANCE_NAME_PROPERTY, igniteInstanceName);
+        map.put(DFLT_ACCESS_TYPE_PROPERTY, dfltAccessType);
+
+        return map;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java
new file mode 100644
index 0000000..deca893
--- /dev/null
+++ b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalSelfTest.java
@@ -0,0 +1,154 @@
+/*
+ * 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.cache.hibernate;
+
+import java.util.Collections;
+import javax.cache.configuration.Factory;
+import javax.transaction.Synchronization;
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+import org.apache.commons.dbcp.managed.BasicManagedDataSource;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.h2.jdbcx.JdbcDataSource;
+import org.hibernate.cache.spi.access.AccessType;
+import org.hibernate.engine.transaction.internal.jta.JtaTransactionFactory;
+import org.hibernate.engine.transaction.spi.TransactionFactory;
+import org.hibernate.service.ServiceRegistryBuilder;
+import org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl;
+import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
+import org.hibernate.service.jta.platform.internal.AbstractJtaPlatform;
+import org.hibernate.service.jta.platform.spi.JtaPlatform;
+import org.jetbrains.annotations.Nullable;
+import org.objectweb.jotm.Jotm;
+
+/**
+ *
+ * Tests Hibernate L2 cache with TRANSACTIONAL access mode (Hibernate and Cache are configured
+ * to used the same TransactionManager).
+ */
+public class HibernateL2CacheTransactionalSelfTest extends HibernateL2CacheSelfTest {
+    /** */
+    private static Jotm jotm;
+
+    /**
+     */
+    private static class TestJtaPlatform extends AbstractJtaPlatform {
+        /** {@inheritDoc} */
+        @Override protected TransactionManager locateTransactionManager() {
+            return jotm.getTransactionManager();
+        }
+
+        /** {@inheritDoc} */
+        @Override protected UserTransaction locateUserTransaction() {
+            return jotm.getUserTransaction();
+        }
+    }
+
+    /**
+     */
+    @SuppressWarnings("PublicInnerClass")
+    public static class TestTmFactory implements Factory<TransactionManager> {
+        /** */
+        private static final long serialVersionUID = 0;
+
+        /** {@inheritDoc} */
+        @Override public TransactionManager create() {
+            return jotm.getTransactionManager();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        jotm = new Jotm(true, false);
+
+        super.beforeTestsStarted();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        if (jotm != null)
+            jotm.stop();
+
+        jotm = null;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        cfg.getTransactionConfiguration().setTxManagerFactory(new TestTmFactory());
+        cfg.getTransactionConfiguration().setUseJtaSynchronization(useJtaSynchronization());
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheConfiguration transactionalRegionConfiguration(String regionName) {
+        CacheConfiguration cfg = super.transactionalRegionConfiguration(regionName);
+
+        cfg.setNearConfiguration(null);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override protected ServiceRegistryBuilder registryBuilder() {
+        ServiceRegistryBuilder builder = new ServiceRegistryBuilder();
+
+        DatasourceConnectionProviderImpl connProvider = new DatasourceConnectionProviderImpl();
+
+        BasicManagedDataSource dataSrc = new BasicManagedDataSource(); // JTA-aware data source.
+
+        dataSrc.setTransactionManager(jotm.getTransactionManager());
+
+        dataSrc.setDefaultAutoCommit(false);
+
+        JdbcDataSource h2DataSrc = new JdbcDataSource();
+
+        h2DataSrc.setURL(CONNECTION_URL);
+
+        dataSrc.setXaDataSourceInstance(h2DataSrc);
+
+        connProvider.setDataSource(dataSrc);
+
+        connProvider.configure(Collections.emptyMap());
+
+        builder.addService(ConnectionProvider.class, connProvider);
+
+        builder.addService(JtaPlatform.class, new TestJtaPlatform());
+
+        builder.addService(TransactionFactory.class, new JtaTransactionFactory());
+
+        return builder;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected AccessType[] accessTypes() {
+        return new AccessType[]{AccessType.TRANSACTIONAL};
+    }
+
+    /**
+     * @return Whether to use {@link Synchronization}.
+     */
+    protected boolean useJtaSynchronization() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.java b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.java
new file mode 100644
index 0000000..44899f9
--- /dev/null
+++ b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/hibernate/HibernateL2CacheTransactionalUseSyncSelfTest.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.cache.hibernate;
+
+import javax.transaction.Synchronization;
+
+/**
+ * Tests Hibernate L2 cache with TRANSACTIONAL access mode and {@link Synchronization}
+ * instead of XA resource.
+ */
+public class HibernateL2CacheTransactionalUseSyncSelfTest extends HibernateL2CacheTransactionalSelfTest {
+    /** {@inheritDoc} */
+    @Override protected boolean useJtaSynchronization() {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
new file mode 100644
index 0000000..d5496af
--- /dev/null
+++ b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreNodeRestartTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.cache.store.hibernate;
+
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.internal.processors.cache.integration.IgniteCacheStoreNodeRestartAbstractTest;
+
+public class CacheHibernateBlobStoreNodeRestartTest extends IgniteCacheStoreNodeRestartAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected CacheStore getStore() {
+        return new CacheHibernateBlobStore();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.PARTITIONED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return CacheAtomicityMode.ATOMIC;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected NearCacheConfiguration nearConfiguration() {
+        return null;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreSelfTest.java b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreSelfTest.java
new file mode 100644
index 0000000..77025a1
--- /dev/null
+++ b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateBlobStoreSelfTest.java
@@ -0,0 +1,113 @@
+/*
+ * 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.cache.store.hibernate;
+
+import java.io.File;
+import java.net.URL;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.cache.GridAbstractCacheStoreSelfTest;
+import org.hibernate.FlushMode;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+
+/**
+ * Cache store test.
+ */
+public class CacheHibernateBlobStoreSelfTest extends
+    GridAbstractCacheStoreSelfTest<CacheHibernateBlobStore<Object, Object>> {
+    /**
+     * @throws Exception If failed.
+     */
+    public CacheHibernateBlobStoreSelfTest() throws Exception {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        Session s = store.session(null);
+
+        if (s == null)
+            return;
+
+        try {
+            s.createQuery("delete from " + CacheHibernateBlobStoreEntry.class.getSimpleName())
+                    .setFlushMode(FlushMode.ALWAYS).executeUpdate();
+
+            Transaction hTx = s.getTransaction();
+
+            if (hTx != null && hTx.isActive())
+                hTx.commit();
+        }
+        finally {
+            s.close();
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheHibernateBlobStore<Object, Object> store() {
+        return new CacheHibernateBlobStore<>();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testConfigurationByUrl() throws Exception {
+        URL url = U.resolveIgniteUrl(CacheHibernateStoreFactorySelfTest.MODULE_PATH +
+            "/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
+
+        assert url != null;
+
+        store.setHibernateConfigurationPath(url.toString());
+
+        // Store will be implicitly initialized.
+        store.load("key");
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testConfigurationByFile() throws Exception {
+        URL url = U.resolveIgniteUrl(CacheHibernateStoreFactorySelfTest.MODULE_PATH +
+                "/src/test/java/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
+
+        assert url != null;
+
+        File file = new File(url.toURI());
+
+        store.setHibernateConfigurationPath(file.getAbsolutePath());
+
+        // Store will be implicitly initialized.
+        store.load("key");
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testConfigurationByResource() throws Exception {
+        store.setHibernateConfigurationPath("/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
+
+        // Store will be implicitly initialized.
+        store.load("key");
+    }
+
+    @Override public void testSimpleMultithreading() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-1757");
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
new file mode 100644
index 0000000..f6c8a2d
--- /dev/null
+++ b/modules/hibernate-4.2/src/test/java/org/apache/ignite/cache/store/hibernate/CacheHibernateStoreFactorySelfTest.java
@@ -0,0 +1,288 @@
+/*
+ * 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.cache.store.hibernate;
+
+import java.io.Serializable;
+import java.sql.Connection;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.hibernate.Cache;
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+import org.hibernate.SessionBuilder;
+import org.hibernate.SessionFactory;
+import org.hibernate.StatelessSession;
+import org.hibernate.StatelessSessionBuilder;
+import org.hibernate.TypeHelper;
+import org.hibernate.engine.spi.FilterDefinition;
+import org.hibernate.metadata.ClassMetadata;
+import org.hibernate.metadata.CollectionMetadata;
+import org.hibernate.stat.Statistics;
+
+/**
+ * Test for Cache jdbc blob store factory.
+ */
+public class CacheHibernateStoreFactorySelfTest extends GridCommonAbstractTest {
+    /** Cache name. */
+    private static final String CACHE_NAME = "test";
+
+    /** */
+    static final String MODULE_PATH = "modules/hibernate-4.2/";
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCacheConfiguration() throws Exception {
+        try (Ignite ignite1 = startGrid(0)) {
+            IgniteCache<Integer, String> cache1 = ignite1.getOrCreateCache(cacheConfiguration());
+
+            checkStore(cache1);
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testXmlConfiguration() throws Exception {
+        try (Ignite ignite = Ignition.start(MODULE_PATH + "/src/test/config/factory-cache.xml")) {
+            try(Ignite ignite1 = Ignition.start(MODULE_PATH + "/src/test/config/factory-cache1.xml")) {
+                checkStore(ignite.<Integer, String>cache(CACHE_NAME), DummySessionFactoryExt.class);
+
+                checkStore(ignite1.<Integer, String>cache(CACHE_NAME), DummySessionFactory.class);
+            }
+        }
+    }
+
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testIncorrectBeanConfiguration() throws Exception {
+        GridTestUtils.assertThrows(log, new Callable<Object>() {
+            @Override public Object call() throws Exception {
+                try(Ignite ignite =
+                    Ignition.start(MODULE_PATH + "/src/test/config/factory-incorrect-store-cache.xml")) {
+                    ignite.cache(CACHE_NAME).getConfiguration(CacheConfiguration.class).
+                            getCacheStoreFactory().create();
+                }
+                return null;
+            }
+        }, IgniteException.class, "Failed to load bean in application context");
+    }
+
+    /**
+     * @return Cache configuration with store.
+     */
+    private CacheConfiguration<Integer, String> cacheConfiguration() {
+        CacheConfiguration<Integer, String> cfg = new CacheConfiguration<>();
+
+        CacheHibernateBlobStoreFactory<Integer, String> factory = new CacheHibernateBlobStoreFactory();
+
+        factory.setHibernateConfigurationPath("/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml");
+
+        cfg.setCacheStoreFactory(factory);
+
+        return cfg;
+    }
+
+    /**
+     * @param cache Ignite cache.
+     * @param dataSrcClass Data source class.
+     * @throws Exception If store parameters is not the same as in configuration xml.
+     */
+    private void checkStore(IgniteCache<Integer, String> cache, Class<?> dataSrcClass) throws Exception {
+        CacheHibernateBlobStore store = (CacheHibernateBlobStore)cache
+            .getConfiguration(CacheConfiguration.class).getCacheStoreFactory().create();
+
+        assertEquals(dataSrcClass,
+            GridTestUtils.getFieldValue(store, CacheHibernateBlobStore.class, "sesFactory").getClass());
+    }
+
+    /**
+     * @param cache Ignite cache.
+     * @throws Exception If store parameters is not the same as in configuration xml.
+     */
+    private void checkStore(IgniteCache<Integer, String> cache) throws Exception {
+        CacheHibernateBlobStore store = (CacheHibernateBlobStore)cache.getConfiguration(CacheConfiguration.class)
+            .getCacheStoreFactory().create();
+
+        assertEquals("/org/apache/ignite/cache/store/hibernate/hibernate.cfg.xml",
+            GridTestUtils.getFieldValue(store, CacheHibernateBlobStore.class, "hibernateCfgPath"));
+    }
+
+    /**
+     *
+     */
+    public static class DummySessionFactoryExt extends DummySessionFactory {
+        /** */
+        public DummySessionFactoryExt() {
+            // No-op.
+        }
+    }
+
+    /**
+     *
+     */
+    public static class DummySessionFactory implements SessionFactory {
+        /** {@inheritDoc} */
+        @Override public SessionFactoryOptions getSessionFactoryOptions() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public SessionBuilder withOptions() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Session openSession() throws HibernateException {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Session getCurrentSession() throws HibernateException {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public StatelessSessionBuilder withStatelessOptions() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public StatelessSession openStatelessSession() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public StatelessSession openStatelessSession(Connection conn) {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public ClassMetadata getClassMetadata(Class entityCls) {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public ClassMetadata getClassMetadata(String entityName) {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public CollectionMetadata getCollectionMetadata(String roleName) {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Map<String, ClassMetadata> getAllClassMetadata() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Map getAllCollectionMetadata() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Statistics getStatistics() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void close() throws HibernateException {
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean isClosed() {
+            return false;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Cache getCache() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void evict(Class persistentCls) throws HibernateException {
+        }
+
+        /** {@inheritDoc} */
+        @Override public void evict(Class persistentCls, Serializable id) throws HibernateException {
+        }
+
+        /** {@inheritDoc} */
+        @Override public void evictEntity(String entityName) throws HibernateException {
+        }
+
+        /** {@inheritDoc} */
+        @Override public void evictEntity(String entityName, Serializable id) throws HibernateException {
+        }
+
+        /** {@inheritDoc} */
+        @Override public void evictCollection(String roleName) throws HibernateException {
+        }
+
+        /** {@inheritDoc} */
+        @Override public void evictCollection(String roleName, Serializable id) throws HibernateException {
+        }
+
+        /** {@inheritDoc} */
+        @Override public void evictQueries(String cacheRegion) throws HibernateException {
+        }
+
+        /** {@inheritDoc} */
+        @Override public void evictQueries() throws HibernateException {
+        }
+
+        /** {@inheritDoc} */
+        @Override public Set getDefinedFilterNames() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public FilterDefinition getFilterDefinition(String filterName) throws HibernateException {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean containsFetchProfileDefinition(String name) {
+            return false;
+        }
+
+        /** {@inheritDoc} */
+        @Override public TypeHelper getTypeHelper() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Reference getReference() throws NamingException {
+            return null;
+        }
+    }
+}
\ No newline at end of file


[48/51] [abbrv] ignite git commit: ignite-5041 NPE in deadlock detection fixed

Posted by sb...@apache.org.
ignite-5041 NPE in deadlock detection fixed


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

Branch: refs/heads/ignite-5075-cacheStart
Commit: 746f8ebc2e56720b50873af1b4ee2a320ca58793
Parents: 8f9edeb
Author: agura <ag...@apache.org>
Authored: Thu Apr 20 20:45:58 2017 +0300
Committer: agura <ag...@apache.org>
Committed: Wed Apr 26 18:48:39 2017 +0300

----------------------------------------------------------------------
 .../cache/DynamicCacheDescriptor.java           |  24 ++
 .../cache/GridCacheSharedContext.java           |  18 +-
 .../cache/transactions/IgniteTxManager.java     |  20 +-
 .../cache/transactions/TxDeadlock.java          |  19 +-
 .../cache/transactions/TxLocksResponse.java     |  37 +--
 ...DeadlockDetectionMessageMarshallingTest.java | 116 ++++++++++
 .../TxDeadlockDetectionUnmasrhalErrorsTest.java | 225 +++++++++++++++++++
 .../TxDeadlockDetectionTestSuite.java           |   4 +
 8 files changed, 435 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/746f8ebc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
index 92a7af3..09b4c3a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
@@ -20,9 +20,11 @@ package org.apache.ignite.internal.processors.cache;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
+import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.GridKernalContext;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessor;
 import org.apache.ignite.internal.processors.plugin.CachePluginManager;
 import org.apache.ignite.internal.processors.query.QuerySchema;
 import org.apache.ignite.internal.processors.query.schema.message.SchemaFinishDiscoveryMessage;
@@ -83,6 +85,12 @@ public class DynamicCacheDescriptor {
     /** */
     private AffinityTopologyVersion rcvdFromVer;
 
+    /** Mutex. */
+    private final Object mux = new Object();
+
+    /** Cached object context for marshalling issues when cache isn't started. */
+    private volatile CacheObjectContext objCtx;
+
     /** */
     private transient AffinityTopologyVersion clientCacheStartVer;
 
@@ -228,6 +236,22 @@ public class DynamicCacheDescriptor {
     }
 
     /**
+     * Creates and caches cache object context if needed.
+     *
+     * @param proc Object processor.
+     */
+    public CacheObjectContext cacheObjectContext(IgniteCacheObjectProcessor proc) throws IgniteCheckedException {
+        if (objCtx == null) {
+            synchronized (mux) {
+                if (objCtx == null)
+                    objCtx = proc.contextForCache(cacheCfg);
+            }
+        }
+
+        return objCtx;
+    }
+
+    /**
      * @return Cache plugin manager.
      */
     public CachePluginManager pluginManager() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/746f8ebc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
index 79083e0..55f3c42 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
@@ -22,8 +22,6 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
 import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicIntegerArray;
 import org.apache.ignite.IgniteCheckedException;
@@ -448,6 +446,22 @@ public class GridCacheSharedContext<K, V> {
     }
 
     /**
+     * Returns cache object context if created or creates new and caches it until cache started.
+     *
+     * @param cacheId Cache id.
+     */
+    public @Nullable CacheObjectContext cacheObjectContext(int cacheId) throws IgniteCheckedException {
+        GridCacheContext<K, V> ctx = ctxMap.get(cacheId);
+
+        if (ctx != null)
+            return ctx.cacheObjectContext();
+
+        DynamicCacheDescriptor desc = cache().cacheDescriptor(cacheId);
+
+        return desc != null ? desc.cacheObjectContext(kernalContext().cacheObjects()) : null;
+    }
+
+    /**
      * @return Ignite instance name.
      */
     public String igniteInstanceName() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/746f8ebc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
index 2da8dee..db0395f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
@@ -2409,11 +2409,18 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
         @Override public void onMessage(UUID nodeId, Object msg) {
             GridCacheMessage cacheMsg = (GridCacheMessage)msg;
 
-            unmarshall(nodeId, cacheMsg);
+            Throwable err = null;
 
-            if (cacheMsg.classError() != null) {
+            try {
+                unmarshall(nodeId, cacheMsg);
+            }
+            catch (Exception e) {
+                err = e;
+            }
+
+            if (err != null || cacheMsg.classError() != null) {
                 try {
-                    processFailedMessage(nodeId, cacheMsg);
+                    processFailedMessage(nodeId, cacheMsg, err);
                 }
                 catch(Throwable e){
                     U.error(log, "Failed to process message [senderId=" + nodeId +
@@ -2466,7 +2473,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
          * @param nodeId Node ID.
          * @param msg Message.
          */
-        private void processFailedMessage(UUID nodeId, GridCacheMessage msg) throws IgniteCheckedException {
+        private void processFailedMessage(UUID nodeId, GridCacheMessage msg, Throwable err) throws IgniteCheckedException {
             switch (msg.directType()) {
                 case -24: {
                     TxLocksRequest req = (TxLocksRequest)msg;
@@ -2498,7 +2505,10 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
                         return;
                     }
 
-                    fut.onResult(nodeId, res);
+                    if (err == null)
+                        fut.onResult(nodeId, res);
+                    else
+                        fut.onDone(null, err);
                 }
 
                 break;

http://git-wip-us.apache.org/repos/asf/ignite/blob/746f8ebc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlock.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlock.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlock.java
index f8130e1..97db698 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlock.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlock.java
@@ -21,11 +21,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.CacheObjectContext;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.typedef.T2;
-import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.U;
 
 /**
@@ -133,11 +132,21 @@ public class TxDeadlock {
         for (Map.Entry<IgniteTxKey, String> e : keyLabels.entrySet()) {
             IgniteTxKey txKey = e.getKey();
 
-            GridCacheContext cctx = ctx.cacheContext(txKey.cacheId());
+            try {
+                CacheObjectContext objCtx = ctx.cacheObjectContext(txKey.cacheId());
 
-            Object val = CU.value(txKey.key(), cctx, true);
+                Object val = txKey.key().value(objCtx, true);
 
-            sb.append(e.getValue()).append(" [key=").append(val).append(", cache=").append(cctx.namexx()).append("]\n");
+                sb.append(e.getValue())
+                    .append(" [key=")
+                    .append(val)
+                    .append(", cache=")
+                    .append(objCtx.cacheName())
+                    .append("]\n");
+            }
+            catch (Exception ex) {
+                sb.append("Unable to unmarshall deadlock information for key [key=").append(e.getValue()).append("]\n");
+            }
         }
 
         return sb.toString();

http://git-wip-us.apache.org/repos/asf/ignite/blob/746f8ebc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksResponse.java
index b7ca832..7856eaa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/TxLocksResponse.java
@@ -181,31 +181,36 @@ public class TxLocksResponse extends GridCacheMessage {
 
     /** {@inheritDoc} */
     @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
-        super.finishUnmarshal(ctx, ldr);
+        try {
+            super.finishUnmarshal(ctx, ldr);
 
-        if (nearTxKeysArr != null) {
-            for (int i = 0; i < nearTxKeysArr.length; i++) {
-                IgniteTxKey key = nearTxKeysArr[i];
+            if (nearTxKeysArr != null) {
+                for (int i = 0; i < nearTxKeysArr.length; i++) {
+                    IgniteTxKey txKey = nearTxKeysArr[i];
 
-                key.finishUnmarshal(ctx.cacheContext(key.cacheId()), ldr);
+                    txKey.key().finishUnmarshal(ctx.cacheObjectContext(txKey.cacheId()), ldr);
 
-                txLocks().put(key, locksArr[i]);
+                    txLocks().put(txKey, locksArr[i]);
+                }
+
+                nearTxKeysArr = null;
+                locksArr = null;
             }
 
-            nearTxKeysArr = null;
-            locksArr = null;
-        }
+            if (txKeysArr != null) {
+                txKeys = U.newHashSet(txKeysArr.length);
 
-        if (txKeysArr != null) {
-            txKeys = U.newHashSet(txKeysArr.length);
+                for (IgniteTxKey txKey : txKeysArr) {
+                    txKey.key().finishUnmarshal(ctx.cacheObjectContext(txKey.cacheId()), ldr);
 
-            for (IgniteTxKey key : txKeysArr) {
-                key.finishUnmarshal(ctx.cacheContext(key.cacheId()), ldr);
+                    txKeys.add(txKey);
+                }
 
-                txKeys.add(key);
+                txKeysArr = null;
             }
-
-            txKeysArr = null;
+        }
+        catch (Exception e) {
+            throw new IgniteCheckedException(e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/746f8ebc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetectionMessageMarshallingTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetectionMessageMarshallingTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetectionMessageMarshallingTest.java
new file mode 100644
index 0000000..dd7c3b3
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetectionMessageMarshallingTest.java
@@ -0,0 +1,116 @@
+/*
+ * 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.transactions;
+
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.managers.communication.GridIoPolicy;
+import org.apache.ignite.internal.managers.communication.GridMessageListener;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.IgniteCacheProxy;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class TxDeadlockDetectionMessageMarshallingTest extends GridCommonAbstractTest {
+    /** Topic. */
+    private static final String TOPIC = "mytopic";
+
+    /** Client mode. */
+    private static boolean clientMode;
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        cfg.setClientMode(clientMode);
+
+        return cfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testMessageUnmarshallWithoutCacheContext() throws Exception {
+        try {
+            Ignite ignite = startGrid(0);
+
+            CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+
+            IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(ccfg);
+
+            clientMode = true;
+
+            Ignite client = startGrid(1);
+
+            final GridCacheSharedContext<Object, Object> clientCtx = ((IgniteKernal)client).context().cache().context();
+
+            final CountDownLatch latch = new CountDownLatch(1);
+
+            final AtomicBoolean res = new AtomicBoolean();
+
+            clientCtx.gridIO().addMessageListener(TOPIC, new GridMessageListener() {
+                @Override public void onMessage(UUID nodeId, Object msg) {
+                    if (msg instanceof TxLocksResponse) {
+                        try {
+                            ((TxLocksResponse)msg).finishUnmarshal(clientCtx, clientCtx.deploy().globalLoader());
+
+                            res.set(true);
+                        }
+                        catch (Exception e) {
+                            log.error("Message unmarshal failed", e);
+                        }
+                        finally {
+                            latch.countDown();
+                        }
+                    }
+                }
+            });
+
+            GridCacheContext cctx = ((IgniteCacheProxy)cache).context();
+
+            KeyCacheObject key = cctx.toCacheKeyObject(1);
+
+            TxLocksResponse msg = new TxLocksResponse();
+            msg.addKey(cctx.txKey(key));
+
+            msg.prepareMarshal(cctx.shared());
+
+            ((IgniteKernal)ignite).context().cache().context().gridIO().sendToCustomTopic(
+                ((IgniteKernal)client).localNode(), TOPIC, msg, GridIoPolicy.PUBLIC_POOL);
+
+            boolean await = latch.await(1, TimeUnit.SECONDS);
+
+            assertTrue(await && res.get());
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/746f8ebc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetectionUnmasrhalErrorsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetectionUnmasrhalErrorsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetectionUnmasrhalErrorsTest.java
new file mode 100644
index 0000000..598725e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxDeadlockDetectionUnmasrhalErrorsTest.java
@@ -0,0 +1,225 @@
+/*
+ * 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.transactions;
+
+import java.util.Collection;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.cache.CacheException;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionDeadlockException;
+import org.apache.ignite.transactions.TransactionTimeoutException;
+
+import static org.apache.ignite.internal.util.typedef.X.hasCause;
+import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
+import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
+import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
+
+/**
+ *
+ */
+public class TxDeadlockDetectionUnmasrhalErrorsTest extends GridCommonAbstractTest {
+    /** Nodes count. */
+    private static final int NODES_CNT = 2;
+
+    /** Client. */
+    private static boolean client;
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        cfg.setClientMode(client);
+
+        if (isDebug()) {
+            TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+            discoSpi.failureDetectionTimeoutEnabled(false);
+
+            cfg.setDiscoverySpi(discoSpi);
+        }
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
+        startGrid(0);
+
+        client = true;
+
+        startGrid(1);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        super.afterTestsStopped();
+
+        stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDeadlockCacheObjectContext() throws Exception {
+        IgniteCache<Integer, Integer> cache0 = null;
+        IgniteCache<Integer, Integer> cache1 = null;
+        try {
+            cache0 = getCache(ignite(0), "cache0");
+            cache1 = getCache(ignite(0), "cache1");
+
+            IgniteCache<Integer, Integer> clientCache0 = grid(1).cache("cache0");
+
+            awaitPartitionMapExchange();
+
+            final CyclicBarrier barrier = new CyclicBarrier(2);
+
+            final CountDownLatch latch = new CountDownLatch(1);
+
+            final AtomicInteger threadCnt = new AtomicInteger();
+
+            final AtomicBoolean deadlock = new AtomicBoolean();
+
+            IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Runnable() {
+                @Override public void run() {
+                    int threadNum = threadCnt.getAndIncrement();
+
+                    Ignite ignite = ignite(0);
+
+                    IgniteCache<Integer, Integer> cache1 = ignite.cache("cache" + (threadNum == 0 ? 0 : 1));
+
+                    IgniteCache<Integer, Integer> cache2 = ignite.cache("cache" + (threadNum == 0 ? 1 : 0));
+
+                    try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ, 1000, 0)) {
+                        int key1 = threadNum == 0 ? 0 : 1;
+
+                        log.info(">>> Performs put [node=" + ((IgniteKernal)ignite).localNode() +
+                            ", tx=" + tx + ", key=" + key1 + ", cache=" + cache1.getName() + ']');
+
+                        cache1.put(key1, 0);
+
+                        barrier.await();
+
+                        int key2 = threadNum == 0 ? 1 : 0;
+
+                        log.info(">>> Performs put [node=" + ((IgniteKernal)ignite).localNode() +
+                            ", tx=" + tx + ", key=" + key2 + ", cache=" + cache2.getName() + ']');
+
+                        latch.countDown();
+
+                        cache2.put(key2, 1);
+
+                        tx.commit();
+
+                        log.info(">>> Commit done");
+                    }
+                    catch (Throwable e) {
+                        // At least one stack trace should contain TransactionDeadlockException.
+                        if (hasCause(e, TransactionTimeoutException.class) &&
+                            hasCause(e, TransactionDeadlockException.class)
+                            ) {
+                            if (deadlock.compareAndSet(false, true))
+                                U.error(log, "At least one stack trace should contain " +
+                                    TransactionDeadlockException.class.getSimpleName(), e);
+                        }
+                    }
+                }
+            }, 2, "tx-thread");
+
+            latch.await();
+
+            Ignite client = grid(1);
+
+            try (Transaction tx = client.transactions().txStart(PESSIMISTIC, READ_COMMITTED, 500, 0)) {
+                clientCache0.put(0, 3);
+                clientCache0.put(1, 3);
+
+                tx.commit();
+
+                log.info(">>> Commit done");
+            }
+            catch (CacheException e) {
+                assertTrue(X.hasCause(e, TransactionTimeoutException.class));
+            }
+            catch (Throwable e) {
+                log.error("Unexpected exception occurred", e);
+
+                fail();
+            }
+
+            fut.get();
+
+            assertTrue(deadlock.get());
+
+            for (int i = 0; i < NODES_CNT ; i++) {
+                Ignite ignite = ignite(i);
+
+                IgniteTxManager txMgr = ((IgniteKernal)ignite).context().cache().context().tm();
+
+                Collection<IgniteInternalFuture<?>> futs = txMgr.deadlockDetectionFutures();
+
+                assertTrue(futs.isEmpty());
+            }
+
+            //assertNotNull(grid(1).context().cache().context().cacheContext(cacheId));
+        }
+        finally {
+            if (cache0 != null)
+                cache0.destroy();
+
+            if (cache1 != null)
+                cache1.destroy();
+        }
+    }
+
+
+
+    /**
+     * @param ignite Ignite.
+     * @param name Name.
+     */
+    private IgniteCache<Integer, Integer> getCache(Ignite ignite, String name) {
+        CacheConfiguration ccfg = defaultCacheConfiguration();
+
+        ccfg.setName(name);
+        ccfg.setCacheMode(CacheMode.PARTITIONED);
+        ccfg.setBackups(0);
+        ccfg.setNearConfiguration(null);
+
+        return ignite.getOrCreateCache(ccfg);
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/746f8ebc/modules/core/src/test/java/org/apache/ignite/testsuites/TxDeadlockDetectionTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/TxDeadlockDetectionTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/TxDeadlockDetectionTestSuite.java
index 5a1b1ad..337d4d4 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/TxDeadlockDetectionTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/TxDeadlockDetectionTestSuite.java
@@ -19,8 +19,10 @@ package org.apache.ignite.testsuites;
 
 import junit.framework.TestSuite;
 import org.apache.ignite.internal.processors.cache.transactions.DepthFirstSearchTest;
+import org.apache.ignite.internal.processors.cache.transactions.TxDeadlockDetectionMessageMarshallingTest;
 import org.apache.ignite.internal.processors.cache.transactions.TxDeadlockDetectionNoHangsTest;
 import org.apache.ignite.internal.processors.cache.transactions.TxDeadlockDetectionTest;
+import org.apache.ignite.internal.processors.cache.transactions.TxDeadlockDetectionUnmasrhalErrorsTest;
 import org.apache.ignite.internal.processors.cache.transactions.TxOptimisticDeadlockDetectionCrossCacheTest;
 import org.apache.ignite.internal.processors.cache.transactions.TxOptimisticDeadlockDetectionTest;
 import org.apache.ignite.internal.processors.cache.transactions.TxPessimisticDeadlockDetectionCrossCacheTest;
@@ -44,6 +46,8 @@ public class TxDeadlockDetectionTestSuite extends TestSuite {
         suite.addTestSuite(TxPessimisticDeadlockDetectionCrossCacheTest.class);
         suite.addTestSuite(TxDeadlockDetectionTest.class);
         suite.addTestSuite(TxDeadlockDetectionNoHangsTest.class);
+        suite.addTestSuite(TxDeadlockDetectionUnmasrhalErrorsTest.class);
+        suite.addTestSuite(TxDeadlockDetectionMessageMarshallingTest.class);
 
         return suite;
     }


[08/51] [abbrv] ignite git commit: ignite-1794 Refactored hibernate modules, switched to hibernate 5.1

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateEntityRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateEntityRegion.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateEntityRegion.java
deleted file mode 100644
index ad5b191..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateEntityRegion.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.Ignite;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.CacheDataDescription;
-import org.hibernate.cache.spi.EntityRegion;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cache.spi.access.EntityRegionAccessStrategy;
-import org.hibernate.cache.spi.access.SoftLock;
-
-/**
- * Implementation of {@link EntityRegion}. This region is used to store entity data.
- * <p>
- * L2 cache for entity can be enabled in the Hibernate configuration file:
- * <pre name="code" class="xml">
- * &lt;hibernate-configuration&gt;
- *     &lt;!-- Enable L2 cache. --&gt;
- *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
- *
- *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
- *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
- *
- *     &lt;!-- Specify entity. --&gt;
- *     &lt;mapping class="com.example.Entity"/&gt;
- *
- *     &lt;!-- Enable L2 cache with nonstrict-read-write access strategy for entity. --&gt;
- *     &lt;class-cache class="com.example.Entity" usage="nonstrict-read-write"/&gt;
- * &lt;/hibernate-configuration&gt;
- * </pre>
- * Also cache for entity can be enabled using annotations:
- * <pre name="code" class="java">
- * &#064;javax.persistence.Entity
- * &#064;javax.persistence.Cacheable
- * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
- * public class Entity { ... }
- * </pre>
- */
-public class HibernateEntityRegion extends HibernateTransactionalDataRegion implements EntityRegion {
-    /**
-     * @param factory Region factory.
-     * @param name Region name.
-     * @param ignite Grid.
-     * @param cache Region cache,
-     * @param dataDesc Region data description.
-     */
-    public HibernateEntityRegion(HibernateRegionFactory factory, String name, Ignite ignite,
-        HibernateCacheProxy cache, CacheDataDescription dataDesc) {
-        super(factory, name, ignite, cache, dataDesc);
-    }
-
-    /** {@inheritDoc} */
-    @Override public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
-        return new AccessStrategy(createAccessStrategy(accessType));
-    }
-
-    /**
-     * Entity region access strategy.
-     */
-    private class AccessStrategy extends HibernateAbstractRegionAccessStrategy
-        implements EntityRegionAccessStrategy {
-        /**
-         * @param stgy Access strategy implementation.
-         */
-        private AccessStrategy(HibernateAccessStrategyAdapter stgy) {
-            super(stgy);
-        }
-
-        /** {@inheritDoc} */
-        @Override public EntityRegion getRegion() {
-            return HibernateEntityRegion.this;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean insert(Object key, Object val, Object ver) throws CacheException {
-            return stgy.insert(key, val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean afterInsert(Object key, Object val, Object ver) throws CacheException {
-            return stgy.afterInsert(key, val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean update(Object key, Object val, Object currVer, Object previousVer)
-            throws CacheException {
-            return stgy.update(key, val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean afterUpdate(Object key, Object val, Object currVer, Object previousVer, SoftLock lock)
-            throws CacheException {
-            return stgy.afterUpdate(key, val, lock);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateGeneralDataRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateGeneralDataRegion.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateGeneralDataRegion.java
deleted file mode 100644
index 2f1a11d..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateGeneralDataRegion.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCheckedException;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.GeneralDataRegion;
-import org.hibernate.cache.spi.QueryResultsRegion;
-import org.hibernate.cache.spi.TimestampsRegion;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Implementation of {@link GeneralDataRegion}. This interface defines common contract for {@link QueryResultsRegion}
- * and {@link TimestampsRegion}.
- */
-public class HibernateGeneralDataRegion extends HibernateRegion implements GeneralDataRegion {
-    /**
-     * @param factory Region factory.
-     * @param name Region name.
-     * @param ignite Grid.
-     * @param cache Region cache.
-     */
-    public HibernateGeneralDataRegion(HibernateRegionFactory factory, String name,
-        Ignite ignite, HibernateCacheProxy cache) {
-        super(factory, name, ignite, cache);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override public Object get(Object key) throws CacheException {
-        try {
-            return cache.get(key);
-        } catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void put(Object key, Object val) throws CacheException {
-        try {
-            cache.put(key, val);
-        } catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void evict(Object key) throws CacheException {
-        HibernateAccessStrategyAdapter.evict(ignite, cache, key);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void evictAll() throws CacheException {
-        HibernateAccessStrategyAdapter.evictAll(cache);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyTransformer.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyTransformer.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyTransformer.java
deleted file mode 100644
index ecad0b6..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyTransformer.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-/**
- * An interface for transforming hibernate keys to Ignite keys.
- */
-public interface HibernateKeyTransformer {
-    /**
-     * @param key Hibernate key.
-     */
-    public Object transform(Object key);
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyWrapper.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyWrapper.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyWrapper.java
deleted file mode 100644
index 7de440e..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateKeyWrapper.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * Hibernate cache key wrapper.
- */
-public class HibernateKeyWrapper {
-    /** Key. */
-    private final Object key;
-
-    /** Entry. */
-    private final String entry;
-
-    /** */
-    private final String tenantId;
-
-    /**
-     * @param key Key.
-     * @param entry Entry.
-     * @param tenantId Tenant ID.
-     */
-    HibernateKeyWrapper(Object key, String entry, String tenantId) {
-        this.key = key;
-        this.entry = entry;
-        this.tenantId = tenantId;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean equals(Object o) {
-        if (this == o) return true;
-
-        if (o == null || getClass() != o.getClass())
-            return false;
-
-        HibernateKeyWrapper that = (HibernateKeyWrapper) o;
-
-        return (key != null ? key.equals(that.key) : that.key == null) &&
-            (entry != null ? entry.equals(that.entry) : that.entry == null) &&
-            (tenantId != null ? tenantId.equals(that.tenantId) : that.tenantId == null);
-    }
-
-    /** {@inheritDoc} */
-    @Override public int hashCode() {
-        int res = key != null ? key.hashCode() : 0;
-        res = 31 * res + (entry != null ? entry.hashCode() : 0);
-        res = 31 * res + (tenantId != null ? tenantId.hashCode() : 0);
-        return res;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(HibernateKeyWrapper.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateNaturalIdRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateNaturalIdRegion.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateNaturalIdRegion.java
deleted file mode 100644
index 862a422..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateNaturalIdRegion.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.Ignite;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.CacheDataDescription;
-import org.hibernate.cache.spi.NaturalIdRegion;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy;
-import org.hibernate.cache.spi.access.SoftLock;
-
-/**
- * Implementation of {@link NaturalIdRegion}. This region is used to store naturalId data.
- * <p>
- * L2 cache for entity naturalId and target cache region can be set using annotations:
- * <pre name="code" class="java">
- * &#064;javax.persistence.Entity
- * &#064;javax.persistence.Cacheable
- * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
- * &#064;org.hibernate.annotations.NaturalIdCache
- * public class Entity {
- *     &#064;org.hibernate.annotations.NaturalId
- *     private String entityCode;
- *
- *     ...
- * }
- * </pre>
- */
-public class HibernateNaturalIdRegion extends HibernateTransactionalDataRegion implements NaturalIdRegion {
-    /**
-     * @param factory Region factory.
-     * @param name Region name.
-     * @param ignite Grid.
-     * @param cache Region cache,
-     * @param dataDesc Region data description.
-     */
-    public HibernateNaturalIdRegion(HibernateRegionFactory factory, String name,
-        Ignite ignite, HibernateCacheProxy cache, CacheDataDescription dataDesc) {
-        super(factory, name, ignite, cache, dataDesc);
-    }
-
-    /** {@inheritDoc} */
-    @Override public NaturalIdRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
-        return new AccessStrategy(createAccessStrategy(accessType));
-    }
-
-    /**
-     * NaturalId region access strategy.
-     */
-    private class AccessStrategy extends HibernateAbstractRegionAccessStrategy implements
-        NaturalIdRegionAccessStrategy {
-        /**
-         * @param stgy Access strategy implementation.
-         */
-        private AccessStrategy(HibernateAccessStrategyAdapter stgy) {
-            super(stgy);
-        }
-
-        /** {@inheritDoc} */
-        @Override public NaturalIdRegion getRegion() {
-            return HibernateNaturalIdRegion.this;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean insert(Object key, Object val) throws CacheException {
-            return stgy.insert(key, val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean afterInsert(Object key, Object val) throws CacheException {
-            return stgy.afterInsert(key, val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean update(Object key, Object val) throws CacheException {
-            return stgy.update(key, val);
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean afterUpdate(Object key, Object val, SoftLock lock) throws CacheException {
-            return stgy.afterUpdate(key, val, lock);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateNonStrictAccessStrategy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateNonStrictAccessStrategy.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateNonStrictAccessStrategy.java
deleted file mode 100644
index a36d7e7..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateNonStrictAccessStrategy.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import java.util.Map;
-import java.util.Set;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.util.GridLeanMap;
-import org.apache.ignite.internal.util.GridLeanSet;
-import org.apache.ignite.internal.util.typedef.F;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cache.spi.access.SoftLock;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Implementation of {@link AccessType#NONSTRICT_READ_WRITE} cache access strategy.
- * <p>
- * Configuration of L2 cache and per-entity cache access strategy can be set in the
- * Hibernate configuration file:
- * <pre name="code" class="xml">
- * &lt;hibernate-configuration&gt;
- *     &lt;!-- Enable L2 cache. --&gt;
- *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
- *
- *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
- *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
- *
- *     &lt;!-- Specify entity. --&gt;
- *     &lt;mapping class="com.example.Entity"/&gt;
- *
- *     &lt;!-- Enable L2 cache with nonstrict-read-write access strategy for entity. --&gt;
- *     &lt;class-cache class="com.example.Entity" usage="nonstrict-read-write"/&gt;
- * &lt;/hibernate-configuration&gt;
- * </pre>
- * Also cache access strategy can be set using annotations:
- * <pre name="code" class="java">
- * &#064;javax.persistence.Entity
- * &#064;javax.persistence.Cacheable
- * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
- * public class Entity { ... }
- * </pre>
- */
-public class HibernateNonStrictAccessStrategy extends HibernateAccessStrategyAdapter {
-    /** */
-    private final ThreadLocal<WriteContext> writeCtx;
-
-    /**
-     * @param ignite Grid.
-     * @param cache Cache.
-     * @param writeCtx Thread local instance used to track updates done during one Hibernate transaction.
-     */
-    protected HibernateNonStrictAccessStrategy(Ignite ignite, HibernateCacheProxy cache, ThreadLocal writeCtx) {
-        super(ignite, cache);
-
-        this.writeCtx = (ThreadLocal<WriteContext>)writeCtx;
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected SoftLock lock(Object key) throws CacheException {
-        WriteContext ctx = writeCtx.get();
-
-        if (ctx == null)
-            writeCtx.set(ctx = new WriteContext());
-
-        ctx.locked(key);
-
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void unlock(Object key, SoftLock lock) throws CacheException {
-        try {
-            WriteContext ctx = writeCtx.get();
-
-            if (ctx != null && ctx.unlocked(key)) {
-                writeCtx.remove();
-
-                ctx.updateCache(cache);
-            }
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean update(Object key, Object val) throws CacheException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean afterUpdate(Object key, Object val, SoftLock lock) throws CacheException {
-        WriteContext ctx = writeCtx.get();
-
-        if (ctx != null) {
-            ctx.updated(key, val);
-
-            unlock(key, lock);
-
-            return true;
-        }
-
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean insert(Object key, Object val) throws CacheException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean afterInsert(Object key, Object val) throws CacheException {
-        try {
-            cache.put(key, val);
-
-            return true;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void remove(Object key) throws CacheException {
-        WriteContext ctx = writeCtx.get();
-
-        if (ctx != null)
-            ctx.removed(key);
-    }
-
-    /**
-     * Information about updates done during single database transaction.
-     */
-    @SuppressWarnings("TypeMayBeWeakened")
-    private static class WriteContext {
-        /** */
-        private Map<Object, Object> updates;
-
-        /** */
-        private Set<Object> rmvs;
-
-        /** */
-        private Set<Object> locked = new GridLeanSet<>();
-
-        /**
-         * Marks key as locked.
-         *
-         * @param key Key.
-         */
-        void locked(Object key) {
-            locked.add(key);
-        }
-
-        /**
-         * Marks key as unlocked.
-         *
-         * @param key Key.
-         * @return {@code True} if last locked key was unlocked.
-         */
-        boolean unlocked(Object key) {
-            locked.remove(key);
-
-            return locked.isEmpty();
-        }
-
-        /**
-         * Marks key as updated.
-         *
-         * @param key Key.
-         * @param val Value.
-         */
-        void updated(Object key, Object val) {
-            if (updates == null)
-                updates = new GridLeanMap<>();
-
-            updates.put(key, val);
-        }
-
-        /**
-         * Marks key as removed.
-         *
-         * @param key Key.
-         */
-        void removed(Object key) {
-            if (rmvs == null)
-                rmvs = new GridLeanSet<>();
-
-            rmvs.add(key);
-        }
-
-        /**
-         * Updates cache.
-         *
-         * @param cache Cache.
-         * @throws IgniteCheckedException If failed.
-         */
-        void updateCache(HibernateCacheProxy cache) throws IgniteCheckedException {
-            if (!F.isEmpty(rmvs))
-                cache.removeAll(rmvs);
-
-            if (!F.isEmpty(updates))
-                cache.putAll(updates);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateQueryResultsRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateQueryResultsRegion.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateQueryResultsRegion.java
deleted file mode 100644
index 0b9a43d..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateQueryResultsRegion.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.Ignite;
-import org.hibernate.Query;
-import org.hibernate.cache.spi.QueryResultsRegion;
-
-/**
- * Implementation of {@link QueryResultsRegion}. This region is used to store query results.
- * <p>
- * Query results caching can be enabled in the Hibernate configuration file:
- * <pre name="code" class="xml">
- * &lt;hibernate-configuration&gt;
- *     &lt;!-- Enable L2 cache. --&gt;
- *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
- *
- *     &lt;!-- Enable query cache. --&gt;
- *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
-
- *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
- *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
- *
- *     &lt;!-- Specify entity. --&gt;
- *     &lt;mapping class="com.example.Entity"/&gt;
- *
- *     &lt;!-- Enable L2 cache with nonstrict-read-write access strategy for entity. --&gt;
- *     &lt;class-cache class="com.example.Entity" usage="nonstrict-read-write"/&gt;
- * &lt;/hibernate-configuration&gt;
- * </pre>
- * By default queries are not cached even after enabling query caching, to enable results caching for a particular
- * query, call {@link Query#setCacheable(boolean)}:
- * <pre name="code" class="java">
- *     Session ses = getSession();
- *
- *     Query qry = ses.createQuery("...");
- *
- *     qry.setCacheable(true); // Enable L2 cache for query.
- * </pre>
- * Note: the query cache does not cache the state of the actual entities in the cache, it caches only identifier
- * values. For this reason, the query cache should always be used in conjunction with
- * the second-level cache for those entities expected to be cached as part of a query result cache
- */
-public class HibernateQueryResultsRegion extends HibernateGeneralDataRegion implements QueryResultsRegion {
-    /**
-     * @param factory Region factory.
-     * @param name Region name.
-     * @param ignite Grid.
-     * @param cache Region cache.
-     */
-    public HibernateQueryResultsRegion(HibernateRegionFactory factory, String name,
-        Ignite ignite, HibernateCacheProxy cache) {
-        super(factory, name, ignite, cache);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadOnlyAccessStrategy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadOnlyAccessStrategy.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadOnlyAccessStrategy.java
deleted file mode 100644
index cdef80e..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadOnlyAccessStrategy.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCheckedException;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cache.spi.access.SoftLock;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Implementation of {@link AccessType#READ_ONLY} cache access strategy.
- * <p>
- * Configuration of L2 cache and per-entity cache access strategy can be set in the
- * Hibernate configuration file:
- * <pre name="code" class="xml">
- * &lt;hibernate-configuration&gt;
- *     &lt;!-- Enable L2 cache. --&gt;
- *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
- *
- *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
- *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
- *
- *     &lt;!-- Specify entity. --&gt;
- *     &lt;mapping class="com.example.Entity"/&gt;
- *
- *     &lt;!-- Enable L2 cache with read-only access strategy for entity. --&gt;
- *     &lt;class-cache class="com.example.Entity" usage="read-only"/&gt;
- * &lt;/hibernate-configuration&gt;
- * </pre>
- * Also cache access strategy can be set using annotations:
- * <pre name="code" class="java">
- * &#064;javax.persistence.Entity
- * &#064;javax.persistence.Cacheable
- * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
- * public class Entity { ... }
- * </pre>
-
- *
- */
-public class HibernateReadOnlyAccessStrategy extends HibernateAccessStrategyAdapter {
-    /**
-     * @param ignite Grid.
-     * @param cache Cache.
-     */
-    public HibernateReadOnlyAccessStrategy(Ignite ignite, HibernateCacheProxy cache) {
-        super(ignite, cache);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean insert(Object key, Object val) throws CacheException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean afterInsert(Object key, Object val) throws CacheException {
-        try {
-            cache.put(key, val);
-
-            return true;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected SoftLock lock(Object key) throws CacheException {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void unlock(Object key, SoftLock lock) throws CacheException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void remove(Object key) throws CacheException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean update(Object key, Object val) throws CacheException {
-        throw new UnsupportedOperationException("Updates are not supported for read-only access strategy.");
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean afterUpdate(Object key, Object val, SoftLock lock) throws CacheException {
-        throw new UnsupportedOperationException("Updates are not supported for read-only access strategy.");
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadWriteAccessStrategy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadWriteAccessStrategy.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadWriteAccessStrategy.java
deleted file mode 100644
index ae9bd71..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateReadWriteAccessStrategy.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import java.util.Set;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
-import org.apache.ignite.internal.util.GridLeanSet;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cache.spi.access.SoftLock;
-
-import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
-import static org.apache.ignite.transactions.TransactionIsolation.REPEATABLE_READ;
-
-/**
- * Implementation of {@link AccessType#READ_WRITE} cache access strategy.
- * <p>
- * Configuration of L2 cache and per-entity cache access strategy can be set in the
- * Hibernate configuration file:
- * <pre name="code" class="xml">
- * &lt;hibernate-configuration&gt;
- *     &lt;!-- Enable L2 cache. --&gt;
- *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
- *
- *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
- *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
- *
- *     &lt;!-- Specify entity. --&gt;
- *     &lt;mapping class="com.example.Entity"/&gt;
- *
- *     &lt;!-- Enable L2 cache with read-write access strategy for entity. --&gt;
- *     &lt;class-cache class="com.example.Entity" usage="read-write"/&gt;
- * &lt;/hibernate-configuration&gt;
- * </pre>
- * Also cache access strategy can be set using annotations:
- * <pre name="code" class="java">
- * &#064;javax.persistence.Entity
- * &#064;javax.persistence.Cacheable
- * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
- * public class Entity { ... }
- * </pre>
- */
-public class HibernateReadWriteAccessStrategy extends HibernateAccessStrategyAdapter {
-    /** */
-    private final ThreadLocal<TxContext> txCtx;
-
-    /**
-     * @param ignite Grid.
-     * @param cache Cache.
-     * @param txCtx Thread local instance used to track updates done during one Hibernate transaction.
-     */
-    protected HibernateReadWriteAccessStrategy(Ignite ignite, HibernateCacheProxy cache, ThreadLocal txCtx) {
-        super(ignite, cache);
-
-        this.txCtx = (ThreadLocal<TxContext>)txCtx;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected Object get(Object key) throws CacheException {
-        boolean success = false;
-
-        try {
-            Object o = cache.get(key);
-
-            success = true;
-
-            return o;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-        finally {
-            if (!success)
-                rollbackCurrentTx();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void putFromLoad(Object key, Object val) throws CacheException {
-        boolean success = false;
-
-        try {
-            cache.put(key, val);
-
-            success = true;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-        finally {
-            if (!success)
-                rollbackCurrentTx();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected SoftLock lock(Object key) throws CacheException {
-        boolean success = false;
-
-        try {
-            TxContext ctx = txCtx.get();
-
-            if (ctx == null)
-                txCtx.set(ctx = new TxContext());
-
-            lockKey(key);
-
-            ctx.locked(key);
-
-            success = true;
-
-            return null;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-        finally {
-            if (!success)
-                rollbackCurrentTx();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void unlock(Object key, SoftLock lock) throws CacheException {
-        boolean success = false;
-
-        try {
-            TxContext ctx = txCtx.get();
-
-            if (ctx != null)
-                unlock(ctx, key);
-
-            success = true;
-        }
-        catch (Exception e) {
-            throw new CacheException(e);
-        }
-        finally {
-            if (!success)
-                rollbackCurrentTx();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean update(Object key, Object val) throws CacheException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean afterUpdate(Object key, Object val, SoftLock lock) throws CacheException {
-        boolean success = false;
-        boolean res = false;
-
-        try {
-            TxContext ctx = txCtx.get();
-
-            if (ctx != null) {
-                cache.put(key, val);
-
-                unlock(ctx, key);
-
-                res = true;
-            }
-
-            success = true;
-
-            return res;
-        }
-        catch (Exception e) {
-            throw new CacheException(e);
-        }
-        finally {
-            if (!success)
-                rollbackCurrentTx();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean insert(Object key, Object val) throws CacheException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean afterInsert(Object key, Object val) throws CacheException {
-        boolean success = false;
-
-        try {
-            cache.put(key, val);
-
-            success = true;
-
-            return true;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-        finally {
-            if (!success)
-                rollbackCurrentTx();
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void remove(Object key) throws CacheException {
-        boolean success = false;
-
-        try {
-            TxContext ctx = txCtx.get();
-
-            if (ctx != null)
-                cache.remove(key);
-
-            success = true;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-        finally {
-            if (!success)
-                rollbackCurrentTx();
-        }
-    }
-
-    /**
-     *
-     * @param ctx Transaction context.
-     * @param key Key.
-     * @throws CacheException If failed.
-     */
-    private void unlock(TxContext ctx, Object key) throws CacheException {
-        if (ctx.unlocked(key)) { // Finish transaction if last key is unlocked.
-            txCtx.remove();
-
-            GridNearTxLocal tx = cache.tx();
-
-            assert tx != null;
-
-            try {
-                tx.proxy().commit();
-            }
-            finally {
-                tx.proxy().close();
-            }
-
-            assert cache.tx() == null;
-        }
-    }
-
-    /**
-     * Roll backs current transaction.
-     */
-    private void rollbackCurrentTx() {
-        try {
-            TxContext ctx = txCtx.get();
-
-            if (ctx != null) {
-                txCtx.remove();
-
-                GridNearTxLocal tx = cache.tx();
-
-                if (tx != null)
-                    tx.proxy().rollback();
-            }
-        }
-        catch (IgniteException e) {
-            log.error("Failed to rollback cache transaction.", e);
-        }
-    }
-
-    /**
-     * @param key Key.
-     * @throws IgniteCheckedException If failed.
-     */
-    private void lockKey(Object key) throws IgniteCheckedException {
-        if (cache.tx() == null)
-            cache.txStart(PESSIMISTIC, REPEATABLE_READ);
-
-        cache.get(key); // Acquire distributed lock.
-    }
-
-    /**
-     * Information about updates done during single database transaction.
-     */
-    @SuppressWarnings("TypeMayBeWeakened")
-    private static class TxContext {
-        /** */
-        private Set<Object> locked = new GridLeanSet<>();
-
-        /**
-         * Marks key as locked.
-         *
-         * @param key Key.
-         */
-        void locked(Object key) {
-            locked.add(key);
-        }
-
-        /**
-         * Marks key as unlocked.
-         *
-         * @param key Key.
-         * @return {@code True} if last locked key was unlocked.
-         */
-        boolean unlocked(Object key) {
-            locked.remove(key);
-
-            return locked.isEmpty();
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegion.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegion.java
deleted file mode 100644
index 11a96d0..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegion.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import java.util.Collections;
-import java.util.Map;
-import org.apache.ignite.Ignite;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.Region;
-
-/**
- * Implementation of {@link Region}. This interface defines base contract for all L2 cache regions.
- */
-public class HibernateRegion implements Region {
-    /** */
-    protected final HibernateRegionFactory factory;
-
-    /** */
-    private final String name;
-
-    /** Cache instance. */
-    protected final HibernateCacheProxy cache;
-
-    /** Grid instance. */
-    protected Ignite ignite;
-
-    /**
-     * @param factory Region factory.
-     * @param name Region name.
-     * @param ignite Grid.
-     * @param cache Region cache.
-     */
-    public HibernateRegion(HibernateRegionFactory factory, String name, Ignite ignite, HibernateCacheProxy cache) {
-        this.factory = factory;
-        this.name = name;
-        this.ignite = ignite;
-        this.cache = cache;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String getName() {
-        return name;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void destroy() throws CacheException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean contains(Object key) {
-        return cache.containsKey(key);
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getSizeInMemory() {
-        return -1;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getElementCountInMemory() {
-        return cache.size();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getElementCountOnDisk() {
-        return -1;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Map toMap() {
-        return Collections.emptyMap();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long nextTimestamp() {
-        return System.currentTimeMillis();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTimeout() {
-        return 0;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegionFactory.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegionFactory.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegionFactory.java
deleted file mode 100644
index 263359b..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateRegionFactory.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.Ignition;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
-import org.apache.ignite.internal.util.typedef.G;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.CacheDataDescription;
-import org.hibernate.cache.spi.CacheKey;
-import org.hibernate.cache.spi.CollectionRegion;
-import org.hibernate.cache.spi.EntityRegion;
-import org.hibernate.cache.spi.NaturalIdRegion;
-import org.hibernate.cache.spi.QueryResultsRegion;
-import org.hibernate.cache.spi.RegionFactory;
-import org.hibernate.cache.spi.TimestampsRegion;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cfg.Settings;
-
-import static org.hibernate.cache.spi.access.AccessType.NONSTRICT_READ_WRITE;
-
-/**
- * Hibernate L2 cache region factory.
- * <p>
- * Following Hibernate settings should be specified to enable second level cache and to use this
- * region factory for caching:
- * <pre name="code" class="brush: xml; gutter: false;">
- * hibernate.cache.use_second_level_cache=true
- * hibernate.cache.region.factory_class=org.apache.ignite.cache.hibernate.HibernateRegionFactory
- * </pre>
- * Note that before region factory is started you need to start properly configured Ignite node in the same JVM.
- * For example to start Ignite node one of loader provided in {@code org.apache.ignite.grid.startup} package can be used.
- * <p>
- * Name of Ignite instance to be used for region factory must be specified as following Hibernate property:
- * <pre name="code" class="brush: xml; gutter: false;">
- * org.apache.ignite.hibernate.ignite_instance_name=&lt;Ignite instance name&gt;
- * </pre>
- * Each Hibernate cache region must be associated with some {@link IgniteInternalCache}, by default it is assumed that
- * for each cache region there is a {@link IgniteInternalCache} with the same name. Also it is possible to define
- * region to cache mapping using properties with prefix {@code org.apache.ignite.hibernate.region_cache}.
- * For example if for region with name "region1" cache with name "cache1" should be used then following
- * Hibernate property should be specified:
- * <pre name="code" class="brush: xml; gutter: false;">
- * org.apache.ignite.hibernate.region_cache.region1=cache1
- * </pre>
- */
-public class HibernateRegionFactory implements RegionFactory {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /**
-     * Hibernate L2 cache grid name property name.
-     *
-     * @deprecated Use {@link #IGNITE_INSTANCE_NAME_PROPERTY}.
-     *      If {@link #IGNITE_INSTANCE_NAME_PROPERTY} is specified it takes precedence.
-     */
-    @Deprecated
-    public static final String GRID_NAME_PROPERTY = "org.apache.ignite.hibernate.grid_name";
-
-    /** Hibernate L2 cache Ignite instance name property name. */
-    public static final String IGNITE_INSTANCE_NAME_PROPERTY = "org.apache.ignite.hibernate.ignite_instance_name";
-
-    /** Default cache property name. */
-    public static final String DFLT_CACHE_NAME_PROPERTY = "org.apache.ignite.hibernate.default_cache";
-
-    /** Property prefix used to specify region name to cache name mapping. */
-    public static final String REGION_CACHE_PROPERTY = "org.apache.ignite.hibernate.region_cache.";
-
-    /** */
-    public static final String DFLT_ACCESS_TYPE_PROPERTY = "org.apache.ignite.hibernate.default_access_type";
-
-    /** */
-    public static final String GRID_CONFIG_PROPERTY = "org.apache.ignite.hibernate.grid_config";
-
-    /** Grid providing caches. */
-    private Ignite ignite;
-
-    /** Default cache. */
-    private HibernateCacheProxy dfltCache;
-
-    /** Default region access type. */
-    private AccessType dfltAccessType;
-
-    /** Region name to cache name mapping. */
-    private final Map<String, String> regionCaches = new HashMap<>();
-
-    /** Map needed to provide the same transaction context for different regions. */
-    private final ThreadLocal threadLoc = new ThreadLocal();
-
-    /** Key transformer. */
-    private final HibernateKeyTransformer hibernate4transformer = new HibernateKeyTransformer() {
-        @Override public Object transform(Object key) {
-            if (key instanceof CacheKey) {
-                CacheKey cacheKey = (CacheKey)key;
-
-                return new HibernateKeyWrapper(
-                    cacheKey.getKey(),
-                    cacheKey.getEntityOrRoleName(),
-                    cacheKey.getTenantId()
-                );
-            }
-
-            return key;
-        }
-    };
-
-    /** {@inheritDoc} */
-    @Override public void start(Settings settings, Properties props) throws CacheException {
-        String gridCfg = props.getProperty(GRID_CONFIG_PROPERTY);
-        String igniteInstanceName = props.getProperty(IGNITE_INSTANCE_NAME_PROPERTY);
-
-        if (igniteInstanceName == null)
-            igniteInstanceName = props.getProperty(GRID_NAME_PROPERTY);
-
-        if (gridCfg != null) {
-            try {
-                ignite = G.start(gridCfg);
-            }
-            catch (IgniteException e) {
-                throw new CacheException(e);
-            }
-        }
-        else
-            ignite = Ignition.ignite(igniteInstanceName);
-
-        String accessType = props.getProperty(DFLT_ACCESS_TYPE_PROPERTY, NONSTRICT_READ_WRITE.name());
-
-        dfltAccessType = AccessType.valueOf(accessType);
-
-        for (Map.Entry<Object, Object> prop : props.entrySet()) {
-            String key = prop.getKey().toString();
-
-            if (key.startsWith(REGION_CACHE_PROPERTY)) {
-                String regionName = key.substring(REGION_CACHE_PROPERTY.length());
-
-                String cacheName = prop.getValue().toString();
-
-                if (((IgniteKernal)ignite).getCache(cacheName) == null)
-                    throw new CacheException("Cache '" + cacheName + "' specified for region '" + regionName + "' " +
-                        "is not configured.");
-
-                regionCaches.put(regionName, cacheName);
-            }
-        }
-
-        String dfltCacheName = props.getProperty(DFLT_CACHE_NAME_PROPERTY);
-
-        if (dfltCacheName != null) {
-            IgniteInternalCache<Object, Object> dfltCache = ((IgniteKernal)ignite).getCache(dfltCacheName);
-
-            if (dfltCache == null)
-                throw new CacheException("Cache specified as default is not configured: " + dfltCacheName);
-
-            this.dfltCache = new HibernateCacheProxy(dfltCache, hibernate4transformer);
-        }
-
-        IgniteLogger log = ignite.log().getLogger(HibernateRegionFactory.class);
-
-        if (log.isDebugEnabled())
-            log.debug("HibernateRegionFactory started [igniteInstanceName=" + igniteInstanceName + ']');
-    }
-
-    /** {@inheritDoc} */
-    @Override public void stop() {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isMinimalPutsEnabledByDefault() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public AccessType getDefaultAccessType() {
-        return dfltAccessType;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long nextTimestamp() {
-        return System.currentTimeMillis();
-    }
-
-    /** {@inheritDoc} */
-    @Override public EntityRegion buildEntityRegion(String regionName, Properties props, CacheDataDescription metadata)
-        throws CacheException {
-        return new HibernateEntityRegion(this, regionName, ignite, regionCache(regionName), metadata);
-    }
-
-    /** {@inheritDoc} */
-    @Override public NaturalIdRegion buildNaturalIdRegion(String regionName, Properties props,
-        CacheDataDescription metadata) throws CacheException {
-        return new HibernateNaturalIdRegion(this, regionName, ignite, regionCache(regionName), metadata);
-    }
-
-    /** {@inheritDoc} */
-    @Override public CollectionRegion buildCollectionRegion(String regionName, Properties props,
-        CacheDataDescription metadata) throws CacheException {
-        return new HibernateCollectionRegion(this, regionName, ignite, regionCache(regionName), metadata);
-    }
-
-    /** {@inheritDoc} */
-    @Override public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties props)
-        throws CacheException {
-        return new HibernateQueryResultsRegion(this, regionName, ignite, regionCache(regionName));
-    }
-
-    /** {@inheritDoc} */
-    @Override public TimestampsRegion buildTimestampsRegion(String regionName, Properties props) throws CacheException {
-        return new HibernateTimestampsRegion(this, regionName, ignite, regionCache(regionName));
-    }
-
-    /**
-     * Reuse same thread local for the same cache across different regions.
-     *
-     * @param cacheName Cache name.
-     * @return Thread local instance used to track updates done during one Hibernate transaction.
-     */
-    ThreadLocal threadLocalForCache(String cacheName) {
-        return threadLoc;
-    }
-
-    /**
-     * @param regionName L2 cache region name.
-     * @return Cache for given region.
-     * @throws CacheException If cache for given region is not configured.
-     */
-    private HibernateCacheProxy regionCache(String regionName) throws CacheException {
-        String cacheName = regionCaches.get(regionName);
-
-        if (cacheName == null) {
-            if (dfltCache != null)
-                return dfltCache;
-
-            cacheName = regionName;
-        }
-
-        IgniteInternalCache<Object, Object> cache = ((IgniteKernal)ignite).getCache(cacheName);
-
-        if (cache == null)
-            throw new CacheException("Cache '" + cacheName + "' for region '" + regionName + "' is not configured.");
-
-        return new HibernateCacheProxy(cache, hibernate4transformer);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateTimestampsRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateTimestampsRegion.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateTimestampsRegion.java
deleted file mode 100644
index 8b4c243..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateTimestampsRegion.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.Ignite;
-import org.hibernate.cache.spi.TimestampsRegion;
-
-/**
- * Implementation of {@link TimestampsRegion}. This region is automatically created when query
- * caching is enabled and it holds most recent updates timestamps to queryable tables.
- * Name of timestamps region is {@code "org.hibernate.cache.spi.UpdateTimestampsCache"}.
- */
-public class HibernateTimestampsRegion extends HibernateGeneralDataRegion implements TimestampsRegion {
-    /**
-     * @param factory Region factory.
-     * @param name Region name.
-     * @param ignite Grid.
-     * @param cache Region cache.
-     */
-    public HibernateTimestampsRegion(HibernateRegionFactory factory, String name,
-        Ignite ignite,  HibernateCacheProxy cache) {
-        super(factory, name, ignite, cache);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalAccessStrategy.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalAccessStrategy.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalAccessStrategy.java
deleted file mode 100644
index ca52849..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalAccessStrategy.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.access.AccessType;
-import org.hibernate.cache.spi.access.SoftLock;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Implementation of {@link AccessType#TRANSACTIONAL} cache access strategy.
- * <p>
- * It is supposed that this strategy is used in JTA environment and Hibernate and
- * {@link IgniteInternalCache} corresponding to the L2 cache region are configured to use the same transaction manager.
- * <p>
- * Configuration of L2 cache and per-entity cache access strategy can be set in the
- * Hibernate configuration file:
- * <pre name="code" class="xml">
- * &lt;hibernate-configuration&gt;
- *     &lt;!-- Enable L2 cache. --&gt;
- *     &lt;property name="cache.use_second_level_cache"&gt;true&lt;/property&gt;
- *
- *     &lt;!-- Use Ignite as L2 cache provider. --&gt;
- *     &lt;property name="cache.region.factory_class"&gt;org.apache.ignite.cache.hibernate.HibernateRegionFactory&lt;/property&gt;
- *
- *     &lt;!-- Specify entity. --&gt;
- *     &lt;mapping class="com.example.Entity"/&gt;
- *
- *     &lt;!-- Enable L2 cache with transactional access strategy for entity. --&gt;
- *     &lt;class-cache class="com.example.Entity" usage="transactional"/&gt;
- * &lt;/hibernate-configuration&gt;
- * </pre>
- * Also cache access strategy can be set using annotations:
- * <pre name="code" class="java">
- * &#064;javax.persistence.Entity
- * &#064;javax.persistence.Cacheable
- * &#064;org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
- * public class Entity { ... }
- * </pre>
- */
-public class HibernateTransactionalAccessStrategy extends HibernateAccessStrategyAdapter {
-    /**
-     * @param ignite Grid.
-     * @param cache Cache.
-     */
-    public HibernateTransactionalAccessStrategy(Ignite ignite, HibernateCacheProxy cache) {
-        super(ignite, cache);
-    }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected Object get(Object key) throws CacheException {
-        try {
-            return cache.get(key);
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void putFromLoad(Object key, Object val) throws CacheException {
-        try {
-            cache.put(key, val);
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected SoftLock lock(Object key) throws CacheException {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void unlock(Object key, SoftLock lock) throws CacheException {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean update(Object key, Object val) throws CacheException {
-        try {
-            cache.put(key, val);
-
-            return true;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean afterUpdate(Object key, Object val, SoftLock lock) throws CacheException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean insert(Object key, Object val) throws CacheException {
-        try {
-            cache.put(key, val);
-
-            return true;
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected boolean afterInsert(Object key, Object val) throws CacheException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void remove(Object key) throws CacheException {
-        try {
-            cache.remove(key);
-        }
-        catch (IgniteCheckedException e) {
-            throw new CacheException(e);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalDataRegion.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalDataRegion.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalDataRegion.java
deleted file mode 100644
index 581076a..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/HibernateTransactionalDataRegion.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.cache.hibernate;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.configuration.TransactionConfiguration;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.spi.CacheDataDescription;
-import org.hibernate.cache.spi.CollectionRegion;
-import org.hibernate.cache.spi.EntityRegion;
-import org.hibernate.cache.spi.NaturalIdRegion;
-import org.hibernate.cache.spi.TransactionalDataRegion;
-import org.hibernate.cache.spi.access.AccessType;
-
-import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
-
-/**
- * Implementation of {@link TransactionalDataRegion} (transactional means that
- * data in the region is updated in connection with database transaction).
- * This interface defines base contract for {@link EntityRegion}, {@link CollectionRegion}
- * and {@link NaturalIdRegion}.
- */
-public class HibernateTransactionalDataRegion extends HibernateRegion implements TransactionalDataRegion {
-    /** */
-    private final CacheDataDescription dataDesc;
-
-    /**
-     * @param factory Region factory.
-     * @param name Region name.
-     * @param ignite Grid.
-     * @param cache Region cache.
-     * @param dataDesc Region data description.
-     */
-    public HibernateTransactionalDataRegion(HibernateRegionFactory factory, String name,
-        Ignite ignite, HibernateCacheProxy cache, CacheDataDescription dataDesc) {
-        super(factory, name, ignite, cache);
-
-        this.dataDesc = dataDesc;
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isTransactionAware() {
-        return false; // This method is not used by Hibernate.
-    }
-
-    /** {@inheritDoc} */
-    @Override public CacheDataDescription getCacheDataDescription() {
-        return dataDesc;
-    }
-
-    /**
-     * @param accessType Hibernate L2 cache access type.
-     * @return Access strategy for given access type.
-     */
-    protected HibernateAccessStrategyAdapter createAccessStrategy(AccessType accessType) {
-        switch (accessType) {
-            case READ_ONLY:
-                return new HibernateReadOnlyAccessStrategy(ignite, cache);
-
-            case NONSTRICT_READ_WRITE:
-                return new HibernateNonStrictAccessStrategy(ignite, cache, factory.threadLocalForCache(cache.name()));
-
-            case READ_WRITE:
-                if (cache.configuration().getAtomicityMode() != TRANSACTIONAL)
-                    throw new CacheException("Hibernate READ-WRITE access strategy must have Ignite cache with " +
-                        "'TRANSACTIONAL' atomicity mode: " + cache.name());
-
-                return new HibernateReadWriteAccessStrategy(ignite, cache, factory.threadLocalForCache(cache.name()));
-
-            case TRANSACTIONAL:
-                if (cache.configuration().getAtomicityMode() != TRANSACTIONAL)
-                    throw new CacheException("Hibernate TRANSACTIONAL access strategy must have Ignite cache with " +
-                        "'TRANSACTIONAL' atomicity mode: " + cache.name());
-
-                TransactionConfiguration txCfg = ignite.configuration().getTransactionConfiguration();
-
-                if (txCfg == null ||
-                    (txCfg.getTxManagerFactory() == null
-                    && txCfg.getTxManagerLookupClassName() == null
-                    && cache.configuration().getTransactionManagerLookupClassName() == null)) {
-                    throw new CacheException("Hibernate TRANSACTIONAL access strategy must have Ignite with " +
-                                "Factory<TransactionManager> configured (see IgniteConfiguration." +
-                                "getTransactionConfiguration().setTxManagerFactory()): " + cache.name());
-                }
-
-                return new HibernateTransactionalAccessStrategy(ignite, cache);
-
-            default:
-                throw new IllegalArgumentException("Unknown Hibernate access type: " + accessType);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee1b19d3/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/package-info.java
----------------------------------------------------------------------
diff --git a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/package-info.java b/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/package-info.java
deleted file mode 100644
index 1179aec..0000000
--- a/modules/hibernate/src/main/java/org/apache/ignite/cache/hibernate/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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 description. -->
- * Contains implementation of Hibernate L2 cache. Refer to
- * <i>org.apache.ignite.examples.datagrid.hibernate.HibernateL2CacheExample</i> for more information on how to
- * configure and use Ignite with Hibernate.
- */
-package org.apache.ignite.cache.hibernate;
\ No newline at end of file


[37/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
index 146c6aa..33766f3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheClientModesAbstractSelfTest.java
@@ -56,7 +56,7 @@ public abstract class GridCacheClientModesAbstractSelfTest extends GridCacheAbst
         super.beforeTestsStarted();
 
         if (nearEnabled())
-            grid(nearOnlyIgniteInstanceName).createNearCache(null, nearConfiguration());
+            grid(nearOnlyIgniteInstanceName).createNearCache(DEFAULT_CACHE_NAME, nearConfiguration());
     }
 
     /** {@inheritDoc} */
@@ -119,8 +119,8 @@ public abstract class GridCacheClientModesAbstractSelfTest extends GridCacheAbst
 
         for (int key = 0; key < 10; key++) {
             for (int i = 0; i < gridCount(); i++) {
-                if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key))
-                    assertEquals(key, grid(i).cache(null).localPeek(key));
+                if (grid(i).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid(i).localNode(), key))
+                    assertEquals(key, grid(i).cache(DEFAULT_CACHE_NAME).localPeek(key));
             }
 
             if (nearEnabled())
@@ -139,8 +139,8 @@ public abstract class GridCacheClientModesAbstractSelfTest extends GridCacheAbst
             assertNull(nearOnly.localPeek(key, CachePeekMode.ALL));
 
         for (int i = 0; i < gridCount(); i++) {
-            if (grid(i).affinity(null).isPrimaryOrBackup(grid(i).localNode(), key)) {
-                TestClass1 val = (TestClass1)grid(i).cache(null).localPeek(key);
+            if (grid(i).affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid(i).localNode(), key)) {
+                TestClass1 val = (TestClass1)grid(i).cache(DEFAULT_CACHE_NAME).localPeek(key);
 
                 assertNotNull(val);
                 assertEquals(key.intValue(), val.val);
@@ -196,7 +196,7 @@ public abstract class GridCacheClientModesAbstractSelfTest extends GridCacheAbst
 
             if (F.eq(g.name(), nearOnlyIgniteInstanceName)) {
                 for (int k = 0; k < 10000; k++) {
-                    IgniteCache<Object, Object> cache = g.cache(null);
+                    IgniteCache<Object, Object> cache = g.cache(DEFAULT_CACHE_NAME);
 
                     String key = "key" + k;
 
@@ -213,10 +213,10 @@ public abstract class GridCacheClientModesAbstractSelfTest extends GridCacheAbst
                 for (int k = 0; k < 10000; k++) {
                     String key = "key" + k;
 
-                    if (g.affinity(null).isPrimaryOrBackup(g.cluster().localNode(), key))
+                    if (g.affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(g.cluster().localNode(), key))
                         foundEntry = true;
 
-                    if (g.affinity(null).mapKeyToPrimaryAndBackups(key).contains(g.cluster().localNode()))
+                    if (g.affinity(DEFAULT_CACHE_NAME).mapKeyToPrimaryAndBackups(key).contains(g.cluster().localNode()))
                         foundAffinityNode = true;
                 }
 
@@ -232,7 +232,7 @@ public abstract class GridCacheClientModesAbstractSelfTest extends GridCacheAbst
     protected IgniteCache<Object, Object> nearOnlyCache() {
         assert nearOnlyIgniteInstanceName != null;
 
-        return G.ignite(nearOnlyIgniteInstanceName).cache(null);
+        return G.ignite(nearOnlyIgniteInstanceName).cache(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -241,7 +241,7 @@ public abstract class GridCacheClientModesAbstractSelfTest extends GridCacheAbst
     protected IgniteCache<Object, Object> dhtCache() {
         for (int i = 0; i < gridCount(); i++) {
             if (!nearOnlyIgniteInstanceName.equals(grid(i).name()))
-                return grid(i).cache(null);
+                return grid(i).cache(DEFAULT_CACHE_NAME);
         }
 
         assert false : "Cannot find DHT cache for this test.";

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetAbstractSelfTest.java
index dddb32b..aea6ce6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheEntrySetAbstractSelfTest.java
@@ -73,7 +73,7 @@ public abstract class GridCacheEntrySetAbstractSelfTest extends GridCacheAbstrac
 
                     log.info("Use cache " + idx);
 
-                    IgniteCache<Object, Object> cache = grid(idx).cache(null);
+                    IgniteCache<Object, Object> cache = grid(idx).cache(DEFAULT_CACHE_NAME);
 
                     for (int i = 0; i < 100; i++)
                         putAndCheckEntrySet(cache);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java
index 4cbf2ed..0bd2d1e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheLockAbstractTest.java
@@ -111,8 +111,8 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
         ignite1 = startGrid(1);
         ignite2 = startGrid(2);
 
-        cache1 = ignite1.cache(null);
-        cache2 = ignite2.cache(null);
+        cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
+        cache2 = ignite2.cache(DEFAULT_CACHE_NAME);
     }
 
     /** {@inheritDoc} */
@@ -507,7 +507,7 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
      * @throws Throwable If failed.
      */
     public void testLockReentrancy() throws Throwable {
-        Affinity<Integer> aff = ignite1.affinity(null);
+        Affinity<Integer> aff = ignite1.affinity(DEFAULT_CACHE_NAME);
 
         for (int i = 10; i < 100; i++) {
             log.info("Test lock [key=" + i +

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMixedModeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMixedModeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMixedModeSelfTest.java
index 59f9a3f..fee1355 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMixedModeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMixedModeSelfTest.java
@@ -48,7 +48,7 @@ public class GridCacheMixedModeSelfTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     private CacheConfiguration cacheConfiguration(String igniteInstanceName) {
-        CacheConfiguration cfg = new CacheConfiguration();
+        CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setCacheMode(CacheMode.PARTITIONED);
 
@@ -69,7 +69,7 @@ public class GridCacheMixedModeSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testBasicOps() throws Exception {
-        IgniteCache<Object, Object> cache = grid(0).cache(null);
+        IgniteCache<Object, Object> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < 1000; i++)
             cache.put(i, i);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
index 67327be..4406800 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeAbstractTest.java
@@ -91,9 +91,9 @@ public abstract class GridCacheMultiNodeAbstractTest extends GridCommonAbstractT
         ignite2 = startGrid(2);
         ignite3 = startGrid(3);
 
-        cache1 = ignite1.cache(null);
-        cache2 = ignite2.cache(null);
-        cache3 = ignite3.cache(null);
+        cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
+        cache2 = ignite2.cache(DEFAULT_CACHE_NAME);
+        cache3 = ignite3.cache(DEFAULT_CACHE_NAME);
     }
 
     /** {@inheritDoc} */
@@ -190,7 +190,7 @@ public abstract class GridCacheMultiNodeAbstractTest extends GridCommonAbstractT
         for (Ignite ignite : ignites)
             addListener(ignite, lsnr);
 
-        IgniteCache<Integer, String> cache1 = ignites[0].cache(null);
+        IgniteCache<Integer, String> cache1 = ignites[0].cache(DEFAULT_CACHE_NAME);
 
         for (int i = 1; i <= cnt; i++)
             cache1.put(i, "val" + i);
@@ -205,7 +205,7 @@ public abstract class GridCacheMultiNodeAbstractTest extends GridCommonAbstractT
         latch.await(10, SECONDS);
 
         for (Ignite ignite : ignites) {
-            IgniteCache<Integer, String> cache = ignite.cache(null);
+            IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             if (cache == cache1)
                 continue;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java
index daccc69..822a7c4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java
@@ -49,9 +49,6 @@ import static org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_UNLOCKED;
  */
 public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstractTest {
     /** */
-    private static final String CACHE1 = null;
-
-    /** */
     private static final String CACHE2 = "cache2";
 
     /** Grid 1. */
@@ -83,7 +80,7 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
 
         cfg.setDiscoverySpi(disco);
 
-        CacheConfiguration ccfg1 = cacheConfiguration().setName(CACHE1);
+        CacheConfiguration ccfg1 = cacheConfiguration().setName(DEFAULT_CACHE_NAME);
         CacheConfiguration ccfg2 = cacheConfiguration().setName(CACHE2);
 
         cfg.setCacheConfiguration(ccfg1, ccfg2);
@@ -130,7 +127,7 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
             jcache(i).clear();
 
             assertTrue(
-                "Cache isn't empty [i=" + i + ", entries=" + ((IgniteKernal)grid(i)).internalCache().entries() + "]",
+                "Cache isn't empty [i=" + i + ", entries=" + ((IgniteKernal)grid(i)).internalCache(DEFAULT_CACHE_NAME).entries() + "]",
                 jcache(i).localSize() == 0);
         }
     }
@@ -231,7 +228,7 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
      * @throws Exception If test failed.
      */
     public void testBasicLock() throws Exception {
-        IgniteCache<Integer, String> cache = ignite1.cache(null);
+        IgniteCache<Integer, String> cache = ignite1.cache(DEFAULT_CACHE_NAME);
 
         Lock lock = cache.lock(1);
 
@@ -264,16 +261,16 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
                 ", de2=" + dht2.peekEx(key) + ']';
         }
 
-        return "Entries [e1=" + "(" + key + ", " + ((IgniteKernal)ignite1).internalCache(null).get(key) + ")"
-            + ", e2=" + "(" + key + ", " + ((IgniteKernal)ignite2).internalCache(null).get(key) + ")" + ']';
+        return "Entries [e1=" + "(" + key + ", " + ((IgniteKernal)ignite1).internalCache(DEFAULT_CACHE_NAME).get(key) + ")"
+            + ", e2=" + "(" + key + ", " + ((IgniteKernal)ignite2).internalCache(DEFAULT_CACHE_NAME).get(key) + ")" + ']';
     }
 
     /**
      * @throws Exception If test fails.
      */
     public void testMultiNodeLock() throws Exception {
-        IgniteCache<Integer, String> cache1 = ignite1.cache(null);
-        IgniteCache<Integer, String> cache2 = ignite2.cache(null);
+        IgniteCache<Integer, String> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
+        IgniteCache<Integer, String> cache2 = ignite2.cache(DEFAULT_CACHE_NAME);
 
         Lock lock1_1 = cache1.lock(1);
         Lock lock2_1 = cache2.lock(1);
@@ -330,8 +327,8 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
      * @throws Exception If test fails.
      */
     public void testMultiNodeLockWithKeyLists() throws Exception {
-        IgniteCache<Integer, String> cache1 = ignite1.cache(null);
-        IgniteCache<Integer, String> cache2 = ignite2.cache(null);
+        IgniteCache<Integer, String> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
+        IgniteCache<Integer, String> cache2 = ignite2.cache(DEFAULT_CACHE_NAME);
 
         Collection<Integer> keys1 = Arrays.asList(1, 2, 3);
         Collection<Integer> keys2 = Arrays.asList(2, 3, 4);
@@ -407,7 +404,7 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
      * @throws IgniteCheckedException If test failed.
      */
     public void testLockReentry() throws IgniteCheckedException {
-        IgniteCache<Integer, String> cache = ignite1.cache(null);
+        IgniteCache<Integer, String> cache = ignite1.cache(DEFAULT_CACHE_NAME);
 
         Lock lock = cache.lock(1);
 
@@ -435,7 +432,7 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
      * @throws Exception If test failed.
      */
     public void testLockMultithreaded() throws Exception {
-        final IgniteCache<Integer, String> cache = ignite1.cache(null);
+        final IgniteCache<Integer, String> cache = ignite1.cache(DEFAULT_CACHE_NAME);
 
         final CountDownLatch l1 = new CountDownLatch(1);
         final CountDownLatch l2 = new CountDownLatch(1);
@@ -553,7 +550,7 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
      * @throws Exception If failed.
      */
     public void testTwoCaches() throws Exception {
-        IgniteCache<Integer, String> cache1 = ignite1.cache(CACHE1);
+        IgniteCache<Integer, String> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
         IgniteCache<Integer, String> cache2 = ignite1.cache(CACHE2);
 
         final Integer key = primaryKey(cache1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultithreadedFailoverAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultithreadedFailoverAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultithreadedFailoverAbstractTest.java
index d3a2ca7..7bb0012 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultithreadedFailoverAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheMultithreadedFailoverAbstractTest.java
@@ -205,7 +205,7 @@ public class GridCacheMultithreadedFailoverAbstractTest extends GridCommonAbstra
      * @throws Exception If failed.
      */
     private IgniteConfiguration configuration(int idx) throws Exception {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(CACHE_NAME);
         ccfg.setCacheMode(cacheMode());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
index cd475fe..3834df9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheNodeFailureAbstractTest.java
@@ -134,7 +134,7 @@ public abstract class GridCacheNodeFailureAbstractTest extends GridCommonAbstrac
      * @return Cache.
      */
     @Override protected <K, V> IgniteCache<K, V> jcache(int i) {
-        return IGNITEs.get(i).cache(null);
+        return IGNITEs.get(i).cache(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -176,7 +176,7 @@ public abstract class GridCacheNodeFailureAbstractTest extends GridCommonAbstrac
         Transaction tx = g.transactions().txStart(concurrency, isolation);
 
         try {
-            g.cache(null).put(KEY, VALUE);
+            g.cache(DEFAULT_CACHE_NAME).put(KEY, VALUE);
 
             int checkIdx = (idx + 1) % G.allGrids().size();
 
@@ -243,7 +243,7 @@ public abstract class GridCacheNodeFailureAbstractTest extends GridCommonAbstrac
 
         info("Grid will be stopped: " + idx);
 
-        info("Nodes for key [id=" + grid(idx).affinity(null).mapKeyToPrimaryAndBackups(KEY) +
+        info("Nodes for key [id=" + grid(idx).affinity(DEFAULT_CACHE_NAME).mapKeyToPrimaryAndBackups(KEY) +
             ", key=" + KEY + ']');
 
         IgniteCache<Integer, String> cache = jcache(idx);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java
index 9c94491..d25304b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionNotLoadedEventSelfTest.java
@@ -77,7 +77,7 @@ public class GridCachePartitionNotLoadedEventSelfTest extends GridCommonAbstract
 
         cfg.setCommunicationSpi(new TestTcpCommunicationSpi());
 
-        CacheConfiguration<Integer, Integer> cacheCfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> cacheCfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         cacheCfg.setCacheMode(PARTITIONED);
         cacheCfg.setBackups(backupCnt);
@@ -113,7 +113,7 @@ public class GridCachePartitionNotLoadedEventSelfTest extends GridCommonAbstract
         ignite(2).events().localListen(lsnr1, EventType.EVT_CACHE_REBALANCE_PART_DATA_LOST);
         ignite(3).events().localListen(lsnr2, EventType.EVT_CACHE_REBALANCE_PART_DATA_LOST);
 
-        Affinity<Integer> aff = ignite(0).affinity(null);
+        Affinity<Integer> aff = ignite(0).affinity(DEFAULT_CACHE_NAME);
 
         int key = 0;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java
index 51e9564..87e121e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePartitionedReloadAllAbstractSelfTest.java
@@ -127,7 +127,7 @@ public abstract class GridCachePartitionedReloadAllAbstractSelfTest extends Grid
         caches = new ArrayList<>(GRID_CNT);
 
         for (int i = 0; i < GRID_CNT; i++)
-            caches.add(startGrid(i).<Integer, String>cache(null));
+            caches.add(startGrid(i).<Integer, String>cache(DEFAULT_CACHE_NAME));
 
         awaitPartitionMapExchange();
     }
@@ -153,7 +153,7 @@ public abstract class GridCachePartitionedReloadAllAbstractSelfTest extends Grid
 
             @Override public void loadCache(IgniteBiInClosure<Integer, String> c,
                 Object... args) {
-                X.println("Loading all on: " + caches.indexOf(((IgniteKernal)g).<Integer, String>getCache(null)));
+                X.println("Loading all on: " + caches.indexOf(((IgniteKernal)g).<Integer, String>getCache(DEFAULT_CACHE_NAME)));
 
                 for (Map.Entry<Integer, String> e : map.entrySet())
                     c.apply(e.getKey(), e.getValue());
@@ -161,7 +161,7 @@ public abstract class GridCachePartitionedReloadAllAbstractSelfTest extends Grid
 
             @Override public String load(Integer key) {
                 X.println("Loading on: " + caches.indexOf(((IgniteKernal)g)
-                    .<Integer, String>getCache(null)) + " key=" + key);
+                    .<Integer, String>getCache(DEFAULT_CACHE_NAME)) + " key=" + key);
 
                 return map.get(key);
             }
@@ -196,7 +196,7 @@ public abstract class GridCachePartitionedReloadAllAbstractSelfTest extends Grid
 
         fut.get();
 
-        Affinity aff = ignite(0).affinity(null);
+        Affinity aff = ignite(0).affinity(DEFAULT_CACHE_NAME);
 
         for (IgniteCache<Integer, String> cache : caches) {
             for (Integer key : map.keySet()) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadEventsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadEventsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadEventsAbstractSelfTest.java
index adbf1b7..59af680 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadEventsAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCachePreloadEventsAbstractSelfTest.java
@@ -98,7 +98,7 @@ public abstract class GridCachePreloadEventsAbstractSelfTest extends GridCommonA
     public void testPreloadEvents() throws Exception {
         Ignite g1 = startGrid("g1");
 
-        IgniteCache<Integer, String> cache = g1.cache(null);
+        IgniteCache<Integer, String> cache = g1.cache(DEFAULT_CACHE_NAME);
 
         cache.put(1, "val1");
         cache.put(2, "val2");
@@ -122,7 +122,7 @@ public abstract class GridCachePreloadEventsAbstractSelfTest extends GridCommonA
         for (Event evt : evts) {
             CacheEvent cacheEvt = (CacheEvent)evt;
             assertEquals(EVT_CACHE_REBALANCE_OBJECT_LOADED, cacheEvt.type());
-            assertEquals(g.cache(null).getName(), cacheEvt.cacheName());
+            assertEquals(g.cache(DEFAULT_CACHE_NAME).getName(), cacheEvt.cacheName());
             assertEquals(g.cluster().localNode().id(), cacheEvt.node().id());
             assertEquals(g.cluster().localNode().id(), cacheEvt.eventNode().id());
             assertTrue(cacheEvt.hasNewValue());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
index a48e1b6..6f27ce7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheTransformEventSelfTest.java
@@ -123,7 +123,7 @@ public class GridCacheTransformEventSelfTest extends GridCommonAbstractTest {
         tCfg.setDefaultTxConcurrency(txConcurrency);
         tCfg.setDefaultTxIsolation(txIsolation);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(CACHE_NAME);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateNodeRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateNodeRestartTest.java
index 69e97d8..ee1b48e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateNodeRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteBinaryMetadataUpdateNodeRestartTest.java
@@ -101,7 +101,7 @@ public class IgniteBinaryMetadataUpdateNodeRestartTest extends GridCommonAbstrac
      * @return Cache configuration.
      */
     private CacheConfiguration cacheConfiguration(String name, CacheAtomicityMode atomicityMode) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
index 6d7ec90..3864fc5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCache150ClientsTest.java
@@ -74,7 +74,7 @@ public class IgniteCache150ClientsTest extends GridCommonAbstractTest {
         CacheConfiguration[] ccfgs = new CacheConfiguration[CACHES];
 
         for (int i = 0 ; i < ccfgs.length; i++) {
-            CacheConfiguration ccfg = new CacheConfiguration();
+            CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             ccfg.setCacheMode(PARTITIONED);
             ccfg.setAtomicityMode(i % 2 == 0 ? ATOMIC : TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
index 8fd8b81..9fe41f2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeChangingTopologyTest.java
@@ -173,7 +173,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
      */
     private void atomicPut(final boolean putAll,
         @Nullable NearCacheConfiguration nearCfg) throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -207,7 +207,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite0.localNode().id());
         spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite1.localNode().id());
 
-        final IgniteCache<Integer, Integer> cache = ignite2.cache(null);
+        final IgniteCache<Integer, Integer> cache = ignite2.cache(DEFAULT_CACHE_NAME);
 
         IgniteInternalFuture<?> putFut = GridTestUtils.runAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {
@@ -295,7 +295,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
      * @throws Exception If failed.
      */
     private void atomicNoRemap() throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -317,9 +317,9 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         final Map<Integer, Integer> map = new HashMap<>();
 
-        map.put(primaryKey(ignite0.cache(null)), 0);
-        map.put(primaryKey(ignite1.cache(null)), 1);
-        map.put(primaryKey(ignite2.cache(null)), 2);
+        map.put(primaryKey(ignite0.cache(DEFAULT_CACHE_NAME)), 0);
+        map.put(primaryKey(ignite1.cache(DEFAULT_CACHE_NAME)), 1);
+        map.put(primaryKey(ignite2.cache(DEFAULT_CACHE_NAME)), 2);
 
         TestCommunicationSpi spi = (TestCommunicationSpi)ignite3.configuration().getCommunicationSpi();
 
@@ -330,7 +330,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         spi.record(GridNearAtomicFullUpdateRequest.class);
 
-        final IgniteCache<Integer, Integer> cache = ignite3.cache(null);
+        final IgniteCache<Integer, Integer> cache = ignite3.cache(DEFAULT_CACHE_NAME);
 
         IgniteInternalFuture<?> putFut = GridTestUtils.runAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {
@@ -362,9 +362,9 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         assertEquals(3, msgs.size());
 
-        map.put(primaryKey(ignite0.cache(null)), 3);
-        map.put(primaryKey(ignite1.cache(null)), 4);
-        map.put(primaryKey(ignite2.cache(null)), 5);
+        map.put(primaryKey(ignite0.cache(DEFAULT_CACHE_NAME)), 3);
+        map.put(primaryKey(ignite1.cache(DEFAULT_CACHE_NAME)), 4);
+        map.put(primaryKey(ignite2.cache(DEFAULT_CACHE_NAME)), 5);
 
         cache.putAll(map);
 
@@ -382,7 +382,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
      * @throws Exception If failed.
      */
     private void atomicGetAndPut() throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -395,7 +395,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         client = true;
 
-        ignite0.cache(null).put(0, 0);
+        ignite0.cache(DEFAULT_CACHE_NAME).put(0, 0);
 
         Ignite ignite2 = startGrid(2);
 
@@ -411,7 +411,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite0.localNode().id());
         spi.blockMessages(GridNearAtomicFullUpdateRequest.class, ignite1.localNode().id());
 
-        final IgniteCache<Integer, Integer> cache = ignite2.cache(null);
+        final IgniteCache<Integer, Integer> cache = ignite2.cache(DEFAULT_CACHE_NAME);
 
         IgniteInternalFuture<Integer> putFut = GridTestUtils.runAsync(new Callable<Integer>() {
             @Override public Integer call() throws Exception {
@@ -442,7 +442,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
      * @throws Exception If failed.
      */
     public void testTxPutAll() throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -469,7 +469,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         spi.blockMessages(GridNearTxPrepareRequest.class, ignite0.localNode().id());
         spi.blockMessages(GridNearTxPrepareRequest.class, ignite1.localNode().id());
 
-        final IgniteCache<Integer, Integer> cache = ignite2.cache(null);
+        final IgniteCache<Integer, Integer> cache = ignite2.cache(DEFAULT_CACHE_NAME);
 
         IgniteInternalFuture<?> putFut = GridTestUtils.runAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {
@@ -523,7 +523,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
      * @throws Exception If failed.
      */
     private void pessimisticTx(NearCacheConfiguration nearCfg) throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -555,7 +555,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         spi.record(GridNearLockRequest.class);
 
-        final IgniteCache<Integer, Integer> cache = ignite2.cache(null);
+        final IgniteCache<Integer, Integer> cache = ignite2.cache(DEFAULT_CACHE_NAME);
 
         IgniteInternalFuture<?> putFut = GridTestUtils.runAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {
@@ -670,17 +670,17 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
             new AffinityTopologyVersion(topVer + 1),
             1);
 
-        AffinityFunction affFunc = ignite.cache(null).getConfiguration(CacheConfiguration.class).getAffinity();
+        AffinityFunction affFunc = ignite.cache(DEFAULT_CACHE_NAME).getConfiguration(CacheConfiguration.class).getAffinity();
 
         List<List<ClusterNode>> newAff = affFunc.assignPartitions(ctx);
 
-        List<List<ClusterNode>> curAff = ((IgniteKernal)ignite).context().cache().internalCache(null).context().
+        List<List<ClusterNode>> curAff = ((IgniteKernal)ignite).context().cache().internalCache(DEFAULT_CACHE_NAME).context().
             affinity().assignments(new AffinityTopologyVersion(topVer));
 
         Integer key1 = null;
         Integer key2 = null;
 
-        Affinity<Integer> aff = ignite.affinity(null);
+        Affinity<Integer> aff = ignite.affinity(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < curAff.size(); i++) {
             if (key1 == null) {
@@ -733,7 +733,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
      * @throws Exception If failed.
      */
     public void testPessimisticTx2() throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -755,7 +755,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         AffinityTopologyVersion topVer1 = new AffinityTopologyVersion(4, 0);
 
-        assertEquals(topVer1, ignite0.context().cache().internalCache(null).context().topology().topologyVersion());
+        assertEquals(topVer1, ignite0.context().cache().internalCache(DEFAULT_CACHE_NAME).context().topology().topologyVersion());
 
         TestCommunicationSpi spi = (TestCommunicationSpi)ignite3.configuration().getCommunicationSpi();
 
@@ -769,7 +769,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         spi.blockMessages(GridNearLockRequest.class, ignite1.localNode().id());
         spi.blockMessages(GridNearLockRequest.class, ignite2.localNode().id());
 
-        final IgniteCache<Integer, Integer> cache = ignite3.cache(null);
+        final IgniteCache<Integer, Integer> cache = ignite3.cache(DEFAULT_CACHE_NAME);
 
         IgniteInternalFuture<?> putFut = GridTestUtils.runAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {
@@ -796,9 +796,9 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         ignite0.context().cache().context().exchange().affinityReadyFuture(topVer2).get();
 
-        assertEquals(topVer2, ignite0.context().cache().internalCache(null).context().topology().topologyVersion());
+        assertEquals(topVer2, ignite0.context().cache().internalCache(DEFAULT_CACHE_NAME).context().topology().topologyVersion());
 
-        GridCacheAffinityManager aff = ignite0.context().cache().internalCache(null).context().affinity();
+        GridCacheAffinityManager aff = ignite0.context().cache().internalCache(DEFAULT_CACHE_NAME).context().affinity();
 
         List<ClusterNode> nodes1 = aff.nodesByKey(key1, topVer1);
         List<ClusterNode> nodes2 = aff.nodesByKey(key1, topVer2);
@@ -840,7 +840,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
      * @throws Exception If failed.
      */
     private void pessimisticTxNoRemap(@Nullable NearCacheConfiguration nearCfg) throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -864,7 +864,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         TestCommunicationSpi spi = (TestCommunicationSpi)ignite3.configuration().getCommunicationSpi();
 
         for (int i = 0; i < 100; i++)
-            primaryCache(i, null).put(i, -1);
+            primaryCache(i, DEFAULT_CACHE_NAME).put(i, -1);
 
         final Map<Integer, Integer> map = new HashMap<>();
 
@@ -877,7 +877,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         spi.record(GridNearLockRequest.class);
 
-        final IgniteCache<Integer, Integer> cache = ignite3.cache(null);
+        final IgniteCache<Integer, Integer> cache = ignite3.cache(DEFAULT_CACHE_NAME);
 
         IgniteInternalFuture<?> putFut = GridTestUtils.runAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {
@@ -945,7 +945,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
      * @throws Exception If failed.
      */
     private void optimisticSerializableTx(NearCacheConfiguration nearCfg) throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -977,7 +977,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         spi.record(GridNearTxPrepareRequest.class);
 
-        final IgniteCache<Integer, Integer> cache = ignite2.cache(null);
+        final IgniteCache<Integer, Integer> cache = ignite2.cache(DEFAULT_CACHE_NAME);
 
         IgniteInternalFuture<?> putFut = GridTestUtils.runAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {
@@ -1097,7 +1097,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
      * @throws Exception If failed.
      */
     private void lock(NearCacheConfiguration nearCfg) throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -1127,7 +1127,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         spi.blockMessages(GridNearLockRequest.class, ignite0.localNode().id());
         spi.blockMessages(GridNearLockRequest.class, ignite1.localNode().id());
 
-        final IgniteCache<Integer, Integer> cache = ignite2.cache(null);
+        final IgniteCache<Integer, Integer> cache = ignite2.cache(DEFAULT_CACHE_NAME);
 
         final CountDownLatch lockedLatch = new CountDownLatch(1);
 
@@ -1165,7 +1165,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         assertTrue(lockedLatch.await(3000, TimeUnit.MILLISECONDS));
 
-        IgniteCache<Integer, Integer> cache0 = ignite0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = ignite0.cache(DEFAULT_CACHE_NAME);
 
         for (Integer key : keys) {
             Lock lock = cache0.lock(key);
@@ -1190,7 +1190,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
             }
 
             private boolean unlocked(Ignite ignite) {
-                IgniteCache<Integer, Integer> cache = ignite.cache(null);
+                IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                 for (Integer key : keys) {
                     if (cache.isLocalLocked(key, false)) {
@@ -1219,7 +1219,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
      * @throws Exception If failed.
      */
     public void testPessimisticTxMessageClientFirstFlag() throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -1243,9 +1243,9 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         spi.record(GridNearLockRequest.class);
 
-        IgniteCache<Integer, Integer> cache = ignite3.cache(null);
+        IgniteCache<Integer, Integer> cache = ignite3.cache(DEFAULT_CACHE_NAME);
 
-        Affinity<Integer> aff = ignite0.affinity(null);
+        Affinity<Integer> aff = ignite0.affinity(DEFAULT_CACHE_NAME);
 
         try (Transaction tx = ignite3.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
             Integer key1 = findKey(aff, 1);
@@ -1263,10 +1263,10 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         Map<Integer, Integer> map = new LinkedHashMap<>();
 
-        map.put(primaryKey(ignite0.cache(null)), 4);
-        map.put(primaryKey(ignite1.cache(null)), 5);
-        map.put(primaryKey(ignite2.cache(null)), 6);
-        map.put(primaryKeys(ignite0.cache(null), 1, 10_000).get(0), 7);
+        map.put(primaryKey(ignite0.cache(DEFAULT_CACHE_NAME)), 4);
+        map.put(primaryKey(ignite1.cache(DEFAULT_CACHE_NAME)), 5);
+        map.put(primaryKey(ignite2.cache(DEFAULT_CACHE_NAME)), 6);
+        map.put(primaryKeys(ignite0.cache(DEFAULT_CACHE_NAME), 1, 10_000).get(0), 7);
 
         try (Transaction tx = ignite3.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
             cache.putAll(map);
@@ -1282,9 +1282,9 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         spi0.record(GridNearLockRequest.class);
 
-        List<Integer> keys = primaryKeys(ignite1.cache(null), 3, 0);
+        List<Integer> keys = primaryKeys(ignite1.cache(DEFAULT_CACHE_NAME), 3, 0);
 
-        IgniteCache<Integer, Integer> cache0 = ignite0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = ignite0.cache(DEFAULT_CACHE_NAME);
 
         try (Transaction tx = ignite0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
             cache0.put(keys.get(0), 0);
@@ -1319,7 +1319,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
      * @throws Exception If failed.
      */
     public void testOptimisticTxMessageClientFirstFlag() throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -1341,11 +1341,11 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         TestCommunicationSpi spi = (TestCommunicationSpi)ignite3.configuration().getCommunicationSpi();
 
-        IgniteCache<Integer, Integer> cache = ignite3.cache(null);
+        IgniteCache<Integer, Integer> cache = ignite3.cache(DEFAULT_CACHE_NAME);
 
-        List<Integer> keys0 = primaryKeys(ignite0.cache(null), 2, 0);
-        List<Integer> keys1 = primaryKeys(ignite1.cache(null), 2, 0);
-        List<Integer> keys2 = primaryKeys(ignite2.cache(null), 2, 0);
+        List<Integer> keys0 = primaryKeys(ignite0.cache(DEFAULT_CACHE_NAME), 2, 0);
+        List<Integer> keys1 = primaryKeys(ignite1.cache(DEFAULT_CACHE_NAME), 2, 0);
+        List<Integer> keys2 = primaryKeys(ignite2.cache(DEFAULT_CACHE_NAME), 2, 0);
 
         LinkedHashMap<Integer, Integer> map = new LinkedHashMap<>();
 
@@ -1377,7 +1377,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         checkData(map, null, cache, 4);
 
-        IgniteCache<Integer, Integer> cache0 = ignite0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = ignite0.cache(DEFAULT_CACHE_NAME);
 
         TestCommunicationSpi spi0 = (TestCommunicationSpi)ignite0.configuration().getCommunicationSpi();
 
@@ -1414,7 +1414,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
      * @throws Exception If failed.
      */
     public void testLockRemoveAfterClientFailed() throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -1431,7 +1431,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         assertTrue(ignite2.configuration().isClientMode());
 
-        IgniteCache<Integer, Integer> cache2 = ignite2.cache(null);
+        IgniteCache<Integer, Integer> cache2 = ignite2.cache(DEFAULT_CACHE_NAME);
 
         final Integer key = 0;
 
@@ -1441,11 +1441,11 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         ignite2.close();
 
-        IgniteCache<Integer, Integer> cache0 = ignite0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = ignite0.cache(DEFAULT_CACHE_NAME);
 
         assertFalse(cache0.isLocalLocked(key, false));
 
-        IgniteCache<Integer, Integer> cache1 = ignite1.cache(null);
+        IgniteCache<Integer, Integer> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
 
         assertFalse(cache1.isLocalLocked(key, false));
 
@@ -1459,7 +1459,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         assertTrue(ignite2.configuration().isClientMode());
 
-        cache2 = ignite2.cache(null);
+        cache2 = ignite2.cache(DEFAULT_CACHE_NAME);
 
         lock2 = cache2.lock(0);
 
@@ -1472,7 +1472,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
      * @throws Exception If failed.
      */
     public void testLockFromClientBlocksExchange() throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -1487,7 +1487,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
         Ignite ignite2 = startGrid(2);
 
-        IgniteCache<Integer, Integer> cache = ignite2.cache(null);
+        IgniteCache<Integer, Integer> cache = ignite2.cache(DEFAULT_CACHE_NAME);
 
         Lock lock = cache.lock(0);
 
@@ -1549,7 +1549,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
     {
         final List<Ignite> nodes = G.allGrids();
 
-        final Affinity<Integer> aff = nodes.get(0).affinity(null);
+        final Affinity<Integer> aff = nodes.get(0).affinity(DEFAULT_CACHE_NAME);
 
         assertEquals(expNodes, nodes.size());
 
@@ -1569,7 +1569,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
                         Object val = null;
 
                         for (Ignite node : nodes) {
-                            IgniteCache<Integer, Integer> cache = node.cache(null);
+                            IgniteCache<Integer, Integer> cache = node.cache(DEFAULT_CACHE_NAME);
 
                             boolean affNode = aff.isPrimaryOrBackup(node.cluster().localNode(), key);
 
@@ -1581,7 +1581,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
                                 else
                                     assertNotNull("Unexpected value for " + node.name(), val0);
 
-                                GridCacheAdapter cache0 = ((IgniteKernal)node).internalCache(null);
+                                GridCacheAdapter cache0 = ((IgniteKernal)node).internalCache(DEFAULT_CACHE_NAME);
 
                                 if (affNode && cache0.isNear())
                                     cache0 = ((GridNearCacheAdapter)cache0).dht();
@@ -1686,7 +1686,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
      */
     private void multinode(CacheAtomicityMode atomicityMode, final TestType testType)
         throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -1734,7 +1734,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
                     Thread.currentThread().setName("update-thread-" + ignite.name());
 
-                    IgniteCache<Integer, Integer> cache = ignite.cache(null);
+                    IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                     boolean useTx = testType == TestType.OPTIMISTIC_TX ||
                         testType == TestType.OPTIMISTIC_SERIALIZABLE_TX ||
@@ -1817,7 +1817,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
 
                     IgniteEx ignite = startGrid(SRV_CNT + CLIENT_CNT);
 
-                    IgniteCache<Integer, Integer> cache = ignite.cache(null);
+                    IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                     assertNotNull(cache);
                 }
@@ -1904,14 +1904,14 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         fut.get(30_000);
 
         if (testType != TestType.LOCK)
-            checkData(null, putKeys, grid(SRV_CNT).cache(null), SRV_CNT + CLIENT_CNT);
+            checkData(null, putKeys, grid(SRV_CNT).cache(DEFAULT_CACHE_NAME), SRV_CNT + CLIENT_CNT);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testServersLeaveOnStart() throws Exception {
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setBackups(1);
@@ -1957,7 +1957,7 @@ public class IgniteCacheClientNodeChangingTopologyTest extends GridCommonAbstrac
         for (int i = 0; i < CLIENTS; i++) {
             Ignite ignite = grid(i + 2);
 
-            IgniteCache<Integer, Integer> cache = ignite.cache(null);
+            IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             cache.put(i, i);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeConcurrentStart.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeConcurrentStart.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeConcurrentStart.java
index 56a0acc..cdb6913 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeConcurrentStart.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodeConcurrentStart.java
@@ -63,7 +63,7 @@ public class IgniteCacheClientNodeConcurrentStart extends GridCommonAbstractTest
 
         cfg.setClientMode(client);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setBackups(0);
         ccfg.setRebalanceMode(SYNC);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
index d07398d..0885b1a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientNodePartitionsExchangeTest.java
@@ -76,7 +76,7 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
 
         cfg.setClientMode(client);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cfg.setCacheConfiguration(ccfg);
 
@@ -114,7 +114,7 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
 
         GridTestUtils.assertThrows(log, new Callable<Void>() {
             @Override public Void call() throws Exception {
-                ignite1.cache(null).get(1);
+                ignite1.cache(DEFAULT_CACHE_NAME).get(1);
 
                 return null;
             }
@@ -122,7 +122,7 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
 
         GridTestUtils.assertThrows(log, new Callable<Void>() {
             @Override public Void call() throws Exception {
-                ignite2.cache(null).get(1);
+                ignite2.cache(DEFAULT_CACHE_NAME).get(1);
 
                 return null;
             }
@@ -134,7 +134,7 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
 
         GridTestUtils.assertThrows(log, new Callable<Void>() {
             @Override public Void call() throws Exception {
-                ignite2.cache(null).get(1);
+                ignite2.cache(DEFAULT_CACHE_NAME).get(1);
 
                 return null;
             }
@@ -427,12 +427,12 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
 
         Ignite ignite0 = it.next();
 
-        Affinity<Integer> aff0 = ignite0.affinity(null);
+        Affinity<Integer> aff0 = ignite0.affinity(DEFAULT_CACHE_NAME);
 
         while (it.hasNext()) {
             Ignite ignite = it.next();
 
-            Affinity<Integer> aff = ignite.affinity(null);
+            Affinity<Integer> aff = ignite.affinity(DEFAULT_CACHE_NAME);
 
             assertEquals(aff0.partitions(), aff.partitions());
 
@@ -498,7 +498,7 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
 
         final String CACHE_NAME1 = "cache1";
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(CACHE_NAME1);
 
@@ -577,7 +577,7 @@ public class IgniteCacheClientNodePartitionsExchangeTest extends GridCommonAbstr
 
         final String CACHE_NAME2 = "cache2";
 
-        ccfg = new CacheConfiguration();
+        ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(CACHE_NAME2);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java
index bdff0f2..ced1a7d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheClientReconnectTest.java
@@ -69,7 +69,7 @@ public class IgniteCacheClientReconnectTest extends GridCommonAbstractTest {
             CacheConfiguration[] ccfgs = new CacheConfiguration[CACHES];
 
             for (int i = 0; i < CACHES; i++) {
-                CacheConfiguration ccfg = new CacheConfiguration();
+                CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
                 ccfg.setCacheMode(PARTITIONED);
                 ccfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java
index 7c454e6..5578640 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheConnectionRecoveryTest.java
@@ -191,7 +191,7 @@ public class IgniteCacheConnectionRecoveryTest extends GridCommonAbstractTest {
      * @return Configuration.
      */
     private CacheConfiguration cacheConfiguration(String name, CacheAtomicityMode atomicityMode) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(name);
         ccfg.setAtomicityMode(atomicityMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java
index 40440e0..c754b38 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheCreatePutTest.java
@@ -72,7 +72,7 @@ public class IgniteCacheCreatePutTest extends GridCommonAbstractTest {
 
         cfg.setMarshaller(marsh);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName("cache*");
         ccfg.setCacheMode(PARTITIONED);
@@ -198,7 +198,7 @@ public class IgniteCacheCreatePutTest extends GridCommonAbstractTest {
                 while (System.currentTimeMillis() < stopTime) {
                     String cacheName = "dynamic-cache-" + nodeIdx;
 
-                    CacheConfiguration ccfg = new CacheConfiguration();
+                    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
                     ccfg.setName(cacheName);
 
@@ -240,7 +240,7 @@ public class IgniteCacheCreatePutTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     private CacheConfiguration cacheConfiguration(String name, CacheAtomicityMode atomicityMode) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setName(name);
         ccfg.setCacheMode(REPLICATED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGetRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGetRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGetRestartTest.java
index 69d9123..d0c380e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGetRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheGetRestartTest.java
@@ -269,7 +269,7 @@ public class IgniteCacheGetRestartTest extends GridCommonAbstractTest {
      * @return Cache configuration.
      */
     private CacheConfiguration<Object, Object> cacheConfiguration(CacheMode cacheMode, int backups, boolean near) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(cacheMode);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheManyClientsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheManyClientsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheManyClientsTest.java
index c12852a..a0be40e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheManyClientsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheManyClientsTest.java
@@ -89,7 +89,7 @@ public class IgniteCacheManyClientsTest extends GridCommonAbstractTest {
 
         cfg.setClientMode(client);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(ATOMIC);
@@ -166,7 +166,7 @@ public class IgniteCacheManyClientsTest extends GridCommonAbstractTest {
 
             clients.add(ignite);
 
-            IgniteCache<Object, Object> cache = ignite.cache(null);
+            IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
             Integer key = rnd.nextInt(0, 1000);
 
@@ -241,7 +241,7 @@ public class IgniteCacheManyClientsTest extends GridCommonAbstractTest {
 
                             assertTrue(ignite.configuration().isClientMode());
 
-                            IgniteCache<Object, Object> cache = ignite.cache(null);
+                            IgniteCache<Object, Object> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                             ThreadLocalRandom rnd = ThreadLocalRandom.current();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryAbstractTest.java
index d25b798..f80985d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryAbstractTest.java
@@ -103,7 +103,7 @@ public abstract class IgniteCacheMessageRecoveryAbstractTest extends GridCommonA
 
             GridTestUtils.retryAssert(log, 10, 500, new CA() {
                 @Override public void apply() {
-                    assertTrue(grid.internalCache().context().mvcc().atomicFutures().isEmpty());
+                    assertTrue(grid.internalCache(DEFAULT_CACHE_NAME).context().mvcc().atomicFutures().isEmpty());
                 }
             });
         }
@@ -115,7 +115,7 @@ public abstract class IgniteCacheMessageRecoveryAbstractTest extends GridCommonA
     public void testMessageRecovery() throws Exception {
         final Ignite ignite = grid(0);
 
-        final IgniteCache<Object, String> cache = ignite.cache(null);
+        final IgniteCache<Object, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         Map<Integer, String> map = new HashMap<>();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java
index 10bb3c1..25cb400 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheMessageRecoveryIdleConnectionTest.java
@@ -107,7 +107,7 @@ public class IgniteCacheMessageRecoveryIdleConnectionTest extends GridCommonAbst
      * @throws Exception If failed.
      */
     private void cacheOperationsIdleConnectionClose(CacheAtomicityMode atomicityMode) throws Exception {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(atomicityMode);
         ccfg.setCacheMode(REPLICATED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheNearRestartRollbackSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheNearRestartRollbackSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheNearRestartRollbackSelfTest.java
index 907922c..79f15ad 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheNearRestartRollbackSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheNearRestartRollbackSelfTest.java
@@ -97,7 +97,7 @@ public class IgniteCacheNearRestartRollbackSelfTest extends GridCommonAbstractTe
      * @return Cache configuration.
      */
     protected CacheConfiguration<Object, Object> cacheConfiguration(String igniteInstanceName) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
 
@@ -205,7 +205,7 @@ public class IgniteCacheNearRestartRollbackSelfTest extends GridCommonAbstractTe
         boolean rollback,
         Set<Integer> keys
     ) {
-        final IgniteCache<Integer, Integer> cache = ignite.cache(null);
+        final IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
         if (rollback) {
             while (true) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTest.java
index df70778..4faf76b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCachePrimarySyncTest.java
@@ -61,13 +61,13 @@ public class IgniteCachePrimarySyncTest extends GridCommonAbstractTest {
 
         ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
 
-        CacheConfiguration<Object, Object> ccfg1 = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg1 = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         ccfg1.setName("cache1");
         ccfg1.setAtomicityMode(ATOMIC);
         ccfg1.setBackups(2);
         ccfg1.setWriteSynchronizationMode(PRIMARY_SYNC);
 
-        CacheConfiguration<Object, Object> ccfg2 = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg2 = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
         ccfg2.setName("cache2");
         ccfg2.setAtomicityMode(TRANSACTIONAL);
         ccfg2.setBackups(2);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheReadFromBackupTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheReadFromBackupTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheReadFromBackupTest.java
index 42de613..1433daa 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheReadFromBackupTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheReadFromBackupTest.java
@@ -386,7 +386,7 @@ public class IgniteCacheReadFromBackupTest extends GridCommonAbstractTest {
         CacheAtomicityMode atomicityMode,
         int backups,
         boolean nearEnabled) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(cacheMode);
         ccfg.setAtomicityMode(atomicityMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheServerNodeConcurrentStart.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheServerNodeConcurrentStart.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheServerNodeConcurrentStart.java
index c47e867..0b5280d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheServerNodeConcurrentStart.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheServerNodeConcurrentStart.java
@@ -48,20 +48,20 @@ public class IgniteCacheServerNodeConcurrentStart extends GridCommonAbstractTest
 
         ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
 
-        CacheConfiguration ccfg1 = new CacheConfiguration();
+        CacheConfiguration ccfg1 = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg1.setName("cache-1");
         ccfg1.setCacheMode(REPLICATED);
         ccfg1.setRebalanceMode(SYNC);
 
-        CacheConfiguration ccfg2 = new CacheConfiguration();
+        CacheConfiguration ccfg2 = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg2.setName("cache-2");
         ccfg2.setCacheMode(PARTITIONED);
         ccfg2.setRebalanceMode(SYNC);
         ccfg2.setBackups(2);
 
-        CacheConfiguration ccfg3 = new CacheConfiguration();
+        CacheConfiguration ccfg3 = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg3.setName("cache-3");
         ccfg3.setCacheMode(PARTITIONED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSingleGetMessageTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSingleGetMessageTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSingleGetMessageTest.java
index 9d3f439..d8d5374 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSingleGetMessageTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSingleGetMessageTest.java
@@ -300,7 +300,7 @@ public class IgniteCacheSingleGetMessageTest extends GridCommonAbstractTest {
         CacheAtomicityMode atomicityMode,
         CacheWriteSynchronizationMode syncMode,
         int backups) {
-        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(cacheMode);
         ccfg.setAtomicityMode(atomicityMode);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java
index b61b0db..cd85950 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSizeFailoverTest.java
@@ -51,7 +51,7 @@ public class IgniteCacheSizeFailoverTest extends GridCommonAbstractTest {
 
         ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(ATOMIC);
@@ -84,7 +84,7 @@ public class IgniteCacheSizeFailoverTest extends GridCommonAbstractTest {
             @Override public Object call() throws Exception {
                 int idx = cntr.getAndIncrement() % 2;
 
-                IgniteCache<Object, Object> cache = ignite(idx).cache(null);
+                IgniteCache<Object, Object> cache = ignite(idx).cache(DEFAULT_CACHE_NAME);
 
                 long cntr = 0;
 
@@ -105,7 +105,7 @@ public class IgniteCacheSizeFailoverTest extends GridCommonAbstractTest {
 
                 Ignite node = startGrid(3);
 
-                IgniteCache<Object, Object> cache = node.cache(null);
+                IgniteCache<Object, Object> cache = node.cache(DEFAULT_CACHE_NAME);
 
                 for (int j = 0; j < 100; j++)
                     assertTrue(cache.size() >= 0);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSystemTransactionsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSystemTransactionsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSystemTransactionsSelfTest.java
index f821a45..e667c49 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSystemTransactionsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteCacheSystemTransactionsSelfTest.java
@@ -56,7 +56,7 @@ public class IgniteCacheSystemTransactionsSelfTest extends GridCacheAbstractSelf
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-        for (String cacheName : new String[] {null, CU.UTILITY_CACHE_NAME}) {
+        for (String cacheName : new String[] {DEFAULT_CACHE_NAME, CU.UTILITY_CACHE_NAME}) {
             IgniteKernal kernal = (IgniteKernal)ignite(0);
 
             GridCacheAdapter<Object, Object> cache = kernal.context().cache().internalCache(cacheName);
@@ -71,7 +71,7 @@ public class IgniteCacheSystemTransactionsSelfTest extends GridCacheAbstractSelf
     public void testSystemTxInsideUserTx() throws Exception {
         IgniteKernal ignite = (IgniteKernal)grid(0);
 
-        IgniteCache<Object, Object> jcache = ignite.cache(null);
+        IgniteCache<Object, Object> jcache = ignite.cache(DEFAULT_CACHE_NAME);
 
         try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
             jcache.get("1");
@@ -98,7 +98,7 @@ public class IgniteCacheSystemTransactionsSelfTest extends GridCacheAbstractSelf
 
         checkTransactionsCommitted();
 
-        checkEntries(null,                  "1", "11", "2", "22", "3", null);
+        checkEntries(DEFAULT_CACHE_NAME,                  "1", "11", "2", "22", "3", null);
         checkEntries(CU.UTILITY_CACHE_NAME, "1", null, "2", "2",  "3", "3");
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteNoClassOnServerAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteNoClassOnServerAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteNoClassOnServerAbstractTest.java
index 4357ae7..1d92376 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteNoClassOnServerAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteNoClassOnServerAbstractTest.java
@@ -87,7 +87,7 @@ public abstract class IgniteNoClassOnServerAbstractTest extends GridCommonAbstra
         }
 
         try (Ignite ignite = Ignition.start(createConfiguration())) {
-            CacheConfiguration cfg = new CacheConfiguration();
+            CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
             cfg.setCopyOnRead(true); // To store only value bytes.
 


[36/51] [abbrv] ignite git commit: IGNITE-3488: Prohibited null as cache name. This closes #1790.

Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java
index 91e6cf6..55d7fe4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCachePrimarySyncTest.java
@@ -61,6 +61,7 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
+import org.jetbrains.annotations.NotNull;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_ASYNC;
@@ -139,13 +140,13 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testSingleKeyCommitFromPrimary() throws Exception {
-        singleKeyCommitFromPrimary(cacheConfiguration(null, PRIMARY_SYNC, 1, true, false));
+        singleKeyCommitFromPrimary(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 1, true, false));
 
-        singleKeyCommitFromPrimary(cacheConfiguration(null, PRIMARY_SYNC, 2, false, false));
+        singleKeyCommitFromPrimary(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 2, false, false));
 
-        singleKeyCommitFromPrimary(cacheConfiguration(null, PRIMARY_SYNC, 2, false, true));
+        singleKeyCommitFromPrimary(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 2, false, true));
 
-        singleKeyCommitFromPrimary(cacheConfiguration(null, PRIMARY_SYNC, 3, false, false));
+        singleKeyCommitFromPrimary(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 3, false, false));
     }
 
     /**
@@ -228,7 +229,7 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
             Ignite node = ignite(i);
 
             if (node != ignite)
-                assertNull(node.cache(null).localPeek(key));
+                assertNull(node.cache(DEFAULT_CACHE_NAME).localPeek(key));
         }
 
         commSpi0.stopBlock(true);
@@ -252,18 +253,18 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testSingleKeyPrimaryNodeFail1() throws Exception {
-        singleKeyPrimaryNodeLeft(cacheConfiguration(null, PRIMARY_SYNC, 1, true, false));
+        singleKeyPrimaryNodeLeft(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 1, true, false));
 
-        singleKeyPrimaryNodeLeft(cacheConfiguration(null, PRIMARY_SYNC, 2, false, false));
+        singleKeyPrimaryNodeLeft(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 2, false, false));
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testSingleKeyPrimaryNodeFail2() throws Exception {
-        singleKeyPrimaryNodeLeft(cacheConfiguration(null, PRIMARY_SYNC, 2, true, false));
+        singleKeyPrimaryNodeLeft(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 2, true, false));
 
-        singleKeyPrimaryNodeLeft(cacheConfiguration(null, PRIMARY_SYNC, 3, false, false));
+        singleKeyPrimaryNodeLeft(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 3, false, false));
     }
 
     /**
@@ -377,13 +378,13 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testSingleKeyCommit() throws Exception {
-        singleKeyCommit(cacheConfiguration(null, PRIMARY_SYNC, 1, true, false));
+        singleKeyCommit(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 1, true, false));
 
-        singleKeyCommit(cacheConfiguration(null, PRIMARY_SYNC, 2, false, false));
+        singleKeyCommit(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 2, false, false));
 
-        singleKeyCommit(cacheConfiguration(null, PRIMARY_SYNC, 2, false, true));
+        singleKeyCommit(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 2, false, true));
 
-        singleKeyCommit(cacheConfiguration(null, PRIMARY_SYNC, 3, false, false));
+        singleKeyCommit(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 3, false, false));
     }
 
     /**
@@ -485,9 +486,9 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
             if (nearCache
                 && node == client &&
                 !node.affinity(ccfg.getName()).isPrimaryOrBackup(node.cluster().localNode(), key))
-                assertEquals("Invalid value for node: " + i, key, ignite(i).cache(null).localPeek(key));
+                assertEquals("Invalid value for node: " + i, key, ignite(i).cache(DEFAULT_CACHE_NAME).localPeek(key));
             else
-                assertNull("Invalid value for node: " + i, ignite(i).cache(null).localPeek(key));
+                assertNull("Invalid value for node: " + i, ignite(i).cache(DEFAULT_CACHE_NAME).localPeek(key));
         }
 
         commSpi0.stopBlock(true);
@@ -519,13 +520,13 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testWaitPrimaryResponse() throws Exception {
-        checkWaitPrimaryResponse(cacheConfiguration(null, PRIMARY_SYNC, 1, true, false));
+        checkWaitPrimaryResponse(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 1, true, false));
 
-        checkWaitPrimaryResponse(cacheConfiguration(null, PRIMARY_SYNC, 2, false, false));
+        checkWaitPrimaryResponse(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 2, false, false));
 
-        checkWaitPrimaryResponse(cacheConfiguration(null, PRIMARY_SYNC, 2, false, true));
+        checkWaitPrimaryResponse(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 2, false, true));
 
-        checkWaitPrimaryResponse(cacheConfiguration(null, PRIMARY_SYNC, 3, false, false));
+        checkWaitPrimaryResponse(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 3, false, false));
     }
 
     /**
@@ -657,7 +658,7 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testOnePhaseMessages() throws Exception {
-        checkOnePhaseMessages(cacheConfiguration(null, PRIMARY_SYNC, 1, false, false));
+        checkOnePhaseMessages(cacheConfiguration(DEFAULT_CACHE_NAME, PRIMARY_SYNC, 1, false, false));
     }
 
     /**
@@ -1071,12 +1072,12 @@ public class IgniteTxCachePrimarySyncTest extends GridCommonAbstractTest {
      * @param nearCache If {@code true} configures near cache.
      * @return Cache configuration.
      */
-    private CacheConfiguration<Object, Object> cacheConfiguration(String name,
+    private CacheConfiguration<Object, Object> cacheConfiguration(@NotNull String name,
         CacheWriteSynchronizationMode syncMode,
         int backups,
         boolean store,
         boolean nearCache) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setName(name);
         ccfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java
index 403aed8..d23e870 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxCacheWriteSynchronizationModesMultithreadedTest.java
@@ -51,6 +51,7 @@ import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionOptimisticException;
+import org.jetbrains.annotations.NotNull;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_ASYNC;
@@ -195,7 +196,7 @@ public class IgniteTxCacheWriteSynchronizationModesMultithreadedTest extends Gri
         boolean restart) throws Exception {
         final Ignite ignite = ignite(0);
 
-        createCache(ignite, cacheConfiguration(null, syncMode, backups, store), nearCache);
+        createCache(ignite, cacheConfiguration(DEFAULT_CACHE_NAME, syncMode, backups, store), nearCache);
 
         final AtomicBoolean stop = new AtomicBoolean();
 
@@ -303,7 +304,7 @@ public class IgniteTxCacheWriteSynchronizationModesMultithreadedTest extends Gri
         finally {
             stop.set(true);
 
-            ignite.destroyCache(null);
+            ignite.destroyCache(DEFAULT_CACHE_NAME);
 
             if (restartFut != null)
                 restartFut.get();
@@ -325,14 +326,14 @@ public class IgniteTxCacheWriteSynchronizationModesMultithreadedTest extends Gri
 
                 Ignite ignite = ignite(nodeIdx);
 
-                IgniteCache<Integer, Integer> cache = ignite.cache(null);
+                IgniteCache<Integer, Integer> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                 while (System.currentTimeMillis() < stopTime)
                     c.apply(ignite, cache);
             }
         }, NODES * 3, "tx-thread");
 
-        final IgniteCache<Integer, Integer> cache = ignite(0).cache(null);
+        final IgniteCache<Integer, Integer> cache = ignite(0).cache(DEFAULT_CACHE_NAME);
 
         for (int key = 0; key < MULTITHREADED_TEST_KEYS; key++) {
             final Integer key0 = key;
@@ -342,7 +343,7 @@ public class IgniteTxCacheWriteSynchronizationModesMultithreadedTest extends Gri
                     final Integer val = cache.get(key0);
 
                     for (int i = 1; i < NODES; i++) {
-                        IgniteCache<Integer, Integer> cache = ignite(i).cache(null);
+                        IgniteCache<Integer, Integer> cache = ignite(i).cache(DEFAULT_CACHE_NAME);
 
                         if (!Objects.equals(val, cache.get(key0)))
                             return false;
@@ -378,11 +379,11 @@ public class IgniteTxCacheWriteSynchronizationModesMultithreadedTest extends Gri
      * @param store If {@code true} configures cache store.
      * @return Cache configuration.
      */
-    private CacheConfiguration<Object, Object> cacheConfiguration(String name,
+    private CacheConfiguration<Object, Object> cacheConfiguration(@NotNull String name,
         CacheWriteSynchronizationMode syncMode,
         int backups,
         boolean store) {
-        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>();
+        CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
 
         ccfg.setName(name);
         ccfg.setAtomicityMode(TRANSACTIONAL);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConsistencyRestartAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConsistencyRestartAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConsistencyRestartAbstractSelfTest.java
index cb43275..a530cab 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConsistencyRestartAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxConsistencyRestartAbstractSelfTest.java
@@ -78,7 +78,7 @@ public abstract class IgniteTxConsistencyRestartAbstractSelfTest extends GridCom
      * @return Cache configuration.
      */
     public CacheConfiguration cacheConfiguration(String igniteInstanceName) {
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setAtomicityMode(TRANSACTIONAL);
         ccfg.setCacheMode(cacheMode());
@@ -108,7 +108,7 @@ public abstract class IgniteTxConsistencyRestartAbstractSelfTest extends GridCom
     public void testTxConsistency() throws Exception {
         startGridsMultiThreaded(GRID_CNT);
 
-        IgniteDataStreamer<Object, Object> ldr = grid(0).dataStreamer(null);
+        IgniteDataStreamer<Object, Object> ldr = grid(0).dataStreamer(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < RANGE; i++) {
             ldr.addData(i, 0);
@@ -154,7 +154,7 @@ public abstract class IgniteTxConsistencyRestartAbstractSelfTest extends GridCom
             try {
                 IgniteKernal grid = (IgniteKernal)grid(idx);
 
-                IgniteCache<Integer, Integer> cache = grid.cache(null);
+                IgniteCache<Integer, Integer> cache = grid.cache(DEFAULT_CACHE_NAME);
 
                 List<Integer> keys = new ArrayList<>();
 
@@ -192,9 +192,9 @@ public abstract class IgniteTxConsistencyRestartAbstractSelfTest extends GridCom
             for (int i = 0; i < GRID_CNT; i++) {
                 IgniteEx grid = grid(i);
 
-                IgniteCache<Integer, Integer> cache = grid.cache(null);
+                IgniteCache<Integer, Integer> cache = grid.cache(DEFAULT_CACHE_NAME);
 
-                if (grid.affinity(null).isPrimaryOrBackup(grid.localNode(), k)) {
+                if (grid.affinity(DEFAULT_CACHE_NAME).isPrimaryOrBackup(grid.localNode(), k)) {
                     if (val == null) {
                         val = cache.localPeek(k, CachePeekMode.ONHEAP);
 
@@ -202,7 +202,7 @@ public abstract class IgniteTxConsistencyRestartAbstractSelfTest extends GridCom
                     }
                     else
                         assertEquals("Failed to find value in cache [primary=" +
-                            grid.affinity(null).isPrimary(grid.localNode(), k) + ']',
+                            grid.affinity(DEFAULT_CACHE_NAME).isPrimary(grid.localNode(), k) + ']',
                             val, cache.localPeek(k, CachePeekMode.ONHEAP));
                 }
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxOriginatingNodeFailureAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxOriginatingNodeFailureAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxOriginatingNodeFailureAbstractSelfTest.java
index 982dc13..8bdfafe 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxOriginatingNodeFailureAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxOriginatingNodeFailureAbstractSelfTest.java
@@ -133,7 +133,7 @@ public abstract class IgniteTxOriginatingNodeFailureAbstractSelfTest extends Gri
         final String initVal = "initialValue";
 
         for (Integer key : keys) {
-            grid(originatingNode()).cache(null).put(key, initVal);
+            grid(originatingNode()).cache(DEFAULT_CACHE_NAME).put(key, initVal);
 
             map.put(key, String.valueOf(key));
         }
@@ -145,7 +145,7 @@ public abstract class IgniteTxOriginatingNodeFailureAbstractSelfTest extends Gri
         for (Integer key : keys) {
             Collection<ClusterNode> nodes = new ArrayList<>();
 
-            nodes.addAll(grid(1).affinity(null).mapKeyToPrimaryAndBackups(key));
+            nodes.addAll(grid(1).affinity(DEFAULT_CACHE_NAME).mapKeyToPrimaryAndBackups(key));
 
             nodes.remove(txNode);
 
@@ -162,7 +162,7 @@ public abstract class IgniteTxOriginatingNodeFailureAbstractSelfTest extends Gri
 
         GridTestUtils.runAsync(new Callable<Object>() {
             @Override public Object call() throws Exception {
-                IgniteCache<Integer, String> cache = txIgniteNode.cache(null);
+                IgniteCache<Integer, String> cache = txIgniteNode.cache(DEFAULT_CACHE_NAME);
 
                 assertNotNull(cache);
 
@@ -224,7 +224,7 @@ public abstract class IgniteTxOriginatingNodeFailureAbstractSelfTest extends Gri
                     private Ignite ignite;
 
                     @Override public Void call() throws Exception {
-                        IgniteCache<Integer, String> cache = ignite.cache(null);
+                        IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                         assertNotNull(cache);
 
@@ -241,7 +241,7 @@ public abstract class IgniteTxOriginatingNodeFailureAbstractSelfTest extends Gri
                 UUID locNodeId = g.cluster().localNode().id();
 
                 assertEquals("Check failed for node: " + locNodeId, partial ? initVal : e.getValue(),
-                    g.cache(null).get(e.getKey()));
+                    g.cache(DEFAULT_CACHE_NAME).get(e.getKey()));
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
index 636eb9f..0463c46 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest.java
@@ -161,7 +161,7 @@ public abstract class IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest
         final String initVal = "initialValue";
 
         for (Integer key : keys) {
-            grid(originatingNode()).cache(null).put(key, initVal);
+            grid(originatingNode()).cache(DEFAULT_CACHE_NAME).put(key, initVal);
 
             map.put(key, String.valueOf(key));
         }
@@ -173,7 +173,7 @@ public abstract class IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest
         for (Integer key : keys) {
             Collection<ClusterNode> nodes = new ArrayList<>();
 
-            nodes.addAll(grid(1).affinity(null).mapKeyToPrimaryAndBackups(key));
+            nodes.addAll(grid(1).affinity(DEFAULT_CACHE_NAME).mapKeyToPrimaryAndBackups(key));
 
             nodes.remove(txNode);
 
@@ -190,7 +190,7 @@ public abstract class IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest
 
         GridTestUtils.runAsync(new Callable<Void>() {
             @Override public Void call() throws Exception {
-                IgniteCache<Integer, String> cache = originatingNodeGrid.cache(null);
+                IgniteCache<Integer, String> cache = originatingNodeGrid.cache(DEFAULT_CACHE_NAME);
 
                 assertNotNull(cache);
 
@@ -228,7 +228,7 @@ public abstract class IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest
         boolean txFinished = GridTestUtils.waitForCondition(new GridAbsPredicate() {
             @Override public boolean apply() {
                 for (IgniteKernal g : grids) {
-                    GridCacheAdapter<?, ?> cache = g.internalCache();
+                    GridCacheAdapter<?, ?> cache = g.internalCache(DEFAULT_CACHE_NAME);
 
                     IgniteTxManager txMgr = cache.isNear() ?
                         ((GridNearCacheAdapter)cache).dht().context().tm() :
@@ -264,7 +264,7 @@ public abstract class IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest
                     private Ignite ignite;
 
                     @Override public Void call() throws Exception {
-                        IgniteCache<Integer, String> cache = ignite.cache(null);
+                        IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                         assertNotNull(cache);
 
@@ -279,7 +279,7 @@ public abstract class IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest
 
         for (Map.Entry<Integer, String> e : map.entrySet()) {
             for (Ignite g : G.allGrids())
-                assertEquals(fullFailure ? initVal : e.getValue(), g.cache(null).get(e.getKey()));
+                assertEquals(fullFailure ? initVal : e.getValue(), g.cache(DEFAULT_CACHE_NAME).get(e.getKey()));
         }
     }
 
@@ -311,14 +311,14 @@ public abstract class IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest
         final String initVal = "initialValue";
 
         for (Integer key : keys) {
-            grid(originatingNode()).cache(null).put(key, initVal);
+            grid(originatingNode()).cache(DEFAULT_CACHE_NAME).put(key, initVal);
 
             map.put(key, String.valueOf(key));
         }
 
         Map<Integer, Collection<ClusterNode>> nodeMap = new HashMap<>();
 
-        IgniteCache<Integer, String> cache = grid(0).cache(null);
+        IgniteCache<Integer, String> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         info("Failing node ID: " + grid(1).localNode().id());
 
@@ -375,7 +375,7 @@ public abstract class IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest
         boolean txFinished = GridTestUtils.waitForCondition(new GridAbsPredicate() {
             @Override public boolean apply() {
                 for (IgniteKernal g : grids) {
-                    GridCacheAdapter<?, ?> cache = g.internalCache();
+                    GridCacheAdapter<?, ?> cache = g.internalCache(DEFAULT_CACHE_NAME);
 
                     IgniteTxManager txMgr = cache.isNear() ?
                         ((GridNearCacheAdapter)cache).dht().context().tm() :
@@ -411,7 +411,7 @@ public abstract class IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest
                     private Ignite ignite;
 
                     @Override public Void call() throws Exception {
-                        IgniteCache<Integer, String> cache = ignite.cache(null);
+                        IgniteCache<Integer, String> cache = ignite.cache(DEFAULT_CACHE_NAME);
 
                         assertNotNull(cache);
 
@@ -426,7 +426,7 @@ public abstract class IgniteTxPessimisticOriginatingNodeFailureAbstractSelfTest
 
         for (Map.Entry<Integer, String> e : map.entrySet()) {
             for (Ignite g : G.allGrids())
-                assertEquals(!commmit ? initVal : e.getValue(), g.cache(null).get(e.getKey()));
+                assertEquals(!commmit ? initVal : e.getValue(), g.cache(DEFAULT_CACHE_NAME).get(e.getKey()));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java
index 8475175..0af84d6 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxTimeoutAbstractTest.java
@@ -74,7 +74,7 @@ public class IgniteTxTimeoutAbstractTest extends GridCommonAbstractTest {
      * @return Cache.
      */
     @Override protected <K, V> IgniteCache<K, V> jcache(int i) {
-        return IGNITEs.get(i).cache(null);
+        return IGNITEs.get(i).cache(DEFAULT_CACHE_NAME);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java
index 91790da..cc6b058 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAbstractTransformWriteThroughSelfTest.java
@@ -316,7 +316,7 @@ public abstract class GridCacheAbstractTransformWriteThroughSelfTest extends Gri
         while (keys.size() < 30) {
             String key = String.valueOf(numKey);
 
-            Affinity<Object> affinity = ignite(0).affinity(null);
+            Affinity<Object> affinity = ignite(0).affinity(DEFAULT_CACHE_NAME);
 
             if (nodeType == NEAR_NODE) {
                 if (!affinity.isPrimaryOrBackup(grid(0).localNode(), key))

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java
index 0c7bf3c..687a1bf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheAtomicNearCacheSelfTest.java
@@ -78,7 +78,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
 
-        CacheConfiguration ccfg = new CacheConfiguration();
+        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         ccfg.setCacheMode(PARTITIONED);
         ccfg.setAtomicityMode(ATOMIC);
@@ -146,9 +146,9 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
 
         Ignite ignite0 = grid(0);
 
-        IgniteCache<Integer, Integer> cache0 = ignite0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = ignite0.cache(DEFAULT_CACHE_NAME);
 
-        Affinity<Integer> aff = ignite0.affinity(null);
+        Affinity<Integer> aff = ignite0.affinity(DEFAULT_CACHE_NAME);
 
         UUID id0 = ignite0.cluster().localNode().id();
 
@@ -207,7 +207,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
         int val = 4;
 
         for (int i = 0; i < GRID_CNT; i++) {
-            IgniteCache<Integer, Integer> cache = grid(i).cache(null);
+            IgniteCache<Integer, Integer> cache = grid(i).cache(DEFAULT_CACHE_NAME);
 
             for (Integer key : nearKeys.keySet())
                 nearKeys.put(key, val);
@@ -246,9 +246,9 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
 
         Ignite ignite0 = grid(0);
 
-        IgniteCache<Integer, Integer> cache0 = ignite0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = ignite0.cache(DEFAULT_CACHE_NAME);
 
-        Affinity<Object> aff = ignite0.affinity(null);
+        Affinity<Object> aff = ignite0.affinity(DEFAULT_CACHE_NAME);
 
         UUID id0 = ignite0.cluster().localNode().id();
 
@@ -291,7 +291,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
         int val = nearKey + 1;
 
         for (int i = 0; i < GRID_CNT; i++) {
-            IgniteCache<Integer, Integer> cache = grid(i).cache(null);
+            IgniteCache<Integer, Integer> cache = grid(i).cache(DEFAULT_CACHE_NAME);
 
             log.info("Transform [igniteInstanceName=" + grid(i).name() + ", val=" + val + ']');
 
@@ -321,9 +321,9 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
 
         Ignite ignite0 = grid(0);
 
-        IgniteCache<Integer, Integer> cache0 = ignite0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = ignite0.cache(DEFAULT_CACHE_NAME);
 
-        Affinity<Object> aff = ignite0.affinity(null);
+        Affinity<Object> aff = ignite0.affinity(DEFAULT_CACHE_NAME);
 
         UUID id0 = ignite0.cluster().localNode().id();
 
@@ -382,7 +382,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
         int val = 4;
 
         for (int i = 0; i < GRID_CNT; i++) {
-            IgniteCache<Integer, Integer> cache = grid(i).cache(null);
+            IgniteCache<Integer, Integer> cache = grid(i).cache(DEFAULT_CACHE_NAME);
 
             for (Integer key : nearKeys)
                 nearKeys.add(key);
@@ -418,21 +418,21 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
     private void checkPutRemoveGet() throws Exception {
         Ignite ignite0 = grid(0);
 
-        IgniteCache<Integer, Integer> cache0 = ignite0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = ignite0.cache(DEFAULT_CACHE_NAME);
 
         Integer key = key(ignite0, NOT_PRIMARY_AND_BACKUP);
 
         cache0.put(key, key);
 
         for (int i = 0; i < GRID_CNT; i++)
-            grid(i).cache(null).get(key);
+            grid(i).cache(DEFAULT_CACHE_NAME).get(key);
 
         cache0.remove(key);
 
         cache0.put(key, key);
 
         for (int i = 0; i < GRID_CNT; i++)
-            grid(i).cache(null).get(key);
+            grid(i).cache(DEFAULT_CACHE_NAME).get(key);
 
         cache0.remove(key);
     }
@@ -456,9 +456,9 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
 
         Ignite ignite0 = grid(grid);
 
-        IgniteCache<Integer, Integer> cache0 = ignite0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = ignite0.cache(DEFAULT_CACHE_NAME);
 
-        Affinity<Integer> aff = ignite0.affinity(null);
+        Affinity<Integer> aff = ignite0.affinity(DEFAULT_CACHE_NAME);
 
         UUID id0 = ignite0.cluster().localNode().id();
 
@@ -501,7 +501,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
         int val = nearKey + 1;
 
         for (int i = 0; i < GRID_CNT; i++) {
-            IgniteCache<Integer, Integer> cache = grid(i).cache(null);
+            IgniteCache<Integer, Integer> cache = grid(i).cache(DEFAULT_CACHE_NAME);
 
             log.info("Put [igniteInstanceName=" + grid(i).name() + ", val=" + val + ']');
 
@@ -531,7 +531,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
 
         Ignite ignite0 = grid(0);
 
-        IgniteCache<Integer, Integer> cache0 = ignite0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = ignite0.cache(DEFAULT_CACHE_NAME);
 
         Integer primaryKey = key(ignite0, PRIMARY);
 
@@ -577,9 +577,9 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
 
         Ignite ignite0 = grid(0);
 
-        IgniteCache<Integer, Integer> cache0 = ignite0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = ignite0.cache(DEFAULT_CACHE_NAME);
 
-        Affinity<Integer> aff = ignite0.affinity(null);
+        Affinity<Integer> aff = ignite0.affinity(DEFAULT_CACHE_NAME);
 
         UUID id0 = ignite0.cluster().localNode().id();
 
@@ -602,7 +602,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
         }
 
         IgniteCache<Integer, Integer> primaryCache = G.ignite(
-            (String)aff.mapKeyToNode(nearKey).attribute(ATTR_IGNITE_INSTANCE_NAME)).cache(null);
+            (String)aff.mapKeyToNode(nearKey).attribute(ATTR_IGNITE_INSTANCE_NAME)).cache(DEFAULT_CACHE_NAME);
 
         primaryCache.put(nearKey, 2); // This put should see that near entry evicted on grid0 and remove reader.
 
@@ -625,9 +625,9 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
     private void checkReaderRemove() throws Exception {
         Ignite ignite0 = grid(0);
 
-        IgniteCache<Integer, Integer> cache0 = ignite0.cache(null);
+        IgniteCache<Integer, Integer> cache0 = ignite0.cache(DEFAULT_CACHE_NAME);
 
-        Affinity<Integer> aff = ignite0.affinity(null);
+        Affinity<Integer> aff = ignite0.affinity(DEFAULT_CACHE_NAME);
 
         UUID id0 = ignite0.cluster().localNode().id();
 
@@ -648,7 +648,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
 
         Ignite primaryNode = G.ignite((String)aff.mapKeyToNode(nearKey).attribute(ATTR_IGNITE_INSTANCE_NAME));
 
-        IgniteCache<Integer, Integer> primaryCache = primaryNode.cache(null);
+        IgniteCache<Integer, Integer> primaryCache = primaryNode.cache(DEFAULT_CACHE_NAME);
 
         primaryCache.put(nearKey, 2); // Put from primary, check there are no readers.
 
@@ -670,7 +670,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
         boolean expectNear,
         final UUID... expReaders) throws Exception
     {
-        GridCacheAdapter<Integer, Integer> near = ((IgniteKernal)ignite).internalCache();
+        GridCacheAdapter<Integer, Integer> near = ((IgniteKernal)ignite).internalCache(DEFAULT_CACHE_NAME);
 
         assertTrue(near.isNear());
 
@@ -746,7 +746,7 @@ public class GridCacheAtomicNearCacheSelfTest extends GridCommonAbstractTest {
      * @return Key with properties specified by the given mode.
      */
     private Integer key(Ignite ignite, int mode) {
-        Affinity<Integer> aff = ignite.affinity(null);
+        Affinity<Integer> aff = ignite.affinity(DEFAULT_CACHE_NAME);
 
         Integer key = null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java
index f034d13..282b792 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java
@@ -327,7 +327,7 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
             Thread.sleep(1000);
             // Check that all transactions are committed.
             for (int i = 0; i < 3; i++) {
-                GridCacheAdapter<Object, Object> cache = ((IgniteKernal)grid(i)).internalCache();
+                GridCacheAdapter<Object, Object> cache = ((IgniteKernal)grid(i)).internalCache(DEFAULT_CACHE_NAME);
 
                 for (Integer key : keys) {
                     GridCacheEntryEx entry = cache.peekEx(key);
@@ -382,7 +382,7 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
             final CountDownLatch lockLatch = new CountDownLatch(1);
             final CountDownLatch unlockLatch = new CountDownLatch(1);
 
-            final Lock lock = g0.cache(null).lock(key);
+            final Lock lock = g0.cache(DEFAULT_CACHE_NAME).lock(key);
 
             IgniteInternalFuture<?> unlockFut = multithreadedAsync(new Runnable() {
                 @Override public void run() {
@@ -407,13 +407,13 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
 
             U.await(lockLatch);
 
-            assert g0.cache(null).isLocalLocked(key, false);
-            assert !g0.cache(null).isLocalLocked(key, true) : "Key can not be locked by current thread.";
+            assert g0.cache(DEFAULT_CACHE_NAME).isLocalLocked(key, false);
+            assert !g0.cache(DEFAULT_CACHE_NAME).isLocalLocked(key, true) : "Key can not be locked by current thread.";
 
             assert !lock.tryLock();
 
-            assert g0.cache(null).isLocalLocked(key, false);
-            assert !g0.cache(null).isLocalLocked(key, true) : "Key can not be locked by current thread.";
+            assert g0.cache(DEFAULT_CACHE_NAME).isLocalLocked(key, false);
+            assert !g0.cache(DEFAULT_CACHE_NAME).isLocalLocked(key, true) : "Key can not be locked by current thread.";
 
             unlockLatch.countDown();
             unlockFut.get();
@@ -439,11 +439,11 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
 
         try {
             for (int i = 0; i < 100; i++)
-                g0.cache(null).put(i, i);
+                g0.cache(DEFAULT_CACHE_NAME).put(i, i);
 
             for (int i = 0; i < 100; i++) {
                 try (Transaction tx = g0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
-                    Integer val = (Integer) g0.cache(null).get(i);
+                    Integer val = (Integer) g0.cache(DEFAULT_CACHE_NAME).get(i);
 
                     assertEquals((Integer) i, val);
                 }
@@ -562,12 +562,12 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
 
             try {
                 if (separate) {
-                    g0.cache(null).put(k0, "val" + k0);
-                    g0.cache(null).put(k1, "val" + k1);
-                    g0.cache(null).put(k2, "val" + k2);
+                    g0.cache(DEFAULT_CACHE_NAME).put(k0, "val" + k0);
+                    g0.cache(DEFAULT_CACHE_NAME).put(k1, "val" + k1);
+                    g0.cache(DEFAULT_CACHE_NAME).put(k2, "val" + k2);
                 }
                 else
-                    g0.cache(null).putAll(map);
+                    g0.cache(DEFAULT_CACHE_NAME).putAll(map);
 
                 if (tx != null)
                     tx.commit();
@@ -578,12 +578,12 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
             }
 
             if (separate) {
-                assertEquals("val" + k0, g0.cache(null).get(k0));
-                assertEquals("val" + k1, g0.cache(null).get(k1));
-                assertEquals("val" + k2, g0.cache(null).get(k2));
+                assertEquals("val" + k0, g0.cache(DEFAULT_CACHE_NAME).get(k0));
+                assertEquals("val" + k1, g0.cache(DEFAULT_CACHE_NAME).get(k1));
+                assertEquals("val" + k2, g0.cache(DEFAULT_CACHE_NAME).get(k2));
             }
             else {
-                Map<Object, Object> res = g0.cache(null).getAll(map.keySet());
+                Map<Object, Object> res = g0.cache(DEFAULT_CACHE_NAME).getAll(map.keySet());
 
                 assertEquals(map, res);
             }
@@ -592,12 +592,12 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
 
             try {
                 if (separate) {
-                    g0.cache(null).remove(k0);
-                    g0.cache(null).remove(k1);
-                    g0.cache(null).remove(k2);
+                    g0.cache(DEFAULT_CACHE_NAME).remove(k0);
+                    g0.cache(DEFAULT_CACHE_NAME).remove(k1);
+                    g0.cache(DEFAULT_CACHE_NAME).remove(k2);
                 }
                 else
-                    g0.cache(null).removeAll(map.keySet());
+                    g0.cache(DEFAULT_CACHE_NAME).removeAll(map.keySet());
 
                 if (tx != null)
                     tx.commit();
@@ -608,12 +608,12 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
             }
 
             if (separate) {
-                assertEquals(null, g0.cache(null).get(k0));
-                assertEquals(null, g0.cache(null).get(k1));
-                assertEquals(null, g0.cache(null).get(k2));
+                assertEquals(null, g0.cache(DEFAULT_CACHE_NAME).get(k0));
+                assertEquals(null, g0.cache(DEFAULT_CACHE_NAME).get(k1));
+                assertEquals(null, g0.cache(DEFAULT_CACHE_NAME).get(k2));
             }
             else {
-                Map<Object, Object> res = g0.cache(null).getAll(map.keySet());
+                Map<Object, Object> res = g0.cache(DEFAULT_CACHE_NAME).getAll(map.keySet());
 
                 assertTrue(res.isEmpty());
             }
@@ -651,11 +651,11 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
 
             try {
                 if (separate) {
-                    g0.cache(null).put(k1, "val" + k1);
-                    g0.cache(null).put(k2, "val" + k2);
+                    g0.cache(DEFAULT_CACHE_NAME).put(k1, "val" + k1);
+                    g0.cache(DEFAULT_CACHE_NAME).put(k2, "val" + k2);
                 }
                 else
-                    g0.cache(null).putAll(map);
+                    g0.cache(DEFAULT_CACHE_NAME).putAll(map);
 
                 if (tx != null)
                     tx.commit();
@@ -666,11 +666,11 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
             }
 
             if (separate) {
-                assertEquals("val" + k1, g0.cache(null).get(k1));
-                assertEquals("val" + k2, g0.cache(null).get(k2));
+                assertEquals("val" + k1, g0.cache(DEFAULT_CACHE_NAME).get(k1));
+                assertEquals("val" + k2, g0.cache(DEFAULT_CACHE_NAME).get(k2));
             }
             else {
-                Map<Object, Object> res = g0.cache(null).getAll(map.keySet());
+                Map<Object, Object> res = g0.cache(DEFAULT_CACHE_NAME).getAll(map.keySet());
 
                 assertEquals(map, res);
             }
@@ -679,11 +679,11 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
 
             try {
                 if (separate) {
-                    g0.cache(null).remove(k1);
-                    g0.cache(null).remove(k2);
+                    g0.cache(DEFAULT_CACHE_NAME).remove(k1);
+                    g0.cache(DEFAULT_CACHE_NAME).remove(k2);
                 }
                 else
-                    g0.cache(null).removeAll(map.keySet());
+                    g0.cache(DEFAULT_CACHE_NAME).removeAll(map.keySet());
 
                 if (tx != null)
                     tx.commit();
@@ -694,11 +694,11 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
             }
 
             if (separate) {
-                assertEquals(null, g0.cache(null).get(k1));
-                assertEquals(null, g0.cache(null).get(k2));
+                assertEquals(null, g0.cache(DEFAULT_CACHE_NAME).get(k1));
+                assertEquals(null, g0.cache(DEFAULT_CACHE_NAME).get(k2));
             }
             else {
-                Map<Object, Object> res = g0.cache(null).getAll(map.keySet());
+                Map<Object, Object> res = g0.cache(DEFAULT_CACHE_NAME).getAll(map.keySet());
 
                 assertTrue(res.isEmpty());
             }
@@ -752,7 +752,7 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
         Ignite g1 = grid(1);
         Ignite g2 = grid(2);
 
-        g0.cache(null).putAll(map);
+        g0.cache(DEFAULT_CACHE_NAME).putAll(map);
 
         checkStore(g0, map);
         checkStore(g1, Collections.<Integer, String>emptyMap());
@@ -761,7 +761,7 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
         clearStores(3);
 
         try (Transaction tx = g0.transactions().txStart(OPTIMISTIC, READ_COMMITTED)) {
-            g0.cache(null).putAll(map);
+            g0.cache(DEFAULT_CACHE_NAME).putAll(map);
 
             tx.commit();
 
@@ -829,7 +829,7 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
 
             Map<Integer, String> map0 = F.asMap(k0, "val" + k0, k1, "val" + k1, k2, "val" + k2);
 
-            g0.cache(null).putAll(map0);
+            g0.cache(DEFAULT_CACHE_NAME).putAll(map0);
 
             Map<Integer, String> map = F.asMap(k0, "value" + k0, k1, "value" + k1, k2, "value" + k2);
 
@@ -837,12 +837,12 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
 
             try {
                 if (separate) {
-                    g0.cache(null).put(k0, "value" + k0);
-                    g0.cache(null).put(k1, "value" + k1);
-                    g0.cache(null).put(k2, "value" + k2);
+                    g0.cache(DEFAULT_CACHE_NAME).put(k0, "value" + k0);
+                    g0.cache(DEFAULT_CACHE_NAME).put(k1, "value" + k1);
+                    g0.cache(DEFAULT_CACHE_NAME).put(k2, "value" + k2);
                 }
                 else
-                    g0.cache(null).putAll(map);
+                    g0.cache(DEFAULT_CACHE_NAME).putAll(map);
 
                 tx.rollback();
             }
@@ -851,12 +851,12 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
             }
 
             if (separate) {
-                assertEquals("val" + k0, g0.cache(null).get(k0));
-                assertEquals("val" + k1, g0.cache(null).get(k1));
-                assertEquals("val" + k2, g0.cache(null).get(k2));
+                assertEquals("val" + k0, g0.cache(DEFAULT_CACHE_NAME).get(k0));
+                assertEquals("val" + k1, g0.cache(DEFAULT_CACHE_NAME).get(k1));
+                assertEquals("val" + k2, g0.cache(DEFAULT_CACHE_NAME).get(k2));
             }
             else {
-                Map<Object, Object> res = g0.cache(null).getAll(map.keySet());
+                Map<Object, Object> res = g0.cache(DEFAULT_CACHE_NAME).getAll(map.keySet());
 
                 assertEquals(map0, res);
             }
@@ -865,12 +865,12 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
 
             try {
                 if (separate) {
-                    g0.cache(null).remove(k0);
-                    g0.cache(null).remove(k1);
-                    g0.cache(null).remove(k2);
+                    g0.cache(DEFAULT_CACHE_NAME).remove(k0);
+                    g0.cache(DEFAULT_CACHE_NAME).remove(k1);
+                    g0.cache(DEFAULT_CACHE_NAME).remove(k2);
                 }
                 else
-                    g0.cache(null).removeAll(map.keySet());
+                    g0.cache(DEFAULT_CACHE_NAME).removeAll(map.keySet());
 
                 tx.rollback();
             }
@@ -879,12 +879,12 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
             }
 
             if (separate) {
-                assertEquals("val" + k0, g0.cache(null).get(k0));
-                assertEquals("val" + k1, g0.cache(null).get(k1));
-                assertEquals("val" + k2, g0.cache(null).get(k2));
+                assertEquals("val" + k0, g0.cache(DEFAULT_CACHE_NAME).get(k0));
+                assertEquals("val" + k1, g0.cache(DEFAULT_CACHE_NAME).get(k1));
+                assertEquals("val" + k2, g0.cache(DEFAULT_CACHE_NAME).get(k2));
             }
             else {
-                Map<Object, Object> res = g0.cache(null).getAll(map.keySet());
+                Map<Object, Object> res = g0.cache(DEFAULT_CACHE_NAME).getAll(map.keySet());
 
                 assertEquals(map0, res);
             }
@@ -983,7 +983,7 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
      */
     private static Integer forPrimary(Ignite g, int prev) {
         for (int i = prev + 1; i < 10000; i++) {
-            if (g.affinity(null).mapKeyToNode(i).id().equals(g.cluster().localNode().id()))
+            if (g.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(i).id().equals(g.cluster().localNode().id()))
                 return i;
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedOptimisticTransactionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedOptimisticTransactionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedOptimisticTransactionSelfTest.java
index e32d4a1..5ed6b38 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedOptimisticTransactionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedOptimisticTransactionSelfTest.java
@@ -69,7 +69,7 @@ public class GridCacheColocatedOptimisticTransactionSelfTest extends GridCommonA
 
         disco.setIpFinder(IP_FINDER);
 
-        CacheConfiguration cc = new CacheConfiguration();
+        CacheConfiguration cc = new CacheConfiguration(DEFAULT_CACHE_NAME);
 
         cc.setName(CACHE);
         cc.setCacheMode(PARTITIONED);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
index 58c3841..db8a3cb 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEntrySelfTest.java
@@ -124,7 +124,7 @@ public class GridCacheDhtEntrySelfTest extends GridCommonAbstractTest {
      * @return Near cache.
      */
     private IgniteCache<Integer, String> near(Ignite g) {
-        return g.cache(null);
+        return g.cache(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -133,7 +133,7 @@ public class GridCacheDhtEntrySelfTest extends GridCommonAbstractTest {
      */
     @SuppressWarnings({"unchecked", "TypeMayBeWeakened"})
     private GridDhtCacheAdapter<Integer, String> dht(Ignite g) {
-        return ((GridNearCacheAdapter)((IgniteKernal)g).internalCache()).dht();
+        return ((GridNearCacheAdapter)((IgniteKernal)g).internalCache(DEFAULT_CACHE_NAME)).dht();
     }
 
     /**
@@ -302,7 +302,7 @@ public class GridCacheDhtEntrySelfTest extends GridCommonAbstractTest {
      * @return For the given key pair {primary node, some other node}.
      */
     private IgniteBiTuple<ClusterNode, ClusterNode> getNodes(Integer key) {
-        Affinity<Integer> aff = grid(0).affinity(null);
+        Affinity<Integer> aff = grid(0).affinity(DEFAULT_CACHE_NAME);
 
         int part = aff.partition(key);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java
index 20162a7..dc5e3ac 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtEvictionNearReadersSelfTest.java
@@ -154,7 +154,7 @@ public class GridCacheDhtEvictionNearReadersSelfTest extends GridCommonAbstractT
      */
     @SuppressWarnings({"unchecked"})
     private GridNearCacheAdapter<Integer, String> near(Ignite g) {
-        return (GridNearCacheAdapter)((IgniteKernal)g).internalCache();
+        return (GridNearCacheAdapter)((IgniteKernal)g).internalCache(DEFAULT_CACHE_NAME);
     }
 
     /**
@@ -163,7 +163,7 @@ public class GridCacheDhtEvictionNearReadersSelfTest extends GridCommonAbstractT
      */
     @SuppressWarnings({"unchecked", "TypeMayBeWeakened"})
     private GridDhtCacheAdapter<Integer, String> dht(Ignite g) {
-        return ((GridNearCacheAdapter)((IgniteKernal)g).internalCache()).dht();
+        return ((GridNearCacheAdapter)((IgniteKernal)g).internalCache(DEFAULT_CACHE_NAME)).dht();
     }
 
     /**
@@ -171,7 +171,7 @@ public class GridCacheDhtEvictionNearReadersSelfTest extends GridCommonAbstractT
      * @return Primary node for the given key.
      */
     private Collection<ClusterNode> keyNodes(Object key) {
-        return grid(0).affinity(null).mapKeyToPrimaryAndBackups(key);
+        return grid(0).affinity(DEFAULT_CACHE_NAME).mapKeyToPrimaryAndBackups(key);
     }
 
     /**
@@ -272,7 +272,7 @@ public class GridCacheDhtEvictionNearReadersSelfTest extends GridCommonAbstractT
 
         // Evict on primary node.
         // It will trigger dht eviction and eviction on backup node.
-        grid(primary).cache(null).localEvict(Collections.<Object>singleton(key));
+        grid(primary).cache(DEFAULT_CACHE_NAME).localEvict(Collections.<Object>singleton(key));
 
         futOther.get(3000);
         futBackup.get(3000);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java
index c77ea8f..35ef4f0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtMappingSelfTest.java
@@ -78,7 +78,7 @@ public class GridCacheDhtMappingSelfTest extends GridCommonAbstractTest {
 
         startGridsMultiThreaded(nodeCnt);
 
-        IgniteCache<Integer, Integer> cache = grid(nodeCnt - 1).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(nodeCnt - 1).cache(DEFAULT_CACHE_NAME);
 
         int kv = 1;
 
@@ -90,7 +90,7 @@ public class GridCacheDhtMappingSelfTest extends GridCommonAbstractTest {
             Ignite g = grid(i);
 
             GridDhtCacheAdapter<Integer, Integer> dht = ((GridNearCacheAdapter<Integer, Integer>)
-                ((IgniteKernal)g).<Integer, Integer>internalCache()).dht();
+                ((IgniteKernal)g).<Integer, Integer>internalCache(DEFAULT_CACHE_NAME)).dht();
 
             if (localPeek(dht, kv) != null) {
                 info("Key found on node: " + g.cluster().localNode().id());

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadBigDataSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadBigDataSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadBigDataSelfTest.java
index 2e7d4aa..86dbd4f 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadBigDataSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadBigDataSelfTest.java
@@ -133,7 +133,7 @@ public class GridCacheDhtPreloadBigDataSelfTest extends GridCommonAbstractTest {
 
             int cnt = 10000;
 
-            populate(grid(0).<Integer, byte[]>cache(null), cnt, KBSIZE);
+            populate(grid(0).<Integer, byte[]>cache(DEFAULT_CACHE_NAME), cnt, KBSIZE);
 
             int gridCnt = 3;
 
@@ -143,7 +143,7 @@ public class GridCacheDhtPreloadBigDataSelfTest extends GridCommonAbstractTest {
             Thread.sleep(10000);
 
             for (int i = 0; i < gridCnt; i++) {
-                IgniteCache<Integer, String> c = grid(i).cache(null);
+                IgniteCache<Integer, String> c = grid(i).cache(DEFAULT_CACHE_NAME);
 
                 if (backups + 1 <= gridCnt)
                     assert c.localSize() < cnt : "Cache size: " + c.localSize();
@@ -172,7 +172,7 @@ public class GridCacheDhtPreloadBigDataSelfTest extends GridCommonAbstractTest {
 
                 @Override public void onLifecycleEvent(LifecycleEventType evt) {
                     if (evt == LifecycleEventType.AFTER_NODE_START) {
-                        IgniteCache<Integer, byte[]> c = ignite.cache(null);
+                        IgniteCache<Integer, byte[]> c = ignite.cache(DEFAULT_CACHE_NAME);
 
                         if (c.putIfAbsent(-1, new byte[1])) {
                             populate(c, cnt, KBSIZE);
@@ -189,12 +189,12 @@ public class GridCacheDhtPreloadBigDataSelfTest extends GridCommonAbstractTest {
                 startGrid(i);
 
             for (int i = 0; i < gridCnt; i++)
-                info("Grid size [i=" + i + ", size=" + grid(i).cache(null).size() + ']');
+                info("Grid size [i=" + i + ", size=" + grid(i).cache(DEFAULT_CACHE_NAME).size() + ']');
 
             Thread.sleep(10000);
 
             for (int i = 0; i < gridCnt; i++) {
-                IgniteCache<Integer, String> c = grid(i).cache(null);
+                IgniteCache<Integer, String> c = grid(i).cache(DEFAULT_CACHE_NAME);
 
                 if (backups + 1 <= gridCnt)
                     assert c.localSize() < cnt;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java
index 3bdce46..0105ece 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDelayedSelfTest.java
@@ -116,7 +116,7 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest {
 
         int cnt = KEY_CNT;
 
-        IgniteCache<String, Integer> c0 = g0.cache(null);
+        IgniteCache<String, Integer> c0 = g0.cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < cnt; i++)
             c0.put(Integer.toString(i), i);
@@ -124,8 +124,8 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest {
         Ignite g1 = startGrid(1);
         Ignite g2 = startGrid(2);
 
-        IgniteCache<String, Integer> c1 = g1.cache(null);
-        IgniteCache<String, Integer> c2 = g2.cache(null);
+        IgniteCache<String, Integer> c1 = g1.cache(DEFAULT_CACHE_NAME);
+        IgniteCache<String, Integer> c2 = g2.cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < cnt; i++)
             assertNull(c1.localPeek(Integer.toString(i), CachePeekMode.ONHEAP));
@@ -195,7 +195,7 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest {
 
         int cnt = KEY_CNT;
 
-        IgniteCache<String, Integer> c0 = g0.cache(null);
+        IgniteCache<String, Integer> c0 = g0.cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < cnt; i++)
             c0.put(Integer.toString(i), i);
@@ -203,8 +203,8 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest {
         Ignite g1 = startGrid(1);
         Ignite g2 = startGrid(2);
 
-        IgniteCache<String, Integer> c1 = g1.cache(null);
-        IgniteCache<String, Integer> c2 = g2.cache(null);
+        IgniteCache<String, Integer> c1 = g1.cache(DEFAULT_CACHE_NAME);
+        IgniteCache<String, Integer> c2 = g2.cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < cnt; i++)
             assertNull(c1.localPeek(Integer.toString(i), CachePeekMode.ONHEAP));
@@ -267,7 +267,7 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest {
 
         int cnt = KEY_CNT;
 
-        IgniteCache<String, Integer> c0 = g0.cache(null);
+        IgniteCache<String, Integer> c0 = g0.cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < cnt; i++)
             c0.put(Integer.toString(i), i);
@@ -275,8 +275,8 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest {
         Ignite g1 = startGrid(1);
         Ignite g2 = startGrid(2);
 
-        IgniteCache<String, Integer> c1 = g1.cache(null);
-        IgniteCache<String, Integer> c2 = g2.cache(null);
+        IgniteCache<String, Integer> c1 = g1.cache(DEFAULT_CACHE_NAME);
+        IgniteCache<String, Integer> c2 = g2.cache(DEFAULT_CACHE_NAME);
 
         GridDhtCacheAdapter<String, Integer> d0 = dht(0);
         GridDhtCacheAdapter<String, Integer> d1 = dht(1);
@@ -375,7 +375,7 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest {
 
             long start = System.currentTimeMillis();
 
-            g.cache(null).rebalance().get();
+            g.cache(DEFAULT_CACHE_NAME).rebalance().get();
 
             info(">>> Finished preloading of empty cache in " + (System.currentTimeMillis() - start) + "ms.");
         }
@@ -389,7 +389,7 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest {
      * @return Topology.
      */
     private GridDhtPartitionTopology topology(Ignite g) {
-        return ((GridNearCacheAdapter<Integer, String>)((IgniteKernal)g).<Integer, String>internalCache()).dht().topology();
+        return ((GridNearCacheAdapter<Integer, String>)((IgniteKernal)g).<Integer, String>internalCache(DEFAULT_CACHE_NAME)).dht().topology();
     }
 
     /**
@@ -397,7 +397,7 @@ public class GridCacheDhtPreloadDelayedSelfTest extends GridCommonAbstractTest {
      * @return Affinity.
      */
     private Affinity<Object> affinity(Ignite g) {
-        return g.affinity(null);
+        return g.affinity(DEFAULT_CACHE_NAME);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java
index 9b34a80..7a80e87 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadDisabledSelfTest.java
@@ -120,7 +120,7 @@ public class GridCacheDhtPreloadDisabledSelfTest extends GridCommonAbstractTest
      * @return Topology.
      */
     private GridDhtPartitionTopology topology(int i) {
-        return near(grid(i).cache(null)).dht().topology();
+        return near(grid(i).cache(DEFAULT_CACHE_NAME)).dht().topology();
     }
 
     /** @throws Exception If failed. */
@@ -177,7 +177,7 @@ public class GridCacheDhtPreloadDisabledSelfTest extends GridCommonAbstractTest
         try {
             Ignite ignite1 = startGrid(0);
 
-            IgniteCache<Integer, String> cache1 = ignite1.cache(null);
+            IgniteCache<Integer, String> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
 
             int keyCnt = 10;
 
@@ -198,7 +198,7 @@ public class GridCacheDhtPreloadDisabledSelfTest extends GridCommonAbstractTest
 
             // Check all nodes.
             for (Ignite g : ignites) {
-                IgniteCache<Integer, String> c = g.cache(null);
+                IgniteCache<Integer, String> c = g.cache(DEFAULT_CACHE_NAME);
 
                 for (int i = 0; i < keyCnt; i++)
                     assertNull(c.localPeek(i));
@@ -207,7 +207,7 @@ public class GridCacheDhtPreloadDisabledSelfTest extends GridCommonAbstractTest
             Collection<Integer> keys = new LinkedList<>();
 
             for (int i = 0; i < keyCnt; i++)
-                if (ignite1.affinity(null).mapKeyToNode(i).equals(ignite1.cluster().localNode()))
+                if (ignite1.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(i).equals(ignite1.cluster().localNode()))
                     keys.add(i);
 
             info(">>> Finished checking nodes [keyCnt=" + keyCnt + ", nodeCnt=" + nodeCnt + ", grids=" +
@@ -222,7 +222,7 @@ public class GridCacheDhtPreloadDisabledSelfTest extends GridCommonAbstractTest
 
                 // Check all nodes.
                 for (Ignite gg : ignites) {
-                    IgniteCache<Integer, String> c = gg.cache(null);
+                    IgniteCache<Integer, String> c = gg.cache(DEFAULT_CACHE_NAME);
 
                     for (int i = 0; i < keyCnt; i++)
                         assertNull(c.localPeek(i));

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java
index af7aff4..e2a8009 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadMessageCountTest.java
@@ -93,7 +93,7 @@ public class GridCacheDhtPreloadMessageCountTest extends GridCommonAbstractTest
 
         int cnt = KEY_CNT;
 
-        IgniteCache<String, Integer> c0 = g0.cache(null);
+        IgniteCache<String, Integer> c0 = g0.cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < cnt; i++)
             c0.put(Integer.toString(i), i);
@@ -103,8 +103,8 @@ public class GridCacheDhtPreloadMessageCountTest extends GridCommonAbstractTest
 
         U.sleep(1000);
 
-        IgniteCache<String, Integer> c1 = g1.cache(null);
-        IgniteCache<String, Integer> c2 = g2.cache(null);
+        IgniteCache<String, Integer> c1 = g1.cache(DEFAULT_CACHE_NAME);
+        IgniteCache<String, Integer> c2 = g2.cache(DEFAULT_CACHE_NAME);
 
         TestRecordingCommunicationSpi spi0 = (TestRecordingCommunicationSpi)g0.configuration().getCommunicationSpi();
         TestRecordingCommunicationSpi spi1 = (TestRecordingCommunicationSpi)g1.configuration().getCommunicationSpi();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java
index 2bbdff7..71911e8 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadPutGetSelfTest.java
@@ -198,7 +198,7 @@ public class GridCacheDhtPreloadPutGetSelfTest extends GridCommonAbstractTest {
                         for (int i = 0; i < ITER_CNT; i++) {
                             info("Iteration # " + i);
 
-                            IgniteCache<Integer, Integer> cache = g2.cache(null);
+                            IgniteCache<Integer, Integer> cache = g2.cache(DEFAULT_CACHE_NAME);
 
                             for (int j = 0; j < KEY_CNT; j++) {
                                 Integer val = cache.get(j);
@@ -230,7 +230,7 @@ public class GridCacheDhtPreloadPutGetSelfTest extends GridCommonAbstractTest {
 
                             Ignite g1 = startGrid(1);
 
-                            IgniteCache<Integer, Integer> cache = g1.cache(null);
+                            IgniteCache<Integer, Integer> cache = g1.cache(DEFAULT_CACHE_NAME);
 
                             for (int j = 0; j < KEY_CNT; j++) {
                                 cache.put(j, j);

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
index 43aa10b..05a9759 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadSelfTest.java
@@ -236,7 +236,7 @@ public class GridCacheDhtPreloadSelfTest extends GridCommonAbstractTest {
         try {
             Ignite ignite1 = startGrid(0);
 
-            IgniteCache<Integer, String> cache1 = ignite1.cache(null);
+            IgniteCache<Integer, String> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
 
             putKeys(cache1, keyCnt);
             checkKeys(cache1, keyCnt, F.asList(ignite1));
@@ -247,7 +247,7 @@ public class GridCacheDhtPreloadSelfTest extends GridCommonAbstractTest {
 
             // Check all nodes.
             for (Ignite g : ignites) {
-                IgniteCache<Integer, String> c = g.cache(null);
+                IgniteCache<Integer, String> c = g.cache(DEFAULT_CACHE_NAME);
 
                 checkKeys(c, keyCnt, ignites);
             }
@@ -322,7 +322,7 @@ public class GridCacheDhtPreloadSelfTest extends GridCommonAbstractTest {
 
             assert last != null;
 
-            IgniteCache<Integer, String> lastCache = last.cache(null);
+            IgniteCache<Integer, String> lastCache = last.cache(DEFAULT_CACHE_NAME);
 
             GridDhtCacheAdapter<Integer, String> dht = dht(lastCache);
 
@@ -364,7 +364,7 @@ public class GridCacheDhtPreloadSelfTest extends GridCommonAbstractTest {
     private void checkActiveState(Iterable<Ignite> grids) {
         // Check that nodes don't have non-active information about other nodes.
         for (Ignite g : grids) {
-            IgniteCache<Integer, String> c = g.cache(null);
+            IgniteCache<Integer, String> c = g.cache(DEFAULT_CACHE_NAME);
 
             GridDhtCacheAdapter<Integer, String> dht = dht(c);
 
@@ -506,7 +506,7 @@ public class GridCacheDhtPreloadSelfTest extends GridCommonAbstractTest {
         try {
             Ignite ignite1 = startGrid(0);
 
-            IgniteCache<Integer, String> cache1 = ignite1.cache(null);
+            IgniteCache<Integer, String> cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
 
             putKeys(cache1, keyCnt);
             checkKeys(cache1, keyCnt, F.asList(ignite1));
@@ -517,7 +517,7 @@ public class GridCacheDhtPreloadSelfTest extends GridCommonAbstractTest {
 
             // Check all nodes.
             for (Ignite g : ignites) {
-                IgniteCache<Integer, String> c = g.cache(null);
+                IgniteCache<Integer, String> c = g.cache(DEFAULT_CACHE_NAME);
 
                 checkKeys(c, keyCnt, ignites);
             }
@@ -580,7 +580,7 @@ public class GridCacheDhtPreloadSelfTest extends GridCommonAbstractTest {
 
                 // Check all left nodes.
                 for (Ignite gg : ignites) {
-                    IgniteCache<Integer, String> c = gg.cache(null);
+                    IgniteCache<Integer, String> c = gg.cache(DEFAULT_CACHE_NAME);
 
                     checkKeys(c, keyCnt, ignites);
                 }
@@ -588,7 +588,7 @@ public class GridCacheDhtPreloadSelfTest extends GridCommonAbstractTest {
 
             assert last != null;
 
-            IgniteCache<Integer, String> lastCache = last.cache(null);
+            IgniteCache<Integer, String> lastCache = last.cache(DEFAULT_CACHE_NAME);
 
             GridDhtCacheAdapter<Integer, String> dht = dht(lastCache);
 
@@ -677,7 +677,7 @@ public class GridCacheDhtPreloadSelfTest extends GridCommonAbstractTest {
         Map<String, String> map = new HashMap<>();
 
         for (Ignite g : grids) {
-            IgniteCache<Integer, String> c = g.cache(null);
+            IgniteCache<Integer, String> c = g.cache(DEFAULT_CACHE_NAME);
 
             GridDhtCacheAdapter<Integer, String> dht = dht(c);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadStartStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadStartStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadStartStopSelfTest.java
index 94918f6..407f69b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadStartStopSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadStartStopSelfTest.java
@@ -185,7 +185,7 @@ public class GridCacheDhtPreloadStartStopSelfTest extends GridCommonAbstractTest
         try {
             Ignite g1 = startGrid(0);
 
-            IgniteCache<Integer, String> c1 = g1.cache(null);
+            IgniteCache<Integer, String> c1 = g1.cache(DEFAULT_CACHE_NAME);
 
             putKeys(c1, keyCnt);
             checkKeys(c1, keyCnt);
@@ -196,7 +196,7 @@ public class GridCacheDhtPreloadStartStopSelfTest extends GridCommonAbstractTest
 
             // Check all nodes.
             for (Ignite g : ignites) {
-                IgniteCache<Integer, String> c = g.cache(null);
+                IgniteCache<Integer, String> c = g.cache(DEFAULT_CACHE_NAME);
 
                 checkKeys(c, keyCnt);
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java
index 96078e2..bc5e3d4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheDhtPreloadUnloadSelfTest.java
@@ -131,7 +131,7 @@ public class GridCacheDhtPreloadUnloadSelfTest extends GridCommonAbstractTest {
 
             int cnt = 1000;
 
-            populate(grid(0).<Integer, String>cache(null), cnt);
+            populate(grid(0).<Integer, String>cache(DEFAULT_CACHE_NAME), cnt);
 
             int gridCnt = 2;
 
@@ -158,7 +158,7 @@ public class GridCacheDhtPreloadUnloadSelfTest extends GridCommonAbstractTest {
 
             int cnt = 1000;
 
-            populate(grid(0).<Integer, String>cache(null), cnt);
+            populate(grid(0).<Integer, String>cache(DEFAULT_CACHE_NAME), cnt);
 
             int gridCnt = 2;
 
@@ -173,10 +173,10 @@ public class GridCacheDhtPreloadUnloadSelfTest extends GridCommonAbstractTest {
             Thread.sleep(wait);
 
             for (int i = 0; i < gridCnt; i++)
-                info("Grid size [i=" + i + ", size=" + grid(i).cache(null).localSize() + ']');
+                info("Grid size [i=" + i + ", size=" + grid(i).cache(DEFAULT_CACHE_NAME).localSize() + ']');
 
             for (int i = 0; i < gridCnt; i++) {
-                IgniteCache<Integer, String> c = grid(i).cache(null);
+                IgniteCache<Integer, String> c = grid(i).cache(DEFAULT_CACHE_NAME);
 
                 // Nothing should be unloaded since nodes are backing up each other.
                 assertEquals(cnt, c.localSize(CachePeekMode.ALL));
@@ -203,7 +203,7 @@ public class GridCacheDhtPreloadUnloadSelfTest extends GridCommonAbstractTest {
             boolean err = false;
 
             for (int i = 0; i < gridCnt; i++) {
-                IgniteCache<Integer, String> c = grid(i).cache(null);
+                IgniteCache<Integer, String> c = grid(i).cache(DEFAULT_CACHE_NAME);
 
                 if (c.localSize() >= cnt)
                     err = true;
@@ -216,10 +216,10 @@ public class GridCacheDhtPreloadUnloadSelfTest extends GridCommonAbstractTest {
         }
 
         for (int i = 0; i < gridCnt; i++)
-            info("Grid size [i=" + i + ", size=" + grid(i).cache(null).localSize() + ']');
+            info("Grid size [i=" + i + ", size=" + grid(i).cache(DEFAULT_CACHE_NAME).localSize() + ']');
 
         for (int i = 0; i < gridCnt; i++) {
-            IgniteCache<Integer, String> c = grid(i).cache(null);
+            IgniteCache<Integer, String> c = grid(i).cache(DEFAULT_CACHE_NAME);
 
             assert c.localSize() < cnt;
         }
@@ -237,7 +237,7 @@ public class GridCacheDhtPreloadUnloadSelfTest extends GridCommonAbstractTest {
 
             int cnt = 1000;
 
-            populate(grid(0).<Integer, String>cache(null), cnt);
+            populate(grid(0).<Integer, String>cache(DEFAULT_CACHE_NAME), cnt);
 
             int gridCnt = 3;
 
@@ -245,7 +245,7 @@ public class GridCacheDhtPreloadUnloadSelfTest extends GridCommonAbstractTest {
                 startGrid(i);
 
                 for (int j = 0; j <= i; j++)
-                    info("Grid size [i=" + i + ", size=" + grid(j).cache(null).localSize() + ']');
+                    info("Grid size [i=" + i + ", size=" + grid(j).cache(DEFAULT_CACHE_NAME).localSize() + ']');
             }
 
             long wait = 3000;
@@ -271,10 +271,10 @@ public class GridCacheDhtPreloadUnloadSelfTest extends GridCommonAbstractTest {
 
                 @Override public void onLifecycleEvent(LifecycleEventType evt) {
                     if (evt == LifecycleEventType.AFTER_NODE_START) {
-                        IgniteCache<Integer, String> c = ignite.cache(null);
+                        IgniteCache<Integer, String> c = ignite.cache(DEFAULT_CACHE_NAME);
 
                         if (c.putIfAbsent(-1, "true")) {
-                            populate(ignite.<Integer, String>cache(null), cnt);
+                            populate(ignite.<Integer, String>cache(DEFAULT_CACHE_NAME), cnt);
 
                             info(">>> POPULATED GRID <<<");
                         }
@@ -288,7 +288,7 @@ public class GridCacheDhtPreloadUnloadSelfTest extends GridCommonAbstractTest {
                 startGrid(i);
 
                 for (int j = 0; j < i; j++)
-                    info("Grid size [i=" + i + ", size=" + grid(j).cache(null).localSize() + ']');
+                    info("Grid size [i=" + i + ", size=" + grid(j).cache(DEFAULT_CACHE_NAME).localSize() + ']');
             }
 
             long wait = 3000;

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledMetricsSelfTest.java
index 7e9533f..6c2da72 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedNearDisabledMetricsSelfTest.java
@@ -80,7 +80,7 @@ public class GridCachePartitionedNearDisabledMetricsSelfTest extends GridCacheAb
     public void testGettingRemovedKey() throws Exception {
         fail("https://issues.apache.org/jira/browse/IGNITE-819");
 
-        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+        IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);
 
         cache.put(0, 0);
 
@@ -88,14 +88,14 @@ public class GridCachePartitionedNearDisabledMetricsSelfTest extends GridCacheAb
             Ignite g = grid(i);
 
             // TODO: getting of removed key will produce 3 inner read operations.
-            g.cache(null).removeAll();
+            g.cache(DEFAULT_CACHE_NAME).removeAll();
 
             // TODO: getting of removed key will produce inner write and 4 inner read operations.
-            //((IgniteKernal)g).cache(null).remove(0);
+            //((IgniteKernal)g).cache(DEFAULT_CACHE_NAME).remove(0);
 
-            assert g.cache(null).localSize() == 0;
+            assert g.cache(DEFAULT_CACHE_NAME).localSize() == 0;
 
-            g.cache(null).mxBean().clear();
+            g.cache(DEFAULT_CACHE_NAME).mxBean().clear();
         }
 
         assertNull("Value is not null for key: " + 0, cache.get(0));
@@ -107,7 +107,7 @@ public class GridCachePartitionedNearDisabledMetricsSelfTest extends GridCacheAb
         long misses = 0;
 
         for (int i = 0; i < gridCount(); i++) {
-            CacheMetrics m = grid(i).cache(null).localMetrics();
+            CacheMetrics m = grid(i).cache(DEFAULT_CACHE_NAME).localMetrics();
 
             removes += m.getCacheRemovals();
             reads += m.getCacheGets();

http://git-wip-us.apache.org/repos/asf/ignite/blob/8f9edebf/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedPreloadEventsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedPreloadEventsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedPreloadEventsSelfTest.java
index 3e7645b..bc62a72 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedPreloadEventsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedPreloadEventsSelfTest.java
@@ -117,7 +117,7 @@ public class GridCachePartitionedPreloadEventsSelfTest extends GridCachePreloadE
 
         Collection<Integer> keys = new HashSet<>();
 
-        IgniteCache<Integer, String> cache = g1.cache(null);
+        IgniteCache<Integer, String> cache = g1.cache(DEFAULT_CACHE_NAME);
 
         for (int i = 0; i < 100; i++) {
             keys.add(i);
@@ -126,7 +126,7 @@ public class GridCachePartitionedPreloadEventsSelfTest extends GridCachePreloadE
 
         Ignite g2 = startGrid("g2");
 
-        Map<ClusterNode, Collection<Object>> keysMap = g1.affinity(null).mapKeysToNodes(keys);
+        Map<ClusterNode, Collection<Object>> keysMap = g1.affinity(DEFAULT_CACHE_NAME).mapKeysToNodes(keys);
         Collection<Object> g2Keys = keysMap.get(g2.cluster().localNode());
 
         assertNotNull(g2Keys);
@@ -134,7 +134,7 @@ public class GridCachePartitionedPreloadEventsSelfTest extends GridCachePreloadE
 
         for (Object key : g2Keys)
             // Need to force keys loading.
-            assertEquals("val", g2.cache(null).getAndPut(key, "changed val"));
+            assertEquals("val", g2.cache(DEFAULT_CACHE_NAME).getAndPut(key, "changed val"));
 
         Collection<Event> evts = g2.events().localQuery(F.<Event>alwaysTrue(), EVT_CACHE_REBALANCE_OBJECT_LOADED);