JBoss JBPM SVN: r6343 - in jbpm4/trunk/modules/jpdl/src: test/java/org/jbpm/jpdl/parsing and 1 other directory.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-05-15 05:22:08 -0400 (Sat, 15 May 2010)
New Revision: 6343
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ActivityParsingTest.java
Log:
JBPM-2785 correct parsing description of activity.
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2010-05-15 09:11:28 UTC (rev 6342)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2010-05-15 09:22:08 UTC (rev 6343)
@@ -282,7 +282,8 @@
if ("on".equals(tagName)
|| "timer".equals(tagName)
|| "swimlane".equals(tagName)
- || "migrate-instances".equals(tagName)) continue;
+ || "migrate-instances".equals(tagName)
+ || "description".equals(tagName)) continue;
JpdlBinding activityBinding = (JpdlBinding) getBinding(nestedElement, CATEGORY_ACTIVITY);
if (activityBinding == null) {
@@ -298,7 +299,7 @@
parseTransitions(nestedElement, activity, parse);
parseVariableDefinitions(nestedElement, parse, activity);
- Element descriptionElement = XmlUtil.element(documentElement, "description");
+ Element descriptionElement = XmlUtil.element(nestedElement, "description");
if (descriptionElement!=null) {
String description = XmlUtil.getContentText(descriptionElement);
activity.setDescription(description);
Modified: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ActivityParsingTest.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ActivityParsingTest.java 2010-05-15 09:11:28 UTC (rev 6342)
+++ jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ActivityParsingTest.java 2010-05-15 09:22:08 UTC (rev 6343)
@@ -23,6 +23,9 @@
import java.util.List;
+import org.jbpm.pvm.internal.client.ClientProcessDefinition;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.xml.Problem;
@@ -48,4 +51,20 @@
);
assertTextPresent("attribute <state name=\"\" is empty", problems.get(0).getMsg());
}
+
+ public void testDescription() {
+ ClientProcessDefinition processDefinition = parse(
+ "<process name='p'>" +
+ " <description>process definition description</description>" +
+ " <start name='start'>" +
+ " <description>start description</description>" +
+ " </start>" +
+ "</process>"
+ );
+ assertEquals("process definition description", processDefinition.getDescription());
+
+ ProcessDefinitionImpl processDefinitionImpl = (ProcessDefinitionImpl) processDefinition;
+ ActivityImpl activity = processDefinitionImpl.getInitial();
+ assertEquals("start description", activity.getDescription());
+ }
}
15 years, 11 months
JBoss JBPM SVN: r6342 - in jbpm4/trunk/modules/test-cfg/src/test: java/org/jbpm/test/custombusinesscalendarimpl and 2 other directories.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-05-15 05:11:28 -0400 (Sat, 15 May 2010)
New Revision: 6342
Modified:
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarcfg/CustomBusinessCalendarCfgTest.java
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendarImplTest.java
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/expression/eventlistener/applicationContext.xml
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/transactionmanager/applicationContext.xml
Log:
correct spring testcase of test-cfg
change deprecated method Job.getDueDate() to getDuedate()
Modified: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarcfg/CustomBusinessCalendarCfgTest.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarcfg/CustomBusinessCalendarCfgTest.java 2010-05-14 02:41:49 UTC (rev 6341)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarcfg/CustomBusinessCalendarCfgTest.java 2010-05-15 09:11:28 UTC (rev 6342)
@@ -71,7 +71,7 @@
.processInstanceId(processInstance.getId())
.uniqueResult();
- Date duedate = job.getDueDate();
+ Date duedate = job.getDuedate();
gregorianCalendar = new GregorianCalendar();
gregorianCalendar.setTime(duedate);
Modified: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendarImplTest.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendarImplTest.java 2010-05-14 02:41:49 UTC (rev 6341)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendarImplTest.java 2010-05-15 09:11:28 UTC (rev 6342)
@@ -65,7 +65,7 @@
.processInstanceId(processInstance.getId())
.uniqueResult();
- Date duedate = job.getDueDate();
+ Date duedate = job.getDuedate();
GregorianCalendar gregorianCalendar = new GregorianCalendar();
gregorianCalendar.setTime(duedate);
Modified: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/expression/eventlistener/applicationContext.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/expression/eventlistener/applicationContext.xml 2010-05-14 02:41:49 UTC (rev 6341)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/expression/eventlistener/applicationContext.xml 2010-05-15 09:11:28 UTC (rev 6342)
@@ -6,10 +6,10 @@
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.0.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<bean id="myEventListener" class="org.jbpm.test.spring.expression.eventlistener.MyEventListener" />
@@ -21,7 +21,7 @@
<bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" />
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
- <property name="configLocation" value="classpath:org/jbpm/test/spring/transactionmanager/jbpm.hibernate.cfg.xml" />
+ <property name="configLocation" value="classpath:org/jbpm/test/spring/expression/eventlistener/jbpm.hibernate.cfg.xml" />
<!-- A best practice should be to keep split the config into multiple files
<property name="configLocations" value="hibernate.cfg.xml, hibernate.jbpm.cfg.xml" />
-->
Modified: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/transactionmanager/applicationContext.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/transactionmanager/applicationContext.xml 2010-05-14 02:41:49 UTC (rev 6341)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/transactionmanager/applicationContext.xml 2010-05-15 09:11:28 UTC (rev 6342)
@@ -6,10 +6,10 @@
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.0.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper">
<property name="jbpmCfg" value="org/jbpm/test/spring/transactionmanager/jbpm.cfg.xml" />
15 years, 11 months
JBoss JBPM SVN: r6341 - in jbpm4/trunk/modules: pvm/src/main/java/org/jbpm/pvm/internal/env and 3 other directories.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-05-13 22:41:49 -0400 (Thu, 13 May 2010)
New Revision: 6341
Added:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/UelExpressionTest.java
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/el/JbpmEnvironmentElResolver.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/BasicEnvironment.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/EnvironmentImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/JuelScriptEngine.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/VariableExpressionTest.java
Log:
JBPM-2777 use Maciej' patch to solve this issue
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/el/JbpmEnvironmentElResolver.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/el/JbpmEnvironmentElResolver.java 2010-05-14 02:23:28 UTC (rev 6340)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/el/JbpmEnvironmentElResolver.java 2010-05-14 02:41:49 UTC (rev 6341)
@@ -27,32 +27,36 @@
import javax.el.ELContext;
import javax.el.ELResolver;
+import org.jbpm.api.JbpmException;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
-
/**
* @author Tom Baeyens
*/
public class JbpmEnvironmentElResolver extends ELResolver {
-
+
EnvironmentImpl environment;
-
+
public JbpmEnvironmentElResolver(EnvironmentImpl environment) {
this.environment = environment;
}
public Object getValue(ELContext context, Object base, Object property) {
- // this resolver only resolves top level variable names to execution variable names.
+ // this resolver only resolves top level variable names to execution
+ // variable names.
// only handle if this is a top level variable
- if (base==null) {
+ if (base == null) {
// we assume a NPE-check for property is not needed
- // i don't think the next cast can go wrong. can it?
+ // i don't think the next cast can go wrong. can it?
String name = (String) property;
- Object object = environment.get(name);
- if (object!=null) {
+ try {
+ Object object = environment.get(name, false);
context.setPropertyResolved(true);
return object;
+ } catch (JbpmException je) {
+ // Property not found... ignore in this case and return null below...
+ // Will be interpreted as property not found
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/BasicEnvironment.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/BasicEnvironment.java 2010-05-14 02:23:28 UTC (rev 6340)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/BasicEnvironment.java 2010-05-14 02:41:49 UTC (rev 6341)
@@ -93,16 +93,30 @@
public Object get(String name) {
return get(name, null);
}
-
+
public Object get(String name, String[] searchOrder) {
- if (searchOrder==null) {
- searchOrder = getDefaultSearchOrder();
+ return get(name, searchOrder, true);
+ }
+
+ public Object get(String name, boolean nullIfNotFound) {
+ return get(name, null, nullIfNotFound);
+ }
+
+ public Object get(String name, String[] searchOrder, boolean nullIfNotFound) {
+ if (searchOrder == null) {
+ searchOrder = getDefaultSearchOrder();
+ }
+ for (String contextName : searchOrder) {
+ Context context = contexts.get(contextName);
+ if (context.has(name)) {
+ return context.get(name);
+ }
+ }
+ if (nullIfNotFound) {
+ return null;
+ } else {
+ throw new JbpmException("Null value found for " + name + " but null is not allowed");
}
- for (String contextName : searchOrder) {
- Context context = contexts.get(contextName);
- if (context.has(name)) return context.get(name);
- }
- return null;
}
public <T> T get(Class<T> type) {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/EnvironmentImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/EnvironmentImpl.java 2010-05-14 02:23:28 UTC (rev 6340)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/env/EnvironmentImpl.java 2010-05-14 02:41:49 UTC (rev 6341)
@@ -141,6 +141,10 @@
* @return the object if it exists in the environment, <code>null</code> if there is no object with the given name in the specified searchOrder contexts.
*/
public abstract Object get(String name, String[] searchOrder);
+
+ public abstract Object get(String name,String[] searchOrder, boolean nullAllowed) throws JbpmException;
+
+ public abstract Object get(String name, boolean nullAllowed) throws JbpmException;
/** searches an object based on type. The search doesn take superclasses of the context elements
* into account.
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/JuelScriptEngine.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/JuelScriptEngine.java 2010-05-14 02:23:28 UTC (rev 6340)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/JuelScriptEngine.java 2010-05-14 02:41:49 UTC (rev 6341)
@@ -21,15 +21,39 @@
*/
package org.jbpm.pvm.internal.script;
-import de.odysseus.el.util.SimpleResolver;
-
-import javax.el.*;
-import javax.script.*;
import java.io.IOException;
import java.io.Reader;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.util.Properties;
+import javax.el.ArrayELResolver;
+import javax.el.BeanELResolver;
+import javax.el.CompositeELResolver;
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.el.FunctionMapper;
+import javax.el.ListELResolver;
+import javax.el.MapELResolver;
+import javax.el.ResourceBundleELResolver;
+import javax.el.ValueExpression;
+import javax.el.VariableMapper;
+import javax.script.AbstractScriptEngine;
+import javax.script.Bindings;
+import javax.script.Compilable;
+import javax.script.CompiledScript;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineFactory;
+import javax.script.ScriptException;
+import javax.script.SimpleBindings;
+
+import org.jbpm.pvm.internal.env.ExecutionContext;
+
+import de.odysseus.el.util.SimpleResolver;
+
class JuelScriptEngine extends AbstractScriptEngine
implements Compilable
{
@@ -369,8 +393,16 @@
return exprFactory.createValueExpression(
value, Object.class);
+ } else {
+ // to support null value for existing variables
+ Bindings b = this.ctx.getBindings(ScriptContext.ENGINE_SCOPE);
+ ExecutionContext execContext = (ExecutionContext) ((EnvironmentBindings) b).environment.getContext("execution");
+ // if variable name exist then set value expression as null
+ // since it was not discovered by attribute scope method
+ if (execContext.getExecution().getVariables().containsKey(variable)) {
+ return exprFactory.createValueExpression(null, Object.class);
+ }
}
-
return null;
}
Added: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/UelExpressionTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/UelExpressionTest.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/expr/UelExpressionTest.java 2010-05-14 02:41:49 UTC (rev 6341)
@@ -0,0 +1,54 @@
+/*
+ * 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.pvm.internal.expr;
+
+import org.jbpm.pvm.activities.WaitState;
+import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
+
+import org.jbpm.pvm.internal.el.Expression;
+import org.jbpm.pvm.internal.el.UelValueExpression;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class UelExpressionTest extends JbpmTestCase {
+
+ public void testUelExpression() {
+ ExecutionImpl execution = (ExecutionImpl) ProcessDefinitionBuilder
+ .startProcess()
+ .startActivity("initial", new WaitState())
+ .initial()
+ .endActivity()
+ .endProcess()
+ .startProcessInstance();
+
+ Expression expression = Expression.create("#{pv}", Expression.LANGUAGE_UEL_VALUE);
+ UelValueExpression uve = ((UelValueExpression) expression);
+
+ execution.setVariable("pv", null);
+
+ assertEquals(null, uve.evaluate(execution));
+ }
+}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/VariableExpressionTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/VariableExpressionTest.java 2010-05-14 02:23:28 UTC (rev 6340)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/variables/VariableExpressionTest.java 2010-05-14 02:41:49 UTC (rev 6341)
@@ -27,6 +27,7 @@
import java.util.HashMap;
import java.util.Map;
+import org.jbpm.api.JbpmException;
import org.jbpm.api.ProcessInstance;
import org.jbpm.api.activity.ActivityBehaviour;
import org.jbpm.api.activity.ActivityExecution;
@@ -35,6 +36,7 @@
/**
* @author Joram Barrez
+ * @author Maciej Swiderski
*/
public class VariableExpressionTest extends JbpmTestCase {
@@ -72,7 +74,77 @@
assertEquals(new Integer(10), counter);
}
+ public void testNullValueExpression() {
+ deployJpdlXmlString(
+ "<process name='theProcess'>" +
+ " <start name='theStart'>" +
+ " <transition to='decideToGoFurther' />" +
+ " </start>" +
+ " <custom name='incrementCounter' class='" + MyJavaActivity.class.getName() + "'>" +
+ " <transition to='decideToGoFurther' />" +
+ " </custom>" +
+ " <decision name='decideToGoFurther'>" +
+ " <transition to='waitHere'>" +
+ " <condition expr='#{counter==null}' />" +
+ " </transition>" +
+ " <transition to='incrementCounter'>" +
+ " <condition expr='#{counter < 10}' />" +
+ " </transition>" +
+ " </decision>" +
+ " <state name='waitHere'>" +
+ " <transition to='theEnd' />" +
+ " </state>" +
+ " <end name='theEnd' />" +
+ "</process>"
+ );
+
+ Map<String, Object> vars = new HashMap<String, Object>();
+ vars.put("counter", null);
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("theProcess", vars);
+ assertActivityActive(processInstance.getId(), "waitHere");
+
+ Object value = executionService.getVariable(processInstance.getId(), "counter");
+ assertEquals(null, value);
+ }
+ public void testMissingVariableExpression() {
+ deployJpdlXmlString(
+ "<process name='theProcess'>" +
+ " <start name='theStart'>" +
+ " <transition to='decideToGoFurther' />" +
+ " </start>" +
+ " <custom name='incrementCounter' class='" + MyJavaActivity.class.getName() + "'>" +
+ " <transition to='decideToGoFurther' />" +
+ " </custom>" +
+ " <decision name='decideToGoFurther'>" +
+ " <transition to='waitHere'>" +
+ " <condition expr='#{counter==null}' />" +
+ " </transition>" +
+ " <transition to='incrementCounter'>" +
+ " <condition expr='#{counter < 10}' />" +
+ " </transition>" +
+ " </decision>" +
+ " <state name='waitHere'>" +
+ " <transition to='theEnd' />" +
+ " </state>" +
+ " <end name='theEnd' />" +
+ "</process>"
+ );
+
+ Map<String, Object> vars = new HashMap<String, Object>();
+ try {
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("theProcess", vars);
+
+ fail("Variable counter is not set, should fail");
+ } catch (JbpmException e) {
+
+ assertTrue(e.getMessage().indexOf("Cannot find property counter") != -1);
+ }
+
+ }
+
+
public static class MyJavaActivity implements ActivityBehaviour {
private static final long serialVersionUID = 1L;
15 years, 11 months
JBoss JBPM SVN: r6340 - in jbpm4/trunk/modules: test-db/src/test/java/org/jbpm/test/query and 1 other directories.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-05-13 22:23:28 -0400 (Thu, 13 May 2010)
New Revision: 6340
Added:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TimerTransitionAsLoopTest.java
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DatabaseIdComposer.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryActivityInstanceQueryTest.java
Log:
JBPM-2794 change DatabaseIdComposer' behaviour to solve this issue
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DatabaseIdComposer.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DatabaseIdComposer.java 2010-05-14 02:15:20 UTC (rev 6339)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DatabaseIdComposer.java 2010-05-14 02:23:28 UTC (rev 6340)
@@ -52,7 +52,7 @@
executionPart = execution.getKey();
} else if (execution.getName()!=null) {
- executionPart = execution.getName();
+ executionPart = execution.getName() + '.' + Long.toString(execution.getDbid());
} else {
executionPart = Long.toString(execution.getDbid());
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryActivityInstanceQueryTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryActivityInstanceQueryTest.java 2010-05-14 02:15:20 UTC (rev 6339)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryActivityInstanceQueryTest.java 2010-05-14 02:23:28 UTC (rev 6340)
@@ -341,7 +341,7 @@
// last check execution ids to illustrate that for task with timer it is not same as process instance id
assertEquals(ids.get(0), history.get(0).getExecutionId());
- assertEquals(ids.get(0) + ".b", history.get(1).getExecutionId());
+ assertTrue(history.get(1).getExecutionId().startsWith(ids.get(0) + ".b."));
assertEquals(ids.get(0), history.get(2).getExecutionId());
}
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TimerTransitionAsLoopTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TimerTransitionAsLoopTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TimerTransitionAsLoopTest.java 2010-05-14 02:23:28 UTC (rev 6340)
@@ -0,0 +1,122 @@
+/*
+ * 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.timer;
+
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.activity.ExternalActivityBehaviour;
+import org.jbpm.api.job.Job;
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.listener.EventListenerExecution;
+import org.jbpm.pvm.internal.util.Clock;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ */
+public class TimerTransitionAsLoopTest extends JbpmTestCase {
+
+ private static final String TEST_PROCESS_TIMER =
+ "<process name='TimerTransitionAsLoop' xmlns='http://jbpm.org/4.3/jpdl'>"
+ +" <start name='start1' g='8,77,48,48'>"
+ +" <transition name='to wait' to='wait for status' g='-24,-18'/>"
+ +" </start>"
+ +" <state name='wait for status' g='134,75,112,52'>"
+ +" <transition name='to get status' to='get status' g='-45,-18'>"
+ +" <timer duedate='2 minutes'/>"
+ +" </transition>"
+ +" </state>"
+ +" <script g='333,80,92,52' name='get status' expr='#{true}' var='status'>"
+ +" <transition name='transition 1' g='261,198:-17,-3' to='wait for status'/>"
+ +" </script>"
+ +"</process>";
+
+ public void testTimerTransitionAsLoop() {
+ deployJpdlXmlString(TEST_PROCESS_TIMER);
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("TimerTransitionAsLoop");
+
+ Job job = managementService.createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .uniqueResult();
+
+ managementService.executeJob(job.getId());
+ }
+
+ private static final String TEST_TIMER_TRANSITION_SELF = ""
+ + "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<process name='TimerTransition' xmlns='http://jbpm.org/4.3/jpdl'>"
+ + " <start g='19,50,48,48'>"
+ + " <transition to='guardedWait' />"
+ + " </start>"
+ + " <state name='guardedWait' g='98,46,127,52'>"
+ + " <transition name='go on' to='next step' g='-16,-17'/>"
+ + " <transition name='timeout' to='escalation' g='-43,-16'>"
+ + " <timer duedate='1 hour' />"
+ + " </transition>"
+ + " <transition name='selft' to='guardedWait' />"
+ + " </state>"
+ + " <state name='next step' g='283,46,83,53'/>"
+ + " <state name='escalation' g='118,140,88,52' />"
+ + "</process>";
+
+ public void testTimerTransitionContinueBeforeTimerFires() {
+ deployJpdlXmlString(TEST_TIMER_TRANSITION_SELF);
+
+ ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("TimerTransition");
+
+ String executionId = processInstance.findActiveExecutionIn("guardedWait").getId();
+
+ // goto self activity
+ executionService.signalExecutionById(executionId, "selft");
+
+ // retrieve process instance
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+
+ // retrieve execution id
+ executionId = processInstance.findActiveExecutionIn("guardedWait").getId();
+
+ // signal to next step
+ executionService.signalExecutionById(executionId, "go on");
+
+ // retrieve process instance
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+
+ assertTrue(processInstance.isActive("next step"));
+
+ // verify there is not any jobs any more
+ List<Job> jobs = managementService.createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .list();
+
+ assertEquals(new ArrayList<Job>(), new ArrayList<Job>(jobs));
+ }
+
+}
15 years, 11 months
JBoss JBPM SVN: r6339 - in jbpm4/trunk/modules/pvm/src: test/java/org/jbpm/pvm/internal and 1 other directories.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-05-13 22:15:20 -0400 (Thu, 13 May 2010)
New Revision: 6339
Added:
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/task/
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/task/TaskImplTest.java
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
Log:
JBPM-2750 delete duplicated state field of TaskImpl
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2010-05-14 02:07:20 UTC (rev 6338)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2010-05-14 02:15:20 UTC (rev 6339)
@@ -71,8 +71,6 @@
protected int priority = Priority.NORMAL;
- protected String state = Task.STATE_OPEN;
-
protected String taskDefinitionName;
protected TaskDefinitionImpl taskDefinition;
@@ -94,6 +92,7 @@
protected Long superTaskDbid;
public TaskImpl() {
+ this.state = Task.STATE_OPEN;
}
// parent for variable lookup ///////////////////////////////////////////////
@@ -395,10 +394,6 @@
this.execution = (ExecutionImpl) execution;
}
- public String getState() {
- return state;
- }
-
public String getAssignee() {
return assignee;
}
@@ -443,10 +438,6 @@
this.participations = participations;
}
- public void setState(String state) {
- this.state = state;
- }
-
public String getExecutionId() {
return executionId;
}
Added: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/task/TaskImplTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/task/TaskImplTest.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/task/TaskImplTest.java 2010-05-14 02:15:20 UTC (rev 6339)
@@ -0,0 +1,31 @@
+
+package org.jbpm.pvm.internal.task;
+
+import junit.framework.TestCase;
+import org.jbpm.api.task.Task;
+import org.jbpm.pvm.internal.task.TaskImpl;
+
+public class TaskImplTest extends TestCase {
+ public void testSuspend() {
+ TaskImpl task = new TaskImpl();
+ assertEquals(Task.STATE_OPEN, task.getState());
+
+ task.suspend();
+ assertEquals(Task.STATE_SUSPENDED, task.getState());
+ assertFalse(task.isCompleted());
+
+ task.resume();
+ assertEquals(Task.STATE_OPEN, task.getState());
+ }
+
+ public void testState() {
+ TaskImpl task = new TaskImpl();
+ assertEquals(Task.STATE_OPEN, task.getState());
+
+ task.setState(Task.STATE_COMPLETED);
+
+ assertEquals(Task.STATE_COMPLETED, task.getState());
+ assertTrue(task.isCompleted());
+ }
+
+}
15 years, 11 months
JBoss JBPM SVN: r6338 - in jbpm4/trunk/modules: examples/src/test/java/org/jbpm/examples/timer/businesstime and 2 other directories.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-05-13 22:07:20 -0400 (Thu, 13 May 2010)
New Revision: 6338
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/job/Job.java
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/businesstime/TimerBusinessTimeTest.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java
Log:
add annotation for deprecated method, and let TimerBusinessTimeTest not use deprecated method getDueDate().
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/job/Job.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/job/Job.java 2010-05-14 01:47:57 UTC (rev 6337)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/job/Job.java 2010-05-14 02:07:20 UTC (rev 6338)
@@ -40,6 +40,7 @@
/** in case this is a timer, it is the time that the timer should fire, in case this
* is a message, it is null.
* @deprecated */
+ @Deprecated
Date getDueDate();
/** in case this is a timer, it is the time that the timer should fire, in case this
Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/businesstime/TimerBusinessTimeTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/businesstime/TimerBusinessTimeTest.java 2010-05-14 01:47:57 UTC (rev 6337)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/businesstime/TimerBusinessTimeTest.java 2010-05-14 02:07:20 UTC (rev 6338)
@@ -58,7 +58,7 @@
.processInstanceId(processInstance.getId())
.uniqueResult();
- long difference = job.getDueDate().getTime() - now;
+ long difference = job.getDuedate().getTime() - now;
// we do not know when this test will be run. So the exact actual duedate of the timer
// can not be calculated easily. But we do know for sure that each working day only
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java 2010-05-14 01:47:57 UTC (rev 6337)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java 2010-05-14 02:07:20 UTC (rev 6338)
@@ -149,6 +149,7 @@
return lockOwner;
}
/** @deprecated */
+ @Deprecated
public Date getDueDate() {
return getDuedate();
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java 2010-05-14 01:47:57 UTC (rev 6337)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java 2010-05-14 02:07:20 UTC (rev 6338)
@@ -272,6 +272,7 @@
/** creates a new Parser with bindings and entities that can be maintained statically
* in specialized subclasses of Parser.
* @deprecated entities should be replaced by {@link #setSchemaResources(List)} */
+ @Deprecated
public Parser(Bindings bindings, Map<String, Entity> entities) {
initialize();
this.bindings = bindings;
15 years, 11 months
JBoss JBPM SVN: r6337 - jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-05-13 21:47:57 -0400 (Thu, 13 May 2010)
New Revision: 6337
Added:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/AssignmentHandlerTest.java
Log:
JBPM-2758 already fixed by Ronald in Revision 6100, just add a testcase to verify
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/AssignmentHandlerTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/AssignmentHandlerTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/AssignmentHandlerTest.java 2010-05-14 01:47:57 UTC (rev 6337)
@@ -0,0 +1,163 @@
+package org.jbpm.test.task;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jbpm.api.Configuration;
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.TaskService;
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.api.task.Assignable;
+import org.jbpm.api.task.AssignmentHandler;
+import org.jbpm.api.task.Participation;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+public class AssignmentHandlerTest extends JbpmTestCase {
+
+ /** Deployment id. */
+ String deploymentId;
+
+ /**
+ * Set up.
+ * @throws Exception exception
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ // XML definition
+ StringBuilder jpdl = new StringBuilder();
+ jpdl.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+ jpdl.append("<process key=\"testProcess\" name=\"Test Process\" xmlns=\"http://jbpm.org/4.3/jpdl\">");
+ jpdl.append(" <start g=\"67,236,48,48\" name=\"start1\">");
+ jpdl.append(" <transition g=\"-43,-18\" name=\"to fork1\" to=\"fork1\"/>");
+ jpdl.append(" </start>");
+ jpdl.append(" <task g=\"255,144,92,52\" name=\"task1\" candidate-groups=\"firstGroup\">");
+ jpdl.append(" <assignment-handler class=\"org.jbpm.test.task.AssignmentHandlerTest$AutoAssignment\"/>");
+ jpdl.append(" <transition g=\"-41,-18\" name=\"to join1\" to=\"join1\"/>");
+ jpdl.append(" </task>");
+ jpdl.append(" <task g=\"258,334,92,52\" name=\"task2\" candidate-groups=\"secondGroup\">");
+ jpdl.append(" <assignment-handler class=\"org.jbpm.test.task.AssignmentHandlerTest$AutoAssignment\"/>");
+ jpdl.append(" <transition g=\"-41,-18\" name=\"to join1\" to=\"join1\"/>");
+ jpdl.append(" </task>");
+ jpdl.append(" <task g=\"515,228,92,52\" name=\"task3\" candidate-groups=\"thirdGroup\">");
+ jpdl.append(" <assignment-handler class=\"org.jbpm.test.task.AssignmentHandlerTest$AutoAssignment\"/>");
+ jpdl.append(" <transition g=\"-42,-18\" name=\"to end1\" to=\"end1\"/>");
+ jpdl.append(" </task>");
+ jpdl.append(" <end g=\"676,232,48,48\" name=\"end1\"/>");
+ jpdl.append(" <fork g=\"172,236,48,48\" name=\"fork1\">");
+ jpdl.append(" <transition g=\"-44,-18\" name=\"to task1\" to=\"task1\"/>");
+ jpdl.append(" <transition g=\"-44,-18\" name=\"to task2\" to=\"task2\"/>");
+ jpdl.append(" </fork>");
+ jpdl.append(" <join g=\"385,233,48,48\" name=\"join1\">");
+ jpdl.append(" <transition g=\"-44,-18\" name=\"to task3\" to=\"task3\"/>");
+ jpdl.append(" </join>");
+ jpdl.append("</process>");
+
+ // Deploys the process
+ deploymentId =
+ repositoryService.createDeployment().addResourceFromString("testProcess.jpdl.xml", jpdl.toString())
+ .deploy();
+ }
+
+ /**
+ * Tear down.
+ * @throws Exception exception
+ */
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ super.tearDown();
+ }
+
+ /**
+ * Tests the process.
+ */
+ public void testProcess() {
+
+ // Starts a new process instance and gets the instance id
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("testProcess");
+ String pid = processInstance.getId();
+
+ // Gets the tasks auto-assigned for the first user and completes the task
+ List < Task > taskList = taskService.findPersonalTasks("firstUser");
+ assertEquals(1, taskList.size());
+ Task task = taskList.get(0);
+ taskService.completeTask(task.getId());
+
+ // Gets the tasks auto-assigned for the second user and completes the task
+ taskList = taskService.findPersonalTasks("secondUser");
+ assertEquals(1, taskList.size());
+ task = taskList.get(0);
+ taskService.completeTask(task.getId());
+
+ // Gets the tasks auto-assigned for the second user and completes the task
+ taskList = taskService.findPersonalTasks("thirdUser");
+ assertEquals(1, taskList.size());
+ task = taskList.get(0);
+ taskService.completeTask(task.getId());
+
+ // Tries to load the instance and checks if it was finished
+ processInstance = executionService.findProcessInstanceById(pid);
+ assertNull(processInstance);
+ }
+
+ /**
+ * Auto assignment class.
+ */
+ public static class AutoAssignment implements AssignmentHandler {
+
+ /** Serial version ID. */
+ private static final long serialVersionUID = 9063679883107908899L;
+
+ /**
+ * Auto-claim the task to the default user.
+ * @param assignable assignable object
+ * @param execution execution object
+ * @throws Exception exception
+ */
+ public void assign(Assignable assignable, OpenExecution execution) throws Exception {
+
+ // Default users (group --> user mapping)
+ Map < String, String > defaultUsers = new HashMap < String, String >();
+ defaultUsers.put("firstGroup", "firstUser");
+ defaultUsers.put("secondGroup", "secondUser");
+ defaultUsers.put("thirdGroup", "thirdUser");
+
+ // Engine and task service
+ ProcessEngine processEngine = new Configuration().buildProcessEngine();
+ TaskService taskService = processEngine.getTaskService();
+
+ // Loads the active activities
+ Set < String > activities = execution.findActiveActivityNames();
+
+ // Iterates the activities
+ for (String activity : activities) {
+
+ // Loads the tasks according to the process instance and activity name
+ List < Task > tasks =
+ taskService.createTaskQuery().activityName(activity).processInstanceId(
+ execution.getProcessInstance().getId()).list();
+
+ // Iterates the tasks
+ for (Task task : tasks) {
+
+ // Compares the task name to the activity name
+ // If the task name matches the activity name, loads the candidate-group and assigns the default user
+ if (task.getName().equals(activity)) {
+
+ // Loads the tasks candidate groups (in our process we have just one group)
+ List < Participation > groups = taskService.getTaskParticipations(task.getId());
+
+ // If the groups collection is not empty, loads the default user and sets in the task
+ if (!groups.isEmpty()) {
+ assignable.setAssignee(defaultUsers.get(groups.get(0).getGroupId()));
+ }
+ }
+ }
+ }
+ }
+ }
+}
15 years, 11 months
JBoss JBPM SVN: r6336 - in jbpm4/trunk/modules: test-db/src/test/java/org/jbpm/test/task and 1 other directory.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-05-13 01:11:53 -0400 (Thu, 13 May 2010)
New Revision: 6336
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskPropertiesTest.java
Log:
JBPM-2755 let description of task provide el
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2010-05-13 00:59:27 UTC (rev 6335)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2010-05-13 05:11:53 UTC (rev 6336)
@@ -489,7 +489,7 @@
Element descriptionElement = XmlUtil.element(element, "description");
if (descriptionElement!=null) {
String descriptionText = XmlUtil.getContentText(descriptionElement);
- Expression descriptionExpression = Expression.create(descriptionText, Expression.LANGUAGE_UEL);
+ Expression descriptionExpression = Expression.create(descriptionText, Expression.LANGUAGE_UEL_VALUE);
assignableDefinition.setDescription(descriptionExpression);
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskPropertiesTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskPropertiesTest.java 2010-05-13 00:59:27 UTC (rev 6335)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/TaskPropertiesTest.java 2010-05-13 05:11:53 UTC (rev 6336)
@@ -24,6 +24,9 @@
*/
package org.jbpm.test.task;
+import java.util.HashMap;
+import java.util.Map;
+
import org.jbpm.api.ProcessDefinition;
import org.jbpm.api.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -33,6 +36,7 @@
* Testcase to check if properties can be resolved through a {@link Task}.
*
* @author Joram Barrez
+ * @author Ronald van Kuijk
*/
public class TaskPropertiesTest extends JbpmTestCase {
@@ -50,6 +54,7 @@
" <transition to='work hard for the money' />" +
" </fork>" +
" <task name='select destination' assignee='" + ACTOR + "'>" +
+ " <description>Description for 'select destination' with #{timeframe}</description>" +
" <transition to='wait' />" +
" </task>" +
" <task name='work hard for the money' assignee='" + ACTOR2 + "_not_the_same'>" +
@@ -62,6 +67,11 @@
Task task = startProcessInstanceAndReturnTaskFor(ACTOR);
assertEquals("select destination", task.getActivityName());
}
+
+ public void testGetDescription() {
+ Task task = startProcessInstanceAndReturnTaskFor(ACTOR);
+ assertEquals("Description for 'select destination' with Springbreak", task.getDescription());
+ }
public void testGetProcessDefinitionThroughTask() {
Task task = startProcessInstanceAndReturnTaskFor(ACTOR);
@@ -75,7 +85,10 @@
private Task startProcessInstanceAndReturnTaskFor(String actor) {
deployJpdlXmlString(PROCESS);
- executionService.startProcessInstanceByKey("VacationTrip");
+ Map<String, String> vars = new HashMap<String, String>();
+ vars.put("timeframe", "Springbreak");
+ executionService.startProcessInstanceByKey("VacationTrip", vars);
+
return taskService.findPersonalTasks(actor).get(0);
}
15 years, 11 months
JBoss JBPM SVN: r6335 - in jbpm4/trunk/modules: test-db/src/test/java/org/jbpm/test/activity/task and 1 other directory.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-05-12 20:59:27 -0400 (Wed, 12 May 2010)
New Revision: 6335
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskSwimlaneTest.java
Log:
JBPM-2860 Thank you Michael for patch and testcase.
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 2010-05-13 00:45:29 UTC (rev 6334)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2010-05-13 00:59:27 UTC (rev 6335)
@@ -837,6 +837,12 @@
public SwimlaneImpl getInitializedSwimlane(SwimlaneDefinitionImpl swimlaneDefinition) {
String swimlaneName = swimlaneDefinition.getName();
SwimlaneImpl swimlane = swimlanes.get(swimlaneName);
+
+ // lookup in parent execution
+ if ((swimlane == null) && (parent != null)) {
+ swimlane = parent.getInitializedSwimlane(swimlaneDefinition);
+ }
+
if (swimlane==null) {
swimlane = createSwimlane(swimlaneName);
initializeAssignments(swimlaneDefinition, swimlane);
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskSwimlaneTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskSwimlaneTest.java 2010-05-13 00:45:29 UTC (rev 6334)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/task/TaskSwimlaneTest.java 2010-05-13 00:59:27 UTC (rev 6335)
@@ -23,6 +23,7 @@
import java.util.List;
+import org.jbpm.api.ProcessInstance;
import org.jbpm.api.task.Task;
import org.jbpm.test.JbpmTestCase;
@@ -94,4 +95,36 @@
assertEquals(0, executionService.createProcessInstanceQuery().count());
assertEquals(0, taskService.createTaskQuery().count());
}
+
+ public void testTaskParse() {
+ deployJpdlXmlString(
+ "<process name='Swimlane' xmlns='http://jbpm.org/4.3/jpdl'>"
+ + "<swimlane name='user'/>"
+ + "<start g='168,19,48,48' name='start1'>"
+ + " <transition g='-61,-18' name='to FirstTask' to='FirstTask'/>"
+ + "</start>"
+ + "<task g='155,86,92,52' name='FirstTask' swimlane='user'>"
+ + " <transition g='-64,-18' name='to timerTask' to='timerTask'/>"
+ + "</task>"
+ + "<task g='157,228,92,52' name='timerTask' swimlane='user'>"
+ + " <transition g='-42,-18' name='to end1' to='end1'>"
+ + " <timer duedate='30 seconds' />"
+ + " </transition>"
+ + "</task>"
+ + "<end g='176,330,48,48' name='end1'/>"
+ + "</process>");
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("Swimlane");
+ Task firstTask = taskService.createTaskQuery().processInstanceId(processInstance.getId()).uniqueResult();
+
+ taskService.assignTask(firstTask.getId(), "alex");
+ firstTask = taskService.getTask(firstTask.getId());
+ assertEquals("alex", firstTask.getAssignee());
+ assertEquals("FirstTask", firstTask.getName());
+ taskService.completeTask(firstTask.getId());
+
+ Task timerTask = taskService.createTaskQuery().processInstanceId(processInstance.getId()).uniqueResult();
+ assertEquals("timerTask", timerTask.getName());
+ assertEquals("alex", timerTask.getAssignee());
+ }
}
15 years, 11 months
JBoss JBPM SVN: r6334 - jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-05-12 20:45:29 -0400 (Wed, 12 May 2010)
New Revision: 6334
Added:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/ExceptionTaskTest.java
Log:
JBPM-2535 add a testcase for verify this scenario is no problem.
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/ExceptionTaskTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/ExceptionTaskTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/task/ExceptionTaskTest.java 2010-05-13 00:45:29 UTC (rev 6334)
@@ -0,0 +1,61 @@
+package org.jbpm.test.task;
+
+import java.util.*;
+
+import org.jbpm.api.*;
+import org.jbpm.api.job.*;
+import org.jbpm.api.task.*;
+
+import org.jbpm.test.*;
+
+
+public class ExceptionTaskTest extends JbpmTestCase {
+ protected void setUp() throws Exception {
+ super.setUp();
+ identityService.createUser("johnsmith", "johnsmith", "johnsmith");
+ deployJpdlXmlString(
+ "<process name='X10ExceptionTaskTest' xmlns='http://jbpm.org/4.3/jpdl'>"
+ + " <start name='start1' g='93,78,48,48' continue='async'>"
+ + " <transition name='to Test Task' to='Test Task' g='1,-20'/>"
+ + " </start>" + " <end name='end1' g='315,236,48,48'/>"
+ + " <task name='Test Task' g='178,159,92,52' assignee='johnsmith'>"
+ + " <notification>" + " <to users='${task.assignee}'/>"
+ + " <cc addresses='invalid@email@address'/>"
+ + " <subject>${task.name}</subject>" + " <text>"
+ + " <![CDATA[Hi ${task.assignee},"
+ + " Task '${task.name}' has been assigned to you."
+ + " ${task.description}" + " Sent by JBoss jBPM"
+ + " ]]>" + " </text>" + " </notification>"
+ + " <transition name='to end1' to='end1' g='-6,-22'/>"
+ + " </task>" + "</process>");
+ }
+
+ protected void tearDown() throws Exception {
+ identityService.deleteUser("johnsmith");
+ super.tearDown();
+ }
+
+ public void testDefault() throws Exception {
+ ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("X10ExceptionTaskTest");
+ String processInstanceId = processInstance.getId();
+ int retries = 0;
+
+ while (retries < 3) {
+ retries++;
+
+ try {
+ List<Job> jobs = managementService.createJobQuery().list();
+ Job job = jobs.get(0);
+ managementService.executeJob(job.getId());
+
+ break;
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ }
+
+ List<Task> tasks = taskService.createTaskQuery().list();
+ assertEquals(0, tasks.size());
+ }
+}
15 years, 11 months