Пример #1
0
 /**
  * Gets the DbUnit connection or creates one if it does not exist yet.
  *
  * @param schemaName The schema name, not null
  * @return The DbUnit connection, not null
  */
 public DbUnitDatabaseConnection getDbUnitDatabaseConnection(String schemaName) {
   DbUnitDatabaseConnection dbUnitDatabaseConnection = dbUnitDatabaseConnections.get(schemaName);
   if (dbUnitDatabaseConnection == null) {
     dbUnitDatabaseConnection = createDbUnitConnection(schemaName);
     DatabaseConfig config = dbUnitDatabaseConnection.getConfig();
     dbUnitDatabaseConnections.put(schemaName, dbUnitDatabaseConnection);
   }
   return dbUnitDatabaseConnection;
 }
Пример #2
0
 /**
  * Closes (i.e. return to the pool) the JDBC Connection that is currently in use by the
  * DbUnitDatabaseConnection
  */
 protected void closeJdbcConnection() {
   try {
     for (DbUnitDatabaseConnection dbUnitDatabaseConnection : dbUnitDatabaseConnections.values()) {
       dbUnitDatabaseConnection.closeJdbcConnection();
     }
   } catch (SQLException e) {
     throw new UnitilsException("Error while closing connection.", e);
   }
 }