[jbpm-commits] JBoss JBPM SVN: r2737 - in jbpm4/trunk/modules: pvm/src/test/java/org/jbpm/pvm/api/db/continuation and 9 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Sat Nov 1 07:13:54 EDT 2008
Author: tom.baeyens at jboss.com
Date: 2008-11-01 07:13:54 -0400 (Sat, 01 Nov 2008)
New Revision: 2737
Added:
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/OldDbTestCase.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/BasicExecutionFlowDbTest.java
jbpm4/trunk/modules/test-db/src/test/resources/
jbpm4/trunk/modules/test-db/src/test/resources/hibernate.properties
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/test-db/src/test/resources/logging.properties
Removed:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/basicfeatures/BasicExecutionFlowDbTest.java
Modified:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/basicfeatures/AutomaticDecisionDbTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ManagementServiceTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ProcessServiceTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/tx/BasicTransactionTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorIsolationDbTest.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java
jbpm4/trunk/modules/test-db/.classpath
jbpm4/trunk/modules/test-db/pom.xml
Log:
unification api proposals
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/basicfeatures/AutomaticDecisionDbTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/basicfeatures/AutomaticDecisionDbTest.java 2008-11-01 10:45:21 UTC (rev 2736)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/basicfeatures/AutomaticDecisionDbTest.java 2008-11-01 11:13:54 UTC (rev 2737)
@@ -23,14 +23,14 @@
import org.jbpm.pvm.activity.ExternalActivity;
import org.jbpm.pvm.client.ClientProcessDefinition;
import org.jbpm.pvm.model.ProcessFactory;
-import org.jbpm.test.DbTestCase;
+import org.jbpm.test.OldDbTestCase;
/**
* @author Tom Baeyens
* @author Guillaume Porcher
*/
-public class AutomaticDecisionDbTest extends DbTestCase {
+public class AutomaticDecisionDbTest extends OldDbTestCase {
public static class AutomaticCreditRating implements Activity {
private static final long serialVersionUID = 1L;
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/basicfeatures/BasicExecutionFlowDbTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/basicfeatures/BasicExecutionFlowDbTest.java 2008-11-01 10:45:21 UTC (rev 2736)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/basicfeatures/BasicExecutionFlowDbTest.java 2008-11-01 11:13:54 UTC (rev 2737)
@@ -1,137 +0,0 @@
-/**
- * Copyright (C) 2007 Bull S. A. S.
- * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
- * This library is free software; you can redistribute it and/or modify it under the terms
- * of the GNU Lesser General Public License as published by the Free Software Foundation
- * version 2.1 of the License.
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License along with this
- * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
- * Floor, Boston, MA 02110-1301, USA.
- **/
-package org.jbpm.pvm.api.db.basicfeatures;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.jbpm.Execution;
-import org.jbpm.pvm.DeploymentImpl;
-import org.jbpm.pvm.activity.Activity;
-import org.jbpm.pvm.activity.ActivityExecution;
-import org.jbpm.pvm.activity.ExternalActivity;
-import org.jbpm.pvm.client.ClientProcessDefinition;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.model.ProcessFactory;
-import org.jbpm.test.DbTestCase;
-
-
-/**
- * @author Guillaume Porcher
- *
- */
-public class BasicExecutionFlowDbTest extends DbTestCase {
-
- // automatic activity will log an event in a given list
- public static List<String> recordedEvents;
-
- public static class AutomaticActivity implements Activity {
- private static final long serialVersionUID = 1L;
-
- public void execute(ActivityExecution execution) {
- recordedEvents.add("execute["+execution.getNodeName()+"]");
- }
- }
-
- public static class WaitState implements ExternalActivity {
- private static final long serialVersionUID = 1L;
-
- public void execute(ActivityExecution execution) {
- recordedEvents.add("execute["+execution.getNodeName()+"]");
- execution.waitForSignal();
- }
- public void signal(ActivityExecution execution, String signalName, Map<String, Object> parameters) throws Exception {
- recordedEvents.add("signal["+execution.getNodeName()+"]");
- execution.take(signalName);
- }
- }
-
- public void testChainOfAutomaticActivitiesAndWaitStates() {
- recordedEvents = new ArrayList<String>();
-
- ClientProcessDefinition processDefinition = ProcessFactory.build("myProcess")
- .node("a").initial().behaviour(new ObjectDescriptor(AutomaticActivity.class))
- .transition().to("b")
- .node("b").behaviour(AutomaticActivity.class)
- .transition().to("c")
- .node("c").behaviour(WaitState.class)
- .transition().to("d")
- .node("d").behaviour(WaitState.class)
- .transition().to("e")
- .node("e").behaviour(AutomaticActivity.class)
- .transition().to("f")
- .node("f").behaviour(AutomaticActivity.class)
- .done();
-
- DeploymentImpl deploymentImpl = new DeploymentImpl(processDefinition);
- processService.deploy(deploymentImpl);
-
- Execution processInstance = executionService.startExecution("myProcess:1", "one");
-
- List<String> expectedEvents = new ArrayList<String>();
-
- expectedEvents.add("execute[a]");
- expectedEvents.add("execute[b]");
- expectedEvents.add("execute[c]");
-
- assertEquals("c", processInstance.getNodeName());
- assertFalse(processInstance.isEnded());
- assertEquals(expectedEvents, recordedEvents);
-
- processInstance = executionService.signalExecution(processInstance.getId());
-
- expectedEvents.add("signal[c]");
- expectedEvents.add("execute[d]");
-
- assertEquals("d", processInstance.getNodeName());
- assertFalse(processInstance.isEnded());
- assertEquals(expectedEvents, recordedEvents);
-
- processInstance = executionService.signalExecution(processInstance.getId());
-
- expectedEvents.add("signal[d]");
- expectedEvents.add("execute[e]");
- expectedEvents.add("execute[f]");
-
- assertEquals("f", processInstance.getNodeName());
- assertTrue(processInstance.isEnded());
- assertEquals(expectedEvents, recordedEvents);
- }
-/*
- public void testDelayedBegin() {
- recordedEvents = new ArrayList<String>();
-
- ClientProcessDefinition processDefinition = ProcessFactory.build("delayedBegin")
- .node("a").initial().behaviour(WaitState.class)
- .done();
-
- processService.deploy(processDefinition);
-
- Execution processInstance = executionService.startExecution(processDefinition.getDbid());
-
- // here, inbetween create and begin of a process instance, the variables can be initialized
- // or subprocessinstance-superprocessinstance relation can be set up
-
- // so we verify that the process execution didn't start yet
- List<String> expectedEvents = new ArrayList<String>();
- assertEquals(expectedEvents, recordedEvents);
-
- processInstance.begin();
-
- expectedEvents.add("execute[a]");
- assertEquals(expectedEvents, recordedEvents);
- }
-*/
-}
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTest.java 2008-11-01 10:45:21 UTC (rev 2736)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/continuation/ContinuationTest.java 2008-11-01 11:13:54 UTC (rev 2737)
@@ -43,13 +43,13 @@
import org.jbpm.pvm.model.ProcessFactory;
import org.jbpm.pvm.session.DbSession;
import org.jbpm.pvm.session.PvmDbSession;
-import org.jbpm.test.DbTestCase;
+import org.jbpm.test.OldDbTestCase;
import org.jbpm.test.EnvironmentFactoryTestSetup;
/**
* @author Tom Baeyens
*/
-public class ContinuationTest extends DbTestCase
+public class ContinuationTest extends OldDbTestCase
{
private static final Log log = Log.getLog(ContinuationTest.class.getName());
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java 2008-11-01 10:45:21 UTC (rev 2736)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ExecutionServiceTest.java 2008-11-01 11:13:54 UTC (rev 2737)
@@ -35,13 +35,13 @@
import org.jbpm.pvm.DeploymentImpl;
import org.jbpm.pvm.client.ClientProcessDefinition;
import org.jbpm.pvm.model.ProcessFactory;
-import org.jbpm.test.DbTestCase;
+import org.jbpm.test.OldDbTestCase;
import org.jbpm.test.EnvironmentFactoryTestSetup;
/**
* @author Tom Baeyens
*/
-public class ExecutionServiceTest extends DbTestCase
+public class ExecutionServiceTest extends OldDbTestCase
{
public static Test suite()
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ManagementServiceTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ManagementServiceTest.java 2008-11-01 10:45:21 UTC (rev 2736)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ManagementServiceTest.java 2008-11-01 11:13:54 UTC (rev 2737)
@@ -24,13 +24,13 @@
import junit.framework.Test;
import org.jbpm.ManagementService;
-import org.jbpm.test.DbTestCase;
+import org.jbpm.test.OldDbTestCase;
import org.jbpm.test.EnvironmentFactoryTestSetup;
/**
* @author Tom Baeyens
*/
-public class ManagementServiceTest extends DbTestCase
+public class ManagementServiceTest extends OldDbTestCase
{
public static Test suite()
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ProcessServiceTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ProcessServiceTest.java 2008-11-01 10:45:21 UTC (rev 2736)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/svc/ProcessServiceTest.java 2008-11-01 11:13:54 UTC (rev 2737)
@@ -31,13 +31,13 @@
import org.jbpm.PvmException;
import org.jbpm.pvm.DeploymentImpl;
import org.jbpm.pvm.model.ProcessFactory;
-import org.jbpm.test.DbTestCase;
+import org.jbpm.test.OldDbTestCase;
import org.jbpm.test.EnvironmentFactoryTestSetup;
/**
* @author Tom Baeyens
*/
-public class ProcessServiceTest extends DbTestCase
+public class ProcessServiceTest extends OldDbTestCase
{
public static Test suite()
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/tx/BasicTransactionTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/tx/BasicTransactionTest.java 2008-11-01 10:45:21 UTC (rev 2736)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/tx/BasicTransactionTest.java 2008-11-01 11:13:54 UTC (rev 2737)
@@ -34,13 +34,13 @@
import org.jbpm.pvm.env.Transaction;
import org.jbpm.pvm.internal.model.CommentImpl;
import org.jbpm.pvm.internal.type.variable.StringVariable;
-import org.jbpm.test.DbTestCase;
+import org.jbpm.test.OldDbTestCase;
import org.jbpm.test.EnvironmentFactoryTestSetup;
/**
* @author Tom Baeyens
*/
-public class BasicTransactionTest extends DbTestCase
+public class BasicTransactionTest extends OldDbTestCase
{
public static Test suite()
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorIsolationDbTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorIsolationDbTest.java 2008-11-01 10:45:21 UTC (rev 2736)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorIsolationDbTest.java 2008-11-01 11:13:54 UTC (rev 2737)
@@ -24,7 +24,7 @@
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
import org.jbpm.pvm.session.MessageSession;
import org.jbpm.pvm.session.PvmDbSession;
-import org.jbpm.test.DbTestCase;
+import org.jbpm.test.OldDbTestCase;
/**
@@ -33,7 +33,7 @@
* @author Guillaume Porcher
*
*/
-public class JobExecutorIsolationDbTest extends DbTestCase {
+public class JobExecutorIsolationDbTest extends OldDbTestCase {
static int jobExecutorTimeoutMillis = 500;
static int checkInterval = 400;
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java 2008-11-01 10:45:21 UTC (rev 2736)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java 2008-11-01 11:13:54 UTC (rev 2737)
@@ -50,14 +50,14 @@
import org.jbpm.pvm.model.ProcessFactory;
import org.jbpm.pvm.session.MessageSession;
import org.jbpm.pvm.session.PvmDbSession;
-import org.jbpm.test.DbTestCase;
+import org.jbpm.test.OldDbTestCase;
import org.jbpm.test.EnvironmentFactoryTestSetup;
/**
* @author Tom Baeyens
* @author Guillaume Porcher
*/
-public class JobExecutorTest extends DbTestCase {
+public class JobExecutorTest extends OldDbTestCase {
private static final Log log = Log.getLog(JobExecutorTest.class.getName());
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java 2008-11-01 10:45:21 UTC (rev 2736)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java 2008-11-01 11:13:54 UTC (rev 2737)
@@ -33,6 +33,7 @@
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.mapping.ForeignKey;
import org.hibernate.mapping.Table;
+import org.jbpm.ProcessEngine;
import org.jbpm.pvm.env.EnvironmentFactory;
@@ -43,6 +44,10 @@
private static final String CLEAN_SQL_KEY = "cleanSql";
+ public static void clean(ProcessEngine processEngine) {
+ clean((EnvironmentFactory) processEngine);
+ }
+
public static void clean(EnvironmentFactory environmentFactory) {
SessionFactory sessionFactory = environmentFactory.get(SessionFactory.class);
String[] cleanSql = (String[]) environmentFactory.get(CLEAN_SQL_KEY);
@@ -116,5 +121,4 @@
session.close();
}
}
-
}
Copied: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/OldDbTestCase.java (from rev 2734, jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java)
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/OldDbTestCase.java (rev 0)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/OldDbTestCase.java 2008-11-01 11:13:54 UTC (rev 2737)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.test;
+
+import org.jbpm.ExecutionService;
+import org.jbpm.ManagementService;
+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 OldDbTestCase extends EnvironmentFactoryTestCase {
+
+ protected CommandService commandService;
+ protected ProcessService processService;
+ protected ExecutionService executionService;
+ protected ManagementService managementService;
+
+ public OldDbTestCase() {
+ super();
+ }
+
+ public OldDbTestCase(String configResource) {
+ super(configResource);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ if (isEnvironmentFactoryCached()) {
+ Db.clean(getEnvironmentFactory());
+ }
+
+ 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;
+ super.tearDown();
+ }
+}
Modified: jbpm4/trunk/modules/test-db/.classpath
===================================================================
--- jbpm4/trunk/modules/test-db/.classpath 2008-11-01 10:45:21 UTC (rev 2736)
+++ jbpm4/trunk/modules/test-db/.classpath 2008-11-01 11:13:54 UTC (rev 2737)
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/test-classes"/>
Modified: jbpm4/trunk/modules/test-db/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-db/pom.xml 2008-11-01 10:45:21 UTC (rev 2736)
+++ jbpm4/trunk/modules/test-db/pom.xml 2008-11-01 11:13:54 UTC (rev 2737)
@@ -32,18 +32,20 @@
<artifactId>jbpm-api</artifactId>
<version>${version}</version>
</dependency>
+
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-test-base</artifactId>
+ <version>${version}</version>
</dependency>
+
+ <!-- TODO remove PVM dependency for compilation (keep it for test)-->
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-pvm</artifactId>
+ <version>${version}</version>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
+
</dependencies>
<!-- Plugins -->
@@ -52,50 +54,4 @@
</plugins>
</build>
- <!-- Profiles -->
- <profiles>
-
- <!--
- Name: no-impl
- Descr: The default implementation profile
- -->
- <profile>
- <id>no-impl</id>
- <activation>
- <property>
- <name>!impl</name>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-pvm</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
- </profile>
-
- <!--
- Name: impl-ri
- Descr: The RI implementation profile
- -->
- <profile>
- <id>impl-ri</id>
- <activation>
- <property>
- <name>impl</name>
- <value>ri</value>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.jbpm.spec</groupId>
- <artifactId>jbpm-spec-ri</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
- </profile>
-
- </profiles>
-
</project>
\ No newline at end of file
Copied: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/BasicExecutionFlowDbTest.java (from rev 2734, jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/api/db/basicfeatures/BasicExecutionFlowDbTest.java)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/BasicExecutionFlowDbTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/BasicExecutionFlowDbTest.java 2008-11-01 11:13:54 UTC (rev 2737)
@@ -0,0 +1,112 @@
+/**
+ * Copyright (C) 2007 Bull S. A. S.
+ * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
+ * This library is free software; you can redistribute it and/or modify it under the terms
+ * of the GNU Lesser General Public License as published by the Free Software Foundation
+ * version 2.1 of the License.
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License along with this
+ * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA 02110-1301, USA.
+ **/
+package org.jbpm.test.basicfeatures;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.Execution;
+import org.jbpm.pvm.DeploymentImpl;
+import org.jbpm.pvm.activity.Activity;
+import org.jbpm.pvm.activity.ActivityExecution;
+import org.jbpm.pvm.activity.ExternalActivity;
+import org.jbpm.pvm.client.ClientProcessDefinition;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.model.ProcessFactory;
+import org.jbpm.test.DbTestCase;
+
+
+/**
+ * @author Guillaume Porcher
+ *
+ */
+public class BasicExecutionFlowDbTest extends DbTestCase {
+
+ // automatic activity will log an event in a given list
+ public static List<String> recordedEvents;
+
+ public static class AutomaticActivity implements Activity {
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ recordedEvents.add("execute["+execution.getNodeName()+"]");
+ }
+ }
+
+ public static class WaitState implements ExternalActivity {
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ recordedEvents.add("execute["+execution.getNodeName()+"]");
+ execution.waitForSignal();
+ }
+ public void signal(ActivityExecution execution, String signalName, Map<String, Object> parameters) throws Exception {
+ recordedEvents.add("signal["+execution.getNodeName()+"]");
+ execution.take(signalName);
+ }
+ }
+
+ public void testChainOfAutomaticActivitiesAndWaitStates() {
+ recordedEvents = new ArrayList<String>();
+
+ ClientProcessDefinition processDefinition = ProcessFactory.build("myProcess")
+ .node("a").initial().behaviour(new ObjectDescriptor(AutomaticActivity.class))
+ .transition().to("b")
+ .node("b").behaviour(AutomaticActivity.class)
+ .transition().to("c")
+ .node("c").behaviour(WaitState.class)
+ .transition().to("d")
+ .node("d").behaviour(WaitState.class)
+ .transition().to("e")
+ .node("e").behaviour(AutomaticActivity.class)
+ .transition().to("f")
+ .node("f").behaviour(AutomaticActivity.class)
+ .done();
+
+ DeploymentImpl deploymentImpl = new DeploymentImpl(processDefinition);
+ processService.deploy(deploymentImpl);
+
+ Execution processInstance = executionService.startExecution("myProcess:1", "one");
+
+ List<String> expectedEvents = new ArrayList<String>();
+
+ expectedEvents.add("execute[a]");
+ expectedEvents.add("execute[b]");
+ expectedEvents.add("execute[c]");
+
+ assertEquals("c", processInstance.getNodeName());
+ assertFalse(processInstance.isEnded());
+ assertEquals(expectedEvents, recordedEvents);
+
+ processInstance = executionService.signalExecution(processInstance.getId());
+
+ expectedEvents.add("signal[c]");
+ expectedEvents.add("execute[d]");
+
+ assertEquals("d", processInstance.getNodeName());
+ assertFalse(processInstance.isEnded());
+ assertEquals(expectedEvents, recordedEvents);
+
+ processInstance = executionService.signalExecution(processInstance.getId());
+
+ expectedEvents.add("signal[d]");
+ expectedEvents.add("execute[e]");
+ expectedEvents.add("execute[f]");
+
+ assertEquals("f", processInstance.getNodeName());
+ assertTrue(processInstance.isEnded());
+ assertEquals(expectedEvents, recordedEvents);
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/basicfeatures/BasicExecutionFlowDbTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:mergeinfo
+
Added: jbpm4/trunk/modules/test-db/src/test/resources/hibernate.properties
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/hibernate.properties (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/hibernate.properties 2008-11-01 11:13:54 UTC (rev 2737)
@@ -0,0 +1,11 @@
+hibernate.dialect org.hibernate.dialect.HSQLDialect
+hibernate.connection.driver_class org.hsqldb.jdbcDriver
+hibernate.connection.url jdbc:hsqldb:mem:.
+hibernate.connection.username sa
+hibernate.connection.password
+hibernate.hbm2ddl.auto create-drop
+hibernate.cache.use_second_level_cache true
+hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
+# hibernate.show_sql true
+hibernate.format_sql true
+hibernate.use_sql_comments true
Added: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml 2008-11-01 11:13:54 UTC (rev 2737)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<contexts xmlns="http://jbpm.org/pvm/1.0/wire">
+
+ <environment-factory>
+
+ <deployer-manager>
+ <language name="api">
+ <check-version />
+ <create-id />
+ <save-process />
+ </language>
+ </deployer-manager>
+
+ <process-service />
+ <execution-service />
+ <management-service />
+
+ <command-service>
+ <retry-interceptor />
+ <environment-interceptor />
+ <standard-transaction-interceptor />
+ </command-service>
+
+ <hibernate-configuration>
+ <properties resource="hibernate.properties" />
+ <mappings resource="org/jbpm/pvm/pvm.hibernate.mappings.xml" />
+ <cache-configuration resource="org/jbpm/pvm/pvm.cache.xml"
+ usage="nonstrict-read-write" />
+ </hibernate-configuration>
+
+ <hibernate-session-factory />
+
+ <job-executor auto-start="false" />
+ <job-test-helper />
+
+ <id-generator />
+ <variable-types resource="org/jbpm/pvm/pvm.types.xml" />
+
+ <business-calendar>
+ <monday hours="9:00-12:00 and 12:30-17:00"/>
+ <tuesday hours="9:00-12:00 and 12:30-17:00"/>
+ <wednesday hours="9:00-12:00 and 12:30-17:00"/>
+ <thursday hours="9:00-12:00 and 12:30-17:00"/>
+ <friday hours="9:00-12:00 and 12:30-17:00"/>
+ <holiday period="01/07/2008 - 31/08/2008"/>
+ </business-calendar>
+
+ </environment-factory>
+
+ <environment>
+ <hibernate-session />
+ <transaction />
+ <pvm-db-session />
+ <job-db-session />
+ <message-session />
+ <timer-session />
+ </environment>
+
+</contexts>
Property changes on: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/test-db/src/test/resources/logging.properties
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/logging.properties (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/logging.properties 2008-11-01 11:13:54 UTC (rev 2737)
@@ -0,0 +1,28 @@
+handlers= java.util.logging.ConsoleHandler
+# to add the error triggered file handler
+# handlers= java.util.logging.ConsoleHandler org.jbpm.util.ErrorTriggeredFileHandler
+
+redirect.commons.logging = enabled
+
+java.util.logging.ConsoleHandler.level = FINEST
+java.util.logging.ConsoleHandler.formatter = org.jbpm.log.LogFormatter
+
+# org.jbpm.util.ErrorTriggeredFileHandler.size = 500
+# org.jbpm.util.ErrorTriggeredFileHandler.push = OFF
+# org.jbpm.util.ErrorTriggeredFileHandler.pattern = %h/jbpm%u.log
+
+# For example, set the com.xyz.foo logger to only log SEVERE messages:
+# com.xyz.foo.level = SEVERE
+
+org.jbpm.level=FINEST
+org.jbpm.pvm.internal.tx.level=FINE
+org.jbpm.pvm.internal.wire.level=FINE
+org.jbpm.pvm.internal.util.level=FINE
+
+org.hibernate.cfg.HbmBinder.level=SEVERE
+org.hibernate.cfg.SettingsFactory.level=SEVERE
+# org.hibernate.level=FINE
+org.hibernate.SQL.level=FINEST
+# org.hibernate.type.level=FINEST
+# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
+# org.hibernate.transaction.level=FINEST
More information about the jbpm-commits
mailing list