http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
 
b/modules/core/src/test/java/org/gridgain/grid/kernal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
deleted file mode 100644
index 9613e92..0000000
--- 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridProjectionLocalJobMultipleArgumentsSelfTest.java
+++ /dev/null
@@ -1,156 +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;
-
-import org.apache.ignite.cache.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.util.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.marshaller.optimized.*;
-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 java.util.concurrent.atomic.*;
-
-import static org.apache.ignite.cache.GridCacheMode.*;
-
-/**
- * Tests for methods that run job locally with multiple arguments.
- */
-public class GridProjectionLocalJobMultipleArgumentsSelfTest extends 
GridCommonAbstractTest {
-    /** IP finder. */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new 
TcpDiscoveryVmIpFinder(true);
-
-    /** */
-    private static Collection<Integer> ids;
-
-    /** */
-    private static AtomicInteger res;
-
-    /**
-     * Starts grid.
-     */
-    public GridProjectionLocalJobMultipleArgumentsSelfTest() {
-        super(true);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setMarshaller(new IgniteOptimizedMarshaller(false));
-
-        CacheConfiguration cache = defaultCacheConfiguration();
-
-        cache.setCacheMode(PARTITIONED);
-        cache.setBackups(1);
-
-        cfg.setCacheConfiguration(cache);
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(disco);
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        ids = new GridConcurrentHashSet<>();
-        res = new AtomicInteger();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testAffinityCall() throws Exception {
-        Collection<Integer> res = new ArrayList<>();
-
-        for (int i : F.asList(1, 2, 3)) {
-            res.add(grid().compute().affinityCall(null, i, new 
IgniteCallable<Integer>() {
-                @Override public Integer call() {
-                    ids.add(System.identityHashCode(this));
-
-                    return 10;
-                }
-            }));
-        }
-
-        assertEquals(30, F.sumInt(res));
-        assertEquals(3, ids.size());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testAffinityRun() throws Exception {
-        for (int i : F.asList(1, 2, 3)) {
-            grid().compute().affinityRun(null, i, new IgniteRunnable() {
-                @Override public void run() {
-                    ids.add(System.identityHashCode(this));
-
-                    res.addAndGet(10);
-                }
-            });
-        }
-
-        assertEquals(30, res.get());
-        assertEquals(3, ids.size());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCall() throws Exception {
-        Collection<Integer> res = grid().compute().apply(new C1<Integer, 
Integer>() {
-            @Override public Integer apply(Integer arg) {
-
-                ids.add(System.identityHashCode(this));
-
-                return 10 + arg;
-            }
-        }, F.asList(1, 2, 3));
-
-        assertEquals(36, F.sumInt(res));
-        assertEquals(3, ids.size());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCallWithProducer() throws Exception {
-        Collection<Integer> args = Arrays.asList(1, 2, 3);
-
-        Collection<Integer> res = grid().compute().apply(new C1<Integer, 
Integer>() {
-            @Override public Integer apply(Integer arg) {
-                ids.add(System.identityHashCode(this));
-
-                return 10 + arg;
-            }
-        }, args);
-
-        assertEquals(36, F.sumInt(res));
-        assertEquals(3, ids.size());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/GridProjectionSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridProjectionSelfTest.java
 
b/modules/core/src/test/java/org/gridgain/grid/kernal/GridProjectionSelfTest.java
deleted file mode 100644
index 689c8d6..0000000
--- 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridProjectionSelfTest.java
+++ /dev/null
@@ -1,145 +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;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.util.*;
-
-/**
- * Test for {@link org.apache.ignite.cluster.ClusterGroup}.
- */
-@GridCommonTest(group = "Kernal Self")
-public class GridProjectionSelfTest extends GridProjectionAbstractTest {
-    /** Nodes count. */
-    private static final int NODES_CNT = 4;
-
-    /** Projection node IDs. */
-    private static Collection<UUID> ids;
-
-    /** */
-    private static Ignite ignite;
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"ConstantConditions"})
-    @Override protected void beforeTestsStarted() throws Exception {
-        assert NODES_CNT > 2;
-
-        ids = new LinkedList<>();
-
-        for (int i = 0; i < NODES_CNT; i++) {
-            Ignite g = startGrid(i);
-
-            ids.add(g.cluster().localNode().id());
-
-            if (i == 0)
-                ignite = g;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        for (int i = 0; i < NODES_CNT; i++)
-            stopGrid(i);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected ClusterGroup projection() {
-        return grid(0).forPredicate(F.<ClusterNode>nodeForNodeIds(ids));
-    }
-
-    /** {@inheritDoc} */
-    @Override protected UUID localNodeId() {
-        return grid(0).localNode().id();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRandom() throws Exception {
-        
assertTrue(ignite.cluster().nodes().contains(ignite.cluster().forRandom().node()));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testOldest() throws Exception {
-        ClusterGroup oldest = ignite.cluster().forOldest();
-
-        ClusterNode node = null;
-
-        long minOrder = Long.MAX_VALUE;
-
-        for (ClusterNode n : ignite.cluster().nodes()) {
-            if (n.order() < minOrder) {
-                node = n;
-
-                minOrder = n.order();
-            }
-        }
-
-        assertEquals(oldest.node(), ignite.cluster().forNode(node).node());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testYoungest() throws Exception {
-        ClusterGroup youngest = ignite.cluster().forYoungest();
-
-        ClusterNode node = null;
-
-        long maxOrder = Long.MIN_VALUE;
-
-        for (ClusterNode n : ignite.cluster().nodes()) {
-            if (n.order() > maxOrder) {
-                node = n;
-
-                maxOrder = n.order();
-            }
-        }
-
-        assertEquals(youngest.node(), ignite.cluster().forNode(node).node());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testNewNodes() throws Exception {
-        ClusterGroup youngest = ignite.cluster().forYoungest();
-        ClusterGroup oldest = ignite.cluster().forOldest();
-
-        ClusterNode old = oldest.node();
-        ClusterNode last = youngest.node();
-
-        assertNotNull(last);
-
-        try (Ignite g = startGrid(NODES_CNT)) {
-            ClusterNode n = g.cluster().localNode();
-
-            ClusterNode latest = youngest.node();
-
-            assertNotNull(latest);
-            assertEquals(latest.id(), n.id());
-            assertEquals(oldest.node(), old);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/GridReduceSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridReduceSelfTest.java 
b/modules/core/src/test/java/org/gridgain/grid/kernal/GridReduceSelfTest.java
deleted file mode 100644
index ed43d7f..0000000
--- 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridReduceSelfTest.java
+++ /dev/null
@@ -1,194 +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;
-
-import org.apache.ignite.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.util.*;
-
-/**
- * Test reduce with long operations.
- */
-public class GridReduceSelfTest extends GridCommonAbstractTest {
-    /** Number of nodes in the grid. */
-    private static final int GRID_CNT = 3;
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testReduce() throws Exception {
-        startGrids(GRID_CNT);
-
-        try {
-            Ignite ignite = grid(0);
-
-            assert ignite.cluster().nodes().size() == GRID_CNT;
-
-            List<ReducerTestClosure> closures = 
closures(ignite.cluster().nodes().size());
-
-            Long res = compute(ignite.cluster().forLocal()).call(closures, new 
R1<Long, Long>() {
-                private long sum;
-
-                @Override public boolean collect(Long e) {
-                    info("Got result from closure: " + e);
-
-                    sum += e;
-
-                    // Stop collecting on value 1.
-                    return e != 1;
-                }
-
-                @Override public Long reduce() {
-                    return sum;
-                }
-            });
-
-            assertEquals((Long)1L, res);
-
-            assertTrue(closures.get(0).isFinished);
-
-            for (int i = 1; i < closures.size(); i++)
-                assertFalse("Closure #" + i + " is not interrupted.", 
closures.get(i).isFinished);
-        }
-        finally {
-            stopAllGrids();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testReduceAsync() throws Exception {
-        startGrids(GRID_CNT);
-
-        try {
-            Ignite ignite = grid(0);
-
-            assert ignite.cluster().nodes().size() == GRID_CNT;
-
-            List<ReducerTestClosure> closures = 
closures(ignite.cluster().nodes().size());
-
-            IgniteCompute comp = 
compute(ignite.cluster().forLocal()).enableAsync();
-
-            comp.call(closures, new R1<Long, Long>() {
-                private long sum;
-
-                @Override
-                public boolean collect(Long e) {
-                    info("Got result from closure: " + e);
-
-                    sum += e;
-
-                    // Stop collecting on value 1.
-                    return e != 1;
-                }
-
-                @Override
-                public Long reduce() {
-                    return sum;
-                }
-            });
-
-            IgniteFuture<Long> fut = comp.future();
-
-            assertEquals((Long)1L, fut.get());
-
-            assertTrue(closures.get(0).isFinished);
-
-            for (int i = 1; i < closures.size(); i++)
-                assertFalse("Closure #" + i + " is not interrupted.", 
closures.get(i).isFinished);
-        }
-        finally {
-            stopAllGrids();
-        }
-    }
-
-    /**
-     * @param size Number of closures.
-     * @return Collection of closures.
-     */
-    private static List<ReducerTestClosure> closures(int size) {
-        assert size > 1;
-
-        List<ReducerTestClosure> cls = new ArrayList<>(size);
-
-        cls.add(new ReducerTestClosure(true)); // Fast closure.
-
-        for (int i = 1; i < size; i++)
-            cls.add(new ReducerTestClosure(false)); // Normal closures.
-
-        return cls;
-    }
-
-    /**
-     * Closure for testing reducer.
-     */
-    @SuppressWarnings("PackageVisibleField")
-    private static class ReducerTestClosure implements IgniteCallable<Long> {
-        /** Logger. */
-        @IgniteLoggerResource
-        private IgniteLogger log;
-
-        /** Test flag to check the thread was interrupted. */
-        volatile boolean isFinished;
-
-        /** Fast or normal closure. */
-        private boolean fast;
-
-        /**
-         * @param fast Fast or normal closure.
-         */
-        ReducerTestClosure(boolean fast) {
-            this.fast = fast;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Long call() {
-            try {
-                try {
-                    if (fast) {
-                        Thread.sleep(500);
-
-                        log.info("Returning 1 from fast closure.");
-
-                        return 1L;
-                    }
-                    else {
-                        Thread.sleep(5000);
-
-                        log.info("Returning 2 from normal closure.");
-
-                        return 2L;
-                    }
-                }
-                finally {
-                    isFinished = true;
-                }
-            }
-            catch (InterruptedException ignore) {
-                log.info("Returning 0 from interrupted closure.");
-
-                return 0L;
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/GridReleaseTypeSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridReleaseTypeSelfTest.java
 
b/modules/core/src/test/java/org/gridgain/grid/kernal/GridReleaseTypeSelfTest.java
deleted file mode 100644
index dd51f59..0000000
--- 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridReleaseTypeSelfTest.java
+++ /dev/null
@@ -1,135 +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;
-
-import org.apache.ignite.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.*;
-import org.apache.ignite.product.*;
-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.io.*;
-import java.util.*;
-import java.util.concurrent.atomic.*;
-
-/**
- * Test grids starting with non compatible release types.
- */
-public class GridReleaseTypeSelfTest extends GridCommonAbstractTest {
-    /** IP finder. */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new 
TcpDiscoveryVmIpFinder(true);
-
-    /** Counter. */
-    private static final AtomicInteger cnt = new AtomicInteger();
-
-    /** */
-    private String firstNodeVer;
-
-    /** */
-    private String secondNodeVer;
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        final int idx = cnt.getAndIncrement();
-
-        // Override node attributes in discovery spi.
-        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi() {
-            @Override public void setNodeAttributes(Map<String, Object> attrs, 
IgniteProductVersion ver) {
-                super.setNodeAttributes(attrs, ver);
-
-                if (idx % 2 == 0)
-                    attrs.put(GridNodeAttributes.ATTR_BUILD_VER, firstNodeVer);
-                else
-                    attrs.put(GridNodeAttributes.ATTR_BUILD_VER, 
secondNodeVer);
-            }
-        };
-
-        discoSpi.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(discoSpi);
-
-        return cfg;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testNodeJoinTopologyWithDifferentReleaseType() throws 
Exception {
-        firstNodeVer = "1.0.0-ent";
-        secondNodeVer = "1.0.0-os";
-
-        try {
-            startGrids(2);
-        }
-        catch (IgniteCheckedException e) {
-            StringWriter errors = new StringWriter();
-
-            e.printStackTrace(new PrintWriter(errors));
-
-            String stackTrace = errors.toString();
-
-            assertTrue(
-                "Caught exception does not contain specified string.",
-                stackTrace.contains("Topology cannot contain nodes of both 
enterprise and open source")
-            );
-
-            return;
-        }
-        finally {
-            stopAllGrids();
-        }
-
-        fail("Exception has not been thrown.");
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testOsEditionDoesNotSupportRollingUpdates() throws Exception {
-        firstNodeVer = "1.0.0-os";
-        secondNodeVer = "1.0.1-os";
-
-        try {
-            startGrids(2);
-        }
-        catch (IgniteCheckedException e) {
-            StringWriter errors = new StringWriter();
-
-            e.printStackTrace(new PrintWriter(errors));
-
-            String stackTrace = errors.toString();
-
-            assertTrue(
-                "Caught exception does not contain specified string.",
-                stackTrace.contains("Local node and remote node have different 
version numbers")
-            );
-
-            return;
-        }
-        finally {
-            stopAllGrids();
-        }
-
-        fail("Exception has not been thrown.");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/GridRuntimeExceptionSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridRuntimeExceptionSelfTest.java
 
b/modules/core/src/test/java/org/gridgain/grid/kernal/GridRuntimeExceptionSelfTest.java
deleted file mode 100644
index 8d33a41..0000000
--- 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridRuntimeExceptionSelfTest.java
+++ /dev/null
@@ -1,302 +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;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.events.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.io.*;
-import java.util.*;
-
-import static org.apache.ignite.events.IgniteEventType.*;
-
-/**
- * Tests runtime exception.
- */
-@SuppressWarnings({"ProhibitedExceptionDeclared"})
-@GridCommonTest(group = "Kernal Self")
-public class GridRuntimeExceptionSelfTest extends GridCommonAbstractTest {
-    /** */
-    private enum FailType {
-        /** */
-        MAP,
-
-        /** */
-        RESULT,
-
-        /** */
-        REDUCE,
-
-        /** */
-        EXECUTE
-    }
-
-    /** */
-    public GridRuntimeExceptionSelfTest() {
-        super(/*start grid*/false);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGrid();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopGrid();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testExecuteFailed() throws Exception {
-        Ignite ignite = G.ignite(getTestGridName());
-
-        ignite.compute().localDeployTask(GridTaskFailedTestTask.class, 
GridTaskFailedTestTask.class.getClassLoader());
-
-        ComputeTaskFuture<?> fut =
-            executeAsync(ignite.compute(), 
GridTaskFailedTestTask.class.getName(), FailType.EXECUTE);
-
-        try {
-            fut.get();
-
-            assert false;
-        }
-        catch (IgniteCheckedException e) {
-            info("Got expected grid exception: " + e);
-        }
-
-        IgniteUuid sesId = fut.getTaskSession().getId();
-
-        // Query for correct events.
-        List<IgniteEvent> evts = ignite.events().remoteQuery(new 
TaskFailedEventFilter(sesId), 0);
-
-        info("Job failed event: " + evts.get(0));
-
-        assert evts.size() == 1;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testMapFailed() throws Exception {
-        Ignite ignite = G.ignite(getTestGridName());
-
-        ignite.compute().localDeployTask(GridTaskFailedTestTask.class, 
GridTaskFailedTestTask.class.getClassLoader());
-
-        ComputeTaskFuture<?> fut =
-            executeAsync(ignite.compute(), 
GridTaskFailedTestTask.class.getName(), FailType.MAP);
-
-        try {
-            fut.get();
-
-            assert false;
-        }
-        catch (IgniteCheckedException e) {
-            info("Got expected grid exception: " + e);
-        }
-
-        IgniteUuid sesId = fut.getTaskSession().getId();
-
-        // Query for correct events.
-        List<IgniteEvent> evts = ignite.events().remoteQuery(new 
TaskFailedEventFilter(sesId), 0);
-
-        assert evts.size() == 1;
-
-        info("Task failed event: " + evts.get(0));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testResultFailed() throws Exception {
-        Ignite ignite = G.ignite(getTestGridName());
-
-        ignite.compute().localDeployTask(GridTaskFailedTestTask.class, 
GridTaskFailedTestTask.class.getClassLoader());
-
-        ComputeTaskFuture<?> fut =
-            executeAsync(ignite.compute(), 
GridTaskFailedTestTask.class.getName(), FailType.RESULT);
-
-        try {
-            fut.get();
-
-            assert false;
-        }
-        catch (IgniteCheckedException e) {
-            info("Got expected grid exception: " + e);
-        }
-
-        IgniteUuid sesId = fut.getTaskSession().getId();
-
-        // Query for correct events.
-        List<IgniteEvent> evts = ignite.events().remoteQuery(new 
TaskFailedEventFilter(sesId), 0);
-
-        assert evts.size() == 1;
-
-        info("Task failed event: " + evts.get(0));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testReduceFailed() throws Exception {
-        Ignite ignite = G.ignite(getTestGridName());
-
-        ignite.compute().localDeployTask(GridTaskFailedTestTask.class, 
GridTaskFailedTestTask.class.getClassLoader());
-
-        ComputeTaskFuture<?> fut =
-            executeAsync(ignite.compute(), 
GridTaskFailedTestTask.class.getName(), FailType.RESULT);
-
-        try {
-            fut.get();
-
-            assert false;
-        }
-        catch (IgniteCheckedException e) {
-            info("Got expected grid exception: " + e);
-        }
-
-        IgniteUuid sesId = fut.getTaskSession().getId();
-
-        // Query for correct events.
-        List<IgniteEvent> evts = ignite.events().remoteQuery(new 
TaskFailedEventFilter(sesId), 0);
-
-        assert evts.size() == 1;
-
-        info("Task failed event: " + evts.get(0));
-    }
-
-    /** */
-    private static class TaskFailedEventFilter implements 
IgnitePredicate<IgniteEvent> {
-        /** */
-        private IgniteUuid sesId;
-
-        /**
-         * @param sesId Session ID.
-         */
-        TaskFailedEventFilter(IgniteUuid sesId) {
-            this.sesId = sesId;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean apply(IgniteEvent evt) {
-            return evt instanceof IgniteTaskEvent &&
-                ((IgniteTaskEvent)evt).taskSessionId() != null &&
-                ((IgniteTaskEvent)evt).taskSessionId().equals(sesId) &&
-                evt.type() == EVT_TASK_FAILED;
-        }
-    }
-
-    /** */
-    private static class GridTaskFailedTestTask extends 
ComputeTaskAdapter<Serializable, Serializable> {
-        /** */
-        @IgniteLoggerResource
-        private IgniteLogger log;
-
-        /** Ignite instance. */
-        @IgniteInstanceResource
-        private Ignite ignite;
-
-        /** */
-        private FailType failType;
-
-        /** {@inheritDoc} */
-        @SuppressWarnings({"ProhibitedExceptionThrown"})
-        @Override public Map<? extends ComputeJob, ClusterNode> 
map(List<ClusterNode> subgrid, Serializable arg)
-            throws IgniteCheckedException {
-            if (log.isInfoEnabled())
-                log.info("Mapping job [job=" + this + ", grid=" + subgrid + ", 
arg=" + arg + ']');
-
-            failType = (FailType)arg;
-
-            if (failType == FailType.MAP)
-                throw new RuntimeException("Failed out of map method.");
-
-            Map<ComputeJob, ClusterNode> map = new HashMap<>(2);
-
-            assert subgrid.size() == 1;
-            assert 
subgrid.get(0).id().equals(ignite.configuration().getNodeId());
-
-            map.put(new GridTaskFailedTestJob(null), subgrid.get(0));
-            map.put(new GridTaskFailedTestJob(failType), subgrid.get(0));
-
-            return map;
-        }
-
-        /** {@inheritDoc} */
-        @SuppressWarnings({"ProhibitedExceptionThrown"})
-        @Override public ComputeJobResultPolicy result(ComputeJobResult res, 
List<ComputeJobResult> received) throws IgniteCheckedException {
-            if (failType == FailType.RESULT)
-                throw new RuntimeException("Failing out of result method.");
-
-            if (res.getException() != null)
-                throw res.getException();
-
-            return ComputeJobResultPolicy.WAIT;
-        }
-
-        /** {@inheritDoc} */
-        @SuppressWarnings({"ProhibitedExceptionThrown"})
-        @Override public Serializable reduce(List<ComputeJobResult> results) 
throws IgniteCheckedException {
-            assert results != null;
-
-            if (failType == FailType.REDUCE)
-                throw new RuntimeException("Failed out of reduce method.");
-
-            return (Serializable)results;
-        }
-    }
-
-    /** */
-    private static class GridTaskFailedTestJob extends ComputeJobAdapter {
-        /** */
-        @IgniteLoggerResource
-        private IgniteLogger log;
-
-        /** */
-        GridTaskFailedTestJob() {
-            // No-op.
-        }
-
-        /**
-         * @param arg Job argument.
-         */
-        GridTaskFailedTestJob(FailType arg) {
-            super(arg);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Serializable execute() {
-            if (log.isInfoEnabled())
-                log.info("Executing job [job=" + this + ", arg=" + argument(0) 
+ ']');
-
-            if (argument(0) != null && argument(0) == FailType.EXECUTE) {
-                // Throw exception.
-                throw new RuntimeException("GridTaskFailedTestJob expected 
exception.");
-            }
-
-            return true;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/GridSameVmStartupSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridSameVmStartupSelfTest.java
 
b/modules/core/src/test/java/org/gridgain/grid/kernal/GridSameVmStartupSelfTest.java
deleted file mode 100644
index e70f584..0000000
--- 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridSameVmStartupSelfTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.gridgain.grid.kernal;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.events.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.util.*;
-import java.util.concurrent.*;
-
-import static org.apache.ignite.events.IgniteEventType.*;
-
-/**
- * Starts two grids on the same vm, checks topologies of each grid and 
discovery
- * events while stopping one them.
- */
-@GridCommonTest(group = "Kernal Self")
-public class GridSameVmStartupSelfTest extends GridCommonAbstractTest {
-    /**
-     *
-     */
-    public GridSameVmStartupSelfTest() {
-        super(false);
-    }
-
-    /**
-     * JUnit.
-     *
-     * @throws Exception If failed.
-     */
-    public void testSameVmStartup() throws Exception {
-        Ignite ignite1 = startGrid(1);
-
-        Collection<ClusterNode> top1 = ignite1.cluster().forRemotes().nodes();
-
-        try {
-            assert top1.isEmpty() : "Grid1 topology is not empty: " + top1;
-
-            // Start another grid.
-            Ignite ignite2 = startGrid(2);
-
-            final CountDownLatch latch = new CountDownLatch(1);
-
-            int size1 = ignite1.cluster().forRemotes().nodes().size();
-            int size2 = ignite2.cluster().forRemotes().nodes().size();
-
-            assert size1 == 1 : "Invalid number of remote nodes discovered: " 
+ size1;
-            assert size2 == 1 : "Invalid number of remote nodes discovered: " 
+ size2;
-
-            final UUID grid1LocNodeId = ignite1.cluster().localNode().id();
-
-            ignite2.events().localListen(new IgnitePredicate<IgniteEvent>() {
-                @Override public boolean apply(IgniteEvent evt) {
-                    assert evt.type() != EVT_NODE_FAILED :
-                        "Node1 did not exit gracefully.";
-
-                    if (evt instanceof IgniteDiscoveryEvent) {
-                        // Local node can send METRICS_UPDATED event.
-                        assert ((IgniteDiscoveryEvent) 
evt).eventNode().id().equals(grid1LocNodeId) ||
-                            evt.type() == EVT_NODE_METRICS_UPDATED :
-                            "Received event about invalid node [received=" +
-                                ((IgniteDiscoveryEvent) evt).eventNode().id() 
+ ", expected=" + grid1LocNodeId +
-                                ", type=" + evt.type() + ']';
-
-                        if (evt.type() == EVT_NODE_LEFT)
-                            latch.countDown();
-                    }
-
-                    return true;
-                }
-            }, EVTS_DISCOVERY);
-
-            stopGrid(1);
-
-            latch.await();
-
-            Collection<ClusterNode> top2 = 
ignite2.cluster().forRemotes().nodes();
-
-            assert top2.isEmpty() : "Grid2 topology is not empty: " + top2;
-        }
-        finally {
-            stopGrid(1);
-            stopGrid(2);
-        }
-
-        assert G.allGrids().isEmpty();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/GridSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridSelfTest.java 
b/modules/core/src/test/java/org/gridgain/grid/kernal/GridSelfTest.java
deleted file mode 100644
index 63ce659..0000000
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/GridSelfTest.java
+++ /dev/null
@@ -1,166 +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;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.messaging.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.util.*;
-import java.util.concurrent.atomic.*;
-
-/**
- * Test for {@link org.apache.ignite.Ignite}.
- */
-@GridCommonTest(group = "Kernal Self")
-public class GridSelfTest extends GridProjectionAbstractTest {
-    /** Nodes count. */
-    private static final int NODES_CNT = 4;
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"ConstantConditions"})
-    @Override protected void beforeTestsStarted() throws Exception {
-        assert NODES_CNT > 2;
-
-        for (int i = 0; i < NODES_CNT; i++)
-            startGrid(i);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected ClusterGroup projection() {
-        return grid(0);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected UUID localNodeId() {
-        return grid(0).localNode().id();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected Collection<UUID> remoteNodeIds() {
-        return F.nodeIds(grid(0).forRemotes().nodes());
-    }
-
-    /** {@inheritDoc} */
-    @Override public void testRemoteNodes() throws Exception {
-        int size = remoteNodeIds().size();
-
-        String name = "oneMoreGrid";
-
-        try {
-            Ignite g = startGrid(name);
-
-            UUID joinedId = g.cluster().localNode().id();
-
-            assert projection().forRemotes().nodes().size() == size + 1;
-
-            assert 
F.nodeIds(projection().forRemotes().nodes()).contains(joinedId);
-        }
-        finally {
-            stopGrid(name);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void testRemoteProjection() throws Exception {
-        ClusterGroup remotePrj = projection().forRemotes();
-
-        int size = remotePrj.nodes().size();
-
-        String name = "oneMoreGrid";
-
-        try {
-            Ignite g = startGrid(name);
-
-            UUID joinedId = g.cluster().localNode().id();
-
-            assert remotePrj.nodes().size() == size + 1;
-
-            assert F.nodeIds(remotePrj.nodes()).contains(joinedId);
-        }
-        finally {
-            stopGrid(name);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    @SuppressWarnings({"TooBroadScope"})
-    public void testAsyncListen() throws Exception {
-        final String msg = "HELLO!";
-
-        Ignite g = (Ignite)projection();
-
-        final UUID locNodeId = g.cluster().localNode().id();
-
-        g.message().remoteListen(null, new MessagingListenActor<String>() {
-            @Override protected void receive(UUID nodeId, String rcvMsg) 
throws Throwable {
-                assert locNodeId.equals(nodeId);
-                assert msg.equals(rcvMsg);
-
-                stop(rcvMsg);
-            }
-        });
-
-        final AtomicInteger cnt = new AtomicInteger();
-
-        g.message().localListen(null, new P2<UUID, String>() {
-            @Override
-            public boolean apply(UUID nodeId, String msg) {
-                if (!locNodeId.equals(nodeId))
-                    cnt.incrementAndGet();
-
-                return true;
-            }
-        });
-
-        g.message().send(null, msg);
-
-        Thread.sleep(1000);
-
-        assert cnt.get() == g.cluster().forRemotes().nodes().size();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testForOthers() throws Exception {
-        ClusterNode node0 = grid(0).localNode();
-        ClusterNode node1 = grid(1).localNode();
-        ClusterNode node2 = grid(2).localNode();
-        ClusterNode node3 = grid(3).localNode();
-
-        ClusterGroup p1 = grid(0).forOthers(node0);
-
-        assertEquals(3, p1.nodes().size());
-
-        assertEquals(2, p1.forOthers(node1).nodes().size());
-
-        assertEquals(1, p1.forOthers(node1, node2).nodes().size());
-
-        assertEquals(1, grid(0).forOthers(node1, node2, node3).nodes().size());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/GridSpiExceptionSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridSpiExceptionSelfTest.java
 
b/modules/core/src/test/java/org/gridgain/grid/kernal/GridSpiExceptionSelfTest.java
deleted file mode 100644
index 1004b2b..0000000
--- 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridSpiExceptionSelfTest.java
+++ /dev/null
@@ -1,174 +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;
-
-import org.apache.ignite.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.events.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.spi.*;
-import org.apache.ignite.spi.deployment.*;
-import org.apache.ignite.spi.eventstorage.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.testframework.junits.common.*;
-import org.jetbrains.annotations.*;
-
-import java.util.*;
-
-/**
- * Tests exceptions that are thrown by event storage and deployment spi.
- */
-@GridCommonTest(group = "Kernal Self")
-public class GridSpiExceptionSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final String TEST_MSG = "Test exception message";
-
-    /** */
-    public GridSpiExceptionSelfTest() {
-        super(/*start Grid*/false);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setEventStorageSpi(new GridTestRuntimeExceptionSpi());
-        cfg.setDeploymentSpi(new GridTestCheckedExceptionSpi());
-
-        // Disable cache since it can deploy some classes during start process.
-        cfg.setCacheConfiguration();
-
-        return cfg;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testSpiFail() throws Exception {
-        Ignite ignite = startGrid();
-
-        try {
-            try {
-                ignite.events().localQuery(F.<IgniteEvent>alwaysTrue());
-
-                assert false : "Exception should be thrown";
-            }
-            catch (IgniteException e) {
-                assert e.getMessage().startsWith(TEST_MSG) : "Wrong exception 
message." + e.getMessage();
-            }
-
-            try {
-                ignite.compute().localDeployTask(GridTestTask.class, 
GridTestTask.class.getClassLoader());
-
-                assert false : "Exception should be thrown";
-            }
-            catch (IgniteCheckedException e) {
-                assert e.getCause() instanceof GridTestSpiException : "Wrong 
cause exception type. " + e;
-
-                assert e.getCause().getMessage().startsWith(TEST_MSG) : "Wrong 
exception message." + e.getMessage();
-            }
-        }
-        finally {
-            stopGrid();
-        }
-    }
-
-    /**
-     * Test event storage spi that throws an exception on try to query local 
events.
-     */
-    @IgniteSpiMultipleInstancesSupport(true)
-    private static class GridTestRuntimeExceptionSpi extends IgniteSpiAdapter 
implements EventStorageSpi {
-        /** {@inheritDoc} */
-        @Override public void spiStart(String gridName) throws 
IgniteSpiException {
-            startStopwatch();
-        }
-
-        /** {@inheritDoc} */
-        @Override public void spiStop() throws IgniteSpiException {
-            // No-op.
-        }
-
-        /** {@inheritDoc} */
-        @Override public <T extends IgniteEvent> Collection<T> 
localEvents(IgnitePredicate<T> p) {
-            throw new IgniteException(TEST_MSG);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void record(IgniteEvent evt) throws 
IgniteSpiException {
-            // No-op.
-        }
-    }
-
-    /**
-     * Test deployment spi that throws an exception on try to register any 
class.
-     */
-    @IgniteSpiMultipleInstancesSupport(true)
-    private static class GridTestCheckedExceptionSpi extends IgniteSpiAdapter 
implements DeploymentSpi {
-        /** {@inheritDoc} */
-        @Override public void spiStart(@Nullable String gridName) throws 
IgniteSpiException {
-            startStopwatch();
-        }
-
-        /** {@inheritDoc} */
-        @Override public void spiStop() throws IgniteSpiException {
-            // No-op.
-        }
-
-        /** {@inheritDoc} */
-        @Nullable @Override public DeploymentResource findResource(String 
rsrcName) {
-            // No-op.
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean register(ClassLoader ldr, Class<?> rsrc) 
throws IgniteSpiException {
-            throw new GridTestSpiException(TEST_MSG);
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean unregister(String rsrcName) {
-            // No-op.
-            return false;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void setListener(DeploymentListener lsnr) {
-            // No-op.
-        }
-    }
-
-    /**
-     * Test spi exception.
-     */
-    private static class GridTestSpiException extends IgniteSpiException {
-        /**
-         * @param msg Error message.
-         */
-        GridTestSpiException(String msg) {
-            super(msg);
-        }
-
-        /**
-         * @param msg Error message.
-         * @param cause Error cause.
-         */
-        GridTestSpiException(String msg, Throwable cause) {
-            super(msg, cause);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/GridStartStopSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridStartStopSelfTest.java
 
b/modules/core/src/test/java/org/gridgain/grid/kernal/GridStartStopSelfTest.java
deleted file mode 100644
index 78363a8..0000000
--- 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridStartStopSelfTest.java
+++ /dev/null
@@ -1,182 +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;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.transactions.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.testframework.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.util.concurrent.*;
-
-import static java.util.concurrent.TimeUnit.*;
-import static org.apache.ignite.IgniteSystemProperties.*;
-import static org.apache.ignite.cache.GridCacheAtomicityMode.*;
-import static org.apache.ignite.transactions.IgniteTxConcurrency.*;
-import static org.apache.ignite.transactions.IgniteTxIsolation.*;
-
-/**
- * Checks basic node start/stop operations.
- */
-@SuppressWarnings({"CatchGenericClass", "InstanceofCatchParameter"})
-@GridCommonTest(group = "Kernal Self")
-public class GridStartStopSelfTest extends GridCommonAbstractTest {
-    /** */
-    public static final int COUNT = 1;
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        System.setProperty(GG_OVERRIDE_MCAST_GRP, 
GridTestUtils.getNextMulticastGroup(GridStartStopSelfTest.class));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testStartStop() throws Exception {
-        IgniteConfiguration cfg = new IgniteConfiguration();
-
-        cfg.setRestEnabled(false);
-
-        info("Grid start-stop test count: " + COUNT);
-
-        for (int i = 0; i < COUNT; i++) {
-            info("Starting grid.");
-
-            try (Ignite g = G.start(cfg)) {
-                assert g != null;
-
-                info("Stopping grid " + g.cluster().localNode().id());
-            }
-        }
-    }
-
-    /**
-     * TODO: GG-7704
-     * @throws Exception If failed.
-     */
-    public void _testStopWhileInUse() throws Exception {
-        IgniteConfiguration cfg = new IgniteConfiguration();
-
-        cfg.setRestEnabled(false);
-
-        cfg.setGridName(getTestGridName(0));
-
-        CacheConfiguration cc = new CacheConfiguration();
-
-        cc.setAtomicityMode(TRANSACTIONAL);
-
-        cfg.setCacheConfiguration(cc);
-
-        final Ignite g0 = G.start(cfg);
-
-        cfg = new IgniteConfiguration();
-
-        cfg.setGridName(getTestGridName(1));
-
-        cc = new CacheConfiguration();
-
-        cc.setAtomicityMode(TRANSACTIONAL);
-
-        cfg.setCacheConfiguration(cc);
-
-        final CountDownLatch latch = new CountDownLatch(1);
-
-        Ignite g1 = G.start(cfg);
-
-        Thread stopper = new Thread(new Runnable() {
-            @Override public void run() {
-                try {
-                    try (IgniteTx ignored = 
g0.cache(null).txStart(PESSIMISTIC, REPEATABLE_READ)) {
-                        g0.cache(null).get(1);
-
-                        latch.countDown();
-
-                        Thread.sleep(500);
-
-                        info("Before stop.");
-
-                        G.stop(getTestGridName(1), true);
-                    }
-                }
-                catch (Exception e) {
-                    error("Error.", e);
-                }
-            }
-        });
-
-        stopper.start();
-
-        assert latch.await(1, SECONDS);
-
-        info("Before remove.");
-
-        g1.cache(null).remove(1);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testStoppedState() throws Exception {
-        IgniteConfiguration cfg = new IgniteConfiguration();
-
-        cfg.setRestEnabled(false);
-
-        Ignite ignite = G.start(cfg);
-
-        assert ignite != null;
-
-        G.stop(ignite.name(), true);
-
-        try {
-            ignite.cluster().localNode();
-        }
-        catch (Exception e) {
-            assert e instanceof IllegalStateException : "Wrong exception 
type.";
-        }
-
-        try {
-            ignite.cluster().nodes();
-
-            assert false;
-        }
-        catch (Exception e) {
-            assert e instanceof IllegalStateException : "Wrong exception 
type.";
-        }
-
-        try {
-            ignite.cluster().forRemotes();
-
-            assert false;
-        }
-        catch (Exception e) {
-            assert e instanceof IllegalStateException : "Wrong exception 
type.";
-        }
-
-        try {
-            ignite.compute().localTasks();
-
-            assert false;
-        }
-        catch (Exception e) {
-            assert e instanceof IllegalStateException : "Wrong exception 
type.";
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/GridStartupMain.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridStartupMain.java 
b/modules/core/src/test/java/org/gridgain/grid/kernal/GridStartupMain.java
deleted file mode 100644
index 89c76fe..0000000
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/GridStartupMain.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.gridgain.grid.kernal;
-
-import org.apache.ignite.internal.util.typedef.*;
-
-import javax.swing.*;
-
-/**
- * GridGain startup.
- */
-public class GridStartupMain {
-    /**
-     * @param args Arguments.
-     * @throws Exception If failed.
-     */
-    public static void main(String[] args) throws Exception {
-        
//resetLog4j("org.apache.ignite.internal.processors.cache.distributed.dht.preloader",
 Level.DEBUG, false, 0);
-
-        //G.start("modules/tests/config/spring-multicache.xml");
-        //G.start("examples/config/example-cache.xml");
-
-        G.start();
-
-        // 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);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/GridStartupTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridStartupTest.java 
b/modules/core/src/test/java/org/gridgain/grid/kernal/GridStartupTest.java
deleted file mode 100644
index a23caea..0000000
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/GridStartupTest.java
+++ /dev/null
@@ -1,69 +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;
-
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import javax.swing.*;
-
-/**
- * GridGain startup.
- */
-@SuppressWarnings({"ProhibitedExceptionDeclared"})
-@GridCommonTest(group = "Kernal")
-public class GridStartupTest extends GridCommonAbstractTest {
-    /** */
-    public GridStartupTest() {
-        super(false);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected long getTestTimeout() {
-        return Long.MAX_VALUE;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testStartup() throws Exception {
-        
//resetLog4j("org.apache.ignite.internal.processors.cache.distributed.dht.preloader",
 Level.DEBUG, false, 0);
-
-        //G.start("modules/tests/config/spring-multicache.xml");
-        //G.start("examples/config/example-cache.xml");
-
-        G.start();
-
-        // 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);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/GridStopWithCancelSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridStopWithCancelSelfTest.java
 
b/modules/core/src/test/java/org/gridgain/grid/kernal/GridStopWithCancelSelfTest.java
deleted file mode 100644
index 20f1332..0000000
--- 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridStopWithCancelSelfTest.java
+++ /dev/null
@@ -1,122 +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;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.testframework.junits.common.*;
-import org.jetbrains.annotations.*;
-
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.*;
-
-/**
- * Tests grid stop with jobs canceling.
- */
-@GridCommonTest(group = "Kernal Self")
-public class GridStopWithCancelSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static CountDownLatch cnt;
-
-    /** */
-    private static volatile boolean cancelCorrect;
-
-    /**
-     * Constructor.
-     */
-    public GridStopWithCancelSelfTest() {
-        super(false);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected long getTestTimeout() {
-        return 10000;
-    }
-
-    /**
-     * @throws Exception If an error occurs.
-     */
-    public void testStopGrid() throws Exception {
-        cancelCorrect = false;
-
-        cnt = new CountDownLatch(1);
-
-        try {
-            Ignite ignite = startGrid("testGrid");
-
-            executeAsync(ignite.compute(), CancelledTask.class, null);
-
-            cnt.await();
-        }
-        finally {
-            stopGrid("testGrid", true);
-        }
-
-        assert cancelCorrect;
-    }
-
-    /**
-     * Test task that will be canceled.
-     */
-    @SuppressWarnings({"PublicInnerClass"})
-    public static final class CancelledTask extends ComputeTaskAdapter<String, 
Object> {
-        /** Ignite instance. */
-        @IgniteInstanceResource
-        private Ignite ignite;
-
-        /** {@inheritDoc} */
-        @Override public Map<? extends ComputeJob, ClusterNode> 
map(List<ClusterNode> subgrid,
-            @Nullable String arg) throws IgniteCheckedException {
-            for (ClusterNode node : subgrid) {
-                if (node.id().equals(ignite.configuration().getNodeId())) {
-                    return Collections.singletonMap(new ComputeJobAdapter() {
-                        @IgniteInstanceResource
-                        private Ignite ignite;
-
-                        @Override public void cancel() {
-                            cancelCorrect = true;
-                        }
-
-                        @Override public Serializable execute() throws 
IgniteCheckedException {
-                            cnt.countDown();
-
-                            try {
-                                Thread.sleep(Long.MAX_VALUE);
-                            }
-                            catch (InterruptedException e) {
-                                throw new IgniteCheckedException(e);
-                            }
-
-                            return null;
-                        }
-                    }, node);
-                }
-            }
-
-            throw new IgniteCheckedException("Local node not found");
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object reduce(List<ComputeJobResult> results) {
-            return null;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/GridStopWithWaitSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridStopWithWaitSelfTest.java
 
b/modules/core/src/test/java/org/gridgain/grid/kernal/GridStopWithWaitSelfTest.java
deleted file mode 100644
index bf7576d..0000000
--- 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridStopWithWaitSelfTest.java
+++ /dev/null
@@ -1,263 +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;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.spi.failover.always.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-
-/**
- * Tests waiting for unfinished tasks while stopping the grid.
- */
-@GridCommonTest(group = "Kernal Self")
-public class GridStopWithWaitSelfTest extends GridCommonAbstractTest {
-    /** Initial node that job has been mapped to. */
-    private static final AtomicReference<ClusterNode> nodeRef = new 
AtomicReference<>(null);
-
-    /** */
-    private static CountDownLatch jobStarted;
-
-    /**
-     *
-     */
-    public GridStopWithWaitSelfTest() {
-        super(/*start Grid*/false);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setFailoverSpi(new AlwaysFailoverSpi());
-
-        return cfg;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testWait() throws Exception {
-        jobStarted = new CountDownLatch(1);
-
-        ComputeTaskFuture<Object> fut = null;
-
-        try {
-            Ignite ignite1 = startGrid(1);
-            Ignite ignite2 = startGrid(2);
-
-            assert ignite1 != null;
-            assert ignite2 != null;
-
-            fut = executeAsync(ignite1.compute().withTimeout(10000),
-                GridWaitTask.class.getName(),
-                ignite1.cluster().localNode().id());
-
-            jobStarted.await();
-        }
-        finally {
-            // Do not cancel but wait.
-            G.stop(getTestGridName(1), false);
-            G.stop(getTestGridName(2), false);
-        }
-
-        assert fut != null;
-
-        Integer res = (Integer)fut.get();
-
-        assert res == 1;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testWaitFailover() throws Exception {
-        jobStarted = new CountDownLatch(1);
-
-        ComputeTaskFuture<Object> fut = null;
-
-        Ignite ignite1 = startGrid(1);
-        Ignite ignite2 = startGrid(2);
-
-        try {
-            assert ignite1 != null;
-            assert ignite2 != null;
-
-            long timeout = 3000;
-
-            fut = executeAsync(ignite1.compute().withTimeout(timeout), 
JobFailTask.class.getName(), "1");
-
-            jobStarted.await(timeout, TimeUnit.MILLISECONDS);
-        }
-        finally {
-            // Do not cancel but wait.
-            G.stop(getTestGridName(1), false);
-            G.stop(getTestGridName(2), false);
-        }
-
-        assert fut != null;
-
-        Integer res = (Integer)fut.get();
-
-        assert res == 1;
-    }
-
-    /**
-     *
-     */
-    @ComputeTaskSessionFullSupport
-    private static class GridWaitTask extends ComputeTaskAdapter<UUID, 
Integer> {
-        /** {@inheritDoc} */
-        @Override public Map<? extends ComputeJob, ClusterNode> 
map(List<ClusterNode> subgrid, UUID arg) throws IgniteCheckedException {
-            ClusterNode mappedNode = null;
-
-            for (ClusterNode node : subgrid) {
-                if (node.id().equals(arg)) {
-                    mappedNode = node;
-
-                    break;
-                }
-            }
-
-            assert mappedNode != null;
-
-            return Collections.singletonMap(new ComputeJobAdapter(arg) {
-                @Override public Integer execute() {
-                    jobStarted.countDown();
-
-                    return 1;
-                }
-            }, mappedNode);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Integer reduce(List<ComputeJobResult> results) throws 
IgniteCheckedException {
-            return results.get(0).getData();
-        }
-    }
-
-    /**
-     *
-     */
-    @ComputeTaskSessionFullSupport
-    private static class JobFailTask implements ComputeTask<String, Object> {
-        /** */
-        @IgniteTaskSessionResource
-        private ComputeTaskSession ses;
-
-        /** Ignite instance. */
-        @IgniteInstanceResource
-        private Ignite ignite;
-
-        /** {@inheritDoc} */
-        @Override public Map<? extends ComputeJob, ClusterNode> 
map(List<ClusterNode> subgrid, String arg) throws IgniteCheckedException {
-            ses.setAttribute("fail", true);
-
-            ClusterNode node = F.view(subgrid, 
F.remoteNodes(ignite.configuration().getNodeId())).iterator().next();
-
-            nodeRef.set(node);
-
-            return Collections.singletonMap(new ComputeJobAdapter(arg) {
-                /** Ignite instance. */
-                @IgniteInstanceResource
-                private Ignite ignite;
-
-                /** Logger. */
-                @IgniteLoggerResource
-                private IgniteLogger log;
-
-                @Override public Serializable execute() throws 
IgniteCheckedException {
-                    jobStarted.countDown();
-
-                    log.info("Starting to execute job with fail attribute: " + 
ses.getAttribute("fail"));
-
-                    boolean fail;
-
-                    assert ignite != null;
-
-                    UUID locId = ignite.configuration().getNodeId();
-
-                    assert locId != null;
-
-                    try {
-                        fail = ses.waitForAttribute("fail", 0);
-                    }
-                    catch (InterruptedException e) {
-                        throw new IgniteCheckedException("Got interrupted 
while waiting for attribute to be set.", e);
-                    }
-
-                    log.info("Failed attribute: " + fail);
-
-                    // Should fail on local node and sent to remote one.
-                    if (fail) {
-                        ses.setAttribute("fail", false);
-
-                        assert nodeRef.get().id().equals(locId);
-
-                        log.info("Throwing grid exception from job.");
-
-                        throw new IgniteCheckedException("Job exception.");
-                    }
-
-                    assert !nodeRef.get().id().equals(locId);
-
-                    Integer res = Integer.parseInt(this.<String>argument(0));
-
-                    log.info("Returning job result: " + res);
-
-                    // This job does not return any result.
-                    return res;
-                }
-            }, node);
-        }
-
-        /** {@inheritDoc} */
-        @Override public ComputeJobResultPolicy result(ComputeJobResult res, 
List<ComputeJobResult> rcvd) throws IgniteCheckedException {
-            if (res.getException() != null && !(res.getException() instanceof 
ComputeUserUndeclaredException)) {
-                assert res.getNode().id().equals(nodeRef.get().id());
-
-                return ComputeJobResultPolicy.FAILOVER;
-            }
-
-            assert !res.getNode().id().equals(nodeRef.get().id());
-
-            return ComputeJobResultPolicy.REDUCE;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object reduce(List<ComputeJobResult> res) throws 
IgniteCheckedException {
-            assert res.size() == 1;
-
-            assert nodeRef.get() != null;
-
-            assert !res.get(0).getNode().id().equals(nodeRef.get().id()) :
-                "Initial node and result one are the same (should be 
different).";
-
-            return res.get(0).getData();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/GridTaskCancelSingleNodeSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridTaskCancelSingleNodeSelfTest.java
 
b/modules/core/src/test/java/org/gridgain/grid/kernal/GridTaskCancelSingleNodeSelfTest.java
deleted file mode 100644
index 0235f46..0000000
--- 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridTaskCancelSingleNodeSelfTest.java
+++ /dev/null
@@ -1,185 +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;
-
-import org.apache.ignite.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.events.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.resources.*;
-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 java.util.*;
-import java.util.concurrent.atomic.*;
-
-import static org.apache.ignite.events.IgniteEventType.*;
-
-/**
- * Test for task cancellation issue.
- * <p/>
- * http://www.gridgainsystems.com/jiveforums/thread.jspa?messageID=8034
- */
-public class GridTaskCancelSingleNodeSelfTest extends GridCommonAbstractTest {
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        startGrid();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        stopGrid();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testImmediateCancellation() throws Exception {
-        checkCancellation(0L);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCancellation() throws Exception {
-        checkCancellation(2000L);
-    }
-
-    /**
-     * @param timeoutBeforeCancel Timeout.
-     * @throws Exception If failed.
-     */
-    @SuppressWarnings("ErrorNotRethrown")
-    private void checkCancellation(long timeoutBeforeCancel) throws Exception {
-        final AtomicInteger finished = new AtomicInteger();
-        final AtomicInteger cancelled = new AtomicInteger();
-        final AtomicInteger rejected = new AtomicInteger();
-
-        grid().events().localListen(new IgnitePredicate<IgniteEvent>() {
-            @Override public boolean apply(IgniteEvent evt) {
-                info("Received event: " + evt);
-
-                switch (evt.type()) {
-                    case EVT_JOB_FINISHED:
-                        finished.incrementAndGet();
-
-                        break;
-
-                    case EVT_JOB_CANCELLED:
-                        cancelled.incrementAndGet();
-
-                        break;
-
-                    case EVT_JOB_REJECTED:
-                        rejected.incrementAndGet();
-
-                        break;
-
-                    default:
-                        assert false : "Unexpected event: " + evt;
-                }
-
-                return true;
-            }
-        }, EVT_JOB_FINISHED, EVT_JOB_CANCELLED, EVT_JOB_REJECTED);
-
-        IgniteCompute comp = grid().compute().enableAsync();
-
-        comp.execute(TestTask.class, null);
-
-        ComputeTaskFuture<?> fut = comp.future();
-
-        if (timeoutBeforeCancel > 0L)
-            Thread.sleep(timeoutBeforeCancel);
-
-        assert fut.cancel();
-
-        for (int i = 0; i < 3; i++) {
-            try {
-            if (timeoutBeforeCancel == 0L)
-                assert (finished.get() == 0 && cancelled.get() == 0 && 
rejected.get() == 0) :
-                    "Failed on iteration [i=" + i + ", finished=" + 
finished.get() +
-                    ", cancelled=" + cancelled.get() + ", rejected=" + 
rejected.get() + ']';
-            else
-                assert (finished.get() == 1 && cancelled.get() == 1 && 
rejected.get() == 0) :
-                    "Failed on iteration [i=" + i + ", finished=" + 
finished.get() +
-                        ", cancelled=" + cancelled.get() + ", rejected=" + 
rejected.get() + ']';
-            }
-            catch (AssertionError e) {
-                info("Check failed: " + e.getMessage());
-
-                if (timeoutBeforeCancel == 0L && i == 2)
-                    throw e;
-            }
-
-            if (i < 2)
-                U.sleep(500);
-        }
-
-        try {
-            fut.get();
-
-            assert false;
-        }
-        catch (IgniteFutureCancelledException e) {
-            info("Caught expected exception: " + e);
-        }
-    }
-
-    /**
-     *
-     */
-    @ComputeTaskMapAsync
-    private static class TestTask extends ComputeTaskSplitAdapter<Void, Void> {
-        /** {@inheritDoc} */
-        @Override protected Collection<? extends ComputeJob> split(int 
gridSize, Void arg) {
-            return F.asSet(new ComputeJobAdapter() {
-                /** */
-                @IgniteLoggerResource
-                private IgniteLogger log;
-
-                /** */
-                @IgniteInstanceResource
-                private Ignite g;
-
-                /** {@inheritDoc} */
-                @Override public Object execute() {
-                    log.info("Executing job on node: " + 
g.cluster().localNode().id());
-
-                    try {
-                        Thread.sleep(5000);
-                    }
-                    catch (InterruptedException ignored) {
-                        log.info("Job thread has been interrupted.");
-
-                        Thread.currentThread().interrupt();
-                    }
-
-                    return null;
-                }
-            });
-        }
-
-        /** {@inheritDoc} */
-        @Nullable @Override public Void reduce(List<ComputeJobResult> results) 
throws IgniteCheckedException {
-            return null;
-        }
-    }
-}

Reply via email to