JBoss JBPM SVN: r5036 - jbpm4/branches.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-15 08:00:19 -0400 (Mon, 15 Jun 2009)
New Revision: 5036
Removed:
jbpm4/branches/tbaeyens/
Log:
deleting tbaeyens branch
16 years, 10 months
JBoss JBPM SVN: r5035 - in jbpm3/branches/jbpm-3.2-soa/modules/core: src/main/java/org/jbpm/db/hibernate and 1 other directory.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-06-12 14:46:50 -0400 (Fri, 12 Jun 2009)
New Revision: 5035
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/hibernate/TextType.java
Log:
JBPM-2094: Unindexed Foreign Keys cause deadlocks in oracle (REOPENED)
Exclude JBPM2094Test in Sybase profile - <exclude> configuration was wrong
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml 2009-06-12 14:47:43 UTC (rev 5034)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml 2009-06-12 18:46:50 UTC (rev 5035)
@@ -315,8 +315,10 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <!-- [JBPM-2094] Unindexed Foreign Keys cause deadlocks in oracle -->
- <excludes>org/jbpm/jbpm2094/JBPM2094Test.java</excludes>
+ <excludes>
+ <!-- [JBPM-2094] Unindexed Foreign Keys cause deadlocks in oracle -->
+ <exclude>org/jbpm/jbpm2094/JBPM2094Test.java</exclude>
+ </excludes>
</configuration>
</plugin>
</plugins>
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/hibernate/TextType.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/hibernate/TextType.java 2009-06-12 14:47:43 UTC (rev 5034)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/hibernate/TextType.java 2009-06-12 18:46:50 UTC (rev 5035)
@@ -39,140 +39,123 @@
import org.hibernate.util.StringHelper;
/**
+ * Replacement for {@link org.hibernate.type.TextType} made to work around a <em>feature</em> in the
+ * jConnect driver when setting a text parameter to <code>null</code>. Specifically, the call:
+ *
+ * <pre>
+ * PreparedStatement st;
+ * st.setNull(index, Types.CLOB);
+ * </pre>
+ *
+ * throws an SQLException with SQL state "JZ0SL" and reason "Unsupported SQL type".
+ *
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-1818">JBPM-1818</a>
* @author Alejandro Guizar
*/
-public class TextType implements EnhancedUserType, Serializable
-{
+public class TextType implements EnhancedUserType, Serializable {
private transient Log log;
- private static final boolean IS_VALUE_TRACING_ENABLED = LogFactory.getLog(StringHelper.qualifier(Type.class.getName())).isTraceEnabled();
+ private static final boolean IS_VALUE_TRACING_ENABLED = LogFactory.getLog(StringHelper.qualifier(Type.class.getName()))
+ .isTraceEnabled();
private static final long serialVersionUID = 1L;
- private Log log()
- {
- if (log == null)
- {
+ private Log log() {
+ if (log == null) {
log = LogFactory.getLog(getClass());
}
return log;
}
- public Object assemble(Serializable cached, Object owner) throws HibernateException
- {
- if (cached == null)
- {
+ public Object assemble(Serializable cached, Object owner) throws HibernateException {
+ if (cached == null) {
return null;
}
- else
- {
+ else {
return deepCopy(cached);
}
}
- public Object deepCopy(Object value) throws HibernateException
- {
+ public Object deepCopy(Object value) throws HibernateException {
return value;
}
- public Serializable disassemble(Object value) throws HibernateException
- {
- if (value == null)
- {
+ public Serializable disassemble(Object value) throws HibernateException {
+ if (value == null) {
return null;
}
- else
- {
- return (Serializable)deepCopy(value);
+ else {
+ return (Serializable) deepCopy(value);
}
}
- public boolean equals(Object x, Object y) throws HibernateException
- {
+ public boolean equals(Object x, Object y) throws HibernateException {
return EqualsHelper.equals(x, y);
}
- public int hashCode(Object x) throws HibernateException
- {
+ public int hashCode(Object x) throws HibernateException {
return x.hashCode();
}
- public boolean isMutable()
- {
+ public boolean isMutable() {
return false;
}
- public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException
- {
+ public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException,
+ SQLException {
return nullSafeGet(rs, names[0]);
}
- public Object nullSafeGet(ResultSet rs, String name) throws HibernateException, SQLException
- {
- try
- {
+ public Object nullSafeGet(ResultSet rs, String name) throws HibernateException, SQLException {
+ try {
Object value = get(rs, name);
- if (value == null)
- {
- if (IS_VALUE_TRACING_ENABLED)
- {
+ if (value == null) {
+ if (IS_VALUE_TRACING_ENABLED) {
log().trace("returning null as column: " + name);
}
return null;
}
- else
- {
- if (IS_VALUE_TRACING_ENABLED)
- {
+ else {
+ if (IS_VALUE_TRACING_ENABLED) {
log().trace("returning '" + toString(value) + "' as column: " + name);
}
return value;
}
}
- catch (RuntimeException re)
- {
+ catch (RuntimeException re) {
log().info("could not read column value from result set: " + name + "; " + re.getMessage());
throw re;
}
- catch (SQLException se)
- {
+ catch (SQLException se) {
log().info("could not read column value from result set: " + name + "; " + se.getMessage());
throw se;
}
}
- public Object get(ResultSet rs, String name) throws HibernateException, SQLException
- {
+ public Object get(ResultSet rs, String name) throws HibernateException, SQLException {
// retrieve the value of the designated column in the current row of the
// result set as a character reader
Reader charReader = rs.getCharacterStream(name);
// if the corresponding SQL value is NULL, the reader we got is NULL as well
- if (charReader == null || rs.wasNull())
- return null;
+ if (charReader == null || rs.wasNull()) return null;
// Fetch Reader content up to the end - and put characters in a StringBuffer
StringBuffer sbuf = new StringBuffer();
- try
- {
+ try {
char[] cbuf = new char[1024];
- for (int amountRead; (amountRead = charReader.read(cbuf)) != -1;)
- {
+ for (int amountRead; (amountRead = charReader.read(cbuf)) != -1;) {
sbuf.append(cbuf, 0, amountRead);
}
}
- catch (IOException ioe)
- {
+ catch (IOException ioe) {
throw new HibernateException("IOException occurred reading text", ioe);
}
- finally
- {
- try
- {
+ finally {
+ try {
charReader.close();
}
- catch (IOException e)
- {
+ catch (IOException e) {
throw new HibernateException("IOException occurred closing stream", e);
}
}
@@ -181,100 +164,92 @@
return sbuf.toString();
}
- public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException
- {
- try
- {
- if (value == null)
- {
- if (IS_VALUE_TRACING_ENABLED)
- {
+ public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException,
+ SQLException {
+ try {
+ if (value == null) {
+ if (IS_VALUE_TRACING_ENABLED) {
log().trace("binding null to parameter: " + index);
}
setNull(st, index);
}
- else
- {
- if (IS_VALUE_TRACING_ENABLED)
- {
+ else {
+ if (IS_VALUE_TRACING_ENABLED) {
log().trace("binding '" + toString(value) + "' to parameter: " + index);
}
set(st, value, index);
}
}
- catch (RuntimeException re)
- {
- log().info("could not bind value '" + nullSafeToString(value) + "' to parameter: " + index + "; " + re.getMessage());
+ catch (RuntimeException re) {
+ log().info("could not bind value '" +
+ nullSafeToString(value) +
+ "' to parameter: " +
+ index +
+ "; " +
+ re.getMessage());
throw re;
}
- catch (SQLException se)
- {
- log().info("could not bind value '" + nullSafeToString(value) + "' to parameter: " + index + "; " + se.getMessage());
+ catch (SQLException se) {
+ log().info("could not bind value '" +
+ nullSafeToString(value) +
+ "' to parameter: " +
+ index +
+ "; " +
+ se.getMessage());
throw se;
}
}
- public void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException
- {
- String str = (String)value;
+ public void set(PreparedStatement st, Object value, int index) throws HibernateException,
+ SQLException {
+ String str = (String) value;
st.setCharacterStream(index, new StringReader(str), str.length());
}
- public void setNull(PreparedStatement st, int index) throws HibernateException, SQLException
- {
+ public void setNull(PreparedStatement st, int index) throws HibernateException, SQLException {
// JBPM-1818: workaround for SQL state JZ0SL: "Unsupported SQL type" with jConnect
st.setCharacterStream(index, null, 0);
}
- public Object replace(Object original, Object target, Object owner) throws HibernateException
- {
+ public Object replace(Object original, Object target, Object owner) throws HibernateException {
return original;
}
- public Class returnedClass()
- {
+ public Class returnedClass() {
return String.class;
}
- public int[] sqlTypes()
- {
+ public int[] sqlTypes() {
return new int[] { sqlType() };
}
- public int sqlType()
- {
+ public int sqlType() {
return Types.CLOB;
}
- public String objectToSQLString(Object value)
- {
- return '\'' + (String)value + '\'';
+ public String objectToSQLString(Object value) {
+ return '\'' + (String) value + '\'';
}
- public Object fromXMLString(String xml)
- {
+ public Object fromXMLString(String xml) {
return xml == null || xml.length() == 0 ? null : fromStringValue(xml);
}
- public String toXMLString(Object value)
- {
+ public String toXMLString(Object value) {
return toString(value);
}
- public String nullSafeToString(Object value) throws HibernateException
- {
+ public String nullSafeToString(Object value) throws HibernateException {
return value == null ? null : toString(value);
}
- public String toString(Object val)
- {
- return (String)val;
+ public String toString(Object val) {
+ return (String) val;
}
- public Object fromStringValue(String xml)
- {
+ public Object fromStringValue(String xml) {
return xml;
}
}
16 years, 10 months
JBoss JBPM SVN: r5034 - jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-12 10:47:43 -0400 (Fri, 12 Jun 2009)
New Revision: 5034
Modified:
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
Log:
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-06-12 14:47:29 UTC (rev 5033)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-06-12 14:47:43 UTC (rev 5034)
@@ -107,7 +107,9 @@
}
String recordsLeftMsg = Db.verifyClean(processEngine);
- if (recordsLeftMsg.length()>0) {
+ if ( (recordsLeftMsg!=null)
+ && (recordsLeftMsg.length()>0)
+ ) {
String message = "database was not clean after test: "+recordsLeftMsg;
if (exception==null) {
throw new JbpmException(message);
16 years, 10 months
JBoss JBPM SVN: r5033 - jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-12 10:47:29 -0400 (Fri, 12 Jun 2009)
New Revision: 5033
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
Log:
JBPM-2212 did state comparison with equals
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-06-12 13:18:58 UTC (rev 5032)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-06-12 14:47:29 UTC (rev 5033)
@@ -188,7 +188,7 @@
// execution method : start /////////////////////////////////////////////////
public void start() {
- if (state!=STATE_CREATED) {
+ if (!STATE_CREATED.equals(state)) {
throw new JbpmException(toString()+" is already begun: "+state);
}
this.state = STATE_ACTIVE_ROOT;
@@ -934,10 +934,6 @@
}
}
- public void setState(String state) {
- this.state = state;
- }
-
protected void checkActive() {
if (!isActive()) {
throw new JbpmException(toString()+" is not active: "+state);
16 years, 10 months
JBoss JBPM SVN: r5032 - in jbpm4/trunk/modules: pvm/src/main/java/org/jbpm/pvm/internal/task and 1 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-12 09:18:58 -0400 (Fri, 12 Jun 2009)
New Revision: 5032
Added:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryProcessTest.java
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskQuery.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryTest.java
Log:
JBPM-2305 adding task query capabilities
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskQuery.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskQuery.java 2009-06-12 09:52:01 UTC (rev 5031)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskQuery.java 2009-06-12 13:18:58 UTC (rev 5032)
@@ -51,8 +51,21 @@
* to the task or the user could be a member of a group that is
* associated as a candidate group to the task. */
TaskQuery candidate(String userId);
+
+ /** only query for tasks that are associated to the given process instance */
+ TaskQuery processInstanceId(String processInstanceId);
+ /** only query for tasks that are associated to the given process definition */
+ TaskQuery processDefinitionId(String processDefinitionId);
+
+ /** only query for tasks that are associated to the given activity name. This
+ * can be used in combination with the {@link #processDefinitionId(String)} */
+ TaskQuery activityName(String activityName);
+
+ /** only query for suspended tasks */
TaskQuery suspended();
+
+ /** exclude suspended tasks */
TaskQuery notSuspended();
TaskQuery page(int firstResult, int maxResults);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java 2009-06-12 09:52:01 UTC (rev 5031)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java 2009-06-12 13:18:58 UTC (rev 5032)
@@ -50,6 +50,9 @@
protected String assignee = null;
protected String candidate = null;
protected Boolean suspended = null;
+ protected String processInstanceId = null;
+ protected String processDefinitionId = null;
+ protected String activityName = null;
/* groupIds transports the groupIds from the hql to the applyParameters */
protected List<String> groupIds;
@@ -68,6 +71,21 @@
return this;
}
+ public TaskQuery processInstanceId(String processInstanceId) {
+ this.processInstanceId = processInstanceId;
+ return this;
+ }
+
+ public TaskQuery processDefinitionId(String processDefinitionId) {
+ this.processDefinitionId = processDefinitionId;
+ return this;
+ }
+
+ public TaskQuery activityName(String activityName) {
+ this.activityName = activityName;
+ return this;
+ }
+
public TaskQuery unassigned() {
this.assignee = null;
this.unassigned = true;
@@ -154,9 +172,19 @@
appendWhereClause("task.state != '"+ExecutionImpl.STATE_SUSPENDED+"' ", hql);
}
}
+
+ if (processInstanceId!=null) {
+ appendWhereClause("task.processInstance.id = '"+processInstanceId+"' ", hql);
+ }
- appendWhereClause("task.state != '"+Task.STATE_SUSPENDED+"' ", hql);
+ if (activityName!=null) {
+ appendWhereClause("task.execution.activityName = '"+activityName+"' ", hql);
+ }
+ if (processDefinitionId!=null) {
+ appendWhereClause("task.processInstance.processDefinitionId = '"+processDefinitionId+"' ", hql);
+ }
+
if (assignee!=null) {
appendWhereClause("task.assignee = :assignee ", hql);
} else if (unassigned) {
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryProcessTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryProcessTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryProcessTest.java 2009-06-12 13:18:58 UTC (rev 5032)
@@ -0,0 +1,246 @@
+/*
+ * 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.task;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskQueryProcessTest extends JbpmTestCase {
+
+
+ public void testTaskQueryProcessInstanceId() {
+ deployJpdlXmlString(
+ "<process name='VacationTrip'>" +
+ " <start>" +
+ " <transition to='f' />" +
+ " </start>" +
+ " <fork name='f'>" +
+ " <transition to='select destination' />" +
+ " <transition to='work hard for the money' />" +
+ " </fork>" +
+ " <task name='select destination' " +
+ " assignee='johndoe'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <task name='work hard for the money' " +
+ " assignee='johndoe'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("destination", "Bruges");
+ executionService.startProcessInstanceByKey("VacationTrip", variables);
+
+ variables = new HashMap<String, Object>();
+ variables.put("destination", "Paris");
+ ProcessInstance parisProcessInstance = executionService.startProcessInstanceByKey("VacationTrip", variables);
+
+ variables = new HashMap<String, Object>();
+ variables.put("destination", "Malaga");
+ executionService.startProcessInstanceByKey("VacationTrip", variables);
+
+
+ deployJpdlXmlString(
+ "<process name='BusinessTrip'>" +
+ " <start>" +
+ " <transition to='try to get someone else to do it' />" +
+ " </start>" +
+ " <task name='try to get someone else to do it' " +
+ " assignee='johndoe'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ executionService.startProcessInstanceByKey("BusinessTrip");
+ executionService.startProcessInstanceByKey("BusinessTrip");
+
+
+ List<Task> parisTasks = taskService
+ .createTaskQuery()
+ .processInstanceId(parisProcessInstance.getId())
+ .list();
+
+ assertEquals("expected 2 elements, but was "+parisTasks.toString(), 2, parisTasks.size());
+
+ Set<String> expectedTaskNames = new HashSet<String>();
+ expectedTaskNames.add("select destination");
+ expectedTaskNames.add("work hard for the money");
+
+ Set<String> taskNames = new HashSet<String>();
+ for (Task task: parisTasks) {
+ taskNames.add(task.getName());
+ assertEquals("Paris", taskService.getVariable(task.getDbid(), "destination"));
+ }
+
+ assertEquals(expectedTaskNames, taskNames);
+ }
+
+ public void testTaskQueryProcessDefinitionId() {
+ deployJpdlXmlString(
+ "<process name='VacationTrip'>" +
+ " <start>" +
+ " <transition to='select destination' />" +
+ " </start>" +
+ " <task name='select destination' " +
+ " assignee='johndoe'>" +
+ " <transition to='work hard for the money' />" +
+ " </task>" +
+ " <task name='work hard for the money' " +
+ " assignee='johndoe'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ // we bring one process instance in task book travel
+ executionService.startProcessInstanceByKey("VacationTrip").getId();
+ taskService.completeTask(taskService.findPersonalTasks("johndoe").get(0).getDbid());
+
+ // and twto process instances in task select destination
+ executionService.startProcessInstanceByKey("VacationTrip");
+ executionService.startProcessInstanceByKey("VacationTrip");
+
+
+ deployJpdlXmlString(
+ "<process name='BusinessTrip'>" +
+ " <start>" +
+ " <transition to='find customer' />" +
+ " </start>" +
+ " <task name='find customer' " +
+ " assignee='johndoe'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ executionService.startProcessInstanceByKey("BusinessTrip");
+ executionService.startProcessInstanceByKey("BusinessTrip");
+
+ List<Task> tasks = taskService
+ .createTaskQuery()
+ .processDefinitionId("VacationTrip-1")
+ .list();
+
+ assertEquals("expected 3 elements, but was "+tasks.toString(), 3, tasks.size());
+
+ int selectDestinationTasks = 0;
+ int workHardForTheMoneyTasks = 0;
+
+ for (Task task: tasks) {
+ if (task.getName().equals("select destination")) {
+ selectDestinationTasks++;
+ }
+ if (task.getName().equals("work hard for the money")) {
+ workHardForTheMoneyTasks++;
+ }
+ }
+
+ assertEquals(2, selectDestinationTasks);
+ assertEquals(1, workHardForTheMoneyTasks);
+ }
+
+ public void testTaskQueryActivityName() {
+ deployJpdlXmlString(
+ "<process name='VacationTrip'>" +
+ " <start>" +
+ " <transition to='select destination' />" +
+ " </start>" +
+ " <task name='select destination' " +
+ " assignee='johndoe'>" +
+ " <transition to='work hard for the money' />" +
+ " </task>" +
+ " <task name='work hard for the money' " +
+ " assignee='johndoe'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ // we bring one process instance in task book travel
+ executionService.startProcessInstanceByKey("VacationTrip").getId();
+ taskService.completeTask(taskService.findPersonalTasks("johndoe").get(0).getDbid());
+
+ // and twto process instances in task select destination
+ executionService.startProcessInstanceByKey("VacationTrip");
+ executionService.startProcessInstanceByKey("VacationTrip");
+
+
+ deployJpdlXmlString(
+ "<process name='BusinessTrip'>" +
+ " <start>" +
+ " <transition to='find customer' />" +
+ " </start>" +
+ " <task name='find customer' " +
+ " assignee='johndoe'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ executionService.startProcessInstanceByKey("BusinessTrip");
+ executionService.startProcessInstanceByKey("BusinessTrip");
+
+ List<Task> tasks = taskService
+ .createTaskQuery()
+ .processDefinitionId("VacationTrip-1")
+ .activityName("select destination")
+ .list();
+
+ assertEquals("expected 2 elements, but was "+tasks.toString(), 2, tasks.size());
+
+ int selectDestinationTasks = 0;
+ int workHardForTheMoneyTasks = 0;
+
+ for (Task task: tasks) {
+ if (task.getName().equals("select destination")) {
+ selectDestinationTasks++;
+ }
+ if (task.getName().equals("work hard for the money")) {
+ workHardForTheMoneyTasks++;
+ }
+ }
+
+ assertEquals(2, selectDestinationTasks);
+ assertEquals(0, workHardForTheMoneyTasks);
+ }
+
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryProcessTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryTest.java 2009-06-12 09:52:01 UTC (rev 5031)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryTest.java 2009-06-12 13:18:58 UTC (rev 5032)
@@ -117,5 +117,4 @@
taskService.deleteTask(dyperTaskDbid);
taskService.deleteTask(laudryTaskDbid);
}
-
}
16 years, 10 months
JBoss JBPM SVN: r5031 - in jbpm4/trunk/modules/devguide/src/main/docbook/en: images and 1 other directories.
by do-not-reply@jboss.org
Author: jbarrez
Date: 2009-06-12 05:52:01 -0400 (Fri, 12 Jun 2009)
New Revision: 5031
Added:
jbpm4/trunk/modules/devguide/src/main/docbook/en/images/jobexecutor.overview.png
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch10-JobExecutor.xml
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch11-SoftwareLogging.xml
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch12-History.xml
Removed:
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch10-SoftwareLogging.xml
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch11-History.xml
Modified:
jbpm4/trunk/modules/devguide/src/main/docbook/en/master.xml
Log:
Added documentation for Jobexecutor to Devguide
Added: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/jobexecutor.overview.png
===================================================================
(Binary files differ)
Property changes on: jbpm4/trunk/modules/devguide/src/main/docbook/en/images/jobexecutor.overview.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: jbpm4/trunk/modules/devguide/src/main/docbook/en/master.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/master.xml 2009-06-12 09:21:13 UTC (rev 5030)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/master.xml 2009-06-12 09:52:01 UTC (rev 5031)
@@ -10,8 +10,9 @@
<!ENTITY ch07-ImplementingAdvancedActivities SYSTEM "modules/ch07-ImplementingAdvancedActivities.xml">
<!ENTITY ch08-AdvancedJpdl SYSTEM "modules/ch08-AdvancedJpdl.xml">
<!ENTITY ch09-Persistence SYSTEM "modules/ch09-Persistence.xml">
- <!ENTITY ch10-SoftwareLogging SYSTEM "modules/ch10-SoftwareLogging.xml">
- <!ENTITY ch11-History SYSTEM "modules/ch11-History.xml">
+ <!ENTITY ch10-JobExecutor SYSTEM "modules/ch10-JobExecutor.xml">
+ <!ENTITY ch11-SoftwareLogging SYSTEM "modules/ch11-SoftwareLogging.xml">
+ <!ENTITY ch12-History SYSTEM "modules/ch12-History.xml">
]>
<book lang="en">
@@ -31,7 +32,8 @@
&ch07-ImplementingAdvancedActivities;
&ch08-AdvancedJpdl;
&ch09-Persistence;
- &ch10-SoftwareLogging;
- &ch11-History;
+ &ch10-JobExecutor;
+ &ch11-SoftwareLogging;
+ &ch12-History;
</book>
\ No newline at end of file
Added: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch10-JobExecutor.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch10-JobExecutor.xml (rev 0)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch10-JobExecutor.xml 2009-06-12 09:52:01 UTC (rev 5031)
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="jobexecutor">
+ <title>JobExecutor</title>
+
+ <para>
+ For jPDL features like asynchronous continuations and timers, jBPM
+ relies on transactional asynchronous messaging and transactional
+ timers. Those are not available on the standard Java platform.
+ Therefore, jBPM includes the JobExecutor component, which executes
+ asynchronous messages and timers in any (potentially clustered)
+ environment.
+ </para>
+
+ <section id="overview">
+ <title>Overview</title>
+ <para>
+ By default, when calling a jBPM service operation (eg. TaskService,
+ ExecutionService, etc.), the jBPM logic is executed on the same thread
+ as where the call came from. In most cases, this is sufficient since
+ most steps in a process don't take much time. This means that
+ signalling a process instance from one wait state to another, passing
+ by several other steps in the business process, can be done in one
+ transaction.
+ </para>
+ <para>
+ However, in some occasions business processes can be made more efficient by
+ introducing asynchronous continuations. By marking an activity as
+ asynchronous, the jBPM engine will take care that the logic
+ encapsulated in the activity isn't executed on the thread of the
+ caller, but on a separate dedicated thread. The same mechanism is used
+ for timers and asynchronous mailing (which means mails will be sent
+ later, in a separate thread). The following picture shows which components
+ come into play when using this mechanism.
+ </para>
+ <figure id="jobexecutor.overview.image">
+ <title>JobExecutor components overview</title>
+ <mediaobject><imageobject><imagedata align="center" fileref="images/jobexecutor.overview.png"/></imageobject></mediaobject>
+ </figure>
+ <para>
+ When using timers or asynchronous continuations in a business process, the
+ jBPM engine will store a 'job' into the database (a job contains mainly a
+ duedate and continuation logic). Do note that this mechanism is
+ pluggable, which means that in the future other destinations could be
+ used (JMS, JCR, etc).
+ </para>
+ <para>
+ Now the JobExecutor comes in to play, which is in fact a manager
+ for several subcomponents:
+
+ <itemizedlist>
+ <listitem>
+ A <emphasis role="bold">shared BlockingQueue</emphasis>,
+ which is used to temporary store job identifiers of jobs which
+ are executable (eg duedate is passed).
+ </listitem>
+ <listitem>
+ Every JobExecutor has one <emphasis role="bold">DispatcherThread.</emphasis>
+ This thread will query the database for 'acquirable jobs' (eg timers
+ which duedate is passed), using a dedicated command through the CommandService.
+ Since the dispatcher uses the CommandService, the command is
+ automatically made transactional and wrapped by the configured
+ interceptors. As long as jobs are available the dispatcher will put
+ job identifiers on the shared queue, until the queue is either full
+ (the thread will automatically be blocked by the JVM until a slot is
+ free) or until no new jobs can be found in the database. If the latter
+ case, the dispatcher will wait for a configured time (ie the 'idle
+ time').
+ </listitem>
+ <listitem>
+ The JobExecutor also maintains a pool of
+ <emphasis role="bold">JobExecutorThreads</emphasis>. The number of
+ JobExecutorThreads can be configured and influences the size of the
+ shared queue. Every one of the JobExecutorThreads will try to take a
+ jobId from the queue. The shared queue implementation is guaranteed to
+ block the JobexecutorThread until a queue slot is filled and the new
+ job id will be passed to exactly one waiting JobexecutorThread.
+ After taking a job id from the queue, the job is transactionally
+ executed using a dedicated command through the CommandService. This
+ means that the job logic will completely be executed on the
+ JobExecutorThread, instead of the default calling thread. This also
+ means that the order in which the jobs are executed is unknown since
+ there could be multiple competing JobExecutorThreads, but it
+ is certain that only one job per transaction will be done (unless using
+ 'exclusive jobs' - in this case all exclusive jobs are sequentially
+ executed).
+ </listitem>
+ </itemizedlist>
+ </para>
+
+ </section>
+
+ <section id="configuration">
+ <title>Configuration</title>
+ <para>
+ Enabling the jobExecutor is very easy by adding the following line to the
+ jbpm.cfg.xml file (using default settings):
+ </para>
+ <programlisting>
+ <import resource="jbpm.jobexecutor.cfg.xml" />
+ </programlisting>
+ <para>
+ Additional attributes can be set to fine-tune the JobExecutor:
+ <itemizedlist>
+ <listitem>
+ <emphasis role="bold">threads:</emphasis> defines the number of
+ JobexecutorThreads (default 3 threads)
+ </listitem>
+ <listitem>
+ <emphasis role="bold">idle:</emphasis> number of milliseconds the dispatcher
+ component waits after no new jobs were found in the database (default 5 seconds)
+ </listitem>
+ <listitem>
+ <emphasis role="bold">idle-max:</emphasis> each time an exception occurs,
+ the idle period will be doubled until the 'idle-max' is reached
+ (back-off mechanism used to avoid a constant load on a failing database)
+ </listitem>
+ <listitem>
+ <emphasis role="bold">lock-millis:</emphasis> Number of milliseconds
+ that a job will be locked after being acquired by the dispatcher.
+ This prevents starvation in case one of more JobExecutorThreads would die
+ (eg when used in a cluster).
+ </listitem>
+ </itemizedlist>
+ <programlisting>
+
+ <process-engine-context>
+
+ <job-executor threads="4" idle="15000" idle-max="60000" lock-millis="3600000" />
+
+ </process-engine-context>
+ </programlisting>
+ </para>
+ </section>
+
+</chapter>
Deleted: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch10-SoftwareLogging.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch10-SoftwareLogging.xml 2009-06-12 09:21:13 UTC (rev 5030)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch10-SoftwareLogging.xml 2009-06-12 09:52:01 UTC (rev 5031)
@@ -1,99 +0,0 @@
-<chapter id="softwarelogging">
- <title>Software logging</title>
-
- <section>
- <title>Configuration</title>
- <para>PVM can use JDK logging (java.util.logging) or log4j. When the first message is
- logged, PVM logging will make the selection with following procedure:
- <orderedlist>
- <listitem>If a <literal>logging.properties</literal> resource is found
- on the classpath (using the context classloader), then JDK logging will
- be used and that file will be used to initialize the JDK logging.
- </listitem>
- <listitem>If log4j is found on the classpath, then log4j will be used.
- The check for log4j will be done by checking availability of class
- <literal>org.apache.log4j.LogManager</literal> with the context classloader.
- </listitem>
- <listitem>If none of the above, JDK logging will be used.</listitem>
- </orderedlist>
- </para>
- </section>
-
- <section>
- <title>Categories</title>
- <para>The PVM classes use their class name as the category for the logger.
- </para>
- <para>To have a basic understanding of what the PVM classes are doing,
- turning on the <literal>debug</literal> level is great. Level
- <literal>trace</literal> might be spitting out too much for that
- purpose.
- </para>
- </section>
-
- <section>
- <title>JDK logging</title>
- <para>In JDK logging, <literal>debug</literal>maps to <literal>fine</literal>
- and <literal>trace</literal> maps to <literal>finest</literal>.
- Level <literal>finer</literal> is not used.
- </para>
- <para><literal>org.jbpm.pvm.internal.log.LogFormatter</literal> is part of
- the pvm library and it can create a nice one-line output for log messages.
- It also has a neat feature that creates a unique indentation per thread.
- To configure it, this is a typical <literal>logging.properties</literal>
- </para>
- <programlisting>handlers = java.util.logging.ConsoleHandler
-java.util.logging.ConsoleHandler.level = FINEST
-java.util.logging.ConsoleHandler.formatter = org.jbpm.pvm.internal.log.LogFormatter
-
-# For example, set the com.xyz.foo logger to only log SEVERE messages:
-# com.xyz.foo.level = SEVERE
-
-.level = SEVERE
-org.jbpm.level=FINE
-org.jbpm.tx.level=FINE
-org.jbpm.pvm.internal.wire.level=FINE</programlisting>
-
-<!--
- <para>For production usage, jBPM also includes an error triggered log handler. This is
- a log handler that will only keep the most recent log messages in
- memory and these will only be flushed to a file in case an error occurs.
- </para>
- <para>to configure it, add <literal>org.jbpm.util.ErrorTriggeredFileHandler</literal>
- to the handlers in the logging properties like this:
- </para>
- <programlisting>handlers = java.util.logging.ConsoleHandler org.jbpm.util.ErrorTriggeredFileHandler</programlisting>
- <para>Next snippet shows how in the same logging.properties, the error
- triggered file handler can be configured. The given values are the default
- values.
- </para>
- <programlisting>org.jbpm.util.ErrorTriggeredFileHandler.size = 500
-org.jbpm.util.ErrorTriggeredFileHandler.push = SEVERE
-org.jbpm.util.ErrorTriggeredFileHandler.pattern = %h/jbpm%u.log</programlisting>
- <para>Alternatively to using the org.jbpm.util.ErrorTriggeredFileHandler, the
- JDK handlers FileHandler and MemoryHandler can used in combination to get
- similar results with a bit more configuration.
- </para>
-
--->
- </section>
-
- <section>
- <title>Debugging persistence</title>
- <para>When testing the persistence, following logging configurations can be
- valuable. Category <literal>org.hibernate.SQL</literal> shows the SQL statement that is executed
- and category <literal>org.hibernate.type</literal> shows the values of the parameters that are
- set in the queries.
- </para>
- <programlisting>org.hibernate.SQL.level=FINEST
-org.hibernate.type.level=FINEST</programlisting>
- <para>And in case you get a failed batch as a cause in a hibernate exception,
- you might want to set the batch size to 0 like this in the hibernate properties:
- </para>
- <programlisting>hibernate.jdbc.batch_size = 0</programlisting>
- <para>Also in the hibernate properties, the following properties allow for
- detailed logs of the SQL that hibernate spits out:</para>
- <programlisting>hibernate.show_sql = true
-hibernate.format_sql = true
-hibernate.use_sql_comments = true</programlisting>
- </section>
-</chapter>
\ No newline at end of file
Deleted: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch11-History.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch11-History.xml 2009-06-12 09:21:13 UTC (rev 5030)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch11-History.xml 2009-06-12 09:52:01 UTC (rev 5031)
@@ -1,42 +0,0 @@
-<chapter id="history">
- <title>History</title>
-
- <section id="overview">
- <title>Overview</title>
-
- <para>HistoryEvents are fired during process execution.
- </para>
-
- <para>We maintain history information on 2 levels: process instance and activity instance.
- </para>
-
- <para>Process instance start and process instance end generate history events are fired directly
- from within the implementation.
- </para>
-
- <para>ActivityBehaviour implementations are responsible for calling the historyXxx methods that
- are exposed on the ActivityExecution
- </para>
-
- <para>All the HistoryEvents are delegated to a HistorySession. The default HistorySessionImpl
- will invoke the process() method on the history events themselves.
- </para>
-
- <para>The HistoryEvents are temporary events. In the process method, they build up the information
- in the history model. There is a HistoryProcessInstance and there is a whole class hierarchy starting with HistoryActivityInstance.
- </para>
-
- <para>In the HistoryEvent.process methods, the history events create model entities or merge
- information into the model entities. For instance, a ProcessInstanceStart history event will
- create a HistoryProcessInstance entity/record. And the ProcessInstanceEnd will set the endTime
- property in the existing HistoryProcessInstance entity/record.
- </para>
-
- <para>Similar pattern for the activities. But for automatic activities, there is an optimisation
- so that only 1 event is created and all the information is stored in one single insert (as all
- this happens inside 1 transaction).
- </para>
-
- </section>
-
-</chapter>
\ No newline at end of file
Copied: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch11-SoftwareLogging.xml (from rev 5027, jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch10-SoftwareLogging.xml)
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch11-SoftwareLogging.xml (rev 0)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch11-SoftwareLogging.xml 2009-06-12 09:52:01 UTC (rev 5031)
@@ -0,0 +1,99 @@
+<chapter id="softwarelogging">
+ <title>Software logging</title>
+
+ <section>
+ <title>Configuration</title>
+ <para>PVM can use JDK logging (java.util.logging) or log4j. When the first message is
+ logged, PVM logging will make the selection with following procedure:
+ <orderedlist>
+ <listitem>If a <literal>logging.properties</literal> resource is found
+ on the classpath (using the context classloader), then JDK logging will
+ be used and that file will be used to initialize the JDK logging.
+ </listitem>
+ <listitem>If log4j is found on the classpath, then log4j will be used.
+ The check for log4j will be done by checking availability of class
+ <literal>org.apache.log4j.LogManager</literal> with the context classloader.
+ </listitem>
+ <listitem>If none of the above, JDK logging will be used.</listitem>
+ </orderedlist>
+ </para>
+ </section>
+
+ <section>
+ <title>Categories</title>
+ <para>The PVM classes use their class name as the category for the logger.
+ </para>
+ <para>To have a basic understanding of what the PVM classes are doing,
+ turning on the <literal>debug</literal> level is great. Level
+ <literal>trace</literal> might be spitting out too much for that
+ purpose.
+ </para>
+ </section>
+
+ <section>
+ <title>JDK logging</title>
+ <para>In JDK logging, <literal>debug</literal>maps to <literal>fine</literal>
+ and <literal>trace</literal> maps to <literal>finest</literal>.
+ Level <literal>finer</literal> is not used.
+ </para>
+ <para><literal>org.jbpm.pvm.internal.log.LogFormatter</literal> is part of
+ the pvm library and it can create a nice one-line output for log messages.
+ It also has a neat feature that creates a unique indentation per thread.
+ To configure it, this is a typical <literal>logging.properties</literal>
+ </para>
+ <programlisting>handlers = java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level = FINEST
+java.util.logging.ConsoleHandler.formatter = org.jbpm.pvm.internal.log.LogFormatter
+
+# For example, set the com.xyz.foo logger to only log SEVERE messages:
+# com.xyz.foo.level = SEVERE
+
+.level = SEVERE
+org.jbpm.level=FINE
+org.jbpm.tx.level=FINE
+org.jbpm.pvm.internal.wire.level=FINE</programlisting>
+
+<!--
+ <para>For production usage, jBPM also includes an error triggered log handler. This is
+ a log handler that will only keep the most recent log messages in
+ memory and these will only be flushed to a file in case an error occurs.
+ </para>
+ <para>to configure it, add <literal>org.jbpm.util.ErrorTriggeredFileHandler</literal>
+ to the handlers in the logging properties like this:
+ </para>
+ <programlisting>handlers = java.util.logging.ConsoleHandler org.jbpm.util.ErrorTriggeredFileHandler</programlisting>
+ <para>Next snippet shows how in the same logging.properties, the error
+ triggered file handler can be configured. The given values are the default
+ values.
+ </para>
+ <programlisting>org.jbpm.util.ErrorTriggeredFileHandler.size = 500
+org.jbpm.util.ErrorTriggeredFileHandler.push = SEVERE
+org.jbpm.util.ErrorTriggeredFileHandler.pattern = %h/jbpm%u.log</programlisting>
+ <para>Alternatively to using the org.jbpm.util.ErrorTriggeredFileHandler, the
+ JDK handlers FileHandler and MemoryHandler can used in combination to get
+ similar results with a bit more configuration.
+ </para>
+
+-->
+ </section>
+
+ <section>
+ <title>Debugging persistence</title>
+ <para>When testing the persistence, following logging configurations can be
+ valuable. Category <literal>org.hibernate.SQL</literal> shows the SQL statement that is executed
+ and category <literal>org.hibernate.type</literal> shows the values of the parameters that are
+ set in the queries.
+ </para>
+ <programlisting>org.hibernate.SQL.level=FINEST
+org.hibernate.type.level=FINEST</programlisting>
+ <para>And in case you get a failed batch as a cause in a hibernate exception,
+ you might want to set the batch size to 0 like this in the hibernate properties:
+ </para>
+ <programlisting>hibernate.jdbc.batch_size = 0</programlisting>
+ <para>Also in the hibernate properties, the following properties allow for
+ detailed logs of the SQL that hibernate spits out:</para>
+ <programlisting>hibernate.show_sql = true
+hibernate.format_sql = true
+hibernate.use_sql_comments = true</programlisting>
+ </section>
+</chapter>
\ No newline at end of file
Copied: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch12-History.xml (from rev 5027, jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch11-History.xml)
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch12-History.xml (rev 0)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch12-History.xml 2009-06-12 09:52:01 UTC (rev 5031)
@@ -0,0 +1,42 @@
+<chapter id="history">
+ <title>History</title>
+
+ <section id="overview">
+ <title>Overview</title>
+
+ <para>HistoryEvents are fired during process execution.
+ </para>
+
+ <para>We maintain history information on 2 levels: process instance and activity instance.
+ </para>
+
+ <para>Process instance start and process instance end generate history events are fired directly
+ from within the implementation.
+ </para>
+
+ <para>ActivityBehaviour implementations are responsible for calling the historyXxx methods that
+ are exposed on the ActivityExecution
+ </para>
+
+ <para>All the HistoryEvents are delegated to a HistorySession. The default HistorySessionImpl
+ will invoke the process() method on the history events themselves.
+ </para>
+
+ <para>The HistoryEvents are temporary events. In the process method, they build up the information
+ in the history model. There is a HistoryProcessInstance and there is a whole class hierarchy starting with HistoryActivityInstance.
+ </para>
+
+ <para>In the HistoryEvent.process methods, the history events create model entities or merge
+ information into the model entities. For instance, a ProcessInstanceStart history event will
+ create a HistoryProcessInstance entity/record. And the ProcessInstanceEnd will set the endTime
+ property in the existing HistoryProcessInstance entity/record.
+ </para>
+
+ <para>Similar pattern for the activities. But for automatic activities, there is an optimisation
+ so that only 1 event is created and all the information is stored in one single insert (as all
+ this happens inside 1 transaction).
+ </para>
+
+ </section>
+
+</chapter>
\ No newline at end of file
16 years, 10 months
JBoss JBPM SVN: r5030 - in jbpm4/trunk/modules: test-base/src/main/java/org/jbpm/test and 1 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-12 05:21:13 -0400 (Fri, 12 Jun 2009)
New Revision: 5030
Added:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryCandidatesTest.java
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/BaseJbpmTestCase.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
Log:
JBPM-2332 fixed task query where clause brackets for candidates
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java 2009-06-11 14:47:45 UTC (rev 5029)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java 2009-06-12 09:21:13 UTC (rev 5030)
@@ -143,7 +143,7 @@
for (Group group: groups) {
groupIds.add(group.getId());
}
- appendWhereClause("(participant.userId = :candidateUserId) or (participant.groupId in (:candidateGroupIds) ) ", hql);
+ appendWhereClause("((participant.userId = :candidateUserId) or (participant.groupId in (:candidateGroupIds)))", hql);
}
}
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/BaseJbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/BaseJbpmTestCase.java 2009-06-11 14:47:45 UTC (rev 5029)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/BaseJbpmTestCase.java 2009-06-12 09:21:13 UTC (rev 5030)
@@ -56,6 +56,8 @@
}
static protected Log log = Log.getLog(BaseJbpmTestCase.class.getName());
+
+ Throwable exception;
protected void setUp() throws Exception {
assertNull("there is already an environment open", Environment.getCurrent());
@@ -83,11 +85,13 @@
log.error("");
log.error("ASSERTION FAILURE: "+e.getMessage(), e);
log.error("");
+ exception = e;
throw e;
} catch (Throwable t) {
log.error("");
log.error("TEST THROWS EXCEPTION: "+t.getMessage(), t);
log.error("");
+ exception = t;
throw t;
}
}
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 2009-06-11 14:47:45 UTC (rev 5029)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/Db.java 2009-06-12 09:21:13 UTC (rev 5030)
@@ -54,8 +54,8 @@
clean((EnvironmentFactory) processEngine);
}
- public static void verifyClean(ProcessEngine processEngine) {
- verifyClean((EnvironmentFactory) processEngine);
+ public static String verifyClean(ProcessEngine processEngine) {
+ return verifyClean((EnvironmentFactory) processEngine);
}
public static void clean(EnvironmentFactory environmentFactory) {
@@ -146,12 +146,12 @@
}
}
- public static void verifyClean(EnvironmentFactory environmentFactory) {
+ public static String verifyClean(EnvironmentFactory environmentFactory) {
SessionFactory sessionFactory = environmentFactory.get(SessionFactory.class);
// when running this with a remote ejb invocation configuration, there is no
// session factory and no cleanup needs to be done
if (sessionFactory==null) {
- return;
+ return null;
}
String[] tableNames = (String[]) environmentFactory.get(TABLE_NAMES_KEY);
@@ -174,7 +174,7 @@
environmentFactory.set(TABLE_NAMES_KEY, tableNames);
}
- String recordsLeft = "";
+ String recordsLeftMsg = "";
Session session = sessionFactory.openSession();
try {
for (String tableName : tableNames) {
@@ -183,17 +183,17 @@
sqlQuery.addScalar("RECORD_COUNT_", Hibernate.LONG);
Long recordCount = (Long) sqlQuery.uniqueResult();
if (recordCount>0L) {
- recordsLeft += tableName+"["+recordCount+"] ";
- log.error("FIXME: JBPM-2004 "+recordCount+" records left in table "+tableName);
+ recordsLeftMsg += tableName+":"+recordCount+", ";
}
}
} finally {
session.close();
}
- if (recordsLeft.length()>0) {
+ if (recordsLeftMsg.length()>0) {
clean(environmentFactory);
- throw new RuntimeException(recordsLeft);
}
+
+ return recordsLeftMsg;
}
}
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-06-11 14:47:45 UTC (rev 5029)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2009-06-12 09:21:13 UTC (rev 5030)
@@ -28,6 +28,7 @@
import org.jbpm.api.ExecutionService;
import org.jbpm.api.HistoryService;
import org.jbpm.api.IdentityService;
+import org.jbpm.api.JbpmException;
import org.jbpm.api.ManagementService;
import org.jbpm.api.ProcessEngine;
import org.jbpm.api.RepositoryService;
@@ -105,7 +106,15 @@
repositoryService.deleteDeploymentCascade(deploymentDbid);
}
- Db.verifyClean(processEngine);
+ String recordsLeftMsg = Db.verifyClean(processEngine);
+ if (recordsLeftMsg.length()>0) {
+ String message = "database was not clean after test: "+recordsLeftMsg;
+ if (exception==null) {
+ throw new JbpmException(message);
+ } else {
+ throw new JbpmException(message, exception);
+ }
+ }
super.tearDown();
}
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryCandidatesTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryCandidatesTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryCandidatesTest.java 2009-06-12 09:21:13 UTC (rev 5030)
@@ -0,0 +1,130 @@
+/*
+ * 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.task;
+
+import java.util.List;
+
+import org.jbpm.api.task.Participation;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskQueryCandidatesTest extends JbpmTestCase {
+
+ String salesGroupId;
+ String developmentGroupId;
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ identityService.createUser("johndoe", "John", "Doe");
+ identityService.createUser("joesmoe", "Joe", "Smoe");
+ identityService.createUser("jackblack", "Jack", "Black");
+
+ salesGroupId = identityService.createGroup("sales");
+ identityService.createMembership("johndoe", salesGroupId);
+ identityService.createMembership("joesmoe", salesGroupId);
+
+ developmentGroupId = identityService.createGroup("development");
+ identityService.createMembership("jackblack", developmentGroupId);
+ }
+
+ public void tearDown() throws Exception {
+ identityService.deleteUser("johndoe");
+ identityService.deleteUser("joesmoe");
+ identityService.deleteUser("jackblack");
+ identityService.deleteGroup(salesGroupId);
+ identityService.deleteGroup(developmentGroupId);
+
+ super.tearDown();
+ }
+
+
+ public void testDirectUserCandidate() {
+ // this is the task we'll be looking for
+ Task task = taskService.newTask();
+ task.setName("do laundry");
+ long taskDbid = taskService.saveTask(task);
+ taskService.addTaskParticipatingUser(taskDbid, "johndoe", Participation.CANDIDATE);
+
+ // this tasks are a diversion to see if the query only selects the above task
+ task = taskService.newTask();
+ task.setName("dishes");
+ task.setAssignee("johndoe");
+ long johnsOtherTaskDbid = taskService.saveTask(task);
+ // this tasks are a diversion to see if the query only selects the above task
+ task = taskService.newTask();
+ task.setName("dishes");
+ long joesOtherTaskDbid = taskService.saveTask(task);
+
+
+ List<Task> groupTasks = taskService.findGroupTasks("johndoe");
+ assertEquals(1, groupTasks.size());
+ assertEquals(taskDbid, groupTasks.get(0).getDbid());
+
+ groupTasks = taskService.findGroupTasks("joesmoe");
+ assertEquals(0, groupTasks.size());
+
+ groupTasks = taskService.findGroupTasks("jackblack");
+ assertEquals(0, groupTasks.size());
+
+ taskService.deleteTask(taskDbid);
+ taskService.deleteTask(johnsOtherTaskDbid);
+ taskService.deleteTask(joesOtherTaskDbid);
+ }
+
+ public void testGroupCandidate() {
+ Task task = taskService.newTask();
+ task.setName("do laundry");
+ long taskDbid = taskService.saveTask(task);
+ taskService.addTaskParticipatingGroup(taskDbid, salesGroupId, Participation.CANDIDATE);
+
+ // this tasks are a diversion to see if the query only selects the above task
+ task = taskService.newTask();
+ task.setName("dishes");
+ task.setAssignee("johndoe");
+ long johnsOtherTaskDbid = taskService.saveTask(task);
+ // this tasks are a diversion to see if the query only selects the above task
+ task = taskService.newTask();
+ task.setName("dishes");
+ long joesOtherTaskDbid = taskService.saveTask(task);
+
+
+ List<Task> groupTasks = taskService.findGroupTasks("johndoe");
+ assertEquals(1, groupTasks.size());
+ assertEquals(taskDbid, groupTasks.get(0).getDbid());
+
+ groupTasks = taskService.findGroupTasks("joesmoe");
+ assertEquals(1, groupTasks.size());
+ assertEquals(taskDbid, groupTasks.get(0).getDbid());
+
+ groupTasks = taskService.findGroupTasks("jackblack");
+ assertEquals(0, groupTasks.size());
+
+ taskService.deleteTask(taskDbid);
+ taskService.deleteTask(johnsOtherTaskDbid);
+ taskService.deleteTask(joesOtherTaskDbid);
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskQueryCandidatesTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 10 months
JBoss JBPM SVN: r5029 - jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-11 10:47:45 -0400 (Thu, 11 Jun 2009)
New Revision: 5029
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/DefaultIdGenerator.java
Log:
JBPM-2330 fine tuned execution id generation
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/DefaultIdGenerator.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/DefaultIdGenerator.java 2009-06-11 14:45:17 UTC (rev 5028)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/DefaultIdGenerator.java 2009-06-11 14:47:45 UTC (rev 5029)
@@ -47,12 +47,11 @@
}
String executionPart = null;
- if (execution.getKey()!=null) {
+ if ( (parent==null)
+ && (execution.getKey()!=null)
+ ) {
executionPart = execution.getKey();
- } else if (execution.getName()!=null) {
- executionPart = execution.getName();
-
} else {
Session session = Environment.getFromCurrent(Session.class);
session.save(execution);
@@ -61,10 +60,6 @@
String executionId = base+"."+executionPart;
- if (parent!=null) {
- executionId += "["+execution.getDbid()+"]";
- }
-
if (log.isDebugEnabled()) log.debug("generated execution id "+executionId);
return executionId;
16 years, 10 months
JBoss JBPM SVN: r5028 - in jbpm4/trunk/modules: pvm/src/main/java/org/jbpm/pvm/internal/model and 1 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-11 10:45:17 -0400 (Thu, 11 Jun 2009)
New Revision: 5028
Added:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEndCombinationTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEventListenerOnEndTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ConcurrentEndTest.java
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateActivity.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
Log:
JBPM-2275 verify combination of async messages and end of process instance
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkActivity.java 2009-06-11 10:34:50 UTC (rev 5027)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkActivity.java 2009-06-11 14:45:17 UTC (rev 5028)
@@ -85,6 +85,10 @@
concurrentExecution.setActivity(activity);
concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
concurrentExecution.take(transition);
+
+ if (concurrentRoot.isEnded()) {
+ break;
+ }
}
}
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateActivity.java 2009-06-11 10:34:50 UTC (rev 5027)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateActivity.java 2009-06-11 14:45:17 UTC (rev 5028)
@@ -49,7 +49,16 @@
execution.fire(signalName, activity);
- Transition transition = activity.findOutgoingTransition(signalName);
+ Transition transition = null;
+ if ( (signalName==null)
+ && (activity.getOutgoingTransitions()!=null)
+ && (activity.getOutgoingTransitions().size()==1)
+ ) {
+ transition = activity.getOutgoingTransitions().get(0);
+ } else {
+ transition = activity.findOutgoingTransition(signalName);
+ }
+
if (transition!=null) {
execution.historyActivityEnd(signalName);
execution.take(transition);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-06-11 10:34:50 UTC (rev 5027)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-06-11 14:45:17 UTC (rev 5028)
@@ -266,6 +266,10 @@
parent.setState(STATE_ACTIVE_ROOT);
}
+ // capture the parent execution cause the
+ // subsequent invocation of end() will set the parent to null
+ ExecutionImpl parent = this.parent;
+
end();
return parent;
@@ -763,9 +767,11 @@
return (ExecutionImpl) (executionsMap!=null ? executionsMap.get(name) : null);
}
- public void removeExecution(Execution child) {
+ public void removeExecution(ExecutionImpl child) {
if (executions!=null) {
if (executions.remove(child)) {
+ child.setParent(null);
+
// invalidate the executionsMap cache
executionsMap = null;
} else {
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEndCombinationTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEndCombinationTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEndCombinationTest.java 2009-06-11 14:45:17 UTC (rev 5028)
@@ -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.execution;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class AsyncEndCombinationTest extends JbpmTestCase {
+
+ public void testConcurrentEndScenario1() {
+ deployJpdlXmlString(
+ "<process name='AsyncEndCombination'>" +
+ " <start>" +
+ " <transition to='f' />" +
+ " </start>" +
+ " <fork name='f'>" +
+ " <transition to='a' continue='async' />" +
+ " <transition to='end' />" +
+ " </fork>" +
+ " <state name='a' />" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("AsyncEndCombination");
+ assertEquals(Execution.STATE_ENDED, processInstance.getState());
+ }
+
+ public void testConcurrentScenario2() {
+ deployJpdlXmlString(
+ "<process name='AsyncEndCombination'>" +
+ " <start>" +
+ " <transition to='f' />" +
+ " </start>" +
+ " <fork name='f'>" +
+ " <transition to='end' />" +
+ " <transition to='a' continue='async' />" +
+ " </fork>" +
+ " <state name='a' />" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("AsyncEndCombination");
+ assertEquals(Execution.STATE_ENDED, processInstance.getState());
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEndCombinationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEventListenerOnEndTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEventListenerOnEndTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEventListenerOnEndTest.java 2009-06-11 14:45:17 UTC (rev 5028)
@@ -0,0 +1,108 @@
+/*
+ * 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.execution;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.job.Job;
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.listener.EventListenerExecution;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class AsyncEventListenerOnEndTest extends JbpmTestCase {
+
+ public static class AsyncEventListener implements EventListener {
+ private static final long serialVersionUID = 1L;
+ public void notify(EventListenerExecution execution) throws Exception {
+ }
+ }
+
+ public void testAsyncEventListenerAfterWaitState() {
+ deployJpdlXmlString(
+ "<process name='AsyncEventListenerOnEnd'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a'>" +
+ " <transition name='start-to-end' to='end'>" +
+ " <event-listener continue='async' class='"+AsyncEventListener.class.getName()+"' />" +
+ " </transition>" +
+ " </state>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("AsyncEventListenerOnEnd");
+
+ processInstance = executionService.signalExecutionById(processInstance.getId());
+
+ assertEquals(Execution.STATE_ASYNC, processInstance.getState());
+
+ Job job = managementService.createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .uniqueResult();
+
+ assertNotNull(job);
+
+ managementService.executeJob(job.getDbid());
+
+ assertEquals(Execution.STATE_ENDED,
+ historyService.createHistoryProcessInstanceQuery()
+ .processInstanceId(processInstance.getId())
+ .uniqueResult()
+ .getState() );
+ }
+
+ public void testAsyncEventListenerInStartTransaction() {
+ deployJpdlXmlString(
+ "<process name='AsyncEventListenerOnEnd'>" +
+ " <start name='start'>" +
+ " <transition name='start-to-end' to='end'>" +
+ " <event-listener continue='async' class='"+AsyncEventListener.class.getName()+"' />" +
+ " </transition>" +
+ " </start>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("AsyncEventListenerOnEnd");
+ assertEquals(Execution.STATE_ASYNC, processInstance.getState());
+
+ Job job = managementService.createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .uniqueResult();
+
+ assertNotNull(job);
+
+ managementService.executeJob(job.getDbid());
+
+ assertEquals(Execution.STATE_ENDED,
+ historyService.createHistoryProcessInstanceQuery()
+ .processInstanceId(processInstance.getId())
+ .uniqueResult()
+ .getState() );
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/AsyncEventListenerOnEndTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ConcurrentEndTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ConcurrentEndTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ConcurrentEndTest.java 2009-06-11 14:45:17 UTC (rev 5028)
@@ -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.execution;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ConcurrentEndTest extends JbpmTestCase {
+
+ public void testConcurrentEndScenario1() {
+ deployJpdlXmlString(
+ "<process name='ConcurrentEnd'>" +
+ " <start>" +
+ " <transition to='f' />" +
+ " </start>" +
+ " <fork name='f'>" +
+ " <transition to='a' />" +
+ " <transition to='end' />" +
+ " </fork>" +
+ " <state name='a' />" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("ConcurrentEnd");
+ assertEquals(Execution.STATE_ENDED, processInstance.getState());
+ }
+
+ public void testConcurrentEndScenario2() {
+ deployJpdlXmlString(
+ "<process name='ConcurrentEnd'>" +
+ " <start>" +
+ " <transition to='f' />" +
+ " </start>" +
+ " <fork name='f'>" +
+ " <transition to='end' />" +
+ " <transition to='a' />" +
+ " </fork>" +
+ " <state name='a' />" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("ConcurrentEnd");
+ assertEquals(Execution.STATE_ENDED, processInstance.getState());
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/execution/ConcurrentEndTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 10 months
JBoss JBPM SVN: r5027 - jbpm3/branches/jbpm-3.2-soa/modules/core.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-06-11 06:34:50 -0400 (Thu, 11 Jun 2009)
New Revision: 5027
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml
Log:
JBPM-2094: Unindexed Foreign Keys cause deadlocks in oracle (REOPENED)
Correctly exclude JBPM2094Test in Sybase profile
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml 2009-06-11 08:16:50 UTC (rev 5026)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/pom.xml 2009-06-11 10:34:50 UTC (rev 5027)
@@ -315,8 +315,8 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <!-- JBPM-2094 Unindexed Foreign Keys cause deadlocks in oracle -->
- <excludes>org.jbpm.jbpm2094.JBPM2094Test</excludes>
+ <!-- [JBPM-2094] Unindexed Foreign Keys cause deadlocks in oracle -->
+ <excludes>org/jbpm/jbpm2094/JBPM2094Test.java</excludes>
</configuration>
</plugin>
</plugins>
16 years, 10 months