Exemple #1
0
        public void TestInvalidCmdArgs()
        {
            var ignoredWarns = new[]
            {
                "WARNING: An illegal reflective access operation has occurred",
                "WARNING: Illegal reflective access by org.apache.ignite.internal.util.GridUnsafe$2 " +
                "(file:/C:/w/incubator-ignite/modules/core/target/classes/) to field java.nio.Buffer.address",
                "WARNING: Please consider reporting this to the maintainers of org.apache.ignite.internal.util." +
                "GridUnsafe$2",
                "WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations",
                "WARNING: All illegal access operations will be denied in a future release"
            };

            Action <string, string> checkError = (args, err) =>
            {
                var reader = new ListDataReader();
                var proc   = new IgniteProcess(reader, args);

                int exitCode;
                Assert.IsTrue(proc.Join(30000, out exitCode));
                Assert.AreEqual(-1, exitCode);

                Assert.AreEqual(err, reader.GetOutput()
                                .Except(ignoredWarns)
                                .FirstOrDefault(x => !string.IsNullOrWhiteSpace(x)));
            };

            checkError("blabla", "ERROR: Apache.Ignite.Core.Common.IgniteException: Missing argument value: " +
                       "'blabla'. See 'Apache.Ignite.exe /help'");

            checkError("blabla=foo", "ERROR: Apache.Ignite.Core.Common.IgniteException: " +
                       "Unknown argument: 'blabla'. See 'Apache.Ignite.exe /help'");

            checkError("assembly=", "ERROR: Apache.Ignite.Core.Common.IgniteException: Missing argument value: " +
                       "'assembly'. See 'Apache.Ignite.exe /help'");

            checkError("assembly=x.dll", "ERROR: Apache.Ignite.Core.Common.IgniteException: Failed to start " +
                       "Ignite.NET, check inner exception for details ---> Apache.Ignite.Core." +
                       "Common.IgniteException: Failed to load assembly: x.dll");

            checkError("configFileName=wrong.config", "ERROR: System.Configuration.ConfigurationErrorsException: " +
                       "Specified config file does not exist: wrong.config");

            checkError("configSectionName=wrongSection", "ERROR: System.Configuration.ConfigurationErrorsException: " +
                       "Could not find IgniteConfigurationSection " +
                       "in current application configuration");

            checkError("JvmInitialMemoryMB=A_LOT", "ERROR: System.InvalidOperationException: Failed to configure " +
                       "Ignite: property 'JvmInitialMemoryMB' has value 'A_LOT', " +
                       "which is not an integer.");

            checkError("JvmMaxMemoryMB=ALL_OF_IT", "ERROR: System.InvalidOperationException: Failed to configure " +
                       "Ignite: property 'JvmMaxMemoryMB' has value 'ALL_OF_IT', " +
                       "which is not an integer.");
        }
Exemple #2
0
        public void InitClient()
        {
            TestUtils.KillProcesses();

            if (_fork)
            {
                Grid1 = Ignition.Start(Configuration("config\\compute\\compute-standalone.xml"));

                _proc2 = Fork("config\\compute\\compute-standalone.xml");

                while (true)
                {
                    if (!_proc2.Alive)
                    {
                        throw new Exception("Process 2 died unexpectedly: " + _proc2.Join());
                    }

                    if (Grid1.GetCluster().GetNodes().Count < 2)
                    {
                        Thread.Sleep(100);
                    }
                    else
                    {
                        break;
                    }
                }

                _proc3 = Fork("config\\compute\\compute-standalone.xml");

                while (true)
                {
                    if (!_proc3.Alive)
                    {
                        throw new Exception("Process 3 died unexpectedly: " + _proc3.Join());
                    }

                    if (Grid1.GetCluster().GetNodes().Count < 3)
                    {
                        Thread.Sleep(100);
                    }
                    else
                    {
                        break;
                    }
                }
            }
            else
            {
                Grid1  = Ignition.Start(Configuration("config\\compute\\compute-grid1.xml"));
                _grid2 = Ignition.Start(Configuration("config\\compute\\compute-grid2.xml"));
                _grid3 = Ignition.Start(Configuration("config\\compute\\compute-grid3.xml"));
            }
        }
        public void TestInvalidCmdArgs()
        {
            Action <string, string> checkError = (args, err) =>
            {
                var reader = new ListDataReader();
                var proc   = new IgniteProcess(reader, args);

                int exitCode;
                Assert.IsTrue(proc.Join(30000, out exitCode));
                Assert.AreEqual(-1, exitCode);

                lock (reader.List)
                {
                    Assert.AreEqual(err, reader.List.FirstOrDefault(x => !string.IsNullOrWhiteSpace(x)));
                }
            };

            checkError("blabla", "ERROR: Apache.Ignite.Core.Common.IgniteException: Missing argument value: " +
                       "'blabla'. See 'Apache.Ignite.exe /help'");

            checkError("blabla=foo", "ERROR: Apache.Ignite.Core.Common.IgniteException: " +
                       "Unknown argument: 'blabla'. See 'Apache.Ignite.exe /help'");

            checkError("assembly=", "ERROR: Apache.Ignite.Core.Common.IgniteException: Missing argument value: " +
                       "'assembly'. See 'Apache.Ignite.exe /help'");

            checkError("assembly=x.dll", "ERROR: Apache.Ignite.Core.Common.IgniteException: Failed to start " +
                       "Ignite.NET, check inner exception for details ---> Apache.Ignite.Core." +
                       "Common.IgniteException: Failed to load assembly: x.dll");

            checkError("configFileName=wrong.config", "ERROR: System.Configuration.ConfigurationErrorsException: " +
                       "Specified config file does not exist: wrong.config");

            checkError("configSectionName=wrongSection", "ERROR: System.Configuration.ConfigurationErrorsException: " +
                       "Could not find IgniteConfigurationSection " +
                       "in current application configuration");

            checkError("JvmInitialMemoryMB=A_LOT", "ERROR: System.InvalidOperationException: Failed to configure " +
                       "Ignite: property 'JvmInitialMemoryMB' has value 'A_LOT', " +
                       "which is not an integer.");

            checkError("JvmMaxMemoryMB=ALL_OF_IT", "ERROR: System.InvalidOperationException: Failed to configure " +
                       "Ignite: property 'JvmMaxMemoryMB' has value 'ALL_OF_IT', " +
                       "which is not an integer.");
        }
Exemple #4
0
        public void StopClient()
        {
            if (Grid1 != null)
            {
                Ignition.Stop(Grid1.Name, true);
            }

            if (_fork)
            {
                if (_proc2 != null)
                {
                    _proc2.Kill();

                    _proc2.Join();
                }

                if (_proc3 != null)
                {
                    _proc3.Kill();

                    _proc3.Join();
                }
            }
            else
            {
                if (_grid2 != null)
                {
                    Ignition.Stop(_grid2.Name, true);
                }

                if (_grid3 != null)
                {
                    Ignition.Stop(_grid3.Name, true);
                }
            }
        }