private static void checkJsonDatasetsOne(JsonValue v) { assertTrue(v.isObject()); JsonObject obj = v.getAsObject(); assertNotNull(obj.get("ds.name")); assertNotNull(obj.get("ds.services")); assertNotNull(obj.get("ds.state")); assertTrue(obj.get("ds.services").isArray()); }
private void checkTask(JsonValue v) { assertNotNull(v); assertTrue(v.isObject()); // System.out.println(v) ; JsonObject obj = v.getAsObject(); try { assertTrue(obj.hasKey("task")); assertTrue(obj.hasKey("taskId")); // Not present until it runs : "started" } catch (AssertionError ex) { System.out.println(obj); throw ex; } }
private void checkInTasks(String x) { String url = urlRoot + "$/tasks"; JsonValue v = httpGetJson(url); assertTrue(v.isArray()); JsonArray array = v.getAsArray(); int found = 0; for (int i = 0; i < array.size(); i++) { JsonValue jv = array.get(i); assertTrue(jv.isObject()); JsonObject obj = jv.getAsObject(); checkTask(obj); if (obj.get("taskId").getAsString().value().equals(x)) { found++; } } assertEquals("Occurence of taskId count", 1, found); }