JBoss JBPM SVN: r5888 - in jbpm4/trunk: modules/test-db and 1 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-11-09 11:29:11 -0500 (Mon, 09 Nov 2009)
New Revision: 5888
Modified:
jbpm4/trunk/modules/distro/src/main/files/install/build.xml
jbpm4/trunk/modules/test-db/.classpath
jbpm4/trunk/qa/build.xml
Log:
jboss and tomcat fixes related to bpmn scripting
Modified: jbpm4/trunk/modules/distro/src/main/files/install/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/build.xml 2009-11-09 13:54:10 UTC (rev 5887)
+++ jbpm4/trunk/modules/distro/src/main/files/install/build.xml 2009-11-09 16:29:11 UTC (rev 5888)
@@ -311,9 +311,16 @@
<include name="freemarker.jar" />
<include name="livetribe-jsr223.jar" />
<include name="juel*.jar" />
+ <include name="groovy-all.jar" />
</fileset>
</copy>
+ <copy todir="${jboss.home}/common/lib" overwrite="true">
+ <fileset dir="${jbpm.home}/lib">
+ <include name="bsh.jar" />
+ </fileset>
+ </copy>
+
<mkdir dir="${jboss.home}/docs/examples/jbpm" />
<copy todir="${jboss.home}/docs/examples/jbpm" overwrite="true">
<fileset dir="${jbpm.home}/install/src/jboss/datasources" />
@@ -446,10 +453,12 @@
<fileset dir="${jbpm.home}/lib">
<include name="activation.jar" />
<include name="antlr.jar" />
+ <include name="bsh.jar" />
<include name="commons-collections.jar" />
<include name="commons-logging.jar" />
<include name="dom4j.jar" />
<include name="freemarker.jar" />
+ <include name="groovy-all.jar" />
<include name="hibernate-core.jar" />
<include name="hibernate-cglib-repack.jar" />
<include name="javassist.jar" />
Modified: jbpm4/trunk/modules/test-db/.classpath
===================================================================
--- jbpm4/trunk/modules/test-db/.classpath 2009-11-09 13:54:10 UTC (rev 5887)
+++ jbpm4/trunk/modules/test-db/.classpath 2009-11-09 16:29:11 UTC (rev 5888)
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Modified: jbpm4/trunk/qa/build.xml
===================================================================
--- jbpm4/trunk/qa/build.xml 2009-11-09 13:54:10 UTC (rev 5887)
+++ jbpm4/trunk/qa/build.xml 2009-11-09 16:29:11 UTC (rev 5888)
@@ -91,6 +91,9 @@
<fileset dir="../modules/test-cactus/target/jbpm.test.webapp.libs" />
</copy>
+ <!-- add the bsh lib -->
+ <copy file="${jbpm.home}/lib/bsh.jar" todir="${tomcat.home}/webapps/jbpm-test-webapp/WEB-INF/lib" />
+
<!-- start tomcat -->
<ant antfile="${jbpm.home}/install/build.xml" target="start.tomcat" />
</target>
14 years, 5 months
JBoss JBPM SVN: r5887 - in jbpm4/trunk: modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes and 11 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-11-09 08:54:10 -0500 (Mon, 09 Nov 2009)
New Revision: 5887
Added:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionCondition.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/BshScriptEngine.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/BshScriptEngineFactory.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/GroovyCompiledScript.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/GroovyScriptEngine.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/GroovyScriptEngineFactory.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/ScriptContextEngineView.java
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.scriptmanager.xml
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ExclusiveGatewayTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ParallelGatewayTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ScriptTaskTest.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/UserTaskTest.java
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/UserTaskGroup.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/UserTaskSequenceFlowCondition.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/UserTaskSimple.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGateway.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayConvergingInvalid.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayDivergingInvalid.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayInvalidConditionExpression.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayMixedInvalid.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayMixedValid.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayNonBoundDefault.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayNonExistingDefault.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayXPath.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/forkWithUncontrolledSequenceFlow.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/forkWithUncontrolledSequenceFlowCondition.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/parallelGateway.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/parallelGatewayInvalid.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/scriptTask.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/shipment.java.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/shipment.pdf
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/shipment.ws.bpmn.xml
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/xmlTestDocument.xml
Removed:
jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/example/
jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/
jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/test/
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExpressionCondition.java
Modified:
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java
jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java
jbpm4/trunk/modules/pvm/pom.xml
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml
jbpm4/trunk/modules/test-db/pom.xml
jbpm4/trunk/pom.xml
Log:
moved bpmn test suite to jbpm-test-db module
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java 2009-11-06 19:42:41 UTC (rev 5886)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/BpmnActivity.java 2009-11-09 13:54:10 UTC (rev 5887)
@@ -25,7 +25,6 @@
import java.util.List;
import org.jbpm.api.Execution;
-import org.jbpm.api.JbpmException;
import org.jbpm.api.activity.ActivityBehaviour;
import org.jbpm.bpmn.parser.BindingsParser;
import org.jbpm.internal.log.Log;
@@ -33,7 +32,6 @@
import org.jbpm.pvm.internal.model.Condition;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.model.Transition;
-import org.jbpm.pvm.internal.model.TransitionImpl;
/**
* Basic activity for BPMN activities (tasks, gateways and event)
@@ -52,26 +50,8 @@
protected static final boolean CONDITIONS_CHECKED = true;
protected static final boolean CONDITIONS_IGNORED = !CONDITIONS_CHECKED;
- // protected String default_;
- protected List<ActivityResource> activvityResources = new ArrayList();
+ protected List<ActivityResource> activvityResources = new ArrayList<ActivityResource>();
-// protected void leaveBpmnActivity(ExecutionImpl execution) {
-//
-// proceedForkedIfAllowed(execution, FORK_ALLOWED, CONDITIONS_CHECKED);
-//
-// }
-//
-// protected void leaveBpmnActivitySingle(ExecutionImpl execution) {
-// proceedForkedIfAllowed(execution, FORK_DISALLOWED, CONDITIONS_CHECKED);
-//
-// }
-//
-// protected void leaveBpmnActivityAll(ExecutionImpl execution) {
-//
-// proceedForkedIfAllowed(execution, FORK_ALLOWED, CONDITIONS_IGNORED);
-//
-// }
-
/**
* In BPMN multiple outgoing sequence flows behave like a fork.
*
@@ -119,7 +99,6 @@
}
protected List<Transition> findTransitions(ExecutionImpl execution, boolean checkConditions) {
-
Activity activity = execution.getActivity();
// evaluate the conditions and find the transitions that should be forked
List<Transition> forkingTransitions = new ArrayList<Transition>();
@@ -127,7 +106,12 @@
for (Transition transition : outgoingTransitions) {
Condition condition = transition.getCondition();
// also ignore the default transition of the exclusive gateway
- if ((condition == null || !checkConditions || condition.evaluate(execution)) && activity.getDefaultOutgoingTransition() != transition) {
+ if ( ( (condition == null)
+ || (!checkConditions)
+ || (condition.evaluate(execution))
+ )
+ && (activity.getDefaultOutgoingTransition() != transition)
+ ) {
forkingTransitions.add(transition);
}
}
@@ -135,14 +119,6 @@
return forkingTransitions;
}
- // public String getDefault_ () {
- // return this.default_;
- // }
- //
- // public void setDefault_ (String default_) {
- // this.default_ = default_;
- // }
-
public void addActivityResource(ActivityResource activityResource) {
this.activvityResources.add(activityResource);
}
Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java 2009-11-06 19:42:41 UTC (rev 5886)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java 2009-11-09 13:54:10 UTC (rev 5887)
@@ -38,6 +38,7 @@
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.model.CompositeElementImpl;
+import org.jbpm.pvm.internal.model.ExpressionCondition;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.model.ScopeElementImpl;
import org.jbpm.pvm.internal.model.TransitionImpl;
@@ -266,9 +267,10 @@
// TODO: add looking up the default language in the document if lang
// is null.
-// TODO refactor according to PVM updates. see package org.jbpm.pvm.internal.wire.usercode
-// ExpressionEvaluatorDescriptor expressionDescriptor = new ExpressionEvaluatorDescriptor(expr, lang);
-// transition.setConditionDescriptor(expressionDescriptor);
+ ExpressionCondition expressionCondition = new ExpressionCondition();
+ expressionCondition.setExpression(expr);
+ expressionCondition.setLanguage(lang);
+ transition.setCondition(expressionCondition);
} else {
parse.addProblem("Type of the conditionExpression on sequenceFlow with id=" + transitionId + " is of onsupported type 'bpmn:tExpression'",
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java 2009-11-06 19:42:41 UTC (rev 5886)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java 2009-11-09 13:54:10 UTC (rev 5887)
@@ -25,6 +25,7 @@
import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ExpressionCondition;
import org.jbpm.pvm.internal.model.TransitionImpl;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.usercode.UserCodeCondition;
Deleted: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExpressionCondition.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExpressionCondition.java 2009-11-06 19:42:41 UTC (rev 5886)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExpressionCondition.java 2009-11-09 13:54:10 UTC (rev 5887)
@@ -1,55 +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.jpdl.internal.activity;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.model.OpenExecution;
-import org.jbpm.pvm.internal.model.Condition;
-import org.jbpm.pvm.internal.script.ScriptManager;
-
-
-/**
- * @author Tom Baeyens
- */
-public class ExpressionCondition implements Condition {
-
- private static final long serialVersionUID = 1L;
-
- protected String expression;
- protected String language;
-
- public boolean evaluate(OpenExecution execution) {
- ScriptManager scriptManager = ScriptManager.getScriptManager();
- Object result = scriptManager.evaluateExpression(expression, language);
- if (result instanceof Boolean) {
- return ((Boolean) result).booleanValue();
- }
- throw new JbpmException("expression condition '"+expression+"' did not return a boolean: "+result);
- }
-
- public void setExpression(String expression) {
- this.expression = expression;
- }
- public void setLanguage(String language) {
- this.language = language;
- }
-}
Modified: jbpm4/trunk/modules/pvm/pom.xml
===================================================================
--- jbpm4/trunk/modules/pvm/pom.xml 2009-11-06 19:42:41 UTC (rev 5886)
+++ jbpm4/trunk/modules/pvm/pom.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -77,6 +77,14 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.beanshell</groupId>
+ <artifactId>bsh</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionCondition.java (from rev 5886, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExpressionCondition.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionCondition.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionCondition.java 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.model;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.pvm.internal.script.ScriptManager;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExpressionCondition implements Condition {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String expression;
+ protected String language;
+
+ public boolean evaluate(OpenExecution execution) {
+ ScriptManager scriptManager = ScriptManager.getScriptManager();
+ Object result = scriptManager.evaluateExpression(expression, language);
+ if (result instanceof Boolean) {
+ return ((Boolean) result).booleanValue();
+ }
+ throw new JbpmException("expression condition '"+expression+"' did not return a boolean: "+result);
+ }
+
+ public void setExpression(String expression) {
+ this.expression = expression;
+ }
+ public void setLanguage(String language) {
+ this.language = language;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExpressionCondition.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/BshScriptEngine.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/BshScriptEngine.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/BshScriptEngine.java 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,340 @@
+package org.jbpm.pvm.internal.script;
+
+import java.io.*;
+import java.util.Map;
+import javax.script.*;
+import bsh.*;
+import static javax.script.ScriptContext.*;
+
+/*
+ Notes
+ This engine supports open-ended pluggable scriptcontexts
+*/
+public class BshScriptEngine extends AbstractScriptEngine
+ implements Compilable, Invocable
+{
+ // The BeanShell global namespace for the interpreter is stored in the
+ // engine scope map under this key.
+ static final String engineNameSpaceKey = "org_beanshell_engine_namespace";
+
+ private BshScriptEngineFactory factory;
+ private bsh.Interpreter interpreter;
+
+ public BshScriptEngine() {
+ this( null );
+ }
+
+ public BshScriptEngine( BshScriptEngineFactory factory )
+ {
+ this.factory = factory;
+ getInterpreter(); // go ahead and prime the interpreter now
+ }
+
+ protected Interpreter getInterpreter()
+ {
+ if ( interpreter == null ) {
+ this.interpreter = new bsh.Interpreter();
+ interpreter.setNameSpace(null); // should always be set by context
+ }
+
+ return interpreter;
+ }
+
+ public Object eval( String script, ScriptContext scriptContext )
+ throws ScriptException
+ {
+ return evalSource( script, scriptContext );
+ }
+
+ public Object eval( Reader reader, ScriptContext scriptContext )
+ throws ScriptException
+ {
+ return evalSource( reader, scriptContext );
+ }
+
+ /*
+ This is the primary implementation method.
+ We respect the String/Reader difference here in BeanShell because
+ BeanShell will do a few extra things in the string case... e.g.
+ tack on a trailing ";" semicolon if necessary.
+ */
+ private Object evalSource( Object source, ScriptContext scriptContext )
+ throws ScriptException
+ {
+ bsh.NameSpace contextNameSpace = getEngineNameSpace( scriptContext );
+ Interpreter bsh = getInterpreter();
+ bsh.setNameSpace( contextNameSpace );
+
+ // This is a big hack, convert writer to PrintStream
+ bsh.setOut( new PrintStream(
+ new WriterOutputStream( scriptContext.getWriter() ) ) );
+ bsh.setErr( new PrintStream(
+ new WriterOutputStream( scriptContext.getErrorWriter() ) ) );
+
+ try {
+ if ( source instanceof Reader )
+ return bsh.eval( (Reader) source );
+ else
+ return bsh.eval( (String) source );
+ } catch ( ParseException e ) {
+ // explicit parsing error
+ throw new ScriptException(
+ e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber() );
+ } catch ( TargetError e ) {
+ // The script threw an application level exception
+ // set it as the cause ?
+ ScriptException se = new ScriptException(
+ e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber() );
+ se.initCause( e.getTarget() );
+ throw se;
+ } catch ( EvalError e ) {
+ // The script couldn't be evaluated properly
+ throw new ScriptException(
+ e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber() );
+ } catch ( InterpreterError e ) {
+ // The interpreter had a fatal problem
+ throw new ScriptException( e.toString() );
+ }
+ }
+
+
+
+ /*
+ Check the context for an existing global namespace embedded
+ in the script context engine scope. If none exists, ininitialize the
+ context with one.
+ */
+ private static NameSpace getEngineNameSpace( ScriptContext scriptContext )
+ {
+ NameSpace ns = (NameSpace)scriptContext.getAttribute(
+ engineNameSpaceKey, ENGINE_SCOPE );
+
+ if ( ns == null )
+ {
+ // Create a global namespace for the interpreter
+ Map engineView = new ScriptContextEngineView( scriptContext );
+ ns = new ExternalNameSpace(
+ null/*parent*/, "javax_script_context", engineView );
+
+ scriptContext.setAttribute( engineNameSpaceKey, ns, ENGINE_SCOPE );
+ }
+
+ return ns;
+ }
+
+ public Bindings createBindings()
+ {
+ return new SimpleBindings();
+ }
+
+ public ScriptEngineFactory getFactory()
+ {
+ if ( factory == null )
+ factory = new BshScriptEngineFactory();
+ return factory;
+ }
+
+ /**
+ * Compiles the script (source represented as a <code>String</code>) for later
+ * execution.
+ *
+ * @param script The source of the script, represented as a
+ * <code>String</code>.
+ *
+ * @return An subclass of <code>CompiledScript</code> to be executed later
+ * using one of the <code>eval</code> methods of <code>CompiledScript</code>.
+ *
+ * @throws ScriptException if compilation fails.
+ * @throws NullPointerException if the argument is null.
+ */
+
+ public CompiledScript compile( String script ) throws
+ ScriptException
+ {
+ return compile( new StringReader( script ) );
+ }
+
+ /**
+ * Compiles the script (source read from <code>Reader</code>) for later
+ * execution. Functionality is identical to <code>compile(String)</code> other
+ * than the way in which the source is passed.
+ *
+ * @param script The reader from which the script source is obtained.
+ *
+ * @return An implementation of <code>CompiledScript</code> to be executed
+ * later using one of its <code>eval</code> methods of
+ * <code>CompiledScript</code>.
+ *
+ * @throws ScriptException if compilation fails.
+ * @throws NullPointerException if argument is null.
+ */
+ public CompiledScript compile( Reader script ) throws
+ ScriptException
+ {
+ // todo
+ throw new Error("unimplemented");
+ }
+
+ /**
+ * Calls a procedure compiled during a previous script execution, which is
+ * retained in the state of the <code>ScriptEngine<code>.
+ *
+ * @param name The name of the script method to be called.
+ * @param thiz thiz is an instance of the script class returned by a previous execution or
+ * invocation, the named method is called through that instance.
+ * @param args Arguments to pass to the procedure. The rules for converting
+ * the arguments to scripting variables are implementation-specific.
+ *
+ * @return The value returned by the method. The rules for converting the
+ * scripting variable returned by the procedure to a Java Object are
+ * implementation-specific.
+ *
+ * @throws javax.script.ScriptException if an error occurrs during invocation
+ * of the method.
+ * @throws NoSuchMethodException if method with given name or matching argument
+ * types cannot be found.
+ * @throws NullPointerException if method name is null.
+ */
+ public Object invokeMethod( Object thiz, String name, Object... args ) throws ScriptException, NoSuchMethodException
+ {
+ if ( ! (thiz instanceof bsh.This) )
+ throw new ScriptException( "Illegal objec type: " +thiz.getClass() );
+
+ bsh.This bshObject = (bsh.This)thiz;
+
+ try {
+ return bshObject.invokeMethod( name, args );
+ } catch ( ParseException e ) {
+ // explicit parsing error
+ throw new ScriptException(
+ e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber() );
+ } catch ( TargetError e ) {
+ // The script threw an application level exception
+ // set it as the cause ?
+ ScriptException se = new ScriptException(
+ e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber() );
+ se.initCause( e.getTarget() );
+ throw se;
+ } catch ( EvalError e ) {
+ // The script couldn't be evaluated properly
+ throw new ScriptException(
+ e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber() );
+ } catch ( InterpreterError e ) {
+ // The interpreter had a fatal problem
+ throw new ScriptException( e.toString() );
+ }
+ }
+
+ /**
+ * Used to call top-level procedures defined in scripts.
+ *
+ * @param name Name of the procedure
+ * @param args Arguments to pass to the procedure
+ *
+ * @return The value returned by the procedure
+ *
+ * @throws javax.script.ScriptException if an error occurrs during invocation
+ * of the method.
+ * @throws NoSuchMethodException if procedure with given name or matching
+ * argument types cannot be found.
+ * @throws NullPointerException if procedure name is null.
+ */
+ public Object invokeFunction( String name, Object... args )
+ throws ScriptException, NoSuchMethodException
+ {
+ return invokeMethod( getGlobal(), name, args );
+ }
+
+ /**
+ * Returns an implementation of an interface using procedures compiled in the
+ * interpreter. The methods of the interface may be implemented using the
+ * <code>invokeFunction</code> method.
+ *
+ * @param clasz The <code>Class</code> object of the interface to return.
+ *
+ * @return An instance of requested interface - null if the requested interface
+ * is unavailable, i. e. if compiled methods in the
+ * <code>ScriptEngine</code> cannot be found matching the ones in the
+ * requested interface.
+ *
+ * @throws IllegalArgumentException if the specified <code>Class</code> object
+ * does not exist or is not an interface.
+ */
+ public <T> T getInterface( Class<T> clasz )
+ {
+ try {
+ return (T) getGlobal().getInterface( clasz );
+ } catch ( UtilEvalError utilEvalError ) {
+ utilEvalError.printStackTrace();
+ return null;
+ }
+ }
+
+ /**
+ * Returns an implementation of an interface using member functions of a
+ * scripting object compiled in the interpreter. The methods of the interface
+ * may be implemented using invokeMethod(Object, String, Object...) method.
+ *
+ * @param thiz The scripting object whose member functions are used to
+ * implement the methods of the interface.
+ * @param clasz The <code>Class</code> object of the interface to return.
+ *
+ * @return An instance of requested interface - null if the requested
+ * interface is unavailable, i. e. if compiled methods in the
+ * <code>ScriptEngine</code> cannot be found matching the ones in the
+ * requested interface.
+ *
+ * @throws IllegalArgumentException if the specified <code>Class</code> object
+ * does not exist or is not an interface, or if the specified Object is null
+ * or does not represent a scripting object.
+ */
+ public <T> T getInterface( Object thiz, Class<T> clasz )
+ {
+ if ( !(thiz instanceof bsh.This) )
+ throw new IllegalArgumentException(
+ "invalid object type: "+thiz.getClass() );
+
+ try {
+ bsh.This bshThis = (bsh.This)thiz;
+ return (T) bshThis.getInterface( clasz );
+ } catch ( UtilEvalError utilEvalError ) {
+ utilEvalError.printStackTrace( System.err );
+ return null;
+ }
+ }
+
+ private bsh.This getGlobal()
+ {
+ // requires 2.0b5 to make getThis() public
+ return getEngineNameSpace( getContext() ).getThis( getInterpreter() );
+ }
+
+ /*
+ This is a total hack. We need to introduce a writer to the
+ Interpreter.
+ */
+ class WriterOutputStream extends OutputStream
+ {
+ Writer writer;
+ WriterOutputStream( Writer writer )
+ {
+ this.writer = writer;
+ }
+
+ public void write( int b ) throws IOException
+ {
+ writer.write(b);
+ }
+
+ public void flush() throws IOException
+ {
+ writer.flush();
+ }
+
+ public void close() throws IOException
+ {
+ writer.close();
+ }
+ }
+
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/BshScriptEngine.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/BshScriptEngineFactory.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/BshScriptEngineFactory.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/BshScriptEngineFactory.java 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,115 @@
+package org.jbpm.pvm.internal.script;
+
+import javax.script.*;
+import java.util.List;
+import java.util.Arrays;
+
+public class BshScriptEngineFactory implements
+ javax.script.ScriptEngineFactory
+{
+ // Begin impl ScriptEnginInfo
+
+ final List<String> extensions = Arrays.asList( "bsh", "java" );
+
+ final List<String> mimeTypes = Arrays.asList(
+ "application/x-beanshell",
+ "application/x-bsh",
+ "application/x-java-source"
+ );
+
+ final List<String> names = Arrays.asList( "beanshell", "bsh", "java" );
+
+ public String getEngineName() {
+ return "BeanShell Engine";
+ }
+
+ public String getEngineVersion() {
+ return "1.0";
+ }
+
+ public List<String> getExtensions() {
+ return extensions;
+ }
+
+ public List<String> getMimeTypes() {
+ return mimeTypes;
+ }
+
+ public List<String> getNames() {
+ return names;
+ }
+
+ public String getLanguageName() {
+ return "BeanShell";
+ }
+
+ public String getLanguageVersion() {
+ return bsh.Interpreter.VERSION + "";
+ }
+
+ public Object getParameter( String param ) {
+ if ( param.equals( ScriptEngine.ENGINE ) )
+ return getEngineName();
+ if ( param.equals( ScriptEngine.ENGINE_VERSION ) )
+ return getEngineVersion();
+ if ( param.equals( ScriptEngine.NAME ) )
+ return getEngineName();
+ if ( param.equals( ScriptEngine.LANGUAGE ) )
+ return getLanguageName();
+ if ( param.equals( ScriptEngine.LANGUAGE_VERSION ) )
+ return getLanguageVersion();
+ if ( param.equals( "THREADING" ) )
+ return "MULTITHREADED";
+
+ return null;
+ }
+
+ public String getMethodCallSyntax(
+ String objectName, String methodName, String ... args )
+ {
+ // Note: this is very close to the bsh.StringUtil.methodString()
+ // method, which constructs a method signature from arg *types*. Maybe
+ // combine these later.
+
+ StringBuilder sb = new StringBuilder();
+ if ( objectName != null )
+ sb.append( objectName + "." );
+ sb.append( methodName + "(" );
+ if ( args.length > 0 )
+ sb.append(" ");
+ for( int i=0; i<args.length; i++ )
+ sb.append( ( (args[i] == null) ? "null" : args[i] )
+ + ( i < (args.length-1) ? ", " : " " ) );
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public String getOutputStatement( String message ) {
+ return "print( \"" + message + "\" );";
+ }
+
+ public String getProgram( String ... statements )
+ {
+ StringBuilder sb = new StringBuilder();
+ for( int i=0; i< statements.length; i++ )
+ {
+ sb.append( statements[i] );
+ if ( !statements[i].endsWith(";") )
+ sb.append( ";" );
+ sb.append("\n");
+ }
+ return sb.toString();
+ }
+
+ // End impl ScriptEngineInfo
+
+ // Begin impl ScriptEngineFactory
+
+ public ScriptEngine getScriptEngine()
+ {
+ return new BshScriptEngine();
+ }
+
+ // End impl ScriptEngineFactory
+}
+
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/BshScriptEngineFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/GroovyCompiledScript.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/GroovyCompiledScript.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/GroovyCompiledScript.java 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met: Redistributions of source code
+ * must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution. Neither the name of the Sun Microsystems nor the names of
+ * is contributors may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * GroovyCompiledScript.java
+ * @author Mike Grogan
+ * @author A. Sundararajan
+ */
+
+package org.jbpm.pvm.internal.script;
+import javax.script.*;
+
+
+public class GroovyCompiledScript extends CompiledScript {
+
+ private GroovyScriptEngine engine;
+ private Class clasz;
+
+ public GroovyCompiledScript(GroovyScriptEngine engine, Class clasz) {
+ this.engine = engine;
+ this.clasz = clasz;
+ }
+
+ public Object eval(ScriptContext context) throws ScriptException {
+ return engine.eval(clasz, context);
+ }
+
+ public ScriptEngine getEngine() {
+ return engine;
+ }
+
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/GroovyCompiledScript.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/GroovyScriptEngine.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/GroovyScriptEngine.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/GroovyScriptEngine.java 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,356 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met: Redistributions of source code
+ * must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution. Neither the name of the Sun Microsystems nor the names of
+ * is contributors may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+/*
+ * GroovyScriptEngine.java
+ * @author Mike Grogan
+ * @author A. Sundararajan
+ */
+package org.jbpm.pvm.internal.script;
+import java.io.*;
+import java.util.*;
+import javax.script.*;
+import groovy.lang.*;
+import org.codehaus.groovy.syntax.SyntaxException;
+import org.codehaus.groovy.runtime.InvokerHelper;
+import org.codehaus.groovy.runtime.MetaClassHelper;
+import org.codehaus.groovy.runtime.MethodClosure;
+import org.codehaus.groovy.control.CompilerConfiguration;
+import org.codehaus.groovy.control.CompilationFailedException;
+import java.lang.reflect.*;
+
+public class GroovyScriptEngine
+ extends AbstractScriptEngine implements Compilable, Invocable {
+
+ private static boolean DEBUG = false;
+
+ // script-string-to-generated Class map
+ private Map<String, Class> classMap;
+ // global closures map - this is used to simulate a single
+ // global functions namespace
+ private Map<String, Closure> globalClosures;
+ // class loader for Groovy generated classes
+ private GroovyClassLoader loader;
+ // lazily initialized factory
+ private volatile GroovyScriptEngineFactory factory;
+
+ // counter used to generate unique global Script class names
+ private static int counter;
+
+ static {
+ counter = 0;
+ }
+
+ public GroovyScriptEngine() {
+ classMap = Collections.synchronizedMap(new HashMap<String, Class>());
+ globalClosures = Collections.synchronizedMap(new HashMap<String, Closure>());
+ loader = new GroovyClassLoader(getParentLoader(),
+ new CompilerConfiguration());
+ }
+
+ public Object eval(Reader reader, ScriptContext ctx)
+ throws ScriptException {
+ return eval(readFully(reader), ctx);
+ }
+
+ public Object eval(String script, ScriptContext ctx)
+ throws ScriptException {
+ try {
+ return eval(getScriptClass(script), ctx);
+ } catch (SyntaxException e) {
+ throw new ScriptException(e.getMessage(),
+ e.getSourceLocator(), e.getLine());
+ } catch (Exception e) {
+ if (DEBUG) e.printStackTrace();
+ throw new ScriptException(e);
+ }
+ }
+
+ public Bindings createBindings() {
+ return new SimpleBindings();
+ }
+
+ public ScriptEngineFactory getFactory() {
+ if (factory == null) {
+ synchronized (this) {
+ if (factory == null) {
+ factory = new GroovyScriptEngineFactory();
+ }
+ }
+ }
+ return factory;
+ }
+
+ // javax.script.Compilable methods
+ public CompiledScript compile(String scriptSource) throws ScriptException {
+ try {
+ return new GroovyCompiledScript(this,
+ getScriptClass(scriptSource));
+ } catch (SyntaxException e) {
+ throw new ScriptException(e.getMessage(),
+ e.getSourceLocator(), e.getLine());
+ } catch (IOException e) {
+ throw new ScriptException(e);
+ } catch (CompilationFailedException ee) {
+ throw new ScriptException(ee);
+ }
+ }
+
+ public CompiledScript compile(Reader reader) throws ScriptException {
+ return compile(readFully(reader));
+ }
+
+ // javax.script.Invocable methods.
+ public Object invokeFunction(String name, Object... args)
+ throws ScriptException, NoSuchMethodException {
+ return invokeImpl(null, name, args);
+ }
+
+ public Object invokeMethod(Object thiz, String name, Object... args)
+ throws ScriptException, NoSuchMethodException {
+ if (thiz == null) {
+ throw new IllegalArgumentException("script object is null");
+ }
+ return invokeImpl(thiz, name, args);
+ }
+
+ public <T> T getInterface(Class<T> clasz) {
+ return makeInterface(null, clasz);
+ }
+
+ public <T> T getInterface(Object thiz, Class<T> clasz) {
+ if (thiz == null) {
+ throw new IllegalArgumentException("script object is null");
+ }
+ return makeInterface(thiz, clasz);
+ }
+
+ // package-privates
+ Object eval(Class scriptClass, final ScriptContext ctx) throws ScriptException {
+ //add context to bindings
+ ctx.setAttribute("context", ctx, ScriptContext.ENGINE_SCOPE);
+
+ //direct output to ctx.getWriter
+ Writer writer = ctx.getWriter();
+ ctx.setAttribute("out", (writer instanceof PrintWriter) ?
+ writer :
+ new PrintWriter(writer),
+ ScriptContext.ENGINE_SCOPE);
+ /*
+ * We use the following Binding instance so that global variable lookup
+ * will be done in the current ScriptContext instance.
+ */
+ Binding binding = new Binding(ctx.getBindings(ScriptContext.ENGINE_SCOPE)) {
+ @Override
+ public Object getVariable(String name) {
+ synchronized (ctx) {
+ int scope = ctx.getAttributesScope(name);
+ if (scope != -1) {
+ return ctx.getAttribute(name, scope);
+ }
+ }
+ throw new MissingPropertyException(name, getClass());
+ }
+ @Override
+ public void setVariable(String name, Object value) {
+ synchronized (ctx) {
+ int scope = ctx.getAttributesScope(name);
+ if (scope == -1) {
+ scope = ScriptContext.ENGINE_SCOPE;
+ }
+ ctx.setAttribute(name, value, scope);
+ }
+ }
+ };
+
+ try {
+ Script scriptObject = InvokerHelper.createScript(scriptClass, binding);
+
+ // create a Map of MethodClosures from this new script object
+ Method[] methods = scriptClass.getMethods();
+ Map<String, Closure> closures = new HashMap<String, Closure>();
+ for (Method m : methods) {
+ String name = m.getName();
+ closures.put(name, new MethodClosure(scriptObject, name));
+ }
+
+ // save all current closures into global closures map
+ globalClosures.putAll(closures);
+
+ MetaClass oldMetaClass = scriptObject.getMetaClass();
+
+ /*
+ * We override the MetaClass of this script object so that we can
+ * forward calls to global closures (of previous or future "eval" calls)
+ * This gives the illusion of working on the same "global" scope.
+ */
+ scriptObject.setMetaClass(new DelegatingMetaClass(oldMetaClass) {
+ @Override
+ public Object invokeMethod(Object object, String name, Object args) {
+ if (args == null) {
+ return invokeMethod(object, name, MetaClassHelper.EMPTY_ARRAY);
+ }
+ if (args instanceof Tuple) {
+ return invokeMethod(object, name, ((Tuple)args).toArray());
+ }
+ if (args instanceof Object[]) {
+ return invokeMethod(object, name, (Object[]) args);
+ } else {
+ return invokeMethod(object, name, new Object[] { args });
+ }
+ }
+
+ @Override
+ public Object invokeMethod(Object object, String name, Object[] args) {
+ try {
+ return super.invokeMethod(object, name, args);
+ } catch (MissingMethodException mme) {
+ return callGlobal(name, args, ctx);
+ }
+ }
+ @Override
+ public Object invokeStaticMethod(Object object, String name, Object[] args) {
+ try {
+ return super.invokeStaticMethod(object, name, args);
+ } catch (MissingMethodException mme) {
+ return callGlobal(name, args, ctx);
+ }
+ }
+ });
+
+ return scriptObject.run();
+ } catch (Exception e) {
+ throw new ScriptException(e);
+ }
+ }
+
+ Class getScriptClass(String script)
+ throws SyntaxException,
+ CompilationFailedException,
+ IOException {
+ Class clazz = classMap.get(script);
+ if (clazz != null) {
+ return clazz;
+ }
+
+ InputStream stream = new ByteArrayInputStream(script.getBytes());
+ clazz = loader.parseClass(stream, generateScriptName());
+ classMap.put(script, clazz);
+ return clazz;
+ }
+
+ //-- Internals only below this point
+
+ // invokes the specified method/function on the given object.
+ private Object invokeImpl(Object thiz, String name, Object... args)
+ throws ScriptException, NoSuchMethodException {
+ if (name == null) {
+ throw new NullPointerException("method name is null");
+ }
+
+ try {
+ if (thiz != null) {
+ return InvokerHelper.invokeMethod(thiz, name, args);
+ } else {
+ return callGlobal(name, args);
+ }
+ } catch (MissingMethodException mme) {
+ throw new NoSuchMethodException(mme.getMessage());
+ } catch (Exception e) {
+ throw new ScriptException(e);
+ }
+ }
+
+ // call the script global function of the given name
+ private Object callGlobal(String name, Object[] args) {
+ return callGlobal(name, args, context);
+ }
+
+ private Object callGlobal(String name, Object[] args, ScriptContext ctx) {
+ Closure closure = globalClosures.get(name);
+ if (closure != null) {
+ return closure.call(args);
+ } else {
+ // Look for closure valued variable in the
+ // given ScriptContext. If available, call it.
+ Object value = ctx.getAttribute(name);
+ if (value instanceof Closure) {
+ return ((Closure)value).call(args);
+ } // else fall thru..
+ }
+ throw new MissingMethodException(name, getClass(), args);
+ }
+
+ // generate a unique name for top-level Script classes
+ private synchronized String generateScriptName() {
+ return "Script" + (++counter) + ".groovy";
+ }
+
+ private <T> T makeInterface(Object obj, Class<T> clazz) {
+ final Object thiz = obj;
+ if (clazz == null || !clazz.isInterface()) {
+ throw new IllegalArgumentException("interface Class expected");
+ }
+ return (T) Proxy.newProxyInstance(
+ clazz.getClassLoader(),
+ new Class[] { clazz },
+ new InvocationHandler() {
+ public Object invoke(Object proxy, Method m, Object[] args)
+ throws Throwable {
+ return invokeImpl(thiz, m.getName(), args);
+ }
+ });
+ }
+
+ // determine appropriate class loader to serve as parent loader
+ // for GroovyClassLoader instance
+ private ClassLoader getParentLoader() {
+ // check whether thread context loader can "see" Groovy Script class
+ ClassLoader ctxtLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ Class c = ctxtLoader.loadClass("org.codehaus.groovy.Script");
+ if (c == Script.class) {
+ return ctxtLoader;
+ }
+ } catch (ClassNotFoundException cnfe) {
+ }
+ // exception was thrown or we get wrong class
+ return Script.class.getClassLoader();
+ }
+
+ private String readFully(Reader reader) throws ScriptException {
+ char[] arr = new char[8*1024]; // 8K at a time
+ StringBuilder buf = new StringBuilder();
+ int numChars;
+ try {
+ while ((numChars = reader.read(arr, 0, arr.length)) > 0) {
+ buf.append(arr, 0, numChars);
+ }
+ } catch (IOException exp) {
+ throw new ScriptException(exp);
+ }
+ return buf.toString();
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/GroovyScriptEngine.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/GroovyScriptEngineFactory.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/GroovyScriptEngineFactory.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/GroovyScriptEngineFactory.java 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met: Redistributions of source code
+ * must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution. Neither the name of the Sun Microsystems nor the names of
+ * is contributors may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * GroovyScriptEngineFactory.java
+ * @author Mike Grogan
+ * @author A. Sundararajan
+ */
+
+package org.jbpm.pvm.internal.script;
+
+import javax.script.*;
+import java.util.*;
+
+public class GroovyScriptEngineFactory implements ScriptEngineFactory {
+
+ private static String VERSION = "1.5.6";
+
+ public String getEngineName() {
+ return "groovy";
+ }
+
+ public String getEngineVersion() {
+ return org.codehaus.groovy.runtime.InvokerHelper.getVersion();
+ }
+
+ public String getLanguageName() {
+ return "groovy";
+ }
+
+ public String getLanguageVersion() {
+ return VERSION;
+ }
+
+ public List<String> getExtensions() {
+ return extensions;
+ }
+
+ public List<String> getMimeTypes() {
+ return mimeTypes;
+ }
+
+ public List<String> getNames() {
+ return names;
+ }
+
+ public Object getParameter(String key) {
+
+ if (ScriptEngine.NAME.equals(key)) {
+ return "Groovy";
+ } else if (ScriptEngine.ENGINE.equals(key)) {
+ return "Groovy Script Engine";
+ } else if (ScriptEngine.ENGINE_VERSION.equals(key)) {
+ return org.codehaus.groovy.runtime.InvokerHelper.getVersion();
+ } else if (ScriptEngine.LANGUAGE.equals(key)) {
+ return "Groovy";
+ } else if (ScriptEngine.LANGUAGE_VERSION.equals(key)) {
+ return VERSION;
+ } else if ("THREADING".equals(key)) {
+ return "MULTITHREADED";
+ } else {
+ throw new IllegalArgumentException("Invalid key");
+ }
+
+ }
+
+
+ public ScriptEngine getScriptEngine() {
+ return new GroovyScriptEngine();
+ }
+
+ public String getMethodCallSyntax(String obj, String method,
+ String... args) {
+
+ String ret = obj + "." + method + "(";
+ int len = args.length;
+ if (len == 0) {
+ ret += ")";
+ return ret;
+ }
+
+ for (int i = 0; i < len; i++) {
+ ret += args[i];
+ if (i != len - 1) {
+ ret += ",";
+ } else {
+ ret += ")";
+ }
+ }
+ return ret;
+ }
+
+ public String getOutputStatement(String toDisplay) {
+ StringBuilder buf = new StringBuilder();
+ buf.append("println(\"");
+ int len = toDisplay.length();
+ for (int i = 0; i < len; i++) {
+ char ch = toDisplay.charAt(i);
+ switch (ch) {
+ case '"':
+ buf.append("\\\"");
+ break;
+ case '\\':
+ buf.append("\\\\");
+ break;
+ default:
+ buf.append(ch);
+ break;
+ }
+ }
+ buf.append("\")");
+ return buf.toString();
+ }
+
+ public String getProgram(String... statements) {
+ StringBuilder ret = new StringBuilder();
+ int len = statements.length;
+ for (int i = 0; i < len; i++) {
+ ret.append(statements[i]);
+ ret.append('\n');
+ }
+ return ret.toString();
+ }
+
+ private static List<String> names;
+ private static List<String> extensions;
+ private static List<String> mimeTypes;
+
+ static {
+ names = new ArrayList<String>(1);
+ names.add("groovy");
+ names = Collections.unmodifiableList(names);
+
+ extensions = names;
+
+ mimeTypes = new ArrayList<String>(0);
+ mimeTypes = Collections.unmodifiableList(mimeTypes);
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/GroovyScriptEngineFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/ScriptContextEngineView.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/ScriptContextEngineView.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/ScriptContextEngineView.java 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,268 @@
+package org.jbpm.pvm.internal.script;
+
+import javax.script.ScriptContext;
+import java.util.*;
+import static javax.script.ScriptContext.*;
+
+/**
+ * This class implements an ENGINE_SCOPE centric Map view of the ScriptContext
+ * for engine implementations. This class can be used to simplify engine
+ * implementations which have the capability to bind their namespaces to Maps
+ * or other external interfaces.
+ *
+ * Get operations on this view delegate to the
+ * ScriptContext inheriting get() method that automatically traverses the
+ * binding scopes in order or precedence. Put operations on this view always
+ * store values in the ENGINE_SCOPE bindings. Other operations such as
+ * size() and contains() are implemented appropriately, but perhaps not as
+ * efficiently as possible.
+ *
+*/
+public class ScriptContextEngineView implements Map<String,Object>
+{
+ ScriptContext context;
+
+ public ScriptContextEngineView( ScriptContext context )
+ {
+ this.context = context;
+ }
+
+ /**
+ * Returns the number of unique object bindings in all scopes.
+ * (duplicate, shadowed, bindings count as a single binging).
+ */
+ public int size()
+ {
+ return totalKeySet().size();
+ }
+
+ /**
+ * Returns true if no bindings are present in any scope of the context.
+ */
+ public boolean isEmpty()
+ {
+ return totalKeySet().size() == 0;
+ }
+
+ /**
+ * Returns true if the key name is bound in any scope in the context.
+ * The key must be a String.
+ *
+ * @param key key whose presence in this map is to be tested.
+ *
+ * @return <tt>true</tt> if this map contains a mapping for the specified key.
+ *
+ * @throws ClassCastException if the key is of an inappropriate type for this
+ * map (optional).
+ * @throws NullPointerException if the key is <tt>null</tt> and this map does
+ * not permit <tt>null</tt> keys (optional).
+ */
+ // Why isn't the compiler allowing this?
+ //public boolean containsKey( String key )
+ public boolean containsKey( Object key )
+ {
+ return context.getAttribute( (String)key ) != null;
+ }
+
+ /**
+ * Returns <tt>true</tt> if this map maps one or more keys to the specified
+ * value. More formally, returns <tt>true</tt> if and only if this map
+ * contains at least one mapping to a value <tt>v</tt> such that
+ * <tt>(value==null ? v==null : value.equals(v))</tt>. This operation will
+ * probably require time linear in the map size for most implementations of the
+ * <tt>Map</tt> interface.
+ *
+ * @param value value whose presence in this map is to be tested.
+ *
+ * @return <tt>true</tt> if this map maps one or more keys to the specified
+ * value.
+ *
+ * @throws ClassCastException if the value is of an inappropriate type for this
+ * map (optional).
+ * @throws NullPointerException if the value is <tt>null</tt> and this map does
+ * not permit <tt>null</tt> values (optional).
+ */
+ public boolean containsValue( Object value )
+ {
+ Set values = totalValueSet();
+ return values.contains( value );
+ }
+
+ /**
+ * Returns the value bound in the most specific (lowest numbered)
+ * bindings space for this key.
+ * key must be a String.
+ *
+ * @param key key whose associated value is to be returned.
+ *
+ * @return the value to which this map maps the specified key, or <tt>null</tt>
+ * if the map contains no mapping for this key.
+ *
+ * @throws ClassCastException if the key is of an inappropriate type for this
+ * map (optional).
+ * @throws NullPointerException if the key is <tt>null</tt> and this map does
+ * not permit <tt>null</tt> keys (optional).
+ * @see #containsKey(Object)
+ */
+ public Object get( Object key )
+ {
+ return context.getAttribute( (String)key );
+ }
+
+ /**
+ * Set the key, value binding in the ENGINE_SCOPE of the context.
+ *
+ * @param key key with which the specified value is to be associated.
+ * @param value value to be associated with the specified key.
+ *
+ * @return previous value associated with specified key, or <tt>null</tt> if
+ * there was no mapping for key. A <tt>null</tt> return can also
+ * indicate that the map previously associated <tt>null</tt> with the
+ * specified key, if the implementation supports <tt>null</tt> values.
+ *
+ * @throws UnsupportedOperationException if the <tt>put</tt> operation is not
+ * supported by this map.
+ * @throws ClassCastException if the class of the specified key or value
+ * prevents it from being stored in this map.
+ * @throws IllegalArgumentException if some aspect of this key or value
+ * prevents it from being stored in this map.
+ * @throws NullPointerException if this map does not permit <tt>null</tt> keys
+ * or values, and the specified key or value is <tt>null</tt>.
+ */
+ public Object put( String key, Object value )
+ {
+ Object oldValue =
+ context.getAttribute( key, ENGINE_SCOPE );
+ context.setAttribute( key, value, ENGINE_SCOPE );
+ return oldValue;
+ }
+
+
+ /**
+ * Put the bindings into the ENGINE_SCOPE of the context.
+ *
+ * @param t Mappings to be stored in this map.
+ *
+ * @throws UnsupportedOperationException if the <tt>putAll</tt> method is not
+ * supported by this map.
+ * @throws ClassCastException if the class of a key or value in the specified
+ * map prevents it from being stored in this map.
+ * @throws IllegalArgumentException some aspect of a key or value in the
+ * specified map prevents it from being stored in this map.
+ * @throws NullPointerException if the specified map is <tt>null</tt>, or if
+ * this map does not permit <tt>null</tt> keys or values, and the specified map
+ * contains <tt>null</tt> keys or values.
+ */
+ public void putAll( Map<? extends String, ? extends Object> t )
+ {
+ context.getBindings( ENGINE_SCOPE ).putAll( t );
+ }
+
+ /**
+ * Removes the mapping from the engine scope.
+ * <p/>
+ * <p>Returns the value to which the map previously associated the key, or
+ * <tt>null</tt> if the map contained no mapping for this key. (A
+ * <tt>null</tt> return can also indicate that the map previously associated
+ * <tt>null</tt> with the specified key if the implementation supports
+ * <tt>null</tt> values.) The map will not contain a mapping for the specified
+ * key once the call returns.
+ *
+ * @param okey key whose mapping is to be removed from the map.
+ *
+ * @return previous value associated with specified key, or <tt>null</tt> if
+ * there was no mapping for key.
+ *
+ * @throws ClassCastException if the key is of an inappropriate type for this
+ * map (optional).
+ * @throws NullPointerException if the key is <tt>null</tt> and this map does
+ * not permit <tt>null</tt> keys (optional).
+ * @throws UnsupportedOperationException if the <tt>remove</tt> method is not
+ * supported by this map.
+ */
+ // Why is the compiler complaining about this?
+ //public Object remove( String key )
+ public Object remove( Object okey )
+ {
+ // This shouldn't be necessary... we don't map Objects, Strings.
+ String key = (String)okey;
+ Object oldValue =
+ context.getAttribute( key, ENGINE_SCOPE );
+ context.removeAttribute( key, ENGINE_SCOPE );
+ return oldValue;
+ }
+
+ /**
+ * Removes all mappings from this map (optional operation).
+ *
+ * @throws UnsupportedOperationException clear is not supported by this map.
+ */
+ public void clear()
+ {
+ context.getBindings( ENGINE_SCOPE ).clear();
+ }
+
+ /**
+ * Returns the total key set of all scopes.
+ * This method violates the Map contract by returning an unmodifiable set.
+ *
+ * @return a set view of the keys contained in this map.
+ */
+ public Set keySet()
+ {
+ return totalKeySet();
+ }
+
+ /**
+ *
+ * Returns the total values set of all scopes.
+ * This method violates the Map contract by returning an unmodifiable set.
+ *
+ * @return a collection view of the values contained in this map.
+ */
+ public Collection values()
+ {
+ return totalValueSet();
+ }
+
+ /**
+ * Returns a set view of the mappings contained in this map. Each element in
+ * the returned set is a {@link java.util.Map.Entry}. The set is backed by the
+ * map, so changes to the map are reflected in the set, and vice-versa. If the
+ * map is modified while an iteration over the set is in progress (except
+ * through the iterator's own <tt>remove</tt> operation, or through the
+ * <tt>setValue</tt> operation on a map entry returned by the iterator) the
+ * results of the iteration are undefined. The set supports element removal,
+ * which removes the corresponding mapping from the map, via the
+ * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, <tt>removeAll</tt>,
+ * <tt>retainAll</tt> and <tt>clear</tt> operations. It does not support the
+ * <tt>add</tt> or <tt>addAll</tt> operations.
+ *
+ * @return a set view of the mappings contained in this map.
+ */
+ public Set<Entry<String,Object>> entrySet()
+ {
+ throw new Error("unimplemented");
+ }
+
+ private Set totalKeySet()
+ {
+ Set keys = new HashSet();
+ List<Integer> scopes = context.getScopes();
+ for ( int i : scopes ) {
+ keys.addAll( context.getBindings( i ).keySet() );
+ }
+ return Collections.unmodifiableSet(keys);
+ }
+ private Set totalValueSet()
+ {
+ Set values = new HashSet();
+ List<Integer> scopes = context.getScopes();
+ for ( int i : scopes ) {
+ values.addAll( context.getBindings( i ).values() );
+ }
+ return Collections.unmodifiableSet(values);
+ }
+
+}
+
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/script/ScriptContextEngineView.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml 2009-11-06 19:42:41 UTC (rev 5886)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -2,6 +2,8 @@
<jbpm-configuration>
+ <import resource="jbpm.default.scriptmanager.xml" />
+
<process-engine-context>
<repository-service />
@@ -24,11 +26,6 @@
<object class="org.jbpm.pvm.internal.id.DatabaseIdComposer" init="eager" />
- <script-manager default-expression-language="juel"
- default-script-language="juel">
- <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
- </script-manager>
-
<types resource="jbpm.variable.types.xml" />
<address-resolver />
Added: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.scriptmanager.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.scriptmanager.xml (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.scriptmanager.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+ <process-engine-context>
+
+ <script-manager default-expression-language="juel"
+ default-script-language="juel">
+ <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
+ <script-language name="bsh" factory="org.jbpm.pvm.internal.script.BshScriptEngineFactory" />
+ <script-language name="groovy" factory="org.jbpm.pvm.internal.script.GroovyScriptEngineFactory" />
+ </script-manager>
+
+ </process-engine-context>
+
+</jbpm-configuration>
Property changes on: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.scriptmanager.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/test-db/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-db/pom.xml 2009-11-06 19:42:41 UTC (rev 5886)
+++ jbpm4/trunk/modules/test-db/pom.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -57,7 +57,6 @@
<artifactId>jbpm-console-reports</artifactId>
<scope>test</scope>
</dependency>
-
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
@@ -91,6 +90,12 @@
</execution>
</executions>
</plugin>
+
+ <!-- <exclude>org/jbpm/bpmn/flownodes/ExclusiveGatewayTest.java</exclude>
+ <exclude>org/jbpm/bpmn/flownodes/ScriptTaskTest.java</exclude>
+ <exclude>org/jbpm/bpmn/flownodes/UserTaskTest.java</exclude>
+ -->
+
</plugins>
</build>
Copied: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ExclusiveGatewayTest.java (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ExclusiveGatewayTest.java)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ExclusiveGatewayTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ExclusiveGatewayTest.java 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,252 @@
+/*
+ * 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.bpmn;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.dom4j.DocumentFactory;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.TaskQuery;
+import org.jbpm.api.task.Task;
+import org.jbpm.bpmn.parser.BpmnParser;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Problem;
+import org.jbpm.test.JbpmTestCase;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/**
+ * @author Tom Baeyens
+ * @author Ronald van Kuijk (kukeltje)
+ */
+public class ExclusiveGatewayTest extends JbpmTestCase {
+
+ static BpmnParser bpmnParser = new BpmnParser();
+
+ public List<Problem> parse(String resource) {
+
+ List<Problem> problems = bpmnParser.createParse().setResource(resource).execute().getProblems();
+
+ return problems;
+ }
+
+ public void testNormal() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/exclusiveGateway.bpmn.xml");
+
+ if (!problems.isEmpty()) {
+ fail("No problems should have occured. Problems: " + problems);
+ }
+ }
+
+ public void testNormalXPath() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/exclusiveGatewayXPath.bpmn.xml");
+
+ if (!problems.isEmpty()) {
+ fail("No problems should have occured. Problems: " + problems);
+ }
+ }
+
+ public void testNormalExecuteDecisionCondition() {
+
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/exclusiveGateway.bpmn.xml").deploy();
+
+ try {
+ Map variables = new HashMap();
+
+ variables.put("test", "value");
+
+ ProcessInstance pi = executionService.startProcessInstanceByKey("ExclusiveGateway", variables );
+ String pid = pi.getId();
+
+ TaskQuery taskQuery = taskService.createTaskQuery();
+ List<Task> allTasks = taskQuery.list();
+
+ assertEquals(1, allTasks.size());
+ assertEquals("doSomething", allTasks.get(0).getActivityName());
+
+ taskService.completeTask( allTasks.get(0).getId());
+
+ // process instance should be ended
+ pi = executionService.findProcessInstanceById(pid);
+ assertNull(pi);
+
+ }
+ finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
+ }
+
+ public void testNormalExecuteDefault() {
+
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/exclusiveGateway.bpmn.xml").deploy();
+
+ try {
+ Map variables = new HashMap();
+
+ variables.put("test", "no value");
+
+ ProcessInstance pi = executionService.startProcessInstanceByKey("ExclusiveGateway", variables );
+ String pid = pi.getId();
+
+ TaskQuery taskQuery = taskService.createTaskQuery();
+ List<Task> allTasks = taskQuery.list();
+
+ assertEquals(1, allTasks.size());
+ assertEquals("doSomethingElse", allTasks.get(0).getActivityName());
+
+ taskService.completeTask( allTasks.get(0).getId());
+
+ // process instance should be ended
+ pi = executionService.findProcessInstanceById(pid);
+ assertNull(pi);
+
+ }
+ finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
+ }
+
+ public void testNormalExecuteDecisionConditionXPath() {
+
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/exclusiveGatewayXPath.bpmn.xml").deploy();
+
+ try {
+ Map variables = new HashMap();
+ Document objectData;
+
+ objectData = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(this.getClass().getResourceAsStream("xmlTestDocument.xml"));
+ variables.put("justadocument", objectData);
+ variables.put("test", "just");
+
+ ProcessInstance pi = executionService.startProcessInstanceByKey("ExclusiveGateway", variables );
+ String pid = pi.getId();
+
+ TaskQuery taskQuery = taskService.createTaskQuery();
+ List<Task> allTasks = taskQuery.list();
+
+ assertEquals(1, allTasks.size());
+ assertEquals("doSomething", allTasks.get(0).getActivityName());
+
+ taskService.completeTask( allTasks.get(0).getId());
+
+ // process instance should be ended
+ pi = executionService.findProcessInstanceById(pid);
+ assertNull(pi);
+
+ } catch (SAXException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (ParserConfigurationException e) {
+ e.printStackTrace();
+ }
+ finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
+ }
+
+
+ public void testNonBoundDefault() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/exclusiveGatewayNonBoundDefault.bpmn.xml");
+
+ if ((problems == null) || (problems.isEmpty())) {
+ fail("expected problems during parse");
+ } else {
+ assertTextPresent("exclusiveGateway 'Just a gateway' default sequenceFlow 'flow5' does not exist or is not related to this node", problems.get(0).getMsg());
+ }
+ }
+
+ public void testNonExistingDefault() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/exclusiveGatewayNonExistingDefault.bpmn.xml");
+
+ if ((problems == null) || (problems.isEmpty())) {
+ fail("expected problems during parse");
+ } else {
+ assertTextPresent("cvc-id.1: There is no ID/IDREF binding for IDREF 'flow666'", problems.get(0).getMsg());
+ }
+ }
+
+ public void testMixedValid() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/exclusiveGatewayMixedValid.bpmn.xml");
+
+ if (!problems.isEmpty()) {
+ fail("No problems should have occured. Problems: " + problems);
+ }
+ }
+
+
+ public void testMixedInvalid() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/exclusiveGatewayMixedInvalid.bpmn.xml");
+
+ if ((problems == null) || (problems.isEmpty())) {
+ fail("expected problems during parse");
+ } else {
+ assertTextPresent("exclusiveGateway 'Just a gateway' has the wrong number of incomming (1) and outgoing (2) transitions for gatewayDirection='mixed'", problems.get(0).getMsg());
+ }
+ }
+
+ public void testConvergingInvalid() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/exclusiveGatewayConvergingInvalid.bpmn.xml");
+
+ if ((problems == null) || (problems.isEmpty())) {
+ fail("expected problems during parse");
+ } else {
+ assertTextPresent("Gateway 'Just a gateway' has the wrong number of incomming (1) and outgoing (2) transitions for gatewayDirection='converging'", problems.get(0).getMsg());
+ }
+ }
+
+ public void testDivergingInvalid() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/exclusiveGatewayDivergingInvalid.bpmn.xml");
+
+ if ((problems == null) || (problems.isEmpty())) {
+ fail("expected problems during parse");
+ } else {
+ assertTextPresent("exclusiveGateway 'Just a gateway' has the wrong number of incomming (2) and outgoing (2) transitions for gatewayDirection='diverging'", problems.get(0).getMsg());
+ }
+ }
+
+ public void testInvalidConditionExpression() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/exclusiveGatewayInvalidConditionExpression.bpmn.xml");
+
+ if ((problems == null) || (problems.isEmpty())) {
+ fail("expected problems during parse");
+ } else {
+ assertTextPresent("Type of the conditionExpression on sequenceFlow with id=flow2 is of onsupported type 'bpmn:tExpression", problems.get(0).getMsg());
+ }
+ }
+
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ExclusiveGatewayTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ParallelGatewayTest.java (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ParallelGatewayTest.java)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ParallelGatewayTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ParallelGatewayTest.java 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,106 @@
+/*
+ * 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.bpmn;
+
+import java.util.List;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.TaskQuery;
+import org.jbpm.api.task.Task;
+import org.jbpm.bpmn.parser.BpmnParser;
+import org.jbpm.pvm.internal.xml.Problem;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ * @author Ronald van Kuijk (kukeltje)
+ */
+public class ParallelGatewayTest extends JbpmTestCase {
+
+ static BpmnParser bpmnParser = new BpmnParser();
+
+ public List<Problem> parse(String resource) {
+
+ List<Problem> problems = bpmnParser.createParse().setResource(resource).execute().getProblems();
+
+ return problems;
+ }
+
+ public void testNormalParse() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/parallelGateway.bpmn.xml");
+
+ if (!problems.isEmpty()) {
+ fail("No problems should have occured. Problems: " + problems);
+ }
+ }
+
+ public void testNormalExecute() {
+
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/parallelGateway.bpmn.xml").deploy();
+
+ try {
+ ProcessInstance pi = executionService.startProcessInstanceByKey("ParallelGateway");
+
+ String pid = pi.getId();
+
+ TaskQuery taskQuery = taskService.createTaskQuery();
+ List<Task> allTasks = taskQuery.list();
+
+ assertEquals(2, allTasks.size());
+ assertEquals("UserTaskLeg1", allTasks.get(0).getActivityName());
+ assertEquals("UserTaskLeg2", allTasks.get(1).getActivityName());
+
+ // specifying a transition is unnecessary, BPMN has outgoing AND semantic!
+ // TODO: fix
+ // Currently not passing any 'outcome'
+ taskService.completeTask( allTasks.get(0).getId());
+
+ pi = executionService.findProcessInstanceById(pid);
+ // process instance should not be ended yet
+ assertNotNull(pi);
+
+ taskService.completeTask( allTasks.get(1).getId());
+
+ assertEquals(0, taskQuery.list().size());
+
+ pi = executionService.findProcessInstanceById(pid);
+ // process instance is ended
+ assertNull(pi);
+
+ }
+ finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
+ }
+
+
+
+ public void testInvalid() {
+ List<Problem> problems = parse("org/jbpm/bpmn/parallelGatewayInvalid.bpmn.xml");
+
+ if ((problems == null) || (problems.isEmpty())) {
+ fail("expected problems during parse");
+ } else {
+ assertTextPresent("parallelGateway 'The Fork' has the wrong number of incomming (1) and outgoing (2) transitions for gatewayDirection='converging'", problems.get(0).getMsg());
+ }
+ }
+}
Copied: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ScriptTaskTest.java (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/ScriptTaskTest.java)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ScriptTaskTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ScriptTaskTest.java 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,78 @@
+/*
+ * 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.bpmn;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.bpmn.parser.BpmnParser;
+import org.jbpm.pvm.internal.xml.Problem;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ * @author Tom Baeyens
+ * @author Ronald van Kuijk (kukeltje)
+ */
+public class ScriptTaskTest extends JbpmTestCase {
+
+ static BpmnParser bpmnParser = new BpmnParser();
+
+ public List<Problem> parse(String resource) {
+
+ List<Problem> problems = bpmnParser.createParse().setResource(resource).execute().getProblems();
+
+ return problems;
+ }
+
+ public void testNormal() {
+
+ List<Problem> problems = parse("org/jbpm/bpmn/scriptTask.bpmn.xml");
+
+ if (!problems.isEmpty()) {
+ fail("No problems should have occured. Problems: " + problems);
+ }
+ }
+
+ public void testNormalExecute() {
+
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/scriptTask.bpmn.xml").deploy();
+
+ try {
+ Map variables = new HashMap();
+ String[] values = {"st", "nd", "rd", "th", "th"};
+ variables.put("test", values);
+
+ ProcessInstance pi = executionService.startProcessInstanceByKey("ScriptTask", variables );
+ String pid = pi.getId();
+
+ // process instance should be ended
+ pi = executionService.findProcessInstanceById(pid);
+ assertNull(pi);
+
+ }
+ finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
+ }
+}
Copied: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/UserTaskTest.java (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/java/org/jbpm/bpmn/flownodes/UserTaskTest.java)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/UserTaskTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/UserTaskTest.java 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,251 @@
+/*
+ * 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.bpmn;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.TaskQuery;
+import org.jbpm.api.task.Task;
+//import org.jbpm.bpmn.model.BpmnProcessDefinition;
+//import org.jbpm.bpmn.parser.BpmnParser;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ * @author Bernd Ruecker (bernd.ruecker(a)camunda.com)
+ */
+public class UserTaskTest extends JbpmTestCase {
+
+// static BpmnParser bpmnParser = new BpmnParser();
+//
+// public void testParsing() {
+// Parse parse = bpmnParser.createParse().setResource("org/jbpm/bpmn/UserTaskSimple.bpmn.xml").execute();
+//
+// if (!parse.getProblems().isEmpty()) {
+// fail("No problems should have occured. Problems: " + parse.getProblems());
+// }
+//
+// List<BpmnProcessDefinition> processDefinitions = (List<BpmnProcessDefinition>) parse.getDocumentObject();
+//
+// assertEquals(1, processDefinitions.size());
+//
+// BpmnProcessDefinition pd = processDefinitions.get(0);
+// assertNotNull(pd);
+// assertEquals("UserTaskSimpleProcess", pd.getKey());
+// }
+
+ public void testNormalUserAssignment() {
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/UserTaskSimple.bpmn.xml").deploy();
+
+ try {
+ Map variables = new HashMap();
+ variables.put("assignedUser", "User1");
+ ProcessInstance pi = executionService.startProcessInstanceByKey("UserTaskSimpleProcess", variables);
+ assertEquals("UserTask", ((ExecutionImpl) pi).getActivityName());
+
+ TaskQuery taskQuery = taskService.createTaskQuery();
+ List<Task> allTasks = taskQuery.list();
+ assertEquals(1, allTasks.size());
+ assertEquals("UserTask", allTasks.get(0).getActivityName());
+ assertEquals("User1", allTasks.get(0).getAssignee());
+ assertEquals("MyForm.ftl", allTasks.get(0).getFormResourceName());
+
+ // speciifiing a transition is unnecessary, BPMN has outgoing AND
+ // semantic!
+ // TODO: fix
+ taskService.completeTask(allTasks.get(0).getId(), "flow2");
+
+ assertEquals(0, taskQuery.list().size());
+
+ // process instance is ended
+ pi = executionService.findProcessInstanceById(pi.getId());
+ // One way or another I would also expect this to work... pi is gone from
+ // database immediately when ended. Only in History DB
+ // assertEquals(true, pi.isEnded());
+ assertNull(pi);
+ } finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
+ }
+
+ public void testNormalGroupAssignment() {
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/UserTaskGroup.bpmn.xml").deploy();
+
+ try {
+ Map variables = new HashMap();
+ variables.put("assignedGroup", "Group1");
+ ProcessInstance pi = executionService.startProcessInstanceByKey("UserTaskGroupProcess", variables);
+
+ assertEquals("UserTask", ((ExecutionImpl) pi).getActivityName());
+
+ TaskQuery taskQuery = taskService.createTaskQuery();
+ List<Task> allTasks = taskQuery.list();
+ assertEquals(1, allTasks.size());
+
+ List<Task> groupTasks = taskService.findGroupTasks("Group1");
+ assertEquals(1, groupTasks.size());
+ assertEquals("UserTask", groupTasks.get(0).getActivityName());
+
+ assertEquals("UserTask", allTasks.get(0).getActivityName());
+
+ assertNull(allTasks.get(0).getAssignee());
+
+ taskService.takeTask(allTasks.get(0).getId(), "User1");
+
+ groupTasks = taskService.findGroupTasks("Group1");
+ assertEquals(0, groupTasks.size());
+
+ List<Task> userTasks = taskService.findPersonalTasks("User1");
+ assertEquals(1, userTasks.size());
+ assertEquals("UserTask", userTasks.get(0).getActivityName());
+
+ taskService.completeTask(userTasks.get(0).getId(), "flow2");
+
+ assertEquals(0, taskQuery.list().size());
+
+ // process instance is ended
+ pi = executionService.findProcessInstanceById(pi.getId());
+ assertNull(pi);
+ } finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
+ }
+
+ public void testNormalSequenceFlowCondition() {
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/UserTaskSequenceFlowCondition.bpmn.xml").deploy();
+
+ try {
+ Map variables = new HashMap();
+ ProcessInstance pi = executionService.startProcessInstanceByKey("UserTaskSequenceFlowConditionProcess");
+
+ assertEquals("UserTask", ((ExecutionImpl) pi).getActivityName());
+
+ TaskQuery taskQuery = taskService.createTaskQuery();
+ List<Task> allTasks = taskQuery.list();
+ assertEquals(1, allTasks.size());
+
+ // Flow does not exist so task should be ended hence process endded since it is the only execution
+ taskService.completeTask(allTasks.get(0).getId(), "NoFlow");
+
+ assertEquals(0, taskQuery.list().size());
+
+ // process instance is ended
+ pi = executionService.findProcessInstanceById(pi.getId());
+ assertNull(pi);
+ } finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
+ }
+
+
+
+ /**
+ * check that multiple outgoing sequence flows will be handled as fork, like
+ * specified in BPMN
+ *
+ * Check with user tasks, sicne the engine stops there for sure.
+ */
+ public void testUncontrolledSequenceFlowAsFork() {
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/forkWithUncontrolledSequenceFlow.bpmn.xml")
+ .deploy();
+
+ try {
+
+ ProcessInstance pi = executionService.startProcessInstanceByKey("ForkWithUncontrolledSequenceFlowProcess");
+
+ String pid = pi.getId();
+
+ TaskQuery taskQuery = taskService.createTaskQuery();
+ List<Task> allTasks = taskQuery.list();
+
+ // since the uncontrolled sequence flow OUT of the activity behaves as a
+ // fork
+ // we now have two tasks
+ assertEquals(2, allTasks.size());
+ assertEquals("UserTaskLeg1", allTasks.get(0).getActivityName());
+ assertEquals("UserTaskLeg2", allTasks.get(1).getActivityName());
+
+ // specifying a transition is unnecessary, BPMN has outgoing AND semantic!
+ // TODO: fix
+ // Currently not passing any 'outcome'
+ taskService.completeTask(allTasks.get(0).getId()); // define output /
+ // flow?
+ taskService.completeTask(allTasks.get(1).getId());
+
+ assertEquals(0, taskQuery.list().size());
+
+ pi = executionService.findProcessInstanceById(pid);
+ // process instance is ended
+ assertNull(pi);
+
+ } finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
+
+ }
+
+ /**
+ * check that multiple outgoing sequence flows will be handled as fork, like
+ * specified in BPMN
+ *
+ * Check with user tasks, sicne the engine stops there for sure.
+ */
+ public void testUncontrolledSequenceFlowConditionAsFork() {
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/forkWithUncontrolledSequenceFlowCondition.bpmn.xml")
+ .deploy();
+
+ try {
+
+ ProcessInstance pi = executionService.startProcessInstanceByKey("ForkWithUncontrolledSequenceFlowConditionProcess");
+
+ String pid = pi.getId();
+
+ TaskQuery taskQuery = taskService.createTaskQuery();
+ List<Task> allTasks = taskQuery.list();
+
+ assertEquals(1, allTasks.size());
+ assertEquals("forkingTask", allTasks.get(0).getActivityName());
+ taskService.completeTask(allTasks.get(0).getId(), "NoFlow");
+
+ // Even though the 'uncontrolled sequence flow' OUT of the activity behaves as a
+ // fork we now have one task since one sequenceflow has a condition that evaluates to false
+
+ allTasks = taskQuery.list();
+ assertEquals(1, allTasks.size());
+ assertEquals("UserTaskLeg2", allTasks.get(0).getActivityName());
+ taskService.completeTask(allTasks.get(0).getId());
+
+ pi = executionService.findProcessInstanceById(pid);
+ // process instance is ended
+ assertNull(pi);
+
+ } finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
+
+ }
+
+}
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/UserTaskGroup.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskGroup.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/UserTaskGroup.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/UserTaskGroup.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="UserTaskGroup"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/"
+ xmlns:jbpm="http://jbpm.org/4.0/bpmn2">
+
+ <bpmn:resource name="sampleHumanResource" />
+
+ <bpmn:process id="UserTaskGroupProcess" name="Simple process with user task for group">
+
+
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" name="fromStartToUserTask"
+ sourceRef="Start" targetRef="UserTask" />
+
+ <bpmn:userTask id="UserTask" name="user task"
+ implementation="other">
+ <!-- use jbpm internal task management -->
+ <bpmn:potentialOwner id="myPerformer" resourceRef="sampleResource" jbpm:type="group">
+ <bpmn:resourceAssignmentExpression
+ id="rae">
+ <bpmn:formalExpression language="juel">
+ ${assignedGroup}</bpmn:formalExpression>
+ </bpmn:resourceAssignmentExpression>
+ </bpmn:potentialOwner>
+ <bpmn:potentialOwner id="myPerformer2" resourceRef="sampleResource">
+ <bpmn:resourceAssignmentExpression
+ id="rae2">
+ <bpmn:formalExpression language="juel">
+ ${assignedGroup}</bpmn:formalExpression>
+ </bpmn:resourceAssignmentExpression>
+ </bpmn:potentialOwner>
+ <bpmn:rendering id="myRendering">
+ <jbpm:form>MyForm.ftl</jbpm:form>
+ </bpmn:rendering>
+ </bpmn:userTask>
+
+ <bpmn:sequenceFlow id="flow2" name="fromUserTaskToEnd"
+ sourceRef="UserTask" targetRef="End" />
+
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/UserTaskSequenceFlowCondition.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskSequenceFlowCondition.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/UserTaskSequenceFlowCondition.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/UserTaskSequenceFlowCondition.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="UserTaskSequenceFlowCondition"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:resource name="sampleHumanResource" />
+
+ <bpmn:process id="UserTaskSequenceFlowConditionProcess"
+ name="Simple process with user task and condition on sequenceFlow">
+
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" name="fromStartToUserTask"
+ sourceRef="Start" targetRef="UserTask" />
+
+ <bpmn:userTask id="UserTask" name="user task"
+ implementation="other">
+ <!-- use jbpm internal task management -->
+ <bpmn:performer id="myPerformer" resourceRef="sampleResource" />
+ </bpmn:userTask>
+
+ <bpmn:sequenceFlow id="flow2" name="fromUserTaskToUSerTask2"
+ sourceRef="UserTask" targetRef="UserTask2">
+ <bpmn:conditionExpression id="flow2Cond"
+ xsi:type="bpmn:tFormalExpression">${jbpm_outcome == 'flow'}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="UserTask2" name="another user task"
+ implementation="other">
+ <!-- use jbpm internal task management -->
+ <bpmn:performer id="myPerformer2" resourceRef="sampleResource" />
+ </bpmn:userTask>
+
+ <bpmn:sequenceFlow id="flow3" name="fromUserTask2ToEnd"
+ sourceRef="UserTask2" targetRef="End">
+ </bpmn:sequenceFlow>
+
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/UserTaskSimple.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/UserTaskSimple.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/UserTaskSimple.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/UserTaskSimple.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="UserTaskSimple"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/"
+ xmlns:jbpm="http://jbpm.org/4.0/bpmn2">
+
+ <bpmn:resource name="sampleHumanResource" />
+
+ <bpmn:process id="UserTaskSimpleProcess" name="Simple process with user task">
+
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" name="fromStartToUserTask"
+ sourceRef="Start" targetRef="UserTask" />
+
+ <bpmn:userTask id="UserTask" name="user task"
+ implementation="other">
+ <!-- use jbpm internal task management -->
+ <bpmn:performer id="myPerformer" resourceRef="sampleResource">
+ <bpmn:resourceAssignmentExpression
+ id="rae">
+ <bpmn:formalExpression language="juel">
+ ${assignedUser}</bpmn:formalExpression>
+ </bpmn:resourceAssignmentExpression>
+ </bpmn:performer>
+ <bpmn:rendering id="myRendering">
+ <jbpm:form>MyForm.ftl</jbpm:form>
+ </bpmn:rendering>
+ </bpmn:userTask>
+
+ <bpmn:sequenceFlow id="flow2" name="fromUserTaskToEnd"
+ sourceRef="UserTask" targetRef="End" />
+
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGateway.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGateway.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGateway.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGateway.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="ExclusiveGateway" name="ExclusiveGateway">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="exclusiveGatewayDecision" name="Start->exclusiveGateway" />
+
+ <bpmn:exclusiveGateway id="exclusiveGatewayDecision"
+ name="Just a gateway" default="flow3"/>
+
+ <!-- Sequence Flow -->
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGatewayDecision"
+ targetRef="doSomething">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${test == 'value'}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGatewayDecision"
+ targetRef="doSomethingElse">
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="doSomething" name="Anything at all"
+ implementation="other"></bpmn:userTask>
+ <bpmn:sequenceFlow id="flow4" sourceRef="doSomething"
+ targetRef="End" />
+
+ <bpmn:userTask id="doSomethingElse" name="But completely different"
+ implementation="other" />
+ <bpmn:sequenceFlow id="flow5" sourceRef="doSomethingElse"
+ targetRef="End" />
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayConvergingInvalid.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayConvergingInvalid.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayConvergingInvalid.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayConvergingInvalid.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="Shipment" name="Shipment">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="exclusiveGateway" name="Start->exclusiveGateway" />
+
+ <bpmn:exclusiveGateway id="exclusiveGateway" default="flow5"
+ name="Just a gateway" gatewayDirection="converging"/>
+
+ <!-- Sequence Flow -->
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGateway"
+ targetRef="doSomething">
+ <bpmn:conditionExpression xsi:type="bpmn:tExpression">
+ Has to be valid
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGateway"
+ targetRef="doSomethingElse">
+ <bpmn:conditionExpression xsi:type="bpmn:tExpression">
+ Otherwise this one
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="doSomething" name="Anything at all"
+ implementation="other"></bpmn:userTask>
+ <bpmn:sequenceFlow id="flow4" sourceRef="doSomething"
+ targetRef="End" />
+
+ <bpmn:userTask id="doSomethingElse" name="But completely different"
+ implementation="other" />
+ <bpmn:sequenceFlow id="flow5" sourceRef="doSomethingElse"
+ targetRef="End" />
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayDivergingInvalid.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayDivergingInvalid.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayDivergingInvalid.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayDivergingInvalid.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="Shipment" name="Shipment">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="exclusiveGatewayPre" name="Start->exclusiveGateway" />
+
+ <bpmn:exclusiveGateway id="exclusiveGatewayPre"
+ name="Just a dummy gateway"/>
+
+ <bpmn:sequenceFlow id="flow6" sourceRef="exclusiveGatewayPre"
+ targetRef="exclusiveGateway" name="exclusiveGateway->exclusiveGatewayPre" />
+
+ <bpmn:sequenceFlow id="flow7" sourceRef="exclusiveGatewayPre"
+ targetRef="exclusiveGateway" name="exclusiveGateway->exclusiveGatewayPre" />
+
+ <bpmn:exclusiveGateway id="exclusiveGateway"
+ name="Just a gateway" gatewayDirection="diverging"/>
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGateway"
+ targetRef="doSomething">
+ <bpmn:conditionExpression xsi:type="bpmn:tExpression">
+ Has to be valid
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGateway"
+ targetRef="doSomethingElse">
+ <bpmn:conditionExpression xsi:type="bpmn:tExpression">
+ Otherwise this one
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="doSomething" name="Anything at all"
+ implementation="other"></bpmn:userTask>
+ <bpmn:sequenceFlow id="flow4" sourceRef="doSomething"
+ targetRef="End" />
+
+ <bpmn:userTask id="doSomethingElse" name="But completely different"
+ implementation="other" />
+ <bpmn:sequenceFlow id="flow5" sourceRef="doSomethingElse"
+ targetRef="End" />
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayInvalidConditionExpression.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayInvalidConditionExpression.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayInvalidConditionExpression.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayInvalidConditionExpression.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="Shipment" name="Shipment">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="exclusiveGateway" name="Start->exclusiveGateway" />
+
+ <bpmn:exclusiveGateway id="exclusiveGateway"
+ name="Just a gateway" />
+
+ <!-- Sequence Flow -->
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGateway"
+ targetRef="doSomething">
+ <bpmn:conditionExpression xsi:type="bpmn:tExpression">
+ getDataObject('lieferungVariable')/confirmationRequired=true
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGateway"
+ targetRef="doSomethingElse">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression" >not(
+ getDataObject('lieferungVariable')/confirmationRequired=true )
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="doSomething" name="Anything at all"
+ implementation="other"></bpmn:userTask>
+ <bpmn:sequenceFlow id="flow4" sourceRef="doSomething"
+ targetRef="End" />
+
+ <bpmn:userTask id="doSomethingElse" name="But completely different"
+ implementation="other" />
+ <bpmn:sequenceFlow id="flow5" sourceRef="doSomethingElse"
+ targetRef="End" />
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayMixedInvalid.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayMixedInvalid.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayMixedInvalid.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayMixedInvalid.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="Shipment" name="Shipment">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="exclusiveGateway" name="Start->exclusiveGateway" />
+
+ <bpmn:exclusiveGateway id="exclusiveGateway" default="flow5"
+ name="Just a gateway" gatewayDirection="mixed"/>
+
+ <!-- Sequence Flow -->
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGateway"
+ targetRef="doSomething">
+ <bpmn:conditionExpression xsi:type="bpmn:tExpression">
+ Has to be valid
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGateway"
+ targetRef="doSomethingElse">
+ <bpmn:conditionExpression xsi:type="bpmn:tExpression">
+ Otherwise this one
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="doSomething" name="Anything at all"
+ implementation="other"></bpmn:userTask>
+ <bpmn:sequenceFlow id="flow4" sourceRef="doSomething"
+ targetRef="End" />
+
+ <bpmn:userTask id="doSomethingElse" name="But completely different"
+ implementation="other" />
+ <bpmn:sequenceFlow id="flow5" sourceRef="doSomethingElse"
+ targetRef="End" />
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayMixedValid.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayMixedValid.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayMixedValid.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayMixedValid.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="Shipment" name="Shipment">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="exclusiveGatewayPre" name="Start->exclusiveGatewayPre" />
+
+ <bpmn:exclusiveGateway id="exclusiveGatewayPre"
+ name="Just a dummy gateway"/>
+
+ <bpmn:sequenceFlow id="flow6" sourceRef="exclusiveGatewayPre"
+ targetRef="exclusiveGateway" name="exclusiveGatewayPre->exclusiveGateway" />
+
+ <bpmn:sequenceFlow id="flow7" sourceRef="exclusiveGatewayPre"
+ targetRef="exclusiveGateway" name="exclusiveGatewayPre->exclusiveGateway" />
+
+ <bpmn:exclusiveGateway id="exclusiveGateway"
+ name="Just a gateway" gatewayDirection="mixed"/>
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGateway"
+ targetRef="doSomething">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">
+ Has to be valid
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGateway"
+ targetRef="doSomethingElse">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">
+ Otherwise this one
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="doSomething" name="Anything at all"
+ implementation="other"></bpmn:userTask>
+ <bpmn:sequenceFlow id="flow4" sourceRef="doSomething"
+ targetRef="End" />
+
+ <bpmn:userTask id="doSomethingElse" name="But completely different"
+ implementation="other" />
+ <bpmn:sequenceFlow id="flow5" sourceRef="doSomethingElse"
+ targetRef="End" />
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayNonBoundDefault.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayNonBoundDefault.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayNonBoundDefault.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayNonBoundDefault.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="Shipment" name="Shipment">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="exclusiveGateway" name="Start->exclusiveGateway" />
+
+ <bpmn:exclusiveGateway id="exclusiveGateway" default="flow5"
+ name="Just a gateway" />
+
+ <!-- Sequence Flow -->
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGateway"
+ targetRef="doSomething">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">
+ getDataObject('lieferungVariable')/confirmationRequired=true
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGateway"
+ targetRef="doSomethingElse">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">not(
+ getDataObject('lieferungVariable')/confirmationRequired=true )
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="doSomething" name="Anything at all"
+ implementation="other"></bpmn:userTask>
+ <bpmn:sequenceFlow id="flow4" sourceRef="doSomething"
+ targetRef="End" />
+
+ <bpmn:userTask id="doSomethingElse" name="But completely different"
+ implementation="other" />
+ <bpmn:sequenceFlow id="flow5" sourceRef="doSomethingElse"
+ targetRef="End" />
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayNonExistingDefault.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayNonExistingDefault.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayNonExistingDefault.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayNonExistingDefault.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="Shipment" name="Shipment">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="exclusiveGateway" name="Start->exclusiveGateway" />
+
+ <bpmn:exclusiveGateway id="exclusiveGateway" default="flow666"
+ name="Just a gateway" />
+
+ <!-- Sequence Flow -->
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGateway"
+ targetRef="doSomething">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">
+ getDataObject('lieferungVariable')/confirmationRequired=true
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGateway"
+ targetRef="doSomethingElse">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">not(
+ getDataObject('lieferungVariable')/confirmationRequired=true )
+ </bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="doSomething" name="Anything at all"
+ implementation="other"></bpmn:userTask>
+ <bpmn:sequenceFlow id="flow4" sourceRef="doSomething"
+ targetRef="End" />
+
+ <bpmn:userTask id="doSomethingElse" name="But completely different"
+ implementation="other" />
+ <bpmn:sequenceFlow id="flow5" sourceRef="doSomethingElse"
+ targetRef="End" />
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayXPath.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/exclusiveGatewayXPath.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayXPath.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/exclusiveGatewayXPath.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="ExclusiveGateway" name="ExclusiveGateway">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="exclusiveGatewayDecision" name="Start->exclusiveGateway" />
+
+ <bpmn:exclusiveGateway id="exclusiveGatewayDecision"
+ name="Just a gateway" default="flow3"/>
+
+ <!-- Sequence Flow -->
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="exclusiveGatewayDecision"
+ targetRef="doSomething">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression" language="xpath">getObjectData("justadocument")/root/child1/text()=$test</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow3" sourceRef="exclusiveGatewayDecision"
+ targetRef="doSomethingElse">
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="doSomething" name="Anything at all"
+ implementation="other"></bpmn:userTask>
+ <bpmn:sequenceFlow id="flow4" sourceRef="doSomething"
+ targetRef="End" />
+
+ <bpmn:userTask id="doSomethingElse" name="But completely different"
+ implementation="other" />
+ <bpmn:sequenceFlow id="flow5" sourceRef="doSomethingElse"
+ targetRef="End" />
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/forkWithUncontrolledSequenceFlow.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlow.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/forkWithUncontrolledSequenceFlow.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/forkWithUncontrolledSequenceFlow.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ForkWithUncontrolledSequenceFlow"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:resource name="sampleResource" />
+
+ <bpmn:process id="ForkWithUncontrolledSequenceFlowProcess" name="ForkWithUncontrolledSequenceFlow">
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" name="fromStartToFork"
+ sourceRef="Start"
+ targetRef="forkingTask" />
+
+ <bpmn:task id="forkingTask" name="The Fork" />
+
+ <bpmn:sequenceFlow id="flow2a" name="Leg 1"
+ sourceRef="forkingTask"
+ targetRef="UserTaskLeg1" />
+ <bpmn:userTask id="UserTaskLeg1" name="user task leg1" implementation="other">
+ <bpmn:potentialOwner resourceRef="sampleResource" />
+ </bpmn:userTask>
+ <bpmn:sequenceFlow id="flow2b" name="Leg 1 -> Join"
+ sourceRef="UserTaskLeg1"
+ targetRef="parallelGatewayJoin" />
+
+ <bpmn:sequenceFlow id="flow3a" name="Leg 2"
+ sourceRef="forkingTask"
+ targetRef="UserTaskLeg2" />
+ <bpmn:userTask id="UserTaskLeg2" name="user task leg2" implementation="other">
+ <bpmn:potentialOwner resourceRef="sampleResource" />
+ </bpmn:userTask>
+ <bpmn:sequenceFlow id="flow3b" name="Leg 2 -> Join"
+ sourceRef="UserTaskLeg2"
+ targetRef="parallelGatewayJoin" />
+
+
+ <bpmn:parallelGateway id="parallelGatewayJoin" name="The Join"
+ gatewayDirection="converging"/>
+ <bpmn:sequenceFlow id="flow4"
+ sourceRef="parallelGatewayJoin"
+ targetRef="End">
+ </bpmn:sequenceFlow>
+
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/forkWithUncontrolledSequenceFlowCondition.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/forkWithUncontrolledSequenceFlowCondition.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/forkWithUncontrolledSequenceFlowCondition.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/forkWithUncontrolledSequenceFlowCondition.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ForkWithUncontrolledSequenceFlowCondition"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:resource name="sampleResource" />
+
+ <bpmn:process id="ForkWithUncontrolledSequenceFlowConditionProcess"
+ name="ForkWithUncontrolledSequenceFlowCondition">
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" name="fromStartToForkingTask"
+ sourceRef="Start" targetRef="forkingTask" />
+
+ <bpmn:userTask id="forkingTask" name="The Fork" />
+
+ <bpmn:sequenceFlow id="flow2a" name="Leg 1"
+ sourceRef="forkingTask" targetRef="UserTaskLeg1">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${jbpm_outcome == 'flow'}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+
+ <bpmn:userTask id="UserTaskLeg1" name="user task leg1"
+ implementation="other">
+ <bpmn:potentialOwner resourceRef="sampleResource" />
+ </bpmn:userTask>
+
+ <bpmn:sequenceFlow id="flow2b" name="Leg 1 -> Join"
+ sourceRef="UserTaskLeg1" targetRef="parallelGatewayJoin" />
+
+ <bpmn:sequenceFlow id="flow3a" name="Leg 2"
+ sourceRef="forkingTask" targetRef="UserTaskLeg2" />
+ <bpmn:userTask id="UserTaskLeg2" name="user task leg2"
+ implementation="other">
+ <bpmn:potentialOwner resourceRef="sampleResource" />
+ </bpmn:userTask>
+
+ <bpmn:sequenceFlow id="flow3b" name="Leg 2 -> Join"
+ sourceRef="UserTaskLeg2" targetRef="parallelGatewayJoin" />
+
+
+ <bpmn:parallelGateway id="parallelGatewayJoin"
+ name="The Join" gatewayDirection="converging" />
+ <bpmn:sequenceFlow id="flow4" sourceRef="parallelGatewayJoin"
+ targetRef="End">
+ </bpmn:sequenceFlow>
+
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/parallelGateway.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/parallelGateway.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/parallelGateway.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/parallelGateway.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="ParallelGateway" name="ParallelGateway">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" name="fromStartToFork"
+ sourceRef="Start"
+ targetRef="parallelGatewayFork" />
+
+ <bpmn:parallelGateway id="parallelGatewayFork" name="The Fork"
+ gatewayDirection="diverging"/>
+
+ <bpmn:sequenceFlow id="flow2a" name="Leg 1"
+ sourceRef="parallelGatewayFork"
+ targetRef="UserTaskLeg1" />
+ <bpmn:userTask id="UserTaskLeg1" name="user task leg1" implementation="other">
+ <bpmn:potentialOwner resourceRef="sampleResource" />
+ </bpmn:userTask>
+ <bpmn:sequenceFlow id="flow2b" name="Leg 1 -> Join"
+ sourceRef="UserTaskLeg1"
+ targetRef="parallelGatewayJoin" />
+
+ <bpmn:sequenceFlow id="flow3a" name="Leg 2"
+ sourceRef="parallelGatewayFork"
+ targetRef="UserTaskLeg2" />
+ <bpmn:userTask id="UserTaskLeg2" name="user task leg2" implementation="other">
+ <bpmn:potentialOwner resourceRef="sampleResource" />
+ </bpmn:userTask>
+ <bpmn:sequenceFlow id="flow3b" name="Leg 2 -> Join"
+ sourceRef="UserTaskLeg2"
+ targetRef="parallelGatewayJoin" />
+
+
+ <bpmn:parallelGateway id="parallelGatewayJoin" name="The Join"
+ gatewayDirection="converging"/>
+ <bpmn:sequenceFlow id="flow4"
+ sourceRef="parallelGatewayJoin"
+ targetRef="End">
+ </bpmn:sequenceFlow>
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/parallelGatewayInvalid.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/parallelGatewayInvalid.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/parallelGatewayInvalid.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/parallelGatewayInvalid.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <bpmn:process id="Shipment" name="Shipment">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="parallelGatewayFork" name="fromStartToFork" />
+
+ <bpmn:parallelGateway id="parallelGatewayFork"
+ name="The Fork" gatewayDirection="converging"/>
+
+ <bpmn:sequenceFlow id="flow2" sourceRef="parallelGatewayFork"
+ targetRef="parallelGatewayJoin" name="Leg 1" />
+
+ <bpmn:sequenceFlow id="flow3" sourceRef="parallelGatewayFork"
+ targetRef="parallelGatewayJoin" name="Leg 2" />
+
+ <bpmn:parallelGateway id="parallelGatewayJoin"
+ name="The Join" gatewayDirection="diverging"/>
+
+ <bpmn:sequenceFlow id="flow4" sourceRef="parallelGatewayJoin"
+ targetRef="End">
+ </bpmn:sequenceFlow>
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/scriptTask.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/scriptTask.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/scriptTask.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/scriptTask.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ExclusiveGatewayNormal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+
+
+ <bpmn:process id="ScriptTask" name="ScriptTask">
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start"
+ targetRef="scriptTask" name="Start->ScriptTask" />
+
+ <bpmn:scriptTask id="scriptTask" name="Script Task"
+ scriptLanguage="bsh" >
+ <bpmn:script><![CDATA[
+for(int i=0;i<5;i++){
+ System.out.println((i+1) + test[i] + " universe");
+}]]>
+</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="flow2" sourceRef="scriptTask"
+ targetRef="End" />
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End" />
+ </bpmn:process>
+</bpmn:definitions>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/shipment.java.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/test/shipment.java.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/shipment.java.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/shipment.java.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ShipmentDefinitions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\BPMN20.xsd" xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" xmlns:sample="http://sample.bpmn.camunda.com/" xmlns:xbpmn="http://bpmn.camunda.com/" xmlns:tns="http://sample.bpmn.camunda.com/" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <!-- imports -->
+ <bpmn:import namespace="http://sample.bpmn.camunda.com/" location="D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\SampleService.xsd" importType="http://www.w3.org/2001/XMLSchema"/>
+ <bpmn:import namespace="http://sample.bpmn.camunda.com/" location="D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\SampleService.wsdl" importType="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ <bpmn:import namespace="http://sample.bpmn.camunda.com/" location="D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\ShipmentProcessService.wsdl" importType="http://schemas.xmlsoap.org/wsdl/soap/"/>
+
+ <!-- definition structures for process variables -->
+ <bpmn:itemDefinition id="lieferungDef" itemKind="Information" structureRef="sample:shipment"/>
+
+ <!-- definition structures for messages -->
+ <bpmn:itemDefinition id="ProzessStartenDef" itemKind="Information" structureRef="sample:startShipmentProces"/>
+ <bpmn:itemDefinition id="LieferungAnlegenDef" itemKind="Information" structureRef="sample:createShipment"/>
+ <bpmn:itemDefinition id="KommissioniertDef" itemKind="Information" structureRef="sample:notifyShipmentConsigned"/>
+
+ <!-- messages -->
+ <bpmn:message name="ProzessStarten" id="ProzessStartenNachricht" structureRef="tns:ProzessStartenDef"/>
+ <bpmn:message name="LieferungAnlegen" id="LieferungAnlegenNachricht" structureRef="tns:LieferungAnlegenDef"/>
+ <bpmn:message name="Kommissioniert" id="KommissioniertNachricht" structureRef="tns:KommissioniertDef"/>
+
+ <!-- Services -->
+ <!-- serivceReference ?? -->
+ <!-- conversation? Participant? -->
+
+ <bpmn:endPoint id="ProzessEndpoint">
+ <xbpmn:url/>
+ </bpmn:endPoint>
+ <bpmn:endPoint id="LiefersystemEndpoint">
+ <xbpmn:url/>
+ </bpmn:endPoint>
+
+ <!-- interfaces -->
+ <bpmn:interface id="ProzessInterface" name="Lieferprozess Schnittstelle">
+ <bpmn:operation name="startShipmentProcess">
+ <bpmn:inMessageRef>tns:ProzessStartenNachricht</bpmn:inMessageRef>
+ </bpmn:operation>
+ <bpmn:operation name="notifyShipmentConsigned">
+ <bpmn:inMessageRef>tns:KommissioniertNachricht</bpmn:inMessageRef>
+ </bpmn:operation>
+ </bpmn:interface>
+ <bpmn:interface id="LiefersystemInterface" name="Liefersystem Schnittstelle">
+ <bpmn:operation name="createShiptment">
+ <bpmn:inMessageRef>tns:LieferungAnlegenNachricht</bpmn:inMessageRef>
+ </bpmn:operation>
+ </bpmn:interface>
+ <!-- Resources / Performers -->
+ <bpmn:resource id="VertriebResource" name="Vertrieb"/>
+ <!-- process definition -->
+ <bpmn:process id="Shipment" name="Shipment">
+ <bpmn:documentation id="doc1">Teilprozess der Lieferung</bpmn:documentation>
+
+ <!-- process variables -->
+ <bpmn:dataObject id="lieferungVariable" name="Lieferung" itemSubjectRef="tns:lieferungDef"/>
+
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start">
+ <bpmn:dataOutput id="ProzessStartOutput" itemSubjectRef="tns:ProzessStartenNachricht"/>
+ <bpmn:dataOutputAssociation>
+ <bpmn:assignment>
+ <bpmn:from xsi:type="bpmn:tFormalExpression">getDataOutput('ProzessStartOutput')/shipment</bpmn:from>
+ <bpmn:to xsi:type="bpmn:tFormalExpression">getDataObject('lieferungVariable')</bpmn:to>
+ </bpmn:assignment>
+ <bpmn:sourceRef>ProzessStartOutput</bpmn:sourceRef>
+ <bpmn:targetRef>tns:lieferungVariable</bpmn:targetRef>
+ </bpmn:dataOutputAssociation>
+ <bpmn:messageEventDefinition messageRef="tns:ProzessStartenNachricht">
+ <bpmn:operationRef>tns:startShipmentProcess</bpmn:operationRef>
+ </bpmn:messageEventDefinition>
+ </bpmn:startEvent>
+
+ <!-- Activity 1: Service Task -->
+ <bpmn:serviceTask id="LieferungBuchen" name="Lieferung buchen" implementation="WebService" operationRef="createShipment">
+ <xbpmn:url/>
+ <bpmn:ioSpecification>
+ <bpmn:dataInput id="LieferungBuchenInput" isCollection="false" itemSubjectRef="tns:LieferungAnlegenNachricht"/>
+ <bpmn:inputSet>
+ <bpmn:dataInputRefs>LieferungBuchenInput</bpmn:dataInputRefs>
+ </bpmn:inputSet>
+ <bpmn:outputSet/>
+ </bpmn:ioSpecification>
+ <bpmn:dataInputAssociation>
+ <bpmn:assignment>
+ <bpmn:from xsi:type="bpmn:tFormalExpression">bpmn:getDataObject('lieferungVariable')</bpmn:from>
+ <bpmn:to xsi:type="bpmn:tFormalExpression">bpmn:getDataInput('LieferungBuchenInput'/shipment/</bpmn:to>
+ </bpmn:assignment>
+ <bpmn:sourceRef>tns:lieferungVariable</bpmn:sourceRef>
+ <bpmn:targetRef>LieferungBuchenInput</bpmn:targetRef>
+ </bpmn:dataInputAssociation>
+ </bpmn:serviceTask>
+
+ <!-- Activity 2: Receive Task -->
+ <bpmn:receiveTask id="WartenAufLieferung" name="Warten auf Lieferung" instantiate="false" implementation="WebService" operationRef="notifyShipmentConsigned" messageRef="tns:Kommissioniert">
+ <bpmn:ioSpecification>
+ <bpmn:dataOutput id="KommissioniertOutput" itemSubjectRef="tns:KommissioniertNachricht"/>
+ <bpmn:inputSet/>
+ <bpmn:outputSet>
+ <bpmn:dataOutputRefs>KommissioniertOutput</bpmn:dataOutputRefs>
+ </bpmn:outputSet>
+ </bpmn:ioSpecification>
+
+ <bpmn:dataOutputAssociation>
+ <bpmn:assignment>
+ <bpmn:from xsi:type="bpmn:tFormalExpression">getDataOutput('KommissioniertOutput')/shipment</bpmn:from>
+ <bpmn:to xsi:type="bpmn:tFormalExpression">getDataObject('lieferungVariable')</bpmn:to>
+ </bpmn:assignment>
+ <bpmn:sourceRef>KommissioniertOutput</bpmn:sourceRef>
+ <bpmn:targetRef>tns:lieferungVariable</bpmn:targetRef>
+ </bpmn:dataOutputAssociation>
+ </bpmn:receiveTask>
+
+ <!-- Gateway -->
+ <bpmn:exclusiveGateway id="PruefeAvisierung" name="Avisierung benoetigt?"/>
+
+ <!-- Activity 3: User Task -->
+ <bpmn:userTask id="LieferterminAvisieren" name="Liefertermin avisieren" implementation="other">
+ <!-- <bpmn:humanPerformer resourceRef="tns:Vertrieb"></bpmn:humanPerformer>-->
+ <bpmn:potentialOwner resourceRef="tns:VertriebResource"/>
+ </bpmn:userTask>
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End"/>
+
+ <!-- Sequence Flow -->
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start" targetRef="LieferungBuchen" name="Start->LieferungBuchen"/>
+ <bpmn:sequenceFlow id="flow2" sourceRef="LieferungBuchen" targetRef="WartenAufLieferung"/>
+ <bpmn:sequenceFlow id="flow3" sourceRef="WartenAufLieferung" targetRef="PruefeAvisierung"/>
+ <bpmn:sequenceFlow id="flow4" sourceRef="PruefeAvisierung" targetRef="LieferterminAvisieren">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">getDataObject('lieferungVariable')/confirmationRequired=true</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow5" sourceRef="PruefeAvisierung" targetRef="End">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">not( getDataObject('lieferungVariable')/confirmationRequired=true )</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow6" sourceRef="LieferterminAvisieren" targetRef="End"/>
+ </bpmn:process>
+
+<!--
+ <bpmn:correlationSubscription>
+ </bpmn:correlationSubscription>
+-->
+
+ <!-- TODO: Correlation / Conversation -->
+ <bpmn:conversation>
+ <bpmn:correlationKey>
+ <bpmn:correlationPropertyRef>test</bpmn:correlationPropertyRef>
+ </bpmn:correlationKey>
+ </bpmn:conversation>
+</bpmn:definitions>
Property changes on: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/shipment.java.bpmn.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/shipment.pdf (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/test/shipment.pdf)
===================================================================
(Binary files differ)
Property changes on: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/shipment.pdf
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/shipment.ws.bpmn.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/test/shipment.ws.bpmn.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/shipment.ws.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/shipment.ws.bpmn.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ShipmentDefinitions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\BPMN20.xsd" xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" xmlns:sample="http://sample.bpmn.camunda.com/" xmlns:xbpmn="http://bpmn.camunda.com/" xmlns:tns="http://sample.bpmn.camunda.com/" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/">
+
+ <!-- imports -->
+ <bpmn:import namespace="http://sample.bpmn.camunda.com/" location="D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\SampleService.xsd" importType="http://www.w3.org/2001/XMLSchema"/>
+ <bpmn:import namespace="http://sample.bpmn.camunda.com/" location="D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\SampleService.wsdl" importType="http://schemas.xmlsoap.org/wsdl/soap/"/>
+ <bpmn:import namespace="http://sample.bpmn.camunda.com/" location="D:\Projekte\workspace\jbpm4\BPMN-2.0\src\resource\ShipmentProcessService.wsdl" importType="http://schemas.xmlsoap.org/wsdl/soap/"/>
+
+ <!-- definition structures for process variables -->
+ <bpmn:itemDefinition id="lieferungDef" itemKind="Information" structureRef="sample:shipment"/>
+
+ <!-- definition structures for messages -->
+ <bpmn:itemDefinition id="ProzessStartenDef" itemKind="Information" structureRef="sample:startShipmentProces"/>
+ <bpmn:itemDefinition id="LieferungAnlegenDef" itemKind="Information" structureRef="sample:createShipment"/>
+ <bpmn:itemDefinition id="KommissioniertDef" itemKind="Information" structureRef="sample:notifyShipmentConsigned"/>
+
+ <!-- messages -->
+ <bpmn:message name="ProzessStarten" id="ProzessStartenNachricht" structureRef="tns:ProzessStartenDef"/>
+ <bpmn:message name="LieferungAnlegen" id="LieferungAnlegenNachricht" structureRef="tns:LieferungAnlegenDef"/>
+ <bpmn:message name="Kommissioniert" id="KommissioniertNachricht" structureRef="tns:KommissioniertDef"/>
+
+ <!-- Services -->
+ <!-- serivceReference ?? -->
+ <!-- conversation? Participant? -->
+
+ <bpmn:endPoint id="ProzessEndpoint">
+ <xbpmn:url/>
+ </bpmn:endPoint>
+ <bpmn:endPoint id="LiefersystemEndpoint">
+ <xbpmn:url/>
+ </bpmn:endPoint>
+
+ <!-- interfaces -->
+ <bpmn:interface id="ProzessInterface" name="Lieferprozess Schnittstelle">
+ <bpmn:operation name="startShipmentProcess">
+ <bpmn:inMessageRef>tns:ProzessStartenNachricht</bpmn:inMessageRef>
+ </bpmn:operation>
+ <bpmn:operation name="notifyShipmentConsigned">
+ <bpmn:inMessageRef>tns:KommissioniertNachricht</bpmn:inMessageRef>
+ </bpmn:operation>
+ </bpmn:interface>
+ <bpmn:interface id="LiefersystemInterface" name="Liefersystem Schnittstelle">
+ <bpmn:operation name="createShiptment">
+ <bpmn:inMessageRef>tns:LieferungAnlegenNachricht</bpmn:inMessageRef>
+ </bpmn:operation>
+ </bpmn:interface>
+ <!-- Resources / Performers -->
+ <bpmn:resource id="VertriebResource" name="Vertrieb"/>
+ <!-- process definition -->
+ <bpmn:process id="Shipment" name="Shipment">
+ <bpmn:documentation id="doc1">Teilprozess der Lieferung</bpmn:documentation>
+
+ <!-- process variables -->
+ <bpmn:dataObject id="lieferungVariable" name="Lieferung" itemSubjectRef="tns:lieferungDef"/>
+
+ <!-- Start-Event -->
+ <bpmn:startEvent id="Start">
+ <bpmn:dataOutput id="ProzessStartOutput" itemSubjectRef="tns:ProzessStartenNachricht"/>
+ <bpmn:dataOutputAssociation>
+ <bpmn:assignment>
+ <bpmn:from xsi:type="bpmn:tFormalExpression">getDataOutput('ProzessStartOutput')/shipment</bpmn:from>
+ <bpmn:to xsi:type="bpmn:tFormalExpression">getDataObject('lieferungVariable')</bpmn:to>
+ </bpmn:assignment>
+ <bpmn:sourceRef>ProzessStartOutput</bpmn:sourceRef>
+ <bpmn:targetRef>tns:lieferungVariable</bpmn:targetRef>
+ </bpmn:dataOutputAssociation>
+ <bpmn:messageEventDefinition messageRef="tns:ProzessStartenNachricht">
+ <bpmn:operationRef>tns:startShipmentProcess</bpmn:operationRef>
+ </bpmn:messageEventDefinition>
+ </bpmn:startEvent>
+
+ <!-- Activity 1: Service Task -->
+ <bpmn:serviceTask id="LieferungBuchen" name="Lieferung buchen" implementation="WebService" operationRef="createShipment">
+ <xbpmn:url/>
+ <bpmn:ioSpecification>
+ <bpmn:dataInput id="LieferungBuchenInput" isCollection="false" itemSubjectRef="tns:LieferungAnlegenNachricht"/>
+ <bpmn:inputSet>
+ <bpmn:dataInputRefs>LieferungBuchenInput</bpmn:dataInputRefs>
+ </bpmn:inputSet>
+ <bpmn:outputSet/>
+ </bpmn:ioSpecification>
+ <bpmn:dataInputAssociation>
+ <bpmn:assignment>
+ <bpmn:from xsi:type="bpmn:tFormalExpression">bpmn:getDataObject('lieferungVariable')</bpmn:from>
+ <bpmn:to xsi:type="bpmn:tFormalExpression">bpmn:getDataInput('LieferungBuchenInput'/shipment/</bpmn:to>
+ </bpmn:assignment>
+ <bpmn:sourceRef>tns:lieferungVariable</bpmn:sourceRef>
+ <bpmn:targetRef>LieferungBuchenInput</bpmn:targetRef>
+ </bpmn:dataInputAssociation>
+ </bpmn:serviceTask>
+
+ <!-- Activity 2: Receive Task -->
+ <bpmn:receiveTask id="WartenAufLieferung" name="Warten auf Lieferung" instantiate="false" implementation="WebService" operationRef="notifyShipmentConsigned" messageRef="tns:Kommissioniert">
+ <bpmn:ioSpecification>
+ <bpmn:dataOutput id="KommissioniertOutput" itemSubjectRef="tns:KommissioniertNachricht"/>
+ <bpmn:inputSet/>
+ <bpmn:outputSet>
+ <bpmn:dataOutputRefs>KommissioniertOutput</bpmn:dataOutputRefs>
+ </bpmn:outputSet>
+ </bpmn:ioSpecification>
+
+ <bpmn:dataOutputAssociation>
+ <bpmn:assignment>
+ <bpmn:from xsi:type="bpmn:tFormalExpression">getDataOutput('KommissioniertOutput')/shipment</bpmn:from>
+ <bpmn:to xsi:type="bpmn:tFormalExpression">getDataObject('lieferungVariable')</bpmn:to>
+ </bpmn:assignment>
+ <bpmn:sourceRef>KommissioniertOutput</bpmn:sourceRef>
+ <bpmn:targetRef>tns:lieferungVariable</bpmn:targetRef>
+ </bpmn:dataOutputAssociation>
+ </bpmn:receiveTask>
+
+ <!-- Gateway -->
+ <bpmn:exclusiveGateway id="PruefeAvisierung" name="Avisierung benoetigt?"/>
+
+ <!-- Activity 3: User Task -->
+ <bpmn:userTask id="LieferterminAvisieren" name="Liefertermin avisieren" implementation="other">
+ <!-- <bpmn:humanPerformer resourceRef="tns:Vertrieb"></bpmn:humanPerformer>-->
+ <bpmn:potentialOwner resourceRef="tns:VertriebResource"/>
+ </bpmn:userTask>
+
+ <!-- End Events -->
+ <bpmn:endEvent id="End" name="End"/>
+
+ <!-- Sequence Flow -->
+ <bpmn:sequenceFlow id="flow1" sourceRef="Start" targetRef="LieferungBuchen" name="Start->LieferungBuchen"/>
+ <bpmn:sequenceFlow id="flow2" sourceRef="LieferungBuchen" targetRef="WartenAufLieferung"/>
+ <bpmn:sequenceFlow id="flow3" sourceRef="WartenAufLieferung" targetRef="PruefeAvisierung"/>
+ <bpmn:sequenceFlow id="flow4" sourceRef="PruefeAvisierung" targetRef="LieferterminAvisieren">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">getDataObject('lieferungVariable')/confirmationRequired=true</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow5" sourceRef="PruefeAvisierung" targetRef="End">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">not( getDataObject('lieferungVariable')/confirmationRequired=true )</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="flow6" sourceRef="LieferterminAvisieren" targetRef="End"/>
+ </bpmn:process>
+
+<!--
+ <bpmn:correlationSubscription>
+ </bpmn:correlationSubscription>
+-->
+
+ <!-- TODO: Correlation / Conversation -->
+ <bpmn:conversation>
+ <bpmn:correlationKey>
+ <bpmn:correlationPropertyRef>test</bpmn:correlationPropertyRef>
+ </bpmn:correlationKey>
+ </bpmn:conversation>
+</bpmn:definitions>
Copied: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/xmlTestDocument.xml (from rev 5886, jbpm4/trunk/modules/bpmn/src/test/resources/org/jbpm/bpmn/flownodes/xmlTestDocument.xml)
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/xmlTestDocument.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/xmlTestDocument.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -0,0 +1,6 @@
+<root>
+ <child1>just</child1>
+ <child2>for</child2>
+ <child3>demo</child3>
+ <child4>purposes</child4>
+</root>
\ No newline at end of file
Modified: jbpm4/trunk/pom.xml
===================================================================
--- jbpm4/trunk/pom.xml 2009-11-06 19:42:41 UTC (rev 5886)
+++ jbpm4/trunk/pom.xml 2009-11-09 13:54:10 UTC (rev 5887)
@@ -47,6 +47,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<apache.ant.version>1.7.0</apache.ant.version>
+ <beanshell.version>2.0b5</beanshell.version>
+ <groovy.version>1.5.6</groovy.version>
<cactus.version>1.8.1</cactus.version>
<aspectjrt.version>1.5.3</aspectjrt.version>
<freemarker.version>2.3.15</freemarker.version>
@@ -55,7 +57,6 @@
<hibernate.version>3.3.1.GA</hibernate.version>
<slf4j.version>1.5.2</slf4j.version>
<hsqldb.version>1.8.0.7</hsqldb.version>
- <izpack.version>4.2.1</izpack.version>
<jboss.identity.version>1.0.0.Beta1</jboss.identity.version>
<jboss.j2ee.version>4.2.2.GA</jboss.j2ee.version>
<jboss.client.version>5.0.1.GA</jboss.client.version>
@@ -172,12 +173,6 @@
<version>${version}</version>
</dependency>
<dependency>
- <groupId>org.eclipse.birt</groupId>
- <artifactId>report-engine</artifactId>
- <type>zip</type>
- <version>${report.engine.version}</version>
- </dependency>
- <dependency>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-console-reports</artifactId>
<version>${version}</version>
@@ -187,43 +182,12 @@
<artifactId>jbpm-jboss4</artifactId>
<version>${version}</version>
</dependency>
-
- <!-- GWT console -->
<dependency>
- <groupId>org.jboss.bpm</groupId>
- <artifactId>gwt-console</artifactId>
- <version>${gwt.console.version}</version>
- <classifier>jbpm</classifier>
- <type>war</type>
- </dependency>
- <dependency>
- <groupId>org.jboss.bpm</groupId>
- <artifactId>gwt-console-server</artifactId>
- <version>${gwt.console.version}</version>
- <classifier>jbpm</classifier>
- <type>war</type>
- </dependency>
- <dependency>
- <groupId>org.jboss.bpm</groupId>
- <artifactId>gwt-console-server-integration</artifactId>
- <version>${gwt.console.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.bpm</groupId>
- <artifactId>gwt-console-rpc</artifactId>
- <version>${gwt.console.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- GPD -->
- <dependency>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-gpd</artifactId>
<type>zip</type>
<version>${jbpm.gpd.version}</version>
</dependency>
-
- <!-- Signavio editor -->
<dependency>
<groupId>org.jbpm.jbpm4.dependencies.signavio</groupId>
<artifactId>jbpmeditor</artifactId>
@@ -239,11 +203,6 @@
<version>${aspectjrt.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>${apache.ant.version}</version>
- </dependency>
- <dependency>
<groupId>cactus</groupId>
<artifactId>cactus.core</artifactId>
<version>${cactus.version}</version>
@@ -259,67 +218,15 @@
<version>${cactus.version}</version>
</dependency>
<dependency>
- <groupId>org.freemarker</groupId>
- <artifactId>freemarker</artifactId>
- <version>${freemarker.version}</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- <version>${hibernate.version}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-jdk14</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-core</artifactId>
- <version>${jboss.identity.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.identity.idm</groupId>
- <artifactId>idm-hibernate</artifactId>
- <version>${jboss.identity.version}</version>
- </dependency>
- <dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>${hsqldb.version}</version>
</dependency>
<dependency>
- <groupId>izpack</groupId>
- <artifactId>standalone-compiler</artifactId>
- <version>${izpack.version}</version>
- </dependency>
-
- <!-- AS 5 dependencies -->
- <dependency>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-javaee</artifactId>
- <version>${jboss.client.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-client</artifactId>
- <version>${jboss.client.version}</version>
- <type>pom</type>
- </dependency>
-
- <!-- enterprise module deepends on j2ee -->
- <dependency>
<groupId>jboss</groupId>
<artifactId>jboss-j2ee</artifactId>
<version>${jboss.j2ee.version}</version>
</dependency>
-
-
<dependency>
<groupId>juel</groupId>
<artifactId>juel</artifactId>
@@ -351,16 +258,103 @@
<version>${log4j.version}</version>
</dependency>
<dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <version>${mail.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>${apache.ant.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.beanshell</groupId>
+ <artifactId>bsh</artifactId>
+ <version>${beanshell.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>${groovy.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.birt</groupId>
+ <artifactId>report-engine</artifactId>
+ <type>zip</type>
+ <version>${report.engine.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.freemarker</groupId>
+ <artifactId>freemarker</artifactId>
+ <version>${freemarker.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>${hibernate.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-core</artifactId>
+ <version>${jboss.identity.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity.idm</groupId>
+ <artifactId>idm-hibernate</artifactId>
+ <version>${jboss.identity.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.bpm</groupId>
+ <artifactId>gwt-console</artifactId>
+ <version>${gwt.console.version}</version>
+ <classifier>jbpm</classifier>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.bpm</groupId>
+ <artifactId>gwt-console-server</artifactId>
+ <version>${gwt.console.version}</version>
+ <classifier>jbpm</classifier>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.bpm</groupId>
+ <artifactId>gwt-console-server-integration</artifactId>
+ <version>${gwt.console.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.bpm</groupId>
+ <artifactId>gwt-console-rpc</artifactId>
+ <version>${gwt.console.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-javaee</artifactId>
+ <version>${jboss.client.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <version>${jboss.client.version}</version>
+ <type>pom</type>
+ </dependency>
+ <dependency>
<groupId>org.livetribe</groupId>
<artifactId>livetribe-jsr223</artifactId>
<version>${jsr233.version}</version>
</dependency>
<dependency>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- <version>${mail.version}</version>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>${spring.version}</version>
14 years, 5 months
JBoss JBPM SVN: r5886 - in jbpm4/trunk: modules/bpmn and 14 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-11-06 14:42:41 -0500 (Fri, 06 Nov 2009)
New Revision: 5886
Added:
jbpm4/trunk/modules/bpmn/src/main/resources/jbpm.bpmn.cfg.xml
jbpm4/trunk/modules/test-cactus/src/test/java/org/jbpm/test/
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/JavaServiceTask.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ServiceTaskTest.java
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/
jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/ServiceTaskJava.bpmn.xml
Modified:
jbpm4/trunk/modules/bpmn/pom.xml
jbpm4/trunk/modules/distro/pom.xml
jbpm4/trunk/modules/distro/scripts/assembly-jbpm-single-jar.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DeployerManagerBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/CollectionDescriptor.java
jbpm4/trunk/modules/test-db/pom.xml
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/pom.xml
jbpm4/trunk/qa/cactus.webapp.cfg/WEB-INF/classes/jbpm.cfg.xml
jbpm4/trunk/qa/jboss.jbpm.cfg/jbpm.cfg.xml
Log:
added bpmn to common test suite
Modified: jbpm4/trunk/modules/bpmn/pom.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/pom.xml 2009-11-05 12:02:17 UTC (rev 5885)
+++ jbpm4/trunk/modules/bpmn/pom.xml 2009-11-06 19:42:41 UTC (rev 5886)
@@ -81,7 +81,9 @@
<configuration>
<excludes>
<exclude>org/jbpm/test/xml/DbGenTest.java</exclude>
+ <exclude>org/jbpm/bpmn/flownodes/ExclusiveGatewayTest.java</exclude>
<exclude>org/jbpm/bpmn/flownodes/ScriptTaskTest.java</exclude>
+ <exclude>org/jbpm/bpmn/flownodes/UserTaskTest.java</exclude>
</excludes>
</configuration>
</plugin>
Added: jbpm4/trunk/modules/bpmn/src/main/resources/jbpm.bpmn.cfg.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/resources/jbpm.bpmn.cfg.xml (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/resources/jbpm.bpmn.cfg.xml 2009-11-06 19:42:41 UTC (rev 5886)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+ <process-engine-context>
+ <deployer-manager>
+ <object class="org.jbpm.bpmn.deployer.BpmnDeployer" />
+ </deployer-manager>
+ </process-engine-context>
+
+</jbpm-configuration>
Property changes on: jbpm4/trunk/modules/bpmn/src/main/resources/jbpm.bpmn.cfg.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/distro/pom.xml
===================================================================
--- jbpm4/trunk/modules/distro/pom.xml 2009-11-05 12:02:17 UTC (rev 5885)
+++ jbpm4/trunk/modules/distro/pom.xml 2009-11-06 19:42:41 UTC (rev 5886)
@@ -77,6 +77,10 @@
</dependency>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-bpmn</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-gpd</artifactId>
<type>zip</type>
</dependency>
Modified: jbpm4/trunk/modules/distro/scripts/assembly-jbpm-single-jar.xml
===================================================================
--- jbpm4/trunk/modules/distro/scripts/assembly-jbpm-single-jar.xml 2009-11-05 12:02:17 UTC (rev 5885)
+++ jbpm4/trunk/modules/distro/scripts/assembly-jbpm-single-jar.xml 2009-11-06 19:42:41 UTC (rev 5886)
@@ -44,6 +44,13 @@
</dependencySet>
<dependencySet>
<includes>
+ <include>org.jbpm.jbpm4:jbpm-bpmn</include>
+ </includes>
+ <unpack>true</unpack>
+ <outputDirectory></outputDirectory>
+ </dependencySet>
+ <dependencySet>
+ <includes>
<include>org.jbpm.jbpm4:jbpm-test-base</include>
</includes>
<unpack>true</unpack>
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DeployerManagerBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DeployerManagerBinding.java 2009-11-05 12:02:17 UTC (rev 5885)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DeployerManagerBinding.java 2009-11-06 19:42:41 UTC (rev 5886)
@@ -21,9 +21,14 @@
*/
package org.jbpm.pvm.internal.wire.binding;
+import java.util.List;
+
import org.jbpm.pvm.internal.repository.DeployerManager;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireDefinition;
import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.operation.FieldOperation;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
import org.w3c.dom.Element;
@@ -38,6 +43,7 @@
public class DeployerManagerBinding extends WireDescriptorBinding {
private static final String DEPLOYER_MANAGER_TAG = "deployer-manager";
+ private static ListBinding listBinding = new ListBinding();
public DeployerManagerBinding() {
super(DEPLOYER_MANAGER_TAG);
@@ -45,11 +51,25 @@
public Object parse(Element element, Parse parse, Parser parser) {
ObjectDescriptor objectDescriptor = new ObjectDescriptor(DeployerManager.class);
-
- ListBinding listBinding = new ListBinding();
+
ListDescriptor listDescriptor = (ListDescriptor) listBinding.parse(element, parse, parser);
- objectDescriptor.addInjection("deployers", listDescriptor);
+ WireDefinition wireDefinition = parse.contextStackFind(WireDefinition.class);
+ String descriptorName = wireDefinition.getDescriptorName(DeployerManager.class);
+ if (descriptorName==null) {
+ // merge the new deployment managers with the existing ones
+ objectDescriptor = new ObjectDescriptor(DeployerManager.class);
+ objectDescriptor.addInjection("deployers", listDescriptor);
+
+ } else {
+ // merge the new deployment managers with the existing ones
+ objectDescriptor = (ObjectDescriptor) wireDefinition.getDescriptor(descriptorName);
+ FieldOperation injection = (FieldOperation) objectDescriptor.getOperations().get(0);
+ ListDescriptor existingDescriptor = (ListDescriptor) injection.getDescriptor();
+ List<Descriptor> valueDescriptors = existingDescriptor.getValueDescriptors();
+ valueDescriptors.addAll(listDescriptor.getValueDescriptors());
+ }
+
return objectDescriptor;
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/CollectionDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/CollectionDescriptor.java 2009-11-05 12:02:17 UTC (rev 5885)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/CollectionDescriptor.java 2009-11-06 19:42:41 UTC (rev 5886)
@@ -9,7 +9,6 @@
import java.util.SortedSet;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.util.ReflectUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.WireException;
Modified: jbpm4/trunk/modules/test-db/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-db/pom.xml 2009-11-05 12:02:17 UTC (rev 5885)
+++ jbpm4/trunk/modules/test-db/pom.xml 2009-11-06 19:42:41 UTC (rev 5886)
@@ -44,6 +44,11 @@
</dependency>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-bpmn</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-test-base</artifactId>
<scope>test</scope>
</dependency>
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/JavaServiceTask.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/JavaServiceTask.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/JavaServiceTask.java 2009-11-06 19:42:41 UTC (rev 5886)
@@ -0,0 +1,9 @@
+package org.jbpm.bpmn;
+
+public class JavaServiceTask {
+
+ String myMethod(String arg1) {
+ return "myMethod with arg1: "+ arg1;
+ }
+
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/JavaServiceTask.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ServiceTaskTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ServiceTaskTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ServiceTaskTest.java 2009-11-06 19:42:41 UTC (rev 5886)
@@ -0,0 +1,68 @@
+/*
+ * 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.bpmn;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.TaskQuery;
+import org.jbpm.api.task.Task;
+import org.jbpm.test.JbpmTestCase;
+
+/**
+ * @author Bernd Ruecker (bernd.ruecker(a)camunda.com)
+ */
+public class ServiceTaskTest extends JbpmTestCase {
+
+ public void testNormalJavaServiceTaskCall() {
+ String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/bpmn/ServiceTaskJava.bpmn.xml").deploy();
+
+ try {
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("var1", "value");
+
+ ProcessInstance pi = executionService.startProcessInstanceByKey("ServiceTaskJavaProcess", variables);
+
+ assertNotNull(pi.getId());
+ assertEquals("myMethod with arg1: value",executionService.getVariable(pi.getId(), "returnVar"));
+
+ TaskQuery taskQuery = taskService.createTaskQuery();
+ List<Task> allTasks = taskQuery.list();
+ assertEquals(1, allTasks.size());
+
+ taskService.completeTask(allTasks.get(0).getId());
+
+ // process instance is ended
+ pi = executionService.findProcessInstanceById(pi.getId());
+ // One way or another I would also expect this to work... pi is gone from
+ // database immediately when ended. Only in History DB
+ // assertEquals(true, pi.isEnded());
+ assertNull(pi);
+ } finally {
+ repositoryService.deleteDeploymentCascade(deploymentId);
+ }
+ }
+
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/bpmn/ServiceTaskTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml 2009-11-05 12:02:17 UTC (rev 5885)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml 2009-11-06 19:42:41 UTC (rev 5886)
@@ -6,6 +6,7 @@
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.tx.hibernate.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" />
+ <import resource="jbpm.bpmn.cfg.xml" />
<import resource="jbpm.identity.cfg.xml" />
</jbpm-configuration>
Added: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/ServiceTaskJava.bpmn.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/ServiceTaskJava.bpmn.xml (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/ServiceTaskJava.bpmn.xml 2009-11-06 19:42:41 UTC (rev 5886)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions id="ServiceTaskJava"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 ../../../../../../main/resources/BPMN20.xsd"
+ xmlns:bpmn="http://schema.omg.org/spec/BPMN/2.0" typeLanguage="http://www.w3.org/2001/XMLSchema"
+ expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://sample.bpmn.camunda.com/"
+ xmlns:jbpm="http://jbpm.org/4.0/bpmn2">
+
+ <bpmn:itemDefinition id="itemDefinition1">
+ <jbpm:arg>
+ <jbpm:object expr="#{var1}" />
+ </jbpm:arg>
+ </bpmn:itemDefinition>
+
+ <bpmn:itemDefinition id="itemDefinition2">
+ <jbpm:var name="returnVar" />
+ </bpmn:itemDefinition>
+
+ <bpmn:message id="inputMessage" name="input message"
+ structureRef="itemDefinition1"></bpmn:message>
+
+ <bpmn:message id="outputMessage" name="output message"
+ structureRef="itemDefinition2">
+ </bpmn:message>
+
+ <bpmn:interface id="interface21"
+ name="org.jbpm.bpmn.JavaServiceTask">
+ <bpmn:operation id="operation42" name="myMethod">
+ <bpmn:inMessageRef>inputMessage</bpmn:inMessageRef>
+ <bpmn:outMessageRef>outputMessage</bpmn:outMessageRef>
+ </bpmn:operation>
+ </bpmn:interface>
+
+ <bpmn:process id="ServiceTaskJavaProcess" name="Simple process with java service task">
+
+ <bpmn:startEvent id="Start" />
+
+ <bpmn:sequenceFlow id="flow1" name="fromStartToServiceTask"
+ sourceRef="Start" targetRef="ServiceTask" />
+
+ <bpmn:serviceTask id="ServiceTask" name="service task"
+ implementation="Other" operationRef="operation42">
+ </bpmn:serviceTask>
+
+ <bpmn:sequenceFlow id="flow2" name="fromServiceTaskToUT1"
+ sourceRef="ServiceTask" targetRef="UT1" />
+
+ <bpmn:userTask id="UT1" name="bla" implementation="other" />
+
+ <bpmn:sequenceFlow id="flow3" name="fromUT1toEnd"
+ sourceRef="UT1" targetRef="End" />
+
+ <bpmn:endEvent id="End" name="End" />
+
+ </bpmn:process>
+</bpmn:definitions>
Property changes on: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/bpmn/ServiceTaskJava.bpmn.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/pom.xml
===================================================================
--- jbpm4/trunk/pom.xml 2009-11-05 12:02:17 UTC (rev 5885)
+++ jbpm4/trunk/pom.xml 2009-11-06 19:42:41 UTC (rev 5886)
@@ -35,6 +35,7 @@
<module>modules/test-base</module>
<module>modules/pvm</module>
<module>modules/jpdl</module>
+ <module>modules/bpmn</module>
<module>modules/integration</module>
<module>modules/examples</module>
<module>modules/test-db</module>
@@ -110,6 +111,11 @@
</dependency>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-bpmn</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-log</artifactId>
<version>${version}</version>
</dependency>
Modified: jbpm4/trunk/qa/cactus.webapp.cfg/WEB-INF/classes/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/qa/cactus.webapp.cfg/WEB-INF/classes/jbpm.cfg.xml 2009-11-05 12:02:17 UTC (rev 5885)
+++ jbpm4/trunk/qa/cactus.webapp.cfg/WEB-INF/classes/jbpm.cfg.xml 2009-11-06 19:42:41 UTC (rev 5886)
@@ -5,6 +5,7 @@
<import resource="jbpm.default.cfg.xml" />
<import resource="jbpm.tx.hibernate.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.jobexecutor.cfg.xml" / -->
Modified: jbpm4/trunk/qa/jboss.jbpm.cfg/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/qa/jboss.jbpm.cfg/jbpm.cfg.xml 2009-11-05 12:02:17 UTC (rev 5885)
+++ jbpm4/trunk/qa/jboss.jbpm.cfg/jbpm.cfg.xml 2009-11-06 19:42:41 UTC (rev 5886)
@@ -6,6 +6,7 @@
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.tx.jta.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" />
+ <import resource="jbpm.bpmn.cfg.xml" />
<import resource="jbpm.identity.cfg.xml" />
<import resource="jbpm.mail.templates.examples.xml" />
14 years, 6 months
JBoss JBPM SVN: r5885 - jbpm4/tags/jbpm-4.2/modules/distro/scripts.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-11-05 07:02:17 -0500 (Thu, 05 Nov 2009)
New Revision: 5885
Modified:
jbpm4/tags/jbpm-4.2/modules/distro/scripts/assembly-distro.xml
Log:
JBPM-2623 removed duplicate inclusion of schemadocs
Modified: jbpm4/tags/jbpm-4.2/modules/distro/scripts/assembly-distro.xml
===================================================================
--- jbpm4/tags/jbpm-4.2/modules/distro/scripts/assembly-distro.xml 2009-11-05 12:02:11 UTC (rev 5884)
+++ jbpm4/tags/jbpm-4.2/modules/distro/scripts/assembly-distro.xml 2009-11-05 12:02:17 UTC (rev 5885)
@@ -74,10 +74,6 @@
<outputDirectory>doc/javadocs</outputDirectory>
</fileSet>
<fileSet>
- <directory>../api/target/schemadocs</directory>
- <outputDirectory>doc/schemadocs</outputDirectory>
- </fileSet>
- <fileSet>
<directory>../db/target/classes</directory>
<outputDirectory>install/src</outputDirectory>
<excludes>
14 years, 6 months
JBoss JBPM SVN: r5884 - jbpm4/trunk/modules/distro/scripts.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-11-05 07:02:11 -0500 (Thu, 05 Nov 2009)
New Revision: 5884
Modified:
jbpm4/trunk/modules/distro/scripts/assembly-distro.xml
Log:
JBPM-2623 removed duplicate inclusion of schemadocs
Modified: jbpm4/trunk/modules/distro/scripts/assembly-distro.xml
===================================================================
--- jbpm4/trunk/modules/distro/scripts/assembly-distro.xml 2009-11-05 08:43:57 UTC (rev 5883)
+++ jbpm4/trunk/modules/distro/scripts/assembly-distro.xml 2009-11-05 12:02:11 UTC (rev 5884)
@@ -74,10 +74,6 @@
<outputDirectory>doc/javadocs</outputDirectory>
</fileSet>
<fileSet>
- <directory>../api/target/schemadocs</directory>
- <outputDirectory>doc/schemadocs</outputDirectory>
- </fileSet>
- <fileSet>
<directory>../db/target/classes</directory>
<outputDirectory>install/src</outputDirectory>
<excludes>
14 years, 6 months
JBoss JBPM SVN: r5883 - jbpm4/tags/jbpm-4.2.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-11-05 03:43:57 -0500 (Thu, 05 Nov 2009)
New Revision: 5883
Modified:
jbpm4/tags/jbpm-4.2/pom.xml
Log:
Set bpm console version 1.2.1
Modified: jbpm4/tags/jbpm-4.2/pom.xml
===================================================================
--- jbpm4/tags/jbpm-4.2/pom.xml 2009-11-03 23:14:39 UTC (rev 5882)
+++ jbpm4/tags/jbpm-4.2/pom.xml 2009-11-05 08:43:57 UTC (rev 5883)
@@ -49,7 +49,7 @@
<cactus.version>1.8.1</cactus.version>
<aspectjrt.version>1.5.3</aspectjrt.version>
<freemarker.version>2.3.15</freemarker.version>
- <gwt.console.version>1.2.0</gwt.console.version>
+ <gwt.console.version>1.2.1</gwt.console.version>
<jbpm.gpd.version>4.2</jbpm.gpd.version>
<hibernate.version>3.3.1.GA</hibernate.version>
<slf4j.version>1.5.2</slf4j.version>
14 years, 6 months
JBoss JBPM SVN: r5882 - jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/resources.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-11-03 18:14:39 -0500 (Tue, 03 Nov 2009)
New Revision: 5882
Modified:
jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/resources/hibernate.mapping.db2.xml
Log:
JBPM-2617: Dynamic timer support pack for DB2
Correct syntax error in DB2 mapping document
Modified: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/resources/hibernate.mapping.db2.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/resources/hibernate.mapping.db2.xml 2009-11-03 22:22:25 UTC (rev 5881)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/resources/hibernate.mapping.db2.xml 2009-11-03 23:14:39 UTC (rev 5882)
@@ -13,7 +13,7 @@
employ data type CLOB instead of VARCHAR(4000) in long string columns.
With CLOB columns, the jBPM tables fit on a 4KB page-size tablespace,
as opposed to the 32KB page-size tablespace required with VARCHAR(4000).
- For details, see: https://jira.jboss.org/jira/browse/JBPM-2369
+ For details, see: https://jira.jboss.org/jira/browse/JBPM-2369 -->
<!--
<mapping resource="org/jbpm/db/hibernate.types.db2.hbm.xml" />
<mapping resource="org/jbpm/context/exe/variableinstance/HibernateStringInstance.db2.hbm.xml"/>
14 years, 6 months
JBoss JBPM SVN: r5881 - jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/resources.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-11-03 17:22:25 -0500 (Tue, 03 Nov 2009)
New Revision: 5881
Modified:
jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/resources/hibernate.mapping.db2.xml
jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/resources/hibernate.mapping.default.xml
jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/resources/hibernate.mapping.sybase.xml
Log:
JBPM-2617: Dynamic timer support pack for DB2
Revert text columns to varchar(4000)
Modified: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/resources/hibernate.mapping.db2.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/resources/hibernate.mapping.db2.xml 2009-11-03 22:12:10 UTC (rev 5880)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/resources/hibernate.mapping.db2.xml 2009-11-03 22:22:25 UTC (rev 5881)
@@ -5,15 +5,25 @@
<!-- hql queries -->
<mapping resource="org/jbpm/db/hibernate.queries.hbm.xml" />
- <!-- DB2 type mappings -->
+ <!-- type definitions -->
+ <mapping resource="org/jbpm/db/hibernate.types.hbm.xml" />
+
+ <!-- DB2 type definitions.
+ Enable these mappings -aimed at new DB2 deployments- in order to
+ employ data type CLOB instead of VARCHAR(4000) in long string columns.
+ With CLOB columns, the jBPM tables fit on a 4KB page-size tablespace,
+ as opposed to the 32KB page-size tablespace required with VARCHAR(4000).
+ For details, see: https://jira.jboss.org/jira/browse/JBPM-2369
+ <!--
<mapping resource="org/jbpm/db/hibernate.types.db2.hbm.xml" />
+ <mapping resource="org/jbpm/context/exe/variableinstance/HibernateStringInstance.db2.hbm.xml"/>
+ -->
- <!-- hql queries used in simulation for querying historical data.
- uncomment if you want to use the GetSimulationInputCommand
- or you want to use the queries directly.
- beware: the queries need the stddev function to be enabled in your dialect.
- for more information, visit:
- http://www.camunda.com/business_process_simulation_news/mysql_and_stddev.... -->
+ <!-- Historical data queries used by the simulation module.
+ Uncomment in order to employ the GetSimulationInputCommand
+ or execute the queries directly.
+ Beware: the stddev function is required. For more info, visit:
+ http://www.camunda.com/content/view/96/ -->
<!--
<mapping resource="org/jbpm/sim/bam/hibernate.queries.hbm.xml" />
-->
@@ -31,13 +41,10 @@
<mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml"/>
<mapping resource="org/jbpm/instantiation/Delegation.hbm.xml"/>
- <!-- ########################################### -->
- <!-- # mapping file with external dependencies # -->
- <!-- ########################################### -->
- <!-- the following mapping file has a dependency on 'bsh-{version}.jar'.
- uncomment this if bsh is not in your classpath.
- the script element will not be available in process definition files.
- note: this mapping must appear below org/jbpm/graph/def/Action.hbm.xml -->
+ <!-- Mapping file with dependency on bsh.jar.
+ comment out if beanshell is not in your classpath.
+ the script element will not be available in process definitions.
+ note: this mapping must appear below Action.hbm.xml -->
<mapping resource="org/jbpm/graph/action/Script.hbm.xml"/>
<!-- graph.node mapping files -->
@@ -91,7 +98,7 @@
<mapping resource="org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml"/>
- <mapping resource="org/jbpm/context/exe/variableinstance/HibernateStringInstance.db2.hbm.xml"/>
+ <mapping resource="org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml"/>
<mapping resource="org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml"/>
Modified: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/resources/hibernate.mapping.default.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/resources/hibernate.mapping.default.xml 2009-11-03 22:12:10 UTC (rev 5880)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/resources/hibernate.mapping.default.xml 2009-11-03 22:22:25 UTC (rev 5881)
@@ -5,15 +5,14 @@
<!-- hql queries -->
<mapping resource="org/jbpm/db/hibernate.queries.hbm.xml" />
- <!-- type mappings -->
+ <!-- type definitions -->
<mapping resource="org/jbpm/db/hibernate.types.hbm.xml" />
- <!-- hql queries used in simulation for querying historical data.
- uncomment if you want to use the GetSimulationInputCommand
- or you want to use the queries directly.
- beware: the queries need the stddev function to be enabled in your dialect.
- for more information, visit:
- http://www.camunda.com/business_process_simulation_news/mysql_and_stddev.... -->
+ <!-- Historical data queries used by the simulation module.
+ Uncomment in order to employ the GetSimulationInputCommand
+ or execute the queries directly.
+ Beware: the stddev function is required. For more info, visit:
+ http://www.camunda.com/content/view/96/ -->
<!--
<mapping resource="org/jbpm/sim/bam/hibernate.queries.hbm.xml" />
-->
@@ -31,13 +30,10 @@
<mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml"/>
<mapping resource="org/jbpm/instantiation/Delegation.hbm.xml"/>
- <!-- ########################################### -->
- <!-- # mapping file with external dependencies # -->
- <!-- ########################################### -->
- <!-- the following mapping file has a dependency on 'bsh-{version}.jar'.
- uncomment this if bsh is not in your classpath.
- the script element will not be available in process definition files.
- note: this mapping must appear below org/jbpm/graph/def/Action.hbm.xml -->
+ <!-- Mapping file with dependency on bsh.jar.
+ comment out if beanshell is not in your classpath.
+ the script element will not be available in process definitions.
+ note: this mapping must appear below Action.hbm.xml -->
<mapping resource="org/jbpm/graph/action/Script.hbm.xml"/>
<!-- graph.node mapping files -->
Modified: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/resources/hibernate.mapping.sybase.xml
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/resources/hibernate.mapping.sybase.xml 2009-11-03 22:12:10 UTC (rev 5880)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/resources/hibernate.mapping.sybase.xml 2009-11-03 22:22:25 UTC (rev 5881)
@@ -5,15 +5,14 @@
<!-- hql queries -->
<mapping resource="org/jbpm/db/hibernate.queries.hbm.xml" />
- <!-- sybase type mappings -->
+ <!-- sybase type definitions -->
<mapping resource="org/jbpm/db/hibernate.types.sybase.hbm.xml" />
- <!-- hql queries used in simulation for querying historical data.
- uncomment if you want to use the GetSimulationInputCommand
- or you want to use the queries directly.
- beware: the queries need the stddev function to be enabled in your dialect.
- for more information, visit:
- http://www.camunda.com/business_process_simulation_news/mysql_and_stddev.... -->
+ <!-- Historical data queries used by the simulation module.
+ Uncomment in order to employ the GetSimulationInputCommand
+ or execute the queries directly.
+ Beware: the stddev function is required. For more info, visit:
+ http://www.camunda.com/content/view/96/ -->
<!--
<mapping resource="org/jbpm/sim/bam/hibernate.queries.hbm.xml" />
-->
@@ -31,13 +30,10 @@
<mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml"/>
<mapping resource="org/jbpm/instantiation/Delegation.hbm.xml"/>
- <!-- ########################################### -->
- <!-- # mapping file with external dependencies # -->
- <!-- ########################################### -->
- <!-- the following mapping file has a dependency on 'bsh-{version}.jar'.
- uncomment this if bsh is not in your classpath.
- the script element will not be available in process definition files.
- note: this mapping must appear below org/jbpm/graph/def/Action.hbm.xml -->
+ <!-- Mapping file with dependency on bsh.jar.
+ comment out if beanshell is not in your classpath.
+ the script element will not be available in process definitions.
+ note: this mapping must appear below Action.hbm.xml -->
<mapping resource="org/jbpm/graph/action/Script.hbm.xml"/>
<!-- graph.node mapping files -->
14 years, 6 months
JBoss JBPM SVN: r5880 - in jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src: main/java/org/jbpm/db/hibernate and 9 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-11-03 17:12:10 -0500 (Tue, 03 Nov 2009)
New Revision: 5880
Added:
jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm1085/
jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm1085/JBPM1085Test.java
jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2603/
jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2603/JBPM2603Test.java
Removed:
jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm1085/JBPM1085Test.java
jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2603/JBPM2603Test.java
jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jpdl/exe/JoinExecutionDbTest.java
Modified:
jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/db/JobSession.java
jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/db/hibernate/LimitedTextType.java
jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/graph/def/Action.java
jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/scheduler/def/CreateTimerAction.java
jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/command/ChangeProcessInstanceVersionCommandTest.java
jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2036/JBPM2036Test.java
jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/taskmgmt/exe/TaskTimerExecutionDbTest.java
Log:
JBPM-2617: Dynamic timer support pack for DB2
Merge revisions 5805-5818 from branch jbpm-3.2-soa
Modified: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/db/JobSession.java
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/db/JobSession.java 2009-11-03 22:11:03 UTC (rev 5879)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/db/JobSession.java 2009-11-03 22:12:10 UTC (rev 5880)
@@ -31,6 +31,8 @@
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
+
+import org.jbpm.graph.def.Action;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.exe.Token;
import org.jbpm.job.Job;
@@ -48,10 +50,10 @@
public Job getFirstAcquirableJob(String lockOwner) {
try {
return (Job) session.getNamedQuery("JobSession.getFirstAcquirableJob")
- .setString("lockOwner", lockOwner)
- .setTimestamp("now", new Date())
- .setMaxResults(1)
- .uniqueResult();
+ .setString("lockOwner", lockOwner)
+ .setTimestamp("now", new Date())
+ .setMaxResults(1)
+ .uniqueResult();
}
catch (HibernateException e) {
throw new JbpmPersistenceException("could not get first acquirable job", e);
@@ -61,24 +63,24 @@
public List findExclusiveJobs(String lockOwner, ProcessInstance processInstance) {
try {
return session.getNamedQuery("JobSession.findExclusiveJobs")
- .setString("lockOwner", lockOwner)
- .setTimestamp("now", new Date())
- .setParameter("processInstance", processInstance)
- .list();
+ .setString("lockOwner", lockOwner)
+ .setTimestamp("now", new Date())
+ .setParameter("processInstance", processInstance)
+ .list();
}
catch (HibernateException e) {
- throw new JbpmPersistenceException("could not find exclusive jobs owned by '" +
- lockOwner +
- "' for " +
- processInstance, e);
+ throw new JbpmPersistenceException("could not find exclusive jobs owned by '"
+ + lockOwner
+ + "' for "
+ + processInstance, e);
}
}
public List findJobsByToken(Token token) {
try {
return session.getNamedQuery("JobSession.findJobsByToken")
- .setParameter("token", token)
- .list();
+ .setParameter("token", token)
+ .list();
}
catch (HibernateException e) {
throw new JbpmPersistenceException("could not find jobs for " + token, e);
@@ -98,16 +100,24 @@
return (Job) query.setString("lockOwner", lockOwner).setMaxResults(1).uniqueResult();
}
catch (HibernateException e) {
- throw new JbpmPersistenceException("could not get first due job owned by '" +
- lockOwner +
- "' ignoring jobs " +
- monitoredJobs, e);
+ throw new JbpmPersistenceException("could not get first due job owned by '"
+ + lockOwner
+ + "' ignoring jobs "
+ + monitoredJobs, e);
}
}
public void saveJob(Job job) {
try {
session.save(job);
+ if (job instanceof Timer) {
+ Timer timer = (Timer) job;
+ Action action = timer.getAction();
+ if (action != null && action.getId() == 0) {
+ // transient action, save it
+ session.save(action);
+ }
+ }
}
catch (HibernateException e) {
throw new JbpmPersistenceException("could not save " + job, e);
@@ -167,7 +177,9 @@
public void suspendJobs(Token token) {
try {
- session.getNamedQuery("JobSession.suspendJobs").setParameter("token", token).executeUpdate();
+ session.getNamedQuery("JobSession.suspendJobs")
+ .setParameter("token", token)
+ .executeUpdate();
}
catch (HibernateException e) {
throw new JbpmPersistenceException("could not suspend jobs for " + token, e);
@@ -176,7 +188,9 @@
public void resumeJobs(Token token) {
try {
- session.getNamedQuery("JobSession.resumeJobs").setParameter("token", token).executeUpdate();
+ session.getNamedQuery("JobSession.resumeJobs")
+ .setParameter("token", token)
+ .executeUpdate();
}
catch (HibernateException e) {
throw new JbpmPersistenceException("could not resume jobs for " + token, e);
@@ -187,29 +201,29 @@
try {
// delete unowned timers
session.getNamedQuery("JobSession.deleteTimersByName")
- .setString("name", name)
- .setParameter("token", token)
- .executeUpdate();
+ .setString("name", name)
+ .setParameter("token", token)
+ .executeUpdate();
// prevent further repetitions
List timers = session.getNamedQuery("JobSession.findRepeatingTimersByName")
- .setString("name", name)
- .setParameter("token", token)
- .list();
+ .setString("name", name)
+ .setParameter("token", token)
+ .list();
preventFurtherRepetitions(timers);
}
catch (HibernateException e) {
- throw new JbpmPersistenceException("could not delete timers by name '" +
- name +
- "' for " +
- token, e);
+ throw new JbpmPersistenceException("could not delete timers by name '"
+ + name
+ + "' for "
+ + token, e);
}
}
public int countDeletableJobsForProcessInstance(ProcessInstance processInstance) {
Number jobCount = (Number) session.getNamedQuery("JobSession.countDeletableJobsForProcessInstance")
- .setParameter("processInstance", processInstance)
- .uniqueResult();
+ .setParameter("processInstance", processInstance)
+ .uniqueResult();
return jobCount.intValue();
}
@@ -217,13 +231,13 @@
try {
// delete unowned node-execute-jobs and timers
session.getNamedQuery("JobSession.deleteJobsForProcessInstance")
- .setParameter("processInstance", processInstance)
- .executeUpdate();
+ .setParameter("processInstance", processInstance)
+ .executeUpdate();
// prevent further repetitions
List timers = session.getNamedQuery("JobSession.findRepeatingTimersForProcessInstance")
- .setParameter("processInstance", processInstance)
- .list();
+ .setParameter("processInstance", processInstance)
+ .list();
preventFurtherRepetitions(timers);
}
catch (HibernateException e) {
@@ -243,11 +257,12 @@
public List findJobsWithOverdueLockTime(Date threshold) {
try {
return session.getNamedQuery("JobSession.findJobsWithOverdueLockTime")
- .setDate("threshold", threshold)
- .list();
+ .setDate("threshold", threshold)
+ .list();
}
catch (HibernateException e) {
- throw new JbpmPersistenceException("could not find jobs with lock time over " + threshold, e);
+ throw new JbpmPersistenceException(
+ "could not find jobs with lock time over " + threshold, e);
}
}
@@ -257,8 +272,6 @@
for (int i = 0; i < jobCount; i++) {
jobs[i] = new Long(jobIds[i]);
}
- return session.createCriteria(Job.class)
- .add(Restrictions.in("id", jobs))
- .list();
+ return session.createCriteria(Job.class).add(Restrictions.in("id", jobs)).list();
}
}
Modified: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/db/hibernate/LimitedTextType.java
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/db/hibernate/LimitedTextType.java 2009-11-03 22:11:03 UTC (rev 5879)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/db/hibernate/LimitedTextType.java 2009-11-03 22:12:10 UTC (rev 5880)
@@ -44,9 +44,13 @@
public void set(PreparedStatement st, Object value, int index) throws SQLException {
String text = (String) value;
- if (text.length() > limit) text = text.substring(0, limit);
+ int length = text.length();
+ if (length > limit) {
+ text = text.substring(0, limit);
+ length = limit;
+ }
- st.setCharacterStream(index, new StringReader(text), text.length());
+ st.setCharacterStream(index, new StringReader(text), length);
}
public void setParameterValues(Properties parameters) {
Modified: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/graph/def/Action.java
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/graph/def/Action.java 2009-11-03 22:11:03 UTC (rev 5879)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/graph/def/Action.java 2009-11-03 22:12:10 UTC (rev 5880)
@@ -39,16 +39,16 @@
private static final long serialVersionUID = 1L;
- long id = 0;
- protected String name = null;
+ long id;
+ protected String name;
protected boolean isPropagationAllowed = true;
- protected boolean isAsync = false;
- protected boolean isAsyncExclusive = false;
- protected Action referencedAction = null;
- protected Delegation actionDelegation = null;
- protected String actionExpression = null;
- protected Event event = null;
- protected ProcessDefinition processDefinition = null;
+ protected boolean isAsync;
+ protected boolean isAsyncExclusive;
+ protected Action referencedAction;
+ protected Delegation actionDelegation;
+ protected String actionExpression;
+ protected Event event;
+ protected ProcessDefinition processDefinition;
public Action() {
}
Modified: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/scheduler/def/CreateTimerAction.java
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/scheduler/def/CreateTimerAction.java 2009-11-03 22:11:03 UTC (rev 5879)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/scheduler/def/CreateTimerAction.java 2009-11-03 22:12:10 UTC (rev 5880)
@@ -43,13 +43,13 @@
public class CreateTimerAction extends Action {
private static final long serialVersionUID = 1L;
- static BusinessCalendar businessCalendar = new BusinessCalendar();
+ static final BusinessCalendar businessCalendar = new BusinessCalendar();
- String timerName = null;
- String dueDate = null;
- String repeat = null;
- String transitionName = null;
- Action timerAction = null;
+ String timerName;
+ String dueDate;
+ String repeat;
+ String transitionName;
+ Action timerAction;
public void read(Element actionElement, JpdlXmlReader jpdlReader) {
timerName = actionElement.attributeValue("name");
Modified: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/command/ChangeProcessInstanceVersionCommandTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/command/ChangeProcessInstanceVersionCommandTest.java 2009-11-03 22:11:03 UTC (rev 5879)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/command/ChangeProcessInstanceVersionCommandTest.java 2009-11-03 22:12:10 UTC (rev 5880)
@@ -44,16 +44,16 @@
// above), in this case I got
// could not delete: [org.jbpm.taskmgmt.def.TaskMgmtDefinition#2]
// Integrity constraint violation FK_TASKMGTINST_TMD table: JBPM_MODULEINSTANCE in statement [/* delete org.jbpm.taskmgmt.def.TaskMgmtDefinition */ delete from JBPM_MODULEDEFINITION where ID_=?]
- jbpmContext.getGraphSession().deleteProcessDefinition(pd2.getId());
- jbpmContext.getGraphSession().deleteProcessDefinition(pd1.getId());
+ graphSession.deleteProcessDefinition(pd2.getId());
+ graphSession.deleteProcessDefinition(pd1.getId());
}
else if (pd1 != null) {
newTransaction();
- jbpmContext.getGraphSession().deleteProcessDefinition(pd1.getId());
+ graphSession.deleteProcessDefinition(pd1.getId());
}
else if (pd2 != null) {
newTransaction();
- jbpmContext.getGraphSession().deleteProcessDefinition(pd2.getId());
+ graphSession.deleteProcessDefinition(pd2.getId());
}
pd1 = null;
@@ -83,7 +83,6 @@
pd1 = ProcessDefinition.parseXmlString(xmlVersion1);
jbpmContext.deployProcessDefinition(pd1);
- pd1 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
// start 2 instances
ProcessInstance pi1 = jbpmContext.newProcessInstance("TestChangeVersion");
@@ -108,7 +107,7 @@
pd2 = ProcessDefinition.parseXmlString(xmlVersion2);
jbpmContext.deployProcessDefinition(pd2);
- pd2 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
+ pd2 = graphSession.findLatestProcessDefinition("TestChangeVersion");
// now change all process instances to most current version
try {
@@ -175,8 +174,8 @@
+ " <end-state name='end' />" //
+ "</process-definition>";
- jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(xmlVersion1));
- pd1 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
+ pd1 = ProcessDefinition.parseXmlString(xmlVersion1);
+ jbpmContext.deployProcessDefinition(pd1);
// start instance
ProcessInstance pi1 = jbpmContext.newProcessInstance("TestChangeVersion");
@@ -206,7 +205,7 @@
+ "</process-definition>";
jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(xmlVersion2));
- pd2 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
+ pd2 = graphSession.findLatestProcessDefinition("TestChangeVersion");
// now change all process instances to most current version
try {
@@ -264,8 +263,8 @@
+ " <end-state name='end' />" //
+ "</process-definition>";
- jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(xmlVersion1));
- pd1 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
+ pd1 = ProcessDefinition.parseXmlString(xmlVersion1);
+ jbpmContext.deployProcessDefinition(pd1);
// start instance
ProcessInstance pi1 = jbpmContext.newProcessInstance("TestChangeVersion");
@@ -297,7 +296,7 @@
+ "</process-definition>";
jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(xmlVersion2));
- pd2 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
+ pd2 = graphSession.findLatestProcessDefinition("TestChangeVersion");
HashMap nodeNameMap = new HashMap();
nodeNameMap.put("task1", "task1b");
@@ -381,7 +380,6 @@
pd1 = ProcessDefinition.parseXmlString(xmlVersion1);
jbpmContext.deployProcessDefinition(pd1);
- pd1 = jbpmContext.getGraphSession().findLatestProcessDefinition("testTaskInstances");
// start 2 instances
ProcessInstance pi1 = jbpmContext.newProcessInstance("testTaskInstances");
@@ -408,7 +406,7 @@
pd2 = ProcessDefinition.parseXmlString(xmlVersion2);
jbpmContext.deployProcessDefinition(pd2);
- pd2 = jbpmContext.getGraphSession().findLatestProcessDefinition("testTaskInstances");
+ pd2 = graphSession.findLatestProcessDefinition("testTaskInstances");
// process instance 1 can me updated, state names haven't changed in this path:
new ChangeProcessInstanceVersionCommand().processInstanceId(pi1.getId()).execute(jbpmContext);
@@ -484,8 +482,8 @@
+ " <end-state name='end'/>" //
+ "</process-definition>";
- jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(xmlVersion1));
- pd1 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
+ pd1 = ProcessDefinition.parseXmlString(xmlVersion1);
+ jbpmContext.deployProcessDefinition(pd1);
// start instance
ProcessInstance pi1 = jbpmContext.newProcessInstance("TestChangeVersion");
@@ -510,7 +508,7 @@
+ "</process-definition>";
jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(xmlVersion2));
- pd2 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
+ pd2 = graphSession.findLatestProcessDefinition("TestChangeVersion");
// change version
HashMap nameMap = new HashMap();
@@ -549,8 +547,8 @@
+ " <end-state name='end'/>" //
+ "</process-definition>";
- jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(xmlVersion1));
- pd1 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
+ pd1 = ProcessDefinition.parseXmlString(xmlVersion1);
+ jbpmContext.deployProcessDefinition(pd1);
// start instance
ProcessInstance pi1 = jbpmContext.newProcessInstance("TestChangeVersion");
@@ -585,7 +583,7 @@
+ "</process-definition>";
jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(xmlVersion2));
- pd2 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
+ pd2 = graphSession.findLatestProcessDefinition("TestChangeVersion");
// change version
HashMap nameMap = new HashMap();
Copied: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm1085 (from rev 5818, jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm1085)
Deleted: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm1085/JBPM1085Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm1085/JBPM1085Test.java 2009-10-27 15:57:27 UTC (rev 5818)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm1085/JBPM1085Test.java 2009-11-03 22:12:10 UTC (rev 5880)
@@ -1,68 +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.jbpm1085;
-
-import org.jbpm.db.AbstractDbTestCase;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ProcessInstance;
-
-public class JBPM1085Test extends AbstractDbTestCase {
-
- public void testJoinPersistence() {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
- + " <start-state>"
- + " <transition to='f' />"
- + " </start-state>"
- + " <fork name='f'>"
- + " <transition name='a' to='a' />"
- + " <transition name='b' to='b' />"
- + " </fork>"
- + " <state name='a'>"
- + " <transition to='j' />"
- + " </state>"
- + " <state name='b'>"
- + " <transition to='j' />"
- + " </state>"
- + " <join name='j'>"
- + " <transition to='end' />"
- + " </join>"
- + " <end-state name='end'/>"
- + "</process-definition>");
- graphSession.saveProcessDefinition(processDefinition);
-
- try {
- ProcessInstance processInstance = new ProcessInstance(processDefinition);
- processInstance.signal();
- processInstance.findToken("/a").signal();
-
- processInstance = saveAndReload(processInstance);
- processInstance.findToken("/b").signal();
-
- assertEquals("end", processInstance.getRootToken().getNode().getName());
- assertEquals("j", processInstance.findToken("/a").getNode().getName());
- assertEquals("j", processInstance.findToken("/b").getNode().getName());
- }
- finally {
- jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
- }
- }
-}
Copied: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm1085/JBPM1085Test.java (from rev 5818, jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm1085/JBPM1085Test.java)
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm1085/JBPM1085Test.java (rev 0)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm1085/JBPM1085Test.java 2009-11-03 22:12:10 UTC (rev 5880)
@@ -0,0 +1,68 @@
+/*
+ * 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.jbpm1085;
+
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+
+public class JBPM1085Test extends AbstractDbTestCase {
+
+ public void testJoinPersistence() {
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+ + " <start-state>"
+ + " <transition to='f' />"
+ + " </start-state>"
+ + " <fork name='f'>"
+ + " <transition name='a' to='a' />"
+ + " <transition name='b' to='b' />"
+ + " </fork>"
+ + " <state name='a'>"
+ + " <transition to='j' />"
+ + " </state>"
+ + " <state name='b'>"
+ + " <transition to='j' />"
+ + " </state>"
+ + " <join name='j'>"
+ + " <transition to='end' />"
+ + " </join>"
+ + " <end-state name='end'/>"
+ + "</process-definition>");
+ graphSession.saveProcessDefinition(processDefinition);
+
+ try {
+ ProcessInstance processInstance = new ProcessInstance(processDefinition);
+ processInstance.signal();
+ processInstance.findToken("/a").signal();
+
+ processInstance = saveAndReload(processInstance);
+ processInstance.findToken("/b").signal();
+
+ assertEquals("end", processInstance.getRootToken().getNode().getName());
+ assertEquals("j", processInstance.findToken("/a").getNode().getName());
+ assertEquals("j", processInstance.findToken("/b").getNode().getName());
+ }
+ finally {
+ jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
+ }
+ }
+}
Modified: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2036/JBPM2036Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2036/JBPM2036Test.java 2009-11-03 22:11:03 UTC (rev 5879)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2036/JBPM2036Test.java 2009-11-03 22:12:10 UTC (rev 5880)
@@ -20,7 +20,6 @@
ProcessDefinition processDefinition = getProcessDefinition();
jbpmContext.deployProcessDefinition(processDefinition);
- newTransaction();
try {
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.signal();
Copied: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2603 (from rev 5818, jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2603)
Deleted: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2603/JBPM2603Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2603/JBPM2603Test.java 2009-10-27 15:57:27 UTC (rev 5818)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2603/JBPM2603Test.java 2009-11-03 22:12:10 UTC (rev 5880)
@@ -1,114 +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.jbpm2603;
-
-import java.util.Calendar;
-
-import org.jbpm.db.AbstractDbTestCase;
-import org.jbpm.graph.def.Action;
-import org.jbpm.graph.def.ActionHandler;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ExecutionContext;
-import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.instantiation.Delegation;
-import org.jbpm.job.Timer;
-
-/**
- * Restore automatic save of timer actions.
- *
- * @see <a href="https://jira.jboss.org/jira/browse/JBPM-2603">JBPM-2603</a>
- * @author Alejandro Guizar
- */
-public class JBPM2603Test extends AbstractDbTestCase {
-
- public void testStaticTimerAction() {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition"
- + " name='static timer action'>"
- + " <start-state><transition to='mid'/></start-state>"
- + " <state name='mid'>"
- + " <timer duedate='1 hour'>"
- + " <action name='example' class='org.example.Action'/>"
- + " </timer>"
- + " </state>"
- + "</process-definition>");
- jbpmContext.deployProcessDefinition(processDefinition);
-
- try {
- ProcessInstance processInstance = new ProcessInstance(processDefinition);
- processInstance.signal();
- jbpmContext.save(processInstance);
-
- Timer timer = (Timer) session.createCriteria(Timer.class).uniqueResult();
- assertEquals(processDefinition.getAction("example").getId(), timer.getAction().getId());
- }
- finally {
- graphSession.deleteProcessDefinition(processDefinition.getId());
- }
- }
-
- public void testDynamicTimerAction() {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition"
- + " name='dynamic timer action'>"
- + " <start-state><transition to='mid'/></start-state>"
- + " <state name='mid'>"
- + " <event type='node-enter'>"
- + " <action class='"
- + CreateDynamicTimer.class.getName()
- + "'/>"
- + " </event>"
- + " </state>"
- + "</process-definition>");
- jbpmContext.deployProcessDefinition(processDefinition);
-
- try {
- ProcessInstance processInstance = new ProcessInstance(processDefinition);
- processInstance.signal();
- jbpmContext.save(processInstance);
-
- Timer timer = (Timer) session.createCriteria(Timer.class).uniqueResult();
- Action action = timer.getAction();
- assertEquals("org.example.Action", action.getActionDelegation().getClassName());
-
- session.delete(action);
- }
- finally {
- graphSession.deleteProcessDefinition(processDefinition.getId());
- }
- }
-
- public static class CreateDynamicTimer implements ActionHandler {
- private static final long serialVersionUID = 1L;
-
- public void execute(ExecutionContext executionContext) throws Exception {
- Action action = new Action(new Delegation("org.example.Action"));
-
- Calendar oneHour = Calendar.getInstance();
- oneHour.add(Calendar.HOUR_OF_DAY, 1);
-
- Timer timer = new Timer(executionContext.getToken());
- timer.setDueDate(oneHour.getTime());
- timer.setAction(action);
-
- executionContext.getJbpmContext().getServices().getSchedulerService().createTimer(timer);
- }
- }
-}
Copied: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2603/JBPM2603Test.java (from rev 5818, jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2603/JBPM2603Test.java)
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2603/JBPM2603Test.java (rev 0)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2603/JBPM2603Test.java 2009-11-03 22:12:10 UTC (rev 5880)
@@ -0,0 +1,114 @@
+/*
+ * 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.jbpm2603;
+
+import java.util.Calendar;
+
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.graph.def.Action;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.instantiation.Delegation;
+import org.jbpm.job.Timer;
+
+/**
+ * Restore automatic save of timer actions.
+ *
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-2603">JBPM-2603</a>
+ * @author Alejandro Guizar
+ */
+public class JBPM2603Test extends AbstractDbTestCase {
+
+ public void testStaticTimerAction() {
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition"
+ + " name='static timer action'>"
+ + " <start-state><transition to='mid'/></start-state>"
+ + " <state name='mid'>"
+ + " <timer duedate='1 hour'>"
+ + " <action name='example' class='org.example.Action'/>"
+ + " </timer>"
+ + " </state>"
+ + "</process-definition>");
+ jbpmContext.deployProcessDefinition(processDefinition);
+
+ try {
+ ProcessInstance processInstance = new ProcessInstance(processDefinition);
+ processInstance.signal();
+ jbpmContext.save(processInstance);
+
+ Timer timer = (Timer) session.createCriteria(Timer.class).uniqueResult();
+ assertEquals(processDefinition.getAction("example").getId(), timer.getAction().getId());
+ }
+ finally {
+ graphSession.deleteProcessDefinition(processDefinition.getId());
+ }
+ }
+
+ public void testDynamicTimerAction() {
+ ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition"
+ + " name='dynamic timer action'>"
+ + " <start-state><transition to='mid'/></start-state>"
+ + " <state name='mid'>"
+ + " <event type='node-enter'>"
+ + " <action class='"
+ + CreateDynamicTimer.class.getName()
+ + "'/>"
+ + " </event>"
+ + " </state>"
+ + "</process-definition>");
+ jbpmContext.deployProcessDefinition(processDefinition);
+
+ try {
+ ProcessInstance processInstance = new ProcessInstance(processDefinition);
+ processInstance.signal();
+ jbpmContext.save(processInstance);
+
+ Timer timer = (Timer) session.createCriteria(Timer.class).uniqueResult();
+ Action action = timer.getAction();
+ assertEquals("org.example.Action", action.getActionDelegation().getClassName());
+
+ session.delete(action);
+ }
+ finally {
+ graphSession.deleteProcessDefinition(processDefinition.getId());
+ }
+ }
+
+ public static class CreateDynamicTimer implements ActionHandler {
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ExecutionContext executionContext) throws Exception {
+ Action action = new Action(new Delegation("org.example.Action"));
+
+ Calendar oneHour = Calendar.getInstance();
+ oneHour.add(Calendar.HOUR_OF_DAY, 1);
+
+ Timer timer = new Timer(executionContext.getToken());
+ timer.setDueDate(oneHour.getTime());
+ timer.setAction(action);
+
+ executionContext.getJbpmContext().getServices().getSchedulerService().createTimer(timer);
+ }
+ }
+}
Deleted: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jpdl/exe/JoinExecutionDbTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jpdl/exe/JoinExecutionDbTest.java 2009-11-03 22:11:03 UTC (rev 5879)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jpdl/exe/JoinExecutionDbTest.java 2009-11-03 22:12:10 UTC (rev 5880)
@@ -1,71 +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.jpdl.exe;
-
-import org.jbpm.db.AbstractDbTestCase;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ProcessInstance;
-
-public class JoinExecutionDbTest extends AbstractDbTestCase {
-
- public void testJoinPersistence() {
- ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
- "<process-definition>" +
- " <start-state>" +
- " <transition to='f' />" +
- " </start-state>" +
- " <fork name='f'>" +
- " <transition name='a' to='a' />" +
- " <transition name='b' to='b' />" +
- " </fork>" +
- " <state name='a'>" +
- " <transition to='j' />" +
- " </state>" +
- " <state name='b'>" +
- " <transition to='j' />" +
- " </state>" +
- " <join name='j'>" +
- " <transition to='end' />" +
- " </join>" +
- " <end-state name='end'/>" +
- "</process-definition>"
- );
- graphSession.saveProcessDefinition(processDefinition);
- try
- {
- ProcessInstance processInstance = new ProcessInstance(processDefinition);
- processInstance.signal();
- processInstance.findToken("/a").signal();
-
- processInstance = saveAndReload(processInstance);
- processInstance.findToken("/b").signal();
-
- assertEquals("end", processInstance.getRootToken().getNode().getName());
- assertEquals("j", processInstance.findToken("/a").getNode().getName());
- assertEquals("j", processInstance.findToken("/b").getNode().getName());
- }
- finally
- {
- jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
- }
- }
-}
Modified: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/taskmgmt/exe/TaskTimerExecutionDbTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/taskmgmt/exe/TaskTimerExecutionDbTest.java 2009-11-03 22:11:03 UTC (rev 5879)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/taskmgmt/exe/TaskTimerExecutionDbTest.java 2009-11-03 22:12:10 UTC (rev 5880)
@@ -65,7 +65,7 @@
processInstance = saveAndReload(processInstance);
- Timer timer = getTimer();
+ Timer timer = (Timer) session.createCriteria(Timer.class).uniqueResult();
assertEquals("ceiling-timer", timer.getName());
}
finally {
@@ -200,7 +200,7 @@
newTransaction();
// fetch the original duedate
- Timer timer = getTimer();
+ Timer timer = (Timer) session.createCriteria(Timer.class).uniqueResult();
assertNotNull(timer);
long originalDueDate = timer.getDueDate().getTime();
@@ -210,7 +210,7 @@
assertEquals(new Integer(1), processInstance.getContextInstance().getVariable("count"));
// check if the timer has be re-scheduled because of the repeat.
- timer = getTimer();
+ timer = (Timer) session.createCriteria(Timer.class).uniqueResult();
assertNotNull(timer);
// check that the timer was rescheduled with a duedate 60 seconds after the original duedate.
assertEquals(originalDueDate + 60000, timer.getDueDate().getTime());
@@ -253,7 +253,7 @@
baseDateTest.clear(Calendar.MILLISECOND);
baseDateTest.add(Calendar.DAY_OF_YEAR, 2);
- Timer timer = getTimer();
+ Timer timer = (Timer) session.createCriteria(Timer.class).uniqueResult();
assertEquals("ceiling-timer", timer.getName());
assertNotNull(timer.getDueDate());
@@ -263,8 +263,4 @@
jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
}
}
-
- private Timer getTimer() {
- return (Timer) session.createCriteria(Timer.class).setMaxResults(1).uniqueResult();
- }
}
14 years, 6 months
JBoss JBPM SVN: r5879 - in projects/bbq/projects: bbq-core/java/org/bbq/commands and 3 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-11-03 17:11:03 -0500 (Tue, 03 Nov 2009)
New Revision: 5879
Modified:
projects/bbq/projects/bbq-core/java/org/bbq/Bbq.java
projects/bbq/projects/bbq-core/java/org/bbq/commands/ClassPath.java
projects/bbq/projects/bbq-core/java/org/bbq/commands/Exec.java
projects/bbq/projects/bbq-core/java/org/bbq/commands/Javac.java
projects/bbq/projects/bbq-core/java/org/bbq/commands/Junit.java
projects/bbq/projects/bbq-core/java/org/bbq/system/FileList.java
projects/bbq/projects/bbq-core/java/org/bbq/system/FileScan.java
projects/bbq/projects/bbq-test-project/build/Build.java
projects/bbq/projects/bbq-test-project/test/com/myproject/AddTest.java
Log:
added junit
Modified: projects/bbq/projects/bbq-core/java/org/bbq/Bbq.java
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/Bbq.java 2009-11-03 09:50:18 UTC (rev 5878)
+++ projects/bbq/projects/bbq-core/java/org/bbq/Bbq.java 2009-11-03 22:11:03 UTC (rev 5879)
@@ -23,13 +23,13 @@
import java.io.File;
import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Properties;
import org.bbq.commands.Javac;
import org.bbq.system.Console;
+import org.bbq.system.Os;
import org.bbq.system.Path;
@@ -46,13 +46,19 @@
properties.setProperty("javac.dest.dir", "gen/classes");
properties.setProperty("build.src.dir", "build");
properties.setProperty("build.classes.dir", "gen/build-classes");
- properties.setProperty("local.repo.dir", System.getProperty("user.home")+"/.bbq");
+ String userBbqDir = System.getProperty("user.home")+"/.bbq";
+ if (Os.isWindows()) {
+ userBbqDir = userBbqDir.replace('\\', '/');
+ }
+ properties.setProperty("local.repo.dir", userBbqDir);
+ String bbqClassPath = Path.absolute(System.getProperty("java.class.path"));
+ properties.setProperty("bbq.classpath", bbqClassPath);
+
// optionally bbq.properties files could be read
// from ${user.home}/.bbq/bbq.properties and ./bbq.properties
String buildSrcDir = properties.getProperty("build.src.dir");
String buildClassesDir = properties.getProperty("build.classes.dir");
- String buildClassPath = Path.absolute(System.getProperty("java.class.path"));
File buildSrcFile = new File(buildSrcDir);
if (!buildSrcFile.exists()) {
@@ -67,18 +73,19 @@
new Javac()
.srcDir(buildSrcDir)
.destDir(buildClassesDir)
- .classPath(buildClassPath)
+ .classPath(bbqClassPath)
.execute();
try {
URL[] urls = {new File(buildClassesDir).toURL()};
ClassLoader classLoader = new URLClassLoader(urls , Bbq.class.getClassLoader());
Class<?> buildClass = Class.forName("Build", true, classLoader);
+ Object buildObject = buildClass.newInstance();
// if the user specified build operations as arguments
if (args!=null && args.length>0) {
for (String operation: args) {
Method method = buildClass.getDeclaredMethod(operation);
- Object result = method.invoke(null, (Object[])null);
+ Object result = method.invoke(buildObject, (Object[])null);
if (result!=null) {
Console.log("result of "+operation+": "+result);
}
@@ -86,9 +93,7 @@
} else { // means user didn't pass build operations
Console.log("available build operations:");
for (Method method: buildClass.getDeclaredMethods()) {
- if ( Modifier.isStatic(method.getModifiers())
- && (method.getParameterTypes().length==0)
- ) {
+ if (method.getParameterTypes().length==0) {
Console.log(" "+method.getName());
}
}
@@ -97,4 +102,8 @@
e.printStackTrace();
}
}
+
+ public static String getProperty(String key) {
+ return properties.getProperty(key);
+ }
}
Modified: projects/bbq/projects/bbq-core/java/org/bbq/commands/ClassPath.java
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/commands/ClassPath.java 2009-11-03 09:50:18 UTC (rev 5878)
+++ projects/bbq/projects/bbq-core/java/org/bbq/commands/ClassPath.java 2009-11-03 22:11:03 UTC (rev 5879)
@@ -55,6 +55,7 @@
public ClassPath add(ClassPath other) {
elements.addAll(other.elements);
+ artifacts.addAll(other.artifacts);
return this;
}
@@ -68,6 +69,10 @@
}
return toString(";");
}
+
+ public String toString() {
+ return toString(";");
+ }
public String toString(String separator) {
StringBuilder stringBuilder = new StringBuilder();
Modified: projects/bbq/projects/bbq-core/java/org/bbq/commands/Exec.java
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/commands/Exec.java 2009-11-03 09:50:18 UTC (rev 5878)
+++ projects/bbq/projects/bbq-core/java/org/bbq/commands/Exec.java 2009-11-03 22:11:03 UTC (rev 5879)
@@ -67,7 +67,7 @@
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
for (String line = bufferedReader.readLine(); line!=null; line = bufferedReader.readLine()) {
- Console.log(" |"+line);
+ Console.log(" [output] "+line);
}
} catch (Exception e) {
Modified: projects/bbq/projects/bbq-core/java/org/bbq/commands/Javac.java
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/commands/Javac.java 2009-11-03 09:50:18 UTC (rev 5878)
+++ projects/bbq/projects/bbq-core/java/org/bbq/commands/Javac.java 2009-11-03 22:11:03 UTC (rev 5879)
@@ -35,14 +35,15 @@
*/
public class Javac {
- FileList sourceFiles = new FileList();
+ FileList sourceFiles = null;
boolean verbose;
String destDir = Bbq.properties.getProperty("javac.dest.dir");
ClassPath classPath = new ClassPath();
public Javac srcDir(String srcDir) {
- FileList sourceFiles = new FileScan(srcDir)
- .filterEnd(".java")
+ FileList sourceFiles = new FileScan()
+ .startsWith(srcDir)
+ .endsWith(".java")
.execute();
if (this.sourceFiles==null) {
@@ -98,9 +99,9 @@
String description = "javac -d "+destDir;
if (!classPath.isEmpty()) {
cmd.add("-classpath");
- cmd.add(classPath.toString());
+ cmd.add(classPath.resolve());
for (String classPathElement: classPath.elements) {
- description += Os.LINE_SEPARATOR+" classpath-element: "+classPathElement;
+ description += Os.LINE_SEPARATOR+" [classpath] "+classPathElement;
}
}
if (verbose) {
@@ -108,7 +109,7 @@
}
for (String fileName: sourceFiles.list()) {
cmd.add(fileName);
- description += Os.LINE_SEPARATOR+" source-file: "+fileName;
+ description += Os.LINE_SEPARATOR+" [source] "+fileName;
}
// execute the compile command
Modified: projects/bbq/projects/bbq-core/java/org/bbq/commands/Junit.java
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/commands/Junit.java 2009-11-03 09:50:18 UTC (rev 5878)
+++ projects/bbq/projects/bbq-core/java/org/bbq/commands/Junit.java 2009-11-03 22:11:03 UTC (rev 5879)
@@ -21,29 +21,29 @@
*/
package org.bbq.commands;
-import java.util.ArrayList;
-import java.util.List;
-
+import org.bbq.Bbq;
+import org.bbq.system.Console;
import org.bbq.system.FileList;
import org.bbq.system.FileScan;
+import org.junit.runner.Description;
import org.junit.runner.JUnitCore;
-import org.junit.runner.Request;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunListener;
-import junit.textui.TestRunner;
-
-
/**
* @author Tom Baeyens
*/
public class Junit {
FileList sourceTestFiles = null;
- ClassPath classPath = new ClassPath();
+ ClassPath classPath = new ClassPath()
+ .add(Bbq.getProperty("bbq.classpath"));
String name = "bbq test run";
public Junit tests(String srcDir, String suffix) {
FileList sourceTestFiles = new FileScan(srcDir)
- .filterEnd(suffix)
+ .endsWith(suffix)
.execute();
if (this.sourceTestFiles==null) {
@@ -61,24 +61,46 @@
}
public void execute() {
- List<String> cmd = new ArrayList<String>();
+ if (sourceTestFiles==null) {
+ tests("test", "Test.java");
+ }
+ String[] args = new String[sourceTestFiles.size()];
+ for (int i=0; i<sourceTestFiles.size(); i++) {
+ String sourceTestResource = sourceTestFiles.getFilePaths().get(i);
+ String testClassName = sourceTestResource
+ .substring(0, sourceTestResource.length()-5)
+ .replace('/', '.');
+ args[i] = testClassName;
+ }
new Java()
- TODO...
+ .classPath(classPath.resolve())
+ .className(Run.class.getName())
+ .args(args)
.execute();
}
public static class Run {
public static void main(String[] args) {
JUnitCore junitCore = new JUnitCore();
- for (String srcTestFile: sourceTestFiles.list()) {
- String testClassName = srcTestFile
- .substring(0, srcTestFile.length()-5)
- .replace('/', '.');
-
- Class< ? > testClass = null;
- junitCore.run(testClass);
+ junitCore.addListener(new JunitRunListener());
+ try {
+ for (String testClassName: args) {
+ Class<?> testClass = Class.forName(testClassName);
+ junitCore.run(testClass);
+ }
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
}
}
}
+
+ public static class JunitRunListener extends RunListener {
+ public void testStarted(Description description) throws Exception {
+ Console.log("starting test: "+description.toString());
+ }
+ public void testFailure(Failure failure) throws Exception {
+ Console.log("TEST FAILED: "+failure.toString());
+ }
+ }
}
Modified: projects/bbq/projects/bbq-core/java/org/bbq/system/FileList.java
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/system/FileList.java 2009-11-03 09:50:18 UTC (rev 5878)
+++ projects/bbq/projects/bbq-core/java/org/bbq/system/FileList.java 2009-11-03 22:11:03 UTC (rev 5879)
@@ -43,4 +43,12 @@
public void add(FileList other) {
filePaths.addAll(other.filePaths);
}
+
+ public int size() {
+ return filePaths.size();
+ }
+
+ public List<String> getFilePaths() {
+ return filePaths;
+ }
}
Modified: projects/bbq/projects/bbq-core/java/org/bbq/system/FileScan.java
===================================================================
--- projects/bbq/projects/bbq-core/java/org/bbq/system/FileScan.java 2009-11-03 09:50:18 UTC (rev 5878)
+++ projects/bbq/projects/bbq-core/java/org/bbq/system/FileScan.java 2009-11-03 22:11:03 UTC (rev 5879)
@@ -31,24 +31,42 @@
*/
public class FileScan {
- String rootDir;
+ String baseDir = null;
List<ScanFilter> scanFilters = new ArrayList<ScanFilter>();
+ public FileScan() {
+ }
+
public FileScan(String dirPath) {
- rootDir = dirPath;
+ baseDir = dirPath;
}
public FileList execute() {
FileList fileList = new FileList();
- scan(rootDir, fileList);
+ scan(null, fileList);
return fileList;
}
private void scan(String dir, FileList fileList) {
- File dirFile = new File(dir);
+ String dirPath = null;
+ if (baseDir!=null) {
+ if (dir!=null) {
+ dirPath = baseDir+"/"+dir;
+ } else {
+ dirPath = baseDir;
+ }
+ } else {
+ if (dir!=null) {
+ dirPath = dir;
+ } else {
+ dirPath = ".";
+ }
+ }
+
+ File dirFile = new File(dirPath);
if (dirFile.exists()) {
for (File child: dirFile.listFiles()) {
- String childPath = ("".equals(dir) ? child.getName() : dir+"/"+child.getName());
+ String childPath = (dir==null ? child.getName() : dir+"/"+child.getName());
if (child.isDirectory()) {
scan(childPath, fileList);
} else if (passesFilters(childPath, child)) {
@@ -71,9 +89,9 @@
boolean passes(String relativePath, File file);
}
- private class EndScanFilter implements ScanFilter {
+ private class EndsWithFilter implements ScanFilter {
String text;
- public EndScanFilter(String text) {
+ public EndsWithFilter(String text) {
this.text = text;
}
public boolean passes(String relativePath, File file) {
@@ -81,8 +99,22 @@
}
}
- public FileScan filterEnd(String text) {
- scanFilters.add(new EndScanFilter(text));
+ private class StartsWithFilter implements ScanFilter {
+ String text;
+ public StartsWithFilter(String text) {
+ this.text = text;
+ }
+ public boolean passes(String relativePath, File file) {
+ return relativePath.startsWith(text);
+ }
+ }
+
+ public FileScan endsWith(String text) {
+ scanFilters.add(new EndsWithFilter(text));
return this;
}
+ public FileScan startsWith(String text) {
+ scanFilters.add(new StartsWithFilter(text));
+ return this;
+ }
}
Modified: projects/bbq/projects/bbq-test-project/build/Build.java
===================================================================
--- projects/bbq/projects/bbq-test-project/build/Build.java 2009-11-03 09:50:18 UTC (rev 5878)
+++ projects/bbq/projects/bbq-test-project/build/Build.java 2009-11-03 22:11:03 UTC (rev 5879)
@@ -37,14 +37,17 @@
.add(jbossRepository, "org/hibernate/hibernate-core/3.3.2.GA/hibernate-core-3.3.2.GA.jar");
ClassPath testCompileClassPath = new ClassPath()
- .add(getCompileClassPath())
+ .add("gen/classes")
+ .add(compileClassPath)
.add(jbossRepository, "junit/junit/4.4/junit-4.4.jar");
- ClassPath testRuntimeClassPath = testCompileClassPath;
+ ClassPath testRuntimeClassPath = new ClassPath()
+ .add("gen/test-classes")
+ .add(testCompileClassPath);
public void compile() {
new Javac()
- .classPath(getCompileClassPath())
+ .classPath(compileClassPath)
.execute();
}
@@ -53,7 +56,7 @@
new Javac()
.srcDir("test")
.destDir("gen/test-classes")
- .classPath(getTestCompileClassPath())
+ .classPath(testCompileClassPath)
.execute();
}
@@ -61,29 +64,10 @@
compileTest();
new Junit()
+ .classPath(testRuntimeClassPath)
.execute();
}
public void publish() {
}
-
-
- public ClassPath getCompileClassPath() {
- if (compileClassPath==null) {
-
- }
- return compileClassPath;
- }
-
-
- public ClassPath getTestCompileClassPath() {
- if (testCompileClassPath==null) {
- }
- return testCompileClassPath;
- }
-
-
- public ClassPath getTestRuntimeClassPath() {
- return testRuntimeClassPath;
- }
}
Modified: projects/bbq/projects/bbq-test-project/test/com/myproject/AddTest.java
===================================================================
--- projects/bbq/projects/bbq-test-project/test/com/myproject/AddTest.java 2009-11-03 09:50:18 UTC (rev 5878)
+++ projects/bbq/projects/bbq-test-project/test/com/myproject/AddTest.java 2009-11-03 22:11:03 UTC (rev 5879)
@@ -21,14 +21,16 @@
*/
package com.myproject;
+import junit.framework.TestCase;
+
/**
* @author Tom Baeyens
*/
-public class AddTest {
+public class AddTest extends TestCase {
public void testAddition() {
Add add = new Add();
- assertEquals(5, add.add(2, 3));
+ assertEquals(6, add.add(2, 3));
}
}
14 years, 6 months