Search in sources :

Example 1 with CleanUpAuditLogRequestJson

use of com.enonic.xp.impl.server.rest.model.CleanUpAuditLogRequestJson 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"));
}
Also used : SubmitTaskParams(com.enonic.xp.task.SubmitTaskParams) TaskResultJson(com.enonic.xp.task.TaskResultJson) CleanUpAuditLogRequestJson(com.enonic.xp.impl.server.rest.model.CleanUpAuditLogRequestJson) Test(org.junit.jupiter.api.Test)

Aggregations

CleanUpAuditLogRequestJson (com.enonic.xp.impl.server.rest.model.CleanUpAuditLogRequestJson)1 SubmitTaskParams (com.enonic.xp.task.SubmitTaskParams)1 TaskResultJson (com.enonic.xp.task.TaskResultJson)1 Test (org.junit.jupiter.api.Test)1