use of com.enonic.xp.schema.content.ContentTypes in project xp by enonic.
the class ContentTypeHandlerTest method testExampleGetTypes.
@Test
public void testExampleGetTypes() {
final Form form = getForm();
Mockito.when(mixinService.inlineFormItems(Mockito.eq(form))).thenReturn(form);
final ContentTypes contentTypes = testContentTypes();
Mockito.when(contentTypeService.getAll()).thenReturn(contentTypes);
runScript("/lib/xp/examples/content/getTypes.js");
}
use of com.enonic.xp.schema.content.ContentTypes in project xp by enonic.
the class ApplicationInfoServiceImplTest method testContentTypes.
@Test
public void testContentTypes() {
mockContentTypes(this.applicationKey);
final ContentTypes contentTypes = this.service.getContentTypes(this.applicationKey);
assertEquals(contentTypes.getSize(), 1);
}
use of com.enonic.xp.schema.content.ContentTypes in project xp by enonic.
the class BuiltinContentTypesTest method testBuiltin.
@Test
public void testBuiltin() {
final ContentTypes types = ContentTypes.from(new BuiltinContentTypes().getAll());
assertEquals(22, types.getSize());
assertType(types.get(0), "base:unstructured", true);
assertType(types.get(1), "base:structured", true);
assertType(types.get(2), "base:folder", true);
assertType(types.get(3), "base:shortcut", true);
assertType(types.get(4), "base:media", true);
assertType(types.get(5), "media:text", true);
assertType(types.get(6), "media:data", true);
assertType(types.get(7), "media:audio", true);
assertType(types.get(8), "media:video", true);
assertType(types.get(9), "media:image", true);
assertType(types.get(10), "media:vector", true);
assertType(types.get(11), "media:archive", true);
assertType(types.get(12), "media:document", true);
assertType(types.get(13), "media:spreadsheet", true);
assertType(types.get(14), "media:presentation", true);
assertType(types.get(15), "media:code", true);
assertType(types.get(16), "media:executable", true);
assertType(types.get(17), "media:unknown", false);
assertType(types.get(18), "portal:site", true);
assertType(types.get(19), "portal:template-folder", true);
assertType(types.get(20), "portal:page-template", true);
assertType(types.get(21), "portal:fragment", true);
}
use of com.enonic.xp.schema.content.ContentTypes in project xp by enonic.
the class ApplicationInfoServiceImplTest method mockContentTypes.
private void mockContentTypes(final ApplicationKey applicationKey) {
final ContentType contentType = ContentType.create().name(ContentTypeName.media()).form(Form.create().build()).setAbstract().setFinal().allowChildContent(true).setBuiltIn().displayNameExpression("displayNameExpression").displayName("displayName").description("description").modifiedTime(Instant.ofEpochSecond(1000)).createdTime(Instant.ofEpochSecond(1000)).creator(PrincipalKey.ofAnonymous()).modifier(PrincipalKey.ofAnonymous()).build();
final ContentTypes contentTypes = ContentTypes.from(contentType);
Mockito.when(this.contentTypeService.getByApplication(applicationKey)).thenReturn(contentTypes);
}
use of com.enonic.xp.schema.content.ContentTypes in project xp by enonic.
the class AbstractCommand method doTransformInlineMixins.
private ContentTypes doTransformInlineMixins(final ContentTypes contentTypes) {
final ContentTypes.Builder transformedContentTypes = ContentTypes.create();
for (final ContentType contentType : contentTypes) {
final Form transformedForm = mixinService.inlineFormItems(contentType.getForm());
final ContentType transformedCty = ContentType.create(contentType).form(transformedForm).build();
transformedContentTypes.add(transformedCty);
}
return transformedContentTypes.build();
}
Aggregations