Ability to run BPELTestAbstract without hibernate on the classpath
------------------------------------------------------------------
Key: ODE-427
URL: https://issues.apache.org/jira/browse/ODE-427
Project: ODE
Issue Type: Improvement
Components: Test environment
Affects Versions: 1.1
Reporter: Hugues Malphettes
Priority: Minor
BPELTestAbstract creates a ProcessStoreImpl based on OpenJPA.
I am trying to package the test-environment in a lightweight application
without hibernate on the classpath.
In order to succeed I had to apply this patch.
I took the opportunity to remove the field _guid that was not used.
The behavior is identical except that it can execute without hibernate on the
classpath.
ndex: bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
===================================================================
--- bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
(revision 713207)
+++ bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
(working copy)
@@ -86,9 +86,6 @@
/** Guards access to the _processes and _deploymentUnits */
private final ReadWriteLock _rw = new ReentrantReadWriteLock();
- /** GUID used to create a unique in-memory db. */
- private String _guid = new GUID().toString();
-
private ConfStoreConnectionFactory _cf;
private EndpointReferenceContext eprContext;
@@ -125,7 +122,7 @@
} else {
// If the datasource is not provided, then we create a
HSQL-based in-memory
// database. Makes testing a bit simpler.
- DataSource hsqlds = createInternalDS(_guid);
+ DataSource hsqlds = createInternalDS(new GUID().toString());
if ("hibernate".equalsIgnoreCase(persistenceType))
_cf = new
org.apache.ode.store.hib.DbConfStoreConnectionFactory(hsqlds,
props.getProperties(), createDatamodel);
else
@@ -134,7 +131,21 @@
}
}
+ /**
+ * @return a ProcessStoreImpl suitable for tests. It relies on a new
in-memory hsqldb database.
+ */
+ public static ProcessStoreImpl
createHsqlDbInMemJPAStore(EndpointReferenceContext eprContext,
+ OdeConfigProperties props) {
+ DataSource hsqlds = createInternalDS(new GUID().toString());
+ //when in memory we always create the model as we are starting
from scratch
+ ConfStoreConnectionFactory cf = new
org.apache.ode.store.jpa.DbConfStoreConnectionFactory(hsqlds, true);
+ return new ProcessStoreImpl(eprContext, cf, hsqlds);
+ }
+ private ProcessStoreImpl(EndpointReferenceContext eprContext,
ConfStoreConnectionFactory cf, DataSource inMemDs) {
+ this.eprContext = eprContext;
+ _cf = cf;
+ _inMemDs = inMemDs;
+ }
+
public void shutdown() {
if (_inMemDs != null) {
shutdownInternalDB(_inMemDs);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.