use of com.enonic.xp.task.TaskResultJson in project xp by enonic.
the class SystemResourceTest method vacuum.
@Test
public void vacuum() throws Exception {
Mockito.when(taskService.submitTask(isA(SubmitTaskParams.class))).thenReturn(TaskId.from("task-id"));
final TaskResultJson result = resource.vacuum(null);
assertEquals("task-id", result.getTaskId());
}
use of com.enonic.xp.task.TaskResultJson in project xp by enonic.
the class SystemResourceTest method upgrade.
@Test
public void upgrade() throws Exception {
Mockito.when(taskService.submitTask(Mockito.isA(UpgradeRunnableTask.class), eq("upgrade"))).thenReturn(TaskId.from("task-id"));
final SystemDumpUpgradeRequestJson json = Mockito.mock(SystemDumpUpgradeRequestJson.class);
final TaskResultJson result = resource.upgrade(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);
}
use of com.enonic.xp.task.TaskResultJson in project xp by enonic.
the class RepositoryResourceTest method importNodes.
@Test
public void importNodes() throws Exception {
Mockito.when(taskService.submitTask(Mockito.isA(ImportRunnableTask.class), eq("import"))).thenReturn(TaskId.from("task-id"));
final ImportNodesRequestJson json = Mockito.mock(ImportNodesRequestJson.class);
final TaskResultJson result = resource.importNodes(json);
assertEquals("task-id", result.getTaskId());
}
Aggregations