use of org.apache.cayenne.map.ObjRelationship in project cayenne by apache.
the class EOModelProcessorTest method assertOneWayRelationships.
protected void assertOneWayRelationships(DataMap map) throws Exception {
// assert that one way relationships are loaded properly
// - Db loaded as two-way, obj - as one-way
ObjEntity exhibitEntity = map.getObjEntity("Exhibit");
ObjRelationship toTypeObject = exhibitEntity.getRelationship("toExhibitType");
DbRelationship toTypeDB = exhibitEntity.getDbEntity().getRelationship("toExhibitType");
assertNotNull(toTypeObject);
assertNotNull(toTypeDB);
assertNull(toTypeObject.getReverseRelationship());
assertNotNull(toTypeDB.getReverseRelationship());
}
use of org.apache.cayenne.map.ObjRelationship in project cayenne by apache.
the class ClientSuperClassGenerationTest method testContainsPropertyImport.
@Test
public void testContainsPropertyImport() throws Exception {
ObjEntity objEntity = new ObjEntity("TEST1");
ObjAttribute attr = new ObjAttribute("attr");
ObjRelationship rel = new ObjRelationship("rel");
objEntity.addAttribute(attr);
objEntity.addRelationship(rel);
VelocityContext context = new VelocityContext();
context.put(Artifact.OBJECT_KEY, objEntity);
String res = renderTemplate(ClientClassGenerationAction.SUPERCLASS_TEMPLATE, context);
assertTrue(res.contains("org.apache.cayenne.exp.Property"));
}
use of org.apache.cayenne.map.ObjRelationship in project cayenne by apache.
the class ClientSuperClassGenerationTest method testContainsPropertyImportForRelationships.
@Test
public void testContainsPropertyImportForRelationships() throws Exception {
ObjEntity objEntity = new ObjEntity("TEST1");
ObjRelationship rel = new ObjRelationship("rel");
objEntity.addRelationship(rel);
VelocityContext context = new VelocityContext();
context.put(Artifact.OBJECT_KEY, objEntity);
String res = renderTemplate(ClientClassGenerationAction.SUPERCLASS_TEMPLATE, context);
assertTrue(res.contains("org.apache.cayenne.exp.Property"));
}
use of org.apache.cayenne.map.ObjRelationship in project cayenne by apache.
the class SingleClassGenerationTest method testContainsPropertyImport.
@Test
public void testContainsPropertyImport() throws Exception {
ObjEntity objEntity = new ObjEntity("TEST1");
ObjAttribute attr = new ObjAttribute("attr");
ObjRelationship rel = new ObjRelationship("rel");
objEntity.addAttribute(attr);
objEntity.addRelationship(rel);
VelocityContext context = new VelocityContext();
context.put(Artifact.OBJECT_KEY, objEntity);
String res = renderTemplate(ClassGenerationAction.SINGLE_CLASS_TEMPLATE, context);
assertTrue(res.contains("org.apache.cayenne.exp.Property"));
}
use of org.apache.cayenne.map.ObjRelationship in project cayenne by apache.
the class SuperClassGenerationTest method testContainsPropertyImportForRelationships.
@Test
public void testContainsPropertyImportForRelationships() throws Exception {
ObjEntity objEntity = new ObjEntity("TEST1");
ObjRelationship rel = new ObjRelationship("rel");
objEntity.addRelationship(rel);
VelocityContext context = new VelocityContext();
context.put(Artifact.OBJECT_KEY, objEntity);
String res = renderTemplate(ClassGenerationAction.SUPERCLASS_TEMPLATE, context);
assertTrue(res.contains("org.apache.cayenne.exp.Property"));
}
Aggregations