You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/09/04 18:27:28 UTC
[14/55] [abbrv] ignite git commit: IGNITE-1348: Moved GridGain's .Net
module to Ignite.
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cec202c/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs
index 73c9bcb..2b0ab8e 100644
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs
+++ b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/TestRunner.cs
@@ -20,6 +20,8 @@ namespace Apache.Ignite.Core.Tests
using System;
using System.Diagnostics;
using System.Reflection;
+ using Apache.Ignite.Core.Tests.Memory;
+ using NUnit.ConsoleRunner;
public static class TestRunner
{
@@ -31,16 +33,15 @@ namespace Apache.Ignite.Core.Tests
//TestOne(typeof(ContinuousQueryAtomiclBackupTest), "TestInitialQuery");
- //TestAll(typeof(IgnitionTest));
-
- TestAllInAssembly();
+ TestAll(typeof (ExecutableTest));
+ //TestAllInAssembly();
}
private static void TestOne(Type testClass, string method)
{
string[] args = { "/run:" + testClass.FullName + "." + method, Assembly.GetAssembly(testClass).Location };
- int returnCode = NUnit.ConsoleRunner.Runner.Main(args);
+ int returnCode = Runner.Main(args);
if (returnCode != 0)
Console.Beep();
@@ -50,7 +51,7 @@ namespace Apache.Ignite.Core.Tests
{
string[] args = { "/run:" + testClass.FullName, Assembly.GetAssembly(testClass).Location };
- int returnCode = NUnit.ConsoleRunner.Runner.Main(args);
+ int returnCode = Runner.Main(args);
if (returnCode != 0)
Console.Beep();
@@ -58,9 +59,9 @@ namespace Apache.Ignite.Core.Tests
private static void TestAllInAssembly()
{
- string[] args = { Assembly.GetAssembly(typeof(IgnitionTest)).Location };
+ string[] args = { Assembly.GetAssembly(typeof(InteropMemoryTest)).Location };
- int returnCode = NUnit.ConsoleRunner.Runner.Main(args);
+ int returnCode = Runner.Main(args);
if (returnCode != 0)
Console.Beep();
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cec202c/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
new file mode 100644
index 0000000..ca45d68
--- /dev/null
+++ b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/TestUtils.cs
@@ -0,0 +1,292 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Tests
+{
+ using System;
+ using System.Collections.Concurrent;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Threading;
+ using Apache.Ignite.Core.Impl;
+ using Apache.Ignite.Core.Tests.Process;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Test utility methods.
+ /// </summary>
+ public static class TestUtils
+ {
+ /** Indicates long running and/or memory/cpu intensive test. */
+ public const string CategoryIntensive = "LONG_TEST";
+
+ /** */
+ public const int DfltBusywaitSleepInterval = 200;
+
+ /** */
+
+ private static readonly IList<string> TestJvmOpts = Environment.Is64BitProcess
+ ? new List<string>
+ {
+ "-XX:+HeapDumpOnOutOfMemoryError",
+ "-Xms1g",
+ "-Xmx4g",
+ "-ea"
+ }
+ : new List<string>
+ {
+ "-XX:+HeapDumpOnOutOfMemoryError",
+ "-Xms512m",
+ "-Xmx512m",
+ "-ea",
+ "-DIGNITE_ATOMIC_CACHE_DELETE_HISTORY_SIZE=1000"
+ };
+
+ /** */
+ private static readonly IList<string> JvmDebugOpts =
+ new List<string> { "-Xdebug", "-Xnoagent", "-Djava.compiler=NONE", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" };
+
+ /** */
+ public static bool JvmDebug = true;
+
+ /** */
+ [ThreadStatic]
+ private static Random _random;
+
+ /** */
+ private static int _seed = Environment.TickCount;
+
+ /// <summary>
+ /// Kill GridGain processes.
+ /// </summary>
+ public static void KillProcesses()
+ {
+ IgniteProcess.KillAll();
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ public static Random Random
+ {
+ get { return _random ?? (_random = new Random(Interlocked.Increment(ref _seed))); }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ public static IList<string> TestJavaOptions()
+ {
+ IList<string> ops = new List<string>(TestJvmOpts);
+
+ if (JvmDebug)
+ {
+ foreach (string opt in JvmDebugOpts)
+ ops.Add(opt);
+ }
+
+ return ops;
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
+ public static string CreateTestClasspath()
+ {
+ return IgniteManager.CreateClasspath(forceTestClasspath: true);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="action"></param>
+ /// <param name="threadNum"></param>
+ public static void RunMultiThreaded(Action action, int threadNum)
+ {
+ List<Thread> threads = new List<Thread>(threadNum);
+
+ var errors = new ConcurrentBag<Exception>();
+
+ for (int i = 0; i < threadNum; i++)
+ {
+ threads.Add(new Thread(() =>
+ {
+ try
+ {
+ action();
+ }
+ catch (Exception e)
+ {
+ errors.Add(e);
+ }
+ }));
+ }
+
+ foreach (Thread thread in threads)
+ thread.Start();
+
+ foreach (Thread thread in threads)
+ thread.Join();
+
+ foreach (var ex in errors)
+ Assert.Fail("Unexpected exception: " + ex);
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="action"></param>
+ /// <param name="threadNum"></param>
+ /// <param name="duration">Duration of test execution in seconds</param>
+ public static void RunMultiThreaded(Action action, int threadNum, int duration)
+ {
+ List<Thread> threads = new List<Thread>(threadNum);
+
+ var errors = new ConcurrentBag<Exception>();
+
+ bool stop = false;
+
+ for (int i = 0; i < threadNum; i++)
+ {
+ threads.Add(new Thread(() =>
+ {
+ try
+ {
+ while (true)
+ {
+ Thread.MemoryBarrier();
+
+ // ReSharper disable once AccessToModifiedClosure
+ if (stop)
+ break;
+
+ action();
+ }
+ }
+ catch (Exception e)
+ {
+ errors.Add(e);
+ }
+ }));
+ }
+
+ foreach (Thread thread in threads)
+ thread.Start();
+
+ Thread.Sleep(duration * 1000);
+
+ stop = true;
+
+ Thread.MemoryBarrier();
+
+ foreach (Thread thread in threads)
+ thread.Join();
+
+ foreach (var ex in errors)
+ Assert.Fail("Unexpected exception: " + ex);
+ }
+
+ /// <summary>
+ /// Wait for particular topology size.
+ /// </summary>
+ /// <param name="grid">Grid.</param>
+ /// <param name="size">Size.</param>
+ /// <param name="timeout">Timeout.</param>
+ /// <returns>
+ /// <c>True</c> if topology took required size.
+ /// </returns>
+ public static bool WaitTopology(this IIgnite grid, int size, int timeout)
+ {
+ int left = timeout;
+
+ while (true)
+ {
+ if (grid.Cluster.Nodes().Count != size)
+ {
+ if (left > 0)
+ {
+ Thread.Sleep(100);
+
+ left -= 100;
+ }
+ else
+ break;
+ }
+ else
+ return true;
+ }
+
+ return false;
+ }
+
+ /// <summary>
+ /// Asserts that the handle registry is empty.
+ /// </summary>
+ /// <param name="timeout">Timeout, in milliseconds.</param>
+ /// <param name="grids">Grids to check.</param>
+ public static void AssertHandleRegistryIsEmpty(int timeout, params IIgnite[] grids)
+ {
+ foreach (var g in grids)
+ AssertHandleRegistryIsEmpty(g, timeout);
+ }
+
+ /// <summary>
+ /// Asserts that the handle registry is empty.
+ /// </summary>
+ /// <param name="grid">The grid to check.</param>
+ /// <param name="timeout">Timeout, in milliseconds.</param>
+ public static void AssertHandleRegistryIsEmpty(IIgnite grid, int timeout)
+ {
+ var handleRegistry = ((Ignite)grid).HandleRegistry;
+
+ if (WaitForCondition(() => handleRegistry.Count == 0, timeout))
+ return;
+
+ var items = handleRegistry.GetItems();
+
+ if (items.Any())
+ Assert.Fail("HandleRegistry is not empty in grid '{0}':\n '{1}'", grid.Name,
+ items.Select(x => x.ToString()).Aggregate((x, y) => x + "\n" + y));
+ }
+
+ /// <summary>
+ /// Waits for condition, polling in busy wait loop.
+ /// </summary>
+ /// <param name="cond">Condition.</param>
+ /// <param name="timeout">Timeout, in milliseconds.</param>
+ /// <returns>True if condition predicate returned true within interval; false otherwise.</returns>
+ public static bool WaitForCondition(Func<bool> cond, int timeout)
+ {
+ if (timeout <= 0)
+ return cond();
+
+ var maxTime = DateTime.Now.AddMilliseconds(timeout + DfltBusywaitSleepInterval);
+
+ while (DateTime.Now < maxTime)
+ {
+ if (cond())
+ return true;
+
+ Thread.Sleep(DfltBusywaitSleepInterval);
+ }
+
+ return false;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cec202c/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/TypeResolverTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/TypeResolverTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/TypeResolverTest.cs
new file mode 100644
index 0000000..a49ee1b
--- /dev/null
+++ b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/TypeResolverTest.cs
@@ -0,0 +1,107 @@
+/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Tests
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Reflection;
+ using Apache.Ignite.Core.Impl.Portable;
+ using Apache.Ignite.Core.Tests.TestDll;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// <see cref="TypeResolver"/> tests.
+ /// </summary>
+ public class TypeResolverTest
+ {
+ /// <summary>
+ /// Tests generic type resolve.
+ /// </summary>
+ [Test]
+ public void TestGenerics()
+ {
+ var testTypes = new[]
+ {
+ typeof (TestGenericPortable<int>),
+ typeof (TestGenericPortable<string>),
+ typeof (TestGenericPortable<TestGenericPortable<int>>),
+ typeof (TestGenericPortable<List<Tuple<int, string>>>),
+ typeof (TestGenericPortable<List<TestGenericPortable<List<Tuple<int, string>>>>>),
+ typeof (List<TestGenericPortable<List<TestGenericPortable<List<Tuple<int, string>>>>>>),
+ typeof (TestGenericPortable<int, string>),
+ typeof (TestGenericPortable<int, TestGenericPortable<string>>),
+ typeof (TestGenericPortable<int, string, Type>),
+ typeof (TestGenericPortable<int, string, TestGenericPortable<int, string, Type>>)
+ };
+
+ foreach (var type in testTypes)
+ {
+ // Without assembly
+ var resolvedType = new TypeResolver().ResolveType(type.FullName);
+ Assert.AreEqual(type.FullName, resolvedType.FullName);
+
+ // With assembly
+ resolvedType = new TypeResolver().ResolveType(type.FullName, type.Assembly.FullName);
+ Assert.AreEqual(type.FullName, resolvedType.FullName);
+
+ // Assembly-qualified
+ resolvedType = new TypeResolver().ResolveType(type.AssemblyQualifiedName);
+ Assert.AreEqual(type.FullName, resolvedType.FullName);
+ }
+ }
+
+ /// <summary>
+ /// Tests loading a type from referenced assembly that is not yet loaded.
+ /// </summary>
+ [Test]
+ public void TestReferencedAssemblyLoading()
+ {
+ const string dllName = "Apache.Ignite.Core.Tests.TestDll";
+
+ const string typeName = "Apache.Ignite.Core.Tests.TestDll.TestClass";
+
+ // Check that the dll is not yet loaded
+ Assert.IsFalse(AppDomain.CurrentDomain.GetAssemblies().Any(x => x.FullName.StartsWith(dllName)));
+
+ // Check that the dll is referenced by current assembly
+ Assert.IsTrue(Assembly.GetExecutingAssembly().GetReferencedAssemblies()
+ .Any(x => x.FullName.StartsWith(dllName)));
+
+ // Check resolver
+ var type = new TypeResolver().ResolveType(typeName);
+
+ Assert.IsNotNull(type);
+ Assert.AreEqual(typeName, type.FullName);
+ Assert.IsNotNull(Activator.CreateInstance(type));
+
+ // At this moment the dll should be loaded
+ Assert.IsTrue(AppDomain.CurrentDomain.GetAssemblies().Any(x => x.FullName.StartsWith(dllName)));
+ }
+
+ /// <summary>
+ /// Unused method that forces C# compiler to include TestDll assembly reference.
+ /// Without this, compiler will remove the reference as unused.
+ /// However, since it is never called, TestDll does not get loaded.
+ /// </summary>
+ public void UnusedMethod()
+ {
+ Assert.IsNotNull(typeof(TestClass));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cec202c/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeBroadcastTask.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeBroadcastTask.java b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeBroadcastTask.java
new file mode 100644
index 0000000..c721e16
--- /dev/null
+++ b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeBroadcastTask.java
@@ -0,0 +1,73 @@
+/*
+ * 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.platform;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobAdapter;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeTaskAdapter;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * Task collecting IDs of all nodes where it was executed.
+ */
+public class PlatformComputeBroadcastTask extends ComputeTaskAdapter<Object, Collection<UUID>> {
+ /** {@inheritDoc} */
+ @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, @Nullable Object arg) {
+ Map<ComputeJob, ClusterNode> jobs = new HashMap<>();
+
+ for (ClusterNode node : subgrid)
+ jobs.put(new BroadcastJob(), node);
+
+ return jobs;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Collection<UUID> reduce(List<ComputeJobResult> results) {
+ List<UUID> ids = new ArrayList<>();
+
+ for (ComputeJobResult res : results)
+ ids.add((UUID)res.getData());
+
+ return ids;
+ }
+
+ /**
+ * Job.
+ */
+ private static class BroadcastJob extends ComputeJobAdapter {
+ /** */
+ @IgniteInstanceResource
+ private Ignite ignite;
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Object execute() {
+ return ignite.cluster().localNode().id();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cec202c/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeDecimalTask.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeDecimalTask.java b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeDecimalTask.java
new file mode 100644
index 0000000..a14e481
--- /dev/null
+++ b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeDecimalTask.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.platform;
+
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobAdapter;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeTaskAdapter;
+import org.apache.ignite.internal.util.typedef.F;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.math.BigDecimal;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+@SuppressWarnings({"ConstantConditions", "UnusedDeclaration"})
+public class PlatformComputeDecimalTask extends ComputeTaskAdapter<Object[], BigDecimal> {
+ /** {@inheritDoc} */
+ @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, @Nullable Object[] arg) {
+ return Collections.singletonMap(new DecimalJob((BigDecimal)arg[0], (String)arg[1]), F.first(subgrid));
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+ @Nullable @Override public BigDecimal reduce(List<ComputeJobResult> results) {
+ ComputeJobResult res = results.get(0);
+
+ if (res.getException() != null)
+ throw res.getException();
+ else
+ return results.get(0).getData();
+ }
+
+ /**
+ * Job.
+ */
+ private static class DecimalJob extends ComputeJobAdapter implements Externalizable {
+ /** Value. */
+ private BigDecimal val;
+
+ /** Value as string. */
+ private String valStr;
+
+ /**
+ * Constructor.
+ */
+ public DecimalJob() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param val Value.
+ * @param valStr Value as string.
+ */
+ private DecimalJob(BigDecimal val, String valStr) {
+ this.val = val;
+ this.valStr = valStr;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Object execute() {
+ BigDecimal exp = new BigDecimal(valStr.replace(',', '.'));
+
+ if (val != null && !exp.equals(val))
+ throw new IgniteException("Actual=" + val);
+
+ return exp;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(val);
+ out.writeObject(valStr);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ val = (BigDecimal)in.readObject();
+ valStr = (String)in.readObject();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cec202c/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
new file mode 100644
index 0000000..f64ca7d
--- /dev/null
+++ b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeEchoTask.java
@@ -0,0 +1,188 @@
+/*
+ * 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.platform;
+
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobAdapter;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeTaskAdapter;
+import org.apache.ignite.internal.util.typedef.F;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Test task producing result without any arguments.
+ */
+public class PlatformComputeEchoTask extends ComputeTaskAdapter<Integer, Object> {
+ /** Type: NULL. */
+ private static final int TYPE_NULL = 0;
+
+ /** Type: byte. */
+ private static final int TYPE_BYTE = 1;
+
+ /** Type: bool. */
+ private static final int TYPE_BOOL = 2;
+
+ /** Type: short. */
+ private static final int TYPE_SHORT = 3;
+
+ /** Type: char. */
+ private static final int TYPE_CHAR = 4;
+
+ /** Type: int. */
+ private static final int TYPE_INT = 5;
+
+ /** Type: long. */
+ private static final int TYPE_LONG = 6;
+
+ /** Type: float. */
+ private static final int TYPE_FLOAT = 7;
+
+ /** Type: double. */
+ private static final int TYPE_DOUBLE = 8;
+
+ /** Type: array. */
+ private static final int TYPE_ARRAY = 9;
+
+ /** Type: collection. */
+ private static final int TYPE_COLLECTION = 10;
+
+ /** Type: map. */
+ private static final int TYPE_MAP = 11;
+
+ /** Type: portable object which exists in all platforms. */
+ private static final int TYPE_PORTABLE = 12;
+
+ /** Type: portable object which exists only in Java. */
+ private static final int TYPE_PORTABLE_JAVA = 13;
+
+ /** Type: object array. */
+ private static final int TYPE_OBJ_ARRAY = 14;
+
+ /** Type: portable object array. */
+ private static final int TYPE_PORTABLE_ARRAY = 15;
+
+ /** Type: enum. */
+ private static final int TYPE_ENUM = 16;
+
+ /** Type: enum array. */
+ private static final int TYPE_ENUM_ARRAY = 17;
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
+ @Nullable Integer arg) {
+ return Collections.singletonMap(new EchoJob(arg), F.first(subgrid));
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Object reduce(List<ComputeJobResult> results) {
+ return results.get(0).getData();
+ }
+
+ /**
+ * Job.
+ */
+ private static class EchoJob extends ComputeJobAdapter {
+ /** Type. */
+ private Integer type;
+
+ /**
+ * Constructor.
+ *
+ * @param type Result type.
+ */
+ public EchoJob(Integer type) {
+ this.type = type;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Object execute() {
+ switch (type) {
+ case TYPE_NULL:
+ return null;
+
+ case TYPE_BYTE:
+ return (byte)1;
+
+ case TYPE_BOOL:
+ return true;
+
+ case TYPE_SHORT:
+ return (short)1;
+
+ case TYPE_CHAR:
+ return (char)1;
+
+ case TYPE_INT:
+ return 1;
+
+ case TYPE_LONG:
+ return (long)1;
+
+ case TYPE_FLOAT:
+ return (float)1;
+
+ case TYPE_DOUBLE:
+ return (double)1;
+
+ case TYPE_ARRAY:
+ return new int[] { 1 };
+
+ case TYPE_COLLECTION:
+ return Collections.singletonList(1);
+
+ case TYPE_MAP:
+ return Collections.singletonMap(1, 1);
+
+ case TYPE_PORTABLE:
+ return new PlatformComputePortable(1);
+
+ case TYPE_PORTABLE_JAVA:
+ return new PlatformComputeJavaPortable(1);
+
+ case TYPE_OBJ_ARRAY:
+ return new String[] { "foo", "bar", "baz" };
+
+ case TYPE_PORTABLE_ARRAY:
+ return new PlatformComputePortable[] {
+ new PlatformComputePortable(1),
+ new PlatformComputePortable(2),
+ new PlatformComputePortable(3)
+ };
+
+ case TYPE_ENUM:
+ return PlatformComputeEnum.BAR;
+
+ case TYPE_ENUM_ARRAY:
+ return new PlatformComputeEnum[] {
+ PlatformComputeEnum.BAR,
+ PlatformComputeEnum.BAZ,
+ PlatformComputeEnum.FOO
+ };
+
+ default:
+ throw new IgniteException("Unknown type: " + type);
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cec202c/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeEnum.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeEnum.java b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeEnum.java
new file mode 100644
index 0000000..7fc0623
--- /dev/null
+++ b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeEnum.java
@@ -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.
+ */
+
+package org.apache.ignite.platform;
+
+/**
+ * Test enum.
+ */
+public enum PlatformComputeEnum
+{
+ FOO,
+ BAR,
+ BAZ
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cec202c/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeJavaPortable.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeJavaPortable.java b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeJavaPortable.java
new file mode 100644
index 0000000..7a940c4
--- /dev/null
+++ b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputeJavaPortable.java
@@ -0,0 +1,39 @@
+/*
+ * 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.platform;
+
+/**
+ * Portable object defined only in Java.
+ */
+public class PlatformComputeJavaPortable extends PlatformComputePortable {
+ /**
+ * Constructor.
+ */
+ public PlatformComputeJavaPortable() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param field Field.
+ */
+ public PlatformComputeJavaPortable(int field) {
+ super(field);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cec202c/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortable.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortable.java b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortable.java
new file mode 100644
index 0000000..f31f093
--- /dev/null
+++ b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortable.java
@@ -0,0 +1,42 @@
+/*
+ * 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.platform;
+
+/**
+ * Portable object for task tests.
+ */
+public class PlatformComputePortable {
+ /** Field. */
+ public int field;
+
+ /**
+ * Constructor.
+ */
+ public PlatformComputePortable() {
+ // No-op.
+ }
+
+ /**
+ * Constructor,
+ *
+ * @param field Field.
+ */
+ public PlatformComputePortable(int field) {
+ this.field = field;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cec202c/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java
new file mode 100644
index 0000000..0e8b825
--- /dev/null
+++ b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformComputePortableArgTask.java
@@ -0,0 +1,119 @@
+/*
+ * 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.platform;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobAdapter;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeTaskAdapter;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.portable.PortableMetadata;
+import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Task working with portable argument.
+ */
+public class PlatformComputePortableArgTask extends ComputeTaskAdapter<Object, Integer> {
+ /** {@inheritDoc} */
+ @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, @Nullable Object arg) {
+ return Collections.singletonMap(new PortableArgJob(arg), F.first(subgrid));
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+ @Nullable @Override public Integer reduce(List<ComputeJobResult> results) {
+ ComputeJobResult res = results.get(0);
+
+ if (res.getException() != null)
+ throw res.getException();
+ else
+ return results.get(0).getData();
+ }
+
+ /**
+ * Job.
+ */
+ private static class PortableArgJob extends ComputeJobAdapter implements Externalizable {
+ /** */
+ @IgniteInstanceResource
+ private Ignite ignite;
+
+ /** Argument. */
+ private Object arg;
+
+ /**
+ * Constructor.
+ */
+ public PortableArgJob() {
+ // No-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param arg Argument.
+ */
+ private PortableArgJob(Object arg) {
+ this.arg = arg;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Object execute() {
+ PortableObject arg0 = ((PortableObject)arg);
+
+ PortableMetadata meta = ignite.portables().metadata(arg0.typeId());
+
+ if (meta == null)
+ throw new IgniteException("Metadata doesn't exist.");
+
+ if (meta.fields() == null || !meta.fields().contains("Field"))
+ throw new IgniteException("Field metadata doesn't exist.");
+
+ if (!F.eq("int", meta.fieldTypeName("Field")))
+ throw new IgniteException("Invalid field type: " + meta.fieldTypeName("Field"));
+
+ if (meta.affinityKeyFieldName() != null)
+ throw new IgniteException("Unexpected affinity key: " + meta.affinityKeyFieldName());
+
+ return arg0.field("field");
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject(arg);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ arg = in.readObject();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cec202c/modules/platform/src/test/java/org/apache/ignite/platform/PlatformEventsWriteEventTask.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformEventsWriteEventTask.java b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformEventsWriteEventTask.java
new file mode 100644
index 0000000..d9dee9d
--- /dev/null
+++ b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformEventsWriteEventTask.java
@@ -0,0 +1,146 @@
+/*
+ * 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.platform;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobAdapter;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeTaskAdapter;
+import org.apache.ignite.events.CacheEvent;
+import org.apache.ignite.events.CacheQueryExecutedEvent;
+import org.apache.ignite.events.CacheQueryReadEvent;
+import org.apache.ignite.events.CacheRebalancingEvent;
+import org.apache.ignite.events.CheckpointEvent;
+import org.apache.ignite.events.DiscoveryEvent;
+import org.apache.ignite.events.JobEvent;
+import org.apache.ignite.events.SwapSpaceEvent;
+import org.apache.ignite.events.TaskEvent;
+import org.apache.ignite.internal.portable.PortableRawWriterEx;
+import org.apache.ignite.internal.processors.platform.PlatformContext;
+import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
+import org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream;
+import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.lang.IgniteUuid;
+import org.apache.ignite.events.*;
+
+import org.apache.ignite.plugin.security.SecurityPermission;
+import org.apache.ignite.plugin.security.SecuritySubjectType;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * Test task writing all events to a stream.
+ */
+@SuppressWarnings("UnusedDeclaration")
+public class PlatformEventsWriteEventTask extends ComputeTaskAdapter<Long, Object> {
+ /** {@inheritDoc} */
+ @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
+ Long ptr) {
+ return Collections.singletonMap(new Job(ptr, F.first(subgrid)), F.first(subgrid));
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Object reduce(List<ComputeJobResult> results) {
+ return results.get(0).getData();
+ }
+
+ /**
+ * Job.
+ */
+ @SuppressWarnings("deprecation")
+ private static class Job extends ComputeJobAdapter {
+ /** Grid. */
+ @IgniteInstanceResource
+ protected transient Ignite ignite;
+
+ /** Stream ptr. */
+ private final long ptr;
+
+ private final ClusterNode node;
+
+ /**
+ * Constructor.
+ *
+ * @param ptr Stream ptr.
+ */
+ public Job(long ptr, ClusterNode node) {
+ this.ptr = ptr;
+ this.node = node;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Object execute() {
+ PlatformContext ctx = PlatformUtils.platformContext(ignite);
+
+ try (PlatformMemory mem = ctx.memory().get(ptr)) {
+ PlatformOutputStream out = mem.output();
+ PortableRawWriterEx writer = ctx.writer(out);
+
+ int evtType = EventType.EVT_SWAP_SPACE_CLEARED;
+ String msg = "msg";
+ UUID uuid = new UUID(1, 2);
+ IgniteUuid igniteUuid = new IgniteUuid(uuid, 3);
+
+ ctx.writeEvent(writer, new CacheEvent("cacheName", node, node, "msg", evtType, 1, true, 2,
+ igniteUuid, 3, 4, true, 5, true, uuid, "cloClsName", "taskName"));
+
+ //noinspection unchecked
+ ctx.writeEvent(writer, new CacheQueryExecutedEvent(node, msg, evtType, "qryType", "cacheName",
+ "clsName", "clause", null, null, null, uuid, "taskName"));
+
+ //noinspection unchecked
+ ctx.writeEvent(writer, new CacheQueryReadEvent(node, msg, evtType, "qryType", "cacheName",
+ "clsName", "clause", null, null, null, uuid, "taskName", 1, 2, 3, 4));
+
+ ctx.writeEvent(writer, new CacheRebalancingEvent("cacheName", node, msg, evtType, 1, node, 2, 3));
+
+ ctx.writeEvent(writer, new CheckpointEvent(node, msg, evtType, "cpKey"));
+
+ DiscoveryEvent discoveryEvent = new DiscoveryEvent(node, msg, evtType, node);
+ discoveryEvent.topologySnapshot(ignite.cluster().topologyVersion(), ignite.cluster().nodes());
+ ctx.writeEvent(writer, discoveryEvent);
+
+ JobEvent jobEvent = new JobEvent(node, msg, evtType);
+ jobEvent.jobId(igniteUuid);
+ jobEvent.taskClassName("taskClsName");
+ jobEvent.taskName("taskName");
+ jobEvent.taskNode(node);
+ jobEvent.taskSessionId(igniteUuid);
+ jobEvent.taskSubjectId(uuid);
+ ctx.writeEvent(writer, jobEvent);
+
+ ctx.writeEvent(writer, new SwapSpaceEvent(node, msg, evtType, "space"));
+
+ ctx.writeEvent(writer, new TaskEvent(node, msg, evtType, igniteUuid, "taskName", "taskClsName",
+ true, uuid));
+
+ out.synchronize();
+ }
+
+ return true;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cec202c/modules/platform/src/test/java/org/apache/ignite/platform/PlatformMaxMemoryTask.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformMaxMemoryTask.java b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformMaxMemoryTask.java
new file mode 100644
index 0000000..6effb0f
--- /dev/null
+++ b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformMaxMemoryTask.java
@@ -0,0 +1,57 @@
+/*
+ * 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.platform;
+
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobAdapter;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeTaskAdapter;
+import org.apache.ignite.internal.util.typedef.F;
+import org.jetbrains.annotations.Nullable;
+
+import java.lang.management.ManagementFactory;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Task to get max Java heap memory for node.
+ */
+public class PlatformMaxMemoryTask extends ComputeTaskAdapter<Object, Long> {
+ /** {@inheritDoc} */
+ @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
+ @Nullable Object arg) {
+ return Collections.singletonMap(new MaxMemoryJob(), F.first(subgrid));
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Long reduce(List<ComputeJobResult> results) {
+ return results.get(0).getData();
+ }
+
+ /**
+ * Job.
+ */
+ private static class MaxMemoryJob extends ComputeJobAdapter {
+ /** {@inheritDoc} */
+ @Nullable @Override public Object execute() {
+ return ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cec202c/modules/platform/src/test/java/org/apache/ignite/platform/PlatformMinMemoryTask.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/PlatformMinMemoryTask.java b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformMinMemoryTask.java
new file mode 100644
index 0000000..23292f7
--- /dev/null
+++ b/modules/platform/src/test/java/org/apache/ignite/platform/PlatformMinMemoryTask.java
@@ -0,0 +1,57 @@
+/*
+ * 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.platform;
+
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobAdapter;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeTaskAdapter;
+import org.apache.ignite.internal.util.typedef.F;
+import org.jetbrains.annotations.Nullable;
+
+import java.lang.management.ManagementFactory;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Task to get min Java heap memory for node.
+ */
+public class PlatformMinMemoryTask extends ComputeTaskAdapter<Object, Long> {
+ /** {@inheritDoc} */
+ @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
+ @Nullable Object arg) {
+ return Collections.singletonMap(new MinMemoryJob(), F.first(subgrid));
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Long reduce(List<ComputeJobResult> results) {
+ return results.get(0).getData();
+ }
+
+ /**
+ * Job.
+ */
+ private static class MinMemoryJob extends ComputeJobAdapter {
+ /** {@inheritDoc} */
+ @Nullable @Override public Object execute() {
+ return ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getInit();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cec202c/modules/platform/src/test/java/org/apache/ignite/platform/lifecycle/PlatformJavaLifecycleBean.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/lifecycle/PlatformJavaLifecycleBean.java b/modules/platform/src/test/java/org/apache/ignite/platform/lifecycle/PlatformJavaLifecycleBean.java
new file mode 100644
index 0000000..d60912b
--- /dev/null
+++ b/modules/platform/src/test/java/org/apache/ignite/platform/lifecycle/PlatformJavaLifecycleBean.java
@@ -0,0 +1,47 @@
+/*
+ * 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.platform.lifecycle;
+
+import org.apache.ignite.lifecycle.LifecycleBean;
+import org.apache.ignite.lifecycle.LifecycleEventType;
+
+/**
+ * Java lifecycle bean.
+ */
+public class PlatformJavaLifecycleBean implements LifecycleBean {
+ /** Count of "beforeStart" invocations. */
+ public static volatile int beforeStartCnt;
+
+ /** Count of "afterStart" invocations. */
+ public static volatile int afterStartCnt;
+
+ /** {@inheritDoc} */
+ @Override public void onLifecycleEvent(LifecycleEventType evt) {
+ switch (evt) {
+ case BEFORE_NODE_START:
+ beforeStartCnt++;
+
+ break;
+
+ case AFTER_NODE_START:
+ afterStartCnt++;
+
+ break;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cec202c/modules/platform/src/test/java/org/apache/ignite/platform/lifecycle/PlatformJavaLifecycleTask.java
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/java/org/apache/ignite/platform/lifecycle/PlatformJavaLifecycleTask.java b/modules/platform/src/test/java/org/apache/ignite/platform/lifecycle/PlatformJavaLifecycleTask.java
new file mode 100644
index 0000000..ec01da1
--- /dev/null
+++ b/modules/platform/src/test/java/org/apache/ignite/platform/lifecycle/PlatformJavaLifecycleTask.java
@@ -0,0 +1,65 @@
+/*
+ * 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.platform.lifecycle;
+
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobAdapter;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeTaskAdapter;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Lifecycle task.
+ */
+public class PlatformJavaLifecycleTask extends ComputeTaskAdapter<Object, List<Integer>> {
+ /** {@inheritDoc} */
+ @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
+ @Nullable Object arg) {
+ Map<ComputeJob, ClusterNode> jobs = new HashMap<>();
+
+ jobs.put(new LifecycleJob(), subgrid.get(0));
+
+ return jobs;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public List<Integer> reduce(List<ComputeJobResult> results) {
+ return results.get(0).getData();
+ }
+
+ /**
+ * Job.
+ */
+ private static class LifecycleJob extends ComputeJobAdapter {
+ /** {@inheritDoc} */
+ @Nullable @Override public Object execute() {
+ List<Integer> res = new ArrayList<Integer>();
+
+ res.add(PlatformJavaLifecycleBean.beforeStartCnt);
+ res.add(PlatformJavaLifecycleBean.afterStartCnt);
+
+ return res;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cec202c/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 69b0cd0..846211b 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -757,6 +757,12 @@
<exclude>**/*.slnrel</exclude>
<exclude>**/*.opensdf</exclude>
<exclude>**/module.def</exclude>
+ <exclude>**/ignite-common.pc.in</exclude>
+ <exclude>**/*.csproj</exclude>
+ <exclude>**/*.fxcop</exclude>
+ <exclude>**/*.metaproj</exclude>
+ <exclude>**/*.metaproj.tmp</exclude>
+ <exclude>**/x64/Debug/**</exclude>
<exclude>**/teamcity_boost.cpp</exclude>
<exclude>**/teamcity_messages.h</exclude>
<exclude>**/teamcity_messages.cpp</exclude>