TestAppManager.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:aliyun-oss-hadoop-fs 作者:
@Test
public void testRMAppSubmitWithInvalidTokens() throws Exception {
  // Setup invalid security tokens
  DataOutputBuffer dob = new DataOutputBuffer();
  ByteBuffer securityTokens = ByteBuffer.wrap(dob.getData(), 0,
      dob.getLength());
  asContext.getAMContainerSpec().setTokens(securityTokens);
  try {
    appMonitor.submitApplication(asContext, "test");
    Assert.fail("Application submission should fail because" +
        " Tokens are invalid.");
  } catch (YarnException e) {
    // Exception is expected
    Assert.assertTrue("The thrown exception is not" +
        " java.io.EOFException",
        e.getMessage().contains("java.io.EOFException"));
  }
  int timeoutSecs = 0;
  while ((getAppEventType() == RMAppEventType.KILL) &&
      timeoutSecs++ < 20) {
    Thread.sleep(1000);
  }
  Assert.assertEquals("app event type sent is wrong",
      RMAppEventType.APP_REJECTED, getAppEventType());
  asContext.getAMContainerSpec().setTokens(null);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号