}
}
public void testWithProperties() {
getLog().trace("testWithProperties() - properties in persistence.xml");
OpenJPAEntityManagerFactory emf1 = null, emf2 = null;
OpenJPAEntityManager em1 = null, em2 = null;
try {
OpenJPAQuery q;
Map<String, Object> hints;
Integer timeout;
Integer lTime = new Integer(10000);
Integer qTime = new Integer(5000);
// create our PU with properties
emf1 = OpenJPAPersistence.createEntityManagerFactory(
"qtimeout-with-properties", "persistence3.xml");
assertNotNull(emf1);
emf2 = OpenJPAPersistence.createEntityManagerFactory(
"qtimeout-with-properties", "persistence3.xml", props);
assertNotNull(emf2);
//=============
// Test for 1b)
//=============
// verify properties in persistence.xml
OpenJPAConfiguration conf1 = emf1.getConfiguration();
assertNotNull(conf1);
assertEquals("Default PU lock timeout", lTime.intValue(),
conf1.getLockTimeout());
assertEquals("Default PU query timeout.", qTime.intValue(),
conf1.getQueryTimeout());
// verify Query receives the properties
em1 = emf1.createEntityManager();
assertNotNull(em1);
q = em1.createNamedQuery("NoHintList");
// Cannot verify properties are passed through as Query hints
// See explanation and commented out test in testNoProperties()
// verify timeout properties supplied in persistence.xml