ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [45/53] [abbrv] [partial] incubator-ignite git commit: # ignite-164 : GridAbstractTest -> IgniteAbstractTest - auto-renaming with all suggested options + rename all methods and fields inside AbstractTest
Date Wed, 04 Feb 2015 14:38:19 GMT
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/GridAlwaysFailoverSpiFailSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridAlwaysFailoverSpiFailSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridAlwaysFailoverSpiFailSelfTest.java
deleted file mode 100644
index 88c97a7..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridAlwaysFailoverSpiFailSelfTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.spi.failover.*;
-import org.apache.ignite.spi.failover.always.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Always failover SPI test.
- */
-@GridCommonTest(group = "Kernal Self")
-public class GridAlwaysFailoverSpiFailSelfTest extends GridCommonAbstractTest {
-    /** */
-    private boolean isFailoverCalled;
-
-    /** */
-    public GridAlwaysFailoverSpiFailSelfTest() {
-        super(true);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration() throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration();
-
-        cfg.setFailoverSpi(new GridTestFailoverSpi());
-
-        return cfg;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    @SuppressWarnings({"UnusedCatchParameter", "ThrowableInstanceNeverThrown"})
-    public void testFailoverTask() throws Exception {
-        isFailoverCalled = false;
-
-        Ignite ignite = G.ignite(getTestGridName());
-
-        ignite.compute().localDeployTask(GridTestFailoverTask.class, GridTestFailoverTask.class.getClassLoader());
-
-        try {
-            ignite.compute().execute(GridTestFailoverTask.class.getName(),
-                new ComputeExecutionRejectedException("Task should be failed over"));
-
-            assert false;
-        }
-        catch (IgniteException e) {
-            //No-op
-        }
-
-        assert isFailoverCalled;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    @SuppressWarnings({"UnusedCatchParameter", "ThrowableInstanceNeverThrown"})
-    public void testNoneFailoverTask() throws Exception {
-        isFailoverCalled = false;
-
-        Ignite ignite = G.ignite(getTestGridName());
-
-        ignite.compute().localDeployTask(GridTestFailoverTask.class, GridTestFailoverTask.class.getClassLoader());
-
-        try {
-            ignite.compute().execute(GridTestFailoverTask.class.getName(),
-                new IgniteException("Task should NOT be failed over"));
-
-            assert false;
-        }
-        catch (IgniteException e) {
-            //No-op
-        }
-
-        assert !isFailoverCalled;
-    }
-
-    /** */
-    private class GridTestFailoverSpi extends AlwaysFailoverSpi {
-        /** {@inheritDoc} */
-        @Override public ClusterNode failover(FailoverContext ctx, List<ClusterNode> grid) {
-            isFailoverCalled = true;
-
-            return super.failover(ctx, grid);
-        }
-    }
-
-    /**
-     * Task which splits to the jobs that always fail.
-     */
-    @SuppressWarnings({"PublicInnerClass"})
-    public static final class GridTestFailoverTask extends ComputeTaskSplitAdapter<Object, Object> {
-        /** {@inheritDoc} */
-        @Override public Collection<? extends ComputeJob> split(int gridSize, Object arg) {
-            assert gridSize == 1;
-            assert arg instanceof IgniteException;
-
-            Collection<ComputeJob> res = new ArrayList<>(gridSize);
-
-            for (int i = 0; i < gridSize; i++)
-                res.add(new GridTestFailoverJob((IgniteException)arg));
-
-            return res;
-        }
-
-        /** {@inheritDoc} */
-        @Override public ComputeJobResultPolicy result(ComputeJobResult res,
-            List<ComputeJobResult> received) {
-            if (res.getException() != null)
-                return ComputeJobResultPolicy.FAILOVER;
-
-            return super.result(res, received);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Serializable reduce(List<ComputeJobResult> results) {
-            return null;
-        }
-    }
-
-    /**
-     * Job that always throws exception.
-     */
-    private static class GridTestFailoverJob extends ComputeJobAdapter {
-        /**
-         * @param ex Exception to be thrown in {@link #execute}.
-         */
-        GridTestFailoverJob(IgniteException ex) { super(ex); }
-
-        /** {@inheritDoc} */
-        @Override public IgniteException execute() {
-            throw this.<IgniteException>argument(0);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/GridCacheProjectionRemoveTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridCacheProjectionRemoveTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridCacheProjectionRemoveTest.java
deleted file mode 100644
index 061313a..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridCacheProjectionRemoveTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal;
-
-import org.apache.ignite.*;
-import org.apache.ignite.internal.processors.cache.*;
-
-/**
- *
- */
-public class GridCacheProjectionRemoveTest extends GridCacheAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected int gridCount() {
-        return 1;
-    }
-
-    /**
-     * @throws IgniteCheckedException If failed.
-     */
-    public void testRemove() throws IgniteCheckedException {
-        cache().put("key", 1);
-
-        assert cache().remove("key", 1);
-        assert !cache().remove("key", 1);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/GridCancelOnGridStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridCancelOnGridStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridCancelOnGridStopSelfTest.java
deleted file mode 100644
index 1270080..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridCancelOnGridStopSelfTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal;
-
-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.*;
-
-/**
- * Test task cancellation on grid stop.
- */
-@SuppressWarnings({"ProhibitedExceptionDeclared"})
-@GridCommonTest(group = "Kernal Self")
-public class GridCancelOnGridStopSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static CountDownLatch cnt;
-
-    /** */
-    private static boolean cancelCall;
-
-    /** */
-    public GridCancelOnGridStopSelfTest() {
-        super(false);
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCancelingJob() throws Exception {
-        cancelCall = false;
-
-        try (Ignite g = startGrid(1)) {
-            cnt = new CountDownLatch(1);
-
-            g.compute().withAsync().execute(CancelledTask.class, null);
-
-            cnt.await();
-        }
-
-        assert cancelCall;
-    }
-
-    /**
-     * Cancelled task.
-     */
-    private static final class CancelledTask extends ComputeTaskAdapter<String, Void> {
-        /** */
-        @IgniteInstanceResource
-        private Ignite ignite;
-
-        /** {@inheritDoc} */
-        @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, @Nullable String arg) {
-            for (ClusterNode node : subgrid) {
-                if (node.id().equals(ignite.configuration().getNodeId())) {
-                    return Collections.singletonMap(new ComputeJob() {
-                        @Override public void cancel() {
-                            cancelCall = true;
-                        }
-
-                        @Override public Serializable execute() {
-                            cnt.countDown();
-
-                            try {
-                                Thread.sleep(Long.MAX_VALUE);
-                            }
-                            catch (InterruptedException e) {
-                                throw new IgniteException(e);
-                            }
-
-                            return null;
-                        }
-                    }, node);
-                }
-            }
-
-            throw new IgniteException("Local node not found");
-        }
-
-        /** {@inheritDoc} */
-        @Nullable @Override public Void reduce(List<ComputeJobResult> results) {
-            return null;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/GridCancelOnIgniteStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridCancelOnIgniteStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridCancelOnIgniteStopSelfTest.java
new file mode 100644
index 0000000..aef4b6a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridCancelOnIgniteStopSelfTest.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal;
+
+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.*;
+
+/**
+ * Test task cancellation on grid stop.
+ */
+@SuppressWarnings({"ProhibitedExceptionDeclared"})
+@GridCommonTest(group = "Kernal Self")
+public class GridCancelOnIgniteStopSelfTest extends IgniteCommonAbstractTest {
+    /** */
+    private static CountDownLatch cnt;
+
+    /** */
+    private static boolean cancelCall;
+
+    /** */
+    public GridCancelOnIgniteStopSelfTest() {
+        super(false);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCancelingJob() throws Exception {
+        cancelCall = false;
+
+        try (Ignite g = startIgnite(1)) {
+            cnt = new CountDownLatch(1);
+
+            g.compute().withAsync().execute(CancelledTask.class, null);
+
+            cnt.await();
+        }
+
+        assert cancelCall;
+    }
+
+    /**
+     * Cancelled task.
+     */
+    private static final class CancelledTask extends ComputeTaskAdapter<String, Void> {
+        /** */
+        @IgniteInstanceResource
+        private Ignite ignite;
+
+        /** {@inheritDoc} */
+        @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, @Nullable String arg) {
+            for (ClusterNode node : subgrid) {
+                if (node.id().equals(ignite.configuration().getNodeId())) {
+                    return Collections.singletonMap(new ComputeJob() {
+                        @Override public void cancel() {
+                            cancelCall = true;
+                        }
+
+                        @Override public Serializable execute() {
+                            cnt.countDown();
+
+                            try {
+                                Thread.sleep(Long.MAX_VALUE);
+                            }
+                            catch (InterruptedException e) {
+                                throw new IgniteException(e);
+                            }
+
+                            return null;
+                        }
+                    }, node);
+                }
+            }
+
+            throw new IgniteException("Local node not found");
+        }
+
+        /** {@inheritDoc} */
+        @Nullable @Override public Void reduce(List<ComputeJobResult> results) {
+            return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/GridCancelUnusedJobSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridCancelUnusedJobSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridCancelUnusedJobSelfTest.java
deleted file mode 100644
index e9a4e8c..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridCancelUnusedJobSelfTest.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal;
-
-import org.apache.ignite.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-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.*;
-
-/**
- * Cancel unused job test.
- */
-@GridCommonTest(group = "Kernal Self")
-public class GridCancelUnusedJobSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final int WAIT_TIME = 100000;
-
-    /** */
-    public static final int SPLIT_COUNT = 10;
-
-    /** */
-    private static volatile int cancelCnt;
-
-    /** */
-    private static volatile int processedCnt;
-
-    /** */
-    private static CountDownLatch startSignal = new CountDownLatch(SPLIT_COUNT);
-
-    /** */
-    private static CountDownLatch stopSignal = new CountDownLatch(SPLIT_COUNT);
-
-    /** */
-    public GridCancelUnusedJobSelfTest() {
-        super(true);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration c = super.getConfiguration(gridName);
-
-        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
-
-        discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
-
-        c.setDiscoverySpi(discoSpi);
-
-        c.setExecutorService(
-            new ThreadPoolExecutor(
-                SPLIT_COUNT,
-                SPLIT_COUNT,
-                0, TimeUnit.MILLISECONDS,
-                new LinkedBlockingQueue<Runnable>()));
-
-        c.setExecutorServiceShutdown(true);
-
-        return c;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    @SuppressWarnings("unchecked")
-    public void testCancel() throws Exception {
-        Ignite ignite = G.ignite(getTestGridName());
-
-        ignite.compute().localDeployTask(GridCancelTestTask.class, U.detectClassLoader(GridCancelTestTask.class));
-
-        ComputeTaskFuture<?> fut = executeAsync(ignite.compute(), GridCancelTestTask.class.getName(), null);
-
-        // Wait until jobs begin execution.
-        boolean await = startSignal.await(WAIT_TIME, TimeUnit.MILLISECONDS);
-
-        assert await : "Jobs did not start.";
-
-        info("Test task result: " + fut);
-
-        assert fut != null;
-
-        // Only first job should successfully complete.
-        Object res = fut.get();
-        assert (Integer)res == 1;
-
-        // Wait for all jobs to finish.
-        await = stopSignal.await(WAIT_TIME, TimeUnit.MILLISECONDS);
-        assert await : "Jobs did not stop.";
-
-        // One is definitely processed. But there might be some more processed or cancelled or processed and cancelled.
-        // Thus total number should be at least SPLIT_COUNT and at most (SPLIT_COUNT - 1) *2 +1
-        assert (cancelCnt + processedCnt) >= SPLIT_COUNT && (cancelCnt + processedCnt) <= (SPLIT_COUNT - 1) * 2 +1 :
-            "Invalid cancel count value: " + cancelCnt;
-    }
-
-    /**
-     *
-     */
-    private static class GridCancelTestTask extends ComputeTaskSplitAdapter<Object, Object> {
-        /** */
-        @IgniteLoggerResource
-        private IgniteLogger log;
-
-        /** {@inheritDoc} */
-        @Override protected Collection<? extends ComputeJob> split(int gridSize, Object arg) {
-            if (log.isInfoEnabled())
-                log.info("Splitting job [job=" + this + ", gridSize=" + gridSize + ", arg=" + arg + ']');
-
-            Collection<ComputeJob> jobs = new ArrayList<>(SPLIT_COUNT);
-
-            for (int i = 1; i <= SPLIT_COUNT; i++)
-                jobs.add(new GridCancelTestJob(i));
-
-            return jobs;
-        }
-
-        /** {@inheritDoc} */
-        @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> received) {
-            return ComputeJobResultPolicy.REDUCE;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Serializable reduce(List<ComputeJobResult> results) {
-            if (log.isInfoEnabled())
-                log.info("Reducing job [job=" + this + ", results=" + results + ']');
-
-            if (results.size() > 1)
-                fail();
-
-            return results.get(0).getData();
-        }
-    }
-
-    /**
-     * Cancel test job.
-     */
-    private static class GridCancelTestJob extends ComputeJobAdapter {
-        /** */
-        @IgniteLoggerResource
-        private IgniteLogger log;
-
-        /** */
-        @IgniteTaskSessionResource
-        private ComputeTaskSession ses;
-
-        /**
-         * @param arg Argument.
-         */
-        private GridCancelTestJob(Integer arg) {
-            super(arg);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Serializable execute() {
-            int arg = this.<Integer>argument(0);
-
-            try {
-                if (log.isInfoEnabled())
-                    log.info("Executing job [job=" + this + ", arg=" + arg + ']');
-
-                startSignal.countDown();
-
-                try {
-                    if (!startSignal.await(WAIT_TIME, TimeUnit.MILLISECONDS))
-                        fail();
-
-                    if (arg == 1) {
-                        if (log.isInfoEnabled())
-                            log.info("Job one is proceeding.");
-                    }
-                    else
-                        Thread.sleep(WAIT_TIME);
-                }
-                catch (InterruptedException e) {
-                    if (log.isInfoEnabled())
-                        log.info("Job got cancelled [arg=" + arg + ", ses=" + ses + ", e=" + e + ']');
-
-                    return 0;
-                }
-
-                if (log.isInfoEnabled())
-                    log.info("Completing job: " + ses);
-
-                return argument(0);
-            }
-            finally {
-                stopSignal.countDown();
-
-                processedCnt++;
-            }
-        }
-
-        /** {@inheritDoc} */
-        @Override public void cancel() {
-            cancelCnt++;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/GridCancelledJobsMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridCancelledJobsMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridCancelledJobsMetricsSelfTest.java
deleted file mode 100644
index 2b0e21f..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridCancelledJobsMetricsSelfTest.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal;
-
-import org.apache.ignite.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.util.lang.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.spi.*;
-import org.apache.ignite.spi.collision.*;
-import org.apache.ignite.spi.discovery.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.testframework.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.util.*;
-
-/**
- * Cancelled jobs metrics self test.
- */
-@GridCommonTest(group = "Kernal Self")
-public class GridCancelledJobsMetricsSelfTest extends GridCommonAbstractTest {
-
-    /** */
-    private static GridCancelCollisionSpi colSpi = new GridCancelCollisionSpi();
-
-    /** */
-    public GridCancelledJobsMetricsSelfTest() {
-        super(true);
-    }
-
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration() throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration();
-
-        cfg.setCollisionSpi(colSpi);
-
-        DiscoverySpi discoSpi = cfg.getDiscoverySpi();
-
-        assert discoSpi instanceof TcpDiscoverySpi;
-
-        ((TcpDiscoverySpi)discoSpi).setHeartbeatFrequency(500);
-
-        return cfg;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testCancelledJobs() throws Exception {
-        final Ignite ignite = G.ignite(getTestGridName());
-
-        Collection<ComputeTaskFuture<?>> futs = new ArrayList<>();
-
-        IgniteCompute comp = ignite.compute().withAsync();
-
-        for (int i = 1; i <= 10; i++) {
-            comp.execute(CancelledTask.class, null);
-
-            futs.add(comp.future());
-        }
-
-        // Wait to be sure that metrics were updated.
-        GridTestUtils.waitForCondition(new GridAbsPredicate() {
-            @Override public boolean apply() {
-                return ignite.cluster().localNode().metrics().getTotalCancelledJobs() > 0;
-            }
-        }, 5000);
-
-        colSpi.externalCollision();
-
-        for (ComputeTaskFuture<?> fut : futs) {
-            try {
-                fut.get();
-
-                assert false : "Job was not interrupted.";
-            }
-            catch (IgniteException e) {
-                if (e.hasCause(InterruptedException.class))
-                    throw new IgniteCheckedException("Test run has been interrupted.", e);
-
-                info("Caught expected exception: " + e.getMessage());
-            }
-        }
-
-        // Job was cancelled and now we need to calculate metrics.
-        int totalCancelledJobs = ignite.cluster().localNode().metrics().getTotalCancelledJobs();
-
-        assert totalCancelledJobs == 10 : "Metrics were not updated. Expected 10 got " + totalCancelledJobs;
-    }
-
-    /**
-     *
-     */
-    private static final class CancelledTask extends ComputeTaskSplitAdapter<String, Object> {
-        /** {@inheritDoc} */
-        @Override protected Collection<? extends ComputeJob> split(int gridSize, String arg) {
-            return Arrays.asList(new GridCancelledJob());
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object reduce(List<ComputeJobResult> results) {
-            assert results.get(0).isCancelled() : "Wrong job result status.";
-
-            return null;
-        }
-    }
-
-    /**
-     *
-     */
-    private static final class GridCancelledJob extends ComputeJobAdapter {
-        /** {@inheritDoc} */
-        @Override public String execute() {
-            X.println("Executing job.");
-
-            try {
-                Thread.sleep(Long.MAX_VALUE);
-            }
-            catch (InterruptedException ignored) {
-                try {
-                    Thread.sleep(1000);
-                }
-                catch (InterruptedException e1) {
-                    throw new IgniteException("Unexpected exception: ", e1);
-                }
-
-                throw new IgniteException("Job got interrupted while waiting for cancellation.");
-            }
-            finally {
-                X.println("Finished job.");
-            }
-
-            return null;
-        }
-    }
-
-    /**
-     *
-     */
-    @IgniteSpiMultipleInstancesSupport(true)
-    private static class GridCancelCollisionSpi extends IgniteSpiAdapter
-        implements CollisionSpi {
-        /** */
-        @IgniteLoggerResource
-        private IgniteLogger log;
-
-        /** */
-        private CollisionExternalListener lsnr;
-
-        /** {@inheritDoc} */
-        @Override public void onCollision(CollisionContext ctx) {
-            Collection<CollisionJobContext> activeJobs = ctx.activeJobs();
-            Collection<CollisionJobContext> waitJobs = ctx.waitingJobs();
-
-            for (CollisionJobContext job : waitJobs)
-                job.activate();
-
-            for (CollisionJobContext job : activeJobs) {
-                log.info("Cancelling job : " + job.getJob());
-
-                job.cancel();
-            }
-        }
-
-        /** {@inheritDoc} */
-        @Override public void spiStart(String gridName) throws IgniteSpiException {
-            // Start SPI start stopwatch.
-            startStopwatch();
-
-            // Ack start.
-            if (log.isInfoEnabled())
-                log.info(startInfo());
-        }
-
-        /** {@inheritDoc} */
-        @Override public void spiStop() throws IgniteSpiException {
-            // Ack stop.
-            if (log.isInfoEnabled())
-                log.info(stopInfo());
-        }
-
-        /** {@inheritDoc} */
-        @Override public void setExternalCollisionListener(CollisionExternalListener lsnr) {
-            this.lsnr = lsnr;
-        }
-
-        /** */
-        public void externalCollision() {
-            CollisionExternalListener tmp = lsnr;
-
-            if (tmp != null)
-                tmp.onExternalCollision();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/GridCollisionJobsContextSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridCollisionJobsContextSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridCollisionJobsContextSelfTest.java
deleted file mode 100644
index 48a5d88..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridCollisionJobsContextSelfTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal;
-
-import org.apache.ignite.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.spi.*;
-import org.apache.ignite.spi.collision.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.util.*;
-
-/**
- * Collision job context test.
- */
-@GridCommonTest(group = "Kernal Self")
-public class GridCollisionJobsContextSelfTest extends GridCommonAbstractTest {
-    /** */
-    public GridCollisionJobsContextSelfTest() {
-        super(/*start grid*/true);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        Ignite ignite = G.ignite(getTestGridName());
-
-        assert ignite != null;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setCollisionSpi(new TestCollisionSpi());
-
-        return cfg;
-    }
-
-    /**
-     * @throws Exception If test failed.
-     */
-    public void testCollisionJobContext() throws Exception {
-        G.ignite(getTestGridName()).compute().execute(new GridTestTask(), "some-arg");
-    }
-
-    /** */
-    @SuppressWarnings( {"PublicInnerClass"})
-    @IgniteSpiMultipleInstancesSupport(true)
-    public static class TestCollisionSpi extends IgniteSpiAdapter implements CollisionSpi {
-        /** Grid logger. */
-        @IgniteLoggerResource
-        private IgniteLogger log;
-
-        /** {@inheritDoc} */
-        @Override public void onCollision(CollisionContext ctx) {
-            Collection<CollisionJobContext> activeJobs = ctx.activeJobs();
-            Collection<CollisionJobContext> waitJobs = ctx.waitingJobs();
-
-            assert waitJobs != null;
-            assert activeJobs != null;
-
-
-            for (CollisionJobContext job : waitJobs) {
-                assert job.getJob() != null;
-                assert job.getJobContext() != null;
-                assert job.getTaskSession() != null;
-
-                assert job.getJob() instanceof GridTestJob : job.getJob();
-
-                job.activate();
-            }
-        }
-
-        /** {@inheritDoc} */
-        @Override public void spiStart(String gridName) throws IgniteSpiException {
-            // Start SPI start stopwatch.
-            startStopwatch();
-
-            // Ack start.
-            if (log.isInfoEnabled())
-                log.info(startInfo());
-        }
-
-        /** {@inheritDoc} */
-        @Override public void spiStop() throws IgniteSpiException {
-            // Ack stop.
-            if (log.isInfoEnabled())
-                log.info(stopInfo());
-        }
-
-        /** {@inheritDoc} */
-        @Override public void setExternalCollisionListener(CollisionExternalListener lsnr) {
-            // No-op.
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/GridCommunicationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridCommunicationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridCommunicationSelfTest.java
deleted file mode 100644
index fce597b..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridCommunicationSelfTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal;
-
-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.io.*;
-import java.util.*;
-
-/**
- * Grid basic communication test.
- */
-@GridCommonTest(group = "Kernal Self")
-public class GridCommunicationSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static Ignite ignite;
-
-    /** */
-    public GridCommunicationSelfTest() {
-        super(/*start grid*/true);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        ignite = G.ignite(getTestGridName());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testSendMessageToEmptyNodes() throws Exception {
-        Collection<ClusterNode> empty = Collections.emptyList();
-
-        try {
-            sendMessage(empty, 1);
-        }
-        catch (IllegalArgumentException ignored) {
-            // No-op.
-        }
-    }
-
-    /**
-     * @param nodes Nodes to send message to.
-     * @param cntr Counter.
-     */
-    private void sendMessage(Collection<ClusterNode> nodes, int cntr) {
-        try {
-            message(ignite.cluster().forNodes(nodes)).send(null,
-                new GridTestCommunicationMessage(cntr, ignite.cluster().localNode().id()));
-        }
-        catch (IgniteException e) {
-            error("Failed to send message.", e);
-        }
-    }
-
-    /**
-     * Test message.
-     */
-    @SuppressWarnings({"PublicInnerClass"})
-    public static class GridTestCommunicationMessage implements Serializable {
-        /** */
-        private final int msgId;
-
-        /** */
-        private final UUID sndId;
-
-        /**
-         * @param msgId Message id.
-         * @param sndId Sender id.
-         */
-        public GridTestCommunicationMessage(int msgId, UUID sndId) {
-            assert sndId != null;
-
-            this.msgId = msgId;
-            this.sndId = sndId;
-        }
-
-        /**
-         * @return Message id.
-         */
-        public int getMessageId() {
-            return msgId;
-        }
-
-        /**
-         * @return Sender id.
-         */
-        public UUID getSenderId() {
-            return sndId;
-        }
-
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            StringBuilder buf = new StringBuilder();
-
-            buf.append(getClass().getSimpleName());
-            buf.append(" [msgId=").append(msgId);
-            buf.append(']');
-
-            return buf.toString();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousJobAnnotationSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousJobAnnotationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousJobAnnotationSelfTest.java
deleted file mode 100644
index d11bced..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousJobAnnotationSelfTest.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.atomic.*;
-
-/**
- * Test for various job callback annotations.
- */
-@GridCommonTest(group = "Kernal Self")
-public class GridContinuousJobAnnotationSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final AtomicBoolean fail = new AtomicBoolean();
-
-    /** */
-    private static final AtomicInteger afterSendCnt = new AtomicInteger();
-
-    /** */
-    private static final AtomicInteger beforeFailoverCnt = new AtomicInteger();
-
-    /** */
-    private static final AtomicReference<Exception> err = new AtomicReference<>();
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration c = super.getConfiguration(gridName);
-
-        c.setMarshalLocalJobs(false);
-
-        return c;
-    }
-
-    /**
-     * @throws Exception If test failed.
-     */
-    public void testJobAnnotation() throws Exception {
-        testContinuousJobAnnotation(TestJob.class);
-    }
-
-    /**
-     * @throws Exception If test failed.
-     */
-    public void testJobChildAnnotation() throws Exception {
-        testContinuousJobAnnotation(TestJobChild.class);
-    }
-
-    /**
-     * @param jobCls Job class.
-     * @throws Exception If test failed.
-     */
-    public void testContinuousJobAnnotation(Class<?> jobCls) throws Exception {
-        try {
-            Ignite ignite = startGrid(0);
-            startGrid(1);
-
-            fail.set(true);
-
-            ignite.compute().execute(TestTask.class, jobCls);
-
-            Exception e = err.get();
-
-            if (e != null)
-                throw e;
-        }
-        finally {
-            stopGrid(0);
-            stopGrid(1);
-        }
-
-        assertEquals(2, afterSendCnt.getAndSet(0));
-        assertEquals(1, beforeFailoverCnt.getAndSet(0));
-    }
-
-    /** */
-    @SuppressWarnings({"PublicInnerClass", "unused"})
-    public static class TestTask implements ComputeTask<Object, Object> {
-        /** */
-        @IgniteTaskContinuousMapperResource
-        private ComputeTaskContinuousMapper mapper;
-
-        /** {@inheritDoc} */
-        @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, Object arg) {
-            try {
-                mapper.send(((Class<ComputeJob>)arg).newInstance());
-            }
-            catch (Exception e) {
-                throw new IgniteException("Job instantination failed.", e);
-            }
-
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> received)
-            throws IgniteException {
-            if (res.getException() != null) {
-                if (res.getException() instanceof ComputeUserUndeclaredException)
-                    throw new IgniteException("Job threw unexpected exception.", res.getException());
-
-                return ComputeJobResultPolicy.FAILOVER;
-            }
-
-            return ComputeJobResultPolicy.WAIT;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object reduce(List<ComputeJobResult> results) throws IgniteException {
-            assert results.size() == 1 : "Unexpected result count: " + results.size();
-
-            return null;
-        }
-    }
-
-    /**
-     *
-     */
-    private static class TestJob extends ComputeJobAdapter {
-        /** */
-        private boolean flag = true;
-
-        /** */
-        TestJob() {
-            X.println("Constructing TestJob [this=" + this + ", identity=" + System.identityHashCode(this) + "]");
-        }
-
-
-        /** */
-        @ComputeJobAfterSend
-        private void afterSend() {
-            X.println("AfterSend start TestJob [this=" + this + ", identity=" + System.identityHashCode(this) +
-                ", flag=" + flag + "]");
-
-            afterSendCnt.incrementAndGet();
-
-            flag = false;
-
-            X.println("AfterSend end TestJob [this=" + this + ", identity=" + System.identityHashCode(this) +
-                ", flag=" + flag + "]");
-        }
-
-        /** */
-        @ComputeJobBeforeFailover
-        private void beforeFailover() {
-            X.println("BeforeFailover start TestJob [this=" + this + ", identity=" + System.identityHashCode(this) +
-                ", flag=" + flag + "]");
-
-            beforeFailoverCnt.incrementAndGet();
-
-            flag = true;
-
-            X.println("BeforeFailover end TestJob [this=" + this + ", identity=" + System.identityHashCode(this) +
-                ", flag=" + flag + "]");
-        }
-
-        /** {@inheritDoc} */
-        @Override public Serializable execute() throws IgniteException {
-            X.println("Execute TestJob [this=" + this + ", identity=" + System.identityHashCode(this) +
-                ", flag=" + flag + "]");
-
-            if (!flag) {
-                String msg = "Flag is false on execute [this=" + this + ", identity=" + System.identityHashCode(this) +
-                    ", flag=" + flag + "]";
-
-                X.println(msg);
-
-                err.compareAndSet(null, new Exception(msg));
-            }
-
-            if (fail.get()) {
-                fail.set(false);
-
-                throw new IgniteException("Expected test exception.");
-            }
-
-            return null;
-        }
-    }
-
-    /**
-     *
-     */
-    private static class TestJobChild extends TestJob {
-        /**
-         * Required for reflectional creation.
-         */
-        TestJobChild() {
-            // No-op.
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousJobSiblingsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousJobSiblingsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousJobSiblingsSelfTest.java
deleted file mode 100644
index adbe08d..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousJobSiblingsSelfTest.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal;
-
-import org.apache.ignite.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Test continuous mapper with siblings.
- */
-@GridCommonTest(group = "Kernal Self")
-public class GridContinuousJobSiblingsSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final int JOB_COUNT = 10;
-
-    /**
-     * @throws Exception If test failed.
-     */
-    public void testContinuousJobSiblings() throws Exception {
-        try {
-            Ignite ignite = startGrid(0);
-            startGrid(1);
-
-            ignite.compute().execute(TestTask.class, null);
-        }
-        finally {
-            stopAllGrids();
-        }
-    }
-
-    /**
-     * @throws Exception If test failed.
-     */
-    public void testContinuousJobSiblingsLocalNode() throws Exception {
-        try {
-            Ignite ignite = startGrid(0);
-
-            compute(ignite.cluster().forLocal()).execute(TestTask.class, null);
-        }
-        finally {
-            stopAllGrids();
-        }
-    }
-
-    /** */
-    private static class TestTask extends ComputeTaskSplitAdapter<Object, Object> {
-        /** */
-        @IgniteTaskContinuousMapperResource
-        private ComputeTaskContinuousMapper mapper;
-
-        /** */
-        @IgniteTaskSessionResource
-        private ComputeTaskSession ses;
-
-        /** */
-        private volatile int jobCnt;
-
-        /** {@inheritDoc} */
-        @Override protected Collection<? extends ComputeJob> split(int gridSize, Object arg) {
-            return Collections.singleton(new TestJob(++jobCnt));
-        }
-
-        /** {@inheritDoc} */
-        @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> received) {
-            if (res.getException() != null)
-                throw new IgniteException("Job resulted in error: " + res, res.getException());
-
-            assert ses.getJobSiblings().size() == jobCnt;
-
-            if (jobCnt < JOB_COUNT) {
-                mapper.send(new TestJob(++jobCnt));
-
-                assert ses.getJobSiblings().size() == jobCnt;
-            }
-
-            return ComputeJobResultPolicy.WAIT;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object reduce(List<ComputeJobResult> results) {
-            assertEquals(JOB_COUNT, results.size());
-
-            return null;
-        }
-    }
-
-    /** */
-    private static class TestJob extends ComputeJobAdapter {
-        /** */
-        @IgniteTaskSessionResource
-        private ComputeTaskSession ses;
-
-        /** */
-        @IgniteLoggerResource
-        private IgniteLogger log;
-
-        /**
-         * @param sibCnt Siblings count to check.
-         */
-        TestJob(int sibCnt) {
-            super(sibCnt);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Serializable execute() {
-            assert ses != null;
-            assert argument(0) != null;
-
-            Integer sibCnt = argument(0);
-
-            log.info("Executing job.");
-
-            assert sibCnt != null;
-
-            Collection<ComputeJobSibling> sibs = ses.getJobSiblings();
-
-            assert sibs != null;
-            assert sibs.size() == sibCnt : "Unexpected siblings collection [expectedSize=" + sibCnt +
-                ", siblingsCnt=" + sibs.size() + ", siblings=" + sibs + ']';
-
-            return null;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousTaskSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousTaskSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousTaskSelfTest.java
deleted file mode 100644
index 5536a7a..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridContinuousTaskSelfTest.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.testframework.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Continuous task test.
- */
-@GridCommonTest(group = "Kernal Self")
-public class GridContinuousTaskSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final int JOB_COUNT = 10;
-
-    /** */
-    private static final int THREAD_COUNT = 10;
-
-    /**
-     * @throws Exception If test failed.
-     */
-    public void testContinuousJobsChain() throws Exception {
-        try {
-            Ignite ignite = startGrid(0);
-
-            IgniteCompute comp = ignite.compute().withAsync();
-
-            comp.execute(TestJobsChainTask.class, true);
-
-            ComputeTaskFuture<Integer> fut1 = comp.future();
-
-            comp.execute(TestJobsChainTask.class, false);
-
-            ComputeTaskFuture<Integer> fut2 = comp.future();
-
-            assert fut1.get() == 55;
-            assert fut2.get() == 55;
-        }
-        finally {
-            stopGrid(0);
-        }
-    }
-
-    /**
-     * @throws Exception If test failed.
-     */
-    public void testContinuousJobsChainMultiThreaded() throws Exception {
-        try {
-            final Ignite ignite = startGrid(0);
-            startGrid(1);
-
-            GridTestUtils.runMultiThreaded(new Runnable() {
-                /** {@inheritDoc} */
-                @Override public void run() {
-                    try {
-                        IgniteCompute comp = ignite.compute().withAsync();
-
-                        comp.execute(TestJobsChainTask.class, true);
-
-                        ComputeTaskFuture<Integer> fut1 = comp.future();
-
-                        comp.execute(TestJobsChainTask.class, false);
-
-                        ComputeTaskFuture<Integer> fut2 = comp.future();
-
-                        assert fut1.get() == 55;
-                        assert fut2.get() == 55;
-                    }
-                    catch (IgniteException e) {
-                        assert false : "Test task failed: " + e;
-                    }
-                }
-
-            }, THREAD_COUNT, "continuous-jobs-chain");
-        }
-        finally {
-            stopGrid(0);
-            stopGrid(1);
-        }
-    }
-
-    /**
-     * @throws Exception If test failed.
-     */
-    public void testContinuousJobsSessionChain() throws Exception {
-        try {
-            Ignite ignite = startGrid(0);
-            startGrid(1);
-
-            ignite.compute().execute(SessionChainTestTask.class, false);
-        }
-        finally {
-            stopGrid(0);
-            stopGrid(1);
-        }
-    }
-
-    /**
-     * @throws Exception If test failed.
-     */
-    public void testContinuousSlowMap() throws Exception {
-        try {
-            Ignite ignite = startGrid(0);
-
-            Integer cnt = ignite.compute().execute(SlowMapTestTask.class, null);
-
-            assert cnt != null;
-            assert cnt == 2 : "Unexpected result: " + cnt;
-        }
-        finally {
-            stopGrid(0);
-        }
-    }
-
-    /** */
-    @SuppressWarnings({"PublicInnerClass"})
-    public static class TestJobsChainTask implements ComputeTask<Boolean, Integer> {
-        /** */
-        @IgniteTaskContinuousMapperResource
-        private ComputeTaskContinuousMapper mapper;
-
-        /** */
-        @IgniteLoggerResource
-        private IgniteLogger log;
-
-        /** */
-        private int cnt;
-
-        /** {@inheritDoc} */
-        @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, Boolean arg) {
-            assert mapper != null;
-            assert arg != null;
-
-            ComputeJob job = new TestJob(++cnt);
-
-            if (arg) {
-                mapper.send(job, subgrid.get(0));
-
-                log.info("Sent test task by continuous mapper: " + job);
-            }
-            else {
-                log.info("Will return job as map() result: " + job);
-
-                return Collections.singletonMap(job, subgrid.get(0));
-            }
-
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> received) {
-            assert mapper != null;
-            assert res.getException() == null : "Unexpected exception: " + res.getException();
-
-            log.info("Received job result [result=" + res + ", count=" + cnt + ']');
-
-            int tmp = ++cnt;
-
-            if (tmp <= JOB_COUNT) {
-                mapper.send(new TestJob(tmp));
-
-                log.info("Sent test task by continuous mapper (from result() method).");
-            }
-
-            return ComputeJobResultPolicy.WAIT;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Integer reduce(List<ComputeJobResult> results) {
-            assert results.size() == 10 : "Unexpected result count: " + results.size();
-
-            log.info("Called reduce() method [results=" + results + ']');
-
-            int res = 0;
-
-            for (ComputeJobResult result : results) {
-                assert result.getData() != null : "Unexpected result data (null): " + result;
-
-                res += (Integer)result.getData();
-            }
-
-            return res;
-        }
-    }
-
-    /** */
-    @SuppressWarnings({"PublicInnerClass"})
-    public static class TestJob extends ComputeJobAdapter {
-        /** */
-        public TestJob() { /* No-op. */ }
-
-        /**
-         * @param arg Job argument.
-         */
-        public TestJob(Integer arg) {
-            super(arg);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Serializable execute() {
-            Integer i = argument(0);
-
-            return i != null ? i : 0;
-        }
-    }
-
-    /** */
-    @SuppressWarnings({"PublicInnerClass"})
-    @ComputeTaskSessionFullSupport
-    public static class SessionChainTestTask extends ComputeTaskSplitAdapter<Object, Object> {
-        /** */
-        @IgniteTaskSessionResource
-        private ComputeTaskSession ses;
-
-        /** */
-        @IgniteTaskContinuousMapperResource
-        private ComputeTaskContinuousMapper mapper;
-
-        /** */
-        @IgniteLoggerResource
-        private IgniteLogger log;
-
-        /** {@inheritDoc} */
-        @Override protected Collection<? extends ComputeJob> split(int gridSize, Object arg) {
-            ses.addAttributeListener(new ComputeTaskSessionAttributeListener() {
-                @Override public void onAttributeSet(Object key, Object val) {
-                    if (key instanceof String) {
-                        if (((String)key).startsWith("sendJob")) {
-                            assert val instanceof Integer;
-
-                            int cnt = (Integer)val;
-
-                            if (cnt < JOB_COUNT) {
-                                try {
-                                    mapper.send(new SessionChainTestJob(cnt));
-                                }
-                                catch (IgniteException e) {
-                                    log.error("Failed to send new job.", e);
-                                }
-                            }
-                        }
-                    }
-                }
-            }, true);
-
-            Collection<ComputeJob> jobs = new ArrayList<>();
-
-            for (int i = 0; i < JOB_COUNT; i++)
-                jobs.add(new SessionChainTestJob(0));
-
-            return jobs;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object reduce(List<ComputeJobResult> results) {
-            assertEquals(JOB_COUNT * JOB_COUNT, results.size());
-
-            return null;
-        }
-    }
-
-    /** */
-    @SuppressWarnings({"PublicInnerClass"})
-    public static class SessionChainTestJob extends ComputeJobAdapter {
-        /** */
-        @IgniteTaskSessionResource
-        private ComputeTaskSession ses;
-
-        /** */
-        @IgniteJobContextResource
-        private ComputeJobContext ctx;
-
-        /** */
-        public SessionChainTestJob() { /* No-op. */}
-
-        /**
-         * @param arg Job argument.
-         */
-        public SessionChainTestJob(Integer arg) {
-            super(arg);
-        }
-
-        /** {@inheritDoc} */
-        @Override public Serializable execute() {
-            Integer i = argument(0);
-
-            int arg = i != null ? i : 0;
-
-            ses.setAttribute("sendJob" + ctx.getJobId(), 1 + arg);
-
-            return arg;
-        }
-    }
-
-    /** */
-    @SuppressWarnings({"PublicInnerClass"})
-    public static class SlowMapTestTask extends ComputeTaskAdapter<Object, Integer> {
-        /** */
-        @IgniteTaskContinuousMapperResource
-        private ComputeTaskContinuousMapper mapper;
-
-        /** */
-        private int cnt;
-
-        /** {@inheritDoc} */
-        @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, Object arg) {
-            mapper.send(new TestJob(++cnt));
-
-            try {
-                Thread.sleep(10000);
-            }
-            catch (InterruptedException e) {
-                throw new IgniteException("Job has been interrupted.", e);
-            }
-
-            mapper.send(new TestJob(++cnt));
-
-            return null;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Integer reduce(List<ComputeJobResult> results) throws IgniteException {
-            return results == null ? 0 : results.size();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/GridDeploymentMultiThreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridDeploymentMultiThreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridDeploymentMultiThreadedSelfTest.java
deleted file mode 100644
index 33d99a4..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridDeploymentMultiThreadedSelfTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.testframework.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.util.*;
-import java.util.concurrent.*;
-
-import static java.util.concurrent.TimeUnit.*;
-
-/**
- * Task deployment tests.
- */
-public class GridDeploymentMultiThreadedSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final int THREAD_CNT = 20;
-
-    /** */
-    private static final int EXEC_CNT = 30000;
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDeploy() throws Exception {
-        try {
-            final Ignite ignite = startGrid(0);
-
-            ignite.compute().localDeployTask(GridDeploymentTestTask.class, GridDeploymentTestTask.class.getClassLoader());
-
-            assert ignite.compute().localTasks().get(GridDeploymentTestTask.class.getName()) != null;
-
-            ignite.compute().undeployTask(GridDeploymentTestTask.class.getName());
-
-            final CyclicBarrier barrier = new CyclicBarrier(THREAD_CNT, new Runnable() {
-                private int iterCnt;
-
-                @Override public void run() {
-                    try {
-                        ignite.compute().undeployTask(GridDeploymentTestTask.class.getName());
-
-                        assert ignite.compute().localTasks().get(GridDeploymentTestTask.class.getName()) == null;
-
-                        if (++iterCnt % 100 == 0)
-                            info("Iterations count: " + iterCnt);
-                    }
-                    catch (IgniteException e) {
-                        U.error(log, "Failed to undeploy task message.", e);
-
-                        fail("See logs for details.");
-                    }
-                }
-            });
-
-            GridTestUtils.runMultiThreaded(new Callable<Object>() {
-                @Override public Object call() throws Exception {
-                    try {
-                        for (int i = 0; i < EXEC_CNT; i++) {
-                            barrier.await(2000, MILLISECONDS);
-
-                            ignite.compute().localDeployTask(GridDeploymentTestTask.class,
-                                GridDeploymentTestTask.class.getClassLoader());
-
-                            assert ignite.compute().localTasks().get(GridDeploymentTestTask.class.getName()) != null;
-                        }
-                    }
-                    catch (Exception e) {
-                        U.error(log, "Test failed.", e);
-
-                        throw e;
-                    }
-                    finally {
-                        info("Thread finished.");
-                    }
-
-                    return null;
-                }
-            }, THREAD_CNT, "grid-load-test-thread");
-        }
-        finally {
-            stopAllGrids();
-        }
-    }
-
-    /**
-     * Test task.
-     */
-    private static class GridDeploymentTestTask extends ComputeTaskAdapter<Object, Object> {
-        /** {@inheritDoc} */
-        @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, Object arg) {
-            assert false;
-
-            return Collections.emptyMap();
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object reduce(List<ComputeJobResult> results) {
-            return null;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6563e8a9/modules/core/src/test/java/org/apache/ignite/internal/GridDeploymentSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridDeploymentSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridDeploymentSelfTest.java
deleted file mode 100644
index 102e9c2..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridDeploymentSelfTest.java
+++ /dev/null
@@ -1,534 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.compute.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.events.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.resources.*;
-import org.apache.ignite.spi.*;
-import org.apache.ignite.spi.deployment.local.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.io.*;
-import java.util.*;
-
-import static org.apache.ignite.events.IgniteEventType.*;
-
-/**
- * Task deployment tests.
- */
-@SuppressWarnings("unchecked")
-@GridCommonTest(group = "Kernal Self")
-public class GridDeploymentSelfTest extends GridCommonAbstractTest {
-    /** */
-    private TestDeploymentSpi depSpi;
-
-    /** */
-    private boolean p2pEnabled = true;
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        depSpi = new TestDeploymentSpi();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        depSpi = null;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setDeploymentSpi(depSpi = new TestDeploymentSpi());
-        cfg.setPeerClassLoadingEnabled(p2pEnabled);
-
-        // Disable cache since it can deploy some classes during start process.
-        cfg.setCacheConfiguration();
-
-        return cfg;
-    }
-
-    /** */
-    public GridDeploymentSelfTest() {
-        super(/*start grid*/false);
-    }
-
-    /**
-     * @param ignite Grid.
-     * @param taskName Task name.
-     * @return {@code True} if task is not deployed.
-     */
-    private boolean checkUndeployed(Ignite ignite, String taskName) {
-        return ignite.compute().localTasks().get(taskName) == null;
-    }
-
-    /**
-     * @param ignite Grid.
-     */
-    @SuppressWarnings({"CatchGenericClass"})
-    private void stopGrid(Ignite ignite) {
-        try {
-            if (ignite != null)
-                stopGrid(ignite.name());
-        }
-        catch (Throwable e) {
-            error("Got error when stopping grid.", e);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDeploy() throws Exception {
-        Ignite ignite = startGrid(getTestGridName());
-
-        try {
-            ignite.compute().localDeployTask(GridDeploymentTestTask.class, GridDeploymentTestTask.class.getClassLoader());
-
-            assert depSpi.getRegisterCount() == 1 : "Invalid deploy count: " + depSpi.getRegisterCount();
-            assert depSpi.getUnregisterCount() == 0 : "Invalid undeploy count: " + depSpi.getUnregisterCount();
-
-            assert ignite.compute().localTasks().get(GridDeploymentTestTask.class.getName()) != null;
-
-            ignite.compute().undeployTask(GridDeploymentTestTask.class.getName());
-
-            assert depSpi.getRegisterCount() == 1 : "Invalid deploy count: " + depSpi.getRegisterCount();
-            assert depSpi.getUnregisterCount() == 1 : "Invalid undeploy count: " + depSpi.getUnregisterCount();
-
-            assert checkUndeployed(ignite, GridDeploymentTestTask.class.getName());
-        }
-        finally {
-            stopGrid(ignite);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testIgnoreDeploymentSpi() throws Exception {
-        // If peer class loading is disabled and local deployment SPI
-        // is configured, SPI should be ignored.
-        p2pEnabled = false;
-
-        Ignite ignite = startGrid(getTestGridName());
-
-        try {
-            ignite.compute().localDeployTask(GridDeploymentTestTask.class, GridDeploymentTestTask.class.getClassLoader());
-
-            assert depSpi.getRegisterCount() == 0 : "Invalid deploy count: " + depSpi.getRegisterCount();
-            assert depSpi.getUnregisterCount() == 0 : "Invalid undeploy count: " + depSpi.getUnregisterCount();
-
-            ignite.compute().undeployTask(GridDeploymentTestTask.class.getName());
-
-            assert depSpi.getRegisterCount() == 0 : "Invalid deploy count: " + depSpi.getRegisterCount();
-            assert depSpi.getUnregisterCount() == 0 : "Invalid undeploy count: " + depSpi.getUnregisterCount();
-        }
-        finally {
-            stopGrid(ignite);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testRedeploy() throws Exception {
-        Ignite ignite = startGrid(getTestGridName());
-
-        try {
-            // Added to work with P2P.
-            ignite.compute().localDeployTask(GridDeploymentTestTask.class, GridDeploymentTestTask.class.getClassLoader());
-
-            // Check auto-deploy.
-            ComputeTaskFuture<?> fut = executeAsync(ignite.compute(), GridDeploymentTestTask.class.getName(), null);
-
-            fut.get();
-
-            assert depSpi.getRegisterCount() == 1 : "Invalid deploy count: " + depSpi.getRegisterCount();
-            assert depSpi.getUnregisterCount() == 0 : "Invalid undeploy count: " + depSpi.getUnregisterCount();
-
-            assert ignite.compute().localTasks().get(GridDeploymentTestTask.class.getName()) != null;
-
-            // Check 2nd execute.
-            fut = executeAsync(ignite.compute(), GridDeploymentTestTask.class.getName(), null);
-
-            fut.get();
-
-            assert depSpi.getRegisterCount() == 1 : "Invalid deploy count: " + depSpi.getRegisterCount();
-            assert depSpi.getUnregisterCount() == 0 : "Invalid undeploy count: " + depSpi.getUnregisterCount();
-
-            assert ignite.compute().localTasks().get(GridDeploymentTestTask.class.getName()) != null;
-
-            // Redeploy, should be NO-OP for the same task.
-            ignite.compute().localDeployTask(GridDeploymentTestTask.class, GridDeploymentTestTask.class.getClassLoader());
-
-            assert ignite.compute().localTasks().get(GridDeploymentTestTask.class.getName()) != null;
-
-            assert depSpi.getRegisterCount() == 1 : "Invalid deploy count: " + depSpi.getRegisterCount();
-            assert depSpi.getUnregisterCount() == 0 : "Invalid undeploy count: " + depSpi.getUnregisterCount();
-
-            // Check 2nd execute.
-            fut = executeAsync(ignite.compute(), GridDeploymentTestTask.class.getName(), null);
-
-            fut.get();
-
-            assert ignite.compute().localTasks().get(GridDeploymentTestTask.class.getName()) != null;
-
-            assert depSpi.getRegisterCount() == 1 : "Invalid deploy count: " + depSpi.getRegisterCount();
-            assert depSpi.getUnregisterCount() == 0 : "Invalid undeploy count: " + depSpi.getUnregisterCount();
-
-            // Check undeploy.
-            ignite.compute().undeployTask(GridDeploymentTestTask.class.getName());
-
-            assert ignite.compute().localTasks().get(GridDeploymentTestTask.class.getName()) == null;
-
-            assert depSpi.getRegisterCount() == 1 : "Invalid deploy count: " + depSpi.getRegisterCount();
-            assert depSpi.getUnregisterCount() == 1 : "Invalid undeploy count: " + depSpi.getUnregisterCount();
-
-            // Added to work with P2P
-            ignite.compute().localDeployTask(GridDeploymentTestTask.class, GridDeploymentTestTask.class.getClassLoader());
-
-            // Check auto-deploy.
-            executeAsync(ignite.compute(), GridDeploymentTestTask.class.getName(), null);
-
-            assert depSpi.getRegisterCount() == 2;
-            assert depSpi.getUnregisterCount() == 1;
-
-            assert ignite.compute().localTasks().get(GridDeploymentTestTask.class.getName()) != null;
-
-            ignite.compute().localDeployTask(GridDeploymentTestTask1.class,
-                GridDeploymentTestTask1.class.getClassLoader());
-
-            try {
-                ignite.compute().localDeployTask(GridDeploymentTestTask2.class,
-                    GridDeploymentTestTask2.class.getClassLoader());
-
-                assert false : "Should not be able to deploy 2 task with same task name";
-            }
-            catch (IgniteException e) {
-                info("Received expected grid exception: " + e);
-            }
-
-            assert depSpi.getRegisterCount() == 3 : "Invalid register count: " + depSpi.getRegisterCount();
-            assert depSpi.getUnregisterCount() == 1 : "Invalid unregister count: " + depSpi.getUnregisterCount();
-
-            assert ignite.compute().localTasks().get("GridDeploymentTestTask") != null;
-
-            Class<? extends ComputeTask<?, ?>> cls = ignite.compute().localTasks().get("GridDeploymentTestTask");
-
-            assert cls.getName().equals(GridDeploymentTestTask1.class.getName());
-        }
-        finally {
-            stopGrid(ignite);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    @SuppressWarnings({"BusyWait"})
-    public void testDeployOnTwoNodes() throws Exception {
-        Ignite ignite1 = startGrid(getTestGridName() + '1');
-        Ignite ignite2 = startGrid(getTestGridName() + '2');
-
-        try {
-            assert !ignite1.cluster().forRemotes().nodes().isEmpty() : ignite1.cluster().forRemotes();
-            assert !ignite2.cluster().forRemotes().nodes().isEmpty() : ignite2.cluster().forRemotes();
-
-            ignite1.compute().localDeployTask(GridDeploymentTestTask.class, GridDeploymentTestTask.class.getClassLoader());
-            ignite2.compute().localDeployTask(GridDeploymentTestTask.class, GridDeploymentTestTask.class.getClassLoader());
-
-            assert ignite1.compute().localTasks().get(GridDeploymentTestTask.class.getName()) != null;
-            assert ignite2.compute().localTasks().get(GridDeploymentTestTask.class.getName()) != null;
-
-            ignite1.compute().undeployTask(GridDeploymentTestTask.class.getName());
-
-            assert checkUndeployed(ignite1, GridDeploymentTestTask.class.getName());
-
-            int cnt = 0;
-
-            boolean taskUndeployed = false;
-
-            while (cnt++ < 10 && !taskUndeployed) {
-                taskUndeployed = checkUndeployed(ignite2, GridDeploymentTestTask.class.getName());
-
-                if (!taskUndeployed)
-                    Thread.sleep(500);
-            }
-
-            // Undeploy on one node should undeploy explicitly deployed
-            // tasks on the others
-            assert taskUndeployed;
-        }
-        finally {
-            stopGrid(ignite1);
-            stopGrid(ignite2);
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDeployEvents() throws Exception {
-        Ignite ignite = startGrid(getTestGridName());
-
-        try {
-            DeploymentEventListener evtLsnr = new DeploymentEventListener();
-
-            ignite.events().localListen(evtLsnr, EVT_TASK_DEPLOYED, EVT_TASK_UNDEPLOYED);
-
-            // Should generate 1st deployment event.
-            ignite.compute().localDeployTask(GridDeploymentTestTask.class, GridDeploymentTestTask.class.getClassLoader());
-
-            assert depSpi.getRegisterCount() == 1 : "Invalid deploy count: " + depSpi.getRegisterCount();
-            assert depSpi.getUnregisterCount() == 0 : "Invalid undeploy count: " + depSpi.getUnregisterCount();
-
-            assert ignite.compute().localTasks().get(GridDeploymentTestTask.class.getName()) != null;
-
-            // Should generate 1st un-deployment event.
-            ignite.compute().undeployTask(GridDeploymentTestTask.class.getName());
-
-            assert depSpi.getRegisterCount() == 1 : "Invalid deploy count: " + depSpi.getRegisterCount();
-            assert depSpi.getUnregisterCount() == 1 : "Invalid undeploy count: " + depSpi.getUnregisterCount();
-
-            assert checkUndeployed(ignite, GridDeploymentTestTask.class.getName());
-
-            // Should generate 2nd deployment event.
-            ignite.compute().localDeployTask(GridDeploymentTestTask.class, GridDeploymentTestTask.class.getClassLoader());
-
-            assert depSpi.getRegisterCount() == 2 : "Invalid deploy count: " + depSpi.getRegisterCount();
-            assert depSpi.getUnregisterCount() == 1 : "Invalid undeploy count: " + depSpi.getUnregisterCount();
-
-            assert ignite.compute().localTasks().get(GridDeploymentTestTask.class.getName()) != null;
-
-            // Should generate 2nd un-deployment event.
-            ignite.compute().undeployTask(GridDeploymentTestTask.class.getName());
-
-            assert depSpi.getRegisterCount() == 2 : "Invalid deploy count: " + depSpi.getRegisterCount();
-            assert depSpi.getUnregisterCount() == 2 : "Invalid undeploy count: " + depSpi.getUnregisterCount();
-
-            assert checkUndeployed(ignite, GridDeploymentTestTask.class.getName());
-
-            // Should generate 3rd deployment event.
-            ignite.compute().localDeployTask(GridDeploymentTestTask.class, GridDeploymentTestTask.class.getClassLoader());
-
-            assert depSpi.getRegisterCount() == 3 : "Invalid deploy count: " + depSpi.getRegisterCount();
-            assert depSpi.getUnregisterCount() == 2 : "Invalid undeploy count: " + depSpi.getUnregisterCount();
-
-            assert ignite.compute().localTasks().get(GridDeploymentTestTask.class.getName()) != null;
-
-            // Should generate 3rd un-deployment event.
-            ignite.compute().undeployTask(GridDeploymentTestTask.class.getName());
-
-            assert depSpi.getRegisterCount() == 3 : "Invalid deploy count: " + depSpi.getRegisterCount();
-            assert depSpi.getUnregisterCount() == 3 : "Invalid undeploy count: " + depSpi.getUnregisterCount();
-
-            assert checkUndeployed(ignite, GridDeploymentTestTask.class.getName());
-
-            assert evtLsnr.getDeployCount() == 3 : "Invalid number of deployment events" + evtLsnr.getDeployCount();
-            assert evtLsnr.getUndeployCount() == 3 : "Invalid number of un-deployment events" + evtLsnr.getDeployCount();
-        }
-        finally {
-            stopGrid(ignite);
-        }
-    }
-
-    /**
-     * Test deployable task.
-     */
-    private static class GridDeploymentTestTask extends ComputeTaskAdapter<Object, Object> {
-        /** */
-        @IgniteLoggerResource
-        private IgniteLogger log;
-
-        /** {@inheritDoc} */
-        @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, Object arg) {
-            Map<ComputeJobAdapter, ClusterNode> map = new HashMap<>(subgrid.size());
-
-            for (ClusterNode node : subgrid) {
-                map.put(new ComputeJobAdapter() {
-                    @Override public Serializable execute() {
-                        if (log.isInfoEnabled())
-                            log.info("Executing grid job: " + this);
-
-                        return null;
-                    }
-                }, node);
-            }
-
-            return map;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object reduce(List<ComputeJobResult> results) {
-            return null;
-        }
-    }
-
-    /**
-     * Test deployable named task.
-     */
-    @ComputeTaskName(value = "GridDeploymentTestTask")
-    private static class GridDeploymentTestTask1 extends ComputeTaskAdapter<Object, Object> {
-        /** */
-        @IgniteLoggerResource
-        private IgniteLogger log;
-
-        /** {@inheritDoc} */
-        @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, Object arg) {
-            Map<ComputeJobAdapter, ClusterNode> map = new HashMap<>(subgrid.size());
-
-            for (ClusterNode node : subgrid) {
-                map.put(new ComputeJobAdapter() {
-                    @Override public Serializable execute() {
-                        log.info("Executing grid job: " + this);
-
-                        return null;
-                    }
-                }, node);
-            }
-
-            return map;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object reduce(List<ComputeJobResult> results) {
-            return null;
-        }
-    }
-
-    /**
-     * Test deployable named task.
-     */
-    @ComputeTaskName(value = "GridDeploymentTestTask")
-    private static class GridDeploymentTestTask2 extends ComputeTaskAdapter<Object, Object> {
-        /** */
-        @IgniteLoggerResource
-        private IgniteLogger log;
-
-        /** {@inheritDoc} */
-        @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, Object arg) {
-            Map<ComputeJobAdapter, ClusterNode> map = new HashMap<>(subgrid.size());
-
-            for (ClusterNode node : subgrid) {
-                map.put(new ComputeJobAdapter() {
-                    @Override public Serializable execute() {
-                        if (log.isInfoEnabled())
-                            log.info("Executing grid job: " + this);
-
-                        return null;
-                    }
-                }, node);
-            }
-
-            return map;
-        }
-
-        /** {@inheritDoc} */
-        @Override public Object reduce(List<ComputeJobResult> results) {
-            return null;
-        }
-    }
-
-    /**
-     *
-     * Test deployment spi.
-     */
-    private static class TestDeploymentSpi extends LocalDeploymentSpi {
-        /** */
-        private volatile int deployCnt;
-
-        /** */
-        private volatile int undeployCnt;
-
-        /** {@inheritDoc} */
-        @Override public boolean register(ClassLoader ldr, Class rsrc) throws IgniteSpiException {
-            if (super.register(ldr, rsrc)) {
-                deployCnt++;
-
-                return true;
-            }
-
-            return false;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean unregister(String rsrcName) {
-            undeployCnt++;
-
-            return super.unregister(rsrcName);
-        }
-
-        /**
-         * @return Deploy count.
-         */
-        public int getRegisterCount() {
-            return deployCnt;
-        }
-
-        /**
-         * @return Undeploy count.
-         */
-        public int getUnregisterCount() {
-            return undeployCnt;
-        }
-    }
-
-    /**
-     * Deployment listener.
-     */
-    private static class DeploymentEventListener implements IgnitePredicate<IgniteEvent> {
-        /** */
-        private int depCnt;
-
-        /** */
-        private int undepCnt;
-
-        /**
-         * Gonna process task deployment events only.
-         *
-         * @param evt local grid event.
-         */
-        @Override public boolean apply(IgniteEvent evt) {
-            if (evt.type() == EVT_TASK_DEPLOYED)
-                depCnt++;
-            else if (evt.type() == EVT_TASK_UNDEPLOYED)
-                undepCnt++;
-
-            return true;
-        }
-
-        /**
-         * @return Deploy count.
-         */
-        public int getDeployCount() {
-            return depCnt;
-        }
-
-        /**
-         * @return Undeploy count.
-         */
-        public int getUndeployCount() {
-            return undepCnt;
-        }
-    }
-}


Mime
View raw message