• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MockNM类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.yarn.server.resourcemanager.MockNM的典型用法代码示例。如果您正苦于以下问题:Java MockNM类的具体用法?Java MockNM怎么用?Java MockNM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MockNM类属于org.apache.hadoop.yarn.server.resourcemanager包,在下文中一共展示了MockNM类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testNodesQueryNew

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
@Test
public void testNodesQueryNew() throws JSONException, Exception {
  WebResource r = resource();
  MockNM nm1 = rm.registerNode("h1:1234", 5120);
  MockNM nm2 = rm.registerNode("h2:1235", 5121);
  rm.sendNodeStarted(nm1);
  rm.NMwaitForState(nm1.getNodeId(), NodeState.RUNNING);
  rm.NMwaitForState(nm2.getNodeId(), NodeState.NEW);

  ClientResponse response = r.path("ws").path("v1").path("cluster")
      .path("nodes").queryParam("states", NodeState.NEW.toString())
      .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);

  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);
  assertEquals("incorrect number of elements", 1, json.length());
  JSONObject nodes = json.getJSONObject("nodes");
  assertEquals("incorrect number of elements", 1, nodes.length());
  JSONArray nodeArray = nodes.getJSONArray("node");
  assertEquals("incorrect number of elements", 1, nodeArray.length());
  JSONObject info = nodeArray.getJSONObject(0);

  verifyNodeInfo(info, nm2);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TestRMWebServicesNodes.java


示例2: testNodesQueryRunning

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
@Test
public void testNodesQueryRunning() throws JSONException, Exception {
  WebResource r = resource();
  MockNM nm1 = rm.registerNode("h1:1234", 5120);
  MockNM nm2 = rm.registerNode("h2:1235", 5121);
  rm.sendNodeStarted(nm1);
  rm.NMwaitForState(nm1.getNodeId(), NodeState.RUNNING);
  rm.NMwaitForState(nm2.getNodeId(), NodeState.NEW);
  ClientResponse response = r.path("ws").path("v1").path("cluster")
      .path("nodes").queryParam("states", "running")
      .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);
  assertEquals("incorrect number of elements", 1, json.length());
  JSONObject nodes = json.getJSONObject("nodes");
  assertEquals("incorrect number of elements", 1, nodes.length());
  JSONArray nodeArray = nodes.getJSONArray("node");
  assertEquals("incorrect number of elements", 1, nodeArray.length());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:TestRMWebServicesNodes.java


示例3: testNodesQueryHealthyFalse

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
@Test
public void testNodesQueryHealthyFalse() throws JSONException, Exception {
  WebResource r = resource();
  MockNM nm1 = rm.registerNode("h1:1234", 5120);
  MockNM nm2 = rm.registerNode("h2:1235", 5121);
  rm.sendNodeStarted(nm1);
  rm.NMwaitForState(nm1.getNodeId(), NodeState.RUNNING);
  rm.NMwaitForState(nm2.getNodeId(), NodeState.NEW);
  ClientResponse response = r.path("ws").path("v1").path("cluster")
      .path("nodes").queryParam("states", "UNHEALTHY")
      .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);
  assertEquals("incorrect number of elements", 1, json.length());
  assertEquals("nodes is not null", JSONObject.NULL, json.get("nodes"));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:TestRMWebServicesNodes.java


示例4: testNodesXML

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
@Test
public void testNodesXML() throws JSONException, Exception {
  rm.start();
  WebResource r = resource();
  MockNM nm1 = rm.registerNode("h1:1234", 5120);
  // MockNM nm2 = rm.registerNode("h2:1235", 5121);
  ClientResponse response = r.path("ws").path("v1").path("cluster")
      .path("nodes").accept(MediaType.APPLICATION_XML)
      .get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_XML_TYPE, response.getType());
  String xml = response.getEntity(String.class);
  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder db = dbf.newDocumentBuilder();
  InputSource is = new InputSource();
  is.setCharacterStream(new StringReader(xml));
  Document dom = db.parse(is);
  NodeList nodesApps = dom.getElementsByTagName("nodes");
  assertEquals("incorrect number of elements", 1, nodesApps.getLength());
  NodeList nodes = dom.getElementsByTagName("node");
  assertEquals("incorrect number of elements", 1, nodes.getLength());
  verifyNodesXML(nodes, nm1);
  rm.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:TestRMWebServicesNodes.java


