Example #1
0
        public virtual void TestNodesBlockRender()
        {
            injector.GetInstance <NodesPage.NodesBlock>().Render();
            PrintWriter writer = injector.GetInstance <PrintWriter>();

            WebAppTests.FlushOutput(injector);
            Org.Mockito.Mockito.Verify(writer, Org.Mockito.Mockito.Times(numberOfActualTableHeaders
                                                                         + numberOfThInMetricsTable)).Write("<th");
            Org.Mockito.Mockito.Verify(writer, Org.Mockito.Mockito.Times(numberOfRacks * numberOfNodesPerRack
                                                                         * numberOfActualTableHeaders + numberOfThInMetricsTable)).Write("<td");
        }
Example #2
0
        public virtual void TestNodesBlockRenderForNodeLabelFilterWithNonEmptyLabel()
        {
            NodesPage.NodesBlock nodesBlock = injector.GetInstance <NodesPage.NodesBlock>();
            nodesBlock.Set("node.label", "x");
            nodesBlock.Render();
            PrintWriter writer = injector.GetInstance <PrintWriter>();

            WebAppTests.FlushOutput(injector);
            Org.Mockito.Mockito.Verify(writer, Org.Mockito.Mockito.Times(numberOfRacks * numberOfActualTableHeaders
                                                                         + numberOfThInMetricsTable)).Write("<td");
        }
        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);
        }
Example #4
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);
        }
Example #5
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);
        }
Example #6
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);
        }
Example #7
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);
        }
Example #8
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);
        }