- private PersistenceUnitDescription persistenceUnit;
- private Database db;
- private DataSource dataSource;
- private DatabaseUtils dbUtils;
- private JpaBuilder jpaBuilder;
- private IDatabaseTester dbTester;
-
- /**
- * Constructs the tester.
- * @param aPersistenceUnit Persistence unit under test.
- */
- public JpaTester(PersistenceUnitDescription aPersistenceUnit) {
- persistenceUnit = aPersistenceUnit;
- }
-
- /**
- * Starts the tester. This must be called prior to running the test.
- * @throws Exception
- */
- public void start() throws Exception {
- db = DatabaseBuilder.getDatabase();
- dataSource = db.start();
-
- dbUtils = new DatabaseUtils(dataSource, persistenceUnit.getTables());
- dbUtils.dropTables();
- dbUtils.dropTables(JpaCustomizerBuilder.getCustomizer().getJpaTables());
-
- jpaBuilder = new JpaBuilder(dataSource, persistenceUnit);
- jpaBuilder.start();
-
- // db tester should be created after Jpa builder because jpa builder
- // creates the
- // tables that the tester looks at when it is initialized.
- dbTester = dbUtils.createDbTester();
- }
-
- /**
- * Stops the tester. This must be called after the test.
- */
- public void stop() {
- if (jpaBuilder != null) {
- jpaBuilder.stop();
- }
- if (db != null) {
- db.stop();
- }
- }
-
- public Database getDb() {
- return db;
- }
-
- public DataSource getDataSource() {
- return dataSource;
- }
-
- public IDatabaseTester getDbTester() {
- return dbTester;
- }
-
- public DatabaseUtils getDbUtils() {
- return dbUtils;
- }
-
- public JpaBuilder getJpaBuilder() {
- return jpaBuilder;
- }
-
- public PersistenceUnitDescription getPersistenceUnit() {
- return persistenceUnit;
- }
+ private PersistenceUnitDescription persistenceUnit;
+ private Database db;
+ private DataSource dataSource;
+ private DatabaseUtils dbUtils;
+ private JpaBuilder jpaBuilder;
+ private IDatabaseTester dbTester;
+
+ /**
+ * Constructs the tester.
+ *
+ * @param aPersistenceUnit
+ * Persistence unit under test.
+ */
+ public JpaTester(PersistenceUnitDescription aPersistenceUnit) {
+ persistenceUnit = aPersistenceUnit;
+ }
+
+ /**
+ * Starts the tester. This must be called prior to running the test.
+ *
+ * @throws Exception
+ */
+ public void start() throws Exception {
+ db = DatabaseBuilder.getDatabase();
+ dataSource = db.start();
+
+ dbUtils = new DatabaseUtils(dataSource, persistenceUnit.getTables());
+ dbUtils.dropTables();
+ dbUtils.dropTables(JpaCustomizerBuilder.getCustomizer().getJpaTables());
+
+ jpaBuilder = new JpaBuilder(dataSource, persistenceUnit);
+ jpaBuilder.start();
+
+ // db tester should be created after Jpa builder because jpa builder
+ // creates the
+ // tables that the tester looks at when it is initialized.
+ dbTester = dbUtils.createDbTester();
+ }
+
+ /**
+ * Stops the tester. This must be called after the test.
+ */
+ public void stop() {
+ if (jpaBuilder != null) {
+ jpaBuilder.stop();
+ }
+ if (db != null) {
+ db.stop();
+ }
+ }
+
+ public Database getDb() {
+ return db;
+ }
+
+ public DataSource getDataSource() {
+ return dataSource;
+ }
+
+ public IDatabaseTester getDbTester() {
+ return dbTester;
+ }
+
+ public DatabaseUtils getDbUtils() {
+ return dbUtils;
+ }
+
+ public JpaBuilder getJpaBuilder() {
+ return jpaBuilder;
+ }
+
+ public PersistenceUnitDescription getPersistenceUnit() {
+ return persistenceUnit;
+ }