Package org.json.simple

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


  public void createUDF() {
    Response response = doCreateUDF();
    Assert.assertEquals(201, response.getStatus());

    JSONObject obj = (JSONObject)response.getEntity();
    Assert.assertTrue(obj.containsKey("udf"));
    Assert.assertNotNull(((UDF) obj.get("udf")).getId());
    Assert.assertFalse(((UDF) obj.get("udf")).getId().isEmpty());
  }

  @Test
View Full Code Here


    Response response2 = udfService.getUDF(createdUdfId);
    Assert.assertEquals(200, response2.getStatus());

    JSONObject obj = ((JSONObject) response2.getEntity());
    Assert.assertTrue(obj.containsKey("udf"));
    Assert.assertEquals(((UDF) obj.get("udf")).getName(), request.udf.getName());
    Assert.assertEquals(((UDF) obj.get("udf")).getPath(), request.udf.getPath());
  }

  @Test
View Full Code Here

  public void configTest() {
    Response response = helpService.config();
    Assert.assertEquals(200, response.getStatus());

    JSONObject obj = (JSONObject)response.getEntity();
    Assert.assertTrue(obj.containsKey("dataworker.defaultFs"));
    Assert.assertEquals(hdfsURI, obj.get("dataworker.defaultFs"));
  }
}
View Full Code Here

    try {
      for (String updateKey : updateKeys) {
        JSONObject counters = (JSONObject) result.get("counters");
 
        updateKey = updateKey.substring(updateKey.indexOf("_") + 1, updateKey.length());
        if (!counters.containsKey(updateKey)) {
          counters.put(updateKey, new JSONObject());
        }
       
        for (Object[] update : updates) {
          Long _slot = (Long) update[0];
View Full Code Here

      for (int i = 0; i < filesRegions.size(); i++) {
        JSONObject filesRegion = (JSONObject) filesRegions.get(i);
        String regionId = (String) filesRegion.get("region");
        String publicUrl = (String) filesRegion.get("publicURL");
        String cdnUrl = cdnUrls.containsKey(regionId) ? cdnUrls.get(regionId) : "";
        Boolean v1Default = filesRegion.containsKey("v1Default")
            ? (Boolean) filesRegion.get("v1Default")
            : Boolean.FALSE;
        regions.add(new FilesRegion(regionId, publicUrl, cdnUrl, v1Default.booleanValue()));
      }
    } catch (Exception e) {
View Full Code Here

            Object obj = parser.parse(response);
            JSONArray jsonObject = (JSONArray) obj;
            Iterator<JSONObject> iterator = jsonObject.iterator();
            while (iterator.hasNext()) {
                JSONObject object = iterator.next();
                if (object.containsKey("authserver.mojang.com")) {
                    if (((String) object.get("authserver.mojang.com")).equalsIgnoreCase("green")) {
                        minecraftLoginServerUp = true;
                    }
                } else if (object.containsKey("session.minecraft.net")) {
                    if (((String) object.get("session.minecraft.net")).equalsIgnoreCase("green")) {
View Full Code Here

                JSONObject object = iterator.next();
                if (object.containsKey("authserver.mojang.com")) {
                    if (((String) object.get("authserver.mojang.com")).equalsIgnoreCase("green")) {
                        minecraftLoginServerUp = true;
                    }
                } else if (object.containsKey("session.minecraft.net")) {
                    if (((String) object.get("session.minecraft.net")).equalsIgnoreCase("green")) {
                        minecraftSessionServerUp = true;
                    }
                }
            }
View Full Code Here

                HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                conn.setRequestMethod("GET");
                assertEquals(HttpServletResponse.SC_OK, conn.getResponseCode());
                assertTrue(conn.getHeaderField("content-type").startsWith(RestConstants.JSON_CONTENT_TYPE));
                JSONObject json = (JSONObject) JSONValue.parse(new InputStreamReader(conn.getInputStream()));
                assertTrue(json.containsKey("USER"));
                return null;
            }
        });
    }
View Full Code Here

                HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                conn.setRequestMethod("GET");
                assertEquals(HttpServletResponse.SC_OK, conn.getResponseCode());
                assertTrue(conn.getHeaderField("content-type").startsWith(RestConstants.JSON_CONTENT_TYPE));
                JSONObject json = (JSONObject) JSONValue.parse(new InputStreamReader(conn.getInputStream()));
                assertTrue(json.containsKey("java.version"));
                return null;
            }
        });
    }
View Full Code Here

                HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                conn.setRequestMethod("GET");
                assertEquals(HttpServletResponse.SC_OK, conn.getResponseCode());
                assertTrue(conn.getHeaderField("content-type").startsWith(RestConstants.JSON_CONTENT_TYPE));
                JSONObject json = (JSONObject) JSONValue.parse(new InputStreamReader(conn.getInputStream()));
                assertTrue(json.containsKey(Services.CONF_SERVICE_CLASSES));
                return null;
            }
        });
    }
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.