ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [16/65] [abbrv] incubator-ignite git commit: # ignite-63
Date Thu, 22 Jan 2015 21:27:03 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1b0e45a2/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestBinaryProtocolSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestBinaryProtocolSelfTest.java b/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestBinaryProtocolSelfTest.java
deleted file mode 100644
index 6cda5d2..0000000
--- a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestBinaryProtocolSelfTest.java
+++ /dev/null
@@ -1,633 +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.gridgain.grid.kernal.processors.rest;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.*;
-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.gridgain.grid.kernal.processors.rest.client.message.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.gridgain.testframework.*;
-import org.gridgain.testframework.junits.common.*;
-import org.jetbrains.annotations.*;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.util.*;
-import java.util.concurrent.*;
-
-import static org.apache.ignite.cache.GridCacheMode.*;
-import static org.apache.ignite.cache.GridCacheWriteSynchronizationMode.*;
-
-/**
- * TCP protocol test.
- */
-@SuppressWarnings("unchecked")
-public class GridRestBinaryProtocolSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** */
-    private static final String CACHE_NAME = "cache";
-
-    /** */
-    private static final String HOST = "127.0.0.1";
-
-    /** */
-    private static final int PORT = 11212;
-
-    /** */
-    private GridTestBinaryClient client;
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGrid();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        client = client();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        client.shutdown();
-
-        grid().cache(null).clearAll();
-        grid().cache(CACHE_NAME).clearAll();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setLocalHost(HOST);
-
-        assert cfg.getClientConnectionConfiguration() == null;
-
-        ClientConnectionConfiguration clientCfg = new ClientConnectionConfiguration();
-
-        clientCfg.setRestTcpPort(PORT);
-
-        cfg.setClientConnectionConfiguration(clientCfg);
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(disco);
-
-        cfg.setCacheConfiguration(cacheConfiguration(null), cacheConfiguration(CACHE_NAME));
-
-        return cfg;
-    }
-
-    /**
-     * @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.setCacheMode(LOCAL);
-        cfg.setName(cacheName);
-        cfg.setWriteSynchronizationMode(FULL_SYNC);
-
-        return cfg;
-    }
-
-    /**
-     * @return Client.
-     * @throws IgniteCheckedException In case of error.
-     */
-    private GridTestBinaryClient client() throws IgniteCheckedException {
-        return new GridTestBinaryClient(HOST, PORT);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPut() throws Exception {
-        assertTrue(client.cachePut(null, "key1", "val1"));
-        assertEquals("val1", grid().cache(null).get("key1"));
-
-        assertTrue(client.cachePut(CACHE_NAME, "key1", "val1"));
-        assertEquals("val1", grid().cache(CACHE_NAME).get("key1"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPutAll() throws Exception {
-        client.cachePutAll(null, F.asMap("key1", "val1", "key2", "val2"));
-
-        Map<String, String> map = grid().<String, String>cache(null).getAll(Arrays.asList("key1", "key2"));
-
-        assertEquals(2, map.size());
-        assertEquals("val1", map.get("key1"));
-        assertEquals("val2", map.get("key2"));
-
-        client.cachePutAll(CACHE_NAME, F.asMap("key1", "val1", "key2", "val2"));
-
-        map = grid().<String, String>cache(CACHE_NAME).getAll(Arrays.asList("key1", "key2"));
-
-        assertEquals(2, map.size());
-        assertEquals("val1", map.get("key1"));
-        assertEquals("val2", map.get("key2"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testGet() throws Exception {
-        assertTrue(grid().cache(null).putx("key", "val"));
-
-        assertEquals("val", client.cacheGet(null, "key"));
-
-        assertTrue(grid().cache(CACHE_NAME).putx("key", "val"));
-
-        assertEquals("val", client.cacheGet(CACHE_NAME, "key"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testFailure() throws Exception {
-        GridKernal kernal = ((GridKernal)grid());
-
-        GridRestProcessor proc = kernal.context().rest();
-
-        // Clearing handlers collection to force failure.
-        Field hndField = proc.getClass().getDeclaredField("handlers");
-
-        hndField.setAccessible(true);
-
-        Map handlers = (Map)hndField.get(proc);
-
-        Map cp = new HashMap(handlers);
-
-        handlers.clear();
-
-        try {
-            GridTestUtils.assertThrows(
-                log,
-                new Callable<Object>() {
-                    @Override public Object call() throws Exception {
-                        return client.cacheGet(null, "key");
-                    }
-                },
-                IgniteCheckedException.class,
-                "Failed to process client request: Failed to find registered handler for command: CACHE_GET");
-        }
-        finally {
-            handlers.putAll(cp);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testGetAll() throws Exception {
-        assertTrue(grid().cache(null).putx("key1", "val1"));
-        assertTrue(grid().cache(null).putx("key2", "val2"));
-
-        Map<String, String> map = client.cacheGetAll(null, "key1", "key2");
-
-        assertEquals(2, map.size());
-        assertEquals("val1", map.get("key1"));
-        assertEquals("val2", map.get("key2"));
-
-        assertTrue(grid().cache(null).putx("key3", "val3"));
-        assertTrue(grid().cache(null).putx("key4", "val4"));
-
-        map = client.cacheGetAll(null, "key3", "key4");
-
-        assertEquals(2, map.size());
-        assertEquals("val3", map.get("key3"));
-        assertEquals("val4", map.get("key4"));
-
-        assertTrue(grid().cache(CACHE_NAME).putx("key1", "val1"));
-        assertTrue(grid().cache(CACHE_NAME).putx("key2", "val2"));
-
-        map = client.cacheGetAll(CACHE_NAME, "key1", "key2");
-
-        assertEquals(2, map.size());
-        assertEquals("val1", map.get("key1"));
-        assertEquals("val2", map.get("key2"));
-
-        assertTrue(grid().cache(CACHE_NAME).putx("key3", "val3"));
-        assertTrue(grid().cache(CACHE_NAME).putx("key4", "val4"));
-
-        map = client.cacheGetAll(CACHE_NAME, "key3", "key4");
-
-        assertEquals(2, map.size());
-        assertEquals("val3", map.get("key3"));
-        assertEquals("val4", map.get("key4"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRemove() throws Exception {
-        assertTrue(grid().cache(null).putx("key", "val"));
-
-        assertTrue(client.cacheRemove(null, "key"));
-        assertFalse(client.cacheRemove(null, "wrongKey"));
-
-        assertNull(grid().cache(null).get("key"));
-
-        assertTrue(grid().cache(CACHE_NAME).putx("key", "val"));
-
-        assertTrue(client.cacheRemove(CACHE_NAME, "key"));
-        assertFalse(client.cacheRemove(CACHE_NAME, "wrongKey"));
-
-        assertNull(grid().cache(CACHE_NAME).get("key"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRemoveAll() throws Exception {
-        assertTrue(grid().cache(null).putx("key1", "val1"));
-        assertTrue(grid().cache(null).putx("key2", "val2"));
-        assertTrue(grid().cache(null).putx("key3", "val3"));
-        assertTrue(grid().cache(null).putx("key4", "val4"));
-
-        client.cacheRemoveAll(null, "key1", "key2");
-
-        assertNull(grid().cache(null).get("key1"));
-        assertNull(grid().cache(null).get("key2"));
-        assertNotNull(grid().cache(null).get("key3"));
-        assertNotNull(grid().cache(null).get("key4"));
-
-        assertTrue(grid().cache(CACHE_NAME).putx("key1", "val1"));
-        assertTrue(grid().cache(CACHE_NAME).putx("key2", "val2"));
-        assertTrue(grid().cache(CACHE_NAME).putx("key3", "val3"));
-        assertTrue(grid().cache(CACHE_NAME).putx("key4", "val4"));
-
-        client.cacheRemoveAll(CACHE_NAME, "key1", "key2");
-
-        assertNull(grid().cache(CACHE_NAME).get("key1"));
-        assertNull(grid().cache(CACHE_NAME).get("key2"));
-        assertNotNull(grid().cache(CACHE_NAME).get("key3"));
-        assertNotNull(grid().cache(CACHE_NAME).get("key4"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testReplace() throws Exception {
-        assertFalse(client.cacheReplace(null, "key1", "val1"));
-        assertTrue(grid().cache(null).putx("key1", "val1"));
-        assertTrue(client.cacheReplace(null, "key1", "val2"));
-
-        assertFalse(client.cacheReplace(null, "key2", "val1"));
-        assertTrue(grid().cache(null).putx("key2", "val1"));
-        assertTrue(client.cacheReplace(null, "key2", "val2"));
-
-        grid().cache(null).clearAll();
-
-        assertFalse(client.cacheReplace(CACHE_NAME, "key1", "val1"));
-        assertTrue(grid().cache(CACHE_NAME).putx("key1", "val1"));
-        assertTrue(client.cacheReplace(CACHE_NAME, "key1", "val2"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCompareAndSet() throws Exception {
-        assertFalse(client.cacheCompareAndSet(null, "key", null, null));
-        assertTrue(grid().cache(null).putx("key", "val"));
-        assertTrue(client.cacheCompareAndSet(null, "key", null, null));
-        assertNull(grid().cache(null).get("key"));
-
-        assertFalse(client.cacheCompareAndSet(null, "key", null, "val"));
-        assertTrue(grid().cache(null).putx("key", "val"));
-        assertFalse(client.cacheCompareAndSet(null, "key", null, "wrongVal"));
-        assertEquals("val", grid().cache(null).get("key"));
-        assertTrue(client.cacheCompareAndSet(null, "key", null, "val"));
-        assertNull(grid().cache(null).get("key"));
-
-        assertTrue(client.cacheCompareAndSet(null, "key", "val", null));
-        assertEquals("val", grid().cache(null).get("key"));
-        assertFalse(client.cacheCompareAndSet(null, "key", "newVal", null));
-        assertEquals("val", grid().cache(null).get("key"));
-        assertTrue(grid().cache(null).removex("key"));
-
-        assertFalse(client.cacheCompareAndSet(null, "key", "val1", "val2"));
-        assertTrue(grid().cache(null).putx("key", "val2"));
-        assertFalse(client.cacheCompareAndSet(null, "key", "val1", "wrongVal"));
-        assertEquals("val2", grid().cache(null).get("key"));
-        assertTrue(client.cacheCompareAndSet(null, "key", "val1", "val2"));
-        assertEquals("val1", grid().cache(null).get("key"));
-        assertTrue(grid().cache(null).removex("key"));
-
-        assertFalse(client.cacheCompareAndSet(CACHE_NAME, "key", null, null));
-        assertTrue(grid().cache(CACHE_NAME).putx("key", "val"));
-        assertTrue(client.cacheCompareAndSet(CACHE_NAME, "key", null, null));
-        assertNull(grid().cache(CACHE_NAME).get("key"));
-
-        assertFalse(client.cacheCompareAndSet(CACHE_NAME, "key", null, "val"));
-        assertTrue(grid().cache(CACHE_NAME).putx("key", "val"));
-        assertFalse(client.cacheCompareAndSet(CACHE_NAME, "key", null, "wrongVal"));
-        assertEquals("val", grid().cache(CACHE_NAME).get("key"));
-        assertTrue(client.cacheCompareAndSet(CACHE_NAME, "key", null, "val"));
-        assertNull(grid().cache(CACHE_NAME).get("key"));
-
-        assertTrue(client.cacheCompareAndSet(CACHE_NAME, "key", "val", null));
-        assertEquals("val", grid().cache(CACHE_NAME).get("key"));
-        assertFalse(client.cacheCompareAndSet(CACHE_NAME, "key", "newVal", null));
-        assertEquals("val", grid().cache(CACHE_NAME).get("key"));
-        assertTrue(grid().cache(CACHE_NAME).removex("key"));
-
-        assertFalse(client.cacheCompareAndSet(CACHE_NAME, "key", "val1", "val2"));
-        assertTrue(grid().cache(CACHE_NAME).putx("key", "val2"));
-        assertFalse(client.cacheCompareAndSet(CACHE_NAME, "key", "val1", "wrongVal"));
-        assertEquals("val2", grid().cache(CACHE_NAME).get("key"));
-        assertTrue(client.cacheCompareAndSet(CACHE_NAME, "key", "val1", "val2"));
-        assertEquals("val1", grid().cache(CACHE_NAME).get("key"));
-        assertTrue(grid().cache(CACHE_NAME).removex("key"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testMetrics() throws Exception {
-        grid().cache(null).resetMetrics();
-        grid().cache(CACHE_NAME).resetMetrics();
-
-        grid().cache(null).putx("key1", "val");
-        grid().cache(null).putx("key2", "val");
-        grid().cache(null).putx("key2", "val");
-
-        grid().cache(null).get("key1");
-        grid().cache(null).get("key2");
-        grid().cache(null).get("key2");
-
-        grid().cache(CACHE_NAME).putx("key1", "val");
-        grid().cache(CACHE_NAME).putx("key2", "val");
-        grid().cache(CACHE_NAME).putx("key2", "val");
-
-        grid().cache(CACHE_NAME).get("key1");
-        grid().cache(CACHE_NAME).get("key2");
-        grid().cache(CACHE_NAME).get("key2");
-
-        Map<String, Long> m = client.cacheMetrics(null);
-
-        assertNotNull(m);
-        assertEquals(7, m.size());
-        assertEquals(3, m.get("reads").longValue());
-        assertEquals(3, m.get("writes").longValue());
-
-        m = client.cacheMetrics(CACHE_NAME);
-
-        assertNotNull(m);
-        assertEquals(7, m.size());
-        assertEquals(3, m.get("reads").longValue());
-        assertEquals(3, m.get("writes").longValue());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testAppend() throws Exception {
-        grid().cache(null).remove("key");
-        grid().cache(CACHE_NAME).remove("key");
-
-        assertFalse(client.cacheAppend(null, "key", ".val"));
-        assertFalse(client.cacheAppend(CACHE_NAME, "key", ".val"));
-
-        grid().cache(null).put("key", "orig");
-        grid().cache(CACHE_NAME).put("key", "orig");
-
-        assertTrue(client.cacheAppend(null, "key", ".val"));
-        assertEquals("orig.val", grid().cache(null).get("key"));
-        assertTrue(client.cacheAppend(null, "key", ".newVal"));
-        assertEquals("orig.val.newVal", grid().cache(null).get("key"));
-
-        assertTrue(client.cacheAppend(CACHE_NAME, "key", ".val"));
-        assertEquals("orig.val", grid().cache(CACHE_NAME).get("key"));
-        assertTrue(client.cacheAppend(CACHE_NAME, "key", ".newVal"));
-        assertEquals("orig.val.newVal", grid().cache(CACHE_NAME).get("key"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPrepend() throws Exception {
-        grid().cache(null).remove("key");
-        grid().cache(CACHE_NAME).remove("key");
-
-        assertFalse(client.cachePrepend(null, "key", ".val"));
-        assertFalse(client.cachePrepend(CACHE_NAME, "key", ".val"));
-
-        grid().cache(null).put("key", "orig");
-        grid().cache(CACHE_NAME).put("key", "orig");
-
-        assertTrue(client.cachePrepend(null, "key", "val."));
-        assertEquals("val.orig", grid().cache(null).get("key"));
-        assertTrue(client.cachePrepend(null, "key", "newVal."));
-        assertEquals("newVal.val.orig", grid().cache(null).get("key"));
-
-        assertTrue(client.cachePrepend(CACHE_NAME, "key", "val."));
-        assertEquals("val.orig", grid().cache(CACHE_NAME).get("key"));
-        assertTrue(client.cachePrepend(CACHE_NAME, "key", "newVal."));
-        assertEquals("newVal.val.orig", grid().cache(CACHE_NAME).get("key"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testExecute() throws Exception {
-        GridClientTaskResultBean res = client.execute(TestTask.class.getName(),
-            Arrays.asList("executing", 3, "test", 5, "task"));
-
-        assertTrue(res.isFinished());
-        assertEquals(25, res.getResult());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testNode() throws Exception {
-        assertNull(client.node(UUID.randomUUID(), false, false));
-        assertNull(client.node("wrongHost", false, false));
-
-        GridClientNodeBean node = client.node(grid().localNode().id(), true, true);
-
-        assertNotNull(node);
-        assertFalse(node.getAttributes().isEmpty());
-        assertNotNull(node.getMetrics());
-        assertNotNull(node.getTcpAddresses());
-        assertEquals(PORT,  node.getTcpPort());
-        assertEquals(grid().localNode().id(), node.getNodeId());
-
-        node = client.node(grid().localNode().id(), false, false);
-
-        assertNotNull(node);
-        assertNull(node.getAttributes());
-        assertNull(node.getMetrics());
-        assertNotNull(node.getTcpAddresses());
-        assertEquals(PORT,  node.getTcpPort());
-        assertEquals(grid().localNode().id(), node.getNodeId());
-
-        node = client.node(HOST, true, true);
-
-        assertNotNull(node);
-        assertFalse(node.getAttributes().isEmpty());
-        assertNotNull(node.getMetrics());
-        assertNotNull(node.getTcpAddresses());
-        assertEquals(PORT,  node.getTcpPort());
-        assertEquals(grid().localNode().id(), node.getNodeId());
-
-        node = client.node(HOST, false, false);
-
-        assertNotNull(node);
-        assertNull(node.getAttributes());
-        assertNull(node.getMetrics());
-        assertNotNull(node.getTcpAddresses());
-        assertEquals(PORT,  node.getTcpPort());
-        assertEquals(grid().localNode().id(), node.getNodeId());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testTopology() throws Exception {
-        List<GridClientNodeBean> top = client.topology(true, true);
-
-        assertNotNull(top);
-        assertEquals(1, top.size());
-
-        GridClientNodeBean node = F.first(top);
-
-        assertNotNull(node);
-        assertFalse(node.getAttributes().isEmpty());
-        assertNotNull(node.getMetrics());
-        assertNotNull(node.getTcpAddresses());
-        assertEquals(grid().localNode().id(), node.getNodeId());
-
-        top = client.topology(false, false);
-
-        assertNotNull(top);
-        assertEquals(1, top.size());
-
-        node = F.first(top);
-
-        assertNotNull(node);
-        assertNull(node.getAttributes());
-        assertNull(node.getMetrics());
-        assertNotNull(node.getTcpAddresses());
-        assertEquals(grid().localNode().id(), node.getNodeId());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testLog() throws Exception {
-        String path = "work/log/gridgain.log." + System.currentTimeMillis();
-
-        File file = new File(U.getGridGainHome(), path);
-
-        assert !file.exists();
-
-        FileWriter writer = new FileWriter(file);
-
-        String sep = System.getProperty("line.separator");
-
-        writer.write("Line 1" + sep);
-        writer.write(sep);
-        writer.write("Line 2" + sep);
-        writer.write("Line 3" + sep);
-
-        writer.flush();
-        writer.close();
-
-        List<String> log = client.log(path, 0, 10);
-
-        assertNotNull(log);
-        assertEquals(4, log.size());
-
-        file.delete();
-
-        GridTestUtils.assertThrows(
-            log(),
-            new Callable<Object>() {
-                @Override
-                public Object call() throws Exception {
-                    client.log("wrong/path", 0, 10);
-
-                    return null;
-                }
-            },
-            IgniteCheckedException.class,
-            null
-        );
-    }
-
-    /**
-     * Test task.
-     */
-    private static class TestTask extends ComputeTaskSplitAdapter<List<Object>, Integer> {
-        /** {@inheritDoc} */
-        @Override protected Collection<? extends ComputeJob> split(int gridSize, List<Object> args)
-            throws IgniteCheckedException {
-            Collection<ComputeJobAdapter> jobs = new ArrayList<>(args.size());
-
-            for (final Object arg : args) {
-                jobs.add(new ComputeJobAdapter() {
-                    @SuppressWarnings("OverlyStrongTypeCast")
-                    @Override public Object execute() {
-                        try {
-                            return ((String)arg).length();
-                        }
-                        catch (ClassCastException ignored) {
-                            assert arg instanceof Integer;
-
-                            return arg;
-                        }
-                    }
-                });
-            }
-
-            return jobs;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Integer reduce(List<ComputeJobResult> results) throws IgniteCheckedException {
-            int sum = 0;
-
-            for (ComputeJobResult res : results)
-                sum += res.<Integer>getData();
-
-            return sum;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1b0e45a2/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestMemcacheProtocolSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestMemcacheProtocolSelfTest.java b/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestMemcacheProtocolSelfTest.java
deleted file mode 100644
index e423134..0000000
--- a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestMemcacheProtocolSelfTest.java
+++ /dev/null
@@ -1,331 +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.gridgain.grid.kernal.processors.rest;
-
-import junit.framework.*;
-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.spi.discovery.tcp.ipfinder.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.gridgain.testframework.junits.common.*;
-import org.jetbrains.annotations.*;
-
-import java.util.*;
-
-import static org.apache.ignite.cache.GridCacheMode.*;
-import static org.apache.ignite.cache.GridCacheWriteSynchronizationMode.*;
-
-/**
- * TCP protocol test.
- */
-@SuppressWarnings("unchecked")
-public class GridRestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** */
-    private static final String CACHE_NAME = "cache";
-
-    /** */
-    private static final String HOST = "127.0.0.1";
-
-    /** */
-    private static final int PORT = 11212;
-
-    /** */
-    private GridTestMemcacheClient client;
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGrid();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        client = client();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        client.shutdown();
-
-        grid().cache(null).clearAll();
-        grid().cache(CACHE_NAME).clearAll();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setLocalHost(HOST);
-
-        assert cfg.getClientConnectionConfiguration() == null;
-
-        ClientConnectionConfiguration clientCfg = new ClientConnectionConfiguration();
-
-        clientCfg.setRestTcpPort(PORT);
-
-        cfg.setClientConnectionConfiguration(clientCfg);
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(disco);
-
-        cfg.setCacheConfiguration(cacheConfiguration(null), cacheConfiguration(CACHE_NAME));
-
-        return cfg;
-    }
-
-    /**
-     * @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.setCacheMode(LOCAL);
-        cfg.setName(cacheName);
-        cfg.setWriteSynchronizationMode(FULL_SYNC);
-
-        return cfg;
-    }
-
-    /**
-     * @return Client.
-     * @throws IgniteCheckedException In case of error.
-     */
-    private GridTestMemcacheClient client() throws IgniteCheckedException {
-        return new GridTestMemcacheClient(HOST, PORT);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPut() throws Exception {
-        assertTrue(client.cachePut(null, "key1", "val1"));
-        assertEquals("val1", grid().cache(null).get("key1"));
-
-        assertTrue(client.cachePut(CACHE_NAME, "key1", "val1"));
-        assertEquals("val1", grid().cache(CACHE_NAME).get("key1"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testGet() throws Exception {
-        assertTrue(grid().cache(null).putx("key", "val"));
-
-        Assert.assertEquals("val", client.cacheGet(null, "key"));
-
-        assertTrue(grid().cache(CACHE_NAME).putx("key", "val"));
-
-        Assert.assertEquals("val", client.cacheGet(CACHE_NAME, "key"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRemove() throws Exception {
-        assertTrue(grid().cache(null).putx("key", "val"));
-
-        assertTrue(client.cacheRemove(null, "key"));
-        assertFalse(client.cacheRemove(null, "wrongKey"));
-
-        assertNull(grid().cache(null).get("key"));
-
-        assertTrue(grid().cache(CACHE_NAME).putx("key", "val"));
-
-        assertTrue(client.cacheRemove(CACHE_NAME, "key"));
-        assertFalse(client.cacheRemove(CACHE_NAME, "wrongKey"));
-
-        assertNull(grid().cache(CACHE_NAME).get("key"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testAdd() throws Exception {
-        assertTrue(client.cacheAdd(null, "key", "val"));
-        assertEquals("val", grid().cache(null).get("key"));
-        assertFalse(client.cacheAdd(null, "key", "newVal"));
-        assertEquals("val", grid().cache(null).get("key"));
-
-        assertTrue(client.cacheAdd(CACHE_NAME, "key", "val"));
-        assertEquals("val", grid().cache(CACHE_NAME).get("key"));
-        assertFalse(client.cacheAdd(CACHE_NAME, "key", "newVal"));
-        assertEquals("val", grid().cache(CACHE_NAME).get("key"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testReplace() throws Exception {
-        assertFalse(client.cacheReplace(null, "key1", "val1"));
-        assertTrue(grid().cache(null).putx("key1", "val1"));
-        assertTrue(client.cacheReplace(null, "key1", "val2"));
-
-        assertFalse(client.cacheReplace(null, "key2", "val1"));
-        assertTrue(grid().cache(null).putx("key2", "val1"));
-        assertTrue(client.cacheReplace(null, "key2", "val2"));
-
-        grid().cache(null).clearAll();
-
-        assertFalse(client.cacheReplace(CACHE_NAME, "key1", "val1"));
-        assertTrue(grid().cache(CACHE_NAME).putx("key1", "val1"));
-        assertTrue(client.cacheReplace(CACHE_NAME, "key1", "val2"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testMetrics() throws Exception {
-        grid().cache(null).resetMetrics();
-        grid().cache(CACHE_NAME).resetMetrics();
-
-        grid().cache(null).putx("key1", "val");
-        grid().cache(null).putx("key2", "val");
-        grid().cache(null).putx("key2", "val");
-
-        grid().cache(null).get("key1");
-        grid().cache(null).get("key2");
-        grid().cache(null).get("key2");
-
-        grid().cache(CACHE_NAME).putx("key1", "val");
-        grid().cache(CACHE_NAME).putx("key2", "val");
-        grid().cache(CACHE_NAME).putx("key2", "val");
-
-        grid().cache(CACHE_NAME).get("key1");
-        grid().cache(CACHE_NAME).get("key2");
-        grid().cache(CACHE_NAME).get("key2");
-
-        Map<String, Long> m = client.cacheMetrics(null);
-
-        assertNotNull(m);
-        assertEquals(7, m.size());
-        assertEquals(3, m.get("reads").longValue());
-        assertEquals(3, m.get("writes").longValue());
-
-        m = client.cacheMetrics(CACHE_NAME);
-
-        assertNotNull(m);
-        assertEquals(7, m.size());
-        assertEquals(3, m.get("reads").longValue());
-        assertEquals(3, m.get("writes").longValue());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testIncrement() throws Exception {
-        assertEquals(15L, client().cacheIncrement(null, "key", 10L, 5L));
-        assertEquals(15L, grid().cache(null).dataStructures().atomicLong("key", 0, true).get());
-        assertEquals(18L, client().cacheIncrement(null, "key", 20L, 3L));
-        assertEquals(18L, grid().cache(null).dataStructures().atomicLong("key", 0, true).get());
-        assertEquals(20L, client().cacheIncrement(null, "key", null, 2L));
-        assertEquals(20L, grid().cache(null).dataStructures().atomicLong("key", 0, true).get());
-
-        assertEquals(15L, client().cacheIncrement(CACHE_NAME, "key", 10L, 5L));
-        assertEquals(15L, grid().cache(CACHE_NAME).dataStructures().atomicLong("key", 0, true).get());
-        assertEquals(18L, client().cacheIncrement(CACHE_NAME, "key", 20L, 3L));
-        assertEquals(18L, grid().cache(CACHE_NAME).dataStructures().atomicLong("key", 0, true).get());
-        assertEquals(20L, client().cacheIncrement(CACHE_NAME, "key", null, 2L));
-        assertEquals(20L, grid().cache(CACHE_NAME).dataStructures().atomicLong("key", 0, true).get());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDecrement() throws Exception {
-        assertEquals(15L, client().cacheDecrement(null, "key", 20L, 5L));
-        assertEquals(15L, grid().cache(null).dataStructures().atomicLong("key", 0, true).get());
-        assertEquals(12L, client().cacheDecrement(null, "key", 20L, 3L));
-        assertEquals(12L, grid().cache(null).dataStructures().atomicLong("key", 0, true).get());
-        assertEquals(10L, client().cacheDecrement(null, "key", null, 2L));
-        assertEquals(10L, grid().cache(null).dataStructures().atomicLong("key", 0, true).get());
-
-        assertEquals(15L, client().cacheDecrement(CACHE_NAME, "key", 20L, 5L));
-        assertEquals(15L, grid().cache(CACHE_NAME).dataStructures().atomicLong("key", 0, true).get());
-        assertEquals(12L, client().cacheDecrement(CACHE_NAME, "key", 20L, 3L));
-        assertEquals(12L, grid().cache(CACHE_NAME).dataStructures().atomicLong("key", 0, true).get());
-        assertEquals(10L, client().cacheDecrement(CACHE_NAME, "key", null, 2L));
-        assertEquals(10L, grid().cache(CACHE_NAME).dataStructures().atomicLong("key", 0, true).get());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testAppend() throws Exception {
-        assertFalse(client.cacheAppend(null, "wrongKey", "_suffix"));
-        assertFalse(client.cacheAppend(CACHE_NAME, "wrongKey", "_suffix"));
-
-        assertTrue(grid().cache(null).putx("key", "val"));
-        assertTrue(client.cacheAppend(null, "key", "_suffix"));
-        assertEquals("val_suffix", grid().cache(null).get("key"));
-
-        assertTrue(grid().cache(CACHE_NAME).putx("key", "val"));
-        assertTrue(client.cacheAppend(CACHE_NAME, "key", "_suffix"));
-        assertEquals("val_suffix", grid().cache(CACHE_NAME).get("key"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testPrepend() throws Exception {
-        assertFalse(client.cachePrepend(null, "wrongKey", "prefix_"));
-        assertFalse(client.cachePrepend(CACHE_NAME, "wrongKey", "prefix_"));
-
-        assertTrue(grid().cache(null).putx("key", "val"));
-        assertTrue(client.cachePrepend(null, "key", "prefix_"));
-        assertEquals("prefix_val", grid().cache(null).get("key"));
-
-        assertTrue(grid().cache(CACHE_NAME).putx("key", "val"));
-        assertTrue(client.cachePrepend(CACHE_NAME, "key", "prefix_"));
-        assertEquals("prefix_val", grid().cache(CACHE_NAME).get("key"));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testVersion() throws Exception {
-        assertNotNull(client.version());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testNoop() throws Exception {
-        client.noop();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testQuit() throws Exception {
-        client.quit();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1b0e45a2/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestProcessorMultiStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestProcessorMultiStartSelfTest.java b/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestProcessorMultiStartSelfTest.java
deleted file mode 100644
index b503542..0000000
--- a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestProcessorMultiStartSelfTest.java
+++ /dev/null
@@ -1,55 +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.gridgain.grid.kernal.processors.rest;
-
-import org.apache.ignite.configuration.*;
-import org.gridgain.testframework.junits.common.*;
-
-/**
- * Rest processor test.
- */
-public class GridRestProcessorMultiStartSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final int GRID_CNT = 3;
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setRestEnabled(true);
-
-        return cfg;
-    }
-
-    /**
-     * Test that multiple nodes can start with JETTY enabled.
-     *
-     * @throws Exception If failed.
-     */
-    public void testMultiStart() throws Exception {
-        try {
-            for (int i = 0; i < GRID_CNT; i++)
-                startGrid(i);
-
-            stopGrid(0);
-        }
-        finally {
-            stopAllGrids();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1b0e45a2/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestProcessorStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestProcessorStartSelfTest.java b/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestProcessorStartSelfTest.java
deleted file mode 100644
index d399358..0000000
--- a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestProcessorStartSelfTest.java
+++ /dev/null
@@ -1,163 +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.gridgain.grid.kernal.processors.rest;
-
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.spi.*;
-import org.apache.ignite.client.*;
-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.gridgain.testframework.*;
-import org.gridgain.testframework.junits.common.*;
-import org.jetbrains.annotations.*;
-
-import java.util.*;
-import java.util.concurrent.*;
-
-/**
- *
- */
-public class GridRestProcessorStartSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** */
-    private static final String HOST = "127.0.0.1";
-
-    /** */
-    public static final int TCP_PORT = 11222;
-
-    /** */
-    private CountDownLatch gridReady;
-
-    /** */
-    private CountDownLatch proceed;
-
-    /** {@inheritDoc}*/
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setLocalHost(HOST);
-
-        assert cfg.getClientConnectionConfiguration() == null;
-
-        ClientConnectionConfiguration clientCfg = new ClientConnectionConfiguration();
-
-        clientCfg.setRestTcpPort(TCP_PORT);
-
-        cfg.setClientConnectionConfiguration(clientCfg);
-
-        TestDiscoverySpi disc = new TestDiscoverySpi();
-
-        disc.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(disc);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc}*/
-    @Override protected void beforeTest() throws Exception {
-        gridReady = new CountDownLatch(1);
-        proceed = new CountDownLatch(1);
-    }
-
-    /** {@inheritDoc}*/
-    @Override protected void afterTest() throws Exception {
-        stopAllGrids();
-    }
-
-    /**
-     *  @throws Exception If failed.
-     */
-    public void testTcpStart() throws Exception {
-        GridClientConfiguration clCfg = new GridClientConfiguration();
-
-        clCfg.setProtocol(GridClientProtocol.TCP);
-        clCfg.setServers(Collections.singleton(HOST + ":" + TCP_PORT));
-
-        doTest(clCfg);
-    }
-
-    /**
-     * @param cfg Client configuration.
-     * @throws Exception If failed.
-     */
-    private void doTest(final GridClientConfiguration cfg) throws Exception {
-        GridTestUtils.runAsync(new IgniteCallable<Object>() {
-            @Override public Object call() {
-                try {
-                    startGrid();
-                }
-                catch (Exception e) {
-                    log().error("Grid start failed", e);
-
-                    fail();
-                }
-
-                return null;
-            }
-        });
-
-        try {
-            gridReady.await();
-
-            IgniteFuture<GridClient> c = GridTestUtils.runAsync(new Callable<GridClient>() {
-                @Override public GridClient call() throws Exception {
-                    return GridClientFactory.start(cfg);
-                }
-            });
-
-            try {
-                proceed.countDown();
-
-                c.get().compute().refreshTopology(false, false);
-            }
-            finally {
-                GridClientFactory.stopAll();
-            }
-        }
-        catch (Throwable e) {
-            e.printStackTrace();
-        }
-        finally {
-            proceed.countDown();
-        }
-    }
-
-    /**
-     * Test SPI.
-     */
-    private class TestDiscoverySpi extends TcpDiscoverySpi {
-        /** {@inheritDoc} */
-        @Override public void spiStart(@Nullable String gridName) throws IgniteSpiException {
-            gridReady.countDown();
-
-            try {
-                proceed.await();
-            }
-            catch (InterruptedException e) {
-                throw new IgniteSpiException("Failed to await start signal.", e);
-            }
-
-            super.spiStart(gridName);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1b0e45a2/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestProcessorTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestProcessorTest.java b/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestProcessorTest.java
deleted file mode 100644
index 62c0221..0000000
--- a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridRestProcessorTest.java
+++ /dev/null
@@ -1,346 +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.gridgain.grid.kernal.processors.rest;
-
-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.spi.discovery.tcp.ipfinder.vm.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.gridgain.testframework.junits.common.*;
-
-import javax.swing.*;
-import java.io.*;
-import java.util.*;
-
-/**
- * Rest processor test.
- * <p>
- * URLs to test:
- * <ul>
- * <li>http://localhost:8080/gridgain?cmd=get&key=simpleBean</li>
- * <li>http://localhost:8080/gridgain?cmd=get&key=complexBean</li>
- * <li>http://localhost:8080/gridgain?cmd=get&key=list</li>
- * <li>http://localhost:8080/gridgain?cmd=get&key=map</li>
- * <li>http://localhost:8080/gridgain?cmd=get&key=int</li>
- * <li>http://localhost:8080/gridgain?cmd=get&key=string</li>
- * <li>http://localhost:8080/gridgain?cmd=get&key=date</li>
- * <li>http://localhost:8080/gridgain?cmd=top</li>
- * <li>http://localhost:8080/gridgain?cmd=exe&name=org.gridgain.grid.kernal.processors.rest.TestTask2</li>
- * <li>http://localhost:8080/gridgain?cmd=exe&name=org.gridgain.grid.kernal.processors.rest.TestTask2&async=true</li>
- * <li>http://localhost:8080/gridgain?cmd=res&id=XXXX</li>
- * </ul>
- */
-public class GridRestProcessorTest extends GridCommonAbstractTest {
-    /** Counter */
-    private static int cntr;
-
-    /** */
-    public GridRestProcessorTest() {
-        super(/*start grid*/false);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected long getTestTimeout() {
-        return Long.MAX_VALUE;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRest() throws Exception {
-        IgniteConfiguration cfg = getConfiguration((String)null);
-
-        cfg = cacheTestConfiguration(cfg);
-
-        G.start(cfg);
-
-        populateCache();
-
-        deployTasks();
-
-        // Wait until Ok is pressed.
-        JOptionPane.showMessageDialog(
-            null,
-            new JComponent[] {
-                new JLabel("GridGain started."),
-                new JLabel(
-                    "<html>" +
-                        "You can use JMX console at <u>http://localhost:1234</u>" +
-                        "</html>"),
-                new JLabel("Press OK to stop GridGain.")
-            },
-            "GridGain Startup JUnit",
-            JOptionPane.INFORMATION_MESSAGE
-        );
-
-        G.stop(true);
-    }
-
-    /**
-     * @param cfg Initial configuration.
-     * @return Final configuration.
-     */
-    @SuppressWarnings({"unchecked"})
-    private IgniteConfiguration cacheTestConfiguration(IgniteConfiguration cfg) {
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
-
-        ipFinder.setShared(true);
-
-        disco.setIpFinder(ipFinder);
-
-        cfg.setDiscoverySpi(disco);
-
-        assert cfg.getClientConnectionConfiguration() == null;
-
-        ClientConnectionConfiguration clientCfg = new ClientConnectionConfiguration();
-
-        // Ensure - no authentication.
-        clientCfg.setRestSecretKey(null);
-
-        cfg.setClientConnectionConfiguration(clientCfg);
-
-        cfg.setCacheConfiguration(defaultCacheConfiguration());
-
-        return cfg;
-    }
-
-    /**
-     * @return Integer.
-     */
-    private int intValue() {
-        return ++cntr;
-    }
-
-    /**
-     * @throws IgniteCheckedException If failed.
-     */
-    private void populateCache() throws IgniteCheckedException {
-        GridCache<String, Object> cache = G.ignite().cache(null);
-
-        cache.put("int", intValue());
-        cache.put("string", "cacheString");
-        cache.put("date", new Date());
-        cache.put("list", createCollection());
-        cache.put("map", createMap());
-        cache.put("simpleBean", new SimpleBean());
-
-        ComplexBean bean = new ComplexBean(new SimpleBean(intValue(), "complexSimpleString"));
-
-        bean.setComplexBean(new ComplexBean(new SimpleBean(intValue(), "complexComplexString")));
-
-        cache.put("complexBean", bean);
-    }
-
-    /**
-     * @throws IgniteCheckedException If failed.
-     */
-    private void deployTasks() throws IgniteCheckedException {
-        G.ignite().compute().localDeployTask(TestTask1.class, TestTask1.class.getClassLoader());
-        G.ignite().compute().localDeployTask(TestTask2.class, TestTask2.class.getClassLoader());
-    }
-
-    /**
-     * @return Map.
-     */
-    private Map<?, ?> createMap() {
-        Map<Object, Object> map = new HashMap<>();
-
-        map.put("intValue", intValue());
-        map.put("stringValue", "mapString");
-        map.put("simpleBean", new SimpleBean());
-        map.put("complexBean", new ComplexBean(new SimpleBean(intValue(), "mapSimpleComplexString")));
-
-        Map<Object, Object> nested = new HashMap<>();
-
-        nested.put("intValue", intValue());
-        nested.put("stringValue", "nestedMapString");
-        nested.put("simpleBean", new SimpleBean());
-        nested.put("complexBean", new ComplexBean(new SimpleBean(intValue(), "mapSimpleComplexNestedString")));
-
-        map.put("nestedMap", nested);
-
-        return map;
-    }
-
-    /**
-     * @return List.
-     */
-    private Collection<?> createCollection() {
-        Collection<Object> list = new ArrayList<>();
-
-        list.add(intValue());
-        list.add("listString");
-        list.add(new Date());
-
-        Collection<Object> nested = new ArrayList<>();
-
-        nested.add(intValue());
-        nested.add("nestedListString");
-        nested.add(new Date());
-
-        list.add(nested);
-
-        return list;
-    }
-
-    /**
-     * Simple bean.
-     */
-    @SuppressWarnings( {"ReturnOfDateField", "AssignmentToDateFieldFromParameter", "PublicInnerClass"})
-    public static class SimpleBean implements Serializable {
-        /** */
-        private int intField = 12345;
-
-        /** */
-        private String strField = "testString";
-
-        /** */
-        private Date date = new Date();
-
-        /**
-         * Empty constructor.
-         */
-        private SimpleBean() {
-            // No-op.
-        }
-
-        /**
-         * @param intField Int value.
-         * @param strField String value.
-         */
-        private SimpleBean(int intField, String strField) {
-            this.intField = intField;
-            this.strField = strField;
-        }
-
-        /**
-         * @param intField Int value.
-         * @param strField String value.
-         * @param date Date value.
-         */
-        private SimpleBean(int intField, String strField, Date date) {
-            this.intField = intField;
-            this.strField = strField;
-            this.date = date;
-        }
-
-        /**
-         * @return Int value.
-         */
-        public int getIntField() {
-            return intField;
-        }
-
-        /**
-         * @param intField Int value.
-         */
-        public void setIntField(int intField) {
-            this.intField = intField;
-        }
-
-        /**
-         * @return String value.
-         */
-        public String getStringField() {
-            return strField;
-        }
-
-        /**
-         * @param strField String value.
-         */
-        public void setStringField(String strField) {
-            this.strField = strField;
-        }
-
-        /**
-         * @return Date value.
-         */
-        public Date getDate() {
-            return date;
-        }
-
-        /**
-         * @param date Date value.
-         */
-        public void setDate(Date date) {
-            this.date = date;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(SimpleBean.class, this);
-        }
-    }
-
-    /**
-     * Simple bean.
-     */
-    @SuppressWarnings( {"ReturnOfDateField", "PublicInnerClass"})
-    public static class ComplexBean extends SimpleBean {
-        /** */
-        private SimpleBean simpleBean = new SimpleBean(67890, "nestedTestString", new Date());
-
-        /** */
-        private ComplexBean complexBean;
-
-        /**
-         * @param simpleBean Simple bean.
-         */
-        private ComplexBean(SimpleBean simpleBean) {
-            this.simpleBean = simpleBean;
-        }
-
-        /**
-         * @return Simple bean.
-         */
-        public SimpleBean getSimpleBean() {
-            return simpleBean;
-        }
-
-        /**
-         * @param simpleBean Simple bean.
-         */
-        public void setSimpleBean(SimpleBean simpleBean) {
-            this.simpleBean = simpleBean;
-        }
-
-        /**
-         * @return Complex bean.
-         */
-        public ComplexBean getComplexBean() {
-            return complexBean;
-        }
-
-        /**
-         * @param complexBean Complex bean.
-         */
-        public void setComplexBean(ComplexBean complexBean) {
-            this.complexBean = complexBean;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(ComplexBean.class, this);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1b0e45a2/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridTaskCommandHandlerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridTaskCommandHandlerSelfTest.java b/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridTaskCommandHandlerSelfTest.java
deleted file mode 100644
index a8920c8..0000000
--- a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridTaskCommandHandlerSelfTest.java
+++ /dev/null
@@ -1,211 +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.gridgain.grid.kernal.processors.rest;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.client.*;
-import org.apache.ignite.internal.*;
-import org.gridgain.grid.kernal.processors.rest.handlers.*;
-import org.gridgain.grid.kernal.processors.rest.handlers.task.*;
-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.gridgain.testframework.junits.common.*;
-import org.jdk8.backport.*;
-import org.jetbrains.annotations.*;
-
-import java.util.*;
-
-import static org.apache.ignite.client.GridClientProtocol.*;
-import static org.apache.ignite.cache.GridCacheMode.*;
-import static org.apache.ignite.cache.GridCacheWriteSynchronizationMode.*;
-
-/**
- * Test for {@code GridTaskCommandHandler}
- */
-public class GridTaskCommandHandlerSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
-    /** */
-    private static final String CACHE_NAME = "cache";
-
-    /** */
-    public static final String HOST = "127.0.0.1";
-
-    /** */
-    public static final int BINARY_PORT = 11212;
-
-    /** */
-    private static final int MAX_TASK_RESULTS = 10;
-
-    /** */
-    private GridClient client;
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        System.setProperty(IgniteSystemProperties.GG_REST_MAX_TASK_RESULTS, String.valueOf(MAX_TASK_RESULTS));
-
-        startGrid(0);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-
-        System.clearProperty(IgniteSystemProperties.GG_REST_MAX_TASK_RESULTS);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        client = GridClientFactory.start(clientConfiguration());
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        GridClientFactory.stop(client.id());
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setLocalHost(HOST);
-
-        assert cfg.getClientConnectionConfiguration() == null;
-
-        ClientConnectionConfiguration clientCfg = new ClientConnectionConfiguration();
-
-        clientCfg.setRestTcpPort(BINARY_PORT);
-
-        cfg.setClientConnectionConfiguration(clientCfg);
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(disco);
-
-        cfg.setCacheConfiguration(cacheConfiguration(null), cacheConfiguration("replicated"),
-            cacheConfiguration("partitioned"), cacheConfiguration(CACHE_NAME));
-
-        return cfg;
-    }
-
-    /**
-     * @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.setCacheMode(cacheName == null || CACHE_NAME.equals(cacheName) ? LOCAL : "replicated".equals(cacheName) ?
-            REPLICATED : PARTITIONED);
-        cfg.setName(cacheName);
-        cfg.setWriteSynchronizationMode(FULL_SYNC);
-
-        return cfg;
-    }
-
-    /**
-     * @return Client configuration.
-     */
-    private GridClientConfiguration clientConfiguration() {
-        GridClientConfiguration cfg = new GridClientConfiguration();
-
-        GridClientDataConfiguration nullCache = new GridClientDataConfiguration();
-
-        GridClientDataConfiguration cache = new GridClientDataConfiguration();
-
-        cache.setName(CACHE_NAME);
-
-        cfg.setDataConfigurations(Arrays.asList(nullCache, cache));
-
-        cfg.setProtocol(TCP);
-        cfg.setServers(Arrays.asList("localhost:" + BINARY_PORT));
-
-        return cfg;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testManyTasksRun() throws Exception {
-        GridClientCompute compute = client.compute();
-
-        for (int i = 0; i < 1000; i++)
-            assertEquals("executing".length(), compute.execute(TestTask.class.getName(), "executing"));
-
-        GridClientFactory.stop(client.id(), true);
-
-        GridKernal g = (GridKernal)grid(0);
-
-        Map<GridRestCommand, GridRestCommandHandler> handlers = U.field(g.context().rest(), "handlers");
-
-        GridTaskCommandHandler taskHnd = (GridTaskCommandHandler)F.find(handlers.values(), null,
-            new P1<GridRestCommandHandler>() {
-                @Override public boolean apply(GridRestCommandHandler e) {
-                    return e instanceof GridTaskCommandHandler;
-                }
-            });
-
-        assertNotNull("GridTaskCommandHandler was not found", taskHnd);
-
-        ConcurrentLinkedHashMap taskDesc = U.field(taskHnd, "taskDescs");
-
-        assertTrue("Task result map size exceeded max value [mapSize=" + taskDesc.sizex() + ", " +
-            "maxSize=" + MAX_TASK_RESULTS + ']', taskDesc.sizex() <= MAX_TASK_RESULTS);
-    }
-
-    /**
-     * Test task.
-     */
-    private static class TestTask extends ComputeTaskSplitAdapter<String, Integer> {
-        /** {@inheritDoc} */
-        @Override protected Collection<? extends ComputeJob> split(int gridSize, final String arg) throws IgniteCheckedException {
-            return Collections.singletonList(new ComputeJobAdapter() {
-                @Override public Object execute() {
-                    try {
-                        Thread.sleep(10);
-                    }
-                    catch (InterruptedException ignored) {
-                        Thread.currentThread().interrupt();
-                    }
-
-                    return arg.length();
-                }
-            });
-        }
-
-        /** {@inheritDoc} */
-        @Override public Integer reduce(List<ComputeJobResult> results) throws IgniteCheckedException {
-            int sum = 0;
-
-            for (ComputeJobResult res : results)
-                sum += res.<Integer>getData();
-
-            return sum;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1b0e45a2/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridTestBinaryClient.java
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridTestBinaryClient.java b/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridTestBinaryClient.java
deleted file mode 100644
index 5f3f55b..0000000
--- a/modules/clients/src/test/java/org/gridgain/grid/kernal/processors/rest/GridTestBinaryClient.java
+++ /dev/null
@@ -1,651 +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.gridgain.grid.kernal.processors.rest;
-
-import org.apache.ignite.*;
-import org.apache.ignite.internal.util.*;
-import org.apache.ignite.logger.java.*;
-import org.apache.ignite.client.marshaller.*;
-import org.apache.ignite.client.marshaller.optimized.*;
-import org.gridgain.grid.kernal.processors.rest.client.message.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.jetbrains.annotations.*;
-
-import java.io.*;
-import java.net.*;
-import java.nio.*;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-
-import static org.gridgain.grid.kernal.processors.rest.client.message.GridClientCacheRequest.GridCacheOperation.*;
-
-/**
- * Test client.
- */
-final class GridTestBinaryClient {
-    /** Logger. */
-    private final IgniteLogger log = new IgniteJavaLogger();
-
-    /** Marshaller. */
-    private final GridClientMarshaller marsh = new GridClientOptimizedMarshaller();
-
-    /** Socket. */
-    private final Socket sock;
-
-    /** Socket input stream. */
-    private final InputStream input;
-
-    /** Opaque counter. */
-    private final AtomicInteger idCntr = new AtomicInteger(0);
-
-    /** Response queue. */
-    private final BlockingQueue<Response> queue = new LinkedBlockingQueue<>();
-
-    /** Socket reader. */
-    private final Thread rdr;
-
-    /** Quit response. */
-    private static final Response QUIT_RESP = new Response(0, GridRestResponse.STATUS_FAILED, null, null);
-
-    /** Random client id. */
-    private UUID id = UUID.randomUUID();
-
-    /**
-     * Creates client.
-     *
-     * @param host Hostname.
-     * @param port Port number.
-     * @throws IgniteCheckedException In case of error.
-     */
-    GridTestBinaryClient(String host, int port) throws IgniteCheckedException {
-        assert host != null;
-        assert port > 0;
-
-        try {
-            sock = new Socket(host, port);
-
-            input = sock.getInputStream();
-
-            GridClientHandshakeRequest req = new GridClientHandshakeRequest();
-
-            req.marshallerId(GridClientOptimizedMarshaller.ID);
-
-            // Write handshake.
-            sock.getOutputStream().write(GridClientHandshakeRequestWrapper.HANDSHAKE_HEADER);
-            sock.getOutputStream().write(req.rawBytes());
-
-            byte[] buf = new byte[1];
-
-            // Wait for handshake response.
-            int read = input.read(buf);
-
-            assert read == 1 : read;
-
-            assert buf[0] == GridClientHandshakeResponse.OK.resultCode() :
-                "Client handshake failed [code=" + buf[0] + ']';
-        }
-        catch (IOException e) {
-            throw new IgniteCheckedException("Failed to establish connection.", e);
-        }
-
-        // Start socket reader thread.
-        rdr = new Thread(new Runnable() {
-            @SuppressWarnings("InfiniteLoopStatement")
-            @Override public void run() {
-                try {
-                    ByteArrayOutputStream buf = new ByteArrayOutputStream();
-
-                    int len = 0;
-
-                    boolean running = true;
-
-                    while (running) {
-                        // Header.
-                        int symbol = input.read();
-
-                        if (symbol == -1)
-                            break;
-
-                        if ((byte)symbol != (byte)0x90) {
-                            if (log.isDebugEnabled())
-                                log.debug("Failed to parse incoming packet (invalid packet start): " +
-                                    Integer.toHexString(symbol & 0xFF));
-
-                            break;
-                        }
-
-                        // Packet.
-                        while (true) {
-                            symbol = input.read();
-
-                            if (symbol == -1) {
-                                running = false;
-
-                                break;
-                            }
-
-                            byte b = (byte)symbol;
-
-                            buf.write(b);
-
-                            if (len == 0) {
-                                if (buf.size() == 4) {
-                                    len = U.bytesToInt(buf.toByteArray(), 0);
-
-                                    if (log.isInfoEnabled())
-                                        log.info("Read length: " + len);
-
-                                    buf.reset();
-                                }
-                            }
-                            else {
-                                if (buf.size() == len) {
-                                    byte[] bytes = buf.toByteArray();
-                                    byte[] hdrBytes = Arrays.copyOfRange(bytes, 0, 40);
-                                    byte[] msgBytes = Arrays.copyOfRange(bytes, 40, bytes.length);
-
-                                    GridClientResponse msg = marsh.unmarshal(msgBytes);
-
-                                    long reqId = GridClientByteUtils.bytesToLong(hdrBytes, 0);
-                                    UUID clientId = GridClientByteUtils.bytesToUuid(hdrBytes, 8);
-                                    UUID destId = GridClientByteUtils.bytesToUuid(hdrBytes, 24);
-
-                                    msg.requestId(reqId);
-                                    msg.clientId(clientId);
-                                    msg.destinationId(destId);
-
-                                    buf.reset();
-
-                                    len = 0;
-
-                                    queue.offer(new Response(msg.requestId(), msg.successStatus(), msg.result(),
-                                        msg.errorMessage()));
-
-                                    break;
-                                }
-                            }
-                        }
-                    }
-                }
-                catch (IOException e) {
-                    if (!Thread.currentThread().isInterrupted())
-                        U.error(log, e);
-                }
-                finally {
-                    U.closeQuiet(sock);
-
-                    queue.add(QUIT_RESP);
-                }
-            }
-        });
-
-        rdr.start();
-    }
-
-    /** {@inheritDoc} */
-    public void shutdown() throws IgniteCheckedException {
-        try {
-            if (rdr != null) {
-                rdr.interrupt();
-
-                U.closeQuiet(sock);
-
-                rdr.join();
-            }
-        }
-        catch (InterruptedException e) {
-            throw new IgniteCheckedException(e);
-        }
-    }
-
-    /**
-     * Makes request to server and waits for response.
-     *
-     * @param msg Message to request,
-     * @return Response object.
-     * @throws IgniteCheckedException If request failed.
-     */
-    private Response makeRequest(GridClientMessage msg) throws IgniteCheckedException {
-        assert msg != null;
-
-        // Send request
-        try {
-            sock.getOutputStream().write(createPacket(msg));
-        }
-        catch (IOException e) {
-            throw new IgniteCheckedException("Failed to send packet.", e);
-        }
-
-        // Wait for response.
-        while (true) {
-            try {
-                // Take response from queue.
-                Response res = queue.take();
-
-                if (res == QUIT_RESP)
-                    return res;
-
-                // Check opaque value.
-                if (res.opaque() == msg.requestId()) {
-                    if (!res.isSuccess() && res.error() != null)
-                        throw new IgniteCheckedException(res.error());
-                    else
-                        return res;
-                }
-                else
-                    // Return response to queue if opaque is incorrect.
-                    queue.add(res);
-            }
-            catch (InterruptedException e) {
-                throw new IgniteCheckedException("Interrupted while waiting for response.", e);
-            }
-        }
-
-    }
-
-    /**
-     * Creates hessian packet from client message.
-     *
-     * @param msg Message to be sent.
-     * @return Raw packet.
-     * @throws IOException If serialization failed.
-     */
-    private byte[] createPacket(GridClientMessage msg) throws IOException {
-        msg.clientId(id);
-
-        ByteBuffer res = marsh.marshal(msg, 45);
-
-        ByteBuffer slice = res.slice();
-
-        slice.put((byte)0x90);
-        slice.putInt(res.remaining() - 5);
-        slice.putLong(msg.requestId());
-        slice.put(U.uuidToBytes(msg.clientId()));
-        slice.put(U.uuidToBytes(msg.destinationId()));
-
-        byte[] arr = new byte[res.remaining()];
-
-        res.get(arr);
-
-        return arr;
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param key Key.
-     * @param val Value.
-     * @return If value was actually put.
-     * @throws IgniteCheckedException In case of error.
-     */
-    public <K, V> boolean cachePut(@Nullable String cacheName, K key, V val)
-        throws IgniteCheckedException {
-        return cachePutAll(cacheName, Collections.singletonMap(key, val));
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param entries Entries.
-     * @return {@code True} if map contained more then one entry or if put succeeded in case of one entry,
-     *      {@code false} otherwise
-     * @throws IgniteCheckedException In case of error.
-     */
-    public <K, V> boolean cachePutAll(@Nullable String cacheName, Map<K, V> entries)
-        throws IgniteCheckedException {
-        assert entries != null;
-
-        GridClientCacheRequest req = new GridClientCacheRequest(PUT_ALL);
-
-        req.requestId(idCntr.incrementAndGet());
-        req.cacheName(cacheName);
-        req.values((Map<Object, Object>)entries);
-
-        return makeRequest(req).<Boolean>getObject();
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param key Key.
-     * @return Value.
-     * @throws IgniteCheckedException In case of error.
-     */
-    public <K, V> V cacheGet(@Nullable String cacheName, K key)
-        throws IgniteCheckedException {
-        assert key != null;
-
-        GridClientCacheRequest req = new GridClientCacheRequest(GET);
-
-        req.requestId(idCntr.getAndIncrement());
-        req.cacheName(cacheName);
-        req.key(key);
-
-        return makeRequest(req).getObject();
-
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param keys Keys.
-     * @return Entries.
-     * @throws IgniteCheckedException In case of error.
-     */
-    public <K, V> Map<K, V> cacheGetAll(@Nullable String cacheName, K... keys)
-        throws IgniteCheckedException {
-        assert keys != null;
-
-        GridClientCacheRequest req = new GridClientCacheRequest(GET_ALL);
-
-        req.requestId(idCntr.getAndIncrement());
-        req.cacheName(cacheName);
-        req.keys((Iterable<Object>)Arrays.asList(keys));
-
-        return makeRequest(req).getObject();
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param key Key.
-     * @return Whether entry was actually removed.
-     * @throws IgniteCheckedException In case of error.
-     */
-    @SuppressWarnings("unchecked")
-    public <K> boolean cacheRemove(@Nullable String cacheName, K key) throws IgniteCheckedException {
-        assert key != null;
-
-        GridClientCacheRequest req = new GridClientCacheRequest(RMV);
-
-        req.requestId(idCntr.getAndIncrement());
-        req.cacheName(cacheName);
-        req.key(key);
-
-        return makeRequest(req).<Boolean>getObject();
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param keys Keys.
-     * @return Whether entries were actually removed
-     * @throws IgniteCheckedException In case of error.
-     */
-    public <K> boolean cacheRemoveAll(@Nullable String cacheName, K... keys)
-        throws IgniteCheckedException {
-        assert keys != null;
-
-        GridClientCacheRequest req = new GridClientCacheRequest(RMV_ALL);
-
-        req.requestId(idCntr.getAndIncrement());
-        req.cacheName(cacheName);
-        req.keys((Iterable<Object>)Arrays.asList(keys));
-
-        return makeRequest(req).isSuccess();
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param key Key.
-     * @param val Value.
-     * @return Whether value was actually replaced.
-     * @throws IgniteCheckedException In case of error.
-     */
-    public <K, V> boolean cacheReplace(@Nullable String cacheName, K key, V val)
-        throws IgniteCheckedException {
-        assert key != null;
-        assert val != null;
-
-        GridClientCacheRequest replace = new GridClientCacheRequest(REPLACE);
-
-        replace.requestId(idCntr.getAndIncrement());
-        replace.cacheName(cacheName);
-        replace.key(key);
-        replace.value(val);
-
-        return makeRequest(replace).<Boolean>getObject();
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param key Key.
-     * @param val1 Value 1.
-     * @param val2 Value 2.
-     * @return Whether new value was actually set.
-     * @throws IgniteCheckedException In case of error.
-     */
-    public <K, V> boolean cacheCompareAndSet(@Nullable String cacheName, K key, @Nullable V val1, @Nullable V val2)
-        throws IgniteCheckedException {
-        assert key != null;
-
-        GridClientCacheRequest msg = new GridClientCacheRequest(CAS);
-
-        msg.requestId(idCntr.getAndIncrement());
-        msg.cacheName(cacheName);
-        msg.key(key);
-        msg.value(val1);
-        msg.value2(val2);
-
-        return makeRequest(msg).<Boolean>getObject();
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @return Metrics.
-     * @throws IgniteCheckedException In case of error.
-     */
-    public <K> Map<String, Long> cacheMetrics(@Nullable String cacheName) throws IgniteCheckedException {
-        GridClientCacheRequest metrics = new GridClientCacheRequest(METRICS);
-
-        metrics.requestId(idCntr.getAndIncrement());
-        metrics.cacheName(cacheName);
-
-        return makeRequest(metrics).getObject();
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param key Key.
-     * @param val Value.
-     * @return Whether entry was appended.
-     * @throws IgniteCheckedException In case of error.
-     */
-    public <K, V> boolean cacheAppend(@Nullable String cacheName, K key, V val)
-        throws IgniteCheckedException {
-        assert key != null;
-        assert val != null;
-
-        GridClientCacheRequest add = new GridClientCacheRequest(APPEND);
-
-        add.requestId(idCntr.getAndIncrement());
-        add.cacheName(cacheName);
-        add.key(key);
-        add.value(val);
-
-        return makeRequest(add).<Boolean>getObject();
-    }
-
-    /**
-     * @param cacheName Cache name.
-     * @param key Key.
-     * @param val Value.
-     * @return Whether entry was prepended.
-     * @throws IgniteCheckedException In case of error.
-     */
-    public <K, V> boolean cachePrepend(@Nullable String cacheName, K key, V val)
-        throws IgniteCheckedException {
-        assert key != null;
-        assert val != null;
-
-        GridClientCacheRequest add = new GridClientCacheRequest(PREPEND);
-
-        add.requestId(idCntr.getAndIncrement());
-        add.cacheName(cacheName);
-        add.key(key);
-        add.value(val);
-
-        return makeRequest(add).<Boolean>getObject();
-    }
-
-    /**
-     * @param taskName Task name.
-     * @param arg Task arguments.
-     * @return Task execution result.
-     * @throws IgniteCheckedException In case of error.
-     */
-    public GridClientTaskResultBean execute(String taskName, @Nullable Object arg) throws IgniteCheckedException {
-        assert !F.isEmpty(taskName);
-
-        GridClientTaskRequest msg = new GridClientTaskRequest();
-
-        msg.taskName(taskName);
-        msg.argument(arg);
-
-        return makeRequest(msg).getObject();
-    }
-
-    /**
-     * @param id Node ID.
-     * @param includeAttrs Whether to include attributes.
-     * @param includeMetrics Whether to include metrics.
-     * @return Node.
-     * @throws IgniteCheckedException In case of error.
-     */
-    public GridClientNodeBean node(UUID id, boolean includeAttrs, boolean includeMetrics)
-        throws IgniteCheckedException {
-        assert id != null;
-
-        GridClientTopologyRequest msg = new GridClientTopologyRequest();
-
-        msg.nodeId(id);
-        msg.includeAttributes(includeAttrs);
-        msg.includeMetrics(includeMetrics);
-
-        return makeRequest(msg).getObject();
-    }
-
-    /**
-     * @param ipAddr IP address.
-     * @param includeAttrs Whether to include attributes.
-     * @param includeMetrics Whether to include metrics.
-     * @return Node.
-     * @throws IgniteCheckedException In case of error.
-     */
-    public GridClientNodeBean node(String ipAddr, boolean includeAttrs, boolean includeMetrics)
-        throws IgniteCheckedException {
-        assert !F.isEmpty(ipAddr);
-
-        GridClientTopologyRequest msg = new GridClientTopologyRequest();
-
-        msg.nodeIp(ipAddr);
-        msg.includeAttributes(includeAttrs);
-        msg.includeMetrics(includeMetrics);
-
-        return makeRequest(msg).getObject();
-    }
-
-    /**
-     * @param includeAttrs Whether to include attributes.
-     * @param includeMetrics Whether to include metrics.
-     * @return Nodes.
-     * @throws IgniteCheckedException In case of error.
-     */
-    public List<GridClientNodeBean> topology(boolean includeAttrs, boolean includeMetrics)
-        throws IgniteCheckedException {
-        GridClientTopologyRequest msg = new GridClientTopologyRequest();
-
-        msg.includeAttributes(includeAttrs);
-        msg.includeMetrics(includeMetrics);
-
-        return makeRequest(msg).getObject();
-    }
-
-    /**
-     * @param path Log file path.
-     * @return Log file contents.
-     * @throws IgniteCheckedException In case of error.
-     */
-    public List<String> log(@Nullable String path, int from, int to) throws IgniteCheckedException {
-        GridClientLogRequest msg = new GridClientLogRequest();
-
-        msg.requestId(idCntr.getAndIncrement());
-        msg.path(path);
-        msg.from(from);
-        msg.to(to);
-
-        return makeRequest(msg).getObject();
-    }
-
-    /**
-     * Response data.
-     */
-    private static class Response {
-        /** Opaque. */
-        private final long opaque;
-
-        /** Success flag. */
-        private final int success;
-
-        /** Response object. */
-        private final Object obj;
-
-        /** Error message, if any */
-        private final String error;
-
-        /**
-         * @param opaque Opaque.
-         * @param success Success flag.
-         * @param obj Response object.
-         * @param error Error message, if any.
-         */
-        Response(long opaque, int success, @Nullable Object obj, @Nullable String error) {
-            assert opaque >= 0;
-
-            this.opaque = opaque;
-            this.success = success;
-            this.obj = obj;
-            this.error = error;
-        }
-
-        /**
-         * @return Opaque.
-         */
-        long opaque() {
-            return opaque;
-        }
-
-        /**
-         * @return Success flag.
-         */
-        boolean isSuccess() {
-            return success == GridRestResponse.STATUS_SUCCESS;
-        }
-
-        /**
-         * @return Response object.
-         */
-        @SuppressWarnings("unchecked")
-        <T> T getObject() {
-            return (T)obj;
-        }
-
-        /**
-         * @return Error message in case if error occurred.
-         */
-        String error() {
-            return error;
-        }
-    }
-}


Mime
View raw message