use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class PrincipalNodeTranslator method createUserProfileFromNode.
private static void createUserProfileFromNode(final PropertyTree nodeAsTree, final User.Builder user) {
final PropertySet nodeProfile = nodeAsTree.getSet(PrincipalPropertyNames.PROFILE_KEY);
final PropertyTree profile = nodeProfile == null ? new PropertyTree() : nodeProfile.toTree();
user.profile(profile);
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class ContentServiceImplTest_applyPermissions 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").parent(ContentPath.ROOT).type(ContentTypeName.folder()).build();
final Content content = this.contentService.create(createContentParams);
final ApplyContentPermissionsParams applyParams = ApplyContentPermissionsParams.create().contentId(content.getId()).applyContentPermissionsListener(Mockito.mock(ApplyPermissionsListener.class)).build();
final ApplyContentPermissionsResult result = this.contentService.applyPermissions(applyParams);
Mockito.verify(auditLogService, Mockito.timeout(5000).times(2)).log(captor.capture());
final PropertySet logResultSet = captor.getValue().getData().getSet("result");
assertEquals(content.getPath().toString(), logResultSet.getStrings("succeedContents").iterator().next());
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class ContentServiceImplTest_duplicate method data_removed_on_duplicate.
@Test
public void data_removed_on_duplicate() throws Exception {
final CreateContentParams createContentParams = CreateContentParams.create().contentData(new PropertyTree()).displayName("rootContent").parent(ContentPath.ROOT).type(ContentTypeName.folder()).permissions(AccessControlList.create().build()).build();
final Content content = this.contentService.create(createContentParams);
this.nodeService.update(UpdateNodeParams.create().id(NodeId.from(content.getId())).editor(toBeEdited -> {
toBeEdited.data.addSet(ContentPropertyNames.PUBLISH_INFO, new PropertySet());
toBeEdited.data.addString(ContentPropertyNames.ORIGIN_PROJECT, "some-project");
toBeEdited.data.addStrings(ContentPropertyNames.INHERIT, ContentInheritType.CONTENT.name(), ContentInheritType.NAME.name());
}).build());
final Content duplicateContent = doDuplicateContent(content);
assertNull(duplicateContent.getPublishInfo());
assertNull(duplicateContent.getOriginProject());
assertTrue(duplicateContent.getInherit().isEmpty());
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class ContentServiceImplTest_duplicate method audit_data.
@Test
public void audit_data() throws Exception {
final ArgumentCaptor<LogAuditLogParams> captor = ArgumentCaptor.forClass(LogAuditLogParams.class);
final Content rootContent = createContent(ContentPath.ROOT);
final Content childContent = createContent(rootContent.getPath());
final Content duplicatedContent = doDuplicateContent(rootContent);
Mockito.verify(auditLogService, Mockito.timeout(5000).times(3)).log(captor.capture());
final PropertySet logResultSet = captor.getValue().getData().getSet("result");
final Iterable<String> ids = logResultSet.getStrings("duplicatedContents");
assertEquals(2, StreamSupport.stream(ids.spliterator(), false).count());
assertTrue(StreamSupport.stream(ids.spliterator(), false).anyMatch(id -> id.equals(duplicatedContent.getId().toString())));
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class PropertyTreeMapperTest method map.
@Test
public void map() throws Exception {
final PropertyTree properties = new PropertyTree();
final PropertySet mySet = properties.addSet("mySet");
mySet.setString("mySetValue", "value");
mySet.setString("mySetValue2", "value2");
serializeAndAssert("mapper-map", properties);
}
Aggregations