org.spicefactory.pimento.test
Class DbUnitServiceImpl

java.lang.Object
  extended by org.spicefactory.pimento.test.DbUnitServiceImpl
All Implemented Interfaces:
DbUnitService

public class DbUnitServiceImpl
extends Object
implements DbUnitService

Default implementation for the DbUnitService. This implementation supports a testMode property that can be used to explicitly enable this service.

This service must never be exposed in a production environment since it would allow anyone to wipe out the entire database if the service would not be protected. For this reason it is disabled by default.

Author:
Jens Halm

Constructor Summary
DbUnitServiceImpl(DataSource dataSource)
          Creates a new instance.
 
Method Summary
 void prepareTables(String data)
          Prepares the database according to the specified XML.
 void setTestMode(boolean testMode)
          Sets whether this service is enabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbUnitServiceImpl

public DbUnitServiceImpl(DataSource dataSource)
Creates a new instance.

Parameters:
dataSource - the DataSource to use to populate the database
Method Detail

setTestMode

public void setTestMode(boolean testMode)
Sets whether this service is enabled

Parameters:
testMode - true if this service should be enabled

prepareTables

public void prepareTables(String data)
Description copied from interface: DbUnitService
Prepares the database according to the specified XML. The XML has to be in the "XML Data Set" format supported by DbUnit. The "Flat XML Data Set" is currently not supported.

Specified by:
prepareTables in interface DbUnitService
Parameters:
data - the XML to populate the database from as a String