use of com.enonic.xp.schema.relationship.RelationshipTypes in project xp by enonic.
the class ApplicationInfoServiceImplTest method mockRelationshipTypes.
private void mockRelationshipTypes(final ApplicationKey applicationKey) {
final RelationshipTypes relationshipTypes = RelationshipTypes.from(RelationshipType.create().name("myapplication:person").build(), RelationshipType.create().name("myapplication:site").build());
Mockito.when(this.relationshipTypeService.getByApplication(applicationKey)).thenReturn(relationshipTypes);
}
use of com.enonic.xp.schema.relationship.RelationshipTypes in project xp by enonic.
the class RelationshipTypeServiceImpl method getAll.
@Override
public RelationshipTypes getAll() {
final Set<RelationshipType> list = new LinkedHashSet<>(this.builtInTypes.getAll().getList());
for (final Application application : this.applicationService.getInstalledApplications()) {
final RelationshipTypes types = getByApplication(application.getKey());
list.addAll(types.getList());
}
return RelationshipTypes.from(list);
}
use of com.enonic.xp.schema.relationship.RelationshipTypes in project xp by enonic.
the class RelationshipTypeServiceImplTest method testSystemTypes.
@Test
public void testSystemTypes() {
RelationshipTypes relationshipTypes = service.getAll();
assertNotNull(relationshipTypes);
assertEquals(2, relationshipTypes.getSize());
relationshipTypes = service.getByApplication(ApplicationKey.SYSTEM);
assertNotNull(relationshipTypes);
assertEquals(2, relationshipTypes.getSize());
RelationshipType relationshipType = service.getByName(RelationshipTypeName.PARENT);
assertNotNull(relationshipType);
relationshipType = service.getByName(RelationshipTypeName.REFERENCE);
assertNotNull(relationshipType);
}
use of com.enonic.xp.schema.relationship.RelationshipTypes in project xp by enonic.
the class BuiltinRelationshipTypesTest method testGetAll.
@Test
public void testGetAll() {
final RelationshipTypes types = new BuiltinRelationshipTypes().getAll();
assertEquals(2, types.getSize());
assertType(types.get(0), RelationshipTypeName.REFERENCE, true);
assertType(types.get(1), RelationshipTypeName.PARENT, true);
}
use of com.enonic.xp.schema.relationship.RelationshipTypes in project xp by enonic.
the class ApplicationInfoServiceImplTest method testRelationshipTypes.
@Test
public void testRelationshipTypes() {
mockRelationshipTypes(this.applicationKey);
final RelationshipTypes relationshipTypes = this.service.getRelationshipTypes(this.applicationKey);
assertEquals(relationshipTypes.getSize(), 2);
}
Aggregations