/** * Create a new entity manager factory backed by an in-memory H2 database for testing purposes. * * @param emName * name of the persistence unit (see META-INF/persistence.xml) * @param withSqlLogging * turn on EclipseLink SQL logging */ public static EntityManagerFactory mkTestEntityManagerFactory(String emName, boolean withSqlLogging) { return mkEntityManagerFactory( emName, "Auto", "org.h2.Driver", "jdbc:h2:./target/db" + System.currentTimeMillis(), "sa", "sa", withSqlLogging ? Collections.merge(TEST_ENTITY_MANAGER_PROPS, TEST_ENTITY_MANAGER_LOGGING_PROPS) : TEST_ENTITY_MANAGER_PROPS, mkTestPersistenceProvider()); }