Search in sources :

Example 6 with RelationshipType

use of com.enonic.xp.schema.relationship.RelationshipType in project xp by enonic.

the class RelationshipTypeServiceImplTest method testEmpty.

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

Example 7 with RelationshipType

use of com.enonic.xp.schema.relationship.RelationshipType in project xp by enonic.

the class RelationshipTypeServiceImplTest method testApplications.

@Test
public void testApplications() {
    initializeApps();
    final RelationshipTypes types1 = this.service.getAll();
    assertNotNull(types1);
    assertEquals(3, types1.getSize());
    final RelationshipTypes types2 = this.service.getByApplication(ApplicationKey.from("myapp1"));
    assertNotNull(types2);
    assertEquals(0, types2.getSize());
    final RelationshipTypes types3 = this.service.getByApplication(ApplicationKey.from("myapp2"));
    assertNotNull(types3);
    assertEquals(1, types3.getSize());
    final RelationshipType type = service.getByName(RelationshipTypeName.from("myapp2:member"));
    assertNotNull(type);
}
Also used : RelationshipTypes(com.enonic.xp.schema.relationship.RelationshipTypes) RelationshipType(com.enonic.xp.schema.relationship.RelationshipType) Test(org.junit.jupiter.api.Test) AbstractSchemaTest(com.enonic.xp.core.impl.schema.AbstractSchemaTest)

Aggregations

RelationshipType (com.enonic.xp.schema.relationship.RelationshipType)7 RelationshipTypes (com.enonic.xp.schema.relationship.RelationshipTypes)4 AbstractSchemaTest (com.enonic.xp.core.impl.schema.AbstractSchemaTest)3 Test (org.junit.jupiter.api.Test)3 Application (com.enonic.xp.app.Application)1 Instant (java.time.Instant)1 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1