ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [06/55] [abbrv] incubator-ignite git commit: #ignite-128: Moved classes in other packages.
Date Tue, 10 Feb 2015 15:58:53 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/756034f3/modules/clients/src/test/java/org/apache/ignite/client/integration/ClientTcpUnreachableMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/client/integration/ClientTcpUnreachableMultiNodeSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/client/integration/ClientTcpUnreachableMultiNodeSelfTest.java
deleted file mode 100644
index 5450fa7..0000000
--- a/modules/clients/src/test/java/org/apache/ignite/client/integration/ClientTcpUnreachableMultiNodeSelfTest.java
+++ /dev/null
@@ -1,147 +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.client.integration;
-
-import org.apache.ignite.client.*;
-import org.apache.ignite.internal.client.*;
-import org.apache.ignite.internal.client.balancer.*;
-import org.apache.ignite.internal.util.typedef.*;
-
-import java.net.*;
-import java.util.*;
-
-/**
- * Test for TCP binary rest protocol with unreachable address.
- */
-public class ClientTcpUnreachableMultiNodeSelfTest extends ClientTcpMultiNodeSelfTest {
-    /** {@inheritDoc} */
-    @Override protected GridClientLoadBalancer getBalancer() {
-        final GridClientLoadBalancer b = super.getBalancer();
-
-        return new TestGridClientLoadBalancer(b);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected GridClientConfiguration clientConfiguration() throws GridClientException {
-        GridClientConfiguration cfg = super.clientConfiguration();
-
-        // Setting low connection timeout to allow multiple threads
-        // pass the unavailable address quickly.
-        cfg.setConnectTimeout(100);
-
-        return cfg;
-    }
-
-    /**
-     *
-     */
-    private class TestGridClientLoadBalancer implements GridClientLoadBalancer, GridClientTopologyListener {
-        /** */
-        private final GridClientLoadBalancer b;
-
-        /**
-         * @param b Delegating balancer.
-         */
-        TestGridClientLoadBalancer(GridClientLoadBalancer b) {
-            this.b = b;
-        }
-
-        /** {@inheritDoc} */
-        @Override public GridClientNode balancedNode(Collection<? extends GridClientNode> nodes)
-            throws GridClientException {
-            final GridClientNode node = b.balancedNode(nodes);
-
-            return new GridClientNode() {
-                @Override public <T> T attribute(String name) {
-                    return node.attribute(name);
-                }
-
-                @Override public Map<String, Object> attributes() {
-                    return node.attributes();
-                }
-
-                @Override public Collection<InetSocketAddress> availableAddresses(GridClientProtocol proto,
-                    boolean filterResolved) {
-                    // Fake address first.
-                    return F.asList(new InetSocketAddress("172.22.13.13", 65432),
-                        F.first(node.availableAddresses(proto, filterResolved)));
-                }
-
-                @Override public Map<String, GridClientCacheMode> caches() {
-                    return node.caches();
-                }
-
-                @Override public int replicaCount() {
-                    return node.replicaCount();
-                }
-
-                @Override public List<String> jettyAddresses() {
-                    return node.jettyAddresses();
-                }
-
-                @Override public List<String> jettyHostNames() {
-                    return node.jettyHostNames();
-                }
-
-                @Override public int httpPort() {
-                    return node.httpPort();
-                }
-
-                @Override public List<String> tcpAddresses() {
-                    return node.tcpAddresses();
-                }
-
-                @Override public List<String> tcpHostNames() {
-                    return node.tcpHostNames();
-                }
-
-                @Override public GridClientNodeMetrics metrics() {
-                    return node.metrics();
-                }
-
-                @Override public UUID nodeId() {
-                    return node.nodeId();
-                }
-
-                @Override public Object consistentId() {
-                    return node.consistentId();
-                }
-
-                @Override public int tcpPort() {
-                    return node.tcpPort();
-                }
-
-                @Override public boolean connectable() {
-                    return node.connectable();
-                }
-            };
-        }
-
-        /** {@inheritDoc} */
-        @Override public void onNodeAdded(GridClientNode node) {
-            if (b instanceof GridClientTopologyListener)
-                ((GridClientTopologyListener)b).onNodeAdded(node);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void onNodeRemoved(GridClientNode node) {
-            if (b instanceof GridClientTopologyListener)
-                ((GridClientTopologyListener)b).onNodeRemoved(node);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/756034f3/modules/clients/src/test/java/org/apache/ignite/client/integration/package.html
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/client/integration/package.html b/modules/clients/src/test/java/org/apache/ignite/client/integration/package.html
deleted file mode 100644
index 056f9fb..0000000
--- a/modules/clients/src/test/java/org/apache/ignite/client/integration/package.html
+++ /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.
-  -->
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<body>
-    <img alt="icon" class="javadocimg" src="{@docRoot}/img/cube.gif"/>
-    Contains intergration tests involving API, Client implementation and REST processor.
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/756034f3/modules/clients/src/test/java/org/apache/ignite/client/router/ClientFailedInitSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/client/router/ClientFailedInitSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/client/router/ClientFailedInitSelfTest.java
deleted file mode 100644
index c28b915..0000000
--- a/modules/clients/src/test/java/org/apache/ignite/client/router/ClientFailedInitSelfTest.java
+++ /dev/null
@@ -1,277 +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.client.router;
-
-import org.apache.ignite.*;
-import org.apache.ignite.client.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.client.*;
-import org.apache.ignite.internal.client.impl.connection.*;
-import org.apache.ignite.internal.client.router.*;
-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.internal.util.typedef.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.util.*;
-
-import static org.apache.ignite.internal.client.GridClientProtocol.*;
-import static org.apache.ignite.client.integration.ClientAbstractSelfTest.*;
-import static org.apache.ignite.IgniteSystemProperties.*;
-
-/**
- *
- */
-public class ClientFailedInitSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final int RECONN_CNT = 3;
-
-    /** */
-    private static final long TOP_REFRESH_PERIOD = 5000;
-
-    /** */
-    private static final int ROUTER_BINARY_PORT = BINARY_PORT + 1;
-
-    /** */
-    private static final int ROUTER_JETTY_PORT = 8081;
-
-    /** */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        GridClientFactory.stopAll();
-        GridRouterFactory.stopAllRouters();
-        stopAllGrids();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        assert cfg.getClientConnectionConfiguration() == null;
-
-        cfg.setLocalHost(HOST);
-
-        ClientConnectionConfiguration clientCfg = new ClientConnectionConfiguration();
-
-        clientCfg.setRestTcpPort(BINARY_PORT);
-        clientCfg.setRestJettyPath(REST_JETTY_CFG);
-
-        cfg.setClientConnectionConfiguration(clientCfg);
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(disco);
-
-        return cfg;
-    }
-
-    /**
-     *
-     */
-    public void testEmptyAddresses() {
-        try {
-            GridClientFactory.start(new GridClientConfiguration());
-
-            assert false;
-        }
-        catch (GridClientException e) {
-            info("Caught expected exception: " + e);
-        }
-    }
-
-    /**
-     *
-     */
-    public void testRoutersAndServersAddressesProvided() {
-        try {
-            GridClientConfiguration c = new GridClientConfiguration();
-
-            c.setRouters(Collections.singleton("127.0.0.1:10000"));
-            c.setServers(Collections.singleton("127.0.0.1:10000"));
-
-            GridClientFactory.start(c);
-
-            assert false;
-        }
-        catch (GridClientException e) {
-            info("Caught expected exception: " + e);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTcpClient() throws Exception {
-        doTestClient(TCP);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTcpRouter() throws Exception {
-        doTestRouter(TCP);
-    }
-
-    /**
-     * @param p Protocol.
-     * @throws Exception If failed.
-     */
-    @SuppressWarnings("BusyWait")
-    private void doTestClient(GridClientProtocol p) throws Exception {
-        GridClient c = client(p, false);
-
-        for (int i = 0; i < RECONN_CNT; i++) {
-            try {
-                c.compute().nodes();
-            }
-            catch (GridClientDisconnectedException e) {
-                assertTrue(X.hasCause(e,
-                    GridServerUnreachableException.class, GridClientConnectionResetException.class));
-            }
-
-            startGrid();
-
-            try {
-                Thread.sleep(TOP_REFRESH_PERIOD * 2);
-
-                c.compute().nodes();
-
-                assertEquals("arg", c.compute().execute(TestTask.class.getName(), "arg"));
-            }
-            finally {
-                stopGrid();
-            }
-
-            Thread.sleep(TOP_REFRESH_PERIOD * 2);
-        }
-    }
-
-    /**
-     * @param p Protocol.
-     * @throws Exception If failed.
-     */
-    @SuppressWarnings("BusyWait")
-    private void doTestRouter(GridClientProtocol p) throws Exception {
-        startRouters();
-
-        GridClient c = client(p, true);
-
-        for (int i = 0; i < RECONN_CNT; i++) {
-            try {
-                c.compute().nodes();
-
-                fail("Nodes list should fail while grid is stopped.");
-            }
-            catch (GridClientDisconnectedException e) {
-                assertTrue(X.hasCause(e, GridClientException.class));
-            }
-
-            startGrid();
-
-            try {
-                Thread.sleep(TOP_REFRESH_PERIOD * 2);
-
-                c.compute().nodes();
-
-                assertEquals("arg", c.compute().execute(TestTask.class.getName(), "arg"));
-            }
-            finally {
-                stopGrid();
-            }
-
-            Thread.sleep(TOP_REFRESH_PERIOD * 2);
-        }
-    }
-
-    /**
-     * @return Grid.
-     * @throws Exception If failed.
-     */
-    @Override protected Ignite startGrid() throws Exception {
-        System.setProperty(IGNITE_JETTY_PORT, Integer.toString(JETTY_PORT));
-
-        try {
-            return super.startGrid();
-        }
-        finally {
-            System.clearProperty(IGNITE_JETTY_PORT);
-        }
-    }
-
-    /**
-     * Starts router.
-     * @throws IgniteCheckedException If failed.
-     */
-    private void startRouters() throws IgniteCheckedException {
-        GridTcpRouterConfiguration tcpCfg = new GridTcpRouterConfiguration();
-
-        tcpCfg.setHost(HOST);
-        tcpCfg.setPort(ROUTER_BINARY_PORT);
-        tcpCfg.setPortRange(0);
-        tcpCfg.setServers(Collections.singleton(HOST + ":" + BINARY_PORT));
-
-        GridRouterFactory.startTcpRouter(tcpCfg);
-    }
-
-    /**
-     * @param p Protocol.
-     * @param useRouter Use router flag.
-     * @return Client instance.
-     * @throws GridClientException If failed.
-     */
-    private GridClient client(GridClientProtocol p, boolean useRouter) throws GridClientException {
-        GridClientConfiguration cfg = new GridClientConfiguration();
-
-        int port = p == TCP ?
-            (useRouter ? ROUTER_BINARY_PORT : BINARY_PORT) :
-            (useRouter ? ROUTER_JETTY_PORT : JETTY_PORT);
-
-        cfg.setProtocol(p);
-        cfg.setServers(Arrays.asList(HOST + ":" + port));
-        cfg.setTopologyRefreshFrequency(TOP_REFRESH_PERIOD);
-
-        return GridClientFactory.start(cfg);
-    }
-
-    /**
-     * Test task.
-     */
-    private static class TestTask extends ComputeTaskSplitAdapter<String, String> {
-        /** {@inheritDoc} */
-        @Override protected Collection<? extends ComputeJob> split(int gridSize, final String arg) throws IgniteCheckedException {
-            return Collections.singleton(new ComputeJobAdapter() {
-                @Override public String execute() {
-                    return arg;
-                }
-            });
-        }
-
-        /** {@inheritDoc} */
-        @Override public String reduce(List<ComputeJobResult> results) throws IgniteCheckedException {
-            assertEquals(1, results.size());
-
-            return results.get(0).getData();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/756034f3/modules/clients/src/test/java/org/apache/ignite/client/router/RouterFactorySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/client/router/RouterFactorySelfTest.java b/modules/clients/src/test/java/org/apache/ignite/client/router/RouterFactorySelfTest.java
deleted file mode 100644
index b485117..0000000
--- a/modules/clients/src/test/java/org/apache/ignite/client/router/RouterFactorySelfTest.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.client.router;
-
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.client.router.*;
-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 java.util.*;
-
-import static org.apache.ignite.IgniteSystemProperties.*;
-
-/**
- * Test routers factory.
- */
-public class RouterFactorySelfTest extends GridCommonAbstractTest {
-    /** Shared IP finder. */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** */
-    private static final int GRID_HTTP_PORT = 11087;
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
-
-        discoSpi.setIpFinder(IP_FINDER);
-
-        IgniteConfiguration cfg = new IgniteConfiguration();
-
-        cfg.setDiscoverySpi(discoSpi);
-        cfg.setGridName(gridName);
-
-        return cfg;
-    }
-
-    /**
-     * Test router's start/stop.
-     *
-     * @throws Exception In case of any exception.
-     */
-    public void testRouterFactory() throws Exception {
-        try {
-            System.setProperty(IGNITE_JETTY_PORT, String.valueOf(GRID_HTTP_PORT));
-
-            try {
-                startGrid();
-            }
-            finally {
-                System.clearProperty(IGNITE_JETTY_PORT);
-            }
-
-            final int size = 20;
-            final Collection<GridTcpRouter> tcpRouters = new ArrayList<>(size);
-            final GridTcpRouterConfiguration tcpCfg = new GridTcpRouterConfiguration();
-
-            tcpCfg.setPortRange(size);
-
-            for (int i = 0; i < size; i++)
-                tcpRouters.add(GridRouterFactory.startTcpRouter(tcpCfg));
-
-            for (GridTcpRouter tcpRouter : tcpRouters) {
-                assertEquals(tcpCfg, tcpRouter.configuration());
-                assertEquals(tcpRouter, GridRouterFactory.tcpRouter(tcpRouter.id()));
-            }
-
-            assertEquals("Validate all started tcp routers.", new HashSet<>(tcpRouters),
-                new HashSet<>(GridRouterFactory.allTcpRouters()));
-
-            for (Iterator<GridTcpRouter> it = tcpRouters.iterator(); it.hasNext(); ) {
-                GridTcpRouter tcpRouter = it.next();
-
-                assertEquals("Validate all started tcp routers.", new HashSet<>(tcpRouters),
-                    new HashSet<>(GridRouterFactory.allTcpRouters()));
-
-                it.remove();
-
-                GridRouterFactory.stopTcpRouter(tcpRouter.id());
-
-                assertEquals("Validate all started tcp routers.", new HashSet<>(tcpRouters),
-                    new HashSet<>(GridRouterFactory.allTcpRouters()));
-            }
-
-            assertEquals(Collections.<GridTcpRouter>emptyList(), GridRouterFactory.allTcpRouters());
-        }
-        finally {
-            GridRouterFactory.stopAllRouters();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/756034f3/modules/clients/src/test/java/org/apache/ignite/client/router/TcpRouterAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/client/router/TcpRouterAbstractSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/client/router/TcpRouterAbstractSelfTest.java
deleted file mode 100644
index d5eedd3..0000000
--- a/modules/clients/src/test/java/org/apache/ignite/client/router/TcpRouterAbstractSelfTest.java
+++ /dev/null
@@ -1,127 +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.client.router;
-
-import org.apache.ignite.*;
-import org.apache.ignite.client.*;
-import org.apache.ignite.internal.client.*;
-import org.apache.ignite.internal.client.router.*;
-import org.apache.ignite.internal.client.router.impl.*;
-import org.apache.ignite.logger.log4j.*;
-import org.apache.ignite.client.integration.*;
-import org.apache.ignite.internal.util.typedef.*;
-
-import java.util.*;
-
-/**
- * Abstract base class for http routing tests.
- */
-public abstract class TcpRouterAbstractSelfTest extends ClientAbstractSelfTest {
-    /** Port number to use by router. */
-    private static final int ROUTER_PORT = BINARY_PORT + 1;
-
-    /** TCP router instance. */
-    private static GridTcpRouterImpl router;
-
-    /** Send count. */
-    private static long sndCnt;
-
-    /** Receive count. */
-    private static long rcvCnt;
-
-    /** {@inheritDoc} */
-    @Override protected GridClientProtocol protocol() {
-        return GridClientProtocol.TCP;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected String serverAddress() {
-        return null;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        sndCnt = router.getSendCount();
-        rcvCnt = router.getReceivedCount();
-
-        super.beforeTest();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        super.afterTest();
-
-        assert router.getSendCount() > sndCnt :
-            "Failed to ensure network activity [currCnt=" + router.getSendCount() + ", oldCnt=" + sndCnt + ']';
-        assert router.getReceivedCount() > rcvCnt:
-            "Failed to ensure network activity [currCnt=" + router.getReceivedCount() + ", oldCnt=" + rcvCnt + ']';
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        super.beforeTestsStarted();
-
-        router = new GridTcpRouterImpl(routerConfiguration());
-
-        router.start();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        router.stop();
-
-        super.afterTestsStopped();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected GridClientConfiguration clientConfiguration() throws GridClientException {
-        GridClientConfiguration cfg = super.clientConfiguration();
-
-        cfg.setServers(Collections.<String>emptySet());
-        cfg.setRouters(Collections.singleton(HOST + ":" + ROUTER_PORT));
-
-        return cfg;
-    }
-
-    /**
-     * @return Router configuration.
-     * @throws IgniteCheckedException If failed.
-     */
-    public GridTcpRouterConfiguration routerConfiguration() throws IgniteCheckedException {
-        GridTcpRouterConfiguration cfg = new GridTcpRouterConfiguration();
-
-        cfg.setHost(HOST);
-        cfg.setPort(ROUTER_PORT);
-        cfg.setPortRange(0);
-        cfg.setServers(Collections.singleton(HOST+":"+BINARY_PORT));
-        cfg.setLogger(new IgniteLog4jLogger(ROUTER_LOG_CFG));
-
-        return cfg;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    @Override public void testConnectable() throws Exception {
-        GridClient client = client();
-
-        List<GridClientNode> nodes = client.compute().refreshTopology(false, false);
-
-        assertFalse(F.first(nodes).connectable());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/756034f3/modules/clients/src/test/java/org/apache/ignite/client/router/TcpRouterMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/client/router/TcpRouterMultiNodeSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/client/router/TcpRouterMultiNodeSelfTest.java
deleted file mode 100644
index cb7f8d4..0000000
--- a/modules/clients/src/test/java/org/apache/ignite/client/router/TcpRouterMultiNodeSelfTest.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.client.router;
-
-import org.apache.ignite.*;
-import org.apache.ignite.client.*;
-import org.apache.ignite.internal.client.*;
-import org.apache.ignite.internal.client.router.*;
-import org.apache.ignite.internal.client.router.impl.*;
-import org.apache.ignite.logger.log4j.*;
-import org.apache.ignite.client.integration.*;
-
-import java.util.*;
-
-import static org.apache.ignite.client.integration.ClientAbstractSelfTest.*;
-
-/**
- *
- */
-public class TcpRouterMultiNodeSelfTest extends ClientAbstractMultiNodeSelfTest {
-    /** Number of routers to start in this test. */
-    private static final int ROUTERS_CNT = 5;
-
-    /** Where to start routers' port numeration. */
-    private static final int ROUTER_TCP_PORT_BASE = REST_TCP_PORT_BASE + NODES_CNT;
-
-    /** Collection of routers. */
-    private static Collection<GridTcpRouterImpl> routers = new ArrayList<>(ROUTERS_CNT);
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        super.beforeTestsStarted();
-
-        for (int i = 0; i < ROUTERS_CNT; i++)
-            routers.add(new GridTcpRouterImpl(routerConfiguration(i++)));
-
-        for (GridTcpRouterImpl r : routers)
-            r.start();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        info("Stopping routers...");
-
-        for (GridTcpRouterImpl r : routers)
-            r.stop();
-
-        info("Routers stopped.");
-
-        routers.clear();
-
-        super.afterTestsStopped();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected GridClientProtocol protocol() {
-        return GridClientProtocol.TCP;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected String serverAddress() {
-        return null;
-    }
-
-    /**
-     * @param i Number of router. Used to avoid configuration conflicts.
-     * @return Router configuration.
-     * @throws IgniteCheckedException If failed.
-     */
-    private GridTcpRouterConfiguration routerConfiguration(int i) throws IgniteCheckedException {
-        GridTcpRouterConfiguration cfg = new GridTcpRouterConfiguration();
-
-        cfg.setHost(HOST);
-        cfg.setPort(ROUTER_TCP_PORT_BASE + i);
-        cfg.setPortRange(0);
-        cfg.setServers(Collections.singleton(HOST + ":" + REST_TCP_PORT_BASE));
-        cfg.setLogger(new IgniteLog4jLogger(ROUTER_LOG_CFG));
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected GridClientConfiguration clientConfiguration() throws GridClientException {
-        GridClientConfiguration cfg = super.clientConfiguration();
-
-        cfg.setServers(Collections.<String>emptySet());
-
-        Collection<String> rtrs = new ArrayList<>(ROUTERS_CNT);
-
-        for (int i = 0; i < ROUTERS_CNT; i++)
-            rtrs.add(HOST + ':' + (ROUTER_TCP_PORT_BASE + i));
-
-        cfg.setRouters(rtrs);
-
-        return cfg;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/756034f3/modules/clients/src/test/java/org/apache/ignite/client/router/TcpRouterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/client/router/TcpRouterSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/client/router/TcpRouterSelfTest.java
deleted file mode 100644
index a7fa1f8..0000000
--- a/modules/clients/src/test/java/org/apache/ignite/client/router/TcpRouterSelfTest.java
+++ /dev/null
@@ -1,35 +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.client.router;
-
-import org.apache.ignite.internal.client.ssl.*;
-
-/**
- * Tests the simplest use case for router: singe router proxies connections to a single node.
- */
-public class TcpRouterSelfTest extends TcpRouterAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected boolean useSsl() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected GridSslContextFactory sslContextFactory() {
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/756034f3/modules/clients/src/test/java/org/apache/ignite/client/router/TcpSslRouterSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/client/router/TcpSslRouterSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/client/router/TcpSslRouterSelfTest.java
deleted file mode 100644
index a90f010..0000000
--- a/modules/clients/src/test/java/org/apache/ignite/client/router/TcpSslRouterSelfTest.java
+++ /dev/null
@@ -1,49 +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.client.router;
-
-import org.apache.ignite.*;
-import org.apache.ignite.internal.client.router.*;
-import org.apache.ignite.internal.client.ssl.*;
-import org.apache.ignite.testframework.*;
-
-/**
- *
- */
-public class TcpSslRouterSelfTest extends TcpRouterAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected boolean useSsl() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected GridSslContextFactory sslContextFactory() {
-        return GridTestUtils.sslContextFactory();
-    }
-
-    /**
-     * @return Router configuration.
-     */
-    @Override public GridTcpRouterConfiguration routerConfiguration() throws IgniteCheckedException {
-        GridTcpRouterConfiguration cfg = super.routerConfiguration();
-
-        cfg.setSslContextFactory(sslContextFactory());
-
-        return cfg;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/756034f3/modules/clients/src/test/java/org/apache/ignite/client/router/package.html
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/client/router/package.html b/modules/clients/src/test/java/org/apache/ignite/client/router/package.html
deleted file mode 100644
index 13bcb4b..0000000
--- a/modules/clients/src/test/java/org/apache/ignite/client/router/package.html
+++ /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.
-  -->
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<body>
-    <img alt="icon" class="javadocimg" src="{@docRoot}/img/cube.gif"/>
-    Contains intergration tests involving API, Client, router and REST processor.
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/756034f3/modules/clients/src/test/java/org/apache/ignite/client/router/testsuites/IgniteRouterTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/client/router/testsuites/IgniteRouterTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/client/router/testsuites/IgniteRouterTestSuite.java
deleted file mode 100644
index 41660b1..0000000
--- a/modules/clients/src/test/java/org/apache/ignite/client/router/testsuites/IgniteRouterTestSuite.java
+++ /dev/null
@@ -1,41 +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.client.router.testsuites;
-
-import junit.framework.*;
-import org.apache.ignite.client.router.*;
-
-/**
- * Test suite for router tests.
- */
-public class IgniteRouterTestSuite extends TestSuite {
-    /**
-     * @return Suite that contains all router tests.
-     */
-    public static TestSuite suite() {
-        TestSuite suite = new TestSuite("Ignite Router Test Suite");
-
-        suite.addTest(new TestSuite(RouterFactorySelfTest.class));
-        suite.addTest(new TestSuite(TcpRouterSelfTest.class));
-        suite.addTest(new TestSuite(TcpSslRouterSelfTest.class));
-        suite.addTest(new TestSuite(TcpRouterMultiNodeSelfTest.class));
-//        suite.addTest(new TestSuite(ClientFailedInitSelfTest.class));
-
-        return suite;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/756034f3/modules/clients/src/test/java/org/apache/ignite/client/suite/IgniteClientTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/client/suite/IgniteClientTestSuite.java b/modules/clients/src/test/java/org/apache/ignite/client/suite/IgniteClientTestSuite.java
deleted file mode 100644
index 2be4a20..0000000
--- a/modules/clients/src/test/java/org/apache/ignite/client/suite/IgniteClientTestSuite.java
+++ /dev/null
@@ -1,118 +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.client.suite;
-
-import junit.framework.*;
-import org.apache.ignite.client.*;
-import org.apache.ignite.client.impl.*;
-import org.apache.ignite.client.integration.*;
-import org.apache.ignite.client.router.*;
-import org.apache.ignite.client.util.*;
-import org.apache.ignite.internal.processors.rest.*;
-import org.apache.ignite.internal.processors.rest.protocols.tcp.*;
-
-/**
- * Test suite includes all test that concern REST processors.
- */
-public class IgniteClientTestSuite extends TestSuite {
-    /**
-     * @return Suite that contains all tests for REST.
-     */
-    public static TestSuite suite() {
-        TestSuite suite = new TestSuite("Ignite Clients Test Suite");
-
-        suite.addTest(new TestSuite(RouterFactorySelfTest.class));
-
-        // Parser standalone test.
-        suite.addTest(new TestSuite(TcpRestParserSelfTest.class));
-
-        // Test memcache protocol with custom test client.
-        suite.addTest(new TestSuite(RestMemcacheProtocolSelfTest.class));
-
-        // Test custom binary protocol with test client.
-        suite.addTest(new TestSuite(RestBinaryProtocolSelfTest.class));
-
-        // Test jetty rest processor
-        suite.addTest(new TestSuite(JettyRestProcessorSignedSelfTest.class));
-        suite.addTest(new TestSuite(JettyRestProcessorUnsignedSelfTest.class));
-
-        // Test TCP rest processor with original memcache client.
-        suite.addTest(new TestSuite(ClientMemcachedProtocolSelfTest.class));
-
-        suite.addTest(new TestSuite(RestProcessorStartSelfTest.class));
-
-        // Test cache flag conversion.
-        suite.addTest(new TestSuite(ClientCacheFlagsCodecTest.class));
-
-        // Test multi-start.
-        suite.addTest(new TestSuite(RestProcessorMultiStartSelfTest.class));
-
-        // Test clients.
-        suite.addTest(new TestSuite(ClientDataImplSelfTest.class));
-        suite.addTest(new TestSuite(ClientComputeImplSelfTest.class));
-        suite.addTest(new TestSuite(ClientTcpSelfTest.class));
-        suite.addTest(new TestSuite(ClientTcpDirectSelfTest.class));
-        suite.addTest(new TestSuite(ClientTcpSslSelfTest.class));
-        suite.addTest(new TestSuite(ClientTcpSslDirectSelfTest.class));
-
-        // Test client with many nodes.
-        suite.addTest(new TestSuite(ClientTcpMultiNodeSelfTest.class));
-        suite.addTest(new TestSuite(ClientTcpDirectMultiNodeSelfTest.class));
-        suite.addTest(new TestSuite(ClientTcpSslMultiNodeSelfTest.class));
-        suite.addTest(new TestSuite(ClientTcpSslDirectMultiNodeSelfTest.class));
-        suite.addTest(new TestSuite(ClientTcpUnreachableMultiNodeSelfTest.class));
-        suite.addTest(new TestSuite(ClientPreferDirectSelfTest.class));
-
-        // Test client with many nodes and in multithreaded scenarios
-        suite.addTest(new TestSuite(ClientTcpMultiThreadedSelfTest.class));
-        suite.addTest(new TestSuite(ClientTcpSslMultiThreadedSelfTest.class));
-
-        // Test client authentication.
-        suite.addTest(new TestSuite(ClientTcpSslAuthenticationSelfTest.class));
-
-        suite.addTest(new TestSuite(ClientTcpConnectivitySelfTest.class));
-        suite.addTest(new TestSuite(ClientReconnectionSelfTest.class));
-
-        // Rest task command handler test.
-        suite.addTest(new TestSuite(TaskCommandHandlerSelfTest.class));
-
-        // Default cache only test.
-        suite.addTest(new TestSuite(ClientDefaultCacheSelfTest.class));
-
-        suite.addTestSuite(ClientFutureAdapterSelfTest.class);
-        suite.addTestSuite(ClientPartitionAffinitySelfTest.class);
-        suite.addTestSuite(ClientPropertiesConfigurationSelfTest.class);
-        suite.addTestSuite(ClientConsistentHashSelfTest.class);
-        suite.addTestSuite(ClientJavaHasherSelfTest.class);
-
-        suite.addTestSuite(ClientByteUtilsTest.class);
-
-        suite.addTest(new TestSuite(ClientTopologyCacheSelfTest.class));
-
-        // Router tests.
-        suite.addTest(new TestSuite(TcpRouterSelfTest.class));
-        suite.addTest(new TestSuite(TcpSslRouterSelfTest.class));
-        suite.addTest(new TestSuite(TcpRouterMultiNodeSelfTest.class));
-
-        suite.addTest(new TestSuite(ClientFailedInitSelfTest.class));
-
-        suite.addTest(new TestSuite(ClientTcpTaskExecutionAfterTopologyRestartSelfTest.class));
-
-        return suite;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/756034f3/modules/clients/src/test/java/org/apache/ignite/client/util/ClientByteUtilsTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/client/util/ClientByteUtilsTest.java b/modules/clients/src/test/java/org/apache/ignite/client/util/ClientByteUtilsTest.java
deleted file mode 100644
index 4774cec..0000000
--- a/modules/clients/src/test/java/org/apache/ignite/client/util/ClientByteUtilsTest.java
+++ /dev/null
@@ -1,172 +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.client.util;
-
-import org.apache.ignite.internal.util.*;
-import org.apache.ignite.testframework.junits.common.*;
-import org.junit.*;
-
-import java.util.*;
-
-import static org.apache.ignite.internal.util.GridClientByteUtils.*;
-
-/**
- * Test case for client's byte convertion utility.
- */
-public class ClientByteUtilsTest extends GridCommonAbstractTest {
-    /**
-     * Test UUID conversions from string to binary and back.
-     *
-     * @throws Exception On any exception.
-     */
-    public void testUuidConvertions() throws Exception {
-        Map<String, byte[]> map = new LinkedHashMap<>();
-
-        map.put("2ec84557-f7c4-4a2e-aea8-251eb13acff3", new byte[] {
-            46, -56, 69, 87, -9, -60, 74, 46, -82, -88, 37, 30, -79, 58, -49, -13
-        });
-        map.put("4e17b7b5-79e7-4db5-ac45-a644ead95b9e", new byte[] {
-            78, 23, -73, -75, 121, -25, 77, -75, -84, 69, -90, 68, -22, -39, 91, -98
-        });
-        map.put("412daadb-e9e6-443b-8b87-8d7895fc2e53", new byte[] {
-            65, 45, -86, -37, -23, -26, 68, 59, -117, -121, -115, 120, -107, -4, 46, 83
-        });
-        map.put("e71aabf4-4aad-4280-b4e9-3c310be0cb88", new byte[] {
-            -25, 26, -85, -12, 74, -83, 66, -128, -76, -23, 60, 49, 11, -32, -53, -120
-        });
-        map.put("d4454cda-a81f-490f-9424-9bdfcc9cf610", new byte[] {
-            -44, 69, 76, -38, -88, 31, 73, 15, -108, 36, -101, -33, -52, -100, -10, 16
-        });
-        map.put("3a584450-5e85-4b69-9f9d-043d89fef23b", new byte[] {
-            58, 88, 68, 80, 94, -123, 75, 105, -97, -99, 4, 61, -119, -2, -14, 59
-        });
-        map.put("6c8baaec-f173-4a60-b566-240a87d7f81d", new byte[] {
-            108, -117, -86, -20, -15, 115, 74, 96, -75, 102, 36, 10, -121, -41, -8, 29
-        });
-        map.put("d99c7102-79f7-4fb4-a665-d331cf285c20", new byte[] {
-            -39, -100, 113, 2, 121, -9, 79, -76, -90, 101, -45, 49, -49, 40, 92, 32
-        });
-        map.put("007d56c7-5c8b-4279-a700-7f3f95946dde", new byte[] {
-            0, 125, 86, -57, 92, -117, 66, 121, -89, 0, 127, 63, -107, -108, 109, -34
-        });
-        map.put("15627963-d8f9-4423-bedc-f6f89f7d3433", new byte[] {
-            21, 98, 121, 99, -40, -7, 68, 35, -66, -36, -10, -8, -97, 125, 52, 51
-        });
-
-        for (Map.Entry<String, byte[]> e : map.entrySet()) {
-            UUID uuid = UUID.fromString(e.getKey());
-            UUID uuidFromBytes = GridClientByteUtils.bytesToUuid(e.getValue(), 0);
-
-            assertEquals(uuid, uuidFromBytes);
-            assertEquals(e.getKey(), uuid.toString());
-            assertEquals(e.getKey(), uuidFromBytes.toString());
-
-            byte[] bytes = new byte[16];
-
-            GridClientByteUtils.uuidToBytes(uuid, bytes, 0);
-
-            assertTrue(e.getKey(), Arrays.equals(e.getValue(), bytes));
-        }
-    }
-
-    public void testShortToBytes() throws Exception {
-        Map<String, Short> map = new HashMap<>();
-
-        map.put("00-00", (short)0);
-        map.put("00-0F", (short)0x0F);
-        map.put("FF-F1", (short)-0x0F);
-        map.put("27-10", (short)10000);
-        map.put("D8-F0", (short)-10000);
-        map.put("80-00", Short.MIN_VALUE);
-        map.put("7F-FF", Short.MAX_VALUE);
-
-        for (Map.Entry<String, Short> entry : map.entrySet()) {
-            byte[] b = asByteArray(entry.getKey());
-
-            Assert.assertArrayEquals(b, shortToBytes(entry.getValue()));
-            Assert.assertEquals((short)entry.getValue(), bytesToShort(b, 0));
-
-            byte[] tmp = new byte[2];
-
-            shortToBytes(entry.getValue(), tmp, 0);
-            Assert.assertArrayEquals(b, tmp);
-        }
-    }
-
-    public void testIntToBytes() throws Exception {
-        Map<String, Integer> map = new HashMap<>();
-
-        map.put("00-00-00-00", 0);
-        map.put("00-FF-FF-FF", 0xFFFFFF);
-        map.put("FF-00-00-01", -0xFFFFFF);
-        map.put("3B-9A-CA-00", 1000000000);
-        map.put("C4-65-36-00", -1000000000);
-        map.put("80-00-00-00", Integer.MIN_VALUE);
-        map.put("7F-FF-FF-FF", Integer.MAX_VALUE);
-
-        for (Map.Entry<String, Integer> entry : map.entrySet()) {
-            byte[] b = asByteArray(entry.getKey());
-
-            Assert.assertArrayEquals(b, intToBytes(entry.getValue()));
-            Assert.assertEquals((int)entry.getValue(), bytesToInt(b, 0));
-
-            byte[] tmp = new byte[4];
-
-            intToBytes(entry.getValue(), tmp, 0);
-            Assert.assertArrayEquals(b, tmp);
-        }
-    }
-
-    public void testLongToBytes() throws Exception {
-        Map<String, Long> map = new LinkedHashMap<>();
-
-        map.put("00-00-00-00-00-00-00-00", 0L);
-        map.put("00-00-00-00-00-FF-FF-FF", 0xFFFFFFL);
-        map.put("FF-FF-FF-FF-FF-00-00-01", -0xFFFFFFL);
-        map.put("00-00-00-00-3B-9A-CA-00", 1000000000L);
-        map.put("FF-FF-FF-FF-C4-65-36-00", -1000000000L);
-        map.put("00-00-AA-AA-AA-AA-AA-AA", 0xAAAAAAAAAAAAL);
-        map.put("FF-FF-55-55-55-55-55-56", -0xAAAAAAAAAAAAL);
-        map.put("0D-E0-B6-B3-A7-64-00-00", 1000000000000000000L);
-        map.put("F2-1F-49-4C-58-9C-00-00", -1000000000000000000L);
-        map.put("80-00-00-00-00-00-00-00", Long.MIN_VALUE);
-        map.put("7F-FF-FF-FF-FF-FF-FF-FF", Long.MAX_VALUE);
-
-        for (Map.Entry<String, Long> entry : map.entrySet()) {
-            byte[] b = asByteArray(entry.getKey());
-
-            Assert.assertArrayEquals(b, longToBytes(entry.getValue()));
-            Assert.assertEquals((long)entry.getValue(), bytesToLong(b, 0));
-
-            byte[] tmp = new byte[8];
-
-            longToBytes(entry.getValue(), tmp, 0);
-            Assert.assertArrayEquals(b, tmp);
-        }
-    }
-
-    private byte[] asByteArray(String text) {
-        String[] split = text.split("-");
-        byte[] b = new byte[split.length];
-
-        for (int i = 0; i < split.length; i++)
-            b[i] = (byte)Integer.parseInt(split[i], 16);
-
-        return b;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/756034f3/modules/clients/src/test/java/org/apache/ignite/client/util/ClientConsistentHashSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/client/util/ClientConsistentHashSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/client/util/ClientConsistentHashSelfTest.java
deleted file mode 100644
index 0abce33..0000000
--- a/modules/clients/src/test/java/org/apache/ignite/client/util/ClientConsistentHashSelfTest.java
+++ /dev/null
@@ -1,282 +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.client.util;
-
-import org.apache.ignite.internal.client.util.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.util.*;
-
-/**
- * Test for consistent hash management class.
- */
-public class ClientConsistentHashSelfTest extends GridCommonAbstractTest {
-    /** Replicas count. */
-    private static final int REPLICAS = 512;
-
-    /**
-     * Test hash codes collisions.
-     *
-     * @throws Exception In case of any exception.
-     */
-    public void testCollisions() throws Exception {
-        Map<Integer, Set<UUID>> map = new HashMap<>();
-
-        // Different nodes, but collide hash codes.
-        Collection<UUID> nodes = new LinkedHashSet<>();
-
-        // Generate several nodes with collide hash codes.
-        while (nodes.size() < 10) {
-            UUID uuid = UUID.randomUUID();
-            int hashCode = uuid.hashCode();
-
-            Set<UUID> set = map.get(hashCode);
-
-            if (set == null)
-                map.put(hashCode, set = new LinkedHashSet<>());
-
-            set.add(uuid);
-
-            if (set.size() > 1)
-                nodes.addAll(set);
-        }
-
-        map.clear(); // Clean up.
-
-        GridClientConsistentHash<UUID> hash = new GridClientConsistentHash<>();
-
-        hash.addNodes(nodes, REPLICAS);
-
-        boolean fail = false;
-
-        for (UUID exp : nodes) {
-            UUID act = hash.node(0, Arrays.asList(exp));
-
-            if (exp.equals(act))
-                info("Validation succeed [exp=" + exp + ", act=" + act + ']');
-            else{
-                info("Validation failed  [exp=" + exp + ", act=" + act + ']');
-
-                fail = true;
-            }
-        }
-
-        if (fail)
-            fail("Failed to resolve consistent hash node, when node's hash codes collide: " + nodes);
-    }
-
-    /**
-     * Test restrictions from internal {@link TreeSet} usage.
-     *
-     * @throws Exception In case of any exception.
-     */
-    public void testTreeSetRestrictions() throws Exception {
-        // Constructs hash without explicit node's comparator.
-        GridClientConsistentHash<Object> hash = new GridClientConsistentHash<>();
-
-        try {
-            // Add several objects with the same hash without neither natural ordering nor comparator.
-            hash.addNode(new Object() { public int hashCode() { return 0; } }, 1);
-            hash.addNode(new Object() { public int hashCode() { return 0; } }, 1);
-
-            fail("Expects failed due to internal TreeSet requires comparator or natural ordering.");
-        }
-        catch (ClassCastException e) {
-            info("Expected fail due to internal TreeSet requires comparator or natural ordering: " + e.getMessage());
-        }
-
-        // Constructs hash with explicit node's comparator.
-        hash = new GridClientConsistentHash<>(new Comparator<Object>() {
-            @Override public int compare(Object o1, Object o2) {
-                // Such comparator is invalid for production code, but acceptable for current test purposes.
-                return System.identityHashCode(o1) - System.identityHashCode(o2);
-            }
-        }, null);
-
-        // Add several objects with the same hash into consistent hash with explicit comparator.
-        hash.addNode(new Object() { public int hashCode() { return 0; } }, 1);
-        hash.addNode(new Object() { public int hashCode() { return 0; } }, 1);
-
-        info("Expected pass due to internal TreeSet has explicit comparator.");
-    }
-
-    /**
-     * Validate generated hashes.<p>
-     * Note! This test should be ported into all supported platforms.
-     */
-    public void testHashGeneraton() {
-        // Validate strings.
-        checkHash("", -1484017934);
-        checkHash("1", -80388575);
-        checkHash("a", -873690096);
-        checkHash("Hadoop\u3092\u6bba\u3059", -695300527);
-        checkHash("key1", -2067461682);
-
-        // Validate primitives.
-        checkHash(true, 1669973725);
-        checkHash(false, -1900934144);
-
-        checkHash(3, 386050343);
-        checkHash(1000000000, -547312286);
-        checkHash(0x7fffffff, 473949739);
-        checkHash(0xffffffff, -1399925094);
-        checkHash(0x7fffffffffffffffL, 201097861);
-        checkHash(0xffffffffffffffffL, -1484017934);
-        checkHash(1.4e-45f, 1262722378);
-        checkHash(3.4028235e+38f, 1313755354);
-        checkHash(4.9e-324, 1262722378);
-        checkHash(1.7976931348623157e+308, -783615357);
-
-        // Validate objects.
-        checkHash(UUID.fromString("4d180911-21c9-48f2-a1e6-7bc1daf588a0"), -440525148);
-
-        checkUUID("224ea4cd-f449-4dcb-869a-5317c63bd619", 806670090);
-        checkUUID("fdc9ec54-ff53-4fdb-8239-5a3ac1fb31bd", -354375826);
-        checkUUID("0f9c9b94-02ae-45a6-9d5c-a066dbdf2636", -1312538272);
-        checkUUID("d8f1f916-4357-4cfe-a7df-49d4721690bf", -482944041);
-        checkUUID("d67eb652-4e76-47fb-ad4e-cd902d9b868a", -449444069);
-        checkUUID("c77ffeae-78a1-4ee6-a0fd-8d197a794412", -168980875);
-        checkUUID("35de9f21-3c9b-4f4a-a7d5-3e2c6cb01564", -383915637);
-    }
-
-    /**
-     * Test mapping to nodes.
-     */
-    @SuppressWarnings("UnaryPlus")
-    public void testMappingToNodes() {
-        String n1 = "node #1";
-        String n2 = "node #2";
-        String n3 = "node #3";
-        String n4 = "node #4";
-
-        List<String> nodes = Arrays.asList(n1, n2, n3, n4);
-
-        GridClientConsistentHash<String> hash = new GridClientConsistentHash<>();
-
-        for (String node : nodes)
-            hash.addNode(node, 5);
-
-        Map<Object, String> data = new LinkedHashMap<>();
-
-        data.put("", n1);
-        data.put("asdf", n3);
-        data.put("224ea4cd-f449-4dcb-869a-5317c63bd619", n2);
-        data.put("fdc9ec54-ff53-4fdb-8239-5a3ac1fb31bd", n4);
-        data.put("0f9c9b94-02ae-45a6-9d5c-a066dbdf2636", n1);
-        data.put("d8f1f916-4357-4cfe-a7df-49d4721690bf", n3);
-        data.put("c77ffeae-78a1-4ee6-a0fd-8d197a794412", n4);
-        data.put("35de9f21-3c9b-4f4a-a7d5-3e2c6cb01564", n4);
-        data.put("d67eb652-4e76-47fb-ad4e-cd902d9b868a", n4);
-
-        data.put(0, n1);
-        data.put(1, n4);
-        data.put(12, n3);
-        data.put(123, n3);
-        data.put(1234, n3);
-        data.put(12345, n4);
-        data.put(123456, n3);
-        data.put(1234567, n4);
-        data.put(12345678, n4);
-        data.put(123456789, n4);
-        data.put(1234567890, n3);
-        data.put(1234567890L, n3);
-        data.put(12345678901L, n4);
-        data.put(123456789012L, n2);
-        data.put(1234567890123L, n4);
-        data.put(12345678901234L, n1);
-        data.put(123456789012345L, n1);
-        data.put(1234567890123456L, n3);
-        data.put(-23456789012345L, n2);
-        data.put(-2345678901234L, n1);
-        data.put(-234567890123L, n4);
-        data.put(-23456789012L, n3);
-        data.put(-2345678901L, n3);
-        data.put(-234567890L, n1);
-        data.put(-234567890, n4);
-        data.put(-23456789, n4);
-        data.put(-2345678, n4);
-        data.put(-234567, n4);
-        data.put(-23456, n4);
-        data.put(-2345, n1);
-        data.put(-234, n4);
-        data.put(-23, n3);
-        data.put(-2, n4);
-
-        data.put(0x80000000, n2);
-        data.put(0x7fffffff, n4);
-        data.put(0x8000000000000000L, n2);
-        data.put(0x7fffffffffffffffL, n2);
-
-        data.put(+1.1, n1);
-        data.put(-10.01, n3);
-        data.put(+100.001, n3);
-        data.put(-1000.0001, n4);
-        data.put(+1.7976931348623157E+308, n4);
-        data.put(-1.7976931348623157E+308, n4);
-        data.put(+4.9E-324, n4);
-        data.put(-4.9E-324, n3);
-
-        for (Map.Entry<Object, String> entry : data.entrySet())
-            assertEquals("Validate key '" + entry.getKey() + "'.", entry.getValue(), hash.node(entry.getKey()));
-
-        for (Map.Entry<Object, String> entry : data.entrySet())
-            assertEquals("Validate key '" + entry.getKey() + "'.", entry.getValue(), hash.node(entry.getKey(), nodes));
-
-        //
-        // Change order nodes were added.
-        //
-
-        nodes = new ArrayList<>(nodes);
-
-        Collections.reverse(nodes);
-
-        // Reset consistent hash with new nodes order.
-        hash = new GridClientConsistentHash<>();
-
-        for (String node : nodes)
-            hash.addNode(node, 5);
-
-        for (Map.Entry<Object, String> entry : data.entrySet())
-            assertEquals("Validate key '" + entry.getKey() + "'.", entry.getValue(), hash.node(entry.getKey()));
-
-        for (Map.Entry<Object, String> entry : data.entrySet())
-            assertEquals("Validate key '" + entry.getKey() + "'.", entry.getValue(), hash.node(entry.getKey(), nodes));
-    }
-
-    /**
-     * Check unique id and generated hash code.
-     *
-     * @param uuid String presentation of unique id.
-     * @param code Expected hash code.
-     */
-    private void checkUUID(String uuid, int code) {
-        checkHash(UUID.fromString(uuid), code);
-    }
-
-    /**
-     * Check hash generation for the specified object.
-     *
-     * @param o Object to verify hash generation for.
-     * @param code Expected hash code.
-     */
-    private void checkHash(Object o, int code) {
-        int i = GridClientConsistentHash.hash(o);
-
-        assertEquals("Check affinity for object: " + o, code, i);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/756034f3/modules/clients/src/test/java/org/apache/ignite/client/util/ClientJavaHasherSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/apache/ignite/client/util/ClientJavaHasherSelfTest.java b/modules/clients/src/test/java/org/apache/ignite/client/util/ClientJavaHasherSelfTest.java
deleted file mode 100644
index 79be2e4..0000000
--- a/modules/clients/src/test/java/org/apache/ignite/client/util/ClientJavaHasherSelfTest.java
+++ /dev/null
@@ -1,84 +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.client.util;
-
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.util.*;
-
-/**
- * Test for Java hash codes calculations - SHOULD BE PORTED to other languages.
- */
-public class ClientJavaHasherSelfTest extends GridCommonAbstractTest {
-    /**
-     * Validate known Java hash codes.
-     */
-    public void testPredefined() {
-        Map<Object, Integer> map = new LinkedHashMap<>();
-
-        // Primitives.
-        for (long i = 1, max = 1L << 48; i < max; i *= -3) {
-            map.put((byte)i, (int)(byte)i);
-            map.put((char)i, (int)(char)i);
-            map.put((int)i, (int)i);
-            map.put(i, (int)(i ^ (i >>> 32)));
-        }
-
-        // Double.
-        map.put(0.0, 0);
-        map.put(1.0, 1072693248);
-        map.put(-1.0, -1074790400);
-        map.put(3.1415e200, 1130072580);
-        map.put(3.1415e-200, -819810675);
-
-        // Strings
-        map.put("", 0);
-        map.put("asdf", 3003444);
-        map.put("Hadoop\u3092\u6bba\u3059", 2113729932);
-        map.put("224ea4cd-f449-4dcb-869a-5317c63bd619", 258755163);
-        map.put("fdc9ec54-ff53-4fdb-8239-5a3ac1fb31bd", -863611257);
-        map.put("0f9c9b94-02ae-45a6-9d5c-a066dbdf2636", -1499939567);
-        map.put("d8f1f916-4357-4cfe-a7df-49d4721690bf", 2041432124);
-
-        // UUID.
-        map.put(UUID.fromString("224ea4cd-f449-4dcb-869a-5317c63bd619"), -1767478264);
-        map.put(UUID.fromString("fdc9ec54-ff53-4fdb-8239-5a3ac1fb31bd"), 1096337416);
-        map.put(UUID.fromString("0f9c9b94-02ae-45a6-9d5c-a066dbdf2636"), 1269913698);
-        map.put(UUID.fromString("d8f1f916-4357-4cfe-a7df-49d4721690bf"), 1315925123);
-
-        boolean ok = true;
-
-        for (Map.Entry<Object, Integer> entry : map.entrySet()) {
-            int act = entry.getKey().hashCode();
-            int exp = entry.getValue();
-
-            if (exp == act)
-                continue;
-
-            ok = false;
-
-            info("Validation of hash code for '" + entry.getKey() + "' failed" +
-                " [expected=" + exp + ", actual=" + act + ".");
-        }
-
-        if (ok)
-            return;
-
-        fail("Java hash codes validation fails.");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/756034f3/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
new file mode 100644
index 0000000..e2f7ad1
--- /dev/null
+++ b/modules/clients/src/test/java/org/apache/ignite/internal/client/ClientAbstractMultiThreadedSelfTest.java
@@ -0,0 +1,619 @@
+/*
+ * 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.client;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.client.*;
+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.client.*;
+import org.apache.ignite.internal.client.balancer.*;
+import org.apache.ignite.internal.client.impl.*;
+import org.apache.ignite.internal.client.ssl.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.resources.*;
+import org.apache.ignite.internal.processors.affinity.*;
+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.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.jetbrains.annotations.*;
+import org.junit.*;
+
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheDistributionMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
+import static org.apache.ignite.testframework.GridTestUtils.*;
+
+/**
+ *
+ */
+public abstract class ClientAbstractMultiThreadedSelfTest extends GridCommonAbstractTest {
+    /** IP finder. */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+    /** Partitioned cache name. */
+    protected static final String PARTITIONED_CACHE_NAME = "partitioned";
+
+    /** Partitioned cache with async commit and backup name. */
+    protected static final String PARTITIONED_ASYNC_BACKUP_CACHE_NAME = "partitioned-async-backup";
+
+    /** Replicated cache name. */
+    private static final String REPLICATED_CACHE_NAME = "replicated";
+
+    /** Replicated cache  with async commit name. */
+    private static final String REPLICATED_ASYNC_CACHE_NAME = "replicated-async";
+
+    /** Nodes count. */
+    protected static final int NODES_CNT = 5;
+
+    /** Thread count to run tests. */
+    private static final int THREAD_CNT = 20;
+
+    /** Count of tasks to run. */
+    private static final int TASK_EXECUTION_CNT = 50000;
+
+    /** Count of cache puts in tests. */
+    private static final int CACHE_PUT_CNT = 10000;
+
+    /** Topology update frequency. */
+    private static final int TOP_REFRESH_FREQ = 1000;
+
+    /** Info messages will be printed each 5000 iterations. */
+    private static final int STATISTICS_PRINT_STEP = 5000;
+
+    /** Host. */
+    public static final String HOST = "127.0.0.1";
+
+    /** Base for tcp rest ports. */
+    public static final int REST_TCP_PORT_BASE = 12345;
+
+    static {
+        System.setProperty("CLIENTS_MODULE_PATH", U.resolveGridGainPath("modules/clients").getAbsolutePath());
+    }
+
+    /** Client instance for each test. */
+    private GridClient client;
+
+    /**
+     * @return Client protocol that should be used.
+     */
+    protected abstract GridClientProtocol protocol();
+
+    /**
+     * @return Server address to create first connection.
+     */
+    protected abstract String serverAddress();
+
+    /**
+     * @return Whether SSL should be used.
+     */
+    protected abstract boolean useSsl();
+
+    /**
+     * @return SSL context factory to use if SSL is enabled.
+     */
+    protected abstract GridSslContextFactory sslContextFactory();
+
+    /**
+     * @return Count of iterations for sync commit test.
+     */
+    protected int syncCommitIterCount() {
+        return 1000;
+    }
+
+    /**
+     * @return Topology refresh frequency interval.
+     */
+    protected int topologyRefreshFrequency() {
+        return TOP_REFRESH_FREQ;
+    }
+
+    /**
+     * @return Max connection idle time.
+     */
+    protected int maxConnectionIdleTime() {
+        return 5000;
+    }
+
+    /**
+     * @return Number of tasks that should be executed during test.
+     */
+    protected int taskExecutionCount() {
+        return TASK_EXECUTION_CNT;
+    }
+
+    /**
+     * @return Number of puts to the cache.
+     */
+    protected int cachePutCount() {
+        return CACHE_PUT_CNT;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration c = super.getConfiguration(gridName);
+
+        c.setLocalHost(HOST);
+
+        assert c.getClientConnectionConfiguration() == null;
+
+        ClientConnectionConfiguration clientCfg = new ClientConnectionConfiguration();
+
+        clientCfg.setRestTcpPort(REST_TCP_PORT_BASE);
+
+        if (useSsl()) {
+            clientCfg.setRestTcpSslEnabled(true);
+
+            clientCfg.setRestTcpSslContextFactory(sslContextFactory());
+        }
+
+        c.setClientConnectionConfiguration(clientCfg);
+
+        TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+        disco.setIpFinder(IP_FINDER);
+
+        c.setDiscoverySpi(disco);
+
+        c.setCacheConfiguration(cacheConfiguration(null), cacheConfiguration(PARTITIONED_CACHE_NAME),
+            cacheConfiguration(REPLICATED_CACHE_NAME), cacheConfiguration(PARTITIONED_ASYNC_BACKUP_CACHE_NAME),
+            cacheConfiguration(REPLICATED_ASYNC_CACHE_NAME));
+
+        return c;
+    }
+
+    /**
+     * @param cacheName Cache name.
+     * @return Cache configuration.
+     * @throws Exception In case of error.
+     */
+    private CacheConfiguration cacheConfiguration(@Nullable String cacheName) throws Exception {
+        CacheConfiguration cfg = defaultCacheConfiguration();
+
+        cfg.setDistributionMode(NEAR_PARTITIONED);
+        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);
+        }
+        else
+            cfg.setCacheMode(REPLICATED);
+
+        cfg.setName(cacheName);
+
+        if (cacheName != null && !cacheName.contains("async"))
+            cfg.setWriteSynchronizationMode(FULL_SYNC);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        startGridsMultiThreaded(NODES_CNT);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTestsStopped() throws Exception {
+        stopAllGrids();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        client = GridClientFactory.start(clientConfiguration());
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        GridClientFactory.stop(client.id(), false);
+
+        client = null;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSyncCommitFlagReplicated() throws Exception {
+        doTestSyncCommitFlag(client.data(REPLICATED_ASYNC_CACHE_NAME));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSyncCommitFlagPartitioned() throws Exception {
+        doTestSyncCommitFlag(client.data(PARTITIONED_ASYNC_BACKUP_CACHE_NAME));
+    }
+
+    /**
+     * Extracts array from given iterator.
+     *
+     * @param nodes Iterator of nodes.
+     * @return Nodes array.
+     */
+    private GridClientNode[] toArray(Iterator<? extends GridClientNode> nodes) {
+        ArrayList<GridClientNode> res = new ArrayList<>();
+
+        while (nodes.hasNext())
+            res.add(nodes.next());
+
+        return res.toArray(new GridClientNode[res.size()]);
+    }
+
+    /**
+     * Runs test on SYNC_COMMIT flag.
+     *
+     * @param data Client data to run test on.
+     * @throws Exception If failed.
+     */
+    private void doTestSyncCommitFlag(final GridClientData data) throws Exception {
+        final String key = "k0";
+
+        Collection<UUID> affNodesIds = F.viewReadOnly(
+            grid(0).cache(data.cacheName()).affinity().mapKeyToPrimaryAndBackups(key),
+            F.node2id());
+
+        final GridClientData dataFirst = data.pinNodes(F.first(client.compute().nodes()));
+
+        List<GridClientNode> affNodes = new ArrayList<>();
+
+        for (GridClientNode node : client.compute().nodes()) {
+            if (affNodesIds.contains(node.nodeId()))
+                affNodes.add(node);
+        }
+
+        Assert.assertFalse(affNodes.isEmpty());
+
+        Iterator<? extends GridClientNode> it = affNodes.iterator();
+
+        final GridClientData dataOthers = data.pinNodes(it.next(), toArray(it));
+
+        for (int i = 0; i < syncCommitIterCount(); i++) {
+            final CountDownLatch l = new CountDownLatch(1);
+
+            final String val = "v" + i;
+
+            IgniteInternalFuture<?> f = multithreadedAsync(new Callable<Object>() {
+                @Override public Object call() throws Exception {
+                    l.await();
+
+                    assertEquals(val, dataOthers.get(key));
+
+                    return null;
+                }
+            }, THREAD_CNT);
+
+            dataFirst.flagsOn(GridClientCacheFlag.SYNC_COMMIT).put(key, val);
+
+            l.countDown();
+
+            f.get();
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testMultithreadedTaskRun() throws Exception {
+        final AtomicLong cnt = new AtomicLong();
+
+        final AtomicReference<GridClientException> err = new AtomicReference<>();
+
+        final ConcurrentLinkedQueue<String> execQueue = new ConcurrentLinkedQueue<>();
+
+        IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
+            @Override
+            public void run() {
+                long processed;
+
+                while ((processed = cnt.getAndIncrement()) < taskExecutionCount()) {
+                    try {
+                        if (processed > 0 && processed % STATISTICS_PRINT_STEP == 0)
+                            info(">>>>>>> " + processed + " tasks finished.");
+
+                        String res = client.compute().execute(TestTask.class.getName(), null);
+
+                        execQueue.add(res);
+                    }
+                    catch (GridClientException e) {
+                        err.compareAndSet(null, e);
+                    }
+                }
+            }
+        }, THREAD_CNT, "client-task-request");
+
+        fut.get();
+
+        if (err.get() != null)
+            throw new Exception(err.get());
+
+        assertEquals(taskExecutionCount(), execQueue.size());
+
+        // With round-robin balancer each node must receive equal count of task requests.
+        Collection<String> executionIds = new HashSet<>(execQueue);
+
+        assertTrue(executionIds.size() == NODES_CNT);
+
+        Map<String, AtomicInteger> statisticsMap = new HashMap<>();
+
+        for (String id : executionIds)
+            statisticsMap.put(id, new AtomicInteger());
+
+        for (String id : execQueue)
+            statisticsMap.get(id).incrementAndGet();
+
+        info(">>>>>>> Execution statistics per node:");
+
+        for (Map.Entry<String, AtomicInteger> e : statisticsMap.entrySet())
+            info(">>>>>>> " + e.getKey() + " run " + e.getValue().get() + " tasks");
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void test6Affinity() throws Exception {
+        GridClientData cache = client.data(PARTITIONED_CACHE_NAME);
+        UUID nodeId = cache.affinity("6");
+
+        info("Affinity node: " + nodeId);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testMultithreadedCachePut() throws Exception {
+        final AtomicLong keyCnt = new AtomicLong();
+
+        final AtomicReference<Exception> err = new AtomicReference<>();
+
+        final ConcurrentMap<String, T2<UUID, String>> puts = new ConcurrentHashMap<>();
+
+        final Map<UUID, Ignite> gridMap = new HashMap<>();
+
+        for (int i = 0; i < NODES_CNT; i++) {
+            Ignite g = grid(i);
+
+            gridMap.put(g.cluster().localNode().id(), g);
+        }
+
+        final Ignite ignite = F.first(gridMap.values());
+
+        assertEquals(NODES_CNT, client.compute().refreshTopology(false, false).size());
+
+        IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() {
+            @SuppressWarnings("OverlyStrongTypeCast")
+            @Override public void run() {
+                try {
+                    GridClientData cache = client.data(PARTITIONED_CACHE_NAME);
+
+                    assertEquals(NODES_CNT, ((GridClientDataImpl)cache).projectionNodes().size());
+
+                    long rawKey;
+
+                    while ((rawKey = keyCnt.getAndIncrement()) < cachePutCount()) {
+                        String key = String.valueOf(rawKey);
+
+                        UUID nodeId = cache.affinity(key);
+                        UUID srvNodeId = ignite.cluster().mapKeyToNode(PARTITIONED_CACHE_NAME, key).id();
+
+                        if (!nodeId.equals(srvNodeId)) {
+                            //GridClientDataAffinity clAff =
+                            //    ((GridClientConfiguration)getFieldValue(client, "cfg")).
+                            //        getDataConfiguration(PARTITIONED_CACHE_NAME).getAffinity();
+
+                            //printAffinityState(gridMap.values());
+                            //info("Client affinity: " + clAff);
+
+                            info("Got wrong client mapping [key=" + key + ", exp=" + srvNodeId +
+                                ", actual=" + nodeId + "]");
+                        }
+
+                        String val = "val" + rawKey;
+
+                        if (cache.put(key, val)) {
+                            T2<UUID, String> old = puts.putIfAbsent(key, new T2<>(nodeId, val));
+
+                            assert old == null : "Map contained entry [key=" + rawKey + ", entry=" + old + ']';
+                        }
+                    }
+                }
+                catch (Exception e) {
+                    err.compareAndSet(null, e);
+                }
+            }
+        }, THREAD_CNT, "client-cache-put");
+
+        fut.get();
+
+        if (err.get() != null)
+            throw new Exception(err.get());
+
+        assertEquals(cachePutCount(), puts.size());
+
+        // Now check that all puts went to primary nodes.
+        for (long i = 0; i < cachePutCount(); i++) {
+            String key = String.valueOf(i);
+
+            ClusterNode node = ignite.cluster().mapKeyToNode(PARTITIONED_CACHE_NAME, key);
+
+            if (!puts.get(key).get2().equals(gridMap.get(node.id()).cache(PARTITIONED_CACHE_NAME).peek(key))) {
+                // printAffinityState(gridMap.values());
+
+                failNotEquals("Node don't have value for key [nodeId=" + node.id() + ", key=" + key + "]",
+                    puts.get(key).get2(), gridMap.get(node.id()).cache(PARTITIONED_CACHE_NAME).peek(key));
+            }
+
+            // Assert that client has properly determined affinity node.
+            if (!node.id().equals(puts.get(key).get1())) {
+                //GridClientDataAffinity clAff =
+                //    ((GridClientConfiguration)getFieldValue(client, "cfg")).
+                //        getDataConfiguration(PARTITIONED_CACHE_NAME).getAffinity();
+
+                //printAffinityState(gridMap.values());
+                //info("Client affinity: " + clAff);
+
+                UUID curAffNode = client.data(PARTITIONED_CACHE_NAME).affinity(key);
+
+                failNotEquals(
+                    "Got different mappings [key=" + key + ", currId=" + curAffNode + "]",
+                    node.id(), puts.get(key).get1());
+            }
+
+            // Check that no other nodes see this key.
+            for (UUID id : F.view(gridMap.keySet(), F.notEqualTo(node.id())))
+                assertNull("Got value in near cache.", gridMap.get(id).cache(PARTITIONED_CACHE_NAME).peek(key));
+        }
+
+        for (Ignite g : gridMap.values())
+            g.cache(PARTITIONED_CACHE_NAME).clearAll();
+    }
+
+    /**
+     * @param grids Collection for Grids to print affinity info.
+     */
+    private void printAffinityState(Iterable<Ignite> grids) {
+        for (Ignite g : grids) {
+            GridAffinityAssignmentCache affCache = getFieldValue(
+                ((IgniteKernal)g).internalCache(PARTITIONED_CACHE_NAME).context().affinity(),
+                "aff");
+
+            CacheAffinityFunction aff = getFieldValue(affCache, "aff");
+
+            info("Affinity [nodeId=" + g.cluster().localNode().id() + ", affinity=" + aff + "]");
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override protected long getTestTimeout() {
+        return 5 * 60 * 1000;
+    }
+
+    /**
+     * Creates client that will try to connect to only first node in grid.
+     *
+     * @return Client.
+     */
+    private GridClientConfiguration clientConfiguration() {
+        GridClientConfiguration cfg = new GridClientConfiguration();
+
+        cfg.setTopologyRefreshFrequency(topologyRefreshFrequency());
+        cfg.setMaxConnectionIdleTime(maxConnectionIdleTime());
+
+        cfg.setProtocol(protocol());
+        cfg.setServers(Arrays.asList(serverAddress()));
+        cfg.setBalancer(new GridClientRoundRobinBalancer());
+
+        if (useSsl())
+            cfg.setSslContextFactory(sslContextFactory());
+
+        GridClientDataConfiguration loc = new GridClientDataConfiguration();
+
+        GridClientDataConfiguration partitioned = new GridClientDataConfiguration();
+        partitioned.setName(PARTITIONED_CACHE_NAME);
+        partitioned.setAffinity(new GridClientPartitionAffinity());
+
+        GridClientDataConfiguration partitionedAsyncBackup = new GridClientDataConfiguration();
+        partitionedAsyncBackup.setName(PARTITIONED_ASYNC_BACKUP_CACHE_NAME);
+        partitionedAsyncBackup.setAffinity(new GridClientPartitionAffinity());
+
+        GridClientDataConfiguration replicated = new GridClientDataConfiguration();
+        replicated.setName(REPLICATED_CACHE_NAME);
+
+        GridClientDataConfiguration replicatedAsync = new GridClientDataConfiguration();
+        replicatedAsync.setName(REPLICATED_ASYNC_CACHE_NAME);
+
+        cfg.setDataConfigurations(Arrays.asList(loc, partitioned, replicated, replicatedAsync, partitionedAsyncBackup));
+
+        return cfg;
+    }
+
+    /**
+     * Test task. Returns a tuple in which first component is id of node that has split the task,
+     * and second component is count of nodes that executed jobs.
+     */
+    private static class TestTask extends ComputeTaskSplitAdapter<Object, String> {
+        /** Injected grid. */
+        @IgniteInstanceResource
+        private Ignite ignite;
+
+        /** Count of tasks this job was split to. */
+        private int gridSize;
+
+        /** {@inheritDoc} */
+        @Override protected Collection<? extends ComputeJob> split(int gridSize, Object arg)
+            throws IgniteCheckedException {
+            Collection<ComputeJobAdapter> jobs = new ArrayList<>(gridSize);
+
+            this.gridSize = gridSize;
+
+            final String locNodeId = ignite.cluster().localNode().id().toString();
+
+            for (int i = 0; i < gridSize; i++) {
+                jobs.add(new ComputeJobAdapter() {
+                    @Override public Object execute() {
+                        return new IgniteBiTuple<>(locNodeId, 1);
+                    }
+                });
+            }
+
+            return jobs;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String reduce(List<ComputeJobResult> results) throws IgniteCheckedException {
+            int sum = 0;
+
+            String locNodeId = null;
+
+            for (ComputeJobResult res : results) {
+                IgniteBiTuple<String, Integer> part = res.getData();
+
+                if (locNodeId == null)
+                    locNodeId = part.get1();
+
+                Integer i = part.get2();
+
+                if (i != null)
+                    sum += i;
+            }
+
+            assert gridSize == sum;
+
+            return locNodeId;
+        }
+    }
+}


Mime
View raw message