Search in sources :

Example 1 with Relationship

use of com.liferay.ide.service.core.model.Relationship in project liferay-ide by liferay.

the class ServiceXmlTests method testEntityReferenceService.

@Test
public void testEntityReferenceService() throws Exception {
    ServiceBuilder sb = ServiceBuilder6xx.TYPE.instantiate(new RootXmlResource(new XmlResourceStore(this.getClass().getResourceAsStream("files/entity-reference-test.xml"))));
    Entity foo = sb.getEntities().get(0);
    Entity bar = sb.getEntities().get(1);
    ElementList<Relationship> relationships = sb.getRelationships();
    assertEquals(1, relationships.size());
    Entity to = sb.getRelationships().get(0).getToEntity().target();
    Entity from = sb.getRelationships().get(0).getFromEntity().target();
    assertEquals(to, foo);
    assertEquals(from, bar);
}
Also used : Entity(com.liferay.ide.service.core.model.Entity) XmlResourceStore(org.eclipse.sapphire.modeling.xml.XmlResourceStore) Relationship(com.liferay.ide.service.core.model.Relationship) RootXmlResource(org.eclipse.sapphire.modeling.xml.RootXmlResource) ServiceBuilder(com.liferay.ide.service.core.model.ServiceBuilder) Test(org.junit.Test)

Aggregations

Entity (com.liferay.ide.service.core.model.Entity)1 Relationship (com.liferay.ide.service.core.model.Relationship)1 ServiceBuilder (com.liferay.ide.service.core.model.ServiceBuilder)1 RootXmlResource (org.eclipse.sapphire.modeling.xml.RootXmlResource)1 XmlResourceStore (org.eclipse.sapphire.modeling.xml.XmlResourceStore)1 Test (org.junit.Test)1