Package org.dbunit

Class JndiDatabaseTester

All Implemented Interfaces:
IDatabaseTester

public class JndiDatabaseTester extends AbstractDatabaseTester
DatabaseTester that pulls a DataSource from a JNDI location.
Since:
2.2.0
Version:
$Revision$ $Date$
Author:
Andres Almiray (aalmiray@users.sourceforge.net), Last changed by: $Author$
  • Constructor Details

    • JndiDatabaseTester

      public JndiDatabaseTester(String lookupName)
      Creates a JndiDatabaseTester with default JNDI properties.
      Parameters:
      lookupName - the name of the resource in the JNDI context
    • JndiDatabaseTester

      public JndiDatabaseTester(Properties environment, String lookupName)
      Creates a JndiDatabaseTester with specific JNDI properties.
      Parameters:
      environment - A Properties object with JNDI properties. Can be null
      lookupName - the name of the resource in the JNDI context
    • JndiDatabaseTester

      public JndiDatabaseTester(Properties environment, String lookupName, String schema)
      Creates a JndiDatabaseTester with specific JNDI properties.
      Parameters:
      environment - A Properties object with JNDI properties. Can be null
      lookupName - the name of the resource in the JNDI context
      schema - The schema name to be used for new dbunit connections. Can be null
      Since:
      2.4.5
    • JndiDatabaseTester

      public JndiDatabaseTester(Properties environment, String lookupName, String schema, CachingConnectionProvider connectionProvider)
      Creates a JndiDatabaseTester with specific JNDI properties, reusing one IDatabaseConnection across calls via the given CachingConnectionProvider instead of creating a new one on every call.
      Share the same connectionProvider instance across the testers created for each test to get reuse across test methods; pair it with IOperationListener.NO_OP_OPERATION_LISTENER (or an equivalent non-closing listener) so the cached connection is not closed after every AbstractDatabaseTester.onSetup()/AbstractDatabaseTester.onTearDown() call.
      Parameters:
      environment - A Properties object with JNDI properties. Can be null
      lookupName - the name of the resource in the JNDI context
      schema - The schema name to be used for new dbunit connections. Can be null
      connectionProvider - caches and validates the connection across calls - can be null, in which case a new connection is created on every call as before
      Since:
      3.4.0
  • Method Details