use of com.enonic.xp.audit.LogAuditLogParams in project xp by enonic.
the class ContentServiceImplTest_media method audit_data.
@Test
public void audit_data() throws Exception {
final ArgumentCaptor<LogAuditLogParams> captor = ArgumentCaptor.forClass(LogAuditLogParams.class);
final CreateMediaParams createMediaParams = new CreateMediaParams();
createMediaParams.byteSource(loadImage("cat-small.jpg")).name("Small cat").parent(ContentPath.ROOT);
final Content content = this.contentService.create(createMediaParams);
Mockito.verify(auditLogService, Mockito.timeout(5000).times(1)).log(captor.capture());
final PropertySet logResultSet = captor.getValue().getData().getSet("result");
assertEquals(content.getId().toString(), logResultSet.getString("id"));
assertEquals(content.getPath().toString(), logResultSet.getString("path"));
}
use of com.enonic.xp.audit.LogAuditLogParams in project xp by enonic.
the class ContentServiceImplTest_publish method audit_data.
@Test
public void audit_data() throws Exception {
final ArgumentCaptor<LogAuditLogParams> captor = ArgumentCaptor.forClass(LogAuditLogParams.class);
final CreateContentParams createContentParams = CreateContentParams.create().contentData(new PropertyTree()).displayName("This is my content").name("myContent").parent(ContentPath.ROOT).type(ContentTypeName.folder()).build();
final Content content = this.contentService.create(createContentParams);
final PublishContentResult push = this.contentService.publish(PushContentParams.create().contentIds(ContentIds.from(content.getId())).target(WS_OTHER).includeDependencies(false).build());
Mockito.verify(auditLogService, Mockito.timeout(5000).times(2)).log(captor.capture());
final PropertySet logResultSet = captor.getValue().getData().getSet("result");
assertEquals(content.getId().toString(), logResultSet.getStrings("pushedContents").iterator().next());
assertFalse(logResultSet.getStrings("deletedContents").iterator().hasNext());
assertFalse(logResultSet.getStrings("pendingContents").iterator().hasNext());
}
use of com.enonic.xp.audit.LogAuditLogParams in project xp by enonic.
the class ContentServiceImplTest_undoPendingDelete method audit_data.
@Test
public void audit_data() {
final ArgumentCaptor<LogAuditLogParams> captor = ArgumentCaptor.forClass(LogAuditLogParams.class);
final Content content = this.createTestContent("myContent");
int result = resurrect(ContentIds.from(ContentIds.from(content.getId())));
Mockito.verify(auditLogService, Mockito.timeout(5000).times(3)).log(captor.capture());
final PropertySet logResultSet = captor.getValue().getData().getSet("result");
assertEquals(content.getId().toString(), logResultSet.getString("id"));
assertEquals(content.getPath().toString(), logResultSet.getString("path"));
}
use of com.enonic.xp.audit.LogAuditLogParams in project xp by enonic.
the class ContentServiceImplTest_update method audit_data.
@Test
public void audit_data() {
final ArgumentCaptor<LogAuditLogParams> captor = ArgumentCaptor.forClass(LogAuditLogParams.class);
final PropertyTree data = new PropertyTree();
data.setString("testString", "value");
data.setString("testString2", "value");
final CreateContentParams createContentParams = CreateContentParams.create().contentData(data).displayName("This is my content").parent(ContentPath.ROOT).type(ContentTypeName.folder()).build();
final Content content = this.contentService.create(createContentParams);
final UpdateContentParams updateContentParams = new UpdateContentParams();
updateContentParams.contentId(content.getId()).editor(edit -> {
final PropertyTree editData = edit.data;
editData.setString("testString", "value-updated");
});
this.contentService.update(updateContentParams);
Mockito.verify(auditLogService, Mockito.timeout(5000).times(2)).log(captor.capture());
final PropertySet logResultSet = captor.getValue().getData().getSet("result");
assertEquals(content.getId().toString(), logResultSet.getString("id"));
assertEquals(content.getPath().toString(), logResultSet.getString("path"));
}
use of com.enonic.xp.audit.LogAuditLogParams in project xp by enonic.
the class ContentServiceImplTest_move method audit_data.
@Test
public void audit_data() throws Exception {
final ArgumentCaptor<LogAuditLogParams> captor = ArgumentCaptor.forClass(LogAuditLogParams.class);
final Content site = createContent(ContentPath.ROOT, "site");
final Content child1 = createContent(site.getPath(), "child1");
final MoveContentParams params = MoveContentParams.create().contentId(child1.getId()).parentContentPath(ContentPath.ROOT).build();
final MoveContentsResult result = this.contentService.move(params);
Mockito.verify(auditLogService, Mockito.timeout(5000).times(3)).log(captor.capture());
final PropertySet logResultSet = captor.getValue().getData().getSet("result");
assertEquals(child1.getId().toString(), logResultSet.getStrings("movedContents").iterator().next());
}
Aggregations