@Override
 public DatabaseType setup(PersistenceUnitDef unit) {
   unit.transactionType(TransactionType.JTA);
   unit.jtaDataSource(DEFAULT_DS);
   unit.nonJtaDataSource(null);
   return DatabaseType.DERBY;
 }
  @Test
  public void shouldBeAbleToGetProperties() throws Exception {
    PersistenceUnitDef def = create().property(name, name2).property(name2, name);

    List<Property> props = def.getProperties();
    assertEquals(2, props.size());
    assertEquals(name, props.get(0).getName());
    assertEquals(name2, props.get(0).getValue());
    assertEquals(name2, props.get(1).getName());
    assertEquals(name, props.get(1).getValue());
  }
  @Test
  public void shouldBeAbleToClearProperties() 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());
  }
  @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;
  }