Package org.json.simple

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


        JSONArray colExp = (JSONArray)colsA.get(1);
        assert ((Long)colExp.get(4)) == 42;
        assert ((Long)colExp.get(5)) == nowInSec;

        JSONObject rowB = (JSONObject)json.get(1);
        assertEquals("unexpected number of keys", 2, rowB.keySet().size());
        assertEquals("unexpected row key",asHex("rowB"),rowB.get("key"));

        JSONArray colsB = (JSONArray)rowB.get("cells");
        JSONArray colB = (JSONArray)colsB.get(0);
        assert colB.size() == 3;
View Full Code Here


        SSTableExport.export(reader, new PrintStream(tempJson.getPath()), new String[0]);
        JSONArray json = (JSONArray)JSONValue.parseWithException(new FileReader(tempJson));
        assertEquals("unexpected number of rows", 1, json.size());

        JSONObject row = (JSONObject)json.get(0);
        assertEquals("unexpected number of keys", 2, row.keySet().size());
        assertEquals("unexpected row key",asHex("rowA"),row.get("key"));

        JSONArray cols = (JSONArray)row.get("cells");
        JSONArray colA = (JSONArray)cols.get(0);
        assert hexToBytes((String)colA.get(0)).equals(ByteBufferUtil.bytes("colA"));
View Full Code Here

        JSONArray json = (JSONArray)JSONValue.parseWithException(new FileReader(tempJson));
        assertEquals("unexpected number of rows", 1, json.size());

        JSONObject row = (JSONObject)json.get(0);
        assertEquals("unexpected number of keys", 2, row.keySet().size());
        assertEquals("unexpected row key",asHex("rowA"),row.get("key"));

        JSONArray cols = (JSONArray)row.get("cells");
        JSONArray colA = (JSONArray)cols.get(0);
        assert hexToBytes((String)colA.get(0)).equals(ByteBufferUtil.bytes("data"));
View Full Code Here

        JSONArray json = (JSONArray)JSONValue.parseWithException(new FileReader(tempJson));
        assertEquals("unexpected number of rows", 1, json.size());

        JSONObject row = (JSONObject)json.get(0);
        assertEquals("unexpected number of keys", 3, row.keySet().size());
        assertEquals("unexpected row key",asHex("rowA"),row.get("key"));

        // check that the row key is there and present
        String rowKey = (String) row.get("key");
        assertNotNull("expecing key to be present", rowKey);
View Full Code Here

        // check that there is metadata and that it contains deletionInfo
        JSONObject meta = (JSONObject) row.get("metadata");
        assertNotNull("expecing metadata to be present", meta);

        assertEquals("unexpected number of metadata entries", 1, meta.keySet().size());

        JSONObject serializedDeletionInfo = (JSONObject) meta.get("deletionInfo");
        assertNotNull("expecing deletionInfo to be present", serializedDeletionInfo);

        assertEquals(
View Full Code Here

            JSONObject obj = parseJSONObject(mk.getNodes("/", rev2, 0, 0, 10, null));
            // make changes from second MongoMK visible
            mk2.runBackgroundOperations();
            mk.runBackgroundOperations();
            // check child nodes of previous getNodes() call
            for (Object key : obj.keySet()) {
                String name = key.toString();
                if (name.startsWith(":")) {
                    continue;
                }
                assertNodesExist(rev2, "/" + name);
View Full Code Here

            assertEquals(3L, obj.get(":childNodeCount"));
            // @rev3 is after background read
            rev3 = mk.getHeadRevision();
            // now all nodes must be visible
            obj = parseJSONObject(mk.getNodes("/", rev3, 0, 0, 10, null));
            for (Object key : obj.keySet()) {
                String name = key.toString();
                if (name.startsWith(":")) {
                    continue;
                }
                assertNodesExist(rev3, "/" + name);
View Full Code Here

          if(type == String.class) {
            inputField.set(formValue, jsonInputs.get(inputName));
          } else if (type.isAssignableFrom(Map.class)) {
            Map<String, String> map = new HashMap<String, String>();
            JSONObject jsonObject = (JSONObject) jsonInputs.get(inputName);
            for(Object key : jsonObject.keySet()) {
              map.put((String)key, (String)jsonObject.get(key));
            }
            inputField.set(formValue, map);
          } else if(type == Integer.class) {
            inputField.set(formValue, ((Long)jsonInputs.get(inputName)).intValue());
View Full Code Here

  public Validation restoreValidation(JSONObject jsonObject) {
    JSONObject jsonMessages = (JSONObject) jsonObject.get(MESSAGES);
    Map<Validation.FormInput, Validation.Message> messages
      = new HashMap<Validation.FormInput, Validation.Message>();

    for(Object key : jsonMessages.keySet()) {
      JSONObject jsonMessage = (JSONObject) jsonMessages.get(key);

      Status status = Status.valueOf((String) jsonMessage.get(STATUS));
      String stringMessage = (String) jsonMessage.get(MESSAGE);
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.