use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class IssueNodeTranslatorTest method createItemSet.
private static PropertySet createItemSet(final String id, final boolean recursive) {
final PropertySet itemSet = new PropertySet();
itemSet.addString(PublishRequestPropertyNames.ITEM_ID, id);
itemSet.addBoolean(PublishRequestPropertyNames.ITEM_RECURSIVE, recursive);
return itemSet;
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class UpdateIssueCommandTest method createMockData.
private PropertyTree createMockData() {
final PropertyTree propertyTree = new PropertyTree();
final PropertySet issueAsData = propertyTree.getRoot();
issueAsData.ifNotNull().addString(STATUS, IssueStatus.OPEN.toString());
issueAsData.ifNotNull().addString(CREATOR, PrincipalKey.from("user:myStore:me").toString());
issueAsData.ifNotNull().addString(TITLE, "title");
issueAsData.ifNotNull().addLong(INDEX, 1L);
return propertyTree;
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class PageDataSerializerTest method component_config.
@Test
public void component_config() {
final Page page = createPage();
final PropertyTree pageAsData = new PropertyTree();
pageDataSerializer.toData(page, pageAsData.getRoot());
final PropertySet componentOnlyData = pageAsData.getRoot().getProperties(COMPONENTS).get(1).getSet();
assertTrue(componentOnlyData.hasProperty("part.config.app-descriptor-x.name-x"));
assertEquals("somevalue", componentOnlyData.getString("part.config.app-descriptor-x.name-x.some"));
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class OccurrenceValidatorTest method testOptionSetWithDefaultValue.
@Test
public void testOptionSetWithDefaultValue() {
Form form = Form.create().addFormItem(FormOptionSet.create().name("checkOptionSet").label("Multi selection").expanded(true).helpText("Help Text").multiple(true).multiselection(Occurrences.create(1, 3)).occurrences(Occurrences.create(1, 1)).addOptionSetOption(FormOptionSetOption.create().name("option_1").label("option_1").helpText("Help text for Option_1").build()).addOptionSetOption(FormOptionSetOption.create().name("option_2").label("option_2").helpText("Help text for Option_2").build()).addOptionSetOption(FormOptionSetOption.create().name("option_3").label("option_3").defaultOption(true).helpText("Help text for Option_3").addFormItem(Input.create().name("htmlAreaField").label("Input").inputType(InputTypeName.HTML_AREA).occurrences(Occurrences.create(2, 4)).build()).build()).build()).build();
ContentType contentType = ContentType.create().name("myapplication:my_type").superType(ContentTypeName.structured()).form(form).build();
Content content = Content.create().path(MY_CONTENT_PATH).type(contentType.getName()).build();
content.getData().setSet("checkOptionSet.option_3", new PropertySet());
final ValidationErrors validationResults = validate(content);
assertFalse(validationResults.hasErrors());
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class InputValidatorTest method validate_incorrect_input_types.
@Test
public void validate_incorrect_input_types() {
// Validates an incorrect value
PropertyTree invalidData = new PropertyTree();
invalidData.addLong("textLine", 1L);
validateIncorrectInputType(invalidData);
// Validates an incorrect value
invalidData = new PropertyTree();
invalidData.addLong("double", 1L);
validateIncorrectInputType(invalidData);
// Validates an incorrect value
invalidData = new PropertyTree();
invalidData.addDouble("long", 1.0d);
validateIncorrectInputType(invalidData);
// Validates an incorrect value
invalidData = new PropertyTree();
invalidData.addBoolean("comboBox", true);
validateIncorrectInputType(invalidData);
// Validates an incorrect value
invalidData = new PropertyTree();
invalidData.addString("comboBox", "value4");
validateIncorrectInputType(invalidData);
// Validates an incorrect value
invalidData = new PropertyTree();
invalidData.addDouble("checkbox", 1.0d);
validateIncorrectInputType(invalidData);
// Validates an incorrect value
invalidData = new PropertyTree();
invalidData.addDouble("tag", 1.0d);
validateIncorrectInputType(invalidData);
// Validates an incorrect value
invalidData = new PropertyTree();
invalidData.addDouble("contentSelector", 1.0d);
validateIncorrectInputType(invalidData);
// Validates an incorrect value
invalidData = new PropertyTree();
invalidData.addDouble("contentTypeFilter", 1.0d);
validateIncorrectInputType(invalidData);
// Validates an incorrect value
invalidData = new PropertyTree();
invalidData.addLocalDateTime("date", LocalDateTime.of(2015, 03, 13, 10, 00, 0));
validateIncorrectInputType(invalidData);
// Validates an incorrect value
invalidData = new PropertyTree();
invalidData.addInstant("time", Instant.now());
validateIncorrectInputType(invalidData);
// Validates an incorrect value
invalidData = new PropertyTree();
invalidData.addString("geoPoint", "59.9127300, 10.7460900");
validateIncorrectInputType(invalidData);
// Validates an incorrect value
invalidData = new PropertyTree();
invalidData.addDouble("htmlArea", 1.0d);
validateIncorrectInputType(invalidData);
// Validates an incorrect value
invalidData = new PropertyTree();
invalidData.addLocalDate("localDateTime", LocalDate.of(2015, 03, 13));
validateIncorrectInputType(invalidData);
// Validates an incorrect value
invalidData = new PropertyTree();
invalidData.addLocalDate("dateTime", LocalDate.of(2015, 03, 13));
validateIncorrectInputType(invalidData);
// Validates an incorrect value
invalidData = new PropertyTree();
PropertySet invalidSet = new PropertySet();
invalidSet.addDouble("setString", 1.0d);
invalidData.addSet("set", invalidSet);
validateIncorrectInputType(invalidData);
// Validates an incorrect value
invalidData = new PropertyTree();
invalidSet = new PropertySet();
invalidSet.addLong("setDouble", 1L);
invalidData.addSet("set", invalidSet);
validateIncorrectInputType(invalidData);
}
Aggregations