use of com.enonic.xp.task.TaskResultJson in project xp by enonic.
the class CleanUpAuditLogCommand method execute.
public TaskResultJson execute() {
PropertyTree config = new PropertyTree();
if (params.getAgeThreshold() != null) {
config.addString("ageThreshold", params.getAgeThreshold());
}
final TaskId taskId = taskService.submitTask(SubmitTaskParams.create().descriptorKey(DescriptorKey.from("com.enonic.xp.app.system:audit-log-cleanup")).data(config).build());
return new TaskResultJson(taskId);
}
use of com.enonic.xp.task.TaskResultJson in project xp by enonic.
the class RepositoryResourceTest method exportNodes.
@Test
public void exportNodes() throws Exception {
Mockito.when(taskService.submitTask(Mockito.isA(ExportRunnableTask.class), eq("export"))).thenReturn(TaskId.from("task-id"));
final ExportNodesRequestJson json = Mockito.mock(ExportNodesRequestJson.class);
final TaskResultJson result = resource.exportNodes(json);
assertEquals("task-id", result.getTaskId());
}
use of com.enonic.xp.task.TaskResultJson in project xp by enonic.
the class AuditLogResourceTest method cleanUpAuditLog.
@Test
public void cleanUpAuditLog() throws Exception {
Mockito.when(taskService.submitTask(isA(SubmitTaskParams.class))).thenReturn(TaskId.from("task-id"));
final CleanUpAuditLogRequestJson requestJson = new CleanUpAuditLogRequestJson("PT1s");
final TaskResultJson result = resource.cleanup(requestJson);
final ArgumentCaptor<SubmitTaskParams> captor = ArgumentCaptor.forClass(SubmitTaskParams.class);
Mockito.verify(taskService, Mockito.times(1)).submitTask(captor.capture());
assertEquals("task-id", result.getTaskId());
assertEquals(1, captor.getValue().getData().getTotalSize());
assertEquals("PT1s", captor.getValue().getData().getString("ageThreshold"));
}
use of com.enonic.xp.task.TaskResultJson in project xp by enonic.
the class SystemResourceTest method load.
@Test
public void load() throws Exception {
Mockito.when(taskService.submitTask(Mockito.isA(LoadRunnableTask.class), eq("load"))).thenReturn(TaskId.from("task-id"));
final SystemLoadRequestJson json = Mockito.mock(SystemLoadRequestJson.class);
final TaskResultJson result = resource.load(json);
assertEquals("task-id", result.getTaskId());
}
use of com.enonic.xp.task.TaskResultJson in project xp by enonic.
the class VacuumCommand method execute.
public TaskResultJson execute() {
PropertyTree config = new PropertyTree();
if (params.getAgeThreshold() != null) {
config.addString("ageThreshold", params.getAgeThreshold());
}
if (params.getTasks() != null) {
config.addStrings("tasks", params.getTasks());
}
final TaskId taskId = taskService.submitTask(SubmitTaskParams.create().descriptorKey(DescriptorKey.from("com.enonic.xp.app.system:vacuum")).data(config).build());
return new TaskResultJson(taskId);
}
Aggregations