http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskNameAnnotationSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskNameAnnotationSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskNameAnnotationSelfTest.java
new file mode 100644
index 0000000..2a5a926
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskNameAnnotationSelfTest.java
@@ -0,0 +1,124 @@
+/*
+ * 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.internal.util.lang.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.testframework.junits.common.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+
+import static org.apache.ignite.compute.ComputeJobResultPolicy.*;
+
+/**
+ * Tests for {@link org.apache.ignite.compute.ComputeTaskName} annotation.
+ */
+public class GridTaskNameAnnotationSelfTest extends GridCommonAbstractTest {
+    /** Task name. */
+    private static final String TASK_NAME = "test-task";
+
+    /** Peer deploy aware task name. */
+    private static final String PEER_DEPLOY_AWARE_TASK_NAME = 
"peer-deploy-aware-test-task";
+
+    /**
+     * Starts grid.
+     */
+    public GridTaskNameAnnotationSelfTest() {
+        super(true);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClass() throws Exception {
+        assert grid().compute().execute(TestTask.class, 
null).equals(TASK_NAME);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testClassPeerDeployAware() throws Exception {
+        assert grid().compute().execute(PeerDeployAwareTestTask.class, 
null).equals(PEER_DEPLOY_AWARE_TASK_NAME);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testInstance() throws Exception {
+        assert grid().compute().execute(new TestTask(), 
null).equals(TASK_NAME);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testInstancePeerDeployAware() throws Exception {
+        assert grid().compute().execute(new PeerDeployAwareTestTask(), null).
+            equals(PEER_DEPLOY_AWARE_TASK_NAME);
+    }
+
+    /**
+     * Test task.
+     */
+    @ComputeTaskName(TASK_NAME)
+    private static class TestTask implements ComputeTask<Void, String> {
+        /** {@inheritDoc} */
+        @Override public Map<? extends ComputeJob, ClusterNode> 
map(List<ClusterNode> subgrid,
+            @Nullable Void arg) throws IgniteCheckedException {
+            return F.asMap(new ComputeJobAdapter() {
+                @IgniteTaskSessionResource
+                private ComputeTaskSession ses;
+
+                @Override public Object execute() {
+                    return ses.getTaskName();
+                }
+            }, F.rand(subgrid));
+        }
+
+        /** {@inheritDoc} */
+        @Override public ComputeJobResultPolicy result(ComputeJobResult res, 
List<ComputeJobResult> rcvd)
+            throws IgniteCheckedException {
+            return WAIT;
+        }
+
+        /** {@inheritDoc} */
+        @Override public String reduce(List<ComputeJobResult> results) throws 
IgniteCheckedException {
+            return F.first(results).getData();
+        }
+    }
+
+    /**
+     * Test task that implements {@link 
org.apache.ignite.internal.util.lang.GridPeerDeployAware}.
+     */
+    @ComputeTaskName(PEER_DEPLOY_AWARE_TASK_NAME)
+    private static class PeerDeployAwareTestTask extends TestTask implements 
GridPeerDeployAware {
+        /** {@inheritDoc} */
+        @Override public Class<?> deployClass() {
+            return getClass();
+        }
+
+        /** {@inheritDoc} */
+        @Override public ClassLoader classLoader() {
+            return getClass().getClassLoader();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskResultCacheSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskResultCacheSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskResultCacheSelfTest.java
new file mode 100644
index 0000000..d9b1e48
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskResultCacheSelfTest.java
@@ -0,0 +1,129 @@
+/*
+ * 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.internal.util.typedef.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ *
+ */
+@GridCommonTest(group = "Kernal Self")
+public class GridTaskResultCacheSelfTest extends GridCommonAbstractTest {
+    /**
+     *
+     */
+    public GridTaskResultCacheSelfTest() {
+        super(true);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNoCacheResults() throws Exception {
+        Ignite ignite = G.ignite(getTestGridName());
+
+        ignite.compute().execute(GridResultNoCacheTestTask.class, "Grid Result 
No Cache Test Argument");
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testCacheResults() throws Exception {
+        Ignite ignite = G.ignite(getTestGridName());
+
+        ignite.compute().execute(GridResultCacheTestTask.class, "Grid Result 
Cache Test Argument");
+    }
+
+    /**
+     *
+     */
+    @ComputeTaskNoResultCache
+    private static class GridResultNoCacheTestTask extends 
GridAbstractCacheTestTask {
+        /** {@inheritDoc} */
+        @Override public ComputeJobResultPolicy result(ComputeJobResult res, 
List<ComputeJobResult> rcvd) throws IgniteCheckedException {
+            assert res.getData() != null;
+            assert rcvd.isEmpty();
+
+            return super.result(res, rcvd);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object reduce(List<ComputeJobResult> results) throws 
IgniteCheckedException {
+            assert results.isEmpty();
+
+            return null;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class GridResultCacheTestTask extends 
GridAbstractCacheTestTask {
+        /** {@inheritDoc} */
+        @Override public ComputeJobResultPolicy result(ComputeJobResult res, 
List<ComputeJobResult> rcvd)
+            throws IgniteCheckedException {
+            assert res.getData() != null;
+            assert rcvd.contains(res);
+
+            for (ComputeJobResult jobRes : rcvd)
+                assert jobRes.getData() != null;
+
+            return super.result(res, rcvd);
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object reduce(List<ComputeJobResult> results) throws 
IgniteCheckedException {
+            for (ComputeJobResult res : results) {
+                if (res.getException() != null)
+                    throw res.getException();
+
+                assert res.getData() != null;
+            }
+
+            return null;
+        }
+    }
+
+    /**
+     * Test task.
+     */
+    private abstract static class GridAbstractCacheTestTask extends 
ComputeTaskSplitAdapter<String, Object> {
+        /** {@inheritDoc} */
+        @Override protected Collection<? extends ComputeJob> split(int 
gridSize, String arg) throws IgniteCheckedException {
+            String[] words = arg.split(" ");
+
+            Collection<ComputeJobAdapter> jobs = new ArrayList<>(words.length);
+
+            for (String word : words) {
+                jobs.add(new ComputeJobAdapter(word) {
+                    @Override public Serializable execute() {
+                        return argument(0);
+                    }
+                });
+            }
+
+            return jobs;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/GridTaskTimeoutSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskTimeoutSelfTest.java
new file mode 100644
index 0000000..9c8d5a4
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/GridTaskTimeoutSelfTest.java
@@ -0,0 +1,223 @@
+/*
+ * 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.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 java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.events.IgniteEventType.*;
+
+/**
+ *
+ */
+@GridCommonTest(group = "Kernal Self")
+public class GridTaskTimeoutSelfTest extends GridCommonAbstractTest {
+    /** Number of jobs each task spawns. */
+    private static final int SPLIT_COUNT = 1;
+
+    /** Timeout for task execution in milliseconds. */
+    private static final long TIMEOUT = 1000;
+
+    /** Number of worker threads. */
+    private static final int N_THREADS = 16;
+
+    /** Test execution period in milliseconds. */
+    private static final int PERIOD = 10000;
+
+    /** */
+    public GridTaskTimeoutSelfTest() {
+        super(true);
+    }
+
+    /**
+     * @param execId Execution ID.
+     */
+    private void checkTimedOutEvents(final IgniteUuid execId) {
+        Ignite ignite = G.ignite(getTestGridName());
+
+        Collection<IgniteEvent> evts = ignite.events().localQuery(new PE() {
+            @Override public boolean apply(IgniteEvent evt) {
+                return ((IgniteTaskEvent) evt).taskSessionId().equals(execId);
+            }
+        }, EVT_TASK_TIMEDOUT);
+
+        assert evts.size() == 1 : "Invalid number of timed out tasks: " + 
evts.size();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSynchronousTimeout() throws Exception {
+        Ignite ignite = G.ignite(getTestGridName());
+
+        ignite.compute().localDeployTask(GridTaskTimeoutTestTask.class, 
GridTaskTimeoutTestTask.class.getClassLoader());
+
+        ComputeTaskFuture<?> fut = 
executeAsync(ignite.compute().withTimeout(TIMEOUT),
+            GridTaskTimeoutTestTask.class.getName(), null);
+
+        try {
+            fut.get();
+
+            assert false : "GridComputeTaskTimeoutException was not thrown 
(synchronous apply)";
+        }
+        catch (ComputeTaskTimeoutException e) {
+            info("Received expected timeout exception (synchronous apply): " + 
e);
+        }
+
+        Thread.sleep(TIMEOUT + 500);
+
+        checkTimedOutEvents(fut.getTaskSession().getId());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testAsynchronousTimeout() throws Exception {
+        Ignite ignite = G.ignite(getTestGridName());
+
+        ignite.compute().localDeployTask(GridTaskTimeoutTestTask.class, 
GridTaskTimeoutTestTask.class.getClassLoader());
+
+        ComputeTaskFuture<?> fut = 
executeAsync(ignite.compute().withTimeout(TIMEOUT),
+            GridTaskTimeoutTestTask.class.getName(), null);
+
+        // Allow timed out events to be executed.
+        Thread.sleep(TIMEOUT + 500);
+
+        checkTimedOutEvents(fut.getTaskSession().getId());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSynchronousTimeoutMultithreaded() throws Exception {
+        final Ignite ignite = G.ignite(getTestGridName());
+
+        final AtomicBoolean finish = new AtomicBoolean();
+
+        final AtomicInteger cnt = new AtomicInteger();
+
+        final CountDownLatch finishLatch = new CountDownLatch(N_THREADS);
+
+        new Thread(new Runnable() {
+            @Override public void run() {
+                try {
+                    Thread.sleep(PERIOD);
+
+                    info("Stopping test.");
+
+                    finish.set(true);
+                }
+                catch (InterruptedException ignored) {
+                    Thread.currentThread().interrupt();
+                }
+            }
+        }).start();
+
+        multithreaded(new Runnable() {
+            @SuppressWarnings("InfiniteLoopStatement")
+            @Override public void run() {
+                while (!finish.get()) {
+                    try {
+                        ComputeTaskFuture<?> fut = executeAsync(
+                            ignite.compute().withTimeout(TIMEOUT), 
GridTaskTimeoutTestTask.class.getName(), null);
+
+                        fut.get();
+
+                        assert false : "Task has not been timed out. Future: " 
+ fut;
+                    }
+                    catch (ComputeTaskTimeoutException ignored) {
+                        // Expected.
+                    }
+                    catch (IgniteCheckedException e) {
+                        throw new IllegalStateException(e); //shouldn't happen
+                    }
+                    finally {
+                        int cnt0 = cnt.incrementAndGet();
+
+                        if (cnt0 % 100 == 0)
+                            info("Tasks finished: " + cnt0);
+                    }
+                }
+
+                info("Thread " + Thread.currentThread().getId() + " 
finishing.");
+
+                finishLatch.countDown();
+            }
+        }, N_THREADS);
+
+        finishLatch.await();
+
+        //Grid will be stopped automatically on tearDown().
+    }
+
+    /**
+     *
+     */
+    private static class GridTaskTimeoutTestTask extends 
ComputeTaskSplitAdapter<Serializable, Object> {
+        /** {@inheritDoc} */
+        @Override protected Collection<? extends ComputeJob> split(int 
gridSize, Serializable arg) throws IgniteCheckedException {
+            Collection<GridTaskTimeoutTestJob> jobs = new 
ArrayList<>(SPLIT_COUNT);
+
+            for (int i = 0; i < SPLIT_COUNT; i++) {
+                GridTaskTimeoutTestJob job = new GridTaskTimeoutTestJob();
+
+                job.setArguments(arg);
+
+                jobs.add(job);
+            }
+
+            return jobs;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object reduce(List<ComputeJobResult> results) throws 
IgniteCheckedException {
+            return null;
+        }
+    }
+
+    /**
+     *
+     */
+    private static class GridTaskTimeoutTestJob extends ComputeJobAdapter {
+        /** Injected logger. */
+        @IgniteLoggerResource
+        private IgniteLogger log;
+
+        /** {@inheritDoc} */
+        @Override public Serializable execute() {
+            try {
+                Thread.sleep(Long.MAX_VALUE);
+            }
+            catch (InterruptedException ignored) {
+                // No-op.
+            }
+
+            return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/apache/ignite/internal/GridTopicExternalizableSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/GridTopicExternalizableSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/GridTopicExternalizableSelfTest.java
new file mode 100644
index 0000000..b17bd1b
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/GridTopicExternalizableSelfTest.java
@@ -0,0 +1,166 @@
+/*
+ * 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.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.marshaller.*;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Grid topic externalization test.
+ */
+public class GridTopicExternalizableSelfTest extends 
GridExternalizableAbstractTest {
+    /** */
+    private static final IgniteUuid A_GRID_UUID = IgniteUuid.randomUuid();
+
+    /** */
+    private static final UUID AN_UUID = UUID.randomUUID();
+
+    /** */
+    private static final long A_LONG = Long.MAX_VALUE;
+
+    /** */
+    private static final String A_STRING = 
"test_test_test_test_test_test_test_test_test_test_test_test_test_test";
+
+    /** */
+    private static final int AN_INT = Integer.MAX_VALUE;
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSerializationTopicCreatedByGridUuid() throws Exception {
+        for (IgniteMarshaller marsh : getMarshallers()) {
+            info("Test GridTopic externalization [marshaller=" + marsh + ']');
+
+            for (GridTopic topic : GridTopic.values()) {
+                Externalizable msgOut = 
(Externalizable)topic.topic(A_GRID_UUID);
+
+                assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, 
marsh));
+            }
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSerializationTopicCreatedByGridUuidAndUUID() throws 
Exception {
+        for (IgniteMarshaller marsh : getMarshallers()) {
+            info("Test GridTopic externalization [marshaller=" + marsh + ']');
+
+            for (GridTopic topic : GridTopic.values()) {
+                Externalizable msgOut = 
(Externalizable)topic.topic(A_GRID_UUID, AN_UUID);
+
+                assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, 
marsh));
+            }
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSerializationTopicCreatedByGridUuidAndLong() throws 
Exception {
+        for (IgniteMarshaller marsh : getMarshallers()) {
+            info("Test GridTopic externalization [marshaller=" + marsh + ']');
+
+            for (GridTopic topic : GridTopic.values()) {
+                Externalizable msgOut = 
(Externalizable)topic.topic(A_GRID_UUID, A_LONG);
+
+                assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, 
marsh));
+            }
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSerializationTopicCreatedByStringAndUUIDAndLong() throws 
Exception {
+        for (IgniteMarshaller marsh : getMarshallers()) {
+            info("Test GridTopic externalization [marshaller=" + marsh + ']');
+
+            for (GridTopic topic : GridTopic.values()) {
+                Externalizable msgOut = (Externalizable)topic.topic(A_STRING, 
AN_UUID, A_LONG);
+
+                assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, 
marsh));
+            }
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSerializationTopicCreatedByString() throws Exception {
+        for (IgniteMarshaller marsh : getMarshallers()) {
+            info("Test GridTopic externalization [marshaller=" + marsh + ']');
+
+            for (GridTopic topic : GridTopic.values()) {
+                Externalizable msgOut = (Externalizable)topic.topic(A_STRING);
+
+                assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, 
marsh));
+            }
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSerializationTopicCreatedByStringAndIntAndLong() throws 
Exception {
+        for (IgniteMarshaller marsh : getMarshallers()) {
+            info("Test GridTopic externalization [marshaller=" + marsh + ']');
+
+            for (GridTopic topic : GridTopic.values()) {
+                Externalizable msgOut = (Externalizable)topic.topic(A_STRING, 
AN_INT, A_LONG);
+
+                assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, 
marsh));
+            }
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSerializationTopicCreatedByStrinAndLong() throws Exception 
{
+        for (IgniteMarshaller marsh : getMarshallers()) {
+            info("Test GridTopic externalization [marshaller=" + marsh + ']');
+
+            for (GridTopic topic : GridTopic.values()) {
+                Externalizable msgOut = (Externalizable)topic.topic(A_STRING, 
A_LONG);
+
+                assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, 
marsh));
+            }
+        }
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testSerializationTopicCreatedByStringAndUUIDAndIntAndLong() 
throws Exception {
+        for (IgniteMarshaller marsh : getMarshallers()) {
+            info("Test GridTopic externalization [marshaller=" + marsh + ']');
+
+            for (GridTopic topic : GridTopic.values()) {
+                Externalizable msgOut = (Externalizable)topic.topic(A_STRING, 
AN_UUID, AN_INT, A_LONG);
+
+                assertEquals(msgOut, GridTestIoUtils.externalize(msgOut, 
marsh));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/apache/ignite/internal/GridTopologyBuildVersionSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/GridTopologyBuildVersionSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/GridTopologyBuildVersionSelfTest.java
new file mode 100644
index 0000000..6e701e1
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/GridTopologyBuildVersionSelfTest.java
@@ -0,0 +1,102 @@
+/*
+ * 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.cluster.*;
+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.internal.util.typedef.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import java.util.*;
+import java.util.concurrent.atomic.*;
+
+/**
+ * Tests build version setting into discovery maps.
+ */
+public class GridTopologyBuildVersionSelfTest extends GridCommonAbstractTest {
+    /** IP finder. */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new 
TcpDiscoveryVmIpFinder(true);
+
+    /** Counter. */
+    private static final AtomicInteger cnt = new AtomicInteger();
+
+    /** Test compatible versions. */
+    private static final Collection<String> COMPATIBLE_VERS =
+        F.asList("1.0.0-ent", "2.0.0-ent", "3.0.0-ent", "4.0.0-ent");
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        final int idx = cnt.incrementAndGet();
+
+        // Override node attributes in discovery spi.
+        TcpDiscoverySpi discoSpi = new TcpDiscoverySpi() {
+            @Override public void setNodeAttributes(Map<String, Object> attrs, 
IgniteProductVersion ver) {
+                super.setNodeAttributes(attrs, ver);
+
+                attrs.put(GridNodeAttributes.ATTR_BUILD_VER, idx + ".0.0" + 
"-ent");
+
+                if (idx < 3)
+                    attrs.remove(GridNodeAttributes.ATTR_BUILD_DATE);
+                else
+                    attrs.put(GridNodeAttributes.ATTR_BUILD_DATE, 
"1385099743");
+
+                attrs.put(GridNodeAttributes.ATTR_COMPATIBLE_VERS, 
COMPATIBLE_VERS);
+            }
+        };
+
+        discoSpi.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(discoSpi);
+
+        return cfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testVersioning() throws Exception {
+        startGrids(4);
+
+        try {
+            for (int i = 3; i >= 0; i--) {
+                GridKernal g = (GridKernal)grid(i);
+
+                NavigableMap<IgniteProductVersion, Collection<ClusterNode>> 
verMap = g.context().discovery()
+                    .topologyVersionMap();
+
+                assertEquals(4, verMap.size());
+
+                // Now check the map itself.
+                assertEquals(4, 
verMap.get(IgniteProductVersion.fromString("1.0.0")).size());
+                assertEquals(3, 
verMap.get(IgniteProductVersion.fromString("2.0.0")).size());
+                assertEquals(2, 
verMap.get(IgniteProductVersion.fromString("3.0.0-ent-1385099743")).size());
+                assertEquals(1, 
verMap.get(IgniteProductVersion.fromString("4.0.0-ent-1385099743")).size());
+            }
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/apache/ignite/internal/GridVersionSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/GridVersionSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/GridVersionSelfTest.java
new file mode 100644
index 0000000..57cfd4e
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/GridVersionSelfTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.product.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import static org.apache.ignite.IgniteSystemProperties.*;
+
+/**
+ * Tests version methods.
+ */
+public class GridVersionSelfTest extends GridCommonAbstractTest {
+    /**
+     * @throws Exception If failed.
+     */
+    public void testVersions() throws Exception {
+        String propVal = System.getProperty(GG_UPDATE_NOTIFIER);
+
+        System.setProperty(GG_UPDATE_NOTIFIER, "true");
+
+        try {
+            Ignite ignite = startGrid();
+
+            IgniteProductVersion currVer = ignite.product().version();
+
+            String newVer = null;
+
+            for (int i = 0; i < 30; i++) {
+                newVer = ignite.product().latestVersion();
+
+                if (newVer != null)
+                    break;
+
+                U.sleep(100);
+            }
+
+            info("Versions [cur=" + currVer + ", latest=" + newVer + ']');
+
+            assertNotNull(newVer);
+            assertNotSame(currVer.toString(), newVer);
+        }
+        finally {
+            stopGrid();
+
+            if (propVal != null)
+                System.setProperty(GG_UPDATE_NOTIFIER, propVal);
+            else
+                System.clearProperty(GG_UPDATE_NOTIFIER);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/apache/ignite/internal/package.html
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/package.html 
b/modules/core/src/test/java/org/apache/ignite/internal/package.html
new file mode 100644
index 0000000..135eb1a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/package.html
@@ -0,0 +1,24 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd";>
+<html>
+<body>
+    <!-- Package description. -->
+    Contains internal tests or test related classes and interfaces.
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/apache/ignite/internal/updatestatus.html
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/updatestatus.html 
b/modules/core/src/test/java/org/apache/ignite/internal/updatestatus.html
new file mode 100644
index 0000000..9c97ac2
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/updatestatus.html
@@ -0,0 +1,28 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml"; lang="en" xml:lang="en">
+<head>
+    <meta name="version" content="1.0.0.20060510"/>
+    <title>GridGain Update Page</title>
+    <style type="text/css"></style>
+</head>
+
+<body>
+<h1>GridGain Update Page.</h1>
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerAbstractTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerAbstractTest.java
 
b/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerAbstractTest.java
index f68f3b7..4b674d8 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerAbstractTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/marshaller/GridMarshallerAbstractTest.java
@@ -34,7 +34,6 @@ import org.apache.ignite.marshaller.optimized.*;
 import org.apache.ignite.product.*;
 import org.apache.ignite.streamer.*;
 import org.apache.ignite.streamer.window.*;
-import org.gridgain.grid.kernal.*;
 import org.apache.ignite.internal.executor.*;
 import org.apache.ignite.internal.processors.cache.affinity.*;
 import org.apache.ignite.internal.processors.cache.datastructures.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/apache/ignite/testsuites/GridContinuousTaskSelfTestSuite.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testsuites/GridContinuousTaskSelfTestSuite.java
 
b/modules/core/src/test/java/org/apache/ignite/testsuites/GridContinuousTaskSelfTestSuite.java
index 3618af6..0a500d7 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testsuites/GridContinuousTaskSelfTestSuite.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testsuites/GridContinuousTaskSelfTestSuite.java
@@ -18,7 +18,7 @@
 package org.apache.ignite.testsuites;
 
 import junit.framework.*;
-import org.gridgain.grid.kernal.*;
+import org.apache.ignite.internal.*;
 
 /**
  * Continuous task self-test suite.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/apache/ignite/testsuites/GridExternalizableSelfTestSuite.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testsuites/GridExternalizableSelfTestSuite.java
 
b/modules/core/src/test/java/org/apache/ignite/testsuites/GridExternalizableSelfTestSuite.java
index 0cd717d..07de42a 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testsuites/GridExternalizableSelfTestSuite.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testsuites/GridExternalizableSelfTestSuite.java
@@ -18,7 +18,7 @@
 package org.apache.ignite.testsuites;
 
 import junit.framework.*;
-import org.gridgain.grid.kernal.*;
+import org.apache.ignite.internal.*;
 
 /**
  * Externalizable self-test suite.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/apache/ignite/testsuites/GridKernalSelfTestSuite.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testsuites/GridKernalSelfTestSuite.java
 
b/modules/core/src/test/java/org/apache/ignite/testsuites/GridKernalSelfTestSuite.java
index 3cfbced..eb530b1 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testsuites/GridKernalSelfTestSuite.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testsuites/GridKernalSelfTestSuite.java
@@ -20,7 +20,6 @@ package org.apache.ignite.testsuites;
 import junit.framework.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.util.*;
-import org.gridgain.grid.kernal.*;
 import org.apache.ignite.internal.managers.*;
 import org.apache.ignite.internal.managers.communication.*;
 import org.apache.ignite.internal.managers.deployment.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/apache/ignite/testsuites/GridRichSelfTestSuite.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testsuites/GridRichSelfTestSuite.java
 
b/modules/core/src/test/java/org/apache/ignite/testsuites/GridRichSelfTestSuite.java
index 654a09d..0cabeec 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testsuites/GridRichSelfTestSuite.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testsuites/GridRichSelfTestSuite.java
@@ -18,7 +18,7 @@
 package org.apache.ignite.testsuites;
 
 import junit.framework.*;
-import org.gridgain.grid.kernal.*;
+import org.apache.ignite.internal.*;
 import org.apache.ignite.messaging.*;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/apache/ignite/testsuites/bamboo/GridBasicTestSuite.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testsuites/bamboo/GridBasicTestSuite.java
 
b/modules/core/src/test/java/org/apache/ignite/testsuites/bamboo/GridBasicTestSuite.java
index 52bb71c..e5f941a 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testsuites/bamboo/GridBasicTestSuite.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testsuites/bamboo/GridBasicTestSuite.java
@@ -19,10 +19,10 @@ package org.apache.ignite.testsuites.bamboo;
 
 import junit.framework.*;
 import org.apache.ignite.*;
+import org.apache.ignite.internal.*;
 import org.apache.ignite.product.*;
 import org.apache.ignite.spi.*;
 import org.apache.ignite.testsuites.*;
-import org.gridgain.grid.kernal.*;
 import org.apache.ignite.internal.processors.affinity.*;
 import org.apache.ignite.internal.processors.closure.*;
 import org.apache.ignite.internal.processors.continuous.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/apache/ignite/testsuites/bamboo/GridComputeGridTestSuite.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/testsuites/bamboo/GridComputeGridTestSuite.java
 
b/modules/core/src/test/java/org/apache/ignite/testsuites/bamboo/GridComputeGridTestSuite.java
index 599da62..8e0b2c3 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/testsuites/bamboo/GridComputeGridTestSuite.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/testsuites/bamboo/GridComputeGridTestSuite.java
@@ -18,8 +18,8 @@
 package org.apache.ignite.testsuites.bamboo;
 
 import junit.framework.*;
+import org.apache.ignite.internal.*;
 import org.apache.ignite.testsuites.*;
-import org.gridgain.grid.kernal.*;
 import org.apache.ignite.internal.managers.checkpoint.*;
 import org.apache.ignite.internal.managers.communication.*;
 import org.apache.ignite.p2p.*;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/ClusterMetricsSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/ClusterMetricsSelfTest.java
 
b/modules/core/src/test/java/org/gridgain/grid/kernal/ClusterMetricsSelfTest.java
deleted file mode 100644
index 9f69f12..0000000
--- 
a/modules/core/src/test/java/org/gridgain/grid/kernal/ClusterMetricsSelfTest.java
+++ /dev/null
@@ -1,353 +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.configuration.*;
-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.*;
-
-/**
- * Tests for projection metrics.
- */
-@GridCommonTest(group = "Kernal Self")
-public class ClusterMetricsSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final int NODES_CNT = 4;
-
-    /** */
-    private static final int ITER_CNT = 30;
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        for (int i = 0; i < NODES_CNT; i++)
-            startGrid(i);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setCacheConfiguration();
-        cfg.setIncludeProperties();
-        cfg.setMetricsUpdateFrequency(0);
-
-        return cfg;
-    }
-
-    /**
-     * @throws Exception In case of error.
-     */
-    public void testEmptyProjection() throws Exception {
-        try {
-            grid(0).forPredicate(F.<ClusterNode>alwaysFalse()).metrics();
-
-            assert false;
-        }
-        catch (ClusterGroupEmptyException e) {
-            info("Caught expected exception: " + e);
-        }
-    }
-
-    /**
-     *
-     */
-    public void testTaskExecution() {
-        for (int i = 0; i < ITER_CNT; i++) {
-            info("Starting new iteration: " + i);
-
-            try {
-                performTaskExecutionTest();
-            }
-            catch (Throwable t) {
-                error("Iteration failed: " + i, t);
-
-                fail("Test failed (see logs for details).");
-            }
-        }
-    }
-
-    /**
-     * @throws Exception In case of error.
-     */
-    private void performTaskExecutionTest() throws Exception {
-        Ignite g = grid(0);
-
-        JobFinishLock jobFinishLock = new JobFinishLock();
-
-        MetricsUpdateLock metricsUpdLock = new MetricsUpdateLock();
-
-        try {
-            for (Ignite g0 : G.allGrids())
-                g0.events().localListen(jobFinishLock, EVT_JOB_FINISHED);
-
-            g.compute().execute(new GridTestTask(), "testArg");
-
-            // Wait until all nodes fire JOB FINISH event.
-            jobFinishLock.await();
-
-            g.events().localListen(metricsUpdLock, EVT_NODE_METRICS_UPDATED);
-
-            // Wait until local node will have updated metrics.
-            metricsUpdLock.await();
-
-            ClusterMetrics m = g.cluster().metrics();
-
-            checkMetrics(m);
-        }
-        finally {
-            for (Ignite g0 : G.allGrids())
-                g0.events().stopLocalListen(jobFinishLock);
-
-            g.events().stopLocalListen(metricsUpdLock);
-        }
-    }
-
-    /**
-     * @param m Metrics.
-     */
-    @SuppressWarnings({"FloatingPointEquality"})
-    private void checkMetrics(ClusterMetrics m) {
-        assert m.getTotalNodes() == NODES_CNT;
-        assert m.getTotalHosts() == 1;
-
-        assert m.getMinimumActiveJobs() == 0;
-        assert m.getMaximumActiveJobs() == 0;
-        assert m.getAverageActiveJobs() == 0;
-
-        assert m.getMinimumCancelledJobs() == 0;
-        assert m.getMaximumCancelledJobs() == 0;
-        assert m.getAverageCancelledJobs() == 0;
-
-        assert m.getMinimumRejectedJobs() == 0;
-        assert m.getMaximumRejectedJobs() == 0;
-        assert m.getAverageRejectedJobs() == 0;
-
-        assert m.getMinimumWaitingJobs() == 0;
-        assert m.getMaximumWaitingJobs() == 0;
-        assert m.getAverageWaitingJobs() == 0;
-
-        assert m.getMinimumJobExecuteTime() >= 0;
-        assert m.getMaximumJobExecuteTime() >= 0;
-        assert m.getAverageJobExecuteTime() >= 0;
-
-        assert m.getAverageJobExecuteTime() >= m.getMinimumJobExecuteTime() &&
-            m.getAverageJobExecuteTime() <= m.getMaximumJobExecuteTime();
-
-        assert m.getMinimumJobWaitTime() >= 0;
-        assert m.getMaximumJobWaitTime() >= 0;
-        assert m.getAverageJobWaitTime() >= 0;
-
-        assert m.getAverageJobWaitTime() >= m.getMinimumJobWaitTime() &&
-            m.getAverageJobWaitTime() <= m.getMaximumJobWaitTime();
-
-        assert m.getMinimumDaemonThreadCount() > 0;
-        assert m.getMaximumDaemonThreadCount() > 0;
-        assert m.getAverageDaemonThreadCount() > 0;
-
-        assert m.getAverageDaemonThreadCount() >= 
m.getMinimumDaemonThreadCount() &&
-            m.getAverageDaemonThreadCount() <= m.getMaximumDaemonThreadCount();
-
-        assert m.getMinimumThreadCount() > 0;
-        assert m.getMaximumThreadCount() > 0;
-        assert m.getAverageThreadCount() > 0;
-
-        assert m.getAverageThreadCount() >= m.getMinimumThreadCount() &&
-            m.getAverageThreadCount() <= m.getMaximumThreadCount();
-
-        assert m.getMinimumIdleTime() >= 0;
-        assert m.getMaximumIdleTime() >= 0;
-        assert m.getAverageIdleTime() >= 0;
-        assert m.getIdleTimePercentage() >= 0;
-        assert m.getIdleTimePercentage() <= 1;
-
-        assert m.getAverageIdleTime() >= m.getMinimumIdleTime() && 
m.getAverageIdleTime() <= m.getMaximumIdleTime();
-
-        assert m.getMinimumBusyTimePercentage() > 0;
-        assert m.getMaximumBusyTimePercentage() > 0;
-        assert m.getAverageBusyTimePercentage() > 0;
-
-        assert m.getAverageBusyTimePercentage() >= 
m.getMinimumBusyTimePercentage() &&
-            m.getAverageBusyTimePercentage() <= 
m.getMaximumBusyTimePercentage();
-
-        assert m.getMinimumCpuLoad() >= 0 || m.getMinimumCpuLoad() == -1.0;
-        assert m.getMaximumCpuLoad() >= 0 || m.getMaximumCpuLoad() == -1.0;
-        assert m.getAverageCpuLoad() >= 0 || m.getAverageCpuLoad() == -1.0;
-
-        assert m.getAverageCpuLoad() >= m.getMinimumCpuLoad() && 
m.getAverageCpuLoad() <= m.getMaximumCpuLoad();
-
-        assert m.getMinimumHeapMemoryCommitted() > 0;
-        assert m.getMaximumHeapMemoryCommitted() > 0;
-        assert m.getAverageHeapMemoryCommitted() > 0;
-
-        assert m.getAverageHeapMemoryCommitted() >= 
m.getMinimumHeapMemoryCommitted() &&
-            m.getAverageHeapMemoryCommitted() <= 
m.getMaximumHeapMemoryCommitted();
-
-        assert m.getMinimumHeapMemoryUsed() > 0;
-        assert m.getMaximumHeapMemoryUsed() > 0;
-        assert m.getAverageHeapMemoryUsed() > 0;
-
-        assert m.getAverageHeapMemoryUsed() >= m.getMinimumHeapMemoryUsed() &&
-            m.getAverageHeapMemoryUsed() <= m.getMaximumHeapMemoryUsed();
-
-        assert m.getMinimumHeapMemoryMaximum() > 0;
-        assert m.getMaximumHeapMemoryMaximum() > 0;
-        assert m.getAverageHeapMemoryMaximum() > 0;
-
-        assert m.getAverageHeapMemoryMaximum() >= 
m.getMinimumHeapMemoryMaximum() &&
-            m.getAverageHeapMemoryMaximum() <= m.getMaximumHeapMemoryMaximum();
-
-        assert m.getMinimumHeapMemoryInitialized() >= 0;
-        assert m.getMaximumHeapMemoryInitialized() >= 0;
-        assert m.getAverageHeapMemoryInitialized() >= 0;
-
-        assert m.getAverageHeapMemoryInitialized() >= 
m.getMinimumHeapMemoryInitialized() &&
-            m.getAverageHeapMemoryInitialized() <= 
m.getMaximumHeapMemoryInitialized();
-
-        assert m.getMinimumNonHeapMemoryCommitted() > 0;
-        assert m.getMaximumNonHeapMemoryCommitted() > 0;
-        assert m.getAverageNonHeapMemoryCommitted() > 0;
-
-        assert m.getAverageNonHeapMemoryCommitted() >= 
m.getMinimumNonHeapMemoryCommitted() &&
-            m.getAverageNonHeapMemoryCommitted() <= 
m.getMaximumNonHeapMemoryCommitted();
-
-        assert m.getMinimumNonHeapMemoryUsed() > 0;
-        assert m.getMaximumNonHeapMemoryUsed() > 0;
-        assert m.getAverageNonHeapMemoryUsed() > 0;
-
-        assert m.getAverageNonHeapMemoryUsed() >= 
m.getMinimumNonHeapMemoryUsed() &&
-            m.getAverageNonHeapMemoryUsed() <= m.getMaximumNonHeapMemoryUsed();
-
-        assert m.getMinimumNonHeapMemoryMaximum() > 0;
-        assert m.getMaximumNonHeapMemoryMaximum() > 0;
-        assert m.getAverageNonHeapMemoryMaximum() > 0;
-
-        assert m.getAverageNonHeapMemoryMaximum() >= 
m.getMinimumNonHeapMemoryMaximum() &&
-            m.getAverageNonHeapMemoryMaximum() <= 
m.getMaximumNonHeapMemoryMaximum();
-
-        assert m.getMinimumNonHeapMemoryInitialized() > 0;
-        assert m.getMaximumNonHeapMemoryInitialized() > 0;
-        assert m.getAverageNonHeapMemoryInitialized() > 0;
-
-        assert m.getAverageNonHeapMemoryInitialized() >= 
m.getMinimumNonHeapMemoryInitialized() &&
-            m.getAverageNonHeapMemoryInitialized() <= 
m.getMaximumNonHeapMemoryInitialized();
-
-        assert m.getYoungestNodeStartTime() > 0;
-        assert m.getOldestNodeStartTime() > 0;
-
-        assert m.getYoungestNodeStartTime() > m.getOldestNodeStartTime();
-
-        assert m.getMinimumUpTime() > 0;
-        assert m.getMaximumUpTime() > 0;
-        assert m.getAverageUpTime() > 0;
-
-        assert m.getAverageUpTime() >= m.getMinimumUpTime() && 
m.getAverageUpTime() <= m.getMaximumUpTime();
-
-        assert m.getMinimumCpusPerNode() > 0;
-        assert m.getMaximumCpusPerNode() > 0;
-        assert m.getAverageCpusPerNode() > 0;
-
-        assert m.getAverageCpusPerNode() == m.getMinimumCpusPerNode() &&
-            m.getAverageCpusPerNode() == m.getMaximumCpusPerNode();
-
-        assert m.getMinimumNodesPerHost() == NODES_CNT;
-        assert m.getMaximumNodesPerHost() == NODES_CNT;
-        assert m.getAverageNodesPerHost() == NODES_CNT;
-
-        assert m.getTotalCpus() > 0;
-        assert m.getTotalHosts() == 1;
-        assert m.getTotalNodes() == NODES_CNT;
-    }
-
-    /**
-     *
-     */
-    private static class JobFinishLock implements IgnitePredicate<IgniteEvent> 
{
-        /** Latch. */
-        private final CountDownLatch latch = new CountDownLatch(NODES_CNT);
-
-        /** {@inheritDoc} */
-        @Override public boolean apply(IgniteEvent evt) {
-            assert evt.type() == EVT_JOB_FINISHED;
-
-            latch.countDown();
-
-            return true;
-        }
-
-        /**
-         * Waits until all nodes fire EVT_JOB_FINISHED.
-         *
-         * @throws InterruptedException If interrupted.
-         */
-        public void await() throws InterruptedException {
-            latch.await();
-        }
-    }
-
-    /**
-     *
-     */
-    private static class MetricsUpdateLock implements 
IgnitePredicate<IgniteEvent> {
-        /** Latch. */
-        private final CountDownLatch latch = new CountDownLatch(NODES_CNT * 2);
-
-        /** */
-        private final Map<UUID, Integer> metricsRcvdCnt = new HashMap<>();
-
-        /** {@inheritDoc} */
-        @Override public boolean apply(IgniteEvent evt) {
-            IgniteDiscoveryEvent discoEvt = (IgniteDiscoveryEvent)evt;
-
-            Integer cnt = F.addIfAbsent(metricsRcvdCnt, 
discoEvt.eventNode().id(), 0);
-
-            assert cnt != null;
-
-            if (cnt < 2) {
-                latch.countDown();
-
-                metricsRcvdCnt.put(discoEvt.eventNode().id(), ++cnt);
-            }
-
-            return true;
-        }
-
-        /**
-         * Waits until all metrics will be received twice from all nodes in
-         * topology.
-         *
-         * @throws InterruptedException If interrupted.
-         */
-        public void await() throws InterruptedException {
-            latch.await();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/ClusterNodeMetricsSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/ClusterNodeMetricsSelfTest.java
 
b/modules/core/src/test/java/org/gridgain/grid/kernal/ClusterNodeMetricsSelfTest.java
deleted file mode 100644
index 4e832b4..0000000
--- 
a/modules/core/src/test/java/org/gridgain/grid/kernal/ClusterNodeMetricsSelfTest.java
+++ /dev/null
@@ -1,246 +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.configuration.*;
-import org.apache.ignite.events.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.messaging.*;
-import org.apache.ignite.internal.processors.task.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.*;
-
-import static org.apache.ignite.events.IgniteEventType.*;
-
-/**
- * Grid node metrics self test.
- */
-@GridCommonTest(group = "Kernal Self")
-public class ClusterNodeMetricsSelfTest extends GridCommonAbstractTest {
-    /** Test message size. */
-    private static final int MSG_SIZE = 1024;
-
-    /** Number of messages. */
-    private static final int MSG_CNT = 3;
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        startGrid();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        stopAllGrids();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setCacheConfiguration();
-        cfg.setMetricsUpdateFrequency(0);
-
-        return cfg;
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testSingleTaskMetrics() throws Exception {
-        Ignite ignite = grid();
-
-        ignite.compute().execute(new GridTestTask(), "testArg");
-
-        // Let metrics update twice.
-        final CountDownLatch latch = new CountDownLatch(2);
-
-        ignite.events().localListen(new IgnitePredicate<IgniteEvent>() {
-            @Override public boolean apply(IgniteEvent evt) {
-                assert evt.type() == EVT_NODE_METRICS_UPDATED;
-
-                latch.countDown();
-
-                return true;
-            }
-        }, EVT_NODE_METRICS_UPDATED);
-
-        // Wait for metrics update.
-        latch.await();
-
-        ClusterNodeMetrics metrics = ignite.cluster().localNode().metrics();
-
-        info("Node metrics: " + metrics);
-
-        assert metrics.getAverageActiveJobs() > 0;
-        assert metrics.getAverageCancelledJobs() == 0;
-        assert metrics.getAverageJobExecuteTime() >= 0;
-        assert metrics.getAverageJobWaitTime() >= 0;
-        assert metrics.getAverageRejectedJobs() == 0;
-        assert metrics.getAverageWaitingJobs() == 0;
-        assert metrics.getCurrentActiveJobs() == 0;
-        assert metrics.getCurrentCancelledJobs() == 0;
-        assert metrics.getCurrentJobExecuteTime() == 0;
-        assert metrics.getCurrentJobWaitTime() == 0;
-        assert metrics.getCurrentWaitingJobs() == 0;
-        assert metrics.getMaximumActiveJobs() == 1;
-        assert metrics.getMaximumCancelledJobs() == 0;
-        assert metrics.getMaximumJobExecuteTime() >= 0;
-        assert metrics.getMaximumJobWaitTime() >= 0;
-        assert metrics.getMaximumRejectedJobs() == 0;
-        assert metrics.getMaximumWaitingJobs() == 0;
-        assert metrics.getTotalCancelledJobs() == 0;
-        assert metrics.getTotalExecutedJobs() == 1;
-        assert metrics.getTotalRejectedJobs() == 0;
-        assert metrics.getTotalExecutedTasks() == 1;
-
-        assertTrue("MaximumJobExecuteTime=" + 
metrics.getMaximumJobExecuteTime() +
-            " is less than AverageJobExecuteTime=" + 
metrics.getAverageJobExecuteTime(),
-            metrics.getMaximumJobExecuteTime() >= 
metrics.getAverageJobExecuteTime());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testInternalTaskMetrics() throws Exception {
-        Ignite ignite = grid();
-
-        // Visor task is internal and should not affect metrics.
-        ignite.compute().withName("visor-test-task").execute(new 
TestInternalTask(), "testArg");
-
-        // Let metrics update twice.
-        final CountDownLatch latch = new CountDownLatch(2);
-
-        ignite.events().localListen(new IgnitePredicate<IgniteEvent>() {
-            @Override public boolean apply(IgniteEvent evt) {
-                assert evt.type() == EVT_NODE_METRICS_UPDATED;
-
-                latch.countDown();
-
-                return true;
-            }
-        }, EVT_NODE_METRICS_UPDATED);
-
-        // Wait for metrics update.
-        latch.await();
-
-        ClusterNodeMetrics metrics = ignite.cluster().localNode().metrics();
-
-        info("Node metrics: " + metrics);
-
-        assert metrics.getAverageActiveJobs() == 0;
-        assert metrics.getAverageCancelledJobs() == 0;
-        assert metrics.getAverageJobExecuteTime() == 0;
-        assert metrics.getAverageJobWaitTime() == 0;
-        assert metrics.getAverageRejectedJobs() == 0;
-        assert metrics.getAverageWaitingJobs() == 0;
-        assert metrics.getCurrentActiveJobs() == 0;
-        assert metrics.getCurrentCancelledJobs() == 0;
-        assert metrics.getCurrentJobExecuteTime() == 0;
-        assert metrics.getCurrentJobWaitTime() == 0;
-        assert metrics.getCurrentWaitingJobs() == 0;
-        assert metrics.getMaximumActiveJobs() == 0;
-        assert metrics.getMaximumCancelledJobs() == 0;
-        assert metrics.getMaximumJobExecuteTime() == 0;
-        assert metrics.getMaximumJobWaitTime() == 0;
-        assert metrics.getMaximumRejectedJobs() == 0;
-        assert metrics.getMaximumWaitingJobs() == 0;
-        assert metrics.getTotalCancelledJobs() == 0;
-        assert metrics.getTotalExecutedJobs() == 0;
-        assert metrics.getTotalRejectedJobs() == 0;
-        assert metrics.getTotalExecutedTasks() == 0;
-
-        assertTrue("MaximumJobExecuteTime=" + 
metrics.getMaximumJobExecuteTime() +
-            " is less than AverageJobExecuteTime=" + 
metrics.getAverageJobExecuteTime(),
-            metrics.getMaximumJobExecuteTime() >= 
metrics.getAverageJobExecuteTime());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testIoMetrics() throws Exception {
-        Ignite ignite0 = grid();
-        Ignite ignite1 = startGrid(1);
-
-        Object msg = new TestMessage();
-
-        int size = ignite0.configuration().getMarshaller().marshal(msg).length;
-
-        assert size > MSG_SIZE;
-
-        final CountDownLatch latch = new CountDownLatch(MSG_CNT);
-
-        ignite0.message().localListen(null, new 
MessagingListenActor<TestMessage>() {
-            @Override protected void receive(UUID nodeId, TestMessage rcvMsg) 
throws Throwable {
-                latch.countDown();
-            }
-        });
-
-        ignite1.message().localListen(null, new 
MessagingListenActor<TestMessage>() {
-            @Override protected void receive(UUID nodeId, TestMessage rcvMsg) 
throws Throwable {
-                respond(rcvMsg);
-            }
-        });
-
-        for (int i = 0; i < MSG_CNT; i++)
-            message(ignite0.cluster().forRemotes()).send(null, msg);
-
-        latch.await();
-
-        ClusterNodeMetrics metrics = ignite0.cluster().localNode().metrics();
-
-        info("Node 0 metrics: " + metrics);
-
-        // Time sync messages are being sent.
-        assert metrics.getSentMessagesCount() >= MSG_CNT;
-        assert metrics.getSentBytesCount() > size * MSG_CNT;
-        assert metrics.getReceivedMessagesCount() >= MSG_CNT;
-        assert metrics.getReceivedBytesCount() > size * MSG_CNT;
-
-        metrics = ignite1.cluster().localNode().metrics();
-
-        info("Node 1 metrics: " + metrics);
-
-        // Time sync messages are being sent.
-        assert metrics.getSentMessagesCount() >= MSG_CNT;
-        assert metrics.getSentBytesCount() > size * MSG_CNT;
-        assert metrics.getReceivedMessagesCount() >= MSG_CNT;
-        assert metrics.getReceivedBytesCount() > size * MSG_CNT;
-    }
-
-    /**
-     * Test message.
-     */
-    @SuppressWarnings("UnusedDeclaration")
-    private static class TestMessage implements Serializable {
-        /** */
-        private final byte[] arr = new byte[MSG_SIZE];
-    }
-
-    /**
-     * Test internal task.
-     */
-    @GridInternal
-    private static class TestInternalTask extends GridTestTask {
-        // No-op.
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/GridAffinityMappedTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridAffinityMappedTest.java
 
b/modules/core/src/test/java/org/gridgain/grid/kernal/GridAffinityMappedTest.java
deleted file mode 100644
index a320822..0000000
--- 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridAffinityMappedTest.java
+++ /dev/null
@@ -1,164 +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.cache.affinity.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.processors.cache.distributed.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.util.*;
-
-import static org.apache.ignite.cache.GridCacheMode.*;
-
-/**
- * Tests affinity mapping when {@link 
org.apache.ignite.cache.affinity.GridCacheAffinityKeyMapper} is used.
- */
-public class GridAffinityMappedTest extends GridCommonAbstractTest {
-    /** VM ip finder for TCP discovery. */
-    private static TcpDiscoveryIpFinder ipFinder = new 
TcpDiscoveryVmIpFinder(true);
-
-    /**
-     *
-     */
-    public GridAffinityMappedTest() {
-        super(false);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-        disco.setMaxMissedHeartbeats(Integer.MAX_VALUE);
-        disco.setIpFinder(ipFinder);
-        cfg.setDiscoverySpi(disco);
-
-        if (gridName.endsWith("1"))
-            cfg.setCacheConfiguration(); // Empty cache configuration.
-        else {
-            assert gridName.endsWith("2") || gridName.endsWith("3");
-
-            CacheConfiguration cacheCfg = defaultCacheConfiguration();
-
-            cacheCfg.setCacheMode(PARTITIONED);
-            cacheCfg.setAffinity(new MockCacheAffinityFunction());
-            cacheCfg.setAffinityMapper(new MockCacheAffinityKeyMapper());
-
-            cfg.setCacheConfiguration(cacheCfg);
-            
cfg.setUserAttributes(F.asMap(GridCacheModuloAffinityFunction.IDX_ATTR, 
gridName.endsWith("2") ? 0 : 1));
-        }
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        startGrid(1);
-        startGrid(2);
-        startGrid(3);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopGrid(1);
-        stopGrid(2);
-        stopGrid(3);
-    }
-
-    /**
-     * @throws IgniteCheckedException If failed.
-     */
-    public void testMappedAffinity() throws IgniteCheckedException {
-        Ignite g1 = grid(1);
-        Ignite g2 = grid(2);
-        Ignite g3 = grid(3);
-
-        assert g1.configuration().getCacheConfiguration().length == 0;
-        assert g2.configuration().getCacheConfiguration()[0].getCacheMode() == 
PARTITIONED;
-        assert g3.configuration().getCacheConfiguration()[0].getCacheMode() == 
PARTITIONED;
-
-        ClusterNode first = g2.cluster().localNode();
-        ClusterNode second = g3.cluster().localNode();
-
-        //When MockCacheAfinity and MockCacheAffinityKeyMapper are set to 
cache configuration we expect the following.
-        //Key 0 is mapped to partition 0, first node.
-        //Key 1 is mapped to partition 1, second node.
-        //key 2 is mapped to partition 0, first node because mapper 
substitutes key 2 with affinity key 0.
-        Map<ClusterNode, Collection<Integer>> map = 
g1.cluster().mapKeysToNodes(null, F.asList(0));
-
-        assertNotNull(map);
-        assertEquals("Invalid map size: " + map.size(), 1, map.size());
-        assertEquals(F.first(map.keySet()), first);
-
-        UUID id1 = g1.cluster().mapKeyToNode(null, 1).id();
-
-        assertNotNull(id1);
-        assertEquals(second.id(),  id1);
-
-        UUID id2 = g1.cluster().mapKeyToNode(null, 2).id();
-
-        assertNotNull(id2);
-        assertEquals(first.id(),  id2);
-    }
-
-    /**
-     * Mock affinity implementation that ensures constant key-to-node mapping 
based on {@link GridCacheModuloAffinityFunction}
-     * The partition selection is as follows: 0 maps to partition 0 and any 
other value maps to partition 1
-     */
-    private static class MockCacheAffinityFunction extends 
GridCacheModuloAffinityFunction {
-        /**
-         * Initializes module affinity with 2 parts and 0 backups
-         */
-        private MockCacheAffinityFunction() {
-            super(2, 0);
-        }
-
-        /** {@inheritDoc} */
-        @Override public int partition(Object key) {
-            return Integer.valueOf(0) == key ? 0 : 1;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void reset() {
-            //no-op
-        }
-    }
-
-    /**
-     * Mock affinity mapper implementation that substitutes values other than 
0 and 1 with 0.
-     */
-    private static class MockCacheAffinityKeyMapper implements 
GridCacheAffinityKeyMapper {
-        /** {@inheritDoc} */
-        @Override public Object affinityKey(Object key) {
-            return key instanceof Integer ? 1 == (Integer)key ? key : 0 : key;
-        }
-
-        /** {@inheritDoc} */
-        @Override public void reset() {
-            // This mapper is stateless and needs no initialization logic.
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/GridAffinityP2PSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridAffinityP2PSelfTest.java
 
b/modules/core/src/test/java/org/gridgain/grid/kernal/GridAffinityP2PSelfTest.java
deleted file mode 100644
index 5b23004..0000000
--- 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridAffinityP2PSelfTest.java
+++ /dev/null
@@ -1,205 +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.cache.affinity.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.internal.processors.cache.distributed.*;
-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.*;
-import org.apache.ignite.testframework.config.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.net.*;
-import java.util.*;
-
-import static org.apache.ignite.cache.GridCacheMode.*;
-
-/**
- * Tests affinity and affinity mapper P2P loading.
- */
-public class GridAffinityP2PSelfTest extends GridCommonAbstractTest {
-    /** VM ip finder for TCP discovery. */
-    private static TcpDiscoveryIpFinder ipFinder = new 
TcpDiscoveryVmIpFinder(true);
-
-    /** */
-    private static final String EXT_AFFINITY_MAPPER_CLS_NAME = 
"org.gridgain.grid.tests.p2p.GridExternalAffinityMapper";
-
-    /** */
-    private static final String EXT_AFFINITY_CLS_NAME = 
"org.gridgain.grid.tests.p2p.GridExternalAffinity";
-
-    /** URL of classes. */
-    private static final URL[] URLS;
-
-    /** Current deployment mode. Used in {@link #getConfiguration(String)}. */
-    private IgniteDeploymentMode depMode;
-
-    /**
-     * Initialize URLs.
-     */
-    static {
-        try {
-            URLS = new URL[] {new 
URL(GridTestProperties.getProperty("p2p.uri.cls"))};
-        }
-        catch (MalformedURLException e) {
-            throw new RuntimeException("Define property p2p.uri.cls", e);
-        }
-    }
-
-    /**
-     *
-     */
-    public GridAffinityP2PSelfTest() {
-        super(false);
-    }
-
-    /** {@inheritDoc} */
-    @SuppressWarnings({"unchecked"})
-    @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
-        IgniteConfiguration c = super.getConfiguration(gridName);
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setMaxMissedHeartbeats(Integer.MAX_VALUE);
-        disco.setIpFinder(ipFinder);
-
-        c.setDiscoverySpi(disco);
-
-        c.setDeploymentMode(depMode);
-
-        if (gridName.endsWith("1"))
-            c.setCacheConfiguration(); // Empty cache configuration.
-        else {
-            assert gridName.endsWith("2") || gridName.endsWith("3");
-
-            CacheConfiguration cc = defaultCacheConfiguration();
-
-            cc.setCacheMode(PARTITIONED);
-
-            GridTestExternalClassLoader ldr = new 
GridTestExternalClassLoader(URLS);
-
-            
cc.setAffinity((GridCacheAffinityFunction)ldr.loadClass(EXT_AFFINITY_CLS_NAME).newInstance());
-            
cc.setAffinityMapper((GridCacheAffinityKeyMapper)ldr.loadClass(EXT_AFFINITY_MAPPER_CLS_NAME)
-                .newInstance());
-
-            c.setCacheConfiguration(cc);
-            
c.setUserAttributes(F.asMap(GridCacheModuloAffinityFunction.IDX_ATTR, 
gridName.endsWith("2") ? 0 : 1));
-        }
-
-        return c;
-    }
-
-    /**
-     * Test {@link 
org.apache.ignite.configuration.IgniteDeploymentMode#PRIVATE} mode.
-     *
-     * @throws Exception if error occur.
-     */
-    public void testPrivateMode() throws Exception {
-        depMode = IgniteDeploymentMode.PRIVATE;
-
-        affinityTest();
-    }
-
-    /**
-     * Test {@link 
org.apache.ignite.configuration.IgniteDeploymentMode#ISOLATED} mode.
-     *
-     * @throws Exception if error occur.
-     */
-    public void testIsolatedMode() throws Exception {
-        depMode = IgniteDeploymentMode.ISOLATED;
-
-        affinityTest();
-    }
-
-    /**
-     * Test {@link 
org.apache.ignite.configuration.IgniteDeploymentMode#CONTINUOUS} mode.
-     *
-     * @throws Exception if error occur.
-     */
-    public void testContinuousMode() throws Exception {
-        depMode = IgniteDeploymentMode.CONTINUOUS;
-
-        affinityTest();
-    }
-
-    /**
-     * Test {@link 
org.apache.ignite.configuration.IgniteDeploymentMode#SHARED} mode.
-     *
-     * @throws Exception if error occur.
-     */
-    public void testSharedMode() throws Exception {
-        depMode = IgniteDeploymentMode.SHARED;
-
-        affinityTest();
-    }
-
-    /** @throws Exception If failed. */
-    private void affinityTest() throws Exception {
-        Ignite g1 = startGrid(1);
-        Ignite g2 = startGrid(2);
-        Ignite g3 = startGrid(3);
-
-        try {
-            assert g1.configuration().getCacheConfiguration().length == 0;
-            assert 
g2.configuration().getCacheConfiguration()[0].getCacheMode() == PARTITIONED;
-            assert 
g3.configuration().getCacheConfiguration()[0].getCacheMode() == PARTITIONED;
-
-            ClusterNode first = g2.cluster().localNode();
-            ClusterNode second = g3.cluster().localNode();
-
-            //When external affinity and mapper are set to cache configuration 
we expect the following.
-            //Key 0 is mapped to partition 0, first node.
-            //Key 1 is mapped to partition 1, second node.
-            //key 2 is mapped to partition 0, first node because mapper 
substitutes key 2 with affinity key 0.
-            Map<ClusterNode, Collection<Integer>> map = 
g1.cluster().mapKeysToNodes(null, F.asList(0));
-
-            assertNotNull(map);
-            assertEquals("Invalid map size: " + map.size(), 1, map.size());
-            assertEquals(F.first(map.keySet()), first);
-
-            ClusterNode n1 = g1.cluster().mapKeyToNode(null, 1);
-
-            assertNotNull(n1);
-
-            UUID id1 = n1.id();
-
-            assertNotNull(id1);
-            assertEquals(second.id(), id1);
-
-            ClusterNode n2 = g1.cluster().mapKeyToNode(null, 2);
-
-            assertNotNull(n2);
-
-            UUID id2 = n2.id();
-
-            assertNotNull(id2);
-            assertEquals(first.id(), id2);
-        }
-        finally {
-            stopGrid(1);
-            stopGrid(2);
-            stopGrid(3);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/GridAffinitySelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridAffinitySelfTest.java 
b/modules/core/src/test/java/org/gridgain/grid/kernal/GridAffinitySelfTest.java
deleted file mode 100644
index 38214f8..0000000
--- 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridAffinitySelfTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.gridgain.grid.kernal;
-
-import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
-import org.apache.ignite.cluster.*;
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.lang.*;
-import org.apache.ignite.spi.discovery.tcp.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
-import org.apache.ignite.internal.util.typedef.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.testframework.junits.common.*;
-
-import java.util.*;
-
-import static org.apache.ignite.cache.GridCacheMode.*;
-
-/**
- * Tests affinity mapping.
- */
-public class GridAffinitySelfTest extends GridCommonAbstractTest {
-    /** VM ip finder for TCP discovery. */
-    private static final TcpDiscoveryIpFinder IP_FINDER = new 
TcpDiscoveryVmIpFinder(true);
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
-        disco.setMaxMissedHeartbeats(Integer.MAX_VALUE);
-        disco.setIpFinder(IP_FINDER);
-
-        cfg.setDiscoverySpi(disco);
-
-        if (gridName.endsWith("1"))
-            cfg.setCacheConfiguration(); // Empty cache configuration.
-        else {
-            assert gridName.endsWith("2");
-
-            CacheConfiguration cacheCfg = defaultCacheConfiguration();
-
-            cacheCfg.setCacheMode(PARTITIONED);
-            cacheCfg.setBackups(1);
-
-            cfg.setCacheConfiguration(cacheCfg);
-        }
-
-        return cfg;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        startGridsMultiThreaded(1, 2);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        stopAllGrids();
-    }
-
-    /**
-     * @throws IgniteCheckedException If failed.
-     */
-    public void testAffinity() throws IgniteCheckedException {
-        Ignite g1 = grid(1);
-        Ignite g2 = grid(2);
-
-        assert caches(g1).size() == 0;
-        assert F.first(caches(g2)).getCacheMode() == PARTITIONED;
-
-        Map<ClusterNode, Collection<String>> map = 
g1.cluster().mapKeysToNodes(null, F.asList("1"));
-
-        assertNotNull(map);
-        assertEquals("Invalid map size: " + map.size(), 1, map.size());
-        assertEquals(F.first(map.keySet()), g2.cluster().localNode());
-
-        UUID id1 = g1.cluster().mapKeyToNode(null, "2").id();
-
-        assertNotNull(id1);
-        assertEquals(g2.cluster().localNode().id(), id1);
-
-        UUID id2 = g1.cluster().mapKeyToNode(null, "3").id();
-
-        assertNotNull(id2);
-        assertEquals(g2.cluster().localNode().id(), id2);
-    }
-
-    /**
-     * @param g Grid.
-     * @return Non-system caches.
-     */
-    private Collection<CacheConfiguration> caches(Ignite g) {
-        return 
F.view(Arrays.asList(g.configuration().getCacheConfiguration()), new 
IgnitePredicate<CacheConfiguration>() {
-            @Override public boolean apply(CacheConfiguration c) {
-                return c.getName() == null || 
!c.getName().equals(CU.UTILITY_CACHE_NAME);
-            }
-        });
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/537f631a/modules/core/src/test/java/org/gridgain/grid/kernal/GridAlwaysFailoverSpiFailSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/gridgain/grid/kernal/GridAlwaysFailoverSpiFailSelfTest.java
 
b/modules/core/src/test/java/org/gridgain/grid/kernal/GridAlwaysFailoverSpiFailSelfTest.java
deleted file mode 100644
index e20df5c..0000000
--- 
a/modules/core/src/test/java/org/gridgain/grid/kernal/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.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.spi.failover.*;
-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.*;
-
-/**
- * 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 (IgniteCheckedException 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 IgniteCheckedException("Task should NOT be failed over"));
-
-            assert false;
-        }
-        catch (IgniteCheckedException 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 IgniteCheckedException;
-
-            Collection<ComputeJob> res = new ArrayList<>(gridSize);
-
-            for (int i = 0; i < gridSize; i++)
-                res.add(new GridTestFailoverJob((IgniteCheckedException)arg));
-
-            return res;
-        }
-
-        /** {@inheritDoc} */
-        @Override public ComputeJobResultPolicy result(ComputeJobResult res,
-            List<ComputeJobResult> received) throws IgniteCheckedException {
-            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(IgniteCheckedException ex) { super(ex); }
-
-        /** {@inheritDoc} */
-        @Override public IgniteCheckedException execute() throws 
IgniteCheckedException {
-            throw this.<IgniteCheckedException>argument(0);
-        }
-    }
-}

Reply via email to