Search in sources :

Example 1 with FindAuditLogResult

use of com.enonic.xp.audit.FindAuditLogResult in project xp by enonic.

the class FindAuditLogHandler method doExecute.

@Override
protected Object doExecute() {
    final FindAuditLogParams params = FindAuditLogParams.create().ids(ids).from(from).to(to).type(type).source(source).count(count).start(start).users(users).objectUris(objectUris).build();
    final FindAuditLogResult result = auditLogService.find(params);
    return new FindAuditLogResultMapper(result);
}
Also used : FindAuditLogResultMapper(com.enonic.xp.lib.audit.mapper.FindAuditLogResultMapper) FindAuditLogResult(com.enonic.xp.audit.FindAuditLogResult) FindAuditLogParams(com.enonic.xp.audit.FindAuditLogParams)

Example 2 with FindAuditLogResult

use of com.enonic.xp.audit.FindAuditLogResult in project xp by enonic.

the class AuditLogServiceImplTest method find.

@Test
public void find() {
    FindAuditLogResult result = auditLogService.find(FindAuditLogParams.create().type(auditLogParams.getType()).build());
    assertEquals(1, result.getCount());
    assertEquals(1, result.getTotal());
    assertLog(result.getHits().first());
}
Also used : FindAuditLogResult(com.enonic.xp.audit.FindAuditLogResult) Test(org.junit.jupiter.api.Test)

Example 3 with FindAuditLogResult

use of com.enonic.xp.audit.FindAuditLogResult in project xp by enonic.

the class AuditLogServiceImplTest method find_no_filter.

@Test
public void find_no_filter() {
    FindAuditLogResult result = auditLogService.find(FindAuditLogParams.create().build());
    assertEquals(1, result.getCount());
    assertEquals(1, result.getTotal());
    assertLog(result.getHits().first());
}
Also used : FindAuditLogResult(com.enonic.xp.audit.FindAuditLogResult) Test(org.junit.jupiter.api.Test)

Example 4 with FindAuditLogResult

use of com.enonic.xp.audit.FindAuditLogResult in project xp by enonic.

the class AuditLogServiceImplTest_find method find_to.

@Test
public void find_to() {
    AuditLog log = logAsAdmin(LogAuditLogParams.create().type("test").time(Instant.now()).build());
    FindAuditLogResult result = findAsAdmin(FindAuditLogParams.create().to(Instant.now().minus(30, ChronoUnit.DAYS)).build());
    assertEquals(0L, result.getCount());
    result = findAsAdmin(FindAuditLogParams.create().to(Instant.now()).build());
    assertEquals(1L, result.getCount());
    assertEquals(log, result.getHits().first());
}
Also used : FindAuditLogResult(com.enonic.xp.audit.FindAuditLogResult) AuditLog(com.enonic.xp.audit.AuditLog) Test(org.junit.jupiter.api.Test)

Example 5 with FindAuditLogResult

use of com.enonic.xp.audit.FindAuditLogResult in project xp by enonic.

the class AuditLogServiceImplTest_find method find.

@Test
public void find() {
    LogAuditLogParams params = LogAuditLogParams.create().type("test").build();
    AuditLog log = logAsAdmin(params);
    FindAuditLogResult result = findAsAdmin(FindAuditLogParams.create().ids(AuditLogIds.from(log.getId())).build());
    assertEquals(1L, result.getCount());
    assertEquals(log, result.getHits().first());
}
Also used : LogAuditLogParams(com.enonic.xp.audit.LogAuditLogParams) FindAuditLogResult(com.enonic.xp.audit.FindAuditLogResult) AuditLog(com.enonic.xp.audit.AuditLog) Test(org.junit.jupiter.api.Test)

Aggregations

FindAuditLogResult (com.enonic.xp.audit.FindAuditLogResult)10 Test (org.junit.jupiter.api.Test)9 AuditLog (com.enonic.xp.audit.AuditLog)6 LogAuditLogParams (com.enonic.xp.audit.LogAuditLogParams)3 FindAuditLogParams (com.enonic.xp.audit.FindAuditLogParams)1 Context (com.enonic.xp.context.Context)1 AuditLogContext (com.enonic.xp.core.impl.audit.AuditLogContext)1 FindAuditLogResultMapper (com.enonic.xp.lib.audit.mapper.FindAuditLogResultMapper)1