use of org.apache.cayenne.gen.mock.CustomProperty in project cayenne by apache.
the class PropertyUtilsTest method customPropertyEmbDefinition.
@Test
public void customPropertyEmbDefinition() throws ClassNotFoundException {
importUtils.addType(CustomProperty.class.getName());
importUtils.addType(TimestampType.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("org.apache.cayenne.access.types.TimestampType");
Embeddable embeddable = new Embeddable();
embeddable.setClassName("test");
embeddable.addAttribute(attribute);
dataMap.addEmbeddable(embeddable);
String definition = propertyUtils.propertyDefinition(attribute);
assertEquals("public static final CustomProperty<TimestampType> TEST_EMB_ATTR = new CustomProperty(\"testEmbAttr\", TimestampType.class);", definition);
}
use of org.apache.cayenne.gen.mock.CustomProperty in project cayenne by apache.
the class PropertyUtilsTest method customPropertyDefinition.
@Test
public void customPropertyDefinition() throws ClassNotFoundException {
importUtils.addType(CustomProperty.class.getName());
importUtils.addType(TimestampType.class.getName());
ObjEntity entity = new ObjEntity("test");
ObjAttribute attribute = new ObjAttribute();
attribute.setName("test");
attribute.setType("org.apache.cayenne.access.types.TimestampType");
entity.addAttribute(attribute);
String definition = propertyUtils.propertyDefinition(attribute);
assertEquals("public static final CustomProperty<TimestampType> TEST = new CustomProperty(\"test\", TimestampType.class);", definition);
}
Aggregations