http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListenerSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListenerSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListenerSelfTest.java
new file mode 100644
index 0000000..64af249
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreSessionListenerSelfTest.java
@@ -0,0 +1,175 @@
+/*
+ * 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.jdbc;
+
+import org.apache.ignite.cache.store.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.resources.*;
+import org.h2.jdbcx.*;
+
+import javax.cache.*;
+import javax.cache.configuration.*;
+import javax.cache.integration.*;
+import java.sql.*;
+import java.util.*;
+
+/**
+ * Tests for {@link CacheJdbcStoreSessionListener}.
+ */
+public class CacheJdbcStoreSessionListenerSelfTest 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() {
+                CacheJdbcStoreSessionListener lsnr = new 
CacheJdbcStoreSessionListener();
+
+                lsnr.setDataSource(JdbcConnectionPool.create(URL, "", ""));
+
+                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();
+
+            checkConnection();
+        }
+
+        /** {@inheritDoc} */
+        @Override public Integer load(Integer key) throws CacheLoaderException 
{
+            loadCnt.incrementAndGet();
+
+            checkConnection();
+
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public void write(Cache.Entry<? extends Integer, ? extends 
Integer> entry)
+            throws CacheWriterException {
+            writeCnt.incrementAndGet();
+
+            checkConnection();
+
+            if (write.get()) {
+                Connection conn = ses.attachment();
+
+                try {
+                    String table;
+
+                    switch (ses.cacheName()) {
+                        case "cache1":
+                            table = "Table1";
+
+                            break;
+
+                        case "cache2":
+                            if (fail.get())
+                                throw new CacheWriterException("Expected 
failure.");
+
+                            table = "Table2";
+
+                            break;
+
+                        default:
+                            throw new CacheWriterException("Wring cache: " + 
ses.cacheName());
+                    }
+
+                    PreparedStatement stmt = conn.prepareStatement(
+                        "INSERT INTO " + table + " (key, value) VALUES (?, 
?)");
+
+                    stmt.setInt(1, entry.getKey());
+                    stmt.setInt(2, entry.getValue());
+
+                    stmt.executeUpdate();
+                }
+                catch (SQLException e) {
+                    throw new CacheWriterException(e);
+                }
+            }
+        }
+
+        /** {@inheritDoc} */
+        @Override public void delete(Object key) throws CacheWriterException {
+            deleteCnt.incrementAndGet();
+
+            checkConnection();
+        }
+
+        /** {@inheritDoc} */
+        @Override public void sessionEnd(boolean commit) {
+            assertNull(ses.attachment());
+        }
+
+        /**
+         */
+        private void checkConnection() {
+            Connection conn = ses.attachment();
+
+            assertNotNull(conn);
+
+            try {
+                assertFalse(conn.isClosed());
+                assertFalse(conn.getAutoCommit());
+            }
+            catch (SQLException e) {
+                throw new RuntimeException(e);
+            }
+
+            verifySameInstance(conn);
+        }
+
+        /**
+         * @param conn Connection.
+         */
+        private void verifySameInstance(Connection conn) {
+            Map<String, Connection> props = ses.properties();
+
+            Connection sesConn = props.get(SES_CONN_KEY);
+
+            if (sesConn == null)
+                props.put(SES_CONN_KEY, conn);
+            else {
+                assertSame(conn, sesConn);
+
+                reuseCnt.incrementAndGet();
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/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 6735021..7bc8dd6 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
@@ -47,6 +47,7 @@ public class GridAffinitySelfTest extends 
GridCommonAbstractTest {
 
         disco.setMaxMissedHeartbeats(Integer.MAX_VALUE);
         disco.setIpFinder(IP_FINDER);
+        disco.setForceServerMode(true);
 
         cfg.setDiscoverySpi(disco);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoveryEventSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoveryEventSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoveryEventSelfTest.java
index 9d98768..3981b7f 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoveryEventSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/GridDiscoveryEventSelfTest.java
@@ -33,7 +33,7 @@ import java.util.*;
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
 
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static java.util.concurrent.TimeUnit.*;
 import static org.apache.ignite.events.EventType.*;
 
 /**
@@ -165,8 +165,6 @@ public class GridDiscoveryEventSelfTest extends 
GridCommonAbstractTest {
                 private AtomicInteger cnt = new AtomicInteger();
 
                 @Override public boolean apply(Event evt) {
-                    assert evt.type() == EVT_NODE_LEFT;
-
                     evts.put(cnt.getAndIncrement(), ((DiscoveryEvent) 
evt).topologyNodes());
 
                     latch.countDown();
@@ -232,7 +230,8 @@ public class GridDiscoveryEventSelfTest extends 
GridCommonAbstractTest {
                 private AtomicInteger cnt = new AtomicInteger();
 
                 @Override public boolean apply(Event evt) {
-                    assert evt.type() == EVT_NODE_JOINED || evt.type() == 
EVT_NODE_LEFT;
+                    assert evt.type() == EVT_NODE_JOINED
+                        || evt.type() == EVT_NODE_LEFT || evt.type() == 
EVT_NODE_FAILED;
 
                     evts.put(cnt.getAndIncrement(), ((DiscoveryEvent) 
evt).topologyNodes());
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/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 3f5df1c..992d7bf 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
@@ -33,6 +33,9 @@ import org.apache.ignite.testframework.junits.common.*;
 import java.util.*;
 import java.util.concurrent.*;
 
+import static java.util.concurrent.TimeUnit.*;
+import static org.apache.ignite.events.EventType.*;
+
 /**
  * Fail fast test.
  */
@@ -78,7 +81,7 @@ public class GridFailFastNodeFailureDetectionSelfTest extends 
GridCommonAbstract
 
                     return true;
                 }
-            }, EventType.EVT_NODE_FAILED);
+            }, EVT_NODE_FAILED);
         }
 
         Ignite ignite1 = ignite(0);
@@ -100,7 +103,7 @@ public class GridFailFastNodeFailureDetectionSelfTest 
extends GridCommonAbstract
 
         failNode(ignite1);
 
-        assert failLatch.await(500, TimeUnit.MILLISECONDS);
+        assert failLatch.await(1000, MILLISECONDS);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionAbstractTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionAbstractTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionAbstractTest.java
index 0171290..cb1341c 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionAbstractTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionAbstractTest.java
@@ -20,9 +20,13 @@ package org.apache.ignite.internal;
 import org.apache.ignite.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.compute.*;
+import org.apache.ignite.configuration.*;
 import org.apache.ignite.events.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.lang.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.apache.ignite.testframework.junits.common.*;
 import org.jetbrains.annotations.*;
 
@@ -38,6 +42,9 @@ import static org.apache.ignite.events.EventType.*;
  */
 @SuppressWarnings("deprecation")
 public abstract class GridProjectionAbstractTest extends 
