From: Erik Brakkee
Date: Sat, 31 Jul 2010 17:33:39 +0000 (+0000)
Subject: (no commit message)
X-Git-Tag: wamblee-utils-0.7~116
X-Git-Url: http://wamblee.org/gitweb/?a=commitdiff_plain;h=83898516d61bfcd1f4e3a3ea79bb56f3877f4900;p=utils
---
diff --git a/test/enterprise/src/main/java/org/wamblee/test/inject/Binding.java b/test/enterprise/src/main/java/org/wamblee/test/inject/Binding.java
index 14e620a3..e9b27b98 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/inject/Binding.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/inject/Binding.java
@@ -24,12 +24,13 @@ import org.wamblee.reflection.Accessor;
import org.wamblee.reflection.AnnotationUtils;
/**
- * This class represents an injection binding. It provides injection of a defined object (typically mock or stub)
- * into other objects. The binding is defined by the required annotation that must be on the field, the field type,
- * and the object to be injected.
+ * This class represents an injection binding. It provides injection of a
+ * defined object (typically mock or stub) into other objects. The binding is
+ * defined by the required annotation that must be on the field, the field type,
+ * and the object to be injected.
*
* @author Erik Brakkee
- *
+ *
* @param
*/
public class Binding {
@@ -39,10 +40,14 @@ public class Binding {
private Map> accessorCache;
/**
- * Constructs the binding.
- * @param aClass Required type of the field injected into.
- * @param aAnnotation Annotation that must be present on the field.
- * @param aValue Value of the annotation.
+ * Constructs the binding.
+ *
+ * @param aClass
+ * Required type of the field injected into.
+ * @param aAnnotation
+ * Annotation that must be present on the field.
+ * @param aValue
+ * Value of the annotation.
*/
public Binding(Class aClass, Class extends Annotation> aAnnotation,
Object aValue) {
diff --git a/test/enterprise/src/main/java/org/wamblee/test/inject/JavaEETestInjector.java b/test/enterprise/src/main/java/org/wamblee/test/inject/JavaEETestInjector.java
index 8fe52ac1..853d312c 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/inject/JavaEETestInjector.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/inject/JavaEETestInjector.java
@@ -37,10 +37,11 @@ import org.wamblee.reflection.ObjectTraversal.ObjectVisitor;
*
*
*
- * It works by first delegating to the default injector (typically CDI). Afterwards it traverses the
- * object graph of the injected object and performs custom injection of test objects as specified by the
- * {@link Binding} class. This approach makes sure that test dependencies also find their way into
- * objects that were created by the injection framework.
+ * It works by first delegating to the default injector (typically CDI).
+ * Afterwards it traverses the object graph of the injected object and performs
+ * custom injection of test objects as specified by the {@link Binding} class.
+ * This approach makes sure that test dependencies also find their way into
+ * objects that were created by the injection framework.
*
*
* @author Erik Brakkee
@@ -50,37 +51,44 @@ public class JavaEETestInjector implements Injector {
private class InjectionVisitor implements ObjectVisitor {
@Override
public boolean mustVisit(Class aClass) {
- if (EntityManager.class.isAssignableFrom(aClass)) {
+ if (EntityManager.class.isAssignableFrom(aClass)) {
return false;
}
return true;
}
+
@Override
public boolean mustVisit(Field aField) {
// just process any field with annotations
- return aField.getAnnotations().length > 0;
+ return aField.getAnnotations().length > 0;
}
+
@Override
public boolean mustVisit(Method aMethod) {
return false;
}
+
@Override
public boolean visitArray(Object aArray) {
return true;
}
+
@Override
public boolean visitList(List aObject) {
return true;
}
+
@Override
public boolean visitMap(Map aObject) {
return true;
}
+
@Override
public boolean visitPlainObject(Object aObject) {
performTestInjections(aObject);
return true;
}
+
@Override
public boolean visitSet(Set aSet) {
return true;
@@ -110,7 +118,7 @@ public class JavaEETestInjector implements Injector {
public void inject(Object aComponent) {
// basic injection
delegate.inject(aComponent);
-
+
// Now perform test injections.
ObjectTraversal traversal = new ObjectTraversal(new InjectionVisitor());
traversal.accept(aComponent);
diff --git a/test/enterprise/src/main/java/org/wamblee/test/inject/JavaEETestInjectorFactory.java b/test/enterprise/src/main/java/org/wamblee/test/inject/JavaEETestInjectorFactory.java
index fdfb84a7..f5814981 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/inject/JavaEETestInjectorFactory.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/inject/JavaEETestInjectorFactory.java
@@ -28,65 +28,76 @@ import org.wamblee.test.persistence.JpaBuilder;
/**
*
- * The test injector factory provides dependency injection of a contextual entity manager
- * using the support/inject mini framework. It supports dependency injection of fields
- * annoted with @PersistenceContext. It only supports one persistence context
- * at the moment. This injector can be easily used together with {@link JpaBuilder#getContextualEntityManager()}
- * for obtaining an entity manager in unit test.
+ * The test injector factory provides dependency injection of a contextual
+ * entity manager using the support/inject mini framework. It supports
+ * dependency injection of fields annoted with
+ * @PersistenceContext. It only supports one persistence
+ * context at the moment. This injector can be easily used together with
+ * {@link JpaBuilder#getContextualEntityManager()} for obtaining an entity
+ * manager in unit test.
*
*
*
- * The reason it is needed is because standard injection mechanisms (such as weld CDI) do not support
- * entity manager injection in a Java SE environment out of the box.
+ * The reason it is needed is because standard injection mechanisms (such as
+ * weld CDI) do not support entity manager injection in a Java SE environment
+ * out of the box.
*
- *
+ *
*
- * To use it, construct the factory using one of the available constructors and set
- * InjectorBuilder.setInjectorFactory(InjectorFactory).
+ * To use it, construct the factory using one of the available constructors and
+ * set InjectorBuilder.setInjectorFactory(InjectorFactory).
*
*
* @author Erik Brakkee
- *
+ *
*/
public class JavaEETestInjectorFactory implements InjectorFactory {
private List bindings;
private InjectorFactory delegate;
-
+
/**
- * Constructs the factory.
- * @param aInjectorFactory Injector factory to delegate to.
+ * Constructs the factory.
+ *
+ * @param aInjectorFactory
+ * Injector factory to delegate to.
*/
public JavaEETestInjectorFactory(InjectorFactory aInjectorFactory) {
- bindings = new ArrayList();
+ bindings = new ArrayList();
delegate = aInjectorFactory;
}
/**
- * Adds default entity manager binding. Any field annotated with @PersistenceContext and of type
- * entity manager will get injected.
- * @param aEntityManager Entitymanager object to inject.
+ * Adds default entity manager binding. Any field annotated with @PersistenceContext
+ * and of type entity manager will get injected.
+ *
+ * @param aEntityManager
+ * Entitymanager object to inject.
* @return Factory to allow chaining.
*/
- public JavaEETestInjectorFactory addEntityManagerBinding(EntityManager aEntityManager) {
- Binding em = new Binding(EntityManager.class, PersistenceContext.class, aEntityManager);
+ public JavaEETestInjectorFactory addEntityManagerBinding(
+ EntityManager aEntityManager) {
+ Binding em = new Binding(EntityManager.class, PersistenceContext.class,
+ aEntityManager);
addBinding(em);
return this;
}
-
+
/**
- * Adds another custom injection binding.
- * @param aBinding Injection binding to use.
+ * Adds another custom injection binding.
+ *
+ * @param aBinding
+ * Injection binding to use.
* @return the factoryto allow chaining.
*/
- public JavaEETestInjectorFactory addBinding(Binding aBinding) {
+ public JavaEETestInjectorFactory addBinding(Binding aBinding) {
bindings.add(aBinding);
- return this;
+ return this;
}
/**
- * Constructs the factory with the default injector factory obtained from
- * {@link InjectorBuilder#getInjector()}.
+ * Constructs the factory with the default injector factory obtained from
+ * {@link InjectorBuilder#getInjector()}.
*/
public JavaEETestInjectorFactory() {
this(getDefaultInjectorFactory());
@@ -99,7 +110,6 @@ public class JavaEETestInjectorFactory implements InjectorFactory {
@Override
public Injector create(Class aClass) {
- return new JavaEETestInjector(aClass, bindings, delegate
- .create(aClass));
+ return new JavaEETestInjector(aClass, bindings, delegate.create(aClass));
}
}
diff --git a/test/enterprise/src/main/java/org/wamblee/test/jndi/StubInitialContext.java b/test/enterprise/src/main/java/org/wamblee/test/jndi/StubInitialContext.java
index f5277703..e185d506 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/jndi/StubInitialContext.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/jndi/StubInitialContext.java
@@ -24,7 +24,7 @@ import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
/**
- * Initial context implementation.
+ * Initial context implementation.
*
* @author Erik Brakkee
*/
@@ -39,7 +39,7 @@ class StubInitialContext extends InitialContext {
public void bind(String aName, Object aObj) throws NamingException {
bindings.put(aName, aObj);
}
-
+
@Override
public void unbind(String aName) throws NamingException {
bindings.remove(aName);
@@ -53,12 +53,12 @@ class StubInitialContext extends InitialContext {
}
return value;
}
-
+
@Override
public void bind(Name aName, Object aObj) throws NamingException {
bind(aName.toString(), aObj);
}
-
+
@Override
public void unbind(Name aName) throws NamingException {
unbind(aName.toString());
diff --git a/test/enterprise/src/main/java/org/wamblee/test/jndi/StubInitialContextFactory.java b/test/enterprise/src/main/java/org/wamblee/test/jndi/StubInitialContextFactory.java
index 09389ef1..023e7777 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/jndi/StubInitialContextFactory.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/jndi/StubInitialContextFactory.java
@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.test.jndi;
import java.util.Hashtable;
@@ -27,17 +27,18 @@ import javax.naming.spi.InitialContextFactory;
*
* See {@link #bind(String, Object)} to resp. register the initial context.
*
- * To start mocking the JNDI tree, call {@link #register()}.
+ * To start mocking the JNDI tree, call {@link #register()}.
+ *
+ * To bind objects in the JNDI tree simply use the standard JNDI api:
*
- * To bind objects in the JNDI tree simply use the standard JNDI api:
*
*
- * When finished with a test case, call {@link #unregister()} to unregister the
- * JNDI tree again.
+ * When finished with a test case, call {@link #unregister()} to unregister the
+ * JNDI tree again.
*/
public class StubInitialContextFactory implements InitialContextFactory {
diff --git a/test/enterprise/src/main/java/org/wamblee/test/jndi/package-info.java b/test/enterprise/src/main/java/org/wamblee/test/jndi/package-info.java
index 7fd7ddbc..acbc06e2 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/jndi/package-info.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/jndi/package-info.java
@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
/**
* This package provides utilities for JNDI testing.
*
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/AbstractDatabase.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/AbstractDatabase.java
index df5cb75f..11fda933 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/AbstractDatabase.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/AbstractDatabase.java
@@ -29,12 +29,12 @@ import org.apache.commons.dbcp.PoolingDataSource;
import org.apache.commons.pool.impl.GenericObjectPool;
/**
- * Abstract database class providing the creation of the datasource,
- * preventing duplicate starts of the same database, and checking
- * for connection leaks when the database is stopped.
+ * Abstract database class providing the creation of the datasource, preventing
+ * duplicate starts of the same database, and checking for connection leaks when
+ * the database is stopped.
*
* @author Erik Brakkee
- *
+ *
*/
public abstract class AbstractDatabase implements Database {
@@ -56,19 +56,19 @@ public abstract class AbstractDatabase implements Database {
private boolean started;
/**
- * Constructs the database.
+ * Constructs the database.
*/
protected AbstractDatabase() {
started = false;
}
/**
- * To be implemented by subclasses to start the database.
+ * To be implemented by subclasses to start the database.
*/
protected abstract void doStart();
/**
- * To be implemented by subclasses to stop the database.
+ * To be implemented by subclasses to stop the database.
*/
protected abstract void doStop();
@@ -101,7 +101,7 @@ public abstract class AbstractDatabase implements Database {
// / BELOW THIS LINE IS NOT OF INTEREST TO SUBCLASSES.
/**
- * Starts the database.
+ * Starts the database.
*/
public final DataSource start() {
if (started) {
@@ -113,9 +113,9 @@ public abstract class AbstractDatabase implements Database {
}
/**
- * Stops the database and tests for connection leaks.
- * In cast the system property with the name given by {@link #IGNORE_CONNECTION_LEAK_PROPERTY}
- * is set then the connection leaks are not checked.
+ * Stops the database and tests for connection leaks. In cast the system
+ * property with the name given by {@link #IGNORE_CONNECTION_LEAK_PROPERTY}
+ * is set then the connection leaks are not checked.
*/
public final void stop() {
if (!started) {
@@ -127,8 +127,9 @@ public abstract class AbstractDatabase implements Database {
String msg = "JDBC connection pool still has " +
connectionPool.getNumActive() +
" active connection(s), this is a potential resource leak in the code\n";
- // backdoor to ignore connection leaks. Use this system property only if you
- // can safely ignore the connection leaks.
+ // backdoor to ignore connection leaks. Use this system property
+ // only if you
+ // can safely ignore the connection leaks.
if (System.getProperty(IGNORE_CONNECTION_LEAK_PROPERTY) == null) {
Assert.fail(msg);
}
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/AbstractDatabaseProvider.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/AbstractDatabaseProvider.java
index 9bfa30f1..321a8c1e 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/AbstractDatabaseProvider.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/AbstractDatabaseProvider.java
@@ -12,24 +12,25 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.test.persistence;
import java.util.List;
+
/**
- * Base class for database providers.
+ * Base class for database providers.
*
* @author Erik Brakkee
*/
public abstract class AbstractDatabaseProvider implements DatabaseProvider {
/**
- * @return List of database capabilities.
+ * @return List of database capabilities.
*/
protected abstract List getCapabilities();
/**
- * Standard implementation of the capabalities check.
+ * Standard implementation of the capabalities check.
*/
public final boolean supportsCapabilities(String[] aCapabilities) {
for (String capability : aCapabilities) {
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/CompositeJpaCustomizer.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/CompositeJpaCustomizer.java
index 08de725c..e766b9fe 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/CompositeJpaCustomizer.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/CompositeJpaCustomizer.java
@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.test.persistence;
import java.util.List;
@@ -21,8 +21,8 @@ import java.util.Map;
import org.dbunit.dataset.filter.ITableFilterSimple;
/**
- * Composite JPA customizer that applies the customizations from several
- * JPA customizers.
+ * Composite JPA customizer that applies the customizations from several JPA
+ * customizers.
*
* @author Erik Brakkee
*/
@@ -32,8 +32,10 @@ public class CompositeJpaCustomizer implements JpaCustomizer {
private CompositeJpaTables tables;
/**
- * Construcst the customizer.
- * @param aCustomizers List of customizers.
+ * Construcst the customizer.
+ *
+ * @param aCustomizers
+ * List of customizers.
*/
public CompositeJpaCustomizer(List aCustomizers) {
customizers = aCustomizers;
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/CompositeJpaTables.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/CompositeJpaTables.java
index 23db6d29..d1d2d3ac 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/CompositeJpaTables.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/CompositeJpaTables.java
@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.test.persistence;
import java.util.ArrayList;
@@ -22,7 +22,7 @@ import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.filter.ITableFilterSimple;
/**
- * Composite JPA tables. Implements the logical or of several table filters.
+ * Composite JPA tables. Implements the logical or of several table filters.
*
* @author Erik Brakkee
*/
@@ -31,15 +31,17 @@ public class CompositeJpaTables implements ITableFilterSimple {
private List tables;
/**
- * Construcst the tables.
+ * Construcst the tables.
*/
public CompositeJpaTables() {
tables = new ArrayList();
}
/**
- * Adds a table filter.
- * @param aFilter filter.
+ * Adds a table filter.
+ *
+ * @param aFilter
+ * filter.
*/
public void add(ITableFilterSimple aFilter) {
tables.add(aFilter);
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/Database.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/Database.java
index da8ff158..66273432 100755
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/Database.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/Database.java
@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.test.persistence;
import javax.sql.DataSource;
@@ -29,13 +29,14 @@ public interface Database {
* database has been started.
*/
DataSource start();
-
+
/**
- * Gets the number of active connections from the pool. This is useful for
- * determining resource leaks.
- * @return Active connections.
+ * Gets the number of active connections from the pool. This is useful for
+ * determining resource leaks.
+ *
+ * @return Active connections.
*/
- int getActiveConnections();
+ int getActiveConnections();
/**
* Gets the Jdbc Url to connect to this database.
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseBuilder.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseBuilder.java
index f8ae4a99..e966d456 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseBuilder.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseBuilder.java
@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.test.persistence;
import java.util.ArrayList;
@@ -62,11 +62,11 @@ public class DatabaseBuilder {
*/
public static final String DB_CAPABILITIES_PROP = "TEST_DB_CAPABILITIES";
- private static ServiceLoader LOADER =
- ServiceLoader.load(DatabaseProvider.class);
+ private static ServiceLoader LOADER = ServiceLoader
+ .load(DatabaseProvider.class);
/**
- * Constructs the database builder.
+ * Constructs the database builder.
*/
private DatabaseBuilder() {
// Empty.
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseDescription.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseDescription.java
index 8f44094a..aa9966e7 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseDescription.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseDescription.java
@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.test.persistence;
/**
@@ -52,7 +52,7 @@ public class DatabaseDescription {
for (int i = 0; i < itsCapabilities.length; i++) {
res.append(itsCapabilities[i]);
if (i < itsCapabilities.length - 1) {
- res.append(", ");
+ res.append(", ");
}
}
return res.toString();
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseProvider.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseProvider.java
index 21699ed8..9b78363c 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseProvider.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseProvider.java
@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.test.persistence;
/**
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseStarter.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseStarter.java
index 8be5ff7c..92b6a521 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseStarter.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseStarter.java
@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.test.persistence;
/**
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseUtils.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseUtils.java
index c4e38f4d..dc7c0404 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseUtils.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/DatabaseUtils.java
@@ -47,7 +47,7 @@ public class DatabaseUtils {
/**
* Represents a set of tables.
- *
+ *
* @author Erik Brakkee
*/
public static interface TableSet {
@@ -58,29 +58,33 @@ public class DatabaseUtils {
* Represents a unit of work (transaction).
*
* @author Erik Brakkee
- *
- * @param Type of return value.
+ *
+ * @param
+ * Type of return value.
*/
public static interface JdbcUnitOfWork {
/**
- * Executes statement within a transaction.
- * @param aConnection Connection.
- * @return Result of the work.
+ * Executes statement within a transaction.
+ *
+ * @param aConnection
+ * Connection.
+ * @return Result of the work.
* @throws Exception
*/
T execute(Connection aConnection) throws Exception;
}
/**
- * Operation to be executed on a set of tables for each table
- * individually.
+ * Operation to be executed on a set of tables for each table individually.
*
* @author Erik Brakkee
*/
public static interface TableSetOperation {
/**
- * Executes on a table.
- * @param aTable Table name.
+ * Executes on a table.
+ *
+ * @param aTable
+ * Table name.
* @throws Exception
*/
void execute(String aTable) throws Exception;
@@ -97,37 +101,39 @@ public class DatabaseUtils {
private IDatabaseTester dbtester;
/**
- * List of connections that were created for dbtesters.
- * This list will be closed in the {@link #stop()} method.
+ * List of connections that were created for dbtesters. This list will be
+ * closed in the {@link #stop()} method.
*/
- private List connections;
-
+ private List connections;
+
/**
- * Constructs the database utils.
- * Before use, {@link #start()} must be called.
- * @param aDataSource Datasource.
+ * Constructs the database utils. Before use, {@link #start()} must be
+ * called.
+ *
+ * @param aDataSource
+ * Datasource.
*/
public DatabaseUtils(DataSource aDataSource) {
dataSource = aDataSource;
dbtester = new DataSourceDatabaseTester(dataSource);
- connections = new ArrayList();
+ connections = new ArrayList();
}
/**
- * Starts the database utils.
+ * Starts the database utils.
*/
- public void start() {
- // Empty. No operation currently.
+ public void start() {
+ // Empty. No operation currently.
}
/**
* Stops the database utils, closing any JDBC connections that were created
- * by this utility. Note that connections obtained from the datasource directly
- * must still be closed by the user. The involved connections are only those that
- * are created by this utility.
+ * by this utility. Note that connections obtained from the datasource
+ * directly must still be closed by the user. The involved connections are
+ * only those that are created by this utility.
*/
public void stop() {
- for (IDatabaseConnection connection: connections) {
+ for (IDatabaseConnection connection : connections) {
try {
connection.close();
} catch (SQLException e) {
@@ -138,19 +144,24 @@ public class DatabaseUtils {
}
/**
- * Creates database tester.
- * @param aTables Tables to create the tester for.
- * @return Database tester.
+ * Creates database tester.
+ *
+ * @param aTables
+ * Tables to create the tester for.
+ * @return Database tester.
* @throws Exception
*/
- public IDatabaseTester createDbTester(ITableFilterSimple aTables) throws Exception {
+ public IDatabaseTester createDbTester(ITableFilterSimple aTables)
+ throws Exception {
return createDbTester(getTableNames(aTables));
}
-
+
/**
- * Creates database tester.
- * @param aTables Tables to create the tester for.
- * @return Database tester.
+ * Creates database tester.
+ *
+ * @param aTables
+ * Tables to create the tester for.
+ * @return Database tester.
* @throws Exception
*/
public IDatabaseTester createDbTester(String[] aTables) throws Exception {
@@ -161,9 +172,12 @@ public class DatabaseUtils {
}
/**
- * Executes an operation on a set of tables.
- * @param aTables Tables.
- * @param aOperation Operation.
+ * Executes an operation on a set of tables.
+ *
+ * @param aTables
+ * Tables.
+ * @param aOperation
+ * Operation.
* @throws Exception
*/
public void executeOnTables(ITableFilterSimple aTables,
@@ -180,9 +194,12 @@ public class DatabaseUtils {
}
/**
- * Cleans a number of database tables. This means deleting the content not dropping the tables.
- * This may fail in case of cyclic dependencies between the tables (current limitation).
- * @param aSelection Tables.
+ * Cleans a number of database tables. This means deleting the content not
+ * dropping the tables. This may fail in case of cyclic dependencies between
+ * the tables (current limitation).
+ *
+ * @param aSelection
+ * Tables.
* @throws Exception
*/
public void cleanDatabase(ITableFilterSimple aSelection) throws Exception {
@@ -205,14 +222,16 @@ public class DatabaseUtils {
}
/**
- * Executes a unit of work within a transaction.
- * @param Result type of th ework.
- * @param aWork Unit of work.
+ * Executes a unit of work within a transaction.
+ *
+ * @param
+ * Result type of th ework.
+ * @param aWork
+ * Unit of work.
* @return
* @throws Exception
*/
- public T executeInTransaction(JdbcUnitOfWork aWork)
- throws Exception {
+ public T executeInTransaction(JdbcUnitOfWork aWork) throws Exception {
Connection connection = dataSource.getConnection();
connection.setAutoCommit(false);
try {
@@ -223,11 +242,13 @@ public class DatabaseUtils {
connection.close();
}
}
-
+
/**
- * Returns table names based on a table filter.
- * @param aSelection Table filter.
- * @return Table names.
+ * Returns table names based on a table filter.
+ *
+ * @param aSelection
+ * Table filter.
+ * @return Table names.
* @throws Exception
*/
public String[] getTableNames(ITableFilterSimple aSelection)
@@ -254,7 +275,7 @@ public class DatabaseUtils {
}
/**
- * Use {@link #cleanDatabase(ITableFilterSimple)} instead.
+ * Use {@link #cleanDatabase(ITableFilterSimple)} instead.
*/
@Deprecated
public void emptyTables(final ITableFilterSimple aSelection)
@@ -267,7 +288,7 @@ public class DatabaseUtils {
}
/**
- * User {@link #cleanDatabase(ITableFilterSimple)} instead.
+ * User {@link #cleanDatabase(ITableFilterSimple)} instead.
*/
@Deprecated
public void emptyTable(String aTable) throws Exception {
@@ -275,8 +296,11 @@ public class DatabaseUtils {
}
/**
- * Drops tables. This only works if there are no cyclic dependencies between the tables.
- * @param aTables Tables to drop.
+ * Drops tables. This only works if there are no cyclic dependencies between
+ * the tables.
+ *
+ * @param aTables
+ * Tables to drop.
* @throws Exception
*/
public void dropTables(ITableFilterSimple aTables) throws Exception {
@@ -299,8 +323,10 @@ public class DatabaseUtils {
}
/**
- * Drops a table.
- * @param aTable Table to drop.
+ * Drops a table.
+ *
+ * @param aTable
+ * Table to drop.
* @throws Exception
*/
public void dropTable(final String aTable) throws Exception {
@@ -413,11 +439,15 @@ public class DatabaseUtils {
}
/**
- * Executes an update.
- * @param aConnection Connection to use.
- * @param aSql SQL update to use.
- * @param aArgs Arguments to the update.
- * @return Number of rows updated.
+ * Executes an update.
+ *
+ * @param aConnection
+ * Connection to use.
+ * @param aSql
+ * SQL update to use.
+ * @param aArgs
+ * Arguments to the update.
+ * @return Number of rows updated.
*/
public int executeUpdate(Connection aConnection, final String aSql,
final Object... aArgs) {
@@ -476,9 +506,11 @@ public class DatabaseUtils {
}
/**
- * Gets the table size.
- * @param aTable Table.
- * @return Table size.
+ * Gets the table size.
+ *
+ * @param aTable
+ * Table.
+ * @return Table size.
* @throws SQLException
*/
public int getTableSize(final String aTable) throws Exception {
@@ -494,9 +526,11 @@ public class DatabaseUtils {
}
/**
- * Counts the results in a result set.
- * @param aResultSet Resultset.
- * @return Number of rows in the set.
+ * Counts the results in a result set.
+ *
+ * @param aResultSet
+ * Resultset.
+ * @return Number of rows in the set.
* @throws SQLException
*/
public int countResultSet(ResultSet aResultSet) throws SQLException {
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/DerbyDatabaseProvider.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/DerbyDatabaseProvider.java
index 26387962..fdab8804 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/DerbyDatabaseProvider.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/DerbyDatabaseProvider.java
@@ -12,14 +12,14 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.test.persistence;
import java.util.Arrays;
import java.util.List;
/**
- * Derby database provider.
+ * Derby database provider.
*
* @author Erik Brakkee
*/
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/ExternalDatabase.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/ExternalDatabase.java
index a3044576..00ea47e4 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/ExternalDatabase.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/ExternalDatabase.java
@@ -12,10 +12,9 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.test.persistence;
-
/**
* Database that encapsulates connection to an external database. Database
* connection details can be configured through system properties and
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/ExternalDatabaseProvider.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/ExternalDatabaseProvider.java
index cc54799b..a460cc52 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/ExternalDatabaseProvider.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/ExternalDatabaseProvider.java
@@ -12,14 +12,14 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.test.persistence;
import java.util.Arrays;
import java.util.List;
/**
- * Database provider for an external database.
+ * Database provider for an external database.
*
* @author Erik Brakkee
*/
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/JpaBuilder.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/JpaBuilder.java
index 223971c6..48556cfa 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/JpaBuilder.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/JpaBuilder.java
@@ -153,7 +153,7 @@ public class JpaBuilder implements TransactionResource {
*
* This method requires the transaction to succeed. Otherwise the test will
* fail. See {@link #execute(JpaUnitOfWork, TransactionResultCallback)} and
- * {@link RequireTransactionStatus} for more possibilities.
+ * {@link RequireTransactionStatus} for more possibilities.
*
* @param aWork
* Work to execute.
@@ -161,9 +161,10 @@ public class JpaBuilder implements TransactionResource {
* @return The return value of the execute method of the unit of work.
*/
public T execute(JpaUnitOfWork aWork) throws Exception {
- return execute(aWork, new RequireTransactionStatus(TransactionResult.COMMIT));
+ return execute(aWork, new RequireTransactionStatus(
+ TransactionResult.COMMIT));
}
-
+
/**
* Executes a unit of work. This creates an entitymanager and runs the
* {@link JpaUnitOfWork#execute(EntityManager)} within a transaction,
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/JpaCustomizer.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/JpaCustomizer.java
index dcafb426..b0222342 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/JpaCustomizer.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/JpaCustomizer.java
@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.test.persistence;
import java.util.Map;
@@ -33,16 +33,20 @@ import org.dbunit.dataset.filter.ITableFilterSimple;
public interface JpaCustomizer {
/**
- * Customizes the persistence unit through properties.
- * @param aPersistenceUnit Persistence unit.
- * @param aJpaProperties Current properties.
+ * Customizes the persistence unit through properties.
+ *
+ * @param aPersistenceUnit
+ * Persistence unit.
+ * @param aJpaProperties
+ * Current properties.
*/
void customize(PersistenceUnitDescription aPersistenceUnit,
Map aJpaProperties);
/**
- * Gets the tables specific to the JPA provider.
- * @return Tables.
+ * Gets the tables specific to the JPA provider.
+ *
+ * @return Tables.
*/
ITableFilterSimple getJpaTables();
}
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/JpaCustomizerBuilder.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/JpaCustomizerBuilder.java
index bd62c054..6eae6661 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/JpaCustomizerBuilder.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/JpaCustomizerBuilder.java
@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.test.persistence;
import java.util.ArrayList;
@@ -20,8 +20,8 @@ import java.util.List;
import java.util.ServiceLoader;
/**
- * JPA customizer builder implements the {@link ServiceLoader} based mechanism for looking up
- * JPA customizers.
+ * JPA customizer builder implements the {@link ServiceLoader} based mechanism
+ * for looking up JPA customizers.
*/
public class JpaCustomizerBuilder {
@@ -29,9 +29,10 @@ public class JpaCustomizerBuilder {
.load(JpaCustomizer.class);
/**
- * Gets the customizer to use. This is a composite customizer that combines all customizers that
- * were found.
- * @return JPA customizer.
+ * Gets the customizer to use. This is a composite customizer that combines
+ * all customizers that were found.
+ *
+ * @return JPA customizer.
*/
public static JpaCustomizer getCustomizer() {
List customizers = new ArrayList();
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/JpaTester.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/JpaTester.java
index 27462fb0..650c55e8 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/JpaTester.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/JpaTester.java
@@ -62,7 +62,7 @@ public class JpaTester {
private DataSource dataSource;
private DatabaseUtils dbUtils;
private JpaBuilder jpaBuilder;
-
+
/**
* Constructs the tester.
*
@@ -81,9 +81,9 @@ public class JpaTester {
public void start() throws Exception {
db = DatabaseBuilder.getDatabase();
dataSource = db.start();
-
- // NOTE: adding datasource to JNDI is no longer needed for
- // JPA testing, but is nice to have available for other uses.
+
+ // NOTE: adding datasource to JNDI is no longer needed for
+ // JPA testing, but is nice to have available for other uses.
StubInitialContextFactory.register();
try {
InitialContext ctx = new InitialContext();
@@ -96,7 +96,8 @@ public class JpaTester {
dbUtils.start();
dbUtils.dropTables(JpaCustomizerBuilder.getCustomizer().getJpaTables());
- jpaBuilder = new JpaBuilder(db.getJdbcUrl(), db.getUsername(), db.getPassword(), persistenceUnit);
+ jpaBuilder = new JpaBuilder(db.getJdbcUrl(), db.getUsername(), db
+ .getPassword(), persistenceUnit);
jpaBuilder.start();
}
@@ -116,40 +117,45 @@ public class JpaTester {
}
/**
- * Gets the database.
- * @return Database.
+ * Gets the database.
+ *
+ * @return Database.
*/
public Database getDb() {
return db;
}
/**
- * Gets the datasource.
- * @return Datasource.
+ * Gets the datasource.
+ *
+ * @return Datasource.
*/
public DataSource getDataSource() {
return dataSource;
}
/**
- * Gets the database utilities.
- * @return Database utilities.
+ * Gets the database utilities.
+ *
+ * @return Database utilities.
*/
public DatabaseUtils getDbUtils() {
return dbUtils;
}
/**
- * Gets the jpa builder.
- * @return JPA builder.
+ * Gets the jpa builder.
+ *
+ * @return JPA builder.
*/
public JpaBuilder getJpaBuilder() {
return jpaBuilder;
}
/**
- * Gets the persistence unit.
- * @return Persistence unit.
+ * Gets the persistence unit.
+ *
+ * @return Persistence unit.
*/
public PersistenceUnitDescription getPersistenceUnit() {
return persistenceUnit;
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/LoggingTransactionResultCallback.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/LoggingTransactionResultCallback.java
index 42d37e48..a46ca18b 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/LoggingTransactionResultCallback.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/LoggingTransactionResultCallback.java
@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.test.persistence;
import java.util.logging.Level;
@@ -22,22 +22,24 @@ import org.wamblee.test.transactions.TransactionResult;
/**
* Logging the result of a transaction.
+ *
* @author Erik Brakkee
- *
+ *
*/
public class LoggingTransactionResultCallback implements
TransactionResultCallback {
-
- private static final Logger LOGGER = Logger.getLogger(LoggingTransactionResultCallback.class.getName());
-
- private Level level;
-
- public LoggingTransactionResultCallback(Level aLevel) {
- level = aLevel;
+
+ private static final Logger LOGGER = Logger
+ .getLogger(LoggingTransactionResultCallback.class.getName());
+
+ private Level level;
+
+ public LoggingTransactionResultCallback(Level aLevel) {
+ level = aLevel;
}
@Override
public void status(TransactionResult aResult) {
- LOGGER.log(level, "Transaction result " + aResult);
+ LOGGER.log(level, "Transaction result " + aResult);
}
}
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/PersistenceUnitDescription.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/PersistenceUnitDescription.java
index 4a16dc06..dc9fca84 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/PersistenceUnitDescription.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/PersistenceUnitDescription.java
@@ -12,12 +12,11 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.test.persistence;
-
/**
- * Describes a persistence unit.
+ * Describes a persistence unit.
*
* @author Erik Brakkee
*/
@@ -27,9 +26,12 @@ public class PersistenceUnitDescription {
private String unitName;
/**
- * Constructs the description.
- * @param aJndiName Jndi name.
- * @param aUnitName Persistence unit name.
+ * Constructs the description.
+ *
+ * @param aJndiName
+ * Jndi name.
+ * @param aUnitName
+ * Persistence unit name.
*/
public PersistenceUnitDescription(String aJndiName, String aUnitName) {
jndiName = aJndiName;
@@ -37,14 +39,14 @@ public class PersistenceUnitDescription {
}
/**
- * @return JNDI name.
+ * @return JNDI name.
*/
public String getJndiName() {
return jndiName;
}
/**
- * Persistence unit name.
+ * Persistence unit name.
*/
public String getUnitName() {
return unitName;
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/RequireTransactionStatus.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/RequireTransactionStatus.java
index 338e41a1..14d871bf 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/RequireTransactionStatus.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/RequireTransactionStatus.java
@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.test.persistence;
import org.wamblee.test.transactions.TransactionResult;
@@ -20,26 +20,31 @@ import org.wamblee.test.transactions.TransactionResult;
import static junit.framework.Assert.*;
/**
- * Specific transaction result callback to require a specific transaction result.
+ * Specific transaction result callback to require a specific transaction
+ * result.
+ *
* @author Erik Brakkee
- *
+ *
*/
public class RequireTransactionStatus implements TransactionResultCallback {
- private TransactionResult result;
-
+ private TransactionResult result;
+
/**
- * Constructs the callback.
- * @param aResult Required result.
+ * Constructs the callback.
+ *
+ * @param aResult
+ * Required result.
*/
- public RequireTransactionStatus(TransactionResult aResult) {
+ public RequireTransactionStatus(TransactionResult aResult) {
result = aResult;
}
-
+
@Override
public void status(TransactionResult aResult) {
- if (!result.equals(aResult)) {
- fail("Required transaction result was " + result + " but actual result was " + aResult);
+ if (!result.equals(aResult)) {
+ fail("Required transaction result was " + result +
+ " but actual result was " + aResult);
}
}
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/TransactionResultCallback.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/TransactionResultCallback.java
index 64c787dd..cc5074b3 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/TransactionResultCallback.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/TransactionResultCallback.java
@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.test.persistence;
import org.wamblee.test.transactions.TransactionResult;
@@ -24,8 +24,10 @@ import org.wamblee.test.transactions.TransactionResult;
*/
public interface TransactionResultCallback {
/**
- * Result notification.
- * @param aResult Transaction result.
+ * Result notification.
+ *
+ * @param aResult
+ * Transaction result.
*/
void status(TransactionResult aResult);
}
\ No newline at end of file
diff --git a/test/enterprise/src/main/java/org/wamblee/test/persistence/package-info.java b/test/enterprise/src/main/java/org/wamblee/test/persistence/package-info.java
index 54316666..7c7a4c4d 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/persistence/package-info.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/persistence/package-info.java
@@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
/**
*
* This package provides test library for database testing in general and JPA testing
@@ -265,4 +265,3 @@
*/
package org.wamblee.test.persistence;
-
diff --git a/test/enterprise/src/main/java/org/wamblee/test/transactions/DefaultUserTransactionFactory.java b/test/enterprise/src/main/java/org/wamblee/test/transactions/DefaultUserTransactionFactory.java
index 9d58546d..1fd0343f 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/transactions/DefaultUserTransactionFactory.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/transactions/DefaultUserTransactionFactory.java
@@ -20,24 +20,26 @@ import java.util.List;
import javax.transaction.UserTransaction;
/**
- * Transaction factory implementation that creates {@link SimpleUserTransaction} objects.
+ * Transaction factory implementation that creates {@link SimpleUserTransaction}
+ * objects.
*
* @author Erik Brakkee
- *
+ *
*/
public class DefaultUserTransactionFactory implements UserTransactionFactory {
/**
- * Constructs the factory.
+ * Constructs the factory.
*/
- public DefaultUserTransactionFactory() {
- // Empty.
+ public DefaultUserTransactionFactory() {
+ // Empty.
}
-
+
@Override
public UserTransaction create(UserTransactionCallback aCallback,
List aResources) {
- return new SimpleUserTransaction(aCallback, aResources.toArray(new TransactionResource[0]));
+ return new SimpleUserTransaction(aCallback, aResources
+ .toArray(new TransactionResource[0]));
}
}
diff --git a/test/enterprise/src/main/java/org/wamblee/test/transactions/SimpleTransactionManager.java b/test/enterprise/src/main/java/org/wamblee/test/transactions/SimpleTransactionManager.java
index a3d57102..7cb51431 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/transactions/SimpleTransactionManager.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/transactions/SimpleTransactionManager.java
@@ -86,7 +86,7 @@ public class SimpleTransactionManager {
transactionFInishedCallback = new UserTransactionCallback() {
@Override
public void transactionFinished() {
- transaction.set(factory.create(this, resources));
+ transaction.set(factory.create(this, resources));
}
};
transaction = new ThreadSpecificProxyFactory(
@@ -120,7 +120,7 @@ public class SimpleTransactionManager {
public UserTransaction getTransaction() {
return transaction.getProxy();
}
-
+
/**
* Gets the thread-specific transaction object.
*
diff --git a/test/enterprise/src/main/java/org/wamblee/test/transactions/SimpleUserTransaction.java b/test/enterprise/src/main/java/org/wamblee/test/transactions/SimpleUserTransaction.java
index ffa8925a..99f7a6f9 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/transactions/SimpleUserTransaction.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/transactions/SimpleUserTransaction.java
@@ -64,8 +64,9 @@ public class SimpleUserTransaction implements UserTransaction {
@Override
public void rollback() throws IllegalStateException, SecurityException,
SystemException {
- if ( status == Status.STATUS_NO_TRANSACTION) {
- throw new IllegalStateException("Rollback while not in a transaction");
+ if (status == Status.STATUS_NO_TRANSACTION) {
+ throw new IllegalStateException(
+ "Rollback while not in a transaction");
}
try {
for (int i = 0; i < resources.length; i++) {
@@ -98,11 +99,11 @@ public class SimpleUserTransaction implements UserTransaction {
resources[i].rollback(txStates[i]);
}
} catch (Exception e) {
- committing = false;
+ committing = false;
}
}
-
- if (!committing) {
+
+ if (!committing) {
throw new HeuristicMixedException("Commit failed");
}
} finally {
@@ -118,8 +119,9 @@ public class SimpleUserTransaction implements UserTransaction {
@Override
public void setRollbackOnly() throws IllegalStateException, SystemException {
- if ( status == Status.STATUS_NO_TRANSACTION) {
- throw new IllegalStateException("setRollbackOnly() while not in a transaction");
+ if (status == Status.STATUS_NO_TRANSACTION) {
+ throw new IllegalStateException(
+ "setRollbackOnly() while not in a transaction");
}
status = Status.STATUS_MARKED_ROLLBACK;
}
diff --git a/test/enterprise/src/main/java/org/wamblee/test/transactions/TransactionProxyFactory.java b/test/enterprise/src/main/java/org/wamblee/test/transactions/TransactionProxyFactory.java
index d6d47992..67f64bee 100644
--- a/test/enterprise/src/main/java/org/wamblee/test/transactions/TransactionProxyFactory.java
+++ b/test/enterprise/src/main/java/org/wamblee/test/transactions/TransactionProxyFactory.java
@@ -15,7 +15,6 @@
*/
package org.wamblee.test.transactions;
-
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -31,24 +30,27 @@ import org.wamblee.test.persistence.JpaBuilder.JpaUnitOfWork;
/**
* This utility makes sure that each invocation on a certain interface is
- * carried out within a JPA unit of work. Note that this is equivalent
- * to the sementics of a requiresNew transaction attribute.
+ * carried out within a JPA unit of work. Note that this is equivalent to the
+ * sementics of a requiresNew transaction attribute.
*
* Use {@link #getTransactionScopedEntityManager()} to get the transaction
* scoped entity manager to pass to services.
*
*
- * For example:
+ * For example:
+ *
*
* JpaBuilder builder = ...
* TransactionProxyFactory factory = new TransactionProxyFactory(
* builder, Service.class);
* Service service = new JpaService(factory.getTransactionScopedEntityManager());
* Service proxy = factory.getProxy(service);
- * proxy.executeMethod(...);
+ * proxy.executeMethod(...);
*
- * The above example executes the executeMethod() call on the service object within an active transaction.
- * In the constructor of the service a transaction scoped entity manager is passed.
+ *
+ * The above example executes the executeMethod() call on the service object
+ * within an active transaction. In the constructor of the service a transaction
+ * scoped entity manager is passed.
*
* @param T
* Type of interface to proxy.
@@ -58,11 +60,12 @@ import org.wamblee.test.persistence.JpaBuilder.JpaUnitOfWork;
public class TransactionProxyFactory {
/**
- * Executes the call on the service within a new transaction.
+ * Executes the call on the service within a new transaction.
*
* @author Erik Brakkee
- *
- * @param Type of the service interface.
+ *
+ * @param
+ * Type of the service interface.
*/
private class UnitOfWorkInvocationHandler implements InvocationHandler {
@@ -75,11 +78,11 @@ public class TransactionProxyFactory {
@Override
public Object invoke(Object aProxy, final Method aMethod,
final Object[] aArgs) throws Throwable {
- return TransactionProxyFactory.this.jpaBuilder
- .execute(new JpaUnitOfWork