//test launch method with -D arguments
        /// <exception cref="System.Exception"/>
        public virtual void TestLaunchWithArguments()
        {
            ExitUtil.DisableSystemExit();
            ApplicationHistoryServer historyServer = null;

            try
            {
                // Not able to modify the config of this test case,
                // but others have been customized to avoid conflicts
                string[] args = new string[2];
                args[0]       = "-D" + YarnConfiguration.TimelineServiceLeveldbTtlIntervalMs + "=4000";
                args[1]       = "-D" + YarnConfiguration.TimelineServiceTtlMs + "=200";
                historyServer = ApplicationHistoryServer.LaunchAppHistoryServer(args);
                Configuration conf = historyServer.GetConfig();
                NUnit.Framework.Assert.AreEqual("4000", conf.Get(YarnConfiguration.TimelineServiceLeveldbTtlIntervalMs
                                                                 ));
                NUnit.Framework.Assert.AreEqual("200", conf.Get(YarnConfiguration.TimelineServiceTtlMs
                                                                ));
            }
            catch (ExitUtil.ExitException e)
            {
                NUnit.Framework.Assert.AreEqual(0, e.status);
                ExitUtil.ResetFirstExitException();
                NUnit.Framework.Assert.Fail();
            }
            finally
            {
                if (historyServer != null)
                {
                    historyServer.Stop();
                }
            }
        }
        // test launch method
        /// <exception cref="System.Exception"/>
        public virtual void TestLaunch()
        {
            ExitUtil.DisableSystemExit();
            ApplicationHistoryServer historyServer = null;

            try
            {
                // Not able to modify the config of this test case,
                // but others have been customized to avoid conflicts
                historyServer = ApplicationHistoryServer.LaunchAppHistoryServer(new string[0]);
            }
            catch (ExitUtil.ExitException e)
            {
                NUnit.Framework.Assert.AreEqual(0, e.status);
                ExitUtil.ResetFirstExitException();
                NUnit.Framework.Assert.Fail();
            }
            finally
            {
                if (historyServer != null)
                {
                    historyServer.Stop();
                }
            }
        }
Exemple #3
0
 // test launch method
 /// <exception cref="System.Exception"/>
 public virtual void TestLaunch()
 {
     ExitUtil.DisableSystemExit();
     try
     {
         historyServer = JobHistoryServer.LaunchJobHistoryServer(new string[0]);
     }
     catch (ExitUtil.ExitException e)
     {
         NUnit.Framework.Assert.AreEqual(0, e.status);
         ExitUtil.ResetFirstExitException();
         NUnit.Framework.Assert.Fail();
     }
 }
Exemple #4
0
 private static void ExpectJMXGetExit(string[] args)
 {
     try
     {
         JMXGet.Main(args);
         NUnit.Framework.Assert.Fail("should call exit");
     }
     catch (ExitUtil.ExitException)
     {
         ExitUtil.ResetFirstExitException();
     }
     catch (Exception ex)
     {
         NUnit.Framework.Assert.Fail("expectJMXGetExit ex error " + ex);
     }
 }
        /// <summary>test start form console command without options</summary>
        private void StartStop()
        {
            ByteArrayOutputStream data  = new ByteArrayOutputStream();
            TextWriter            error = System.Console.Error;

            Runtime.SetErr(new TextWriter(data));
            ExitUtil.DisableSystemExit();
            try
            {
                CLI.Main(new string[0]);
                Fail(" CLI.main should call System.exit");
            }
            catch (ExitUtil.ExitException e)
            {
                ExitUtil.ResetFirstExitException();
                NUnit.Framework.Assert.AreEqual(-1, e.status);
            }
            catch (Exception)
            {
            }
            finally
            {
                Runtime.SetErr(error);
            }
            // in console should be written help text
            string s = Sharpen.Runtime.GetStringForBytes(data.ToByteArray());

            NUnit.Framework.Assert.IsTrue(s.Contains("-submit"));
            NUnit.Framework.Assert.IsTrue(s.Contains("-status"));
            NUnit.Framework.Assert.IsTrue(s.Contains("-kill"));
            NUnit.Framework.Assert.IsTrue(s.Contains("-set-priority"));
            NUnit.Framework.Assert.IsTrue(s.Contains("-events"));
            NUnit.Framework.Assert.IsTrue(s.Contains("-history"));
            NUnit.Framework.Assert.IsTrue(s.Contains("-list"));
            NUnit.Framework.Assert.IsTrue(s.Contains("-list-active-trackers"));
            NUnit.Framework.Assert.IsTrue(s.Contains("-list-blacklisted-trackers"));
            NUnit.Framework.Assert.IsTrue(s.Contains("-list-attempt-ids"));
            NUnit.Framework.Assert.IsTrue(s.Contains("-kill-task"));
            NUnit.Framework.Assert.IsTrue(s.Contains("-fail-task"));
            NUnit.Framework.Assert.IsTrue(s.Contains("-logs"));
        }
Exemple #6
0
 public virtual void ClearExitStatus()
 {
     ExitUtil.ResetFirstExitException();
 }
Exemple #7
0
 public virtual void ResetSystemExit()
 {
     ExitUtil.ResetFirstExitException();
 }