com.silverpeas.components.model
Class AbstractTestDao

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.dbunit.DatabaseTestCase
              extended by org.dbunit.DBTestCase
                  extended by org.dbunit.JndiBasedDBTestCase
                      extended by com.silverpeas.components.model.AbstractTestDao
All Implemented Interfaces:
junit.framework.Test

public abstract class AbstractTestDao
extends org.dbunit.JndiBasedDBTestCase

Author:
ehugonnet

Field Summary
protected  org.springframework.jdbc.datasource.embedded.EmbeddedDatabase datasource
           
 
Constructor Summary
AbstractTestDao()
           
 
Method Summary
 void cleanData()
          Frees the previously created data in the database.
 void configureJNDIDatasource()
          Configure the data source from a JNDI context.
protected  org.dbunit.dataset.IDataSet getDataSet()
           
protected abstract  String getDatasetFileName()
           
protected  String getLookupName()
           
protected abstract  String getTableCreationFileName()
           
protected  String getTableCreationScript()
           
protected  org.dbunit.operation.DatabaseOperation getTearDownOperation()
           
 void prepareData()
          Prepares the data for the tests in the database.
 void setUp()
          This is called directly when running under JUnit 3.
static void setUpClass()
           
 void tearDown()
          This is called directly when running under JUnit 3.
static void tearDownClass()
           
 
Methods inherited from class org.dbunit.JndiBasedDBTestCase
getJNDIProperties, newDatabaseTester
 
Methods inherited from class org.dbunit.DBTestCase
getConnection
 
Methods inherited from class org.dbunit.DatabaseTestCase
closeConnection, getDatabaseTester, getOperationListener, getSetUpOperation, setUpDatabaseConfig
 
Methods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

datasource

protected org.springframework.jdbc.datasource.embedded.EmbeddedDatabase datasource
Constructor Detail

AbstractTestDao

public AbstractTestDao()
Method Detail

setUpClass

public static void setUpClass()
                       throws Exception
Throws:
Exception

tearDownClass

public static void tearDownClass()
                          throws Exception
Throws:
Exception

tearDown

public void tearDown()
              throws Exception
This is called directly when running under JUnit 3.

Overrides:
tearDown in class org.dbunit.DatabaseTestCase
Throws:
Exception - if an error occurs while tearing down the resources.

cleanData

public void cleanData()
               throws Exception
Frees the previously created data in the database. This is called directly by JUnit 4 or by the tearDown() method when running in JUnit 3.

Throws:
Exception - if an error occurs while cleaning data.

setUp

public void setUp()
           throws Exception
This is called directly when running under JUnit 3.

Overrides:
setUp in class org.dbunit.DatabaseTestCase
Throws:
Exception - if an error occurs while setting up the resources required by the tests.

prepareData

public void prepareData()
                 throws Exception
Prepares the data for the tests in the database. This is called directly by JUnit 4 or by the setUp() method when running in JUnit 3.

Throws:
Exception - if an error occurs while preparing the data required by the tests.

configureJNDIDatasource

public void configureJNDIDatasource()
                             throws Exception
Configure the data source from a JNDI context. This is called directly by JUnit 4 at test class loading or by the setUp() method at each test invocation in JUnit 3.

Throws:
IOException - if an error occurs while communicating with the JNDI context.
NamingException - if the data source cannot be found in the JNDI context.
Exception - if the data source cannot be created.

getTearDownOperation

protected org.dbunit.operation.DatabaseOperation getTearDownOperation()
                                                               throws Exception
Overrides:
getTearDownOperation in class org.dbunit.DatabaseTestCase
Throws:
Exception

getLookupName

protected String getLookupName()
Specified by:
getLookupName in class org.dbunit.JndiBasedDBTestCase

getDataSet

protected org.dbunit.dataset.IDataSet getDataSet()
                                          throws Exception
Specified by:
getDataSet in class org.dbunit.DatabaseTestCase
Throws:
Exception

getDatasetFileName

protected abstract String getDatasetFileName()

getTableCreationFileName

protected abstract String getTableCreationFileName()

getTableCreationScript

protected String getTableCreationScript()


Copyright © 2016 Silverpeas. All Rights Reserved.