/// <summary> /// Starts standalone node. /// </summary> private void StartRemoteNodes() { if (_remoteNodeStarted) { return; } // Start a grid to monitor topology; // Stop it after topology check so we don't interfere with example. Ignition.ClientMode = false; using (var ignite = Ignition.StartFromApplicationConfiguration( "igniteConfiguration", PathUtil.ExamplesAppConfigPath)) { var args = new List <string> { "-configFileName=" + PathUtil.ExamplesAppConfigPath, " -assembly=" + typeof(AverageSalaryJob).Assembly.Location }; var proc = new IgniteProcess(args.ToArray()); Assert.IsTrue(ignite.WaitTopology(2), string.Format("Standalone node failed to join topology: [{0}]", proc.GetInfo())); Assert.IsTrue(proc.Alive, string.Format("Standalone node stopped unexpectedly: [{0}]", proc.GetInfo())); } _remoteNodeStarted = true; }
/// <summary> /// Starts standalone node. /// </summary> private void StartRemoteNodes() { if (_remoteNodeStarted) { return; } // Start a grid to monitor topology; // Stop it after topology check so we don't interfere with example. Ignition.ClientMode = false; var fileMap = new ExeConfigurationFileMap { ExeConfigFilename = _configPath }; var config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); var section = (IgniteConfigurationSection)config.GetSection("igniteConfiguration"); // Disable client connector so that temporary node does not occupy the port. var cfg = new IgniteConfiguration(section.IgniteConfiguration) { ClientConnectorConfigurationEnabled = false, CacheConfiguration = null }; using (var ignite = Ignition.Start(cfg)) { var args = new List <string> { "-configFileName=" + _configPath, "-assembly=" + typeof(ExamplesDll::Apache.Ignite.ExamplesDll.Compute.AverageSalaryJob) .Assembly.Location }; var proc = new IgniteProcess(args.ToArray()); Assert.IsTrue(ignite.WaitTopology(2), string.Format("Standalone node failed to join topology: [{0}]", proc.GetInfo())); Assert.IsTrue(proc.Alive, string.Format("Standalone node stopped unexpectedly: [{0}]", proc.GetInfo())); } _remoteNodeStarted = true; }
/// <summary> /// Tests the example with standalone Apache.Ignite.exe nodes. /// </summary> /// <param name="example">The example to run.</param> /// <param name="clientMode">Client mode flag.</param> private static void TestRemoteNodes(Example example, bool clientMode) { Assert.IsNotEmpty(example.ConfigPath); var configPath = Path.Combine(PathUtil.IgniteHome, PathUtil.DevPrefix, example.ConfigPath); // Try with multiple standalone nodes for (var i = 0; i < 2; i++) { // Start a grid to monitor topology // Stop it after topology check so we don't interfere with example Ignition.ClientMode = false; using (var ignite = Ignition.StartFromApplicationConfiguration( "igniteConfiguration", configPath)) { var args = new List <string> { "-configFileName=" + configPath }; if (example.NeedsTestDll) { args.Add(" -assembly=" + typeof(AverageSalaryJob).Assembly.Location); } var proc = new IgniteProcess(args.ToArray()); Assert.IsTrue(ignite.WaitTopology(i + 2), string.Format("Standalone node failed to join topology: [{0}]", proc.GetInfo())); Assert.IsTrue(proc.Alive, string.Format("Standalone node stopped unexpectedly: [{0}]", proc.GetInfo())); } Ignition.ClientMode = clientMode; // Run twice to catch issues with standalone node state example.Run(); example.Run(); } }