[jbpm-commits] JBoss JBPM SVN: r2738 - jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test.
do-not-reply at jboss.org
do-not-reply at jboss.org
Sat Nov 1 07:15:28 EDT 2008
Author: tom.baeyens at jboss.com
Date: 2008-11-01 07:15:28 -0400 (Sat, 01 Nov 2008)
New Revision: 2738
Modified:
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java
Log:
unification api proposals
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java 2008-11-01 11:13:54 UTC (rev 2737)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java 2008-11-01 11:15:28 UTC (rev 2738)
@@ -21,51 +21,52 @@
*/
package org.jbpm.test;
+import org.jbpm.Configuration;
import org.jbpm.ExecutionService;
import org.jbpm.ManagementService;
+import org.jbpm.ProcessEngine;
import org.jbpm.ProcessService;
-import org.jbpm.cmd.CommandService;
-/** for tests that use persistence through a command service.
- *
- * The DB is cleaned inbetween tests. No environment is created.
- *
+/**
* @author Tom Baeyens
*/
-public abstract class DbTestCase extends EnvironmentFactoryTestCase {
+public class DbTestCase extends JbpmTestCase {
- protected CommandService commandService;
+ protected static ProcessEngine processEngine = null;
+
protected ProcessService processService;
protected ExecutionService executionService;
protected ManagementService managementService;
- public DbTestCase() {
- super();
- }
-
- public DbTestCase(String configResource) {
- super(configResource);
- }
-
public void setUp() throws Exception {
super.setUp();
- if (isEnvironmentFactoryCached()) {
- Db.clean(getEnvironmentFactory());
+ initializeProcessEngine();
+
+ processService = processEngine.getProcessService();
+ executionService = processEngine.getExecutionService();
+ managementService = processEngine.getManagementService();
+ }
+
+ protected synchronized void initializeProcessEngine() {
+ if (processEngine==null) {
+
+ String jbpmTestCfgType = System.getProperty("jbpm.test.cfg.type");
+ Configuration configuration = new Configuration(jbpmTestCfgType);
+
+ String jbpmTestCfgResource = System.getProperty("jbpm.test.cfg.resource");
+ if (jbpmTestCfgResource!=null) {
+ configuration.setResource(jbpmTestCfgResource);
+ }
+
+ processEngine = configuration.buildProcessEngine();
}
+ }
- commandService = getEnvironmentFactory().get(CommandService.class);
- processService = getEnvironmentFactory().get(ProcessService.class);
- executionService = getEnvironmentFactory().get(ExecutionService.class);
- managementService = getEnvironmentFactory().get(ManagementService.class);
- }
-
public void tearDown() throws Exception {
- commandService = null;
- processService = null;
- executionService = null;
- managementService = null;
+ Db.clean(processEngine);
+
super.tearDown();
}
}
More information about the jbpm-commits
mailing list