use of com.hazelcast.internal.management.request.ExecuteScriptRequest in project hazelcast by hazelcast.
the class ExecuteScriptRequestTest method testExecuteScriptRequest_withScriptException.
@Test
public void testExecuteScriptRequest_withScriptException() throws Exception {
ExecuteScriptRequest request = new ExecuteScriptRequest("print(;", "JavaScript", true, bindings);
JsonObject jsonObject = new JsonObject();
request.writeResponse(managementCenterService, jsonObject);
JsonObject result = (JsonObject) jsonObject.get("result");
String response = (String) request.readResponse(result);
assertNotNull(response);
}
use of com.hazelcast.internal.management.request.ExecuteScriptRequest in project hazelcast by hazelcast.
the class ExecuteScriptRequestTest method testExecuteScriptRequest_withIllegalScriptEngine.
@Test
public void testExecuteScriptRequest_withIllegalScriptEngine() throws Exception {
ExecuteScriptRequest request = new ExecuteScriptRequest("script", "engine", true, bindings);
JsonObject jsonObject = new JsonObject();
request.writeResponse(managementCenterService, jsonObject);
JsonObject result = (JsonObject) jsonObject.get("result");
String response = (String) request.readResponse(result);
assertContains(response, "IllegalArgumentException");
}
use of com.hazelcast.internal.management.request.ExecuteScriptRequest in project hazelcast by hazelcast.
the class ExecuteScriptRequestTest method testExecuteScriptRequest_whenTargetAllMembers_withTarget.
@Test
public void testExecuteScriptRequest_whenTargetAllMembers_withTarget() throws Exception {
Address address = cluster.getLocalMember().getAddress();
Set<String> targets = Collections.singleton(address.getHost() + ":" + address.getPort());
ExecuteScriptRequest request = new ExecuteScriptRequest("print('test');", "JavaScript", targets, bindings);
JsonObject jsonObject = new JsonObject();
request.writeResponse(managementCenterService, jsonObject);
JsonObject result = (JsonObject) jsonObject.get("result");
String response = (String) request.readResponse(result);
assertEquals("error", response.trim());
}
use of com.hazelcast.internal.management.request.ExecuteScriptRequest in project hazelcast by hazelcast.
the class ExecuteScriptRequestTest method testExecuteScriptRequest_whenTargetAllMembers.
@Test
public void testExecuteScriptRequest_whenTargetAllMembers() throws Exception {
ExecuteScriptRequest request = new ExecuteScriptRequest("print('test');", "JavaScript", true, null);
JsonObject jsonObject = new JsonObject();
request.writeResponse(managementCenterService, jsonObject);
JsonObject result = (JsonObject) jsonObject.get("result");
String response = (String) request.readResponse(result);
assertEquals("error\nerror\n", response);
}
use of com.hazelcast.internal.management.request.ExecuteScriptRequest in project hazelcast by hazelcast.
the class ExecuteScriptRequestTest method testExecuteScriptRequest.
@Test
public void testExecuteScriptRequest() throws Exception {
ExecuteScriptRequest request = new ExecuteScriptRequest("print('test');", "JavaScript", false, bindings);
JsonObject jsonObject = new JsonObject();
request.writeResponse(managementCenterService, jsonObject);
JsonObject result = (JsonObject) jsonObject.get("result");
String response = (String) request.readResponse(result);
assertEquals("", response.trim());
}
Aggregations