JBoss JBPM SVN: r6374 - in jbpm4/trunk/modules: examples/src/test/java/org/jbpm/examples/subprocess/outcomeobject and 6 other directories.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-05-24 23:45:03 -0400 (Mon, 24 May 2010)
New Revision: 6374
Added:
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomeobject/
jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomeobject/SubProcessOutcomeObjectTest.java
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeobject/
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeobject/SubProcessDocument.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeobject/SubProcessReview.jpdl.xml
Modified:
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeactivity/SubProcessReview.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomevalue/SubProcessReview.jpdl.xml
jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/variables/SubProcessReview.jpdl.xml
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
Log:
JBPM-2864 correct subprocess outcome value which type is not string.
Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomeobject/SubProcessOutcomeObjectTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomeobject/SubProcessOutcomeObjectTest.java (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/subprocess/outcomeobject/SubProcessOutcomeObjectTest.java 2010-05-25 03:45:03 UTC (rev 6374)
@@ -0,0 +1,126 @@
+/*
+ * 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.examples.subprocess.outcomeobject;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.collections.map.HashedMap;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SubProcessOutcomeObjectTest extends JbpmTestCase {
+
+ String subProcessReviewDeploymentId;
+ String subProcessDocumentDeploymentId;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ subProcessReviewDeploymentId = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/subprocess/outcomeobject/SubProcessReview.jpdl.xml")
+ .deploy();
+
+ subProcessDocumentDeploymentId = repositoryService.createDeployment()
+ .addResourceFromClasspath("org/jbpm/examples/subprocess/outcomeobject/SubProcessDocument.jpdl.xml")
+ .deploy();
+ }
+
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(subProcessReviewDeploymentId);
+ repositoryService.deleteDeploymentCascade(subProcessDocumentDeploymentId);
+
+ super.tearDown();
+ }
+
+ public void testSubProcessResultOk() {
+ ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("SubProcessDocument");
+
+ assertNotNull(processInstance.findActiveExecutionIn("review"));
+
+ List<Task> taskList = taskService.findPersonalTasks("johndoe");
+ Task task = taskList.get(0);
+
+ // the result variable is set in the task
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("result", 100);
+ taskService.setVariables(task.getId(), variables);
+
+ // the task in the sub process instance is completed
+ taskService.completeTask(task.getId());
+
+ // we check that the process instance has moved to the next step
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ assertNotNull(processInstance.findActiveExecutionIn("next step"));
+ }
+
+ public void testSubProcessResultNok() {
+ ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("SubProcessDocument");
+
+ assertNotNull(processInstance.findActiveExecutionIn("review"));
+
+ List<Task> taskList = taskService.findPersonalTasks("johndoe");
+ Task task = taskList.get(0);
+
+ // the result variable is set in the task
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("result", 200);
+ taskService.setVariables(task.getId(), variables);
+
+ // the task in the sub process instance is completed
+ taskService.completeTask(task.getId());
+
+ // we check that the process instance has moved to update
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ assertNotNull(processInstance.findActiveExecutionIn("update"));
+ }
+
+ public void testSubProcessResultReject() {
+ ProcessInstance processInstance = executionService
+ .startProcessInstanceByKey("SubProcessDocument");
+
+ assertNotNull(processInstance.findActiveExecutionIn("review"));
+
+ List<Task> taskList = taskService.findPersonalTasks("johndoe");
+ Task task = taskList.get(0);
+
+ // the result variable is set in the task
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("result", 300);
+ taskService.setVariables(task.getId(), variables);
+
+ // the task in the sub process instance is completed
+ taskService.completeTask(task.getId());
+
+ // we check that the process instance has moved to close
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ assertNotNull(processInstance.findActiveExecutionIn("close"));
+ }
+}
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeactivity/SubProcessReview.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeactivity/SubProcessReview.jpdl.xml 2010-05-24 04:50:26 UTC (rev 6373)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeactivity/SubProcessReview.jpdl.xml 2010-05-25 03:45:03 UTC (rev 6374)
@@ -1,22 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
+<process name="SubProcessReview" xmlns="http://jbpm.org/4.3/jpdl">
-<process name="SubProcessReview" xmlns="http://jbpm.org/4.3/jpdl">
-
- <start g="25,101,48,48">
- <transition to="get approval"/>
- </start>
-
+ <start g="25,101,48,48">
+ <transition to="get approval"/>
+ </start>
+
<task name="get approval"
- assignee="johndoe"
- g="107,97,127,52">
-
+ assignee="johndoe"
+ g="107,97,127,52">
+
<transition name="ok" to="ok" g="171,71:9,-16"/>
<transition name="nok" to="nok" g="-16,-16"/>
<transition name="reject" to="reject" g="170,179:8,3"/>
- </task>
-
+ </task>
+
<end name="ok" g="269,48,88,52" />
<end name="nok" g="270,101,88,52" />
<end name="reject" g="270,156,88,52"/>
-
</process>
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeobject/SubProcessDocument.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeobject/SubProcessDocument.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeobject/SubProcessDocument.jpdl.xml 2010-05-25 03:45:03 UTC (rev 6374)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="SubProcessDocument" xmlns="http://jbpm.org/4.3/jpdl">
+
+ <start g="36,109,48,48">
+ <transition to="review" />
+ </start>
+
+ <sub-process name="review"
+ sub-process-key="SubProcessReview"
+ outcome="#{result}"
+ g="118,106,99,52">
+
+ <transition name="ok" to="next step" g="167,67:6,-19">
+ <outcome-value>
+ <int value="100"/>
+ </outcome-value>
+ </transition>
+ <transition name="nok" to="update" g="-22,-18">
+ <outcome-value>
+ <int value="200"/>
+ </outcome-value>
+ </transition>
+ <transition name="reject" to="close" g="167,200:7,3">
+ <outcome-value>
+ <int value="300"/>
+ </outcome-value>
+ </transition>
+ </sub-process>
+
+ <state name="next step" g="255,41,88,52"/>
+ <state name="update" g="256,106,88,52"/>
+ <state name="close" g="258,175,88,52"/>
+
+</process>
Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeobject/SubProcessReview.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeobject/SubProcessReview.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomeobject/SubProcessReview.jpdl.xml 2010-05-25 03:45:03 UTC (rev 6374)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<process name="SubProcessReview" xmlns="http://jbpm.org/4.3/jpdl">
+
+ <start g="20,20,48,48">
+ <transition to="get approval"/>
+ </start>
+
+ <task name="get approval"
+ assignee="johndoe"
+ g="96,16,127,52">
+
+ <transition to="end"/>
+ </task>
+
+ <end name="end" g="254,19,88,52" />
+
+</process>
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomevalue/SubProcessReview.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomevalue/SubProcessReview.jpdl.xml 2010-05-24 04:50:26 UTC (rev 6373)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/outcomevalue/SubProcessReview.jpdl.xml 2010-05-25 03:45:03 UTC (rev 6374)
@@ -1,18 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
+<process name="SubProcessReview" xmlns="http://jbpm.org/4.3/jpdl">
-<process name="SubProcessReview" xmlns="http://jbpm.org/4.3/jpdl">
-
- <start g="20,20,48,48">
- <transition to="get approval"/>
- </start>
-
+ <start g="20,20,48,48">
+ <transition to="get approval"/>
+ </start>
+
<task name="get approval"
- assignee="johndoe"
- g="96,16,127,52">
-
- <transition to="end"/>
- </task>
-
- <end name="end" g="254,19,88,52" />
-
+ assignee="johndoe"
+ g="96,16,127,52">
+
+ <transition to="end"/>
+ </task>
+
+ <end name="end" g="254,19,88,52" />
+
</process>
\ No newline at end of file
Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/variables/SubProcessReview.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/variables/SubProcessReview.jpdl.xml 2010-05-24 04:50:26 UTC (rev 6373)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/subprocess/variables/SubProcessReview.jpdl.xml 2010-05-25 03:45:03 UTC (rev 6374)
@@ -1,18 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
+<process name="SubProcessReview" xmlns="http://jbpm.org/4.3/jpdl">
-<process name="SubProcessReview" xmlns="http://jbpm.org/4.3/jpdl">
-
- <start g="20,20,48,48">
- <transition to="get approval"/>
- </start>
-
+ <start g="20,20,48,48">
+ <transition to="get approval"/>
+ </start>
+
<task name="get approval"
- assignee="johndoe"
- g="96,16,127,52">
-
- <transition to="end"/>
- </task>
-
- <end name="end" g="254,19,88,52" />
-
+ assignee="johndoe"
+ g="96,16,127,52">
+
+ <transition to="end"/>
+ </task>
+
+ <end name="end" g="254,19,88,52" />
+
</process>
\ No newline at end of file
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java 2010-05-24 04:50:26 UTC (rev 6373)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java 2010-05-25 03:45:03 UTC (rev 6374)
@@ -47,13 +47,13 @@
public Object parseJpdl(Element element, Parse parse, JpdlParser parser) {
SubProcessActivity subProcessActivity = new SubProcessActivity();
-
+
String subProcessKey = XmlUtil.attribute(element, "sub-process-key");
subProcessActivity.setSubProcessKey(subProcessKey);
-
+
String subProcessId = XmlUtil.attribute(element, "sub-process-id");
subProcessActivity.setSubProcessId(subProcessId);
-
+
List<SubProcessInParameterImpl> inParameters = new ArrayList<SubProcessInParameterImpl>();
for (Element inElement: XmlUtil.elements(element, "parameter-in")) {
SubProcessInParameterImpl inParameter = new SubProcessInParameterImpl();
@@ -81,7 +81,7 @@
SubProcessOutParameterImpl outParameter = new SubProcessOutParameterImpl();
parseParameter(outElement, outParameter);
outParameters.add(outParameter);
-
+
if (outParameter.getVariableName()==null) {
parse.addProblem("no 'variable' specified for parameter-in", element);
}
@@ -108,7 +108,7 @@
if (outcomeExpressionText!=null) {
Expression outcomeExpression = Expression.create(outcomeExpressionText, outcomeLanguage);
subProcessActivity.setOutcomeExpression(outcomeExpression);
-
+
for (Element transitionElement: XmlUtil.elements(element, "transition")) {
Element outcomeValueElement = XmlUtil.element(transitionElement, "outcome-value");
if (outcomeValueElement!=null) {
@@ -121,6 +121,7 @@
Descriptor descriptor = (Descriptor) WireParser.getInstance().parseElement(valueElement, parse);
Object value = WireContext.create(descriptor);
outcomeVariableMappings.put(value, transitionName);
+ subProcessActivity.setOutcomeVariableMappings(outcomeVariableMappings);
} else {
parse.addProblem("outcome-value must contain exactly one element", outcomeValueElement);
}
@@ -135,7 +136,7 @@
void parseParameter(Element element, SubProcessParameterImpl parameter) {
String name = XmlUtil.attribute(element, "subvar");
parameter.setSubVariableName(name);
-
+
String expressionText = XmlUtil.attribute(element, "expr");
String language = XmlUtil.attribute(element, "expr-lang");
if (expressionText!=null) {
@@ -151,11 +152,11 @@
public static Map<String, String> parseSwimlaneMappings(Element element, Parse parse) {
Map<String, String> swimlaneMappings = new HashMap<String, String>();
-
+
for (Element inElement: XmlUtil.elements(element, "swimlane-mapping")) {
String swimlane = XmlUtil.attribute(inElement, "swimlane", true, parse);
String subSwimlane = XmlUtil.attribute(inElement, "sub-swimlane", true, parse);
-
+
swimlaneMappings.put(swimlane, subSwimlane);
}
13 years, 11 months
JBoss JBPM SVN: r6373 - jbpm4/trunk/modules/userguide/src/main/docbook/en/modules.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-05-24 00:50:26 -0400 (Mon, 24 May 2010)
New Revision: 6373
Modified:
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Services.xml
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
Log:
correct userguide, refer http://community.jboss.org/thread/152299
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Services.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Services.xml 2010-05-22 04:22:48 UTC (rev 6372)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch05-Services.xml 2010-05-24 04:50:26 UTC (rev 6373)
@@ -133,7 +133,7 @@
will be automatically be assigned. For version
assignment, the versions of all deployed process definitions with the same name will
be taken into account. The assigned <literal>version</literal> will be one higher
- then the highest <literal>version</literal> number of deployed process definitions
+ than the highest <literal>version</literal> number of deployed process definitions
with the same <literal>key</literal>. If no process definitions with a similar
<literal>key</literal> have been deployed, version number 1 is assigned.
</para>
@@ -371,11 +371,11 @@
<para>Typically tasks are associated with a form and displayed in some user
interface. The form needs to be able to read and write data related to the task.
</para>
- <programlisting>long taskId = task.getId();
-
+ <programlisting>// read task variables
Set<String> variableNames = taskService.getVariableNames(taskId);
-variables = taskService.getVariables(taskId, variableNames);
+variables = taskService.getVariables(taskId, variableNames);</programlisting>
+ <programlisting>// write task variables
variables = new HashMap<String, Object>();
variables.put("category", "small");
variables.put("lires", 923874893);
@@ -409,7 +409,7 @@
If a task has one outgoing transition with a name then:
</emphasis>
<itemizedlist>
- <listitem>gtaskService.etOutcomes() returns a collection that includes only the name of the transition</listitem>
+ <listitem>taskService.getOutcomes() returns a collection that includes only the name of the transition</listitem>
<listitem>taskService.completeTask(taskId) will take the single outgoing transition</listitem>
<listitem>taskService.completeTask(taskId, null) will will result in an exception (as there is no transition without a name)</listitem>
<listitem>taskService.completeTask(taskId, "anyvalue") will result in an exception</listitem>
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2010-05-22 04:22:48 UTC (rev 6372)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch06-Jpdl.xml 2010-05-24 04:50:26 UTC (rev 6373)
@@ -653,7 +653,7 @@
<start>
<transition to="get return code" />
- <start>
+ </start>
<state name="get return code">
<transition name="200" to="ok"/>
13 years, 11 months
JBoss JBPM SVN: r6372 - in jbpm4/trunk/modules/pvm/src: test/java/org/jbpm/pvm/internal/wire and 1 other directory.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-05-22 00:22:48 -0400 (Sat, 22 May 2010)
New Revision: 6372
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/ReflectUtil.java
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectWireTest.java
Log:
JBPM-2717: allow unboxing and widening primitive conversions in property injection
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/ReflectUtil.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/ReflectUtil.java 2010-05-21 11:46:12 UTC (rev 6371)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/ReflectUtil.java 2010-05-22 04:22:48 UTC (rev 6372)
@@ -5,7 +5,9 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.jbpm.api.JbpmException;
import org.jbpm.internal.log.Log;
@@ -18,10 +20,32 @@
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
-public abstract class ReflectUtil {
+public class ReflectUtil {
+
+ private ReflectUtil() {
+ // hide default constructor to prevent instantiation
+ }
- private static Log log = Log.getLog(ReflectUtil.class.getName());
-
+ private static final Log log = Log.getLog(ReflectUtil.class.getName());
+
+ /**
+ * Maps wrapper <code>Class</code>es to their corresponding primitive types.
+ */
+ private static final Map<Class<?>, Class<?>> wrapperPrimitiveMap = createWrapperPrimitiveMap();
+
+ private static Map<Class<?>, Class<?>> createWrapperPrimitiveMap() {
+ Map<Class<?>, Class<?>> map = new HashMap<Class<?>, Class<?>>();
+ map.put(Boolean.class, boolean.class);
+ map.put(Byte.class, byte.class);
+ map.put(Character.class, char.class);
+ map.put(Short.class, short.class);
+ map.put(Integer.class, int.class);
+ map.put(Long.class, long.class);
+ map.put(Double.class, double.class);
+ map.put(Float.class, float.class);
+ return map;
+ }
+
/** searches for the field in the given class and in its super classes */
public static Field findField(Class<?> clazz, String fieldName) {
return findField(clazz, fieldName, clazz);
@@ -200,38 +224,136 @@
}
public static boolean isArgumentMatch(Class<?>[] parameterTypes, List<ArgDescriptor> argDescriptors, Object[] args) {
- int nbrOfArgs = 0;
- if (args!=null) nbrOfArgs = args.length;
+ int nbrOfArgs = args!=null ? args.length : 0;
+ int nbrOfParameterTypes = parameterTypes!=null ? parameterTypes.length : 0;
- int nbrOfParameterTypes = 0;
- if (parameterTypes!=null) nbrOfParameterTypes = parameterTypes.length;
+ if (nbrOfArgs!=nbrOfParameterTypes) {
+ return false;
+ }
- if ( (nbrOfArgs==0)
- && (nbrOfParameterTypes==0)
- ) {
+ if (nbrOfArgs==0) {
return true;
}
- if (nbrOfArgs!=nbrOfParameterTypes) {
- return false;
- }
-
- for (int i=0; (i<parameterTypes.length); i++) {
+ for (int i=0; i<parameterTypes.length; i++) {
Class<?> parameterType = parameterTypes[i];
- String argTypeName = (argDescriptors!=null ? argDescriptors.get(i).getTypeName() : null);
- if (argTypeName!=null) {
- if (! argTypeName.equals(parameterType.getName())) {
- return false;
- }
- } else if ( (args[i]!=null)
- && (! parameterType.isAssignableFrom(args[i].getClass()))
- ) {
+ String argTypeName;
+ if (argDescriptors == null || (argTypeName = argDescriptors.get(i).getTypeName()) == null) {
+ Object arg = args[i];
+ if (!isAssignable(parameterType, arg)) {
+ return false;
+ }
+ }
+ else if (!parameterType.getName().equals(argTypeName)) {
return false;
}
}
return true;
}
+ /**
+ * <p>
+ * Checks if the given <code>value</code> can be assigned to a variable of the specified
+ * <code>type</code>.
+ * </p>
+ * <p>
+ * Unlike the {@link Class#isAssignableFrom(Class)} method, this method takes into
+ * account widenings of primitive types and <code>null</code>s.
+ * </p>
+ * <p>
+ * Primitive widenings allow an int to be assigned to a long, float or double. This method
+ * returns the correct result for these cases.
+ * </p>
+ * <p>
+ * <code>null</code> may be assigned to any reference type. This method will return
+ * <code>true</code> if <code>null</code> is passed in and the specified <code>type</code> is
+ * a reference type.
+ * </p>
+ * <p>
+ * Specifically, this method tests whether the class of the given <code>value</code> parameter
+ * can be converted to the type represented by the specified <code>Class</code> via an
+ * identity, widening primitive or widening reference conversion. See the
+ * <a href="http://java.sun.com/docs/books/jls/">Java Language Specification</a>,
+ * sections 5.1.1, 5.1.2 and 5.1.4 for details.
+ * </p>
+ * @param type the Class to try to assign into
+ * @param value the object to check, may be <code>null</code>
+ * @return <code>true</code> if assignment is possible
+ * @see <a
+ * href="http://commons.apache.org/lang/api-release/org/apache/commons/lang/ClassU..."
+ * >ClassUtils.isAssignable()</a>
+ */
+ private static boolean isAssignable(Class<?> type, Object value) {
+ // check for null value
+ if (value == null) {
+ // null is assignable to reference types
+ return !type.isPrimitive();
+ }
+
+ if (type.isPrimitive()) {
+ // unboxing
+ Class<?> valueType = wrapperToPrimitive(value.getClass());
+ if (null == valueType) {
+ return false;
+ }
+ if (type == valueType) {
+ return true;
+ }
+ // widening primitive conversion
+ if (int.class == valueType) {
+ return long.class == type || float.class == type || double.class == type;
+ }
+ if (long.class == valueType) {
+ return float.class == type || double.class == type;
+ }
+ if (boolean.class == valueType) {
+ return false;
+ }
+ if (double.class == valueType) {
+ return false;
+ }
+ if (float.class == valueType) {
+ return double.class == type;
+ }
+ if (char.class == valueType) {
+ return int.class == type || long.class == type || float.class == type
+ || double.class == type;
+ }
+ if (short.class == valueType) {
+ return int.class == type || long.class == type || float.class == type
+ || double.class == type;
+ }
+ if (byte.class == valueType) {
+ return short.class == type || int.class == type || long.class == type
+ || float.class == type || double.class == type;
+ }
+ // should never get here
+ return false;
+ }
+
+ return type.isInstance(value);
+ }
+
+ /**
+ * <p>
+ * Converts the specified wrapper class to its corresponding primitive class.
+ * </p>
+ * <p>
+ * If the passed in class is a wrapper class for a primitive type, this primitive type will be
+ * returned (e.g. <code>Integer.TYPE</code> for <code>Integer.class</code>). For other
+ * classes, or if the parameter is <code>null</code>, the return value is <code>null</code>.
+ * </p>
+ * @param cls the class to convert, may be <code>null</code>
+ * @return the corresponding primitive type if <code>cls</code> is a wrapper class,
+ * <code>null</code> otherwise
+ * @see <a
+ * href="http://commons.apache.org/lang/api-release/org/apache/commons/lang/ClassU..."
+ * >ClassUtils.wrapperToPrimitive</a>
+ */
+ private static Class<?> wrapperToPrimitive(Class<?> cls) {
+ return wrapperPrimitiveMap.get(cls);
+ }
+
public static String getSignature(String methodName, List<ArgDescriptor> argDescriptors, Object[] args) {
String signature = methodName+"(";
if (args!=null) {
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectWireTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectWireTest.java 2010-05-21 11:46:12 UTC (rev 6371)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/ObjectWireTest.java 2010-05-22 04:22:48 UTC (rev 6372)
@@ -534,7 +534,7 @@
}
public static class OverriddenFieldInjectionClass extends FieldInjectionClass {
- String txtOne = null;
+ String txtOne;
}
public void testOverriddenFieldInjection() {
@@ -623,66 +623,143 @@
}
public static class PropertyInjectionClass {
- String p = null;
- String q = null;
- String propertyP = null;
- String propertyQ = null;
- public void setP(String p) {
- propertyP = p;
+ String s;
+ String propertyS;
+ boolean z;
+ boolean propertyZ;
+ char c;
+ char propertyC;
+ int i;
+ int propertyI;
+ long l;
+ long propertyL;
+ float f;
+ float propertyF;
+ double d;
+ double propertyD;
+
+ public void setS(String s) {
+ propertyS = s;
}
- public void setQ(String q) {
- propertyQ = q;
+ public void setZ(boolean z) {
+ propertyZ = z;
}
+ public void setC(char c) {
+ propertyC = c;
+ }
+ public void setI(int i) {
+ propertyI = i;
+ }
+ public void setL(long l) {
+ propertyL = l;
+ }
+ public void setF(float f) {
+ propertyF = f;
+ }
+ public void setD(double d) {
+ propertyD = d;
+ }
}
public void testPropertyInjection() {
WireContext wireContext = createWireContext(
"<objects>" +
" <object name='o' class='"+PropertyInjectionClass.class.getName()+"'>" +
- " <property name='p'>" +
+ " <property name='s'>" +
" <string value='hello' />" +
" </property>" +
- " <property name='q'>" +
- " <string value='world' />" +
+ " <property name='z'>" +
+ " <true/>" +
" </property>" +
+ " <property name='c'>" +
+ " <char value='x'/>" +
+ " </property>" +
+ " <property name='i'>" +
+ " <int value='32768'/>" +
+ " </property>" +
+ " <property name='l'>" +
+ " <long value='2147483648'/>" +
+ " </property>" +
+ " <property name='f'>" +
+ " <float value='3e9'/>" +
+ " </property>" +
+ " <property name='d'>" +
+ " <double value='1e39'/>" +
+ " </property>" +
" </object>" +
"</objects>"
);
- Object o = wireContext.get("o");
+ PropertyInjectionClass pic = (PropertyInjectionClass) wireContext.get("o");
- assertNotNull(o);
- assertEquals(PropertyInjectionClass.class, o.getClass());
- assertNull(((PropertyInjectionClass)o).p);
- assertNull(((PropertyInjectionClass)o).q);
- assertEquals("hello", ((PropertyInjectionClass)o).propertyP);
- assertEquals("world", ((PropertyInjectionClass)o).propertyQ);
+ assertNull(pic.s);
+ assertEquals("hello", pic.propertyS);
+ assertFalse(pic.z);
+ assertTrue(pic.propertyZ);
+ assertEquals('\0', pic.c);
+ assertEquals('x', pic.propertyC);
+ assertEquals(0, pic.i);
+ assertEquals(1 << 15, pic.propertyI);
+ assertEquals(0, pic.l);
+ assertEquals(1l << 31, pic.propertyL);
+ assertEquals(0, pic.f, 0);
+ assertEquals(3e9f, pic.propertyF, 0);
+ assertEquals(0, pic.d, 0);
+ assertEquals(1e39, pic.propertyD, 0);
}
- public void testPropertyInjectionWithSetter() {
+ public void testWideningPropertyInjection() {
WireContext wireContext = createWireContext(
"<objects>" +
" <object name='o' class='"+PropertyInjectionClass.class.getName()+"'>" +
- " <property setter='setP'>" +
+ " <property name='s'>" +
" <string value='hello' />" +
" </property>" +
- " <property setter='setQ'>" +
- " <string value='world' />" +
+ " <property name='i'>" +
+ " <char value=' '/>" +
" </property>" +
+ " <property name='l'>" +
+ " <int value='2147483647'/>" +
+ " </property>" +
+ " <property name='f'>" +
+ " <int value='16777216'/>" +
+ " </property>" +
+ " <property name='d'>" +
+ " <long value='9007199254740992'/>" +
+ " </property>" +
" </object>" +
"</objects>"
);
- Object o = wireContext.get("o");
+ PropertyInjectionClass pic = (PropertyInjectionClass) wireContext.get("o");
- assertNotNull(o);
- assertEquals(PropertyInjectionClass.class, o.getClass());
- assertNull(((PropertyInjectionClass)o).p);
- assertNull(((PropertyInjectionClass)o).q);
- assertEquals("hello", ((PropertyInjectionClass)o).propertyP);
- assertEquals("world", ((PropertyInjectionClass)o).propertyQ);
+ assertEquals(0, pic.i);
+ assertEquals(' ', pic.propertyI);
+ assertEquals(0, pic.l);
+ assertEquals(Integer.MAX_VALUE, pic.propertyL);
+ assertEquals(0, pic.f, 0);
+ assertEquals(1 << 24, pic.propertyF, 0);
+ assertEquals(0, pic.d, 0);
+ assertEquals(1l << 53, pic.propertyD, 0);
}
+ public void testPropertyInjectionWithSetter() {
+ WireContext wireContext = createWireContext(
+ "<objects>" +
+ " <object name='o' class='"+PropertyInjectionClass.class.getName()+"'>" +
+ " <property setter='setS'>" +
+ " <string value='hello' />" +
+ " </property>" +
+ " </object>" +
+ "</objects>"
+ );
+
+ PropertyInjectionClass pic = (PropertyInjectionClass) wireContext.get("o");
+
+ assertNull(pic.s);
+ assertEquals("hello", pic.propertyS);
+ }
+
public void testBadPropertyDescriptor() {
List<Problem> problems = parseProblems(
"<objects>" +
@@ -727,30 +804,24 @@
WireContext wireContext = createWireContext(
"<objects>" +
" <object name='o' class='"+InheritedPropertyInjectionClass.class.getName()+"'>" +
- " <property name='p'>" +
+ " <property name='s'>" +
" <string value='hello' />" +
" </property>" +
- " <property name='q'>" +
- " <string value='world' />" +
- " </property>" +
" </object>" +
"</objects>"
);
- Object o = wireContext.get("o");
+ InheritedPropertyInjectionClass ipic = (InheritedPropertyInjectionClass) wireContext.get("o");
- assertNotNull(o);
- assertEquals(InheritedPropertyInjectionClass.class, o.getClass());
- assertNull(((InheritedPropertyInjectionClass)o).p);
- assertNull(((InheritedPropertyInjectionClass)o).q);
- assertEquals("hello", ((InheritedPropertyInjectionClass)o).propertyP);
- assertEquals("world", ((InheritedPropertyInjectionClass)o).propertyQ);
+ assertNull(ipic.s);
+ assertEquals("hello", ipic.propertyS);
}
public static class OverwrittenPropertyInjectionClass extends PropertyInjectionClass {
- String overwrittenPropertyQ = null;
- public void setQ(String q) {
- overwrittenPropertyQ = q;
+ String overwrittenPropertyS;
+ @Override
+ public void setS(String s) {
+ overwrittenPropertyS = s;
}
}
@@ -758,25 +829,18 @@
WireContext wireContext = createWireContext(
"<objects>" +
" <object name='o' class='"+OverwrittenPropertyInjectionClass.class.getName()+"'>" +
- " <property name='p'>" +
+ " <property name='s'>" +
" <string value='hello' />" +
" </property>" +
- " <property name='q'>" +
- " <string value='world' />" +
- " </property>" +
" </object>" +
"</objects>"
);
- Object o = wireContext.get("o");
+ OverwrittenPropertyInjectionClass opic = (OverwrittenPropertyInjectionClass) wireContext.get("o");
- assertNotNull(o);
- assertEquals(OverwrittenPropertyInjectionClass.class, o.getClass());
- assertNull(((OverwrittenPropertyInjectionClass)o).p);
- assertNull(((OverwrittenPropertyInjectionClass)o).q);
- assertEquals("hello", ((OverwrittenPropertyInjectionClass)o).propertyP);
- assertNull(((OverwrittenPropertyInjectionClass)o).propertyQ);
- assertEquals("world", ((OverwrittenPropertyInjectionClass)o).overwrittenPropertyQ);
+ assertNull(opic.s);
+ assertNull(opic.propertyS);
+ assertEquals("hello", opic.overwrittenPropertyS);
}
public static class InvokeClass {
13 years, 11 months
JBoss JBPM SVN: r6371 - in jbpm4/trunk/modules: pvm and 2 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-05-21 07:46:12 -0400 (Fri, 21 May 2010)
New Revision: 6371
Modified:
jbpm4/trunk/modules/jpdl/pom.xml
jbpm4/trunk/modules/pvm/pom.xml
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/forkjoin/ForkResultsInNullEndActivityTest.java
jbpm4/trunk/modules/test-pojo/pom.xml
Log:
JBPM-2839: mark dependency on jbpm-test-base as scope=test
add jbpm-test-base dependency to modules jpdl and test-pojo
Modified: jbpm4/trunk/modules/jpdl/pom.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/pom.xml 2010-05-21 06:43:20 UTC (rev 6370)
+++ jbpm4/trunk/modules/jpdl/pom.xml 2010-05-21 11:46:12 UTC (rev 6371)
@@ -29,19 +29,20 @@
<relativePath>../../pom.xml</relativePath>
</parent>
- <!-- Properties -->
- <properties>
- </properties>
-
<!-- Dependencies -->
<dependencies>
-
<!-- JBPM4 -->
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-pvm</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-test-base</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
<!-- 3rd Party -->
<dependency>
Modified: jbpm4/trunk/modules/pvm/pom.xml
===================================================================
--- jbpm4/trunk/modules/pvm/pom.xml 2010-05-21 06:43:20 UTC (rev 6370)
+++ jbpm4/trunk/modules/pvm/pom.xml 2010-05-21 11:46:12 UTC (rev 6371)
@@ -41,6 +41,7 @@
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-test-base</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/forkjoin/ForkResultsInNullEndActivityTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/forkjoin/ForkResultsInNullEndActivityTest.java 2010-05-21 06:43:20 UTC (rev 6370)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/forkjoin/ForkResultsInNullEndActivityTest.java 2010-05-21 11:46:12 UTC (rev 6371)
@@ -19,7 +19,7 @@
* 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.activity.forktest;
+ package org.jbpm.test.activity.forkjoin;
import org.jbpm.api.ProcessInstance;
import org.jbpm.pvm.internal.model.ExecutionImpl;
Modified: jbpm4/trunk/modules/test-pojo/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-pojo/pom.xml 2010-05-21 06:43:20 UTC (rev 6370)
+++ jbpm4/trunk/modules/test-pojo/pom.xml 2010-05-21 11:46:12 UTC (rev 6371)
@@ -33,6 +33,11 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-test-base</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
@@ -47,7 +52,6 @@
<artifactId>jbpm-pvm</artifactId>
<version>${project.version}</version>
</dependency>
-
</dependencies>
<!-- Plugins -->
@@ -80,4 +84,4 @@
</profile>
</profiles>
-</project>
\ No newline at end of file
+</project>
13 years, 11 months
JBoss JBPM SVN: r6370 - in jbpm4/trunk/modules: bpmn/src/test/java/org/jbpm/bpmn and 5 other directories.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-05-21 02:43:20 -0400 (Fri, 21 May 2010)
New Revision: 6370
Added:
jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/model/
jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/model/BpmnProcessDefinitionTest.java
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/internal/
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/internal/model/
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinitionTest.java
Modified:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/model/BpmnProcessDefinition.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java
Log:
JBPM-2865 delete duplicated taskdefinition and variabledefinition.
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/model/BpmnProcessDefinition.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/model/BpmnProcessDefinition.java 2010-05-21 06:29:13 UTC (rev 6369)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/model/BpmnProcessDefinition.java 2010-05-21 06:43:20 UTC (rev 6370)
@@ -40,8 +40,6 @@
private static final long serialVersionUID = 1L;
- protected Map<String, TaskDefinitionImpl> taskDefinitions = new HashMap<String, TaskDefinitionImpl>();
- protected List<VariableDefinitionImpl> processVariableDefinitions = new ArrayList<VariableDefinitionImpl>();
protected Map<String, Element> messages = new HashMap<String, Element>();
protected Map<String, Element> itemDefinitions = new HashMap<String, Element>();
protected Map<String, Element> interfaces = new HashMap<String, Element>();
@@ -56,6 +54,7 @@
public TaskDefinitionImpl createTaskDefinition(String name) {
TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
+ taskDefinition.setName(name);
taskDefinitions.put(name, taskDefinition);
return taskDefinition;
}
@@ -69,7 +68,7 @@
}
public void setVariableDefinition(List<VariableDefinitionImpl> variableDefinitions) {
- this.processVariableDefinitions = variableDefinitions;
+ this.variableDefinitions = variableDefinitions;
}
public Resource getResource(String ref) {
@@ -88,53 +87,53 @@
this.interfaces = interfaces;
}
-
+
public Map<String, Element> getOperations() {
return operations;
}
-
+
public void setOperations(Map<String, Element> operations) {
this.operations = operations;
}
-
+
public Map<String, Element> getMessages() {
return messages;
}
-
+
public void setMessages(Map<String, Element> messages) {
this.messages = messages;
}
-
+
public Map<String, Element> getItemDefinitions() {
return itemDefinitions;
}
-
+
public void setItemDefinitions(Map<String, Element> itemDefinitions) {
this.itemDefinitions = itemDefinitions;
}
public void addSequenceFlow(String transitionId, Transition transition) {
this.sequenceFlow.put(transitionId, transition);
-
+
String source = transition.getSource().getName();
if (sourceToTargetMapping.get(source) == null) {
sourceToTargetMapping.put(source, new HashSet<String>());
}
sourceToTargetMapping.get(source).add(transition.getDestination().getName());
}
-
+
public Map<String, Set<String>> getSourceToTargetMapping() {
return sourceToTargetMapping;
}
-
+
public boolean isReachable(String srcActivityId , String dstActivityId) {
return isReachable(srcActivityId, dstActivityId, new HashSet<String>());
}
-
+
protected boolean isReachable(String srcActivityId , String dstActivityId, Set<String> alreadyVisited) {
if (srcActivityId.equals(dstActivityId)) {
return true;
Added: jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/model/BpmnProcessDefinitionTest.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/model/BpmnProcessDefinitionTest.java (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/model/BpmnProcessDefinitionTest.java 2010-05-21 06:43:20 UTC (rev 6370)
@@ -0,0 +1,26 @@
+
+package org.jbpm.bpmn.model;
+
+import junit.framework.TestCase;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
+
+/**
+ * @author Huisheng Xu
+ */
+public class BpmnProcessDefinitionTest extends TestCase {
+ public void testCreateTaskDefinition() {
+ BpmnProcessDefinition bpmnProcessDefinition = new BpmnProcessDefinition();
+ bpmnProcessDefinition.createTaskDefinition("do something");
+ assertEquals("do something", bpmnProcessDefinition.getTaskDefinition("do something").getName());
+ assertEquals(1, bpmnProcessDefinition.getTaskDefinitions().size());
+ }
+
+ public void testAddTaskDefinition() {
+ BpmnProcessDefinition bpmnProcessDefinition = new BpmnProcessDefinition();
+ TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
+ taskDefinition.setName("do something");
+ bpmnProcessDefinition.addTaskDefinitionImpl(taskDefinition);
+ assertEquals("do something", bpmnProcessDefinition.getTaskDefinition("do something").getName());
+ assertEquals(1, bpmnProcessDefinition.getTaskDefinitions().size());
+ }
+}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java 2010-05-21 06:29:13 UTC (rev 6369)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java 2010-05-21 06:43:20 UTC (rev 6370)
@@ -35,9 +35,8 @@
public class JpdlProcessDefinition extends ProcessDefinitionImpl {
private static final long serialVersionUID = 1L;
-
+
Map<String, SwimlaneDefinitionImpl> swimlaneDefinitions = new HashMap<String, SwimlaneDefinitionImpl>();
- Map<String, TaskDefinitionImpl> taskDefinitions = new HashMap<String, TaskDefinitionImpl>();
protected ExecutionImpl newProcessInstance() {
return new ExecutionImpl();
@@ -56,10 +55,11 @@
public TaskDefinitionImpl createTaskDefinition(String name) {
TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
+ taskDefinition.setName(name);
taskDefinitions.put(name, taskDefinition);
return taskDefinition;
}
-
+
public Map<String, TaskDefinitionImpl> getTaskDefinitions() {
return taskDefinitions;
}
Added: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinitionTest.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinitionTest.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinitionTest.java 2010-05-21 06:43:20 UTC (rev 6370)
@@ -0,0 +1,26 @@
+
+package org.jbpm.jpdl.internal.model;
+
+import junit.framework.TestCase;
+import org.jbpm.pvm.internal.task.TaskDefinitionImpl;
+
+/**
+ * @author Huisheng Xu
+ */
+public class JpdlProcessDefinitionTest extends TestCase {
+ public void testCreateTaskDefinition() {
+ JpdlProcessDefinition jpdlProcessDefinition = new JpdlProcessDefinition();
+ jpdlProcessDefinition.createTaskDefinition("do something");
+ assertEquals("do something", jpdlProcessDefinition.getTaskDefinition("do something").getName());
+ assertEquals(1, jpdlProcessDefinition.getTaskDefinitions().size());
+ }
+
+ public void testAddTaskDefinition() {
+ JpdlProcessDefinition jpdlProcessDefinition = new JpdlProcessDefinition();
+ TaskDefinitionImpl taskDefinition = new TaskDefinitionImpl();
+ taskDefinition.setName("do something");
+ jpdlProcessDefinition.addTaskDefinitionImpl(taskDefinition);
+ assertEquals("do something", jpdlProcessDefinition.getTaskDefinition("do something").getName());
+ assertEquals(1, jpdlProcessDefinition.getTaskDefinitions().size());
+ }
+}
13 years, 11 months
JBoss JBPM SVN: r6369 - in jbpm4/trunk/modules: test-cfg and 4 other directories.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-05-21 02:29:13 -0400 (Fri, 21 May 2010)
New Revision: 6369
Added:
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/spring/repositorycache/
jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/spring/repositorycache/RepositoryCacheTest.java
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/applicationContext.xml
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/jbpm.cfg.xml
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/jbpm.hibernate.cfg.xml
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/jdbc.properties
jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/log4j.properties
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryCacheBinding.java
jbpm4/trunk/modules/test-cfg/pom.xml
Log:
JBPM-2859 shouldn't autowire field which type is Map
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryCacheBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryCacheBinding.java 2010-05-21 06:18:22 UTC (rev 6368)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RepositoryCacheBinding.java 2010-05-21 06:29:13 UTC (rev 6369)
@@ -39,7 +39,6 @@
public Object parse(Element element, Parse parse, Parser parser) {
ObjectDescriptor objectDescriptor = new ObjectDescriptor(RepositoryCacheImpl.class);
- objectDescriptor.setAutoWireEnabled(true);
return objectDescriptor;
}
}
Modified: jbpm4/trunk/modules/test-cfg/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/pom.xml 2010-05-21 06:18:22 UTC (rev 6368)
+++ jbpm4/trunk/modules/test-cfg/pom.xml 2010-05-21 06:29:13 UTC (rev 6369)
@@ -49,11 +49,6 @@
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-test-base</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<scope>test</scope>
@@ -63,6 +58,11 @@
<artifactId>spring-mock</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-j2ee</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
-
+
</project>
Added: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/spring/repositorycache/RepositoryCacheTest.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/spring/repositorycache/RepositoryCacheTest.java (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/spring/repositorycache/RepositoryCacheTest.java 2010-05-21 06:29:13 UTC (rev 6369)
@@ -0,0 +1,42 @@
+/*
+ * 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.spring.repositorycache;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.test.AbstractTransactionalSpringJbpmTestCase;
+
+public class RepositoryCacheTest extends AbstractTransactionalSpringJbpmTestCase {
+ public void testNotNumberFormatException() {
+ Map map = processEngine.get(Map.class);
+ map.put("some.useless.info", "johndoe");
+ try {
+ executionService.startProcessInstanceByKey("testProcess");
+ } catch(JbpmException ex) {
+ assertTrue(true);
+ }
+ }
+
+}
Added: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/applicationContext.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/applicationContext.xml (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/applicationContext.xml 2010-05-21 06:29:13 UTC (rev 6369)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:aop="http://www.springframework.org/schema/aop"
+ xmlns:context="http://www.springframework.org/schema/context"
+ 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.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/repositorycache/jbpm.cfg.xml" />
+ </bean>
+
+ <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/repositorycache/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" />
+ -->
+ <property name="dataSource" ref="dataSource" />
+ </bean>
+
+ <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
+ <property name="sessionFactory" ref="sessionFactory" />
+ <property name="dataSource" ref="dataSource" />
+ </bean>
+
+ <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
+ <property name="driverClassName" value="${jdbc.driverClassName}" />
+ <property name="url" value="${jdbc.url}" />
+ <property name="username" value="${jdbc.username}" />
+ <property name="password" value="${jdbc.password}" />
+ </bean>
+
+ <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="locations">
+ <list>
+ <value>classpath*:org/jbpm/test/spring/repositorycache/jdbc.properties</value>
+ </list>
+ </property>
+ </bean>
+
+ <bean name="configProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"/>
+
+</beans>
Added: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/jbpm.cfg.xml (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/jbpm.cfg.xml 2010-05-21 06:29:13 UTC (rev 6369)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+ <import resource="jbpm.default.cfg.xml" />
+ <import resource="jbpm.jpdl.cfg.xml" />
+ <import resource="jbpm.bpmn.cfg.xml" />
+ <import resource="jbpm.identity.cfg.xml" />
+ <import resource="jbpm.businesscalendar.cfg.xml" />
+ <import resource="jbpm.console.cfg.xml" />
+
+ <!-- Spring configuration -->
+ <import resource="jbpm.tx.spring.cfg.xml" />
+
+</jbpm-configuration>
Added: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/jbpm.hibernate.cfg.xml (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/jbpm.hibernate.cfg.xml 2010-05-21 06:29:13 UTC (rev 6369)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+ <session-factory>
+
+ <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+ <property name="hibernate.format_sql">true</property>
+
+ <property name="hibernate.hbm2ddl.auto">create-drop</property>
+
+ <mapping resource="jbpm.repository.hbm.xml" />
+ <mapping resource="jbpm.execution.hbm.xml" />
+ <mapping resource="jbpm.history.hbm.xml" />
+ <mapping resource="jbpm.task.hbm.xml" />
+ <mapping resource="jbpm.identity.hbm.xml" />
+
+ </session-factory>
+</hibernate-configuration>
Added: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/jdbc.properties
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/jdbc.properties (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/jdbc.properties 2010-05-21 06:29:13 UTC (rev 6369)
@@ -0,0 +1,4 @@
+jdbc.driverClassName=org.hsqldb.jdbcDriver
+jdbc.url=jdbc:hsqldb:.
+jdbc.username=sa
+jdbc.password=
Added: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/log4j.properties
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/log4j.properties (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/spring/repositorycache/log4j.properties 2010-05-21 06:29:13 UTC (rev 6369)
@@ -0,0 +1,4 @@
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
+log4j.rootLogger=info, stdout
13 years, 11 months
JBoss JBPM SVN: r6368 - in jbpm4/trunk/modules: pvm/src/main/java/org/jbpm/pvm/internal/cmd and 1 other directories.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-05-21 02:18:22 -0400 (Fri, 21 May 2010)
New Revision: 6368
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ExecutionService.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskService.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java
Log:
JBPM-2760 fix generics specification in ExecutionService and TaskService.
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ExecutionService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ExecutionService.java 2010-05-21 06:10:39 UTC (rev 6367)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/ExecutionService.java 2010-05-21 06:18:22 UTC (rev 6368)
@@ -44,14 +44,14 @@
/** starts a new process instance for the ProcessDefinition with the given processDefinitionDbid.
* @param processDefinitionId the {@link ProcessDefinition#getId() unique id} of the process definition.
* @param variables are the initial values of the process variables that will be set before the execution starts. */
- ProcessInstance startProcessInstanceById(String processDefinitionId, Map<String, Object> variables);
+ ProcessInstance startProcessInstanceById(String processDefinitionId, Map<String, ?> variables);
/** starts a new process instance for the ProcessDefinition with the given processDefinitionDbid.
* @param processDefinitionId the {@link ProcessDefinition#getId() unique id} of the process definition.
* @param variables are the initial values of the process variables that will be set before the execution starts.
* @param processInstanceKey is a user provided reference for the new process instance that must be unique over all
* process versions with the same name. */
- ProcessInstance startProcessInstanceById(String processDefinitionId, Map<String, Object> variables, String processInstanceKey);
+ ProcessInstance startProcessInstanceById(String processDefinitionId, Map<String, ?> variables, String processInstanceKey);
/** starts a new process instance in the latest version of the given process definition.
* @param processDefinitionKey is the key of the process definition for which the latest version will be taken. */
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskService.java 2010-05-21 06:10:39 UTC (rev 6367)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/TaskService.java 2010-05-21 06:18:22 UTC (rev 6368)
@@ -31,7 +31,7 @@
import java.util.Set;
/** task management.
- *
+ *
* @author Tom Baeyens
* @author Alejandro Guizar
* @author Heiko Braun <heiko.braun(a)jboss.com>
@@ -40,42 +40,42 @@
/** Creates a task.
* The returned task will be transient.
- * Use {@link #saveTask(Task)} to persist the task. Only
- * after the invocation of {@link #saveTask(Task)}, the
+ * Use {@link #saveTask(Task)} to persist the task. Only
+ * after the invocation of {@link #saveTask(Task)}, the
* {@link Task#getId()} property will be initialized. */
Task newTask();
/** Creates a new subtask for the given task.
- * Make sure that the parent task is saved before the
+ * Make sure that the parent task is saved before the
* {@link Task#getId() Id} is taken.
* The returned task will be transient.
* Use {@link #saveTask(Task)} to persist the task. */
Task newTask(String parentTaskId);
- /** Saves the given task to persistent storage.
+ /** Saves the given task to persistent storage.
* @return the taskId */
String saveTask(Task task);
- /** Retrieves the task with the given identifier from persistent storage.
- * If no task with the given identifier exists,
+ /** Retrieves the task with the given identifier from persistent storage.
+ * If no task with the given identifier exists,
* the call returns <code>null</code>. */
Task getTask(String taskId);
/** assigns this task to the given assignee. */
void assignTask(String taskId, String userId);
- /** taking this task will prevent all other candidates from
- * taking and working on this task.
+ /** taking this task will prevent all other candidates from
+ * taking and working on this task.
* The inverse operation of putting the task back into the group
- * for someone else to take it, can be done by providing a null value
+ * for someone else to take it, can be done by providing a null value
* for userId in the {@link #assignTask(String, String)} method:
* <code>taskService.assignTask(taskId, null);</code>
* @throws JbpmException if this task already has been taken. */
void takeTask(String taskId, String userId);
/** Deletes this task, marks the related history task as completed.
- * If the task was created in the context
- * of a process execution, this operation may result in a process instance
+ * If the task was created in the context
+ * of a process execution, this operation may result in a process instance
* being triggered. */
void completeTask(String taskId);
@@ -84,62 +84,62 @@
* variables. If the task was created in the context of a process execution,
* this operation may result in a process instance being triggered to
* continue.*/
- void completeTask(String taskId, Map<String, Object> variables);
-
- /** Deletes this task, marks the related history task as completed
- * with the specified outcome. If the task was created in the context
- * of a process execution, this operation may result in a process instance
- * being triggered. The outcome in that case corresponds to an outgoing
+ void completeTask(String taskId, Map<String, ?> variables);
+
+ /** Deletes this task, marks the related history task as completed
+ * with the specified outcome. If the task was created in the context
+ * of a process execution, this operation may result in a process instance
+ * being triggered. The outcome in that case corresponds to an outgoing
* transition in the process. */
void completeTask(String taskId, String outcome);
-
+
/** Deletes this task, marks the related history task as completed with the
* specified outcome. The given variables are created (or they overwrite
* existing values) as task variables. If the task was created in the context
* of a process execution, this operation may result in a process instance
* being triggered. The outcome in that case corresponds to an outgoing
* transition in the process. */
- void completeTask(String taskId, String outcome, Map<String, Object> variables);
+ void completeTask(String taskId, String outcome, Map<String, ?> variables);
/** Deletes the task without completing it.
* The history information is kept in the DB.
- * If this task was created in the context of a process execution,
- * the execution remains active and the {@link ExecutionService#signalExecutionById(String)}
- * is to be given explicitly. */
+ * If this task was created in the context of a process execution,
+ * the execution remains active and the {@link ExecutionService#signalExecutionById(String)}
+ * is to be given explicitly. */
void deleteTask(String taskId);
/** deletes this task, including all history information */
void deleteTaskCascade(String taskId);
- /** Deletes the task without completing indicating the reason. Example reasons
+ /** Deletes the task without completing indicating the reason. Example reasons
* could be: "failed", "error", "exited", "obsolete" or "deleted".
* The history information is kept in the DB.
- * The reason ends up as the state in the {@link HistoryActivityInstance}.
- * If this task was created in the context of a process execution,
- * the execution remains active and the {@link ExecutionService#signalExecutionById(String)}
- * is to be given explicitly. */
+ * The reason ends up as the state in the {@link HistoryActivityInstance}.
+ * If this task was created in the context of a process execution,
+ * the execution remains active and the {@link ExecutionService#signalExecutionById(String)}
+ * is to be given explicitly. */
void deleteTask(String taskId, String reason);
/** add a role to a given task.
* @param participationType specifies the kind of involvement of the participatingUser
* in this task. see {@link Participation} for default constants. */
void addTaskParticipatingUser(String taskId, String userId, String participationType);
-
+
/** add a role to a given task.
* @param participationType specifies the kind of involvement of the participatingUser
* in this task. see {@link Participation} for default constants. */
void addTaskParticipatingGroup(String taskId, String groupId, String participationType);
-
+
/** get roles related to a given task. */
List<Participation> getTaskParticipations(String taskId);
-
- /** removes a role to a given task. Nothing happens (no exception) if
+
+ /** removes a role to a given task. Nothing happens (no exception) if
* the role does not exist.
* @param participationType specifies the kind of involvement of the participatingUser
* in this task. see {@link Participation} for default constants. */
void removeTaskParticipatingUser(String taskId, String userId, String participationType);
-
- /** removes a role to a given task. Nothing happens (no exception) if
+
+ /** removes a role to a given task. Nothing happens (no exception) if
* the role does not exist.
* @param participationType specifies the kind of involvement of the participatingUser
* in this task. see {@link Participation} for default constants. */
@@ -148,7 +148,7 @@
/** create a new query for tasks */
TaskQuery createTaskQuery();
- /** list of tasks that are assigned to the given user.
+ /** list of tasks that are assigned to the given user.
* Returns an empty list in case no such tasks exist. */
List<Task> findPersonalTasks(String userId);
@@ -162,8 +162,8 @@
/** add a comment to a task */
HistoryComment addTaskComment(String taskId, String message);
- /** get the list of comments made to a task. this will
- * fetch all the comments and recursively all replies to those
+ /** get the list of comments made to a task. this will
+ * fetch all the comments and recursively all replies to those
* comments. */
List<HistoryComment> getTaskComments(String taskId);
@@ -175,7 +175,7 @@
void deleteComment(String commentId);
/** creates or overwrites the variable values on the given task */
- void setVariables(String taskId, Map<String, Object> variables);
+ void setVariables(String taskId, Map<String, ?> variables);
/** retrieves a variable */
Object getVariable(String taskId, String variableName);
@@ -185,8 +185,8 @@
/** retrieves a map of variables */
Map<String, Object> getVariables(String taskId, Set<String> variableNames);
-
+
/** the set of possible valid outcomes for this task.
- * An empty set means that any value is possible. */
+ * An empty set means that any value is possible. */
Set<String> getOutcomes(String taskId);
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java 2010-05-21 06:10:39 UTC (rev 6367)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceCmd.java 2010-05-21 06:18:22 UTC (rev 6368)
@@ -41,7 +41,7 @@
protected String processDefinitionId;
protected String executionKey;
- public StartProcessInstanceCmd(String processDefinitionId, Map<String, Object> variables, String executionKey) {
+ public StartProcessInstanceCmd(String processDefinitionId, Map<String, ?> variables, String executionKey) {
this.processDefinitionId = processDefinitionId;
this.variables = variables;
this.executionKey = executionKey;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2010-05-21 06:10:39 UTC (rev 6367)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/ExecutionServiceImpl.java 2010-05-21 06:18:22 UTC (rev 6368)
@@ -54,11 +54,11 @@
return commandService.execute(new StartProcessInstanceCmd(processDefinitionId, null, executionKey));
}
- public ProcessInstance startProcessInstanceById(String processDefinitionId, Map<String, Object> variables){
+ public ProcessInstance startProcessInstanceById(String processDefinitionId, Map<String, ?> variables){
return commandService.execute(new StartProcessInstanceCmd(processDefinitionId, variables, null));
}
- public ProcessInstance startProcessInstanceById(String processDefinitionId, Map<String, Object> variables, String executionKey){
+ public ProcessInstance startProcessInstanceById(String processDefinitionId, Map<String, ?> variables, String executionKey){
return commandService.execute(new StartProcessInstanceCmd(processDefinitionId, variables, executionKey));
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java 2010-05-21 06:10:39 UTC (rev 6367)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/TaskServiceImpl.java 2010-05-21 06:18:22 UTC (rev 6368)
@@ -88,7 +88,7 @@
commandService.execute(new CompleteTaskCmd(taskId));
}
- public void completeTask(String taskId, Map<String, Object> variables) {
+ public void completeTask(String taskId, Map<String, ?> variables) {
completeTask(taskId, null, variables);
}
@@ -96,7 +96,7 @@
commandService.execute(new CompleteTaskCmd(taskId, outcome));
}
- public void completeTask(String taskId, String outcome, Map<String, Object> variables) {
+ public void completeTask(String taskId, String outcome, Map<String, ?> variables) {
SetTaskVariablesCmd setTaskVariablesCmd = new SetTaskVariablesCmd(taskId);
setTaskVariablesCmd.setVariables(variables);
CompositeCmd compositeCmd = new CompositeCmd();
@@ -194,7 +194,7 @@
return commandService.execute(new GetTaskVariablesCmd(taskDbid, variableNames));
}
- public void setVariables(String taskDbid, Map<String, Object> variables) {
+ public void setVariables(String taskDbid, Map<String, ?> variables) {
SetTaskVariablesCmd cmd = new SetTaskVariablesCmd(taskDbid);
cmd.setVariables(variables);
commandService.execute(cmd);
13 years, 11 months
JBoss JBPM SVN: r6367 - in jbpm4/trunk/modules: test-db/src/test/java/org/jbpm/test/activity/forkjoin and 1 other directory.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-05-21 02:10:39 -0400 (Fri, 21 May 2010)
New Revision: 6367
Added:
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/forkjoin/ForkResultsInNullEndActivityTest.java
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndActivity.java
Log:
JBPM-2833 when we end a child execution of processInstance, the history process instance didn't record end activity.
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndActivity.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndActivity.java 2010-05-21 06:03:10 UTC (rev 6366)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndActivity.java 2010-05-21 06:10:39 UTC (rev 6367)
@@ -37,29 +37,29 @@
public class EndActivity extends JpdlActivity {
private static final long serialVersionUID = 1L;
-
+
protected boolean endProcessInstance = true;
protected String state = null;
public void execute(ActivityExecution execution) {
execute((ExecutionImpl)execution);
}
-
+
public void execute(ExecutionImpl execution) {
Activity activity = execution.getActivity();
List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
ActivityImpl parentActivity = (ActivityImpl) activity.getParentActivity();
if ( (parentActivity!=null)
- && ("group".equals(parentActivity.getType()))
+ && ("group".equals(parentActivity.getType()))
) {
- // if the end activity itself has an outgoing transition
+ // if the end activity itself has an outgoing transition
// (such end activities should be drawn on the border of the group)
if ( (outgoingTransitions!=null)
&& (outgoingTransitions.size()==1)
) {
Transition outgoingTransition = outgoingTransitions.get(0);
- // taking the transition that goes over the group boundaries will
+ // taking the transition that goes over the group boundaries will
// destroy the scope automatically (see atomic operation TakeTransition)
execution.take(outgoingTransition);
@@ -67,15 +67,16 @@
execution.setActivity(parentActivity);
execution.signal();
}
-
+
} else {
ExecutionImpl executionToEnd = null;
if (endProcessInstance) {
executionToEnd = execution.getProcessInstance();
+ executionToEnd.setActivity(execution.getActivity());
} else {
executionToEnd = execution;
}
-
+
if (state==null) {
executionToEnd.end();
} else {
@@ -83,7 +84,7 @@
}
}
}
-
+
public void setEndProcessInstance(boolean endProcessInstance) {
this.endProcessInstance = endProcessInstance;
}
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/forkjoin/ForkResultsInNullEndActivityTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/forkjoin/ForkResultsInNullEndActivityTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activity/forkjoin/ForkResultsInNullEndActivityTest.java 2010-05-21 06:10:39 UTC (rev 6367)
@@ -0,0 +1,118 @@
+/*
+ * 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.activity.forktest;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.test.JbpmTestCase;
+
+import java.util.Set;
+
+public class ForkResultsInNullEndActivityTest extends JbpmTestCase {
+ private String deploymentId;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ final String jpdl = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<process name=\"ForkTest\" xmlns=\"http://jbpm.org/4.3/jpdl\">\n" +
+ " <start name=\"preparing test\">\n" +
+ " <transition to=\"fork\"/>\n" +
+ " </start>\n" +
+ " <fork name=\"fork\">\n" +
+ " <transition to=\"state1\"/>\n" +
+ " <transition to=\"state2\"/>\n" +
+ " <transition to=\"cancel\"/>\n" +
+ " </fork>\n" +
+ " <state name=\"cancel\">\n" +
+ " <transition to=\"cancelled\"/>\n" +
+ " </state>\n" +
+ " <state name=\"state1\">\n" +
+ " <transition to=\"states completed\"/>\n" +
+ " </state>\n" +
+ " <state name=\"state2\">\n" +
+ " <transition to=\"states completed\"/>\n" +
+ " </state>\n" +
+ " <join multiplicity=\"2\" name=\"states completed\">\n" +
+ " <transition to=\"completed\"/>\n" +
+ " </join>\n" +
+ " <end name=\"cancelled\"/>\n" +
+ " <end name=\"completed\"/>\n" +
+ "</process>";
+
+ // Deploys the process
+ deploymentId = repositoryService.createDeployment().
+ addResourceFromString("ForkTest.jpdl.xml", jpdl).deploy();
+ }
+
+ protected void tearDown() throws Exception {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ super.tearDown();
+ }
+
+ private void verifyInitialActivities(ProcessInstance proc) {
+ String[] expectedStartActivities = {"state1", "state2", "cancel"};
+ Set<String> foundStartActivities = proc.findActiveActivityNames();
+ for (String act : expectedStartActivities) {
+ assertTrue(foundStartActivities.contains(act));
+ }
+ }
+
+ public void testCompleteJoin() {
+ ProcessInstance proc = executionService.startProcessInstanceByKey("ForkTest");
+ verifyInitialActivities(proc);
+
+ String state1Id = proc.findActiveExecutionIn("state1").getId();
+ proc = executionService.signalExecutionById(state1Id);
+
+ String state2Id = proc.findActiveExecutionIn("state2").getId();
+ proc = executionService.signalExecutionById(state2Id);
+
+ assertExecutionEnded(proc.getId());
+
+ //the name of the end activity should now be set on the execution
+ ExecutionImpl executionImpl = (ExecutionImpl) proc;
+ assertEquals("completed", executionImpl.getActivityName());
+
+ assertEquals("completed", historyService.createHistoryProcessInstanceQuery()
+ .uniqueResult()
+ .getEndActivityName());
+ }
+
+ public void testCancelWithoutJoin() {
+ ProcessInstance proc = executionService.startProcessInstanceByKey("ForkTest");
+ verifyInitialActivities(proc);
+
+ String driveTruckExecutionId = proc.findActiveExecutionIn("cancel").getId();
+ proc = executionService.signalExecutionById(driveTruckExecutionId);
+
+ assertExecutionEnded(proc.getId());
+
+ //the name of the end activity should now be set on the execution
+ ExecutionImpl executionImpl = (ExecutionImpl) proc;
+ assertEquals("cancelled", executionImpl.getActivityName());
+
+ assertEquals("cancelled", historyService.createHistoryProcessInstanceQuery()
+ .uniqueResult()
+ .getEndActivityName());
+ }
+
+}
13 years, 11 months
JBoss JBPM SVN: r6366 - in jbpm4/trunk/modules: test-db/src/test/java/org/jbpm/test/migration and 1 other directory.
by do-not-reply@jboss.org
Author: rebody
Date: 2010-05-21 02:03:10 -0400 (Fri, 21 May 2010)
New Revision: 6366
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/migration/InstanceMigrator.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/migration/InstanceMigratorTest.java
Log:
JBPM-2677 when there is no process definition for migration, we will meet a IndexOutOfBoundsException
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/migration/InstanceMigrator.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/migration/InstanceMigrator.java 2010-05-21 03:26:59 UTC (rev 6365)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/migration/InstanceMigrator.java 2010-05-21 06:03:10 UTC (rev 6366)
@@ -100,7 +100,9 @@
.list();
int startIndex = calculateStartIndex(processDefinitions.size() - 1, migrationDescriptor);
int endIndex = calculateEndIndex(processDefinitions.size() - 1, migrationDescriptor);
- if (startIndex > endIndex) startIndex = endIndex;
+ if (startIndex > endIndex || startIndex < 0) {
+ startIndex = endIndex;
+ }
return processDefinitions.subList(startIndex, endIndex);
}
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/migration/InstanceMigratorTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/migration/InstanceMigratorTest.java 2010-05-21 03:26:59 UTC (rev 6365)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/migration/InstanceMigratorTest.java 2010-05-21 06:03:10 UTC (rev 6366)
@@ -240,8 +240,12 @@
}
return result;
}
-
+ public void testNoProcessInstanceForMigration() {
+ ProcessDefinition pd2 = deployProcessDefinition("foobar", versionWithWildcardVersionRange);
+ repositoryService.deleteDeploymentCascade(pd2.getDeploymentId());
+ }
+
public void testNoMigration() {
ProcessDefinition pd1 = deployProcessDefinition("foobar", originalVersion);
ProcessInstance pi1 = startAndSignal(pd1, "a");
13 years, 11 months
JBoss JBPM SVN: r6365 - in jbpm4/trunk/modules: jpdl/src/test/java/org/jbpm/jpdl and 6 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2010-05-20 23:26:59 -0400 (Thu, 20 May 2010)
New Revision: 6365
Removed:
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/test/
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/db/
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/test/JbpmTestExtensionsImpl.java
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestExtensions.java
Modified:
jbpm4/trunk/modules/jpdl/pom.xml
jbpm4/trunk/modules/pvm/pom.xml
jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/test/EnvironmentFactoryTestCase.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/JbpmTestCase.java
jbpm4/trunk/modules/test-db/pom.xml
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TimerTest.java
Log:
JBPM-2839: move jbpm-test-base dependency of jbpm-pvm to test scope
disentangle compilation dependency on jbpm-test-base by removing JbpmTestExtensions
Modified: jbpm4/trunk/modules/jpdl/pom.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/pom.xml 2010-05-21 02:10:12 UTC (rev 6364)
+++ jbpm4/trunk/modules/jpdl/pom.xml 2010-05-21 03:26:59 UTC (rev 6365)
@@ -64,12 +64,6 @@
<excludes>
<exclude>org/jbpm/test/update/ProcessUpdateTest.java</exclude>
</excludes>
- <systemProperties>
- <property>
- <name>org.jbpm.test.JbpmTestExtensions</name>
- <value>org.jbpm.jpdl.test.JbpmTestExtensionsImpl</value>
- </property>
- </systemProperties>
</configuration>
</plugin>
</plugins>
Modified: jbpm4/trunk/modules/pvm/pom.xml
===================================================================
--- jbpm4/trunk/modules/pvm/pom.xml 2010-05-21 02:10:12 UTC (rev 6364)
+++ jbpm4/trunk/modules/pvm/pom.xml 2010-05-21 03:26:59 UTC (rev 6365)
@@ -182,12 +182,6 @@
<exclude>**/*TestCase.java</exclude>
<exclude>org/jbpm/examples/bpmn/gateway/exclusive/ExclusiveGateway*</exclude>
</excludes>
- <systemProperties>
- <property>
- <name>org.jbpm.test.JbpmTestExtensions</name>
- <value>org.jbpm.pvm.test.JbpmTestExtensionsImpl</value>
- </property>
- </systemProperties>
</configuration>
</plugin>
</plugins>
Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/test/EnvironmentFactoryTestCase.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/test/EnvironmentFactoryTestCase.java 2010-05-21 02:10:12 UTC (rev 6364)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/test/EnvironmentFactoryTestCase.java 2010-05-21 03:26:59 UTC (rev 6365)
@@ -29,55 +29,44 @@
import org.jbpm.pvm.internal.env.EnvironmentFactory;
import org.jbpm.test.BaseJbpmTestCase;
-
/**
* @author Tom Baeyens
*/
public abstract class EnvironmentFactoryTestCase extends BaseJbpmTestCase {
-
- String configResource;
- static Map<String, EnvironmentFactory> environmentFactories = new HashMap<String, EnvironmentFactory>();
-
+ private String configResource;
+
+ private static Map<String, EnvironmentFactory> environmentFactories = new HashMap<String, EnvironmentFactory>();
+
public EnvironmentFactoryTestCase() {
this("jbpm.cfg.xml");
}
-
+
public EnvironmentFactoryTestCase(String configResource) {
this.configResource = configResource;
}
public EnvironmentFactory getEnvironmentFactory() {
- if (isEnvironmentFactoryCached()) {
- return environmentFactories.get(configResource);
+ EnvironmentFactory environmentFactory = environmentFactories.get(configResource);
+ if (environmentFactory == null) {
+ environmentFactory = createEnvironmentFactory(configResource);
}
- return createEnvironmentFactory();
+ return environmentFactory;
}
- boolean isEnvironmentFactoryCached() {
- return environmentFactories.containsKey(configResource);
- }
-
- EnvironmentFactory createEnvironmentFactory() {
- return createEnvironmentFactory(configResource);
- }
-
- static EnvironmentFactory createEnvironmentFactory(String configResource) {
+ private EnvironmentFactory createEnvironmentFactory(String configResource) {
try {
- log.debug("creating environment factory for ["+configResource+"]");
- EnvironmentFactory newEnvironmentFactory = (EnvironmentFactory) new Configuration().setResource(configResource).buildProcessEngine();
+ log.debug("creating environment factory for [" + configResource + "]");
+ EnvironmentFactory newEnvironmentFactory = (EnvironmentFactory) new Configuration()
+ .setResource(configResource)
+ .buildProcessEngine();
environmentFactories.put(configResource, newEnvironmentFactory);
return newEnvironmentFactory;
- } catch (Exception e) {
- throw new JbpmException("Exception during creation of environment factory for "+configResource, e);
}
- }
-
- static void closeEnvironmentFactory(String configResource) {
- EnvironmentFactory environmentFactory = environmentFactories.remove(configResource);
- if (environmentFactory!=null) {
- log.debug("closing environment factory for ["+configResource+"]");
- environmentFactory.close();
+ catch (Exception e) {
+ throw new JbpmException("Exception during creation of environment factory for "
+ + configResource, e);
}
}
+
}
Deleted: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/test/JbpmTestExtensionsImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/test/JbpmTestExtensionsImpl.java 2010-05-21 02:10:12 UTC (rev 6364)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/test/JbpmTestExtensionsImpl.java 2010-05-21 03:26:59 UTC (rev 6365)
@@ -1,43 +0,0 @@
-/*
- * 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.test;
-
-import java.util.Date;
-
-import org.jbpm.pvm.internal.util.Clock;
-import org.jbpm.test.JbpmTestExtensions;
-
-/**
- * @author Tom Baeyens
- */
-public class JbpmTestExtensionsImpl extends JbpmTestExtensions {
-
- @Override
- public Date getExplicitTime() {
- return Clock.getExplicitTime();
- }
-
- @Override
- public void setExplicitTime(Date explicitTime) {
- Clock.setExplicitTime(explicitTime);
- }
-}
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 2010-05-21 02:10:12 UTC (rev 6364)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/BaseJbpmTestCase.java 2010-05-21 03:26:59 UTC (rev 6365)
@@ -21,10 +21,8 @@
*/
package org.jbpm.test;
-import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
-import org.jbpm.api.JbpmException;
import org.jbpm.internal.log.Jdk14LogFactory;
import org.jbpm.internal.log.Log;
import org.jbpm.internal.log.LogFormatter;
@@ -55,48 +53,23 @@
Jdk14LogFactory.initializeJdk14Logging();
}
- static protected JbpmTestExtensions jbpmTestExtensions = JbpmTestExtensions.getJbpmTestExtensions();
- static protected Log log = Log.getLog(BaseJbpmTestCase.class.getName());
-
- Throwable exception;
+ protected final Log log = Log.getLog(getClass().getName());
+ @Override
protected void setUp() throws Exception {
LogFormatter.resetIndentation();
log.debug("=== starting "+getName()+" =============================");
}
+ @Override
protected void tearDown() throws Exception {
log.debug("=== ending "+getName()+" =============================\n");
-
- if (jbpmTestExtensions.getExplicitTime()!=null) {
- jbpmTestExtensions.setExplicitTime(null);
- throw new JbpmException("This test forgot to unset the explicit time of the clock. use JbpmTestExtensions.getJbpmTestExtensions().setExplicitTime(null);");
- }
}
public void assertTextPresent(String expected, String value) {
- if ( (value==null)
- || (value.indexOf(expected)==-1)
- ) {
+ if (value == null || !value.contains(expected)) {
fail("expected presence of '"+expected+"' but was '"+value+"'");
}
}
-
- protected void runTest() throws Throwable {
- try {
- super.runTest();
- } catch (AssertionFailedError e) {
- 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/JbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2010-05-21 02:10:12 UTC (rev 6364)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java 2010-05-21 03:26:59 UTC (rev 6365)
@@ -74,6 +74,7 @@
* in the tearDown. This is a convenience function as each test is expected to clean up the DB. */
protected List<String> registeredDeployments = new ArrayList<String>();
+ @Override
protected void setUp() throws Exception {
super.setUp();
initialize();
@@ -92,6 +93,7 @@
}
}
+ @Override
protected void tearDown() throws Exception {
deleteRegisteredDeployments();
String errorMsg = verifyDbClean();
@@ -99,11 +101,7 @@
super.tearDown();
if (errorMsg!=null) {
- if (exception==null) {
- throw new JbpmException(errorMsg);
- } else {
- throw new JbpmException(errorMsg, exception);
- }
+ throw new JbpmException(errorMsg);
}
}
Deleted: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestExtensions.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestExtensions.java 2010-05-21 02:10:12 UTC (rev 6364)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestExtensions.java 2010-05-21 03:26:59 UTC (rev 6365)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.test;
-
-import java.util.Date;
-
-import org.jbpm.api.JbpmException;
-
-/**
- * @author Tom Baeyens
- */
-public abstract class JbpmTestExtensions {
-
- private static final String PROPERTY_NAME = "org.jbpm.test.JbpmTestExtensions";
- private static final JbpmTestExtensions instance = instantiateJbpmTestExtentions();
-
- protected static JbpmTestExtensions instantiateJbpmTestExtentions() {
- String implClassName = System.getProperty(PROPERTY_NAME);
- if (implClassName == null) {
- throw new JbpmException("system property not specified: " + PROPERTY_NAME);
- }
-
- try {
- ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
- Class<?> implClass = Class.forName(implClassName, false, contextClassLoader);
- try {
- return (JbpmTestExtensions) implClass.newInstance();
- }
- catch (InstantiationException e) {
- throw new JbpmException("failed to instantiate " + implClass, e);
- }
- catch (IllegalAccessException e) {
- throw new JbpmException(JbpmTestExtensions.class + " has no access to " + implClass, e);
- }
- }
- catch (ClassNotFoundException e) {
- throw new JbpmException("could not find class " + implClassName, e);
- }
- }
-
- public static JbpmTestExtensions getJbpmTestExtensions() {
- return instance;
- }
-
- public abstract void setExplicitTime(Date explicitTime);
- public abstract Date getExplicitTime();
-}
Modified: jbpm4/trunk/modules/test-db/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-db/pom.xml 2010-05-21 02:10:12 UTC (rev 6364)
+++ jbpm4/trunk/modules/test-db/pom.xml 2010-05-21 03:26:59 UTC (rev 6365)
@@ -27,7 +27,6 @@
<!-- Dependencies -->
<dependencies>
-
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-api</artifactId>
@@ -97,11 +96,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<failIfNoTests>false</failIfNoTests>
- <trimStackTrace>false</trimStackTrace>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
- <excludes>
-
- </excludes>
</configuration>
</plugin>
</plugins>
Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TimerTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TimerTest.java 2010-05-21 02:10:12 UTC (rev 6364)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/timer/TimerTest.java 2010-05-21 03:26:59 UTC (rev 6365)
@@ -33,7 +33,6 @@
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;
/**
@@ -445,7 +444,6 @@
}
public void notify(EventListenerExecution execution) throws Exception {
- log.debug("Timer went off, taking transition");
nrOfTimesCalled++;
}
}
13 years, 11 months