|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.akquinet.jbosscc.needle.db.DatabaseTestcase
public class DatabaseTestcase
Base class for a database test case. Executes optional database operation on
test setup and tear down.
May be used as an injection provider for EntityManager,
EntityManagerFactory and EntityTransaction.
InjectionProvider,
DBOperation| Constructor Summary | |
|---|---|
DatabaseTestcase()
Creates an instance of DatabaseTestcase with the global
configured persistence unit name and the global configured
DBOperation. |
|
DatabaseTestcase(Class<?>... clazzes)
Deprecated. |
|
DatabaseTestcase(DBOperation dbOperation)
Creates an instance of DatabaseTestcase with the global
configured persistence unit name and overrides the global configured
DBOperation with the given database operation. |
|
DatabaseTestcase(DBOperation dbOperation,
Class<?>... clazzes)
Deprecated. |
|
DatabaseTestcase(String persistenceUnitName)
Creates an instance of DatabaseTestcase with the given
persistence unit name and the global configured DBOperation. |
|
DatabaseTestcase(String persistenceUnitName,
DBOperation dbOperation)
Creates an instance of DatabaseTestcase with the given
persistence unit name and overrides the global configured
DBOperation with the given database operation. |
|
| Method Summary | |
|---|---|
protected void |
after()
Execute tear down database operation, if configured. |
protected void |
before()
Execute setup database operation, if configured. |
javax.persistence.EntityManager |
getEntityManager()
Returns the EntityManager. |
javax.persistence.EntityManagerFactory |
getEntityManagerFactory()
Returns the EntityManagerFactory. |
Object |
getInjectedObject(Class<?> injectionPointType)
Provides an instance of T. |
Object |
getKey(InjectionTargetInformation injectionTargetInformation)
Returns a key object, which identifies the provided object. |
TransactionHelper |
getTransactionHelper()
Returns an instance of TransactionHelper |
boolean |
verify(InjectionTargetInformation injectionTargetInformation)
Verifies the injection target. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DatabaseTestcase()
DatabaseTestcase with the global
configured persistence unit name and the global configured
DBOperation.
DBOperationpublic DatabaseTestcase(DBOperation dbOperation)
DatabaseTestcase with the global
configured persistence unit name and overrides the global configured
DBOperation with the given database operation.
dbOperation - database operation to execute on test setup and tear downDBOperationpublic DatabaseTestcase(String persistenceUnitName)
DatabaseTestcase with the given
persistence unit name and the global configured DBOperation.
persistenceUnitName - the name of the persistence unitDBOperation
public DatabaseTestcase(String persistenceUnitName,
DBOperation dbOperation)
DatabaseTestcase with the given
persistence unit name and overrides the global configured
DBOperation with the given database operation.
persistenceUnitName - the name of the persistence unitdbOperation - database operation to execute on test setup and tear downDBOperation@Deprecated public DatabaseTestcase(Class<?>... clazzes)
DatabaseTestcase for the given entity
classes by using the configured hibernate specific configuration file
(*cfg.xml) and use the global configured DBOperation.
clazzes - the entity classesDBOperation
@Deprecated
public DatabaseTestcase(DBOperation dbOperation,
Class<?>... clazzes)
DatabaseTestcase for the given entity
classes by using the configured hibernate specific configuration file
(*cfg.xml) and overrides the global configured DBOperation with
the give database operation.
dbOperation - database operation to execute on test setup and tear downclazzes - the entity classesDBOperation| Method Detail |
|---|
protected void after()
throws Exception
Exception - thrown if an error occurs
protected void before()
throws Exception
Exception - thrown if an error occurspublic javax.persistence.EntityManager getEntityManager()
EntityManager.
EntityManager.public javax.persistence.EntityManagerFactory getEntityManagerFactory()
EntityManagerFactory.
EntityManagerFactory.public TransactionHelper getTransactionHelper()
TransactionHelper
TransactionHelperTransactionHelperpublic Object getInjectedObject(Class<?> injectionPointType)
InjectionProviderT.
getInjectedObject in interface InjectionProvider<Object>injectionPointType - the type of the injection target.
Tpublic boolean verify(InjectionTargetInformation injectionTargetInformation)
InjectionVerifier
verify in interface InjectionVerifierinjectionTargetInformation - information about the injection point
public Object getKey(InjectionTargetInformation injectionTargetInformation)
InjectionProvider
getKey in interface InjectionProvider<Object>injectionTargetInformation - information about the injection point
NeedleTestcase.getInjectedObject(Object)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||