GridCommonAbstractTest implements Externalizable {
+    /** VM ip finder for TCP discovery. */
+    private static TcpDiscoveryIpFinder ipFinder = new 
TcpDiscoveryVmIpFinder(true);
+
     /** Waiting timeout. */
     private static final int WAIT_TIMEOUT = 30000;
 
@@ -87,6 +94,15 @@ public abstract class GridProjectionAbstractTest extends 
GridCommonAbstractTest
         // No-op.
     }
 
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        cfg.setDiscoverySpi(new 
TcpDiscoverySpi().setForceServerMode(true).setIpFinder(ipFinder));
+
+        return cfg;
+    }
+
     /**
      * @param startGrid Start grid flag.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/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 0a961d4..04cd3f0 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
@@ -52,9 +52,14 @@ public class GridProjectionForCachesSelfTest extends 
GridCommonAbstractTest {
 
         cfg.setDiscoverySpi(discoverySpi());
 
-        cfg.setCacheConfiguration(
-            cacheConfiguration(null, new AttributeFilter(getTestGridName(0)), 
false),
-            cacheConfiguration(CACHE_NAME, new 
AttributeFilter(getTestGridName(2), getTestGridName(3)), true));
+        List<CacheConfiguration> ccfgs = new ArrayList<>();
+
+        if (gridName.equals(getTestGridName(0)))
+            ccfgs.add(cacheConfiguration(null, new 
AttributeFilter(getTestGridName(0)), false));
+        else if (gridName.equals(getTestGridName(2)) || 
gridName.equals(getTestGridName(3)))
+            ccfgs.add(cacheConfiguration(CACHE_NAME, new 
AttributeFilter(getTestGridName(2), getTestGridName(3)), true));
+
+        cfg.setCacheConfiguration(ccfgs.toArray(new 
CacheConfiguration[ccfgs.size()]));
 
         return cfg;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java
index 284aa0c..96d5f1a 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/GridReleaseTypeSelfTest.java
@@ -27,7 +27,6 @@ import org.apache.ignite.testframework.junits.common.*;
 
 import java.io.*;
 import java.util.*;
-import java.util.concurrent.atomic.*;
 
 /**
  * Test grids starting with non compatible release types.
@@ -36,49 +35,56 @@ public class GridReleaseTypeSelfTest extends 
GridCommonAbstractTest {
     /** IP finder. */
     private static final TcpDiscoveryIpFinder IP_FINDER = new 
TcpDiscoveryVmIpFinder(true);
 
-    /** Counter. */
-    private static final AtomicInteger cnt = new AtomicInteger();
-
     /** */
-    private String firstNodeVer;
+    private String nodeVer;
 
     /** */
-    private String secondNodeVer;
+    private boolean clientMode;
 
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
-        final int idx = cnt.getAndIncrement();
+        if (clientMode)
+            cfg.setClientMode(true);
 
