Search in sources :

Example 21 with JsonValue

use of org.apache.jena.atlas.json.JsonValue 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 22 with JsonValue

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

the class TestAdmin method stats_2.

@Test
public void stats_2() {
    addTestDataset();
    JsonValue v = execGetJSON(ServerCtl.urlRoot() + "$/" + opStats + ServerCtl.datasetPath());
    checkJsonStatsAll(v);
    deleteDataset(dsTest);
}
Also used : JsonValue(org.apache.jena.atlas.json.JsonValue) Test(org.junit.Test)

Example 23 with JsonValue

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

the class TestAdmin method list_datasets_2.

@Test
public void list_datasets_2() {
    try (TypedInputStream in = execHttpGet(ServerCtl.urlRoot() + "$/" + opDatasets)) {
        assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType());
        JsonValue v = JSON.parseAny(in);
        assertNotNull(v.getAsObject().get("datasets"));
        checkJsonDatasetsAll(v);
    }
}
Also used : JsonValue(org.apache.jena.atlas.json.JsonValue) TypedInputStream(org.apache.jena.atlas.web.TypedInputStream) Test(org.junit.Test)

Example 24 with JsonValue

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

the class TestAdmin method stats_1.

// ---- Backup
// ---- Server
// ---- Stats
@Test
public void stats_1() {
    JsonValue v = execGetJSON(ServerCtl.urlRoot() + "$/" + opStats);
    checkJsonStatsAll(v);
}
Also used : JsonValue(org.apache.jena.atlas.json.JsonValue) Test(org.junit.Test)

Example 25 with JsonValue

use of org.apache.jena.atlas.json.JsonValue 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

JsonValue (org.apache.jena.atlas.json.JsonValue)28 Test (org.junit.Test)7 JsonArray (org.apache.jena.atlas.json.JsonArray)4 JsonObject (org.apache.jena.atlas.json.JsonObject)4 TypedInputStream (org.apache.jena.atlas.web.TypedInputStream)3 JsonBuilder (org.apache.jena.atlas.json.JsonBuilder)2 AsyncTask (org.apache.jena.fuseki.async.AsyncTask)2 ServletOutputStream (javax.servlet.ServletOutputStream)1 JsonParseException (org.apache.jena.atlas.json.JsonParseException)1 JsonString (org.apache.jena.atlas.json.JsonString)1 HttpException (org.apache.jena.atlas.web.HttpException)1 AsyncPool (org.apache.jena.fuseki.async.AsyncPool)1 Node (org.apache.jena.graph.Node)1 LabelToNode (org.apache.jena.riot.lang.LabelToNode)1 Var (org.apache.jena.sparql.core.Var)1 BindingMap (org.apache.jena.sparql.engine.binding.BindingMap)1