Exemple #1
0
            /*
             * If this method is called with isTrackingUrl=false, no tracking url
             * will set in the app report. Hence, there will be a connection exception
             * when the prxyCon tries to connect.
             */
            private AppReportFetcher.FetchedAppReport GetDefaultApplicationReport(ApplicationId
                                                                                  appId, bool isTrackingUrl)
            {
                AppReportFetcher.FetchedAppReport fetchedReport;
                ApplicationReport result = new ApplicationReportPBImpl();

                result.SetApplicationId(appId);
                result.SetYarnApplicationState(YarnApplicationState.Running);
                result.SetUser(CommonConfigurationKeys.DefaultHadoopHttpStaticUser);
                if (isTrackingUrl)
                {
                    result.SetOriginalTrackingUrl("localhost:" + TestWebAppProxyServlet.originalPort
                                                  + "/foo/bar");
                }
                if (this._enclosing.configuration.GetBoolean(YarnConfiguration.ApplicationHistoryEnabled
                                                             , false))
                {
                    fetchedReport = new AppReportFetcher.FetchedAppReport(result, AppReportFetcher.AppReportSource
                                                                          .Ahs);
                }
                else
                {
                    fetchedReport = new AppReportFetcher.FetchedAppReport(result, AppReportFetcher.AppReportSource
                                                                          .Rm);
                }
                return(fetchedReport);
            }
        public virtual void TestRunningApp()
        {
            YarnClient    client = CreateCheckerWithMockedClient();
            ApplicationId id     = ApplicationId.NewInstance(1, 1);
            // create a report and set the state to an active one
            ApplicationReport report = new ApplicationReportPBImpl();

            report.SetYarnApplicationState(YarnApplicationState.Accepted);
            Org.Mockito.Mockito.DoReturn(report).When(client).GetApplicationReport(id);
            NUnit.Framework.Assert.IsTrue(checker.IsApplicationActive(id));
        }