Beispiel #1
0
        public virtual void SetUp()
        {
            RMContext mockRMContext = TestRMWebApp.MockRMContext(3, numberOfRacks, numberOfNodesPerRack
                                                                 , 8 * TestRMWebApp.GiB);

            injector = WebAppTests.CreateMockInjector <RMContext>(mockRMContext, new _Module_63
                                                                      (mockRMContext));
        }
Beispiel #2
0
        public virtual void TestControllerIndex()
        {
            Injector injector = WebAppTests.CreateMockInjector <TestRMWebApp>(this, new _Module_82
                                                                                  ());
            RmController c = injector.GetInstance <RmController>();

            c.Index();
            NUnit.Framework.Assert.AreEqual("Applications", c.Get(Params.Title, "unknown"));
        }
Beispiel #3
0
        public virtual void TestAppControllerIndex()
        {
            AppContext    ctx        = new MockAppContext(0, 1, 1, 1);
            Injector      injector   = WebAppTests.CreateMockInjector <AppContext>(ctx);
            AppController controller = injector.GetInstance <AppController>();

            controller.Index();
            NUnit.Framework.Assert.AreEqual(ctx.GetApplicationID().ToString(), controller.Get
                                                (AMParams.AppId, string.Empty));
        }
        public virtual void TestFairSchedulerWebAppPage()
        {
            IList <RMAppState> appStates = Arrays.AsList(RMAppState.New, RMAppState.NewSaving,
                                                         RMAppState.Submitted);
            RMContext rmContext = MockRMContext(appStates);
            Injector  injector  = WebAppTests.CreateMockInjector <RMContext>(rmContext, new _Module_70
                                                                                 (rmContext));
            FairSchedulerPage fsViewInstance = injector.GetInstance <FairSchedulerPage>();

            fsViewInstance.Render();
            WebAppTests.FlushOutput(injector);
        }
Beispiel #5
0
        public virtual void TestAppControllerIndex()
        {
            ApplicationHistoryManager ahManager = Org.Mockito.Mockito.Mock <ApplicationHistoryManager
                                                                            >();
            Injector injector = WebAppTests.CreateMockInjector <ApplicationHistoryManager>(ahManager
                                                                                           );
            AHSController controller = injector.GetInstance <AHSController>();

            controller.Index();
            NUnit.Framework.Assert.AreEqual("Application History", controller.Get(Params.Title
                                                                                  , "unknown"));
        }
Beispiel #6
0
        public virtual void TestSubView()
        {
            Injector injector = WebAppTests.CreateMockInjector(this);

            injector.GetInstance <TestSubViews.MainView>().Render();
            PrintWriter @out = injector.GetInstance <HttpServletResponse>().GetWriter();

            @out.Flush();
            Org.Mockito.Mockito.Verify(@out).Write("sub1 text");
            Org.Mockito.Mockito.Verify(@out).Write("sub2 text");
            Org.Mockito.Mockito.Verify(@out, Org.Mockito.Mockito.Times(16)).WriteLine();
        }
Beispiel #7
0
        public virtual void TestContainerPage()
        {
            Injector injector = WebAppTests.CreateMockInjector <ApplicationBaseProtocol>(MockApplicationHistoryClientService
                                                                                             (1, 1, 1));
            ContainerPage containerPageInstance = injector.GetInstance <ContainerPage>();

            containerPageInstance.Render();
            WebAppTests.FlushOutput(injector);
            containerPageInstance.Set(YarnWebParams.ContainerId, ContainerId.NewContainerId(ApplicationAttemptId
                                                                                            .NewInstance(ApplicationId.NewInstance(0, 1), 1), 1).ToString());
            containerPageInstance.Render();
            WebAppTests.FlushOutput(injector);
        }
Beispiel #8
0
        public virtual void TestAppPage()
        {
            Injector injector = WebAppTests.CreateMockInjector <ApplicationBaseProtocol>(MockApplicationHistoryClientService
                                                                                             (1, 5, 1));
            AppPage appPageInstance = injector.GetInstance <AppPage>();

            appPageInstance.Render();
            WebAppTests.FlushOutput(injector);
            appPageInstance.Set(YarnWebParams.ApplicationId, ApplicationId.NewInstance(0, 1).
                                ToString());
            appPageInstance.Render();
            WebAppTests.FlushOutput(injector);
        }
Beispiel #9
0
        public virtual void TestView()
        {
            Injector injector = WebAppTests.CreateMockInjector <RMContext>(MockRMContext(15, 1
                                                                                         , 2, 8 * GiB), new _Module_98());
            RmView rmViewInstance = injector.GetInstance <RmView>();

            rmViewInstance.Set(YarnWebParams.AppState, YarnApplicationState.Running.ToString(
                                   ));
            rmViewInstance.Render();
            WebAppTests.FlushOutput(injector);
            rmViewInstance.Set(YarnWebParams.AppState, StringHelper.Cjoin(YarnApplicationState
                                                                          .Accepted.ToString(), YarnApplicationState.Running.ToString()));
            rmViewInstance.Render();
            WebAppTests.FlushOutput(injector);
        }
