/// <summary> /// Checks task execution. /// </summary> /// <param name="grid">Grid.</param> /// <param name="arg">Task arg.</param> private static void CheckTask(IIgnite grid, object arg) { var jobResult = grid.Compute().Execute(new CombineStringsTask(), arg); var nodeCount = grid.Cluster.Nodes().Count; var expectedRes = CombineStringsTask.CombineStrings(Enumerable.Range(0, nodeCount).Select(x => arg.ToString())); Assert.AreEqual(expectedRes, jobResult.InnerXml); }
public void TestWithBeans() { // 1. Test .Net start events. IIgnite grid = Start(CfgBeans); Assert.AreEqual(4, BeforeStartEvts.Count); CheckEvent(BeforeStartEvts[0], null, null, 0, null); CheckEvent(BeforeStartEvts[1], null, null, 1, "1"); CheckEvent(BeforeStartEvts[2], null, null, 0, null); CheckEvent(BeforeStartEvts[3], null, null, 0, null); Assert.AreEqual(4, AfterStartEvts.Count); CheckEvent(AfterStartEvts[0], grid, grid, 0, null); CheckEvent(AfterStartEvts[1], grid, grid, 1, "1"); CheckEvent(AfterStartEvts[2], grid, grid, 0, null); CheckEvent(AfterStartEvts[3], grid, grid, 0, null); // 2. Test Java start events. IList <int> res = grid.Compute().ExecuteJavaTask <IList <int> >( "org.apache.ignite.platform.lifecycle.PlatformJavaLifecycleTask", null); Assert.AreEqual(2, res.Count); Assert.AreEqual(3, res[0]); Assert.AreEqual(3, res[1]); // 3. Test .Net stop events. Ignition.Stop(grid.Name, false); Assert.AreEqual(4, BeforeStartEvts.Count); Assert.AreEqual(4, AfterStartEvts.Count); Assert.AreEqual(4, BeforeStopEvts.Count); CheckEvent(BeforeStopEvts[0], grid, grid, 0, null); CheckEvent(BeforeStopEvts[1], grid, grid, 1, "1"); CheckEvent(BeforeStopEvts[2], grid, grid, 0, null); CheckEvent(BeforeStopEvts[3], grid, grid, 0, null); Assert.AreEqual(4, AfterStopEvts.Count); CheckEvent(AfterStopEvts[0], grid, grid, 0, null); CheckEvent(AfterStopEvts[1], grid, grid, 1, "1"); CheckEvent(AfterStopEvts[2], grid, grid, 0, null); CheckEvent(AfterStopEvts[3], grid, grid, 0, null); }
/// <summary> /// Uses the ignite. /// </summary> /// <param name="ignite">The ignite.</param> private static void UseIgnite(IIgnite ignite) { // Create objects holding references to java objects. var comp = ignite.Compute(); // ReSharper disable once RedundantAssignment comp = comp.WithKeepPortable(); var prj = ignite.Cluster.ForOldest(); Assert.IsTrue(prj.Nodes().Count > 0); Assert.IsNotNull(prj.Compute()); var cache = ignite.Cache <int, int>("cache1"); Assert.IsNotNull(cache); cache.GetAndPut(1, 1); Assert.AreEqual(1, cache.Get(1)); }
/// <summary> /// Uses the ignite. /// </summary> /// <param name="ignite">The ignite.</param> private static void UseIgnite(IIgnite ignite) { // Create objects holding references to java objects. var comp = ignite.Compute(); // ReSharper disable once RedundantAssignment comp = comp.WithKeepPortable(); var prj = ignite.Cluster.ForOldest(); Assert.IsTrue(prj.Nodes().Count > 0); Assert.IsNotNull(prj.Compute()); var cache = ignite.Cache<int, int>("cache1"); Assert.IsNotNull(cache); cache.GetAndPut(1, 1); Assert.AreEqual(1, cache.Get(1)); }
/** <inheritdoc /> */ public ICompute Compute() { return(_ignite.Compute()); }