use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class CreateContentCommandTest method initContent.
private NodePath initContent(final ContentTypeName contentTypeName, final String name, final NodePath parentPath) {
final PropertyTree nodeData = new PropertyTree();
nodeData.setString(ContentPropertyNames.TYPE, contentTypeName.toString());
nodeData.setSet(ContentPropertyNames.DATA, new PropertySet());
nodeData.setString(ContentPropertyNames.CREATOR, "user:myidprovider:user1");
final Node node = Node.create().id(NodeId.from(name)).name(name).parentPath(parentPath).data(nodeData).build();
Mockito.when(nodeService.getByPath(Mockito.eq(node.path()))).thenReturn(node);
Mockito.when(nodeService.getById(Mockito.eq(node.id()))).thenReturn(node);
return node.path();
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class PageRegionsConfigProcessorTest method test_complex_component_config.
@Test
public void test_complex_component_config() throws Exception {
final PropertyTree config = new PropertyTree();
final PropertySet items = config.addSet("items");
items.addStrings("input", "a", "b", "c");
final Page page = Page.create().regions(PageRegions.create().add(Region.create().name("region1").add(PartComponent.create().descriptor(DescriptorKey.from("appKey1:partName1")).config(new PropertyTree()).build()).add(LayoutComponent.create().descriptor(DescriptorKey.from("appKey2:layoutName")).config(new PropertyTree()).regions(LayoutRegions.create().add(Region.create().name("region").add(PartComponent.create().descriptor(DescriptorKey.from("appKey3:partName2")).config(new PropertyTree()).build()).build()).build()).build()).build()).build()).build();
final Form form = Form.create().addFormItem(FormItemSet.create().name("items").addFormItem(Input.create().name("input").label("input").inputType(InputTypeName.TEXT_LINE).occurrences(0, 5).build()).build()).build();
final PatternIndexConfigDocument result = processPage(page, Arrays.asList(form, form).listIterator(), singletonList(form).listIterator());
assertEquals(8, result.getPathIndexConfigs().size());
assertEquals(IndexConfig.BY_TYPE, result.getConfigForPath(PropertyPath.from("components.part.config.appKey1.partName1")));
assertEquals(IndexConfig.BY_TYPE, result.getConfigForPath(PropertyPath.from("components.part.config.appKey2.layoutName")));
assertEquals(IndexConfig.BY_TYPE, result.getConfigForPath(PropertyPath.from("components.part.config.appkey3.partname2")));
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class ProjectAccessSiteProcessorTest method createSiteConfig.
private PropertySet createSiteConfig(final String bgColor) {
PropertySet set = new PropertySet();
set.addString("applicationKey", "com.enonic.app.test");
PropertySet siteConfig = set.addSet("config");
siteConfig.addString("backgroundColor", bgColor);
return set;
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class ArchiveInitializer method initArchiveNode.
private void initArchiveNode() {
LOG.info("Archive root-node not found, creating");
final PropertyTree data = new PropertyTree();
data.setString(ContentPropertyNames.TYPE, ContentTypeName.folder().toString());
data.setSet(ContentPropertyNames.DATA, new PropertySet());
data.setString(ContentPropertyNames.CREATOR, ContextAccessor.current().getAuthInfo().getUser().toString());
data.setString(ContentPropertyNames.MODIFIER, ContextAccessor.current().getAuthInfo().getUser().toString());
final Node archiveRoot = nodeService.create(CreateNodeParams.create().data(data).name(ArchiveConstants.ARCHIVE_ROOT_NAME).parent(NodePath.ROOT).permissions(Objects.requireNonNullElse(accessControlList, ArchiveConstants.ARCHIVE_ROOT_DEFAULT_ACL)).childOrder(ArchiveConstants.DEFAULT_ARCHIVE_REPO_ROOT_ORDER).build());
LOG.info("Created archive root-node: " + archiveRoot.path());
nodeService.refresh(RefreshMode.ALL);
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class SchedulableTaskImplTest method mockNode.
private void mockNode() {
final PropertyTree jobData = new PropertyTree();
final PropertySet calendar = new PropertySet();
calendar.addString(ScheduledJobPropertyNames.CALENDAR_TYPE, "ONE_TIME");
calendar.addString(ScheduledJobPropertyNames.CALENDAR_VALUE, "2021-02-25T10:44:33.170079900Z");
jobData.addString(ScheduledJobPropertyNames.DESCRIPTOR, "app:key");
jobData.addBoolean(ScheduledJobPropertyNames.ENABLED, true);
jobData.addSet(ScheduledJobPropertyNames.CALENDAR, calendar);
jobData.addSet(ScheduledJobPropertyNames.CONFIG, new PropertySet());
jobData.setString(ScheduledJobPropertyNames.CREATOR, "user:system:creator");
jobData.setString(ScheduledJobPropertyNames.MODIFIER, "user:system:modifier");
jobData.setString(ScheduledJobPropertyNames.CREATED_TIME, "2021-02-26T10:44:33.170079900Z");
jobData.setString(ScheduledJobPropertyNames.MODIFIED_TIME, "2021-03-26T10:44:33.170079900Z");
final Node job = Node.create().id(NodeId.from("abc")).name("test").parentPath(NodePath.ROOT).data(jobData).build();
when(nodeService.update(isA(UpdateNodeParams.class))).thenReturn(job);
}
Aggregations