Search in sources :

Example 1 with Mixins

use of com.enonic.xp.schema.mixin.Mixins in project xp by enonic.

the class MixinServiceImpl method getAll.

@Override
public Mixins getAll() {
    final Set<Mixin> list = new LinkedHashSet<>();
    for (final Application application : this.applicationService.getInstalledApplications()) {
        final Mixins types = getByApplication(application.getKey());
        list.addAll(types.getList());
    }
    return Mixins.from(list);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Mixins(com.enonic.xp.schema.mixin.Mixins) Application(com.enonic.xp.app.Application) Mixin(com.enonic.xp.schema.mixin.Mixin) InlineMixin(com.enonic.xp.form.InlineMixin)

Example 2 with Mixins

use of com.enonic.xp.schema.mixin.Mixins in project xp by enonic.

the class MixinServiceImplTest method testEmpty.

@Test
public void testEmpty() {
    final Mixins types1 = this.service.getAll();
    assertNotNull(types1);
    assertEquals(0, types1.getSize());
    final Mixins types2 = this.service.getByApplication(ApplicationKey.from("other"));
    assertNotNull(types2);
    assertEquals(0, types2.getSize());
    final Mixin mixin = service.getByName(MixinName.from("other:mytype"));
    assertEquals(null, mixin);
}
Also used : Mixins(com.enonic.xp.schema.mixin.Mixins) InlineMixin(com.enonic.xp.form.InlineMixin) Mixin(com.enonic.xp.schema.mixin.Mixin) Test(org.junit.jupiter.api.Test) AbstractSchemaTest(com.enonic.xp.core.impl.schema.AbstractSchemaTest)

Example 3 with Mixins

use of com.enonic.xp.schema.mixin.Mixins in project xp by enonic.

the class MixinServiceImplTest method testApplications.

@Test
public void testApplications() {
    initializeApps();
    final Mixins types1 = this.service.getAll();
    assertNotNull(types1);
    assertEquals(8, types1.getSize());
    final Mixins types2 = this.service.getByApplication(ApplicationKey.from("myapp1"));
    assertNotNull(types2);
    assertEquals(2, types2.getSize());
    final Mixins types3 = this.service.getByApplication(ApplicationKey.from("myapp2"));
    assertNotNull(types3);
    assertEquals(6, types3.getSize());
    final Mixin mixin = service.getByName(MixinName.from("myapp2:mixin1"));
    assertNotNull(mixin);
}
Also used : Mixins(com.enonic.xp.schema.mixin.Mixins) InlineMixin(com.enonic.xp.form.InlineMixin) Mixin(com.enonic.xp.schema.mixin.Mixin) Test(org.junit.jupiter.api.Test) AbstractSchemaTest(com.enonic.xp.core.impl.schema.AbstractSchemaTest)

Aggregations

InlineMixin (com.enonic.xp.form.InlineMixin)3 Mixin (com.enonic.xp.schema.mixin.Mixin)3 Mixins (com.enonic.xp.schema.mixin.Mixins)3 AbstractSchemaTest (com.enonic.xp.core.impl.schema.AbstractSchemaTest)2 Test (org.junit.jupiter.api.Test)2 Application (com.enonic.xp.app.Application)1 LinkedHashSet (java.util.LinkedHashSet)1