Search in sources :

Example 6 with JsonValue

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

the class ActionBackupList method perform.

@Override
protected void perform(HttpAction action) {
    JsonValue result = description(action);
    ServletOps.setNoCache(action.response);
    ServletOps.sendJsonReponse(action, result);
}
Also used : JsonValue(org.apache.jena.atlas.json.JsonValue)

Example 7 with JsonValue

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

the class TestAdmin method execSleepTask.

private static String execSleepTask(String name, int millis) {
    String url = ServerCtl.urlRoot() + "$/sleep";
    if (name != null) {
        if (name.startsWith("/"))
            name = name.substring(1);
        url = url + "/" + name;
    }
    JsonResponseHandler x = new JsonResponseHandler();
    HttpOp.execHttpPost(url + "?interval=" + millis, null, WebContent.contentTypeJSON, x);
    JsonValue v = x.getJSON();
    String id = v.getAsObject().get("taskId").getAsString().value();
    return id;
}
Also used : JsonValue(org.apache.jena.atlas.json.JsonValue)

Example 8 with JsonValue

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

the class TestAdmin method checkTask.

private static void checkTask(String x) {
    String url = ServerCtl.urlRoot() + "$/tasks/" + x;
    JsonValue v = httpGetJson(url);
    checkTask(v);
}
Also used : JsonValue(org.apache.jena.atlas.json.JsonValue)

Example 9 with JsonValue

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

the class TestAdmin method server_1.

// --- Server status 
@Test
public void server_1() {
    JsonValue jv = httpGetJson(ServerCtl.urlRoot() + "$/" + opServer);
    JsonObject obj = jv.getAsObject();
    // Now optional : assertTrue(obj.hasKey(JsonConst.admin)) ;
    assertTrue(obj.hasKey(JsonConst.datasets));
    assertTrue(obj.hasKey(JsonConst.uptime));
    assertTrue(obj.hasKey(JsonConst.startDT));
}
Also used : JsonValue(org.apache.jena.atlas.json.JsonValue) JsonObject(org.apache.jena.atlas.json.JsonObject) Test(org.junit.Test)

Example 10 with JsonValue

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

the class TestAdmin method getDatasetDescription.

private static JsonValue getDatasetDescription(String dsName) {
    try (TypedInputStream in = execHttpGet(ServerCtl.urlRoot() + "$/" + opDatasets + "/" + dsName)) {
        assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType());
        JsonValue v = JSON.parse(in);
        return v;
    }
}
Also used : JsonValue(org.apache.jena.atlas.json.JsonValue) TypedInputStream(org.apache.jena.atlas.web.TypedInputStream)

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