本文整理汇总了Java中org.apache.hadoop.yarn.webapp.test.WebAppTests类的典型用法代码示例。如果您正苦于以下问题:Java WebAppTests类的具体用法?Java WebAppTests怎么用?Java WebAppTests使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebAppTests类属于org.apache.hadoop.yarn.webapp.test包,在下文中一共展示了WebAppTests类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setUp
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
final RMContext mockRMContext =
TestRMWebApp.mockRMContext(3, numberOfRacks, numberOfNodesPerRack,
8 * TestRMWebApp.GiB);
injector =
WebAppTests.createMockInjector(RMContext.class, mockRMContext,
new Module() {
@Override
public void configure(Binder binder) {
try {
binder.bind(ResourceManager.class).toInstance(
TestRMWebApp.mockRm(mockRMContext));
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
});
}
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:TestNodesPage.java
示例2: testNodesBlockRenderForLostNodes
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test
public void testNodesBlockRenderForLostNodes() {
NodesBlock nodesBlock = injector.getInstance(NodesBlock.class);
nodesBlock.set("node.state", "lost");
nodesBlock.render();
PrintWriter writer = injector.getInstance(PrintWriter.class);
WebAppTests.flushOutput(injector);
Mockito.verify(writer,
Mockito.times(numberOfActualTableHeaders + numberOfThInMetricsTable))
.print("<th");
Mockito.verify(
writer,
Mockito.times(numberOfRacks * numberOfLostNodesPerRack
* numberOfActualTableHeaders + numberOfThInMetricsTable)).print(
"<td");
}
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TestNodesPage.java
示例3: testView
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test
public void testView() throws Exception {
Injector injector =
WebAppTests.createMockInjector(ApplicationBaseProtocol.class,
mockApplicationHistoryClientService(5, 1, 1));
AHSView ahsViewInstance = injector.getInstance(AHSView.class);
ahsViewInstance.render();
WebAppTests.flushOutput(injector);
ahsViewInstance.set(YarnWebParams.APP_STATE,
YarnApplicationState.FAILED.toString());
ahsViewInstance.render();
WebAppTests.flushOutput(injector);
ahsViewInstance.set(YarnWebParams.APP_STATE, StringHelper.cjoin(
YarnApplicationState.FAILED.toString(), YarnApplicationState.KILLED));
ahsViewInstance.render();
WebAppTests.flushOutput(injector);
}
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestAHSWebApp.java
示例4: testAppAttemptPage
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test
public void testAppAttemptPage() throws Exception {
Injector injector =
WebAppTests.createMockInjector(ApplicationBaseProtocol.class,
mockApplicationHistoryClientService(1, 1, 5));
AppAttemptPage appAttemptPageInstance =
injector.getInstance(AppAttemptPage.class);
appAttemptPageInstance.render();
WebAppTests.flushOutput(injector);
appAttemptPageInstance.set(YarnWebParams.APPLICATION_ATTEMPT_ID,
ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1)
.toString());
appAttemptPageInstance.render();
WebAppTests.flushOutput(injector);
}
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TestAHSWebApp.java
示例5: testContainerPage
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test
public void testContainerPage() throws Exception {
Injector injector =
WebAppTests.createMockInjector(ApplicationBaseProtocol.class,
mockApplicationHistoryClientService(1, 1, 1));
ContainerPage containerPageInstance =
injector.getInstance(ContainerPage.class);
containerPageInstance.render();
WebAppTests.flushOutput(injector);
containerPageInstance.set(
YarnWebParams.CONTAINER_ID,
ContainerId
.newContainerId(
ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1),
1).toString());
containerPageInstance.render();
WebAppTests.flushOutput(injector);
}
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestAHSWebApp.java
示例6: testSingleTaskCounterView
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test public void testSingleTaskCounterView() {
AppContext appContext = new MockAppContext(0, 1, 1, 2);
Map<String, String> params = getTaskParams(appContext);
params.put(AMParams.COUNTER_GROUP,
"org.apache.hadoop.mapreduce.FileSystemCounter");
params.put(AMParams.COUNTER_NAME, "HDFS_WRITE_OPS");
// remove counters from one task attempt
// to test handling of missing counters
TaskId taskID = MRApps.toTaskID(params.get(AMParams.TASK_ID));
Job job = appContext.getJob(taskID.getJobId());
Task task = job.getTask(taskID);
TaskAttempt attempt = task.getAttempts().values().iterator().next();
attempt.getReport().setCounters(null);
WebAppTests.testPage(SingleCounterPage.class, AppContext.class,
appContext, params);
}
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestAMWebApp.java
示例7: testLogsView2
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test
public void testLogsView2() throws IOException {
LOG.info("HsLogsPage with data");
MockAppContext ctx = new MockAppContext(0, 1, 1, 1);
Map<String, String> params = new HashMap<String, String>();
params.put(CONTAINER_ID, MRApp.newContainerId(1, 1, 333, 1)
.toString());
params.put(NM_NODENAME,
NodeId.newInstance(MockJobs.NM_HOST, MockJobs.NM_PORT).toString());
params.put(ENTITY_STRING, "container_10_0001_01_000001");
params.put(APP_OWNER, "owner");
Injector injector =
WebAppTests.testPage(AggregatedLogsPage.class, AppContext.class, ctx,
params);
PrintWriter spyPw = WebAppTests.getPrintWriter(injector);
verify(spyPw).write(
"Aggregation is not enabled. Try the nodemanager at "
+ MockJobs.NM_HOST + ":" + MockJobs.NM_PORT);
}
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestHSWebApp.java
示例8: testLogsViewBadStartEnd
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test
public void testLogsViewBadStartEnd() throws IOException {
LOG.info("HsLogsPage with bad start/end params");
MockAppContext ctx = new MockAppContext(0, 1, 1, 1);
Map<String, String> params = new HashMap<String, String>();
params.put("start", "foo");
params.put("end", "bar");
params.put(CONTAINER_ID, MRApp.newContainerId(1, 1, 333, 1)
.toString());
params.put(NM_NODENAME,
NodeId.newInstance(MockJobs.NM_HOST, MockJobs.NM_PORT).toString());
params.put(ENTITY_STRING, "container_10_0001_01_000001");
params.put(APP_OWNER, "owner");
Injector injector =
WebAppTests.testPage(AggregatedLogsPage.class, AppContext.class, ctx,
params);
PrintWriter spyPw = WebAppTests.getPrintWriter(injector);
verify(spyPw).write("Invalid log start value: foo");
verify(spyPw).write("Invalid log end value: bar");
}
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestHSWebApp.java
示例9: testUsual
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test public void testUsual() {
Injector injector = WebAppTests.testBlock(TestBlock.class);
PrintWriter out = injector.getInstance(PrintWriter.class);
verify(out).print(" id=\"testid\"");
verify(out).print("test note");
}
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:TestHtmlBlock.java
示例10: testUsual
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test public void testUsual() {
Injector injector = WebAppTests.testPage(TestView.class);
PrintWriter out = injector.getInstance(PrintWriter.class);
// Verify the HTML page has correct meta tags in the header
verify(out).print(" http-equiv=\"X-UA-Compatible\"");
verify(out).print(" content=\"IE=8\"");
verify(out).print(" http-equiv=\"Content-type\"");
verify(out).print(String.format(" content=\"%s\"", MimeType.HTML));
verify(out).print("test");
verify(out).print(" id=\"testid\"");
verify(out).print("test note");
}
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:TestHtmlPage.java
示例11: testMultilineInfoBlock
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test(timeout=60000L)
public void testMultilineInfoBlock() throws Exception{
WebAppTests.testBlock(MultilineInfoBlock.class);
TestInfoBlock.pw.flush();
String output = TestInfoBlock.sw.toString().replaceAll(" +", " ");
String expectedMultilineData1 = String.format("<tr class=\"odd\">%n"
+ " <th>%n Multiple_line_value%n </th>%n"
+ " <td>%n This is one line.%n </td>%n");
String expectedMultilineData2 = String.format("<tr class=\"even\">%n"
+ " <th>%n Multiple_line_value%n </th>%n <td>%n <div>%n"
+ " This is first line.%n </div>%n <div>%n"
+ " This is second line.%n </div>%n");
assertTrue(output.contains(expectedMultilineData1) && output.contains(expectedMultilineData2));
}
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:TestInfoBlock.java
示例12: testJavaScriptInfoBlock
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test(timeout=60000L)
public void testJavaScriptInfoBlock() throws Exception{
WebAppTests.testBlock(JavaScriptInfoBlock.class);
TestInfoBlock.pw.flush();
String output = TestInfoBlock.sw.toString();
assertFalse(output.contains("<script>"));
assertTrue(output.contains(JAVASCRIPT_ESCAPED));
}
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:TestInfoBlock.java
示例13: testSubView
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test public void testSubView() throws Exception {
Injector injector = WebAppTests.createMockInjector(this);
injector.getInstance(MainView.class).render();
PrintWriter out =
injector.getInstance(HttpServletResponse.class).getWriter();
out.flush();
verify(out).print("sub1 text");
verify(out).print("sub2 text");
verify(out, times(16)).println(); // test inline transition across views
}
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:TestSubViews.java
示例14: testControllerIndex
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test
public void testControllerIndex() {
Injector injector = WebAppTests.createMockInjector(TestRMWebApp.class,
this, new Module() {
@Override
public void configure(Binder binder) {
binder.bind(ApplicationACLsManager.class).toInstance(
new ApplicationACLsManager(new Configuration()));
}
});
RmController c = injector.getInstance(RmController.class);
c.index();
assertEquals("Applications", c.get(TITLE, "unknown"));
}
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:TestRMWebApp.java
示例15: testView
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test public void testView() {
Injector injector = WebAppTests.createMockInjector(RMContext.class,
mockRMContext(15, 1, 2, 8*GiB),
new Module() {
@Override
public void configure(Binder binder) {
try {
ResourceManager mockRm = mockRm(3, 1, 2, 8*GiB);
binder.bind(ResourceManager.class).toInstance(mockRm);
binder.bind(ApplicationBaseProtocol.class)
.toInstance(mockRm.getClientRMService());
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
});
RmView rmViewInstance = injector.getInstance(RmView.class);
rmViewInstance.set(YarnWebParams.APP_STATE,
YarnApplicationState.RUNNING.toString());
rmViewInstance.render();
WebAppTests.flushOutput(injector);
rmViewInstance.set(YarnWebParams.APP_STATE, StringHelper.cjoin(
YarnApplicationState.ACCEPTED.toString(),
YarnApplicationState.RUNNING.toString()));
rmViewInstance.render();
WebAppTests.flushOutput(injector);
}
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:TestRMWebApp.java
示例16: testNodesPage
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test public void testNodesPage() {
// 10 nodes. Two of each type.
final RMContext rmContext = mockRMContext(3, 2, 12, 8*GiB);
Injector injector = WebAppTests.createMockInjector(RMContext.class,
rmContext,
new Module() {
@Override
public void configure(Binder binder) {
try {
binder.bind(ResourceManager.class).toInstance(mockRm(rmContext));
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
});
// All nodes
NodesPage instance = injector.getInstance(NodesPage.class);
instance.render();
WebAppTests.flushOutput(injector);
// Unhealthy nodes
instance.moreParams().put(YarnWebParams.NODE_STATE,
NodeState.UNHEALTHY.toString());
instance.render();
WebAppTests.flushOutput(injector);
// Lost nodes
instance.moreParams().put(YarnWebParams.NODE_STATE,
NodeState.LOST.toString());
instance.render();
WebAppTests.flushOutput(injector);
}
开发者ID:naver,项目名称:hadoop,代码行数:35,代码来源:TestRMWebApp.java
示例17: testFairSchedulerWebAppPage
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test
public void testFairSchedulerWebAppPage() {
List<RMAppState> appStates = Arrays.asList(RMAppState.NEW,
RMAppState.NEW_SAVING, RMAppState.SUBMITTED);
final RMContext rmContext = mockRMContext(appStates);
Injector injector = WebAppTests.createMockInjector(RMContext.class,
rmContext,
new Module() {
@Override
public void configure(Binder binder) {
try {
ResourceManager mockRmWithFairScheduler =
mockRm(rmContext);
binder.bind(ResourceManager.class).toInstance
(mockRmWithFairScheduler);
binder.bind(ApplicationBaseProtocol.class).toInstance(
mockRmWithFairScheduler.getClientRMService());
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
});
FairSchedulerPage fsViewInstance = injector.getInstance(FairSchedulerPage
.class);
fsViewInstance.render();
WebAppTests.flushOutput(injector);
}
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:TestRMWebAppFairScheduler.java
示例18: testNodesBlockRender
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test
public void testNodesBlockRender() throws Exception {
injector.getInstance(NodesBlock.class).render();
PrintWriter writer = injector.getInstance(PrintWriter.class);
WebAppTests.flushOutput(injector);
Mockito.verify(writer,
Mockito.times(numberOfActualTableHeaders + numberOfThInMetricsTable))
.print("<th");
Mockito.verify(
writer,
Mockito.times(numberOfRacks * numberOfNodesPerRack
* numberOfActualTableHeaders + numberOfThInMetricsTable)).print(
"<td");
}
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:TestNodesPage.java
示例19: testNodesBlockRenderForNodeLabelFilterWithNonEmptyLabel
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test
public void testNodesBlockRenderForNodeLabelFilterWithNonEmptyLabel() {
NodesBlock nodesBlock = injector.getInstance(NodesBlock.class);
nodesBlock.set("node.label", "x");
nodesBlock.render();
PrintWriter writer = injector.getInstance(PrintWriter.class);
WebAppTests.flushOutput(injector);
Mockito.verify(
writer,
Mockito.times(numberOfRacks
* numberOfActualTableHeaders + numberOfThInMetricsTable)).print(
"<td");
}
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:TestNodesPage.java
示例20: testNodesBlockRenderForNodeLabelFilterWithEmptyLabel
import org.apache.hadoop.yarn.webapp.test.WebAppTests; //导入依赖的package包/类
@Test
public void testNodesBlockRenderForNodeLabelFilterWithEmptyLabel() {
NodesBlock nodesBlock = injector.getInstance(NodesBlock.class);
nodesBlock.set("node.label", "");
nodesBlock.render();
PrintWriter writer = injector.getInstance(PrintWriter.class);
WebAppTests.flushOutput(injector);
Mockito.verify(
writer,
Mockito.times(numberOfRacks * (numberOfNodesPerRack - 1)
* numberOfActualTableHeaders + numberOfThInMetricsTable)).print(
"<td");
}
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:TestNodesPage.java
注:本文中的org.apache.hadoop.yarn.webapp.test.WebAppTests类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论