use of elemental.json.JsonObject in project che by eclipse.
the class EditorAgentImpl method storeEditors.
private JsonObject storeEditors(EditorMultiPartStackState splitStacks) {
JsonObject result = Json.createObject();
if (splitStacks.getEditorPartStack() != null) {
result.put("FILES", storeEditors(splitStacks.getEditorPartStack()));
} else {
result.put("DIRECTION", splitStacks.getDirection().toString());
result.put("SPLIT_FIRST", storeEditors(splitStacks.getSplitFirst()));
result.put("SPLIT_SECOND", storeEditors(splitStacks.getSplitSecond()));
result.put("SIZE", splitStacks.getSize());
}
return result;
}
use of elemental.json.JsonObject in project che by eclipse.
the class JsonRpcRequestTest method shouldToJsonObjectWhenPassStringParamsWithoutIdAndWithParams.
@Test
public void shouldToJsonObjectWhenPassStringParamsWithoutIdAndWithParams() {
when(params.emptyOrAbsent()).thenReturn(false);
JsonObject expected = request;
expected.remove("id");
JsonRpcRequest jsonRpcRequest = new JsonRpcRequest("method", params, jsonFactory);
JsonObject actual = jsonRpcRequest.toJsonObject();
assertTrue(expected.jsEquals(actual));
}
use of elemental.json.JsonObject in project che by eclipse.
the class JsonRpcRequestTest method shouldToJsonObjectWhenParseStringParamsWithoutIdAndWithoutParams.
@Test
public void shouldToJsonObjectWhenParseStringParamsWithoutIdAndWithoutParams() {
when(params.emptyOrAbsent()).thenReturn(false);
JsonObject expected = request;
expected.remove("params");
expected.remove("id");
JsonRpcRequest jsonRpcRequest = new JsonRpcRequest(request.toJson(), jsonFactory, jsonRpcFactory);
JsonObject actual = jsonRpcRequest.toJsonObject();
assertTrue(expected.jsEquals(actual));
}
use of elemental.json.JsonObject in project che by eclipse.
the class JsonRpcRequestTest method shouldToStringWhenPassStringParamsWithIdAndWithoutParams.
@Test
public void shouldToStringWhenPassStringParamsWithIdAndWithoutParams() {
when(params.emptyOrAbsent()).thenReturn(true);
JsonObject expected = request;
expected.remove("params");
JsonRpcRequest jsonRpcRequest = new JsonRpcRequest("0", "method", params, jsonFactory);
JsonValue actual = jsonFactory.parse(jsonRpcRequest.toString());
assertTrue(expected.jsEquals(actual));
}
use of elemental.json.JsonObject in project che by eclipse.
the class JsonRpcResponseTest method setUp.
@Before
public void setUp() throws Exception {
response = jsonFactory.createObject();
JsonObject error = jsonFactory.createObject();
JsonObject result = jsonFactory.createObject();
error.put("code", 0);
error.put("message", "error message");
response.put("jsonrpc", "2.0");
response.put("id", "0");
response.put("error", error);
response.put("result", result);
when(this.result.toJsonValue()).thenReturn(result);
when(this.error.toJsonObject()).thenReturn(error);
}
Aggregations