示例5: testSingleNodesXML

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
@Test
public void testSingleNodesXML() throws JSONException, Exception {
  rm.start();
  WebResource r = resource();
  MockNM nm1 = rm.registerNode("h1:1234", 5120);
  // MockNM nm2 = rm.registerNode("h2:1235", 5121);
  ClientResponse response = r.path("ws").path("v1").path("cluster")
      .path("nodes").path("h1:1234").accept(MediaType.APPLICATION_XML)
      .get(ClientResponse.class);

  assertEquals(MediaType.APPLICATION_XML_TYPE, response.getType());
  String xml = response.getEntity(String.class);

  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder db = dbf.newDocumentBuilder();
  InputSource is = new InputSource();
  is.setCharacterStream(new StringReader(xml));
  Document dom = db.parse(is);
  NodeList nodes = dom.getElementsByTagName("node");
  assertEquals("incorrect number of elements", 1, nodes.getLength());
  verifyNodesXML(nodes, nm1);
  rm.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:TestRMWebServicesNodes.java


示例6: testQueryAll

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
@Test
public void testQueryAll() throws Exception {
  WebResource r = resource();
  MockNM nm1 = rm.registerNode("h1:1234", 5120);
  MockNM nm2 = rm.registerNode("h2:1235", 5121);
  MockNM nm3 = rm.registerNode("h3:1236", 5122);
  rm.sendNodeStarted(nm1);
  rm.sendNodeStarted(nm3);
  rm.NMwaitForState(nm1.getNodeId(), NodeState.RUNNING);
  rm.NMwaitForState(nm2.getNodeId(), NodeState.NEW);
  rm.sendNodeLost(nm3);

  ClientResponse response = r.path("ws").path("v1").path("cluster")
      .path("nodes")
      .queryParam("states", Joiner.on(',').join(EnumSet.allOf(NodeState.class)))
      .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);

  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);
  JSONObject nodes = json.getJSONObject("nodes");
  assertEquals("incorrect number of elements", 1, nodes.length());
  JSONArray nodeArray = nodes.getJSONArray("node");
  assertEquals("incorrect number of elements", 3, nodeArray.length());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TestRMWebServicesNodes.java


