当前位置: 首页>>代码示例>>Java>>正文


Java JSONObject.getLong方法代码示例

本文整理汇总了Java中org.codehaus.jettison.json.JSONObject.getLong方法的典型用法代码示例。如果您正苦于以下问题:Java JSONObject.getLong方法的具体用法?Java JSONObject.getLong怎么用?Java JSONObject.getLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.codehaus.jettison.json.JSONObject的用法示例。


在下文中一共展示了JSONObject.getLong方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: verifyAMJobTaskCounters

import org.codehaus.jettison.json.JSONObject; //导入方法依赖的package包/类
public void verifyAMJobTaskCounters(JSONObject info, Task task)
    throws JSONException {

  assertEquals("incorrect number of elements", 2, info.length());

  WebServicesTestUtils.checkStringMatch("id", MRApps.toString(task.getID()),
      info.getString("id"));
  // just do simple verification of fields - not data is correct
  // in the fields
  JSONArray counterGroups = info.getJSONArray("taskCounterGroup");
  for (int i = 0; i < counterGroups.length(); i++) {
    JSONObject counterGroup = counterGroups.getJSONObject(i);
    String name = counterGroup.getString("counterGroupName");
    assertTrue("name not set", (name != null && !name.isEmpty()));
    JSONArray counters = counterGroup.getJSONArray("counter");
    for (int j = 0; j < counters.length(); j++) {
      JSONObject counter = counters.getJSONObject(j);
      String counterName = counter.getString("name");
      assertTrue("name not set",
          (counterName != null && !counterName.isEmpty()));
      long value = counter.getLong("value");
      assertTrue("value  >= 0", value >= 0);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:TestAMWebServicesTasks.java

示例2: verifyAMJobTaskAttemptCounters

import org.codehaus.jettison.json.JSONObject; //导入方法依赖的package包/类
public void verifyAMJobTaskAttemptCounters(JSONObject info, TaskAttempt att)
    throws JSONException {

  assertEquals("incorrect number of elements", 2, info.length());

  WebServicesTestUtils.checkStringMatch("id", MRApps.toString(att.getID()),
      info.getString("id"));

  // just do simple verification of fields - not data is correct
  // in the fields
  JSONArray counterGroups = info.getJSONArray("taskAttemptCounterGroup");
  for (int i = 0; i < counterGroups.length(); i++) {
    JSONObject counterGroup = counterGroups.getJSONObject(i);
    String name = counterGroup.getString("counterGroupName");
    assertTrue("name not set", (name != null && !name.isEmpty()));
    JSONArray counters = counterGroup.getJSONArray("counter");
    for (int j = 0; j < counters.length(); j++) {
      JSONObject counter = counters.getJSONObject(j);
      String counterName = counter.getString("name");
      assertTrue("name not set",
          (counterName != null && !counterName.isEmpty()));
      long value = counter.getLong("value");
      assertTrue("value  >= 0", value >= 0);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:TestAMWebServicesAttempts.java

示例3: verifyHsJobTaskAttemptCounters

import org.codehaus.jettison.json.JSONObject; //导入方法依赖的package包/类
public void verifyHsJobTaskAttemptCounters(JSONObject info, TaskAttempt att)
    throws JSONException {

  assertEquals("incorrect number of elements", 2, info.length());

  WebServicesTestUtils.checkStringMatch("id", MRApps.toString(att.getID()),
      info.getString("id"));

  // just do simple verification of fields - not data is correct
  // in the fields
  JSONArray counterGroups = info.getJSONArray("taskAttemptCounterGroup");
  for (int i = 0; i < counterGroups.length(); i++) {
    JSONObject counterGroup = counterGroups.getJSONObject(i);
    String name = counterGroup.getString("counterGroupName");
    assertTrue("name not set", (name != null && !name.isEmpty()));
    JSONArray counters = counterGroup.getJSONArray("counter");
    for (int j = 0; j < counters.length(); j++) {
      JSONObject counter = counters.getJSONObject(j);
      String counterName = counter.getString("name");
      assertTrue("name not set",
          (counterName != null && !counterName.isEmpty()));
      long value = counter.getLong("value");
      assertTrue("value  >= 0", value >= 0);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:TestHsWebServicesAttempts.java

示例4: verifyHsJobTaskCounters

import org.codehaus.jettison.json.JSONObject; //导入方法依赖的package包/类
public void verifyHsJobTaskCounters(JSONObject info, Task task)
    throws JSONException {

  assertEquals("incorrect number of elements", 2, info.length());

  WebServicesTestUtils.checkStringMatch("id", MRApps.toString(task.getID()),
      info.getString("id"));
  // just do simple verification of fields - not data is correct
  // in the fields
  JSONArray counterGroups = info.getJSONArray("taskCounterGroup");
  for (int i = 0; i < counterGroups.length(); i++) {
    JSONObject counterGroup = counterGroups.getJSONObject(i);
    String name = counterGroup.getString("counterGroupName");
    assertTrue("name not set", (name != null && !name.isEmpty()));
    JSONArray counters = counterGroup.getJSONArray("counter");
    for (int j = 0; j < counters.length(); j++) {
      JSONObject counter = counters.getJSONObject(j);
      String counterName = counter.getString("name");
      assertTrue("name not set",
          (counterName != null && !counterName.isEmpty()));
      long value = counter.getLong("value");
      assertTrue("value  >= 0", value >= 0);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:TestHsWebServicesTasks.java

示例5: validateGetNewApplicationJsonResponse

import org.codehaus.jettison.json.JSONObject; //导入方法依赖的package包/类
protected String validateGetNewApplicationJsonResponse(JSONObject json)
    throws JSONException {
  String appId = json.getString("application-id");
  assertTrue(!appId.isEmpty());
  JSONObject maxResources = json.getJSONObject("maximum-resource-capability");
  long memory = maxResources.getLong("memory");
  long vCores = maxResources.getLong("vCores");
  assertTrue(memory != 0);
  assertTrue(vCores != 0);
  return appId;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:TestRMWebServicesAppsModification.java

示例6: verifyAMJobCounters

import org.codehaus.jettison.json.JSONObject; //导入方法依赖的package包/类
public void verifyAMJobCounters(JSONObject info, Job job)
    throws JSONException {

  assertEquals("incorrect number of elements", 2, info.length());

  WebServicesTestUtils.checkStringMatch("id", MRApps.toString(job.getID()),
      info.getString("id"));
  // just do simple verification of fields - not data is correct
  // in the fields
  JSONArray counterGroups = info.getJSONArray("counterGroup");
  for (int i = 0; i < counterGroups.length(); i++) {
    JSONObject counterGroup = counterGroups.getJSONObject(i);
    String name = counterGroup.getString("counterGroupName");
    assertTrue("name not set", (name != null && !name.isEmpty()));
    JSONArray counters = counterGroup.getJSONArray("counter");
    for (int j = 0; j < counters.length(); j++) {
      JSONObject counter = counters.getJSONObject(j);
      String counterName = counter.getString("name");
      assertTrue("counter name not set",
          (counterName != null && !counterName.isEmpty()));

      long mapValue = counter.getLong("mapCounterValue");
      assertTrue("mapCounterValue  >= 0", mapValue >= 0);

      long reduceValue = counter.getLong("reduceCounterValue");
      assertTrue("reduceCounterValue  >= 0", reduceValue >= 0);

      long totalValue = counter.getLong("totalCounterValue");
      assertTrue("totalCounterValue  >= 0", totalValue >= 0);

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

示例7: verifyHsJobCounters

import org.codehaus.jettison.json.JSONObject; //导入方法依赖的package包/类
public void verifyHsJobCounters(JSONObject info, Job job)
    throws JSONException {

  assertEquals("incorrect number of elements", 2, info.length());

  WebServicesTestUtils.checkStringMatch("id", MRApps.toString(job.getID()),
      info.getString("id"));
  // just do simple verification of fields - not data is correct
  // in the fields
  JSONArray counterGroups = info.getJSONArray("counterGroup");
  for (int i = 0; i < counterGroups.length(); i++) {
    JSONObject counterGroup = counterGroups.getJSONObject(i);
    String name = counterGroup.getString("counterGroupName");
    assertTrue("name not set", (name != null && !name.isEmpty()));
    JSONArray counters = counterGroup.getJSONArray("counter");
    for (int j = 0; j < counters.length(); j++) {
      JSONObject counter = counters.getJSONObject(j);
      String counterName = counter.getString("name");
      assertTrue("counter name not set",
          (counterName != null && !counterName.isEmpty()));

      long mapValue = counter.getLong("mapCounterValue");
      assertTrue("mapCounterValue  >= 0", mapValue >= 0);

      long reduceValue = counter.getLong("reduceCounterValue");
      assertTrue("reduceCounterValue  >= 0", reduceValue >= 0);

      long totalValue = counter.getLong("totalCounterValue");
      assertTrue("totalCounterValue  >= 0", totalValue >= 0);

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

示例8: processIssueDeleteEvent

import org.codehaus.jettison.json.JSONObject; //导入方法依赖的package包/类
private void processIssueDeleteEvent(JSONObject issue) throws JSONException {
    Long id = issue.getLong(WEB_HOOK_JIRA_ID_FIELD);
    main.deleteIssue(id);
}
 
开发者ID:BBVA,项目名称:mirrorgate-jira-stories-collector,代码行数:5,代码来源:WebHookController.java


注:本文中的org.codehaus.jettison.json.JSONObject.getLong方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。