Package org.json.simple

Examples of org.json.simple.JSONObject.keySet()


    {
      final JSONObject aps = this.extractApsObjectFromPayloadString(this.builder.buildWithDefaultMaximumLength());
      final JSONObject alert = (JSONObject) aps.get("alert");

      assertTrue(alert.keySet().contains("action-loc-key"));
      assertNull(alert.get("action-loc-key"));
    }

    final String actionButtonKey = "action.key";
    this.builder.setLocalizedActionButtonKey(actionButtonKey);
View Full Code Here


    {
      final JSONObject aps = this.extractApsObjectFromPayloadString(this.builder.buildWithDefaultMaximumLength());
      final JSONObject alert = (JSONObject) aps.get("alert");

      assertTrue(alert.keySet().contains("action-loc-key"));
      assertNull(alert.get("action-loc-key"));
    }
  }

  @Test
View Full Code Here

    Map<String, Clusters> clusterMembership = new HashMap<String, Clusters>();
    JSONParser parser = new JSONParser();
    try {
      JSONObject parseObj = (JSONObject) parser.parse(new FileReader(trainingFile));
      JSONObject topicObj = (JSONObject) parseObj.get("topics");
      Set<String> topics = topicObj.keySet();
      Iterator<String> topicIt = topics.iterator();
      while (topicIt.hasNext()) { // for each topic
        String topic = topicIt.next();
        clusterMembership.put(topic, new Clusters());
        JSONArray clusters = (JSONArray) ((JSONObject) topicObj.get(topic)).get("clusters");
View Full Code Here

    Macro m=new Macro(startTime, endTime, queryString);
    ResultSet rs = db.query(m.toString());
    // move to the first record
    rs.next();
    ResultSetMetaData md=rs.getMetaData();
    Iterator names=row_obj.keySet().iterator();
    while (names.hasNext()) {
        String name=(String)names.next();
        String jsonValue=(String)row_obj.get(name);
        String dbValue=rs.getString(name);
        int dbCol=rs.findColumn(name);
View Full Code Here

    double user = 0.0;
    double sys = 0.0;
    double idle = 0.0;
    for(int i = 0; i< cpuList.size(); i++) {
      JSONObject cpu = (JSONObject) cpuList.get(i);
      Iterator<String> keys = cpu.keySet().iterator();
      combined = combined + Double.parseDouble(cpu.get("combined").toString());
      user = user + Double.parseDouble(cpu.get("user").toString());
      sys = sys + Double.parseDouble(cpu.get("sys").toString());
      idle = idle + Double.parseDouble(cpu.get("idle").toString());
      while(keys.hasNext()) {
View Full Code Here

    buildGenericRecord(record, null, cal.getTimeInMillis(), "system");
    output.collect(key, record);   

    record = new ChukwaRecord();
    JSONObject memory = (JSONObject) json.get("memory");
    Iterator<String> memKeys = memory.keySet().iterator();
    while(memKeys.hasNext()) {
      String key = memKeys.next();
      record.add(key, memory.get(key).toString());
    }
    buildGenericRecord(record, null, cal.getTimeInMillis(), "memory");
View Full Code Here

    double txPackets = 0;
    record = new ChukwaRecord();
    JSONArray netList = (JSONArray) json.get("network");
    for(int i = 0;i < netList.size(); i++) {
      JSONObject netIf = (JSONObject) netList.get(i);
      Iterator<String> keys = netIf.keySet().iterator();
      while(keys.hasNext()) {
        String key = keys.next();
        record.add(key + "." + i, netIf.get(key).toString());
        if(i!=0) {
          if(key.equals("RxBytes")) {
View Full Code Here

    double writes = 0;
    record = new ChukwaRecord();
    JSONArray diskList = (JSONArray) json.get("disk");
    for(int i = 0;i < diskList.size(); i++) {
      JSONObject disk = (JSONObject) diskList.get(i);
      Iterator<String> keys = disk.keySet().iterator();
      while(keys.hasNext()) {
        String key = keys.next();
        record.add(key + "." + i, disk.get(key).toString());
        if(key.equals("ReadBytes")) {
          readBytes = readBytes + (Long) disk.get("ReadBytes");
View Full Code Here

      ChukwaRecord record = new ChukwaRecord();
      StringBuilder datasource = new StringBuilder();
      String contextName = null;
      String recordName = null;

      Iterator<String> ki = json.keySet().iterator();
      while (ki.hasNext()) {
        String keyName = ki.next();
        if (chukwaTimestampField.intern() == keyName.intern()) {
          d = new Date((Long) json.get(keyName));
          Calendar cal = Calendar.getInstance();
View Full Code Here

            JSONObject json = (JSONObject)JSONValue.parseWithException(new FileReader(jsonFile));
           
            SSTableWriter writer = new SSTableWriter(ssTablePath, json.size(), partitioner);
            List<DecoratedKey<?>> decoratedKeys = new ArrayList<DecoratedKey<?>>();
           
            for (String key : (Set<String>)json.keySet())
                decoratedKeys.add(partitioner.decorateKey(key));
            Collections.sort(decoratedKeys);

            for (DecoratedKey<?> rowKey : decoratedKeys)
            {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.