示例7: verifyNodesXML

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
public void verifyNodesXML(NodeList nodes, MockNM nm) throws JSONException,
    Exception {
  for (int i = 0; i < nodes.getLength(); i++) {
    Element element = (Element) nodes.item(i);
    verifyNodeInfoGeneric(nm,
        WebServicesTestUtils.getXmlString(element, "state"),
        WebServicesTestUtils.getXmlString(element, "rack"),
        WebServicesTestUtils.getXmlString(element, "id"),
        WebServicesTestUtils.getXmlString(element, "nodeHostName"),
        WebServicesTestUtils.getXmlString(element, "nodeHTTPAddress"),
        WebServicesTestUtils.getXmlLong(element, "lastHealthUpdate"),
        WebServicesTestUtils.getXmlString(element, "healthReport"),
        WebServicesTestUtils.getXmlInt(element, "numContainers"),
        WebServicesTestUtils.getXmlLong(element, "usedMemoryMB"),
        WebServicesTestUtils.getXmlLong(element, "availMemoryMB"),
        WebServicesTestUtils.getXmlLong(element, "usedVirtualCores"),
        WebServicesTestUtils.getXmlLong(element,  "availableVirtualCores"),
        WebServicesTestUtils.getXmlLong(element, "usedGpuCores"),
        WebServicesTestUtils.getXmlLong(element, "availableGpuCores"),
        WebServicesTestUtils.getXmlString(element, "version"));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestRMWebServicesNodes.java


示例8: verifyNodeInfo

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
public void verifyNodeInfo(JSONObject nodeInfo, MockNM nm)
    throws JSONException, Exception {
  assertEquals("incorrect number of elements", 15, nodeInfo.length());

  verifyNodeInfoGeneric(nm, nodeInfo.getString("state"),
      nodeInfo.getString("rack"),
      nodeInfo.getString("id"), nodeInfo.getString("nodeHostName"),
      nodeInfo.getString("nodeHTTPAddress"),
      nodeInfo.getLong("lastHealthUpdate"),
      nodeInfo.getString("healthReport"), nodeInfo.getInt("numContainers"),
      nodeInfo.getLong("usedMemoryMB"), nodeInfo.getLong("availMemoryMB"),
      nodeInfo.getLong("usedVirtualCores"), nodeInfo.getLong("availableVirtualCores"),
      nodeInfo.getLong("usedGpuCores"), nodeInfo.getLong("availableGpuCores"),
      nodeInfo.getString("version"));

}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:TestRMWebServicesNodes.java


示例9: testSingleAppState

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
@Test
public void testSingleAppState() throws Exception {
  rm.start();
  MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
  String[] mediaTypes =
      { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML };
  for (String mediaType : mediaTypes) {
    RMApp app = rm.submitApp(CONTAINER_MB, "", webserviceUserName);
    amNodeManager.nodeHeartbeat(true);
    ClientResponse response =
        this
          .constructWebResource("apps", app.getApplicationId().toString(),
            "state").accept(mediaType).get(ClientResponse.class);
    assertEquals(Status.OK, response.getClientResponseStatus());
    if (mediaType.equals(MediaType.APPLICATION_JSON)) {
      verifyAppStateJson(response, RMAppState.ACCEPTED);
    } else if (mediaType.equals(MediaType.APPLICATION_XML)) {
      verifyAppStateXML(response, RMAppState.ACCEPTED);
    }
  }
  rm.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestRMWebServicesAppsModification.java


示例10: testSingleAppKillInvalidId

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
@Test
public void testSingleAppKillInvalidId() throws Exception {
  rm.start();
  MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
  amNodeManager.nodeHeartbeat(true);
  String[] testAppIds = { "application_1391705042196_0001", "random_string" };
  for (String testAppId : testAppIds) {
    AppState info = new AppState("KILLED");
    ClientResponse response =
        this.constructWebResource("apps", testAppId, "state")
          .accept(MediaType.APPLICATION_XML)
          .entity(info, MediaType.APPLICATION_XML).put(ClientResponse.class);
    if (!isAuthenticationEnabled()) {
      assertEquals(Status.UNAUTHORIZED, response.getClientResponseStatus());
      continue;
    }
    assertEquals(Status.NOT_FOUND, response.getClientResponseStatus());
  }
  rm.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestRMWebServicesAppsModification.java


示例11: testAppsXML

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
@Test
public void testAppsXML() throws JSONException, Exception {
  rm.start();
  MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
  RMApp app1 = rm.submitApp(CONTAINER_MB, "testwordcount", "user1");
  amNodeManager.nodeHeartbeat(true);
  WebResource r = resource();
  ClientResponse response = r.path("ws").path("v1").path("cluster")
      .path("apps").accept(MediaType.APPLICATION_XML)
      .get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_XML_TYPE, response.getType());
  String xml = response.getEntity(String.class);
  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder db = dbf.newDocumentBuilder();
  InputSource is = new InputSource();
  is.setCharacterStream(new StringReader(xml));
  Document dom = db.parse(is);
  NodeList nodesApps = dom.getElementsByTagName("apps");
  assertEquals("incorrect number of elements", 1, nodesApps.getLength());
  NodeList nodes = dom.getElementsByTagName("app");
  assertEquals("incorrect number of elements", 1, nodes.getLength());
  verifyAppsXML(nodes, app1);
  rm.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TestRMWebServicesApps.java


示例12: testAppsXMLMulti

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
@Test
public void testAppsXMLMulti() throws JSONException, Exception {
  rm.start();
  MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
  rm.submitApp(CONTAINER_MB, "testwordcount", "user1");
  rm.submitApp(2048, "testwordcount2", "user1");

  amNodeManager.nodeHeartbeat(true);
  WebResource r = resource();

  ClientResponse response = r.path("ws").path("v1").path("cluster")
      .path("apps").accept(MediaType.APPLICATION_XML)
      .get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_XML_TYPE, response.getType());
  String xml = response.getEntity(String.class);
  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder db = dbf.newDocumentBuilder();
  InputSource is = new InputSource();
  is.setCharacterStream(new StringReader(xml));
  Document dom = db.parse(is);
  NodeList nodesApps = dom.getElementsByTagName("apps");
  assertEquals("incorrect number of elements", 1, nodesApps.getLength());
  NodeList nodes = dom.getElementsByTagName("app");
  assertEquals("incorrect number of elements", 2, nodes.getLength());
  rm.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:TestRMWebServicesApps.java


示例13: testAppsQueryState

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
@Test
public void testAppsQueryState() throws JSONException, Exception {
  rm.start();
  MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
  RMApp app1 = rm.submitApp(CONTAINER_MB);
  amNodeManager.nodeHeartbeat(true);
  WebResource r = resource();

  ClientResponse response = r.path("ws").path("v1").path("cluster")
      .path("apps")
      .queryParam("state", YarnApplicationState.ACCEPTED.toString())
      .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);
  assertEquals("incorrect number of elements", 1, json.length());
  JSONObject apps = json.getJSONObject("apps");
  assertEquals("incorrect number of elements", 1, apps.length());
  JSONArray array = apps.getJSONArray("app");
  assertEquals("incorrect number of elements", 1, array.length());
  verifyAppInfo(array.getJSONObject(0), app1);
  rm.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestRMWebServicesApps.java


示例14: testAppsQueryStatesNone

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
@Test
public void testAppsQueryStatesNone() throws JSONException, Exception {
  rm.start();
  MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
  rm.submitApp(CONTAINER_MB);
  amNodeManager.nodeHeartbeat(true);
  WebResource r = resource();

  ClientResponse response = r.path("ws").path("v1").path("cluster")
      .path("apps")
      .queryParam("states", YarnApplicationState.RUNNING.toString())
      .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);
  assertEquals("incorrect number of elements", 1, json.length());
  assertEquals("apps is not null", JSONObject.NULL, json.get("apps"));
  rm.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestRMWebServicesApps.java


示例15: testAppsQueryStateNone

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
@Test
public void testAppsQueryStateNone() throws JSONException, Exception {
  rm.start();
  MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
  rm.submitApp(CONTAINER_MB);
  amNodeManager.nodeHeartbeat(true);
  WebResource r = resource();

  ClientResponse response = r.path("ws").path("v1").path("cluster")
      .path("apps")
      .queryParam("state", YarnApplicationState.RUNNING.toString())
      .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);
  assertEquals("incorrect number of elements", 1, json.length());
  assertEquals("apps is not null", JSONObject.NULL, json.get("apps"));
  rm.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestRMWebServicesApps.java


示例16: testAppsQueryFinalStatus

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
@Test
public void testAppsQueryFinalStatus() throws JSONException, Exception {
  rm.start();
  MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
  RMApp app1 = rm.submitApp(CONTAINER_MB);
  amNodeManager.nodeHeartbeat(true);
  WebResource r = resource();

  ClientResponse response = r.path("ws").path("v1").path("cluster")
      .path("apps").queryParam("finalStatus", FinalApplicationStatus.UNDEFINED.toString())
      .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);
  assertEquals("incorrect number of elements", 1, json.length());
  System.out.println(json.toString());
  JSONObject apps = json.getJSONObject("apps");
  assertEquals("incorrect number of elements", 1, apps.length());
  JSONArray array = apps.getJSONArray("app");
  assertEquals("incorrect number of elements", 1, array.length());
  verifyAppInfo(array.getJSONObject(0), app1);
  rm.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestRMWebServicesApps.java


示例17: testAppsQueryFinalStatusNone

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
@Test
public void testAppsQueryFinalStatusNone() throws JSONException, Exception {
  rm.start();
  MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
  rm.submitApp(CONTAINER_MB);
  amNodeManager.nodeHeartbeat(true);
  WebResource r = resource();

  ClientResponse response = r.path("ws").path("v1").path("cluster")
      .path("apps").queryParam("finalStatus", FinalApplicationStatus.KILLED.toString())
      .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);
  assertEquals("incorrect number of elements", 1, json.length());
  assertEquals("apps is not null", JSONObject.NULL, json.get("apps"));
  rm.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TestRMWebServicesApps.java


示例18: testAppsQueryQueue

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
@Test
public void testAppsQueryQueue() throws JSONException, Exception {
  rm.start();
  MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
  rm.submitApp(CONTAINER_MB);
  rm.submitApp(CONTAINER_MB);

  amNodeManager.nodeHeartbeat(true);
  WebResource r = resource();

  ClientResponse response = r.path("ws").path("v1").path("cluster")
      .path("apps").queryParam("queue", "default")
      .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
  JSONObject json = response.getEntity(JSONObject.class);
  assertEquals("incorrect number of elements", 1, json.length());
  JSONObject apps = json.getJSONObject("apps");
  assertEquals("incorrect number of elements", 1, apps.length());
  JSONArray array = apps.getJSONArray("app");
  assertEquals("incorrect number of elements", 2, array.length());
  rm.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestRMWebServicesApps.java


示例19: testSingleAppsXML

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
@Test
public void testSingleAppsXML() throws JSONException, Exception {
  rm.start();
  MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
  RMApp app1 = rm.submitApp(CONTAINER_MB, "testwordcount", "user1");
  amNodeManager.nodeHeartbeat(true);
  WebResource r = resource();
  ClientResponse response = r.path("ws").path("v1").path("cluster")
      .path("apps").path(app1.getApplicationId().toString())
      .accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
  assertEquals(MediaType.APPLICATION_XML_TYPE, response.getType());
  String xml = response.getEntity(String.class);

  DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder db = dbf.newDocumentBuilder();
  InputSource is = new InputSource();
  is.setCharacterStream(new StringReader(xml));
  Document dom = db.parse(is);
  NodeList nodes = dom.getElementsByTagName("app");
  assertEquals("incorrect number of elements", 1, nodes.getLength());
  verifyAppsXML(nodes, app1);
  rm.stop();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:TestRMWebServicesApps.java


示例20: getLogAggregationContextFromContainerToken

import org.apache.hadoop.yarn.server.resourcemanager.MockNM; //导入依赖的package包/类
private LogAggregationContext getLogAggregationContextFromContainerToken(
    MockRM rm1, MockNM nm1, LogAggregationContext logAggregationContext)
    throws Exception {
  RMApp app2 = rm1.submitApp(200, logAggregationContext);
  MockAM am2 = MockRM.launchAndRegisterAM(app2, rm1, nm1);
  nm1.nodeHeartbeat(true);
  // request a container.
  am2.allocate("127.0.0.1", 512, 1, new ArrayList<ContainerId>());
  ContainerId containerId =
      ContainerId.newContainerId(am2.getApplicationAttemptId(), 2);
  rm1.waitForState(nm1, containerId, RMContainerState.ALLOCATED);

  // acquire the container.
  List<Container> containers =
      am2.allocate(new ArrayList<ResourceRequest>(),
        new ArrayList<ContainerId>()).getAllocatedContainers();
  Assert.assertEquals(containerId, containers.get(0).getId());
  // container token is generated.
  Assert.assertNotNull(containers.get(0).getContainerToken());
  ContainerTokenIdentifier token =
      BuilderUtils.newContainerTokenIdentifier(containers.get(0)
        .getContainerToken());
  return token.getLogAggregationContext();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TestContainerAllocation.java



注:本文中的org.apache.hadoop.yarn.server.resourcemanager.MockNM类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ValueInputStream类代码示例发布时间:2022-05-22
下一篇:
Java MathHelper类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap