|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.wamblee.test.persistence.JpaTester
public class JpaTester
This class is the entry point for JPA tests. Test code should construct a
JpaTester in the @Before method and call start() on it
in that method. Also, test code should call stop() on it in the
@After method.
This class is constructed with a description of the persistence unit to be
tested. The principle is that an existing persistence.xml can be
tested without change in unit test code.
It then takes care of the following:
DatabaseBuilder for more information on how a
databse is obtained.PersistenceUnitDescription which describes the persistence unit and
must be provided at construction of the JpaTester
NOTE: Persistence XML files should be explicitly configured with the classes
that are part of the persistence unit since scanning of classes does not work
correctly in a unit test environment. This is currently the only limitation.
| Constructor Summary | |
|---|---|
JpaTester(PersistenceUnitDescription aPersistenceUnit)
Constructs the tester. |
|
| Method Summary | |
|---|---|
javax.sql.DataSource |
getDataSource()
Gets the datasource. |
Database |
getDb()
Gets the database. |
DatabaseUtils |
getDbUtils()
Gets the database utilities. |
JpaBuilder |
getJpaBuilder()
Gets the jpa builder. |
PersistenceUnitDescription |
getPersistenceUnit()
Gets the persistence unit. |
void |
start()
Starts the tester. |
void |
stop()
Stops the tester. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JpaTester(PersistenceUnitDescription aPersistenceUnit)
aPersistenceUnit - Persistence unit under test.| Method Detail |
|---|
public void start()
throws java.lang.Exception
java.lang.Exceptionpublic void stop()
public Database getDb()
public javax.sql.DataSource getDataSource()
public DatabaseUtils getDbUtils()
public JpaBuilder getJpaBuilder()
public PersistenceUnitDescription getPersistenceUnit()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||