use of org.eclipse.persistence.testing.models.jpa.metamodel.HardwareDesigner in project eclipselink by eclipse-ee4j.
the class MetamodelMetamodelTest method testManagedType_getDeclaredSingularAttribute_Type_param_Method.
// TODO: This is not testing anything different?
public void testManagedType_getDeclaredSingularAttribute_Type_param_Method() {
EntityManager em = null;
boolean expectedIAExceptionThrown = false;
try {
em = privateTestSetup();
assertNotNull(em);
Metamodel metamodel = em.getMetamodel();
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel);
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl) metamodel.entity(Manufacturer.class);
assertNotNull(entityManufacturer_);
MappedSuperclassTypeImpl<Person> msPerson_ = (MappedSuperclassTypeImpl) metamodel.managedType(Person.class);
assertNotNull(msPerson_);
MappedSuperclassTypeImpl<Corporation> msCorporation_ = (MappedSuperclassTypeImpl) metamodel.managedType(Corporation.class);
assertNotNull(msCorporation_);
EntityTypeImpl<GalacticPosition> entityLocation_ = (EntityTypeImpl) metamodel.entity(GalacticPosition.class);
assertNotNull(entityLocation_);
EntityTypeImpl<Computer> entityComputer_ = (EntityTypeImpl) metamodel.entity(Computer.class);
assertNotNull(entityComputer_);
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl) metamodel.entity(HardwareDesigner.class);
assertNotNull(entityHardwareDesigner_);
} catch (IllegalArgumentException iae) {
iae.printStackTrace();
expectedIAExceptionThrown = true;
} finally {
cleanup(em);
assertFalse("An IAE exception should not occur here.", expectedIAExceptionThrown);
}
}
use of org.eclipse.persistence.testing.models.jpa.metamodel.HardwareDesigner in project eclipselink by eclipse-ee4j.
the class MetamodelMetamodelTest method testManagedType_getList_Type_param_Method.
// TODO: This is not testing anything different?
public void testManagedType_getList_Type_param_Method() {
EntityManager em = null;
boolean expectedIAExceptionThrown = false;
try {
em = privateTestSetup();
assertNotNull(em);
Metamodel metamodel = em.getMetamodel();
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel);
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl) metamodel.entity(Manufacturer.class);
assertNotNull(entityManufacturer_);
MappedSuperclassTypeImpl<Person> msPerson_ = (MappedSuperclassTypeImpl) metamodel.managedType(Person.class);
assertNotNull(msPerson_);
MappedSuperclassTypeImpl<Corporation> msCorporation_ = (MappedSuperclassTypeImpl) metamodel.managedType(Corporation.class);
assertNotNull(msCorporation_);
EntityTypeImpl<GalacticPosition> entityLocation_ = (EntityTypeImpl) metamodel.entity(GalacticPosition.class);
assertNotNull(entityLocation_);
EntityTypeImpl<Computer> entityComputer_ = (EntityTypeImpl) metamodel.entity(Computer.class);
assertNotNull(entityComputer_);
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl) metamodel.entity(HardwareDesigner.class);
assertNotNull(entityHardwareDesigner_);
} catch (IllegalArgumentException iae) {
iae.printStackTrace();
expectedIAExceptionThrown = true;
} finally {
cleanup(em);
assertFalse("An IAE exception should not occur here.", expectedIAExceptionThrown);
}
}
use of org.eclipse.persistence.testing.models.jpa.metamodel.HardwareDesigner in project eclipselink by eclipse-ee4j.
the class MetamodelMetamodelTest method testManagedType_getCollection_Type_param_Method.
// TODO: This is not testing anything different?
public void testManagedType_getCollection_Type_param_Method() {
EntityManager em = null;
boolean expectedIAExceptionThrown = false;
try {
em = privateTestSetup();
assertNotNull(em);
Metamodel metamodel = em.getMetamodel();
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel);
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl) metamodel.entity(Manufacturer.class);
assertNotNull(entityManufacturer_);
MappedSuperclassTypeImpl<Person> msPerson_ = (MappedSuperclassTypeImpl) metamodel.managedType(Person.class);
assertNotNull(msPerson_);
MappedSuperclassTypeImpl<Corporation> msCorporation_ = (MappedSuperclassTypeImpl) metamodel.managedType(Corporation.class);
assertNotNull(msCorporation_);
EntityTypeImpl<GalacticPosition> entityLocation_ = (EntityTypeImpl) metamodel.entity(GalacticPosition.class);
assertNotNull(entityLocation_);
EntityTypeImpl<Computer> entityComputer_ = (EntityTypeImpl) metamodel.entity(Computer.class);
assertNotNull(entityComputer_);
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl) metamodel.entity(HardwareDesigner.class);
assertNotNull(entityHardwareDesigner_);
} catch (IllegalArgumentException iae) {
iae.printStackTrace();
expectedIAExceptionThrown = true;
} finally {
cleanup(em);
assertFalse("An IAE exception should not occur here.", expectedIAExceptionThrown);
}
}
use of org.eclipse.persistence.testing.models.jpa.metamodel.HardwareDesigner in project eclipselink by eclipse-ee4j.
the class MetamodelMetamodelTest method testBindable_getBindableJavaType_Method.
public void testBindable_getBindableJavaType_Method() {
EntityManager em = null;
boolean exceptionThrown = false;
try {
em = privateTestSetup();
assertNotNull(em);
Metamodel metamodel = em.getMetamodel();
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel);
// Actual Test Case
/*public static enum BindableType {
SINGULAR_ATTRIBUTE, PLURAL_ATTRIBUTE, ENTITY_TYPE}*/
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl) metamodel.entity(Manufacturer.class);
assertNotNull(entityManufacturer_);
SingularAttribute<Manufacturer, Boolean> manufacturer_booleanObject = entityManufacturer_.getDeclaredSingularAttribute("aBooleanObject", Boolean.class);
assertNotNull(manufacturer_booleanObject);
ListAttribute<Manufacturer, HardwareDesigner> manufacturer_hardwareDesignersList = entityManufacturer_.getDeclaredList("hardwareDesigners", HardwareDesigner.class);
assertNotNull(manufacturer_hardwareDesignersList);
/**
* Return the Java type of the represented object.
* If the bindable type of the object is <code>PLURAL_ATTRIBUTE</code>,
* the Java element type is returned. If the bindable type is
* <code>SINGULAR_ATTRIBUTE</code> or <code>ENTITY_TYPE</code>,
* the Java type of the
* represented entity or attribute is returned.
* @return Java type
*/
// Class<T> getBindableJavaType();
// EntityTypeImpl
assertEquals(entityManufacturer_.getJavaType(), entityManufacturer_.getBindableJavaType());
// SingularAttribute
assertEquals(manufacturer_booleanObject.getJavaType(), manufacturer_booleanObject.getBindableJavaType());
// PluralAttribute
Type<HardwareDesigner> manufacturer_hardwareDesignersType = manufacturer_hardwareDesignersList.getElementType();
assertNotNull(manufacturer_hardwareDesignersType);
assertNotNull(manufacturer_hardwareDesignersType.getJavaType());
assertEquals(manufacturer_hardwareDesignersType.getJavaType(), manufacturer_hardwareDesignersList.getBindableJavaType());
} catch (IllegalArgumentException iae) {
iae.printStackTrace();
exceptionThrown = true;
} finally {
cleanup(em);
assertFalse("An IAE exception should not occur here.", exceptionThrown);
}
}
use of org.eclipse.persistence.testing.models.jpa.metamodel.HardwareDesigner in project eclipselink by eclipse-ee4j.
the class MetamodelMetamodelTest method testSingularAttribute_isVersion_Method.
public void testSingularAttribute_isVersion_Method() {
EntityManager em = null;
boolean expectedIAExceptionThrown = false;
try {
em = privateTestSetup();
assertNotNull(em);
Metamodel metamodel = em.getMetamodel();
assertNotNull("The metamodel should never be null after an em.getMetamodel() call here.", metamodel);
EntityTypeImpl<Manufacturer> entityManufacturer_ = (EntityTypeImpl) metamodel.entity(Manufacturer.class);
assertNotNull(entityManufacturer_);
EntityTypeImpl<HardwareDesigner> entityHardwareDesigner_ = (EntityTypeImpl) metamodel.entity(HardwareDesigner.class);
assertNotNull(entityHardwareDesigner_);
// Composite table FK's that include a MappedSuperclass
// get an Attribute<Container, Type==String>
Attribute nameAttribute = entityManufacturer_.getAttribute("name");
assertTrue(null != nameAttribute);
/**
* Is the attribute a version attribute.
* @return boolean indicating whether or not attribute is
* a version attribute
*/
// public boolean isVersion() {
assertFalse(((AttributeImpl) nameAttribute).isPlural());
assertFalse(((SingularAttributeImpl) nameAttribute).isVersion());
} catch (IllegalArgumentException iae) {
iae.printStackTrace();
expectedIAExceptionThrown = true;
} finally {
cleanup(em);
assertFalse("An IAE exception should not occur here.", expectedIAExceptionThrown);
}
}
Aggregations