當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。