use of org.apache.jena.atlas.json.JsonObject in project jena by apache.
the class TestStoreParams method store_params_12.
@Test
public void store_params_12() {
String xs = "{ \"tdb.file_mode\": \"direct\" , \"tdb.block_size\": 2048 }";
JsonObject x = JSON.parse(xs);
StoreParams paramsExpected = StoreParams.builder().blockSize(2048).fileMode(FileMode.direct).build();
StoreParams paramsActual = StoreParamsCodec.decode(x);
assertEqualsStoreParams(paramsExpected, paramsActual);
}
use of org.apache.jena.atlas.json.JsonObject in project jena by apache.
the class TestStoreParams method store_params_14.
@Test(expected = TDBException.class)
public void store_params_14() {
// Misspelt.
String xs = "{ \"tdb.triples_indexes\" : [ \"POS\" , \"PSO\"] } ";
JsonObject x = JSON.parse(xs);
StoreParams params = StoreParamsCodec.decode(x);
String[] expected = { "POS", "PSO" };
assertArrayEquals(expected, params.getTripleIndexes());
}
use of org.apache.jena.atlas.json.JsonObject in project jena by apache.
the class TestStoreParams method store_params_11.
@Test
public void store_params_11() {
String xs = "{ \"tdb.block_size\": 2048 }";
JsonObject x = JSON.parse(xs);
StoreParams paramsExpected = StoreParams.builder().blockSize(2048).build();
StoreParams paramsActual = StoreParamsCodec.decode(x);
assertEqualsStoreParams(paramsExpected, paramsActual);
}
use of org.apache.jena.atlas.json.JsonObject in project jena by apache.
the class TestJsonExt method js_map_ext_1.
@Test
public void js_map_ext_1() {
JsonObject obj = new JsonObject();
obj.put("abc", JsonNumber.value(123));
writeRead(obj);
// Use of key.
read("{abc: 123}", obj);
}
use of org.apache.jena.atlas.json.JsonObject in project jena by apache.
the class ValidatorBase method executeJSON.
protected void executeJSON(HttpServletRequest request, HttpServletResponse response, JsonAction jsonAction) {
long id = allocRequestId(request, response);
ValidationAction action = new ValidationAction(id, vLog, request, response, false);
printRequest(action);
action.setStartTime();
response = action.response;
initResponse(request, response);
try {
JsonObject obj = jsonAction.execute(action);
action.statusCode = HttpSC.OK_200;
action.message = "OK";
response.setCharacterEncoding(charsetUTF8);
response.setContentType(contentTypeJSON);
//response.setContentType(WebContent.contentTypeTextPlain);
action.response.setStatus(HttpSC.OK_200);
OutputStream out = response.getOutputStream();
JSON.write(out, obj);
} catch (ActionErrorException ex) {
if (ex.getCause() != null)
ex.getCause().printStackTrace(System.err);
if (ex.getMessage() != null)
ServletOps.responseSendError(response, ex.getRC(), ex.getMessage());
else
ServletOps.responseSendError(response, ex.getRC());
} catch (Throwable th) {
ServletOps.responseSendError(response, HttpSC.INTERNAL_SERVER_ERROR_500, "Internal Error");
}
action.setFinishTime();
printResponse(action);
}
Aggregations