use of org.infinispan.scripting.impl.ScriptTask in project infinispan by infinispan.
the class SecureScriptingTaskManagerTest method testTask.
public void testTask() throws Exception {
Security.doAs(PHEIDIPPIDES, new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception {
String result = CompletionStages.join(taskManager.runTask(SCRIPT_NAME, new TaskContext().addParameter("a", "a")));
assertEquals("a", result);
return null;
}
});
List<Task> tasks = taskManager.getTasks();
assertEquals(1, tasks.size());
ScriptTask scriptTask = (ScriptTask) tasks.get(0);
assertEquals(SCRIPT_NAME, scriptTask.getName());
assertEquals(TaskExecutionMode.ONE_NODE, scriptTask.getExecutionMode());
assertEquals("Script", scriptTask.getType());
}
use of org.infinispan.scripting.impl.ScriptTask in project infinispan by infinispan.
the class ScriptingTaskManagerTest method testTask.
public void testTask() throws Exception {
ScriptingManager scriptingManager = extractGlobalComponent(cacheManager, ScriptingManager.class);
ScriptingUtils.loadScript(scriptingManager, TEST_SCRIPT);
String result = CompletionStages.join(taskManager.runTask(TEST_SCRIPT, new TaskContext().addParameter("a", "a")));
assertEquals("a", result);
List<Task> tasks = taskManager.getTasks();
assertEquals(1, tasks.size());
ScriptTask scriptTask = (ScriptTask) tasks.get(0);
assertEquals("test.js", scriptTask.getName());
assertEquals(TaskExecutionMode.ONE_NODE, scriptTask.getExecutionMode());
assertEquals("Script", scriptTask.getType());
}
Aggregations