use of com.enonic.xp.inputtype.InputTypeConfig in project xp by enonic.
the class XmlInputTypeConfigMapperTest method parseAttributes.
@Test
public void parseAttributes() {
final InputTypeConfig config = build("attributes.xml");
assertNotNull(config);
assertEquals(2, config.getSize());
assertEquals("other=world[a=1],other=world[a=1,b=2]", toString(config.getProperties("other")));
}
use of com.enonic.xp.inputtype.InputTypeConfig in project xp by enonic.
the class XmlInputTypeConfigMapperTest method parseNone.
@Test
public void parseNone() {
final InputTypeConfig config = build("none.xml");
assertNotNull(config);
assertEquals(0, config.getSize());
}
use of com.enonic.xp.inputtype.InputTypeConfig in project xp by enonic.
the class XmlInputTypeConfigMapperTest method parseAliased.
@Test
public void parseAliased() {
final InputTypeConfig config = build("aliased.xml", InputTypeName.CONTENT_SELECTOR);
assertNotNull(config);
assertEquals(2, config.getSize());
assertEquals("allowContentType=contentTypeTest[]", toString(config.getProperties("allowContentType")));
assertEquals("relationshipType=myapp:relationshipTypeTest[]", toString(config.getProperties("relationshipType")));
}
use of com.enonic.xp.inputtype.InputTypeConfig in project xp by enonic.
the class XmlInputTypeConfigMapperTest method parseSimple.
@Test
public void parseSimple() {
final InputTypeConfig config = build("simple.xml");
assertNotNull(config);
assertEquals(2, config.getSize());
assertEquals("timezone=true[]", toString(config.getProperties("timezone")));
assertEquals("other=world[]", toString(config.getProperties("other")));
}
use of com.enonic.xp.inputtype.InputTypeConfig in project xp by enonic.
the class XmlContentTypeParserTest method assertResult.
private void assertResult() throws Exception {
final ContentType result = this.builder.build();
assertEquals("myapplication:mytype", result.getName().toString());
assertEquals("All the Base Types", result.getDisplayName());
assertEquals("description", result.getDescription());
assertEquals("${firstName} ${lastName}", result.getDisplayNameExpression());
assertEquals("Display Name Label", result.getDisplayNameLabel());
assertEquals("myapplication:content", result.getSuperType().toString());
assertEquals(false, result.isAbstract());
assertEquals(true, result.isFinal());
assertEquals(4, result.getForm().size());
final FormItem item = result.getForm().getFormItem("myDate");
assertNotNull(item);
final Input input = (Input) item;
assertEquals(InputTypeName.DATE.toString(), input.getInputType().toString());
final FormItem contentSelectorItem = result.getForm().getFormItem("someonesParent");
assertNotNull(contentSelectorItem);
final Input contentSelectorInput = (Input) contentSelectorItem;
assertEquals(InputTypeName.CONTENT_SELECTOR.toString(), contentSelectorInput.getInputType().toString());
assertEquals("mytype", contentSelectorInput.getInputTypeConfig().getProperty("allowContentType").getValue());
assertEquals(2, contentSelectorInput.getInputTypeConfig().getProperties("allowContentType").size());
assertEquals("path1", contentSelectorInput.getInputTypeConfig().getProperty("allowPath").getValue());
assertEquals(2, contentSelectorInput.getInputTypeConfig().getProperties("allowPath").size());
assertEquals("system:reference", contentSelectorInput.getInputTypeConfig().getProperty("relationshipType").getValue());
final InputTypeConfig config = input.getInputTypeConfig();
assertNotNull(config);
final Input defaultOccurrencesInput = result.getForm().getInput("defaultOccurrences");
final Occurrences defaultOccurrences = defaultOccurrencesInput.getOccurrences();
assertEquals(0, defaultOccurrences.getMinimum());
assertEquals(1, defaultOccurrences.getMaximum());
}
Aggregations