-        // Override node attributes in discovery spi.
         TcpDiscoverySpi discoSpi = new TcpDiscoverySpi() {
-            @Override public void setNodeAttributes(Map<String, Object> attrs, 
IgniteProductVersion ver) {
+            @Override public void setNodeAttributes(Map<String, Object> attrs,
+                IgniteProductVersion ver) {
                 super.setNodeAttributes(attrs, ver);
 
-                if (idx % 2 == 0)
-                    attrs.put(IgniteNodeAttributes.ATTR_BUILD_VER, 
firstNodeVer);
-                else
-                    attrs.put(IgniteNodeAttributes.ATTR_BUILD_VER, 
secondNodeVer);
+                attrs.put(IgniteNodeAttributes.ATTR_BUILD_VER, nodeVer);
             }
         };
 
-        discoSpi.setIpFinder(IP_FINDER);
+        discoSpi.setIpFinder(IP_FINDER).setForceServerMode(true);
 
         cfg.setDiscoverySpi(discoSpi);
 
         return cfg;
     }
 
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        clientMode = false;
+
+        stopAllGrids();
+    }
+
     /**
      * @throws Exception If failed.
      */
     public void testOsEditionDoesNotSupportRollingUpdates() throws Exception {
-        firstNodeVer = "1.0.0";
-        secondNodeVer = "1.0.1";
+        nodeVer = "1.0.0";
+
+        startGrid(0);
 
         try {
-            startGrids(2);
+            nodeVer = "1.0.1";
+
+            startGrid(1);
+
+            fail("Exception has not been thrown.");
         }
         catch (IgniteCheckedException e) {
             StringWriter errors = new StringWriter();
@@ -87,17 +93,36 @@ public class GridReleaseTypeSelfTest extends 
GridCommonAbstractTest {
 
             String stackTrace = errors.toString();
 
-            assertTrue(
-                "Caught exception does not contain specified string.",
-                stackTrace.contains("Local node and remote node have different 
version numbers")
-            );
-
-            return;
+            if (!stackTrace.contains("Local node and remote node have 
different version numbers"))
+                throw e;
         }
-        finally {
-            stopAllGrids();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testOsEditionDoesNotSupportRollingUpdatesClientMode() throws 
Exception {
+        nodeVer = "1.0.0";
+
+        startGrid(0);
+
+        try {
+            nodeVer = "1.0.1";
+            clientMode = true;
+
+            startGrid(1);
+
+            fail("Exception has not been thrown.");
         }
+        catch (IgniteCheckedException e) {
+            StringWriter errors = new StringWriter();
+
+            e.printStackTrace(new PrintWriter(errors));
 
-        fail("Exception has not been thrown.");
+            String stackTrace = errors.toString();
+
+            if (!stackTrace.contains("Local node and remote node have 
different version numbers"))
+                throw e;
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java 
b/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
index b4dce6c..7f5ee54 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridSelfTest.java
@@ -118,8 +118,8 @@ public class GridSelfTest extends 
GridProjectionAbstractTest {
 
         g.message().remoteListen(null, new MessagingListenActor<String>() {
             @Override protected void receive(UUID nodeId, String rcvMsg) 
throws Throwable {
-                assert locNodeId.equals(nodeId);
-                assert msg.equals(rcvMsg);
+                assertEquals(locNodeId, nodeId);
+                assertEquals(msg, rcvMsg);
 
                 stop(rcvMsg);
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/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 8c2ce02..ba61890 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
@@ -52,7 +52,7 @@ public class GridDiscoveryManagerAliveCacheSelfTest extends 
GridCommonAbstractTe
     private static final int TMP_NODES_CNT = 3;
 
     /** */
-    private static final int ITERATIONS = 20;
+    private static final int ITERATIONS = 10;
 
     /** */
     private int gridCntr;
@@ -64,6 +64,9 @@ public class GridDiscoveryManagerAliveCacheSelfTest extends 
GridCommonAbstractTe
     private volatile CountDownLatch latch;
 
     /** */
+    private boolean clientMode;
+
+    /** */
     private final IgnitePredicate<Event> lsnr = new IgnitePredicate<Event>() {
         @Override public boolean apply(Event evt) {
             assertNotNull("Topology lost nodes before stopTempNodes() was 
called.", latch);
@@ -93,7 +96,15 @@ public class GridDiscoveryManagerAliveCacheSelfTest extends 
GridCommonAbstractTe
 
         TcpDiscoverySpi disc = new TcpDiscoverySpi();
 
+        if (clientMode && ((gridName.charAt(gridName.length() - 1) - '0') & 1) 
!= 0)
+            cfg.setClientMode(true);
+        else
+            disc.setMaxMissedClientHeartbeats(50);
+
+        disc.setHeartbeatFrequency(500);
         disc.setIpFinder(IP_FINDER);
+        disc.setAckTimeout(1000);
+        disc.setSocketTimeout(1000);
 
         cfg.setCacheConfiguration(cCfg);
         cfg.setDiscoverySpi(disc);
@@ -123,7 +134,7 @@ public class GridDiscoveryManagerAliveCacheSelfTest extends 
GridCommonAbstractTe
     /**
      * @throws Exception If failed.
      */
-    public void testAlives() throws Exception {
+    private void doTestAlive() throws Exception {
         for (int i = 0; i < ITERATIONS; i++) {
             info("Performing iteration: " + i);
 
@@ -146,6 +157,24 @@ public class GridDiscoveryManagerAliveCacheSelfTest 
extends GridCommonAbstractTe
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testAlives() throws Exception {
+        clientMode = false;
+
+        doTestAlive();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testAlivesClient() throws Exception {
+        clientMode = true;
+
+        doTestAlive();
+    }
+
+    /**
      * Waits while topology on all nodes became equals to the expected size.
      *
      * @param nodesCnt Expected nodes count.
@@ -154,6 +183,8 @@ public class GridDiscoveryManagerAliveCacheSelfTest extends 
GridCommonAbstractTe
     @SuppressWarnings("BusyWait")
     private void awaitDiscovery(long nodesCnt) throws InterruptedException {
         for (Ignite g : alive) {
+            
((TcpDiscoverySpi)g.configuration().getDiscoverySpi()).waitForClientMessagePrecessed();
+
             while (g.cluster().nodes().size() != nodesCnt)
                 Thread.sleep(10);
         }
@@ -192,7 +223,7 @@ public class GridDiscoveryManagerAliveCacheSelfTest extends 
GridCommonAbstractTe
                     });
 
                 assertTrue(
-                    
currTop.contains(GridCacheUtils.oldest(k.internalCache().context(), new 
AffinityTopologyVersion(currVer))));
+                    
currTop.contains(GridCacheUtils.oldestAliveCacheServerNode(k.context().cache().context(),
 new AffinityTopologyVersion(currVer))));
             }
         }
     }
@@ -218,23 +249,28 @@ public class GridDiscoveryManagerAliveCacheSelfTest 
extends GridCommonAbstractTe
      * Stops temporary nodes.
      */
     private void stopTempNodes() {
-        int rmv = 0;
+        Collection<Ignite> toRmv = new ArrayList<>(alive.subList(0, 
TMP_NODES_CNT));
 
-        Collection<Ignite> toRmv = new ArrayList<>(TMP_NODES_CNT);
+        alive.removeAll(toRmv);
+
+        // Remove listeners to avoid receiving events from stopping nodes.
+        for (Ignite g : toRmv)
+            g.events().stopLocalListen(lsnr, EventType.EVT_NODE_LEFT, 
EventType.EVT_NODE_FAILED);
 
-        for (Iterator<Ignite> iter = alive.iterator(); iter.hasNext() && rmv < 
TMP_NODES_CNT;) {
-            toRmv.add(iter.next());
+        for (Iterator<Ignite> itr = toRmv.iterator(); itr.hasNext(); ) {
+            Ignite g = itr.next();
 
-            iter.remove();
+            if (g.cluster().localNode().isClient()) {
+                G.stop(g.name(), false);
 
-            rmv++;
+                itr.remove();
+            }
         }
 
-        // Remove listeners to avoid receiving events from stopping nodes.
-        for (Ignite g : toRmv)
-            g.events().stopLocalListen(lsnr, EventType.EVT_NODE_LEFT, 
EventType.EVT_NODE_FAILED);
+        for (Ignite g : toRmv) {
+            assert !g.cluster().localNode().isClient();
 
-        for (Ignite g : toRmv)
             G.stop(g.name(), false);
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
index 538ea39..e76c615 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
@@ -29,7 +29,7 @@ import static 
org.apache.ignite.configuration.DeploymentMode.*;
 /**
  * Tests for node attributes consistency checks.
  */
-public class GridDiscoveryManagerAttributesSelfTest extends 
GridCommonAbstractTest {
+public abstract class GridDiscoveryManagerAttributesSelfTest extends 
GridCommonAbstractTest {
     /** */
     private static final String PREFER_IPV4 = "java.net.preferIPv4Stack";
 
@@ -37,7 +37,7 @@ public class GridDiscoveryManagerAttributesSelfTest extends 
GridCommonAbstractTe
     private static final TcpDiscoveryIpFinder IP_FINDER = new 
TcpDiscoveryVmIpFinder(true);
 
     /** */
-    private static DeploymentMode mode = SHARED;
+    private static DeploymentMode mode;
 
     /** */
     private static boolean p2pEnabled;
@@ -46,18 +46,34 @@ public class GridDiscoveryManagerAttributesSelfTest extends 
GridCommonAbstractTe
     @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
-        TcpDiscoverySpi disc = new TcpDiscoverySpi();
-
-        disc.setIpFinder(IP_FINDER);
+        if (gridName.equals(getTestGridName(1)))
+            cfg.setClientMode(true);
 
         cfg.setIncludeProperties(PREFER_IPV4);
         cfg.setDeploymentMode(mode);
         cfg.setPeerClassLoadingEnabled(p2pEnabled);
-        cfg.setDiscoverySpi(disc);
+
+        TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
+
+        discoverySpi.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(discoverySpi);
 
         return cfg;
     }
 
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        mode = SHARED;
+
+        p2pEnabled = false;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids();
+    }
+
     /**
      * @throws Exception If failed.
      */
@@ -83,44 +99,35 @@ public class GridDiscoveryManagerAttributesSelfTest extends 
GridCommonAbstractTe
      * @throws Exception If failed.
      */
     public void testPreferIpV4StackDifferentValues() throws Exception {
-        try {
-            System.setProperty(PREFER_IPV4, "true");
+        System.setProperty(PREFER_IPV4, "true");
 
-            for (int i = 0; i < 2; i++) {
-                Ignite g = startGrid(i);
+        for (int i = 0; i < 2; i++) {
+            Ignite g = startGrid(i);
 
-                assert 
"true".equals(g.cluster().localNode().attribute(PREFER_IPV4));
-            }
+            assert 
"true".equals(g.cluster().localNode().attribute(PREFER_IPV4));
+        }
 
-            System.setProperty(PREFER_IPV4, "false");
+        System.setProperty(PREFER_IPV4, "false");
 
-            startGrid(2);
-        }
-        finally {
-            stopAllGrids();
-        }
+        startGrid(2);
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testDifferentDeploymentModes() throws Exception {
-        try {
-            startGrid(1);
+        startGrid(0);
 
-            mode = CONTINUOUS;
+        mode = CONTINUOUS;
 
-            try {
-                startGrid(2);
+        try {
+            startGrid(1);
 
-                fail();
-            }
-            catch (IgniteCheckedException e) {
-                assertTrue(e.getCause().getMessage().startsWith("Remote node 
has deployment mode different from"));
-            }
+            fail();
         }
-        finally {
-            stopAllGrids();
+        catch (IgniteCheckedException e) {
+            if (!e.getCause().getMessage().startsWith("Remote node has 
deployment mode different from"))
+                throw e;
         }
     }
 
@@ -128,23 +135,18 @@ public class GridDiscoveryManagerAttributesSelfTest 
extends GridCommonAbstractTe
      * @throws Exception If failed.
      */
     public void testDifferentPeerClassLoadingEnabledFlag() throws Exception {
-        try {
-            startGrid(1);
+        startGrid(0);
 
-            p2pEnabled = true;
+        p2pEnabled = true;
 
-            try {
-                startGrid(2);
+        try {
+            startGrid(1);
 
-                fail();
-            }
-            catch (IgniteCheckedException e) {
-                assertTrue(e.getCause().getMessage().startsWith("Remote node 
has peer class loading enabled flag " +
-                    "different from"));
-            }
+            fail();
         }
-        finally {
-            stopAllGrids();
+        catch (IgniteCheckedException e) {
+            if (!e.getCause().getMessage().startsWith("Remote node has peer 
class loading enabled flag different from"))
+                throw e;
         }
     }
 
@@ -153,19 +155,35 @@ public class GridDiscoveryManagerAttributesSelfTest 
extends GridCommonAbstractTe
      * @throws Exception If failed.
      */
     private void testPreferIpV4Stack(boolean preferIpV4) throws Exception {
-        try {
-            String val = String.valueOf(preferIpV4);
+        String val = String.valueOf(preferIpV4);
 
-            System.setProperty(PREFER_IPV4, val);
+        System.setProperty(PREFER_IPV4, val);
 
-            for (int i = 0; i < 2; i++) {
-                Ignite g = startGrid(i);
+        for (int i = 0; i < 2; i++) {
+            Ignite g = startGrid(i);
 
-                assert 
val.equals(g.cluster().localNode().attribute(PREFER_IPV4));
-            }
+            assert val.equals(g.cluster().localNode().attribute(PREFER_IPV4));
         }
-        finally {
-            stopAllGrids();
+    }
+
+    /**
+     *
+     */
+    public static class RegularDiscovery extends 
GridDiscoveryManagerAttributesSelfTest {
+        /** {@inheritDoc} */
+        @Override protected IgniteConfiguration getConfiguration(String 
gridName) throws Exception {
+            IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+            ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);
+
+            return cfg;
         }
     }
+
+    /**
+     *
+     */
+    public static class ClientDiscovery extends 
GridDiscoveryManagerAttributesSelfTest {
+        // No-op.
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerSelfTest.java
index 6f7c935..65aec49 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerSelfTest.java
@@ -33,7 +33,7 @@ import static org.apache.ignite.cache.CacheMode.*;
 /**
  *
  */
-public class GridDiscoveryManagerSelfTest extends GridCommonAbstractTest {
+public abstract class GridDiscoveryManagerSelfTest extends 
GridCommonAbstractTest {
     /** */
     private static final String CACHE_NAME = "cache";
 
@@ -50,12 +50,6 @@ public class GridDiscoveryManagerSelfTest extends 
GridCommonAbstractTest {
     @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
-        TcpDiscoverySpi disc = new TcpDiscoverySpi();
-
-        disc.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(disc);
-
         CacheConfiguration ccfg1 = defaultCacheConfiguration();
 
         ccfg1.setName(CACHE_NAME);
@@ -66,14 +60,21 @@ public class GridDiscoveryManagerSelfTest extends 
GridCommonAbstractTest {
 
         if (gridName.equals(getTestGridName(1)))
             cfg.setClientMode(true);
+        else {
+            ccfg1.setNearConfiguration(null);
+            ccfg2.setNearConfiguration(null);
 
-        ccfg1.setNearConfiguration(null);
-        ccfg2.setNearConfiguration(null);
+            ccfg1.setCacheMode(PARTITIONED);
+            ccfg2.setCacheMode(PARTITIONED);
+
+            cfg.setCacheConfiguration(ccfg1, ccfg2);
+        }
 
-        ccfg1.setCacheMode(PARTITIONED);
-        ccfg2.setCacheMode(PARTITIONED);
+        TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
 
-        cfg.setCacheConfiguration(ccfg1, ccfg2);
+        discoverySpi.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(discoverySpi);
 
         return cfg;
     }
@@ -186,4 +187,25 @@ public class GridDiscoveryManagerSelfTest extends 
GridCommonAbstractTest {
         assertTrue(g0.context().discovery().hasNearCache(null, four));
         assertFalse(g0.context().discovery().hasNearCache(null, five));
     }
+
+    /**
+     *
+     */
+    public static class RegularDiscovery extends GridDiscoveryManagerSelfTest {
+        /** {@inheritDoc} */
+        @Override protected IgniteConfiguration getConfiguration(String 
gridName) throws Exception {
+            IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+            ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);
+
+            return cfg;
+        }
+    }
+
+    /**
+     *
+     */
+    public static class ClientDiscovery extends GridDiscoveryManagerSelfTest {
+        // No-op.
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/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 e7fab8e..7da3728 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
@@ -54,6 +54,7 @@ public abstract class GridAffinityProcessorAbstractSelfTest 
extends GridCommonAb
 
         TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
 
+        discoSpi.setForceServerMode(true);
         discoSpi.setIpFinder(ipFinder);
 
         cfg.setDiscoverySpi(discoSpi);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadOnlyTransactionalClientSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadOnlyTransactionalClientSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadOnlyTransactionalClientSelfTest.java
new file mode 100644
index 0000000..f2c38e1
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheReadOnlyTransactionalClientSelfTest.java
@@ -0,0 +1,327 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.store.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import javax.cache.*;
+import javax.cache.configuration.*;
+import javax.cache.processor.*;
+
+import static org.apache.ignite.IgniteSystemProperties.*;
+
+/**
+ * Tests for read-only transactional cache client.
+ */
+public class CacheReadOnlyTransactionalClientSelfTest extends 
GridCommonAbstractTest {
+    /** */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new 
TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    private static final String CACHE_NAME = "test-cache";
+
+    /** */
+    private boolean client;
+
+    /** */
+    private boolean nearEnabled;
+
+    /** */
+    private Factory<CacheStore> factory;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        cfg.setClientMode(client);
+
+        CacheConfiguration cc = new CacheConfiguration();
+
+        cc.setName(CACHE_NAME);
+        cc.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+        cc.setCacheStoreFactory(factory);
+
+        if (client && nearEnabled)
+            cc.setNearConfiguration(new NearCacheConfiguration());
+
+        cfg.setCacheConfiguration(cc);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(disco);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        client = false;
+        factory = new Factory1();
+
+        startGrids(2);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopGrid();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCorrectStore() throws Exception {
+        client = true;
+        nearEnabled = false;
+        factory = new Factory1();
+
+        Ignite ignite = startGrid();
+
+        IgniteCache cache = ignite.cache(CACHE_NAME);
+
+        cache.get(0);
+        cache.getAll(F.asSet(0, 1));
+        cache.getAndPut(0, 0);
+        cache.getAndPutIfAbsent(0, 0);
+        cache.getAndRemove(0);
+        cache.getAndReplace(0, 0);
+        cache.put(0, 0);
+        cache.putAll(F.asMap(0, 0, 1, 1));
+        cache.putIfAbsent(0, 0);
+        cache.remove(0);
+        cache.remove(0, 0);
+        cache.removeAll(F.asSet(0, 1));
+        cache.removeAll();
+        cache.invoke(0, new EP());
+        cache.invokeAll(F.asSet(0, 1), new EP());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testInvalidStore() throws Exception {
+        client = true;
+        nearEnabled = false;
+        factory = new Factory2();
+
+        try {
+            startGrid();
+
+            assert false : "Exception was not thrown.";
+        }
+        catch (Exception e) {
+            assert e.getMessage().startsWith("Store factory mismatch") : 
e.getMessage();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testDisabledConsistencyCheck() throws Exception {
+        client = false;
+        nearEnabled = false;
+        factory = new Factory2();
+
+        System.setProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, 
"true");
+
+        startGrid("client-1");
+
+        factory = new Factory1();
+
+        System.clearProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK);
+
+        startGrid("client-2");
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNoStoreNearDisabled() throws Exception {
+        nearEnabled = false;
+
+        doTestNoStore();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNoStoreNearEnabled() throws Exception {
+        nearEnabled = true;
+
+        doTestNoStore();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void doTestNoStore() throws Exception {
+        client = true;
+        factory = null;
+
+        Ignite ignite = startGrid();
+
+        IgniteCache cache = ignite.cache(CACHE_NAME);
+
+        cache.get(0);
+        cache.getAll(F.asSet(0, 1));
+
+        try {
+            cache.getAndPut(0, 0);
+        }
+        catch (CacheException e) {
+            assert e.getMessage().startsWith("Updates are not allowed for 
transactional cache: " + CACHE_NAME + ".") :
+                e.getMessage();
+        }
+
+        try {
+            cache.getAndPutIfAbsent(0, 0);
+        }
+        catch (CacheException e) {
+            assert e.getMessage().startsWith("Updates are not allowed for 
transactional cache: " + CACHE_NAME + ".") :
+                e.getMessage();
+        }
+
+        try {
+            cache.getAndRemove(0);
+        }
+        catch (CacheException e) {
+            assert e.getMessage().startsWith("Updates are not allowed for 
transactional cache: " + CACHE_NAME + ".") :
+                e.getMessage();
+        }
+
+        try {
+            cache.getAndReplace(0, 0);
+        }
+        catch (CacheException e) {
+            assert e.getMessage().startsWith("Updates are not allowed for 
transactional cache: " + CACHE_NAME + ".") :
+                e.getMessage();
+        }
+
+        try {
+            cache.put(0, 0);
+        }
+        catch (CacheException e) {
+            assert e.getMessage().startsWith("Updates are not allowed for 
transactional cache: " + CACHE_NAME + ".") :
+                e.getMessage();
+        }
+
+        try {
+            cache.putAll(F.asMap(0, 0, 1, 1));
+        }
+        catch (CacheException e) {
+            assert e.getMessage().startsWith("Updates are not allowed for 
transactional cache: " + CACHE_NAME + ".") :
+                e.getMessage();
+        }
+
+        try {
+            cache.putIfAbsent(0, 0);
+        }
+        catch (CacheException e) {
+            assert e.getMessage().startsWith("Updates are not allowed for 
transactional cache: " + CACHE_NAME + ".") :
+                e.getMessage();
+        }
+
+        try {
+            cache.remove(0);
+        }
+        catch (CacheException e) {
+            assert e.getMessage().startsWith("Updates are not allowed for 
transactional cache: " + CACHE_NAME + ".") :
+                e.getMessage();
+        }
+
+        try {
+            cache.remove(0, 0);
+        }
+        catch (CacheException e) {
+            assert e.getMessage().startsWith("Updates are not allowed for 
transactional cache: " + CACHE_NAME + ".") :
+                e.getMessage();
+        }
+
+        try {
+            cache.removeAll(F.asSet(0, 1));
+        }
+        catch (CacheException e) {
+            assert e.getMessage().startsWith("Updates are not allowed for 
transactional cache: " + CACHE_NAME + ".") :
+                e.getMessage();
+        }
+
+        try {
+            cache.removeAll();
+        }
+        catch (CacheException e) {
+            assert e.getMessage().startsWith("Updates are not allowed for 
transactional cache: " + CACHE_NAME + ".") :
+                e.getMessage();
+        }
+
+        try {
+            cache.invoke(0, new EP());
+        }
+        catch (CacheException e) {
+            assert e.getMessage().startsWith("Updates are not allowed for 
transactional cache: " + CACHE_NAME + ".") :
+                e.getMessage();
+        }
+
+        try {
+            cache.invokeAll(F.asSet(0, 1), new EP());
+        }
+        catch (CacheException e) {
+            assert e.getMessage().startsWith("Updates are not allowed for 
transactional cache: " + CACHE_NAME + ".") :
+                e.getMessage();
+        }
+    }
+
+    /**
+     */
+    private static class Factory1 implements Factory<CacheStore> {
+        /** {@inheritDoc} */
+        @Override public CacheStore create() {
+            return null;
+        }
+    }
+
+    /**
+     */
+    private static class Factory2 implements Factory<CacheStore> {
+        /** {@inheritDoc} */
+        @Override public CacheStore create() {
+            return null;
+        }
+    }
+
+    /**
+     */
+    private static class EP implements CacheEntryProcessor {
+        @Override public Object process(MutableEntry entry, Object... 
arguments) {
+            return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/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 f5de96f..1d4d2f4 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
@@ -32,7 +32,7 @@ import java.util.concurrent.atomic.*;
 public class CacheRemoveAllSelfTest extends GridCacheAbstractSelfTest {
     /** {@inheritDoc} */
     @Override protected long getTestTimeout() {
-        return 60000;
+        return 2 * 60 * 1000;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/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 5d9ad35..6b7d1b8 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
@@ -74,7 +74,7 @@ public abstract class GridCacheAbstractFailoverSelfTest 
extends GridCacheAbstrac
 
         discoSpi.setSocketTimeout(10_000);
         discoSpi.setAckTimeout(10_000);
-        discoSpi.setNetworkTimeout(10_000);
+        discoSpi.setNetworkTimeout(60_000);
 
         return cfg;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/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 70d8f9c..9bfbd15 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
@@ -33,6 +33,7 @@ import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
+import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.swapspace.inmemory.*;
 import org.apache.ignite.testframework.*;
 import org.apache.ignite.transactions.*;
@@ -130,6 +131,8 @@ public abstract class GridCacheAbstractFullApiSelfTest 
extends GridCacheAbstract
     @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);
+
         if (memoryMode() == OFFHEAP_TIERED || memoryMode() == OFFHEAP_VALUES)
             cfg.setSwapSpaceSpi(new GridTestSwapSpaceSpi());
 
@@ -3913,6 +3916,33 @@ public abstract class GridCacheAbstractFullApiSelfTest 
extends GridCacheAbstract
     /**
      * @throws Exception If failed.
      */
+    public void testIterator() throws Exception {
+        IgniteCache<Integer, Integer> cache = grid(0).cache(null);
+
+        final int KEYS = 1000;
+
+        for (int i = 0; i < KEYS; i++)
+            cache.put(i, i);
+
+        // Try to initialize readers in case when near cache is enabled.
+        for (int i = 0; i < gridCount(); i++) {
+            cache = grid(i).cache(null);
+
+            for (int k = 0; k < KEYS; k++)
+                assertEquals((Object)k, cache.get(k));
+        }
+
+        int cnt = 0;
+
+        for (Cache.Entry e : cache)
+            cnt++;
+
+        assertEquals(KEYS, cnt);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
     public void testIgniteCacheIterator() throws Exception {
         IgniteCache<String, Integer> cache = jcache(0);
 
@@ -4863,6 +4893,89 @@ public abstract class GridCacheAbstractFullApiSelfTest 
extends GridCacheAbstract
     }
 
     /**
+     * @throws Exception If failed.
+     */
+    public void testGetOutTx() throws Exception {
+        checkGetOutTx(false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testGetOutTxAsync() throws Exception {
+        checkGetOutTx(true);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    private void checkGetOutTx(boolean async) throws Exception {
+        final AtomicInteger lockEvtCnt = new AtomicInteger();
+
+        IgnitePredicate<Event> lsnr = new IgnitePredicate<Event>() {
+            @Override public boolean apply(Event evt) {
+                lockEvtCnt.incrementAndGet();
+
+                return true;
+            }
+        };
+
+        try {
+            IgniteCache<String, Integer> cache = grid(0).cache(null);
+
+            List<String> keys = primaryKeysForCache(cache, 2);
+
+            assertEquals(2, keys.size());
+
+            cache.put(keys.get(0), 0);
+            cache.put(keys.get(1), 1);
+
+            grid(0).events().localListen(lsnr, EVT_CACHE_OBJECT_LOCKED, 
EVT_CACHE_OBJECT_UNLOCKED);
+
+            if (async)
+                cache = cache.withAsync();
+
+            try (Transaction tx = transactions().txStart(PESSIMISTIC, 
REPEATABLE_READ)) {
+                Integer val0 = cache.get(keys.get(0));
+
+                if (async)
+                    val0 = cache.<Integer>future().get();
+
+                assertEquals(0, val0.intValue());
+
+                Map<String, Integer> allOutTx = 
cache.getAllOutTx(F.asSet(keys.get(1)));
+
+                if (async)
+                    allOutTx = cache.<Map<String, Integer>>future().get();
+
+                assertEquals(1, allOutTx.size());
+
+                assertTrue(allOutTx.containsKey(keys.get(1)));
+
+                assertEquals(1, allOutTx.get(keys.get(1)).intValue());
+            }
+
+            assertTrue(GridTestUtils.waitForCondition(new PA() {
+                @Override public boolean apply() {
+                    info("Lock event count: " + lockEvtCnt.get());
+                    if (atomicityMode() == ATOMIC)
+                        return lockEvtCnt.get() == 0;
+
+                    if (cacheMode() == PARTITIONED && nearEnabled()) {
+                        if (!grid(0).configuration().isClientMode())
+                            return lockEvtCnt.get() == 4;
+                    }
+
+                    return lockEvtCnt.get() == 2;
+                }
+            }, 15000));
+        }
+        finally {
+            grid(0).events().stopLocalListen(lsnr, EVT_CACHE_OBJECT_LOCKED, 
EVT_CACHE_OBJECT_UNLOCKED);
+        }
+    }
+
+    /**
      * Sets given value, returns old value.
      */
     public static final class SetValueProcessor implements 
EntryProcessor<String, Integer, Integer> {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/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 1821e12..bb1732e 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
@@ -38,7 +38,7 @@ import static java.util.concurrent.TimeUnit.*;
  */
 public abstract class GridCacheAbstractMetricsSelfTest extends 
GridCacheAbstractSelfTest {
     /** */
-    private static final int KEY_CNT = 50;
+    private static final int KEY_CNT = 500;
 
     /** {@inheritDoc} */
     @Override protected boolean swapEnabled() {
@@ -163,24 +163,18 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
 
         IgniteCache<Object, Object> cacheAsync = cache.withAsync();
 
-        cache.put(1, 1);
-        cache.put(2, 2);
+        for (int i = 0; i < KEY_CNT; i++)
+            cache.put(i, i);
 
         assertEquals(cache.metrics().getAverageRemoveTime(), 0.0, 0.0);
 
-        cacheAsync.getAndRemove(1);
-
-        IgniteFuture<Object> fut = cacheAsync.future();
-
-        assertEquals(1, (int)fut.get());
-
-        assert cache.metrics().getAverageRemoveTime() > 0;
-
-        cacheAsync.getAndRemove(2);
+        for (int i = 0; i < KEY_CNT; i++) {
+            cacheAsync.getAndRemove(i);
 
-        fut = cacheAsync.future();
+            IgniteFuture<Object> fut = cacheAsync.future();
 
-        assertEquals(2, (int)fut.get());
+            fut.get();
+        }
 
         assert cache.metrics().getAverageRemoveTime() > 0;
     }
@@ -221,18 +215,13 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
     public void testRemoveAvgTime() throws Exception {
         IgniteCache<Integer, Integer> cache = grid(0).cache(null);
 
-        cache.put(1, 1);
-        cache.put(2, 2);
+        for (int i = 0; i < KEY_CNT; i++)
+            cache.put(i, i);
 
         assertEquals(cache.metrics().getAverageRemoveTime(), 0.0, 0.0);
 
-        cache.remove(1);
-
-        float avgRmvTime = cache.metrics().getAverageRemoveTime();
-
-        assert avgRmvTime > 0;
-
-        cache.remove(2);
+        for (int i = 0; i < KEY_CNT; i++)
+            cache.remove(i);
 
         assert cache.metrics().getAverageRemoveTime() > 0;
     }
@@ -378,17 +367,12 @@ public abstract class GridCacheAbstractMetricsSelfTest 
extends GridCacheAbstract
         assertEquals(0.0, cache.metrics().getAveragePutTime(), 0.0);
         assertEquals(0, cache.metrics().getCachePuts());
 
-        cache.put(1, 1);
-
-        float avgPutTime = cache.metrics().getAveragePutTime();
-
-        assert avgPutTime >= 0;
-
-        assertEquals(1, cache.metrics().getCachePuts());
+        for (int i = 0; i < KEY_CNT; i++)
+            cache.put(i, i);
 
-        cache.put(2, 2);
+        assert cache.metrics().getAveragePutTime() > 0;
 
-        assert cache.metrics().getAveragePutTime() >= 0;
+        assertEquals(KEY_CNT, cache.metrics().getCachePuts());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/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 c6ede61..2b6a6b0 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
@@ -18,10 +18,12 @@
 package org.apache.ignite.internal.processors.cache;
 
 import org.apache.ignite.*;
+import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.testframework.*;
 import org.jsr166.*;
 
@@ -71,6 +73,18 @@ public abstract class GridCacheAbstractRemoveFailureTest 
extends GridCacheAbstra
     private String sizePropVal;
 
     /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);
+
+        if (testClientNode() && getTestGridName(0).equals(gridName))
+            cfg.setClientMode(true);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
     @Override protected int gridCount() {
         return GRID_CNT;
     }
@@ -106,9 +120,18 @@ public abstract class GridCacheAbstractRemoveFailureTest 
extends GridCacheAbstra
     }
 
     /**
+     * @return {@code True} if test updates from client node.
+     */
+    protected boolean testClientNode() {
+        return false;
+    }
+
+    /**
      * @throws Exception If failed.
      */
     public void testPutAndRemove() throws Exception {
+        assertEquals(testClientNode(), 
(boolean)grid(0).configuration().isClientMode());
+
         final IgniteCache<Integer, Integer> sndCache0 = grid(0).cache(null);
 
         final AtomicBoolean stop = new AtomicBoolean();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/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 ad09ba1..3f14f49 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
@@ -57,7 +57,7 @@ public abstract class GridCacheAbstractSelfTest extends 
GridCommonAbstractTest {
     protected static final Map<Object, Object> map = new 
ConcurrentHashMap8<>();
 
     /** VM ip finder for TCP discovery. */
-    private static TcpDiscoveryIpFinder ipFinder = new 
TcpDiscoveryVmIpFinder(true);
+    protected static TcpDiscoveryIpFinder ipFinder = new 
TcpDiscoveryVmIpFinder(true);
 
     /**
      * @return Grids count to start.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/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 da2b81c..db4061a 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
@@ -60,6 +60,7 @@ public class GridCacheAtomicMessageCountSelfTest extends 
GridCommonAbstractTest
 
         TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
 
+        discoSpi.setForceServerMode(true);
         discoSpi.setIpFinder(ipFinder);
 
         cfg.setDiscoverySpi(discoSpi);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/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 8a1ae78..bba4ad9 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
@@ -26,7 +26,6 @@ import org.apache.ignite.cluster.*;
 import org.apache.ignite.compute.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.processors.cache.query.*;
 import org.apache.ignite.internal.processors.cache.distributed.dht.*;
 import org.apache.ignite.internal.processors.cache.distributed.near.*;
 import org.apache.ignite.internal.util.*;
@@ -38,6 +37,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.apache.ignite.testframework.junits.common.*;
 import org.apache.ignite.transactions.*;
+
 import org.jetbrains.annotations.*;
 
 import java.io.*;
@@ -110,7 +110,11 @@ public class GridCacheConcurrentTxMultiNodeTest extends 
GridCommonAbstractTest {
             CacheConfiguration cc = defaultCacheConfiguration();
 
             cc.setCacheMode(mode);
-            cc.setEvictionPolicy(new LruEvictionPolicy(1000));
+
+            LruEvictionPolicy plc = new LruEvictionPolicy();
+            plc.setMaxSize(1000);
+
+            cc.setEvictionPolicy(plc);
             cc.setEvictSynchronized(false);
             cc.setSwapEnabled(false);
             cc.setWriteSynchronizationMode(FULL_SYNC);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/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 44171a8..445a5e1 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
@@ -442,7 +442,12 @@ public class GridCacheConfigurationConsistencySelfTest 
extends GridCommonAbstrac
                 /** {@inheritDoc} */
                 @Override public Void apply(CacheConfiguration cfg) {
                     cfg.setEvictSynchronized(true);
-                    cfg.setEvictionPolicy(new FifoEvictionPolicy(100));
+
+                    FifoEvictionPolicy plc = new FifoEvictionPolicy();
+
+                    plc.setMaxSize(100);
+
+                    cfg.setEvictionPolicy(plc);
                     return null;
                 }
             },
@@ -450,7 +455,12 @@ public class GridCacheConfigurationConsistencySelfTest 
extends GridCommonAbstrac
                 /** {@inheritDoc} */
                 @Override public Void apply(CacheConfiguration cfg) {
                     cfg.setEvictSynchronized(false);
-                    cfg.setEvictionPolicy(new FifoEvictionPolicy(100));
+
+                    FifoEvictionPolicy plc = new FifoEvictionPolicy();
+
+                    plc.setMaxSize(100);
+
+                    cfg.setEvictionPolicy(plc);
                     return null;
                 }
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheExAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheExAbstractFullApiSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheExAbstractFullApiSelfTest.java
deleted file mode 100644
index 7a1b7cc..0000000
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheExAbstractFullApiSelfTest.java
+++ /dev/null
@@ -1,103 +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.internal.processors.cache;
-
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.events.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.testframework.*;
-import org.apache.ignite.transactions.*;
-
-import java.util.concurrent.atomic.*;
-
-import static org.apache.ignite.events.EventType.*;
-import static org.apache.ignite.transactions.TransactionConcurrency.*;
-import static org.apache.ignite.transactions.TransactionIsolation.*;
-
-/**
- * Abstract test for private cache interface.
- */
-public abstract class GridCacheExAbstractFullApiSelfTest extends 
GridCacheAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected int gridCount() {
-        return 4;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected NearCacheConfiguration nearConfiguration() {
-        return null;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testGetOutTx() throws Exception {
-        final AtomicInteger lockEvtCnt = new AtomicInteger();
-
-        IgnitePredicate<Event> lsnr = new IgnitePredicate<Event>() {
-            @Override public boolean apply(Event evt) {
-                lockEvtCnt.incrementAndGet();
-
-                return true;
-            }
-        };
-
-        try {
-            grid(0).events().localListen(lsnr, EVT_CACHE_OBJECT_LOCKED, 
EVT_CACHE_OBJECT_UNLOCKED);
-
-            GridCacheAdapter<String, Integer> cache = 
((IgniteKernal)grid(0)).internalCache();
-
-            try (Transaction tx = transactions().txStart(PESSIMISTIC, 
REPEATABLE_READ)) {
-                int key = 0;
-
-                for (int i = 0; i < 1000; i++) {
-                    if (grid(0).affinity(null).mapKeyToNode("key" + 
i).id().equals(grid(0).localNode().id())) {
-                        key = i;
-
-                        break;
-                    }
-                }
-
-                cache.get("key" + key);
-
-                for (int i = key + 1; i < 1000; i++) {
-                    if (grid(0).affinity(null).mapKeyToNode("key" + 
i).id().equals(grid(0).localNode().id())) {
-                        key = i;
-
-                        break;
-                    }
-                }
-
-                cache.getAllOutTx(F.asList("key" + key));
-            }
-
-            assertTrue(GridTestUtils.waitForCondition(new PA() {
-                @Override public boolean apply() {
-                    info("Lock event count: " + lockEvtCnt.get());
-
-                    return lockEvtCnt.get() == (nearEnabled() ? 4 : 2);
-                }
-            }, 15000));
-        }
-        finally {
-            grid(0).events().stopLocalListen(lsnr, EVT_CACHE_OBJECT_LOCKED, 
EVT_CACHE_OBJECT_UNLOCKED);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMemoryModeSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMemoryModeSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMemoryModeSelfTest.java
index cc3b072..5629a96 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMemoryModeSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMemoryModeSelfTest.java
@@ -27,6 +27,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.apache.ignite.spi.swapspace.file.*;
 import org.apache.ignite.testframework.junits.common.*;
+
 import org.junit.*;
 
 import java.util.*;
@@ -80,7 +81,9 @@ public class GridCacheMemoryModeSelfTest extends 
GridCommonAbstractTest {
     }
 
     /**
-     * @return Cache configuration.
+     * Returns cache configuration.
+     *
+     * @return cache configuration.
      */
     protected CacheConfiguration cacheConfiguration() {
         CacheConfiguration cacheCfg = defaultCacheConfiguration();
@@ -90,7 +93,16 @@ public class GridCacheMemoryModeSelfTest extends 
GridCommonAbstractTest {
         cacheCfg.setSwapEnabled(swapEnabled);
         cacheCfg.setCacheMode(mode);
         cacheCfg.setMemoryMode(memoryMode);
-        cacheCfg.setEvictionPolicy(maxOnheapSize == Integer.MAX_VALUE ? null : 
new LruEvictionPolicy(maxOnheapSize));
+
+        LruEvictionPolicy plc = null;
+
+        if (maxOnheapSize != Integer.MAX_VALUE) {
+            plc = new LruEvictionPolicy();
+            plc.setMaxSize(maxOnheapSize);
+        }
+
+        cacheCfg.setEvictionPolicy(plc);
+
         cacheCfg.setAtomicityMode(atomicity);
         cacheCfg.setOffHeapMaxMemory(offheapSize);
 
@@ -200,7 +212,8 @@ public class GridCacheMemoryModeSelfTest extends 
GridCommonAbstractTest {
      * @param swapEmpty Swap is empty.
      * @throws Exception If failed.
      */
-    private void doTestPutAndPutAll(int cache, int offheapSwap, boolean 
offheapEmpty, boolean swapEmpty) throws Exception {
+    private void doTestPutAndPutAll(int cache, int offheapSwap, boolean 
offheapEmpty, boolean swapEmpty)
+        throws Exception {
         final int all = cache + offheapSwap;
 
         // put
@@ -232,7 +245,8 @@ public class GridCacheMemoryModeSelfTest extends 
GridCommonAbstractTest {
      * @param x Cache modifier.
      * @throws IgniteCheckedException If failed.
      */
-    void doTest(int cache, int offheapSwap, boolean offheapEmpty, boolean 
swapEmpty, CIX1<IgniteCache<String, Integer>> x) throws Exception {
+    void doTest(int cache, int offheapSwap, boolean offheapEmpty, boolean 
swapEmpty,
+        CIX1<IgniteCache<String, Integer>> x) throws Exception {
         ipFinder = new TcpDiscoveryVmIpFinder(true);
 
         startGrid();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/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 266937f..2fad523 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
@@ -56,7 +56,7 @@ public class GridCacheMixedPartitionExchangeSelfTest extends 
GridCommonAbstractT
     @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
-        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+        
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder).setForceServerMode(true);
 
         if (cache)
             cfg.setCacheConfiguration(cacheConfiguration());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java
index e10d626..09f9042 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest.java
@@ -20,7 +20,7 @@ package org.apache.ignite.internal.processors.cache;
 import org.apache.ignite.configuration.*;
 
 /**
- *
+ * TODO: IGNITE-809.
  */
 public class GridCacheMultinodeUpdateNearEnabledNoBackupsSelfTest extends 
GridCacheMultinodeUpdateNearEnabledSelfTest {
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java
index 982f7b8..201aa44 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMultinodeUpdateNearEnabledSelfTest.java
@@ -23,7 +23,7 @@ import org.apache.ignite.configuration.*;
 import static org.apache.ignite.cache.CacheAtomicityMode.*;
 
 /**
- *
+ * TODO: IGNITE-809.
  */
 public class GridCacheMultinodeUpdateNearEnabledSelfTest extends 
GridCacheMultinodeUpdateAbstractSelfTest {
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTest.java
index d69f7fa..f7e3962 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheOffHeapTest.java
@@ -76,7 +76,10 @@ public class GridCacheOffHeapTest extends 
GridCommonAbstractTest {
         cacheCfg.setStartSize(startSize);
 
         if (onheap > 0) {
-            cacheCfg.setEvictionPolicy(new FifoEvictionPolicy(onheap));
+            FifoEvictionPolicy plc = new FifoEvictionPolicy();
+            plc.setMaxSize(onheap);
+
+            cacheCfg.setEvictionPolicy(plc);
 
             cacheCfg.setOffHeapMaxMemory(80 * 1024L * 1024L * 1024L); // 10GB
         }
@@ -89,7 +92,9 @@ public class GridCacheOffHeapTest extends 
GridCommonAbstractTest {
     /**
      * @throws Exception If failed.
      */
-    public void _testOnHeapReplicatedPerformance() throws Exception {
+    public void testOnHeapReplicatedPerformance() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-817";);
+        
         mode = REPLICATED;
         onheap = 0;
         startSize = 18 * 1024 * 1024;
@@ -100,7 +105,9 @@ public class GridCacheOffHeapTest extends 
GridCommonAbstractTest {
     /**
      * @throws Exception If failed.
      */
-    public void _testOnHeapPartitionedPerformance() throws Exception {
+    public void testOnHeapPartitionedPerformance() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-817";);
+        
         mode = PARTITIONED;
         onheap = 0;
         startSize = 18 * 1024 * 1024;
@@ -111,7 +118,9 @@ public class GridCacheOffHeapTest extends 
GridCommonAbstractTest {
     /**
      * @throws Exception If failed.
      */
-    public void _testOffHeapReplicatedPerformance() throws Exception {
+    public void testOffHeapReplicatedPerformance() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-817";);
+        
         mode = REPLICATED;
         onheap = 1024 * 1024;
         startSize = onheap;
@@ -122,7 +131,9 @@ public class GridCacheOffHeapTest extends 
GridCommonAbstractTest {
     /**
      * @throws Exception If failed.
      */
-    public void _testOffHeapPartitionedPerformance() throws Exception {
+    public void testOffHeapPartitionedPerformance() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-817";);
+        
         mode = PARTITIONED;
         onheap = 4 * 1024 * 1024;
 
@@ -132,7 +143,9 @@ public class GridCacheOffHeapTest extends 
GridCommonAbstractTest {
     /**
      * @throws Exception If failed.
      */
-    public void _testOnHeapReplicatedPerformanceMultithreaded() throws 
Exception {
+    public void testOnHeapReplicatedPerformanceMultithreaded() throws 
Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-817";);
+        
         mode = REPLICATED;
         onheap = 0;
         startSize = 18 * 1024 * 1024;
@@ -143,7 +156,9 @@ public class GridCacheOffHeapTest extends 
GridCommonAbstractTest {
     /**
      * @throws Exception If failed.
      */
-    public void _testOnHeapPartitionedPerformanceMultithreaded() throws 
Exception {
+    public void testOnHeapPartitionedPerformanceMultithreaded() throws 
Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-817";);
+        
         mode = PARTITIONED;
         onheap = 0;
         startSize = 18 * 1024 * 1024;
@@ -165,7 +180,9 @@ public class GridCacheOffHeapTest extends 
GridCommonAbstractTest {
     /**
      * @throws Exception If failed.
      */
-    public void _testOffHeapPartitionedPerformanceMultithreaded() throws 
Exception {
+    public void testOffHeapPartitionedPerformanceMultithreaded() throws 
Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-817";);
+        
         mode = PARTITIONED;
         onheap = 4 * 1024 * 1024;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
index ae36c4de..4ef5787 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
@@ -49,6 +49,11 @@ import static 
org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
  * Tests putAll() method along with failover and different configurations.
  */
 public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-157";);
+    }
+
     /** IP finder. */
     private static TcpDiscoveryIpFinder ipFinder = new 
TcpDiscoveryVmIpFinder(true);
 
@@ -617,6 +622,7 @@ public class GridCachePutAllFailoverSelfTest extends 
GridCommonAbstractTest {
 
         discoverySpi.setAckTimeout(60000);
         discoverySpi.setIpFinder(ipFinder);
+        discoverySpi.setForceServerMode(true);
 
         cfg.setDiscoverySpi(discoverySpi);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReloadSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReloadSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReloadSelfTest.java
index e2cdd08..b6bfbc7 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReloadSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheReloadSelfTest.java
@@ -74,7 +74,11 @@ public class GridCacheReloadSelfTest extends 
GridCommonAbstractTest {
         CacheConfiguration cacheCfg = defaultCacheConfiguration();
         cacheCfg.setName(CACHE_NAME);
         cacheCfg.setCacheMode(cacheMode);
-        cacheCfg.setEvictionPolicy(new LruEvictionPolicy(MAX_CACHE_ENTRIES));
+
+        LruEvictionPolicy plc = new LruEvictionPolicy();
+        plc.setMaxSize(MAX_CACHE_ENTRIES);
+
+        cacheCfg.setEvictionPolicy(plc);
         cacheCfg.setNearConfiguration(nearEnabled ? new 
NearCacheConfiguration() : null);
 
         final CacheStore store = new CacheStoreAdapter<Integer, Integer>() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/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 3e5987a..7723319 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
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.cache;
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.configuration.*;
+import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.testframework.junits.common.*;
 
 import javax.cache.processor.*;
@@ -62,6 +63,8 @@ public class GridCacheReturnValueTransferSelfTest extends 
GridCommonAbstractTest
 
         cfg.setCacheConfiguration(ccfg);
 
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);
+
         if (!cache)
             cfg.setClientMode(true);
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d78aa15/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 1d7c2bd..ccf2332 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
@@ -36,6 +36,11 @@ import static org.apache.ignite.cache.CacheMode.*;
  * Tests correct cache stopping.
  */
 public class GridCacheStopSelfTest extends GridCommonAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        fail("https://issues.apache.org/jira/browse/IGNITE-257";);
+    }
+
     /** */
     private static final String EXPECTED_MSG = "Grid is in invalid state to 
perform this operation. " +
         "It either not started yet or has already being or have stopped";

Reply via email to