@Override public PersistenceUnitDef setup(PersistenceUnitDef unit, JPADataSource ds) { unit.provider("org.eclipse.persistence.jpa.PersistenceProvider"); unit.includeUnlistedClasses(); unit.property("eclipselink.ddl-generation", "drop-and-create-tables"); if (!DatabaseType.DEFAULT.equals(ds.getDatabase())) { String platform = platforms.get(ds.getDatabase()); if (platform == null) { throw new RuntimeException( "Unsupported database type for Eclipselink [" + ds.getDatabase() + "]"); } unit.property("eclipselink.target-database", platform); } return unit; }
@Test public void shouldBeAbleToClearPropertiesAndAddNew() throws Exception { PersistenceUnitDef def = create().property(name, name2).property(name2, name); List<Property> props = def.getProperties(); assertEquals(2, props.size()); def.clearProperties(); props = def.getProperties(); assertEquals(0, props.size()); def.property(name2, name).property(name, name2); props = def.getProperties(); assertEquals(2, props.size()); assertEquals(name2, props.get(0).getName()); assertEquals(name, props.get(0).getValue()); assertEquals(name, props.get(1).getName()); assertEquals(name2, props.get(1).getValue()); }