From: erik
Date: Mon, 5 Jul 2010 20:38:58 +0000 (+0000)
Subject: More javadoc.
X-Git-Tag: wamblee-utils-0.3~105
X-Git-Url: http://wamblee.org/gitweb/?a=commitdiff_plain;h=f468bbd8556fb91536de50fc8540ea5694cb5115;p=utils
More javadoc.
---
diff --git a/test/enterprise/src/main/java/org/wamblee/support/jndi/StubInitialContextFactory.java b/test/enterprise/src/main/java/org/wamblee/support/jndi/StubInitialContextFactory.java
index d65968a2..158bd6d8 100644
--- a/test/enterprise/src/main/java/org/wamblee/support/jndi/StubInitialContextFactory.java
+++ b/test/enterprise/src/main/java/org/wamblee/support/jndi/StubInitialContextFactory.java
@@ -27,11 +27,17 @@ import javax.naming.spi.InitialContextFactory;
*
* See {@link #bind(String, Object)} to resp. register the initial context.
*
- * To bind objects in the JNDI tree simply use the standard JNDI api:
+ * To start mocking the JNDI tree, call {@link #register()}.
+ *
+ * To bind objects in the JNDI tree simply use the standard JNDI api:
+ *
* InitialContext context = new InitialContext();
* MyClass myObj = ...;
* context.bind("a/b", myObj);
- *
+ *
+ *
+ * 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/support/persistence/DatabaseBuilder.java b/test/enterprise/src/main/java/org/wamblee/support/persistence/DatabaseBuilder.java
index 6f495698..ae7cd28a 100644
--- a/test/enterprise/src/main/java/org/wamblee/support/persistence/DatabaseBuilder.java
+++ b/test/enterprise/src/main/java/org/wamblee/support/persistence/DatabaseBuilder.java
@@ -60,7 +60,7 @@ public class DatabaseBuilder {
* Environmment variable by which capabilities of the requested database can
* be defined
*/
- private static final String DB_CAPABILITIES_PROP = "TEST_DB_CAPABILITIES";
+ public static final String DB_CAPABILITIES_PROP = "TEST_DB_CAPABILITIES";
private static ServiceLoader LOADER =
ServiceLoader.load(DatabaseProvider.class);
diff --git a/test/enterprise/src/main/java/org/wamblee/support/persistence/doc-files/Class_Diagram__org.wamblee.support.persistence__database.jpg b/test/enterprise/src/main/java/org/wamblee/support/persistence/doc-files/Class_Diagram__org.wamblee.support.persistence__database.jpg
new file mode 100644
index 00000000..f8e6cede
Binary files /dev/null and b/test/enterprise/src/main/java/org/wamblee/support/persistence/doc-files/Class_Diagram__org.wamblee.support.persistence__database.jpg differ
diff --git a/test/enterprise/src/main/java/org/wamblee/support/persistence/doc-files/Class_Diagram__org.wamblee.support.persistence__jpatester.jpg b/test/enterprise/src/main/java/org/wamblee/support/persistence/doc-files/Class_Diagram__org.wamblee.support.persistence__jpatester.jpg
new file mode 100644
index 00000000..965e92b4
Binary files /dev/null and b/test/enterprise/src/main/java/org/wamblee/support/persistence/doc-files/Class_Diagram__org.wamblee.support.persistence__jpatester.jpg differ
diff --git a/test/enterprise/src/main/java/org/wamblee/support/persistence/package-info.java b/test/enterprise/src/main/java/org/wamblee/support/persistence/package-info.java
index d38be579..1ea78e25 100644
--- a/test/enterprise/src/main/java/org/wamblee/support/persistence/package-info.java
+++ b/test/enterprise/src/main/java/org/wamblee/support/persistence/package-info.java
@@ -72,6 +72,12 @@
* This also requires a number of environment variables or system properties to be set,
* see {@link ExternalDatabase}.
*
+ *
+ * However, the most convenient way to set the capabilities is usually to set a system property or environment
+ * variable see the javadocs of {@link DatabaseBuilder}. and
+ * specifically {@link DatabaseBuilder#DB_CAPABILITIES_PROP}
+ *
+ *
*
*
* Executing code within a JDBC transaction
@@ -189,26 +195,50 @@
*
*
*
- * design overview
+ * Design overview
*
*
- * Database transaparency
- *
- * Testing using JDBC and DBUnit
+ * Database transparency
*
+ *
+ *
+ *
+ *
+ * {@link DatabaseProvider} uses java.util.ServiceLoader
to find all implementations
+ * of {@link DatabaseProvider} on the classpath. It then asks the database providers whether
+ * they support the required capabilities (by default inmemory), and the first provider that
+ * supports the capabilities is used to create the database.
+ *
+ *
+ * Note that the Database
interface is not intended to always create a database.
+ * It will do so for {@link DerbyDatabase} (inmemory), but with {@link ExternalDatabase}
+ * it simply connects to an external database based on system properties or environment
+ * variables.
+ *
+ *
* JPA tester overview
*
+ *
+ *
+ *
+ *
+ * JPATester
is responsible for:
+ *
+ * - Starting or connecting to a database, using {@link DatabaseBuilder}.
+ *
+ * - Registering the acquired datasource in JNDI by first stubbing JNDI
+ * using {@link org.wamblee.support.jndi.StubInitialContextFactory}.
+ *
+ * - Creating the {@link JPABuilder} that will do the JPA heavy lifting.
+ *
+ * - Creating the {@link DatabaseUtils} for JDBC and DBUnit testing.
+ *
+ *
*
*
*/
package org.wamblee.support.persistence;
-import static org.mockito.Mockito.*;
-
-import javax.persistence.EntityManager;
-
-import org.junit.Before;
-import org.wamblee.support.persistence.JpaBuilder.JpaUnitOfWork;
-import org.wamblee.support.persistence.TransactionProxyFactoryTestBase.Service;
-