Beispiel #10
0
        public virtual void TestView()
        {
            Injector injector = WebAppTests.CreateMockInjector <ApplicationBaseProtocol>(MockApplicationHistoryClientService
                                                                                             (5, 1, 1));
            AHSView ahsViewInstance = injector.GetInstance <AHSView>();

            ahsViewInstance.Render();
            WebAppTests.FlushOutput(injector);
            ahsViewInstance.Set(YarnWebParams.AppState, YarnApplicationState.Failed.ToString(
                                    ));
            ahsViewInstance.Render();
            WebAppTests.FlushOutput(injector);
            ahsViewInstance.Set(YarnWebParams.AppState, StringHelper.Cjoin(YarnApplicationState
                                                                           .Failed.ToString(), YarnApplicationState.Killed));
            ahsViewInstance.Render();
            WebAppTests.FlushOutput(injector);
        }
Beispiel #11
0
        public virtual void TestNodesPage()
        {
            // 10 nodes. Two of each type.
            RMContext rmContext = MockRMContext(3, 2, 12, 8 * GiB);
            Injector  injector  = WebAppTests.CreateMockInjector <RMContext>(rmContext, new _Module_129
                                                                                 (rmContext));
            // All nodes
            NodesPage instance = injector.GetInstance <NodesPage>();

            instance.Render();
            WebAppTests.FlushOutput(injector);
            // Unhealthy nodes
            instance.MoreParams()[YarnWebParams.NodeState] = NodeState.Unhealthy.ToString();
            instance.Render();
            WebAppTests.FlushOutput(injector);
            // Lost nodes
            instance.MoreParams()[YarnWebParams.NodeState] = NodeState.Lost.ToString();
            instance.Render();
            WebAppTests.FlushOutput(injector);
        }
        public virtual void TestFairSchedulerWebAppPageInInconsistentState()
        {
            IList <RMAppState> appStates = Arrays.AsList(RMAppState.New, RMAppState.NewSaving,
                                                         RMAppState.Submitted, RMAppState.Running, RMAppState.FinalSaving, RMAppState.Accepted
                                                         , RMAppState.Finished);
            RMContext rmContext = MockRMContext(appStates);
            Injector  injector  = WebAppTests.CreateMockInjector <RMContext>(rmContext, new _Module_110
                                                                                 (rmContext));
            FairSchedulerPage fsViewInstance = injector.GetInstance <FairSchedulerPage>();

            try
            {
                fsViewInstance.Render();
            }
            catch (Exception e)
            {
                NUnit.Framework.Assert.Fail("Failed to render FairSchedulerPage: " + StringUtils.
                                            StringifyException(e));
            }
            WebAppTests.FlushOutput(injector);
        }
Beispiel #13
0
        public virtual void TestAppBlockRenderWithNullCurrentAppAttempt()
        {
            ApplicationId AppId = ApplicationId.NewInstance(1234L, 0);
            Injector      injector;
            // init app
            RMApp app = Org.Mockito.Mockito.Mock <RMApp>();

            Org.Mockito.Mockito.When(app.GetTrackingUrl()).ThenReturn("http://host:123");
            Org.Mockito.Mockito.When(app.GetState()).ThenReturn(RMAppState.Failed);
            Org.Mockito.Mockito.When(app.GetApplicationId()).ThenReturn(AppId);
            Org.Mockito.Mockito.When(app.GetApplicationType()).ThenReturn("Type");
            Org.Mockito.Mockito.When(app.GetUser()).ThenReturn("user");
            Org.Mockito.Mockito.When(app.GetName()).ThenReturn("Name");
            Org.Mockito.Mockito.When(app.GetQueue()).ThenReturn("queue");
            Org.Mockito.Mockito.When(app.GetDiagnostics()).ThenReturn(new StringBuilder());
            Org.Mockito.Mockito.When(app.GetFinalApplicationStatus()).ThenReturn(FinalApplicationStatus
                                                                                 .Failed);
            Org.Mockito.Mockito.When(app.GetFinalApplicationStatus()).ThenReturn(FinalApplicationStatus
                                                                                 .Failed);
            Org.Mockito.Mockito.When(app.GetStartTime()).ThenReturn(0L);
            Org.Mockito.Mockito.When(app.GetFinishTime()).ThenReturn(0L);
            Org.Mockito.Mockito.When(app.CreateApplicationState()).ThenReturn(YarnApplicationState
                                                                              .Failed);
            RMAppMetrics appMetrics = new RMAppMetrics(Resource.NewInstance(0, 0), 0, 0, 0, 0
                                                       );

            Org.Mockito.Mockito.When(app.GetRMAppMetrics()).ThenReturn(appMetrics);
            // initialize RM Context, and create RMApp, without creating RMAppAttempt
            RMContext rmContext = TestRMWebApp.MockRMContext(15, 1, 2, 8);

            rmContext.GetRMApps()[AppId] = app;
            injector = WebAppTests.CreateMockInjector <RMContext>(rmContext, new _Module_76(rmContext
                                                                                            ));
            AppBlock instance = injector.GetInstance <AppBlock>();

            instance.Set(YarnWebParams.ApplicationId, AppId.ToString());
            instance.Render();
        }
Beispiel #14
0
 public virtual void TestInfoBlock()
 {
     Injector     injector = WebAppTests.CreateMockInjector(this);
     ResponseInfo info     = injector.GetInstance <ResponseInfo>();
 }