use of org.apache.cayenne.exp.property.EmbeddableProperty in project cayenne by apache.
the class PropertyUtilsTest method simpleNumericPropertyEmbDefinition.
@Test
public void simpleNumericPropertyEmbDefinition() throws ClassNotFoundException {
importUtils.addType(EmbeddableProperty.class.getName());
DataMap dataMap = new DataMap();
ObjEntity entity = new ObjEntity();
entity.setDataMap(dataMap);
EmbeddedAttribute embeddedAttribute = new EmbeddedAttribute();
embeddedAttribute.setName("a");
embeddedAttribute.setType("test");
embeddedAttribute.addAttributeOverride("testEmbAttr", "testPath");
embeddedAttribute.setEntity(entity);
EmbeddableAttribute attribute = new EmbeddableAttribute();
attribute.setName("testEmbAttr");
attribute.setType("int");
Embeddable embeddable = new Embeddable();
embeddable.setClassName("test");
embeddable.addAttribute(attribute);
dataMap.addEmbeddable(embeddable);
String definition = propertyUtils.propertyDefinition(embeddedAttribute);
assertEquals("public static final EmbeddableProperty<test> A = PropertyFactory.createEmbeddable(\"a\", test.class);", definition);
}
Aggregations