use of org.datanucleus.samples.annotations.models.company.Room in project tests by datanucleus.
the class JDOMetadataAPITest method testInheritanceAndDiscrim.
/**
* Test for use of annotations with inherited classes and discriminator
*/
public void testInheritanceAndDiscrim() {
TypeMetadata typemd = pmf.getMetadata(Room.class.getName());
assertFalse(typemd.getDetachable());
assertEquals(IdentityType.APPLICATION, typemd.getIdentityType());
assertFalse(typemd.getEmbeddedOnly());
assertTrue(typemd.getRequiresExtent());
InheritanceMetadata inhmd = typemd.getInheritanceMetadata();
assertNotNull(inhmd);
assertEquals(InheritanceStrategy.NEW_TABLE, inhmd.getStrategy());
DiscriminatorMetadata dismd = inhmd.getDiscriminatorMetadata();
assertNotNull(dismd);
assertEquals(DiscriminatorStrategy.VALUE_MAP, dismd.getStrategy());
assertEquals("ROOM", dismd.getValue());
TypeMetadata typemd2 = pmf.getMetadata(MeetingRoom.class.getName());
assertFalse(typemd2.getDetachable());
assertEquals(IdentityType.APPLICATION, typemd2.getIdentityType());
assertFalse(typemd2.getEmbeddedOnly());
assertTrue(typemd2.getRequiresExtent());
InheritanceMetadata inhmd2 = typemd2.getInheritanceMetadata();
assertNotNull(inhmd2);
assertEquals(InheritanceStrategy.SUPERCLASS_TABLE, inhmd2.getStrategy());
DiscriminatorMetadata dismd2 = inhmd2.getDiscriminatorMetadata();
assertNotNull(dismd2);
assertEquals(DiscriminatorStrategy.VALUE_MAP, dismd2.getStrategy());
assertEquals("MEETING_ROOM", dismd2.getValue());
}
Aggregations