Search in sources :

Example 6 with ContentTypes

use of com.enonic.xp.schema.content.ContentTypes in project xp by enonic.

the class ContentTypeServiceTest method testApplications.

@Test
public void testApplications() throws Exception {
    initializeApps();
    final ContentTypes types1 = this.service.getAll();
    assertNotNull(types1);
    assertEquals(24, types1.getSize());
    final ContentTypes types2 = this.service.getByApplication(ApplicationKey.from("myapp1"));
    assertNotNull(types2);
    assertEquals(1, types2.getSize());
    final ContentTypes types3 = this.service.getByApplication(ApplicationKey.from("myapp2"));
    assertNotNull(types3);
    assertEquals(1, types3.getSize());
    final ContentType contentType = service.getByName(new GetContentTypeParams().contentTypeName("myapp1:tag"));
    assertNotNull(contentType);
}
Also used : GetContentTypeParams(com.enonic.xp.schema.content.GetContentTypeParams) ContentType(com.enonic.xp.schema.content.ContentType) ContentTypes(com.enonic.xp.schema.content.ContentTypes) Test(org.junit.jupiter.api.Test) AbstractSchemaTest(com.enonic.xp.core.impl.schema.AbstractSchemaTest)

Example 7 with ContentTypes

use of com.enonic.xp.schema.content.ContentTypes in project xp by enonic.

the class ContentTypeServiceTest method testEmpty.

@Test
public void testEmpty() {
    final ContentTypes types1 = this.service.getAll();
    assertNotNull(types1);
    assertEquals(22, types1.getSize());
    final ContentTypes types2 = this.service.getByApplication(ApplicationKey.from("other"));
    assertNotNull(types2);
    assertEquals(0, types2.getSize());
    final ContentType contentType = service.getByName(new GetContentTypeParams().contentTypeName("other:mytype"));
    assertEquals(null, contentType);
}
Also used : GetContentTypeParams(com.enonic.xp.schema.content.GetContentTypeParams) ContentType(com.enonic.xp.schema.content.ContentType) ContentTypes(com.enonic.xp.schema.content.ContentTypes) Test(org.junit.jupiter.api.Test) AbstractSchemaTest(com.enonic.xp.core.impl.schema.AbstractSchemaTest)

Example 8 with ContentTypes

use of com.enonic.xp.schema.content.ContentTypes in project xp by enonic.

the class ContentTypeServiceTest method testSystemApplication.

@Test
public void testSystemApplication() {
    ContentTypes contentTypes = this.service.getAll();
    assertNotNull(contentTypes);
    assertEquals(22, contentTypes.getSize());
    ContentType contentType = service.getByName(new GetContentTypeParams().contentTypeName(ContentTypeName.folder()));
    assertNotNull(contentType);
    contentTypes = service.getByApplication(ApplicationKey.BASE);
    assertNotNull(contentTypes);
    assertEquals(contentTypes.getSize(), 5);
    contentTypes = service.getByApplication(ApplicationKey.PORTAL);
    assertNotNull(contentTypes);
    assertEquals(contentTypes.getSize(), 4);
    contentTypes = service.getByApplication(ApplicationKey.MEDIA_MOD);
    assertNotNull(contentTypes);
    assertEquals(contentTypes.getSize(), 13);
    contentType = service.getByName(new GetContentTypeParams().contentTypeName(ContentTypeName.site()));
    assertNotNull(contentType);
}
Also used : GetContentTypeParams(com.enonic.xp.schema.content.GetContentTypeParams) ContentType(com.enonic.xp.schema.content.ContentType) ContentTypes(com.enonic.xp.schema.content.ContentTypes) Test(org.junit.jupiter.api.Test) AbstractSchemaTest(com.enonic.xp.core.impl.schema.AbstractSchemaTest)

Example 9 with ContentTypes

use of com.enonic.xp.schema.content.ContentTypes in project xp by enonic.

the class ContentTypeHandlerTest method testList.

@Test
public void testList() throws Exception {
    final Form form = getForm();
    Mockito.when(mixinService.inlineFormItems(Mockito.eq(form))).thenReturn(form);
    final ContentTypes contentTypes = testContentTypes();
    Mockito.when(contentTypeService.getAll()).thenReturn(contentTypes);
    runFunction("/test/ContentTypeHandlerTest.js", "testList");
}
Also used : Form(com.enonic.xp.form.Form) ContentTypes(com.enonic.xp.schema.content.ContentTypes) Test(org.junit.jupiter.api.Test)

Aggregations

ContentTypes (com.enonic.xp.schema.content.ContentTypes)9 Test (org.junit.jupiter.api.Test)7 ContentType (com.enonic.xp.schema.content.ContentType)5 AbstractSchemaTest (com.enonic.xp.core.impl.schema.AbstractSchemaTest)3 Form (com.enonic.xp.form.Form)3 GetContentTypeParams (com.enonic.xp.schema.content.GetContentTypeParams)3