Search in sources :

Example 16 with JsonObject

use of org.apache.jena.atlas.json.JsonObject in project jena by apache.

the class TestAdmin method checkJsonDatasetsOne.

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());
}
Also used : JsonObject(org.apache.jena.atlas.json.JsonObject)

Example 17 with JsonObject

use of org.apache.jena.atlas.json.JsonObject in project jena by apache.

the class TestAdmin method checkInTasks.

private static void checkInTasks(String x) {
    String url = ServerCtl.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);
}
Also used : JsonArray(org.apache.jena.atlas.json.JsonArray) JsonValue(org.apache.jena.atlas.json.JsonValue) JsonObject(org.apache.jena.atlas.json.JsonObject)

Example 18 with JsonObject

use of org.apache.jena.atlas.json.JsonObject in project jena by apache.

the class TestAdmin method checkJsonStatsCounters.

private static void checkJsonStatsCounters(JsonValue v) {
    JsonObject obj = v.getAsObject();
    assertTrue(obj.hasKey("Requests"));
    assertTrue(obj.hasKey("RequestsGood"));
    assertTrue(obj.hasKey("RequestsBad"));
}
Also used : JsonObject(org.apache.jena.atlas.json.JsonObject)

Example 19 with JsonObject

use of org.apache.jena.atlas.json.JsonObject in project jena by apache.

the class TestAdmin method checkTask.

private static 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;
    }
}
Also used : JsonObject(org.apache.jena.atlas.json.JsonObject)

Example 20 with JsonObject

use of org.apache.jena.atlas.json.JsonObject in project jena by apache.

the class TestAdmin method checkJsonStatsAll.

private static void checkJsonStatsAll(JsonValue v) {
    assertNotNull(v.getAsObject().get("datasets"));
    JsonObject a = v.getAsObject().get("datasets").getAsObject();
    for (String dsname : a.keys()) {
        JsonValue obj = a.get(dsname).getAsObject();
        checkJsonStatsOne(obj);
    }
}
Also used : JsonValue(org.apache.jena.atlas.json.JsonValue) JsonObject(org.apache.jena.atlas.json.JsonObject)

Aggregations

JsonObject (org.apache.jena.atlas.json.JsonObject)23 Test (org.junit.Test)8 BaseTest (org.apache.jena.atlas.junit.BaseTest)7 StoreParams (org.apache.jena.tdb.setup.StoreParams)5 JsonValue (org.apache.jena.atlas.json.JsonValue)4 OutputStream (java.io.OutputStream)3 JsonArray (org.apache.jena.atlas.json.JsonArray)3 JsonString (org.apache.jena.atlas.json.JsonString)2 ActionErrorException (org.apache.jena.fuseki.servlets.ActionErrorException)2 ValidationAction (org.apache.jena.fuseki.validation.json.ValidationAction)2 Model (org.apache.jena.rdf.model.Model)2 JsonLDWriteContext (org.apache.jena.riot.JsonLDWriteContext)2 BufferedOutputStream (java.io.BufferedOutputStream)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 ServletOutputStream (javax.servlet.ServletOutputStream)1 JsonBuilder (org.apache.jena.atlas.json.JsonBuilder)1 Node (org.apache.jena.graph.Node)1 Resource (org.apache.jena.rdf.model.Resource)1 LabelToNode (org.apache.jena.riot.lang.LabelToNode)1