提交 d571cbc7 编写于 作者: T tombaeyens

uploading activiti trunk

上级 60b23ed7
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>activiti</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<project name="activiti.distro" default="distro">
<property file="${user.home}/.activiti/build.properties" />
<property name="mvn.executable" value="mvn" />
<property name="activiti.version" value="5.0.alpha3-SNAPSHOT" />
<property name="target.distro.root" value="target/activiti-${activiti.version}" />
<property name="activiti.website" value="../../activiti-website" />
<target name="clean">
<delete dir="target" />
</target>
<target name="distro" depends="build.modules, get.libs, build.userguide, build.javadocs">
<mkdir dir="${target.distro.root}" />
<copy todir="${target.distro.root}">
<fileset dir="src" />
</copy>
<copy todir="${target.distro.root}/docs/examples/src">
<fileset dir="../modules/activiti-engine-examples/src/test/java" />
<fileset dir="../modules/activiti-engine-examples/src/test/resources" />
</copy>
<copy todir="${target.distro.root}/docs/xsd">
<fileset dir="../modules/activiti-engine/src/main/resources/org/activiti/impl/bpmn/parser">
<include name="*.xsd" />
</fileset>
</copy>
<mkdir dir="${target.distro.root}/lib" />
<copy todir="${target.distro.root}/lib">
<fileset dir="../modules/activiti-engine/target">
<include name="activiti-engine-*.jar"/>
</fileset>
</copy>
<mkdir dir="${target.distro.root}/setup/files/webapps/activiti-probe.war" />
<unzip dest="${target.distro.root}/setup/files/webapps/activiti-probe.war"
src="../modules/activiti-probe/target/activiti-probe-${activiti.version}.war"/>
<mkdir dir="${target.distro.root}/setup/files/webapps/libs" />
<move todir="${target.distro.root}/setup/files/webapps/libs/WEB-INF/lib">
<fileset dir="${target.distro.root}/setup/files/webapps/activiti-probe.war/WEB-INF/lib" />
</move>
<mkdir dir="${target.distro.root}/setup/files/webapps/activiti-explorer.war" />
<unzip dest="${target.distro.root}/setup/files/webapps/activiti-explorer.war"
src="../modules/activiti-explorer/target/activiti-explorer-${activiti.version}.war"/>
<delete>
<fileset dir="${target.distro.root}/setup/files/webapps/activiti-explorer.war/WEB-INF/lib" />
</delete>
<mkdir dir="${target.distro.root}/setup/files/webapps/activiti-rest.war" />
<unzip dest="${target.distro.root}/setup/files/webapps/activiti-rest.war"
src="../modules/activiti-rest/target/activiti-rest-${activiti.version}.war"/>
<delete>
<fileset dir="${target.distro.root}/setup/files/webapps/activiti-rest.war/WEB-INF/lib" />
</delete>
<mkdir dir="${target.distro.root}/setup/files/webapps/activiti-engine-init.war" />
<unzip dest="${target.distro.root}/setup/files/webapps/activiti-engine-init.war"
src="../modules/activiti-engine-init/target/activiti-engine-init-${activiti.version}.war"/>
<zip destfile="${target.distro.root}.zip">
<fileset dir="${target.distro.root}" />
</zip>
</target>
<target name="get.libs">
<mkdir dir="${target.distro.root}/lib" />
<exec executable="${mvn.executable}" dir="../modules/activiti-engine">
<arg line="-DoutputDirectory=../../distro/${target.distro.root}/lib dependency:copy-dependencies" />
</exec>
</target>
<target name="build.modules">
<exec executable="${mvn.executable}" dir="..">
<arg line="-Pdistro clean install" />
</exec>
</target>
<target name="build.userguide" unless="nodocs">
<ant antfile="../userguide/build.xml" inheritall="false" />
<mkdir dir="${target.distro.root}/docs/userguide" />
<copy todir="${target.distro.root}/docs/userguide">
<fileset dir="../userguide/target/html/en" />
</copy>
</target>
<target name="build.javadocs" unless="nodocs">
<exec executable="${mvn.executable}" dir="../modules/activiti-engine">
<arg line="javadoc:javadoc" />
</exec>
<mkdir dir="${target.distro.root}/docs/javadocs" />
<copy todir="${target.distro.root}/docs/javadocs">
<fileset dir="../modules/activiti-engine/target/site/apidocs" />
</copy>
</target>
<target name="publish.docs" depends="build.javadocs, build.userguide">
<mkdir dir="${activiti.website}/javadocs" />
<copy todir="${activiti.website}/javadocs" overwrite="true">
<fileset dir="../modules/activiti-engine/target/site/apidocs" />
</copy>
<mkdir dir="${activiti.website}/userguide" />
<copy todir="${activiti.website}/userguide" overwrite="true">
<fileset dir="../userguide/target/html/en" />
</copy>
</target>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Activiti Libraries"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>examples</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Activiti Readme</title>
</head>
<body>
<img src="docs/userguide/images/activiti_readme.png"/>
<h1>License</h1>
<p><a href="license.txt">Apache license</a></p>
<h1>Documentation</h1>
<ul>
<li><a href="docs/userguide/index.html#10minutetutorial">10 Minute Tutorial</a></li>
<li><a href="docs/userguide/index.html">The User Guide</a></li>
<li><a href="docs/userguide/index.html#examples">Examples</a></li>
<li><a href="docs/javadocs/index.html">Javadocs</a></li>
</ul>
<h1>Stability guarantees</h1>
<p>Until a first GA version (see <a href="http://activiti.org/roadmap.html">roadmap</a>), there
can be absolutely no assumptions about stability.
</p>
<h1>Activiti Release Notes</h1>
<h3>5.0.alpha2</h3>
<h4>Improvements</h4>
<ul>
<li>Task forms in Activiti Explorer</li>
<li>Database table content viewer in Activiti Probe</li>
<li>Exclusive gateway</li>
<li>Unified Expression Language support</li>
<li>Reduced download size</li>
</ul>
<h4>Known limitations</h4>
<ul>
<li>No history in Activiti Engine</li>
<li>Only single DB: H2</li>
<li>Only one tx demarcation tech: standalone JDBC</li>
<li>No process concurrency</li>
</ul>
<h3>5.0.alpha1</h3>
<h4>Known limitations</h4>
<ul>
<li>No history in Activiti Engine</li>
<li>Only single DB: H2</li>
<li>Only one tx demarcation tech: standalone JDBC</li>
<li>No task forms</li>
<li>No process concurrency</li>
<li>No Activiti Cycle</li>
</ul>
</body>
</html>
jdbc.driver=org.h2.Driver
jdbc.url=jdbc:h2:tcp://localhost/activiti
jdbc.username=sa
jdbc.password=
# The db property should refer to the type of database that
# you want to use. Currently only h2 is supported.
db=h2
# The tx property refers to the transaction environment
# you want to use. Choose from {standalone}
tx=standalone
# Specify the version of Tomcat that you want to use.
# We only tested with the given Tomcat version but in
# theory any tomcat 6.0.x version should do fine.
tomcat.version=6.0.26
# If you have tomcat already downloaded, point the
# downloads.dir property to that directly. If tomcat is
# not found in the downloads.dir, it will be automatically
# downloaded there.
# The downloads directory should be outside of /target/
# to avoid re-downloading after a clean
downloads.dir=../../../downloads
<?xml version="1.0" encoding="UTF-8"?>
<project name="activiti.setup" default="demo.setup">
<property file="${user.home}/.activiti/build.properties" />
<property file="build.properties" />
<property file="build.${db}.properties" />
<property name="activiti.home" value=".." />
<property name="activiti.version" value="5.0.alpha3-SNAPSHOT" />
<echo message="Activiti home = ${activiti.home}" />
<echo message="Activiti version = ${activiti.version}" />
<property name="apache.mirror.url" value="http://mirrors.enquira.co.uk/apache/" />
<property name="tomcat.home" value="${activiti.home}/apps/apache-tomcat-${tomcat.version}" />
<property name="tomcat.filename" value="apache-tomcat-${tomcat.version}.zip" />
<property name="tomcat.download.url" value="${apache.mirror.url}tomcat/tomcat-6/v${tomcat.version}/bin/${tomcat.filename}" />
<property name="activiti.modeler.download.url" value="http://activiti.org/downloads/activiti-modeler-${activiti.version}.war" />
<available property="is.activiti.modeler.available" file="${activiti.home}/setup/build/activiti-modeler-${activiti.version}.war" />
<target name="demo.setup" depends="h2.install, h2.start,
db.create,
tomcat.install,
deploy.activiti.engine.into.tomcat,
db.demo.data,
deploy.activiti.rest.into.tomcat,
deploy.activiti.explorer.and.probe.into.tomcat,
tomcat.start,
deploy.activiti.modeler.into.tomcat "/>
<target name="demo.teardown" depends="tomcat.stop, db.drop, h2.stop" />
<target name="h2.install">
<mkdir dir="${activiti.home}/apps/h2" />
<copy todir="${activiti.home}/apps/h2">
<fileset dir="${activiti.home}/lib">
<include name="h2*.jar"/>
</fileset>
<fileset dir="files/h2" />
</copy>
<chmod perm="a+x">
<fileset dir="${activiti.home}/apps/h2">
<include name="*.sh"/>
</fileset>
</chmod>
</target>
<target name="h2.start" depends="internal.taskdef.launch">
<launch dir="${activiti.home}/apps/h2"
script="h2.start"
msg="TCP server running on"/>
</target>
<target name="h2.stop" depends="internal.taskdef.launch">
<launch dir="${activiti.home}/apps/h2"
script="h2.stop"/>
</target>
<target name="db.create" depends="internal.classpath.libs">
<sql driver="${jdbc.driver}"
password="${jdbc.password}"
url="${jdbc.url}"
userid="${jdbc.username}"
classpathref="classpath.libs">
<javaresource name="org/activiti/db/create/activiti.${db}.create.sql"
classpathref="classpath.libs" />
</sql>
</target>
<target name="db.drop" depends="internal.classpath.libs">
<sql driver="${jdbc.driver}"
password="${jdbc.password}"
url="${jdbc.url}"
classpathref="classpath.libs"
userid="${jdbc.username}">
<transaction>
<javaresource name="org/activiti/db/drop/activiti.${db}.drop.sql"
classpathref="classpath.libs"/>
</transaction>
</sql>
</target>
<target name="tomcat.install">
<mkdir dir="${activiti.home}/apps" />
<property name="tomcat.distro" value="${downloads.dir}/${tomcat.filename}" />
<available property="is.tomcat.available" file="${tomcat.distro}" />
<antcall target="internal.download.tomcat" />
<unzip src="${tomcat.distro}" dest="${activiti.home}/apps"/>
<available file="${user.home}/.activiti/tomcat-users.xml" property="tomcat.users.available" />
<antcall target="tomcat.copy.users" />
<antcall target="tomcat.enable.debug" />
<chmod perm="a+x" os="Linux, Mac OS X">
<fileset dir="${tomcat.home}/bin">
<include name="*.sh" />
</fileset>
</chmod>
</target>
<target name="tomcat.copy.users" if="tomcat.users.available">
<copy file="${user.home}/.activiti/tomcat-users.xml"
todir="${tomcat.home}/conf"
overwrite="true"/>
</target>
<target name="tomcat.enable.debug" if="tomcat.enable.debug">
<echo>Enabling tomcat remote debugging ... </echo>
<replace file="${tomcat.home}/bin/startup.sh">
<replacetoken><![CDATA[
# Licensed to the Apache Software Foundation (ASF) under one or more]]></replacetoken>
<replacevalue><![CDATA[
JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787"
# Licensed to the Apache Software Foundation (ASF) under one or more]]></replacevalue>
</replace>
</target>
<target name="tomcat.start" depends="internal.taskdef.launch">
<launch dir="${activiti.home}/apps/apache-tomcat-${tomcat.version}/bin"
script="startup"
msg="Using CLASSPATH:" />
</target>
<target name="tomcat.stop" depends="internal.taskdef.launch">
<launch dir="${activiti.home}/apps/apache-tomcat-${tomcat.version}/bin"
script="shutdown"
msg="Using CLASSPATH:"/>
</target>
<target name="cfg.create">
<mkdir dir="${activiti.home}/setup/build/activiti-cfg" />
<copy todir="${activiti.home}/setup/build/activiti-cfg" overwrite="true">
<filterset filtersfile="build.${db}.properties" />
<fileset dir="files/cfg.activiti/${tx}" />
</copy>
<jar destfile="${activiti.home}/setup/build/activiti-cfg.jar">
<fileset dir="${activiti.home}/setup/build/activiti-cfg" />
</jar>
</target>
<target name="deploy.activiti.engine.into.tomcat" depends="cfg.create">
<copy todir="${tomcat.home}/lib">
<fileset dir="${activiti.home}/lib">
<include name="activiti-engine-${activiti.version}.jar"/>
<include name="mybatis-*.jar"/>
<include name="h2-*.jar"/>
<include name="freemarker-*.jar" />
<include name="juel*.jar" />
</fileset>
<fileset dir="build">
<include name="activiti-cfg.jar"/>
</fileset>
</copy>
<!-- Need to remove el-api.jar since it has an older verson of javax.el.* than JUEL-->
<delete file="${tomcat.home}/lib/el-api.jar" />
</target>
<target name="db.demo.data" depends="internal.classpath.libs">
<sql driver="${jdbc.driver}"
password="${jdbc.password}"
url="${jdbc.url}"
userid="${jdbc.username}"
classpathref="classpath.libs"
src="files/demo/${db}.data.sql"/>
<zip destfile="${activiti.home}/setup/build/activiti-examples.bar">
<fileset dir="${activiti.home}/docs/examples/src">
<include name="org/activiti/examples/bpmn/taskassignee/TaskAssigneeTest.testTaskAssignee.bpmn20.xml"/>
<include name="org/activiti/examples/bpmn/taskcandidate/TaskCandidateTest.testMixedCandidateUserAndGroup.bpmn20.xml"/>
<include name="org/activiti/examples/bpmn/taskcandidate/TaskCandidateTest.testMultipleCandidateGroups.bpmn20.xml"/>
<include name="org/activiti/examples/bpmn/taskcandidate/TaskCandidateTest.testMultipleCandidateUsers.bpmn20.xml"/>
<include name="org/activiti/examples/bpmn/taskcandidate/TaskCandidateTest.testSingleCandidateGroup.bpmn20.xml"/>
<include name="org/activiti/examples/bpmn/task/FinancialReportProcess.bpmn20.xml"/>
<include name="org/activiti/examples/taskforms/VacationRequest.bpmn20.xml"/>
<include name="org/activiti/examples/taskforms/request.form"/>
<include name="org/activiti/examples/taskforms/approve.form"/>
<include name="org/activiti/examples/taskforms/adjustRequest.form"/>
</fileset>
</zip>
<taskdef name="deploy-bar" classname="org.activiti.impl.ant.DeployBarTask">
<classpath>
<pathelement path="files/demo"/>
<fileset dir="build">
<include name="activiti-cfg.jar"/>
</fileset>
<fileset dir="${activiti.home}/lib">
<include name="activiti-engine-${activiti.version}.jar"/>
<include name="mybatis-*.jar"/>
<include name="h2-*.jar"/>
<include name="freemarker-*.jar" />
<include name="juel*.jar" />
</fileset>
</classpath>
</taskdef>
<deploy-bar file="${activiti.home}/setup/build/activiti-examples.bar" />
</target>
<target name="deploy.activiti.rest.into.tomcat" depends="build.webapp.activiti.engine.init, build.webapp.activiti.rest">
<mkdir dir="${tomcat.home}/webapps/activiti-engine-init" />
<unzip dest="${tomcat.home}/webapps/activiti-engine-init" src="${activiti.home}/setup/build/activiti-engine-init.war" />
<mkdir dir="${tomcat.home}/webapps/activiti-rest" />
<unzip dest="${tomcat.home}/webapps/activiti-rest" src="${activiti.home}/setup/build/activiti-rest.war" />
</target>
<target name="build.webapp.activiti.engine.init">
<zip destfile="${activiti.home}/setup/build/activiti-engine-init.war">
<fileset dir="${activiti.home}/setup/files/webapps/activiti-engine-init.war"/>
</zip>
</target>
<target name="build.webapp.activiti.rest">
<zip destfile="${activiti.home}/setup/build/activiti-rest.war">
<fileset dir="${activiti.home}/setup/files/webapps/activiti-rest.war"/>
<fileset dir="${activiti.home}/setup/files/webapps/libs" />
</zip>
</target>
<target name="build.webapp.activiti.probe">
<zip destfile="${activiti.home}/setup/build/activiti-probe.war">
<fileset dir="${activiti.home}/setup/files/webapps/activiti-probe.war"/>
<fileset dir="${activiti.home}/setup/files/webapps/libs" />
</zip>
</target>
<target name="build.webapp.activiti.explorer">
<zip destfile="${activiti.home}/setup/build/activiti-explorer.war">
<fileset dir="${activiti.home}/setup/files/webapps/activiti-explorer.war"/>
<fileset dir="${activiti.home}/setup/files/webapps/libs" />
</zip>
</target>
<target name="deploy.activiti.explorer.and.probe.into.tomcat" depends="build.webapp.activiti.explorer, build.webapp.activiti.probe">
<mkdir dir="${tomcat.home}/webapps/activiti-explorer" />
<unzip dest="${tomcat.home}/webapps/activiti-explorer" src="${activiti.home}/setup/build/activiti-explorer.war" />
<mkdir dir="${tomcat.home}/webapps/activiti-probe" />
<unzip dest="${tomcat.home}/webapps/activiti-probe" src="${activiti.home}/setup/build/activiti-probe.war" />
</target>
<target name="deploy.activiti.modeler.into.tomcat" unless="skip.deploy.activiti.modeler">
<antcall target="internal.download.activiti.modeler" /> <!-- Can't use depends for this, due to http://ant.apache.org/faq.html#stop-dependency-->
<mkdir dir="${activiti.home}/apps/activiti-model-repository"/>
<copy file="${activiti.home}/setup/build/activiti-modeler-${activiti.version}.war"
tofile="${tomcat.home}/webapps/activiti-modeler.war"/>
</target>
<target name="internal.download.activiti.modeler" unless="is.activiti.modeler.available">
<echo message="This could take a while. Set the 'skip.deploy.activiti.modeler' property in user.home/.activiti/build.properties to skip this step" />
<mkdir dir="${activiti.home}/setup/build"/>
<get src="${activiti.modeler.download.url}" dest="${activiti.home}/setup/build/activiti-modeler-${activiti.version}.war"/>
</target>
<target name="internal.download.tomcat" unless="is.tomcat.available">
<mkdir dir="${downloads.dir}" />
<get src="${tomcat.download.url}" dest="${tomcat.distro}" />
</target>
<target name="internal.taskdef.launch" depends="internal.classpath.libs">
<taskdef name="launch" classname="org.activiti.impl.ant.LaunchTask" classpathref="classpath.libs" />
</target>
<target name="internal.classpath.libs">
<path id="classpath.libs">
<fileset dir="${activiti.home}/lib">
<include name="*.jar" />
</fileset>
</path>
</target>
</project>
database=h2
jdbc.driver=@jdbc.driver@
jdbc.url=@jdbc.url@
jdbc.username=@jdbc.username@
jdbc.password=@jdbc.password@
db.schema.strategy=check-version
job.executor.auto.activate=off
insert into ACT_ID_GROUP values ('admin', 1, 'System administrator', 'security-role');
insert into ACT_ID_GROUP values ('user', 1, 'User', 'security-role');
insert into ACT_ID_GROUP values ('manager', 1, 'Manager', 'security-role');
insert into ACT_ID_GROUP values ('management', 1, 'Management', 'assignment');
insert into ACT_ID_GROUP values ('accountancy', 1, 'Accountancy', 'assignment');
insert into ACT_ID_GROUP values ('engineering', 1, 'Engineering', 'assignment');
insert into ACT_ID_GROUP values ('sales', 1, 'Sales', 'assignment');
insert into ACT_ID_USER values ('kermit', 1, 'Kermit', 'the Frog', 'kermit@localhost', 'kermit');
insert into ACT_ID_MEMBERSHIP values ('kermit', 'admin');
insert into ACT_ID_MEMBERSHIP values ('kermit', 'manager');
insert into ACT_ID_MEMBERSHIP values ('kermit', 'management');
insert into ACT_ID_MEMBERSHIP values ('kermit', 'accountancy');
insert into ACT_ID_MEMBERSHIP values ('kermit', 'engineering');
insert into ACT_ID_MEMBERSHIP values ('kermit', 'sales');
insert into ACT_ID_USER values ('fozzie', 1, 'Fozzie', 'Bear', 'fozzie@localhost', 'fozzie');
insert into ACT_ID_MEMBERSHIP values ('fozzie', 'user');
insert into ACT_ID_MEMBERSHIP values ('fozzie', 'accountancy');
insert into ACT_ID_USER values ('gonzo', 1, 'Gonzo', 'the Great', 'gonzo@localhost', 'gonzo');
insert into ACT_ID_MEMBERSHIP values ('gonzo', 'manager');
insert into ACT_ID_MEMBERSHIP values ('gonzo', 'management');
insert into ACT_ID_MEMBERSHIP values ('gonzo', 'accountancy');
insert into ACT_ID_MEMBERSHIP values ('gonzo', 'sales');
update ACT_PROPERTY
set VALUE_ = '10'
where NAME_ = 'next.dbid';
@echo off
java -cp h2-1.2.132.jar org.h2.tools.Server -baseDir . -tcp -tcpAllowOthers
#!/bin/sh
java -cp h2-1.2.132.jar org.h2.tools.Server -baseDir . -tcp -tcpAllowOthers
@echo off
java -cp h2-1.2.132.jar org.h2.tools.Server -tcpShutdown tcp://localhost:9092
#!/bin/sh
java -cp h2-1.2.132.jar org.h2.tools.Server -tcpShutdown tcp://localhost:9092
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>The Activiti Community Kickoff Meeting</title>
</head>
<body>
<h1>The Activiti Community Kickoff Meeting</h1>
<h3>Goals of he meeting</h3>
<ol>
<li>Define the roadmap
<ul>
<li>lot of initiatives have impact on roadmap</li>
<li>distill most important decisions</li>
<li>analyse impact on roadmap</li>
<li>discuss and decide on those important decisions</li>
<li>come to a concrete achievable roadmap </li>
<li>that way we all know what we can expect this year</li>
</ul>
</li>
<li>Get to know each other to improve the collaboration</li>
<li>Clarify which parties take on which task assignments and responsibilities and commitments. Work is only pulled by volunteers. No workload is being pushed to community people.</li>
</ol>
<h3>BPMN compatibility</h3>
<p>Biggest question around BPMN is the suitability for developers. jPDL was much more readable.
Will BPMN shortcut suffice? Will just have to take the pain of a verbose language? Or do we need to
go for usability, compactness and readability without compromises.
</p>
<p>How do we make it easy for users to work with all these namespaces (if we decide to put
custom conveniences in namespaces)
</p>
<p>Is there a clear scope we can target? Simple or descriptive conformance? Maybe Bernd could prepare
this topic as he's closest to the spec. But most important is not the knowledge of the actual conformance, but
arguments that give us guidance on what kind of conformance we target and how strict we'll be.
The alternative is that we define our own subset of what we think is useful.
</p>
<h3>PVM</h3>
<p>Extracting PVM into separate library?</p>
<p>Define which aspects need to be pluggable/configurable and which not.</p>
<p>Currently our strategy is to combine the PVM with other components like task management and command interceptors
into the core activi jar. So the biggest question is if we will be extracting the PVM into a separate
project jar, and productize it. Roughly, the downside of extracting it is that we'll have to define a
very clear boundary between what is in the PVM and what is not. This will also lead to more decoupling
and hence more indirections being placed. That might impact the readability and simplicity of the whole engine.
</p>
<p>Further, it only makes sense to extract the PVM if we do the effort of productizing it. Meaning,
have a specific documentation set for it and also build out a test suite for the PVM itself.
</p>
<p>Currently we have the PVM design as the basis, but we avoid all this because of practical reasons: 1) We can go
faster in terms of features if we combine the PVM with the other components. 2) We don't have to do the effort
of productizing (QA + docs) of the PVM component itself.
</p>
<p>One aspect of this is timer sessions and message session: Currently, timers and async continuations are part of
the PVM infrastructure. This implies that the CommandContext, Interceptors, Service API also should be included in the PVM.
Is that desirable?
</p>
<p>Another aspect is testing. The test helper methods often want to make use of implementation classes. Even
if the test method API doesn't expose the impl classes, those test helper classes always will have a dependency
on the implementation lib.
</p>
<h3>DB persistence</h3>
<p>iBatis, JPA and others?</p>
<p>Is the current architecture OK for 5.0?</p>
<h3>Cloud support</h3>
<p>The biggest question here is: How will we aling the roadmap of researching the cloud solution
with the roadmap towards 5.0GA in november?
</p>
<h5>Query APIs</h5>
<p>An important aspect of cloud is the query API. We currently plan to build out the query API
similar to jBPM 4. For example
</p>
<pre>taskService.createTaskQuery()
.processInstanceId(processInstanceId)
.activityName("task1")
.orderAsc(TaskQuery.PROPERTY_NAME)</pre>
<p>But that might be hard to implement on cloud persistence. Maybe there are solutions. MapReduce?
</p>
<h5>Persistence</h5>
<p>For persistence, we can serialize the process instances to JSON. Diff between DB is then still
granularity: Cloud stores whole process instances, DB stores executions individually. Implementations of
PersistenceSession impl should be able to cope with this diff by using the object's relations in the cloud.
</p>
</body>
</html>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Activiti Developers Guide</title>
</head>
<body>
<h1>Activiti Developers Guide</h1>
<h2>Building the sources</h2>
<h3>Dependencies</h3>
<ul><li>JDK 5+ : Make sure that you do <b>not</b> use code constructs that require JDK 6 or higher.</li>
<li>Maven 2.0.9</li>
<li>Ant 1.7.1</li></ul>
<h3>Running tests before commit</h3>
<div>Before a checkin is done, a developers should make sure to update to the latest sources and then run</div>
<div>&nbsp;&nbsp; &nbsp;<font class="Apple-style-span" face="'Courier New'"><b>mvn -Pcheck clean install</b></font><br>
in the root activiti directory <br>
</div>
<h3>Demo setup</h3>
<div>To run smoke tests on webapps, the quickest way to get started is using the target <font class="Apple-style-span" face="'Courier New'"><b>test.demo.setup</b></font> in <font class="Apple-style-span" face="'Courier New'"><b>qa/build.xml</b></font></div>
<div>That will also startup h2 and tomcat. So to rebuild, you can use the target&nbsp;<font class="Apple-style-span" face="'Courier New'"><b>test.demo.setup.refresh</b></font> &nbsp;That target will first shutdown tomcat and h2 and then do a full new demo test setup.</div>
<h3>Building the javadocs</h3>
Use target <font class="Apple-style-span" face="'Courier New'"><b>build.javadocs</b></font> in <font class="Apple-style-span" face="'Courier New'"><b>qa/build.xml</b></font><br>
<h3>Building a distribution</h3>
<div>To build a distribution, run target <font class="Apple-style-span" face="'Courier New'"><b>distro</b></font> of build file <font class="Apple-style-span" face="'Courier New'"><b>distro/build.xml</b></font></div>
<h3>User scripts</h3>
<div>After an distribution is unzipped (or directly in the distro/target/activiti-version directory), a number of scripts are offered to our users as well. &nbsp;Those scripts can be found in <font class="Apple-style-span" face="'Courier New'"><b>${activiti.home}/setup/build.xml</b></font></div>
<h3>${user.home}/.activiti/build.properties</h3>
<p>As an example, here's the content of my&nbsp;<b><font class="Apple-style-span" face="'Courier New'">${user.home}/.activiti/build.properties:</font>&nbsp;</b></p>
<blockquote class="webkit-indent-blockquote" style="border:medium none;margin:0pt 0pt 0pt 40px"><font class="Apple-style-span" face="'Courier New'"><font class="Apple-style-span" size="2">activiti.home=/Users/tombaeyens/Documents/workspace/activiti/distro/target/activiti-5.0.alpha1-SNAPSHOT<br>
downloads.dir=/Users/tombaeyens/Downloads<br>
</font></font>
<p style="margin-left:0px;margin-right:0px"><font class="Apple-style-span" face="'Courier New'"><font class="Apple-style-span" size="2">tomcat.enable.debug=true</font></font></p>
</blockquote>
<p></p>
<p><font class="Apple-style-span" face="'Courier New'"><b>activiti.home</b></font>, is used in the setup/build.xml. It will work straight from the sources. &nbsp;So you can add the setup from the sources to your ant view in your IDE.</p>
<font class="Apple-style-span" face="'Courier New'"><b>downloads.dir</b></font>, is used in the setup/build.xml. It allows you to configure a custom location for your directory to download/find tomcat. &nbsp;If you don't specify this, the default is relative to the setup directory (../downloads). &nbsp;So if you use the setup/build from the sources, you might end up downloading tomcat into your sources. &nbsp;If that still would happen, don't check it in! ;-) &nbsp;
<div><b><font class="Apple-style-span" face="'Courier New'">tomcat.enable.debug</font></b> is used in setup/build.xml when tomcat is installed. &nbsp;if the property is specified (whatever value), the following line will be added at the beginning of the catalina.sh:</div>
<p style="font-family:monaco;font-size:11px;font-style:normal;margin:0px">&nbsp;&nbsp; &nbsp;JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8787"</p>
<p style="font-family:monaco;font-size:11px;font-style:normal;margin:0px"><font class="Apple-style-span" face="courier new" size="2"><b>skip.deploy.activiti.modeler=true</b></font> <font class="Apple-style-span" size="2"><font class="Apple-style-span" face="verdana">set this property if the activiti modeler fetching from net and deployment must be skipped. <br>
</font></font></p>
<p style="font-family:monaco;font-size:11px;font-style:normal;margin:0px"><font class="Apple-style-span" size="2"><font class="Apple-style-span" face="Verdana">Unless before a release or explicitely working on Signavio, it's advised to set this property since sometimes a version matching the current trunk version isn't uploaded yet, causing the demo setup to fail.</font></font><br>
</p>
<p style="font-family:monaco;font-size:11px;font-style:normal;margin:0px"></p>
<p style="font-family:monaco;font-size:11px;font-style:normal;margin-left:0px;margin-right:0px"><font class="Apple-style-span" face="courier new" size="2"><b>mvn.executable=mvn.bat</b></font>&nbsp;<font class="Apple-style-span" face="verdana, sans-serif"><font class="Apple-style-span" size="2">on windows you have to set this property to make the calls from the ant build scripts (distro/build.xml and qa/build.xml) to maven work.</font></font></p>
<p></p>
<p style="font-family:monaco;font-size:11px;font-style:normal;margin:0px"></p>
<h3 style="font-size:12pt">${user.home}/.activiti/tomcat-users.xml</h3>
<div>To enable the automatic redeployment targets in qa/build.xml, put a tomcat-users.xml in your ${user.home}/.activiti directory with the following content:</div>
<p style="margin-left:0px;margin-right:0px"><font class="Apple-style-span" face="'Courier New'">&nbsp;&nbsp;&lt;?xml version="1.0" encoding="utf-8"?&gt;&nbsp;</font></p>
<p style="margin-left:0px;margin-right:0px"><font class="Apple-style-span" face="'Courier New'">&nbsp;&nbsp;&lt;tomcat-users&gt;&nbsp;</font></p>
<p style="margin-left:0px;margin-right:0px"><font class="Apple-style-span" face="'Courier New'">&nbsp;&nbsp; &nbsp;&lt;role rolename="manager"/&gt;&nbsp;</font></p>
<p style="margin-left:0px;margin-right:0px"><font class="Apple-style-span" face="'Courier New'">&nbsp;&nbsp; &nbsp;&lt;user username="activiti" password="activiti" roles="manager"/&gt;&nbsp;</font></p>
<p style="margin-left:0px;margin-right:0px"><font class="Apple-style-span" face="'Courier New'">&nbsp;&nbsp;&lt;/tomcat-users&gt;</font></p>
<p></p>
<h3 style="font-size:12pt">QA</h3>
<div>Build file <font class="Apple-style-span" face="'Courier New'"><b>qa/build.xml</b></font> contains a number of targets for driving the QA. &nbsp;It also contains convenience targets for developers to do integration testing.</div>
<h3>Eclipse IDE Setup</h3>
You'll need to install the maven and svn plugins.<br>
<br>
<div>In the "Galileo - http://download.eclipse.org/releases/galileo" update site, which should be available automatically, install "Collaboration --&gt; Subversibe SVN Team provider". &nbsp;After rebooting and adding an SVN repository, you'll be asked automatically to install one of the polarion connectors for SVN. &nbsp;Just take the latest version of the polarion connectors. &nbsp;In case that doesn't happen automatically install a polarion connector manually from "Subversive SVN Connectors Site http://community.polarion.com/projects/subversive/download/eclipse/2.0/update-site/"</div>
<br>
<div>Install the maven plugins from http://m2eclipse.sonatype.org/sites/m2e</div>
<br>
<div>First check out the activiti root from svn as one project. &nbsp;Then import existing projects and navigate to the modules directory. &nbsp;All the module projects should then be found and can be imported in one go.</div>
<br>
<div>in the <font class="Apple-style-span" face="'Courier New'"><b>eclipse</b></font> directory of the root activiti source directory are some files that should be imported as eclipse preferences. &nbsp;The filenames indicate the dialog that can be used to import them.<br>
<br>
<h3>Deployment to Alfresco repo</h3>
<br>
Add following to /{$user.home}/.m2/settings.xml<br>
<br>
&lt;settings xmlns="http://maven.apache.org/POM/4.0.0"<br>
&nbsp; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br>
&nbsp; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http://maven.apache.org/xsd/settings-1.0.0.xsd"&gt;<br>
<br>
&nbsp; &lt;servers&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;server&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;id&gt;alfresco.snapshot.repo&lt;/id&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;username&gt;jbarrez&lt;/username&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;password&gt;XXX&lt;/password&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/server&gt;<br>
<br>
&nbsp;&nbsp;&nbsp; &lt;server&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;id&gt;alfresco.release.repo&lt;/id&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;username&gt;jbarrez&lt;/username&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;password&gt;XXX&lt;/password&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/server&gt;<br>
&nbsp; &lt;/servers&gt;<br>
<br>
&lt;/settings&gt;<br>
<br>
<br>
Note that this will save your password in plain text.<br>
</div>
It is possible (since maven 2.1.0) to encrypt your password (untested): http://maven.apache.org/guides/mini/guide-encryption.html<br>
<br>
Just do a <b>mvn -Pcheck clean install followed by a mvn deploy</b> on the root. This will publish all artifact to the snapshot/release repo, depending whether '-SNAPSHOT' is added to the current project version.<br>
<br>
snapshot repo: http://maven.alfresco.com/nexus/content/repositories/activiti-snapshots/<br>
release repo: http://maven.alfresco.com/nexus/content/repositories/activiti-releases/<br>
<br>
<h3>Debugging ant task</h3>
http://www.vitorrodrigues.com/blog/2009/07/10/debugging-ant-tasks-in-eclipse/<br>
<br>
<h3>Signavio</h3>
See&nbsp;<a href="View?docid=dgfrhrmh_136cd6vgqgf" id="pqc:" title="activiti - signavio rebranding">activiti - signavio rebranding</a><br>
<br>
</body>
</html>
\ No newline at end of file
此差异已折叠。
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Activiti Release Guide</title>
</head>
<body>
<h1>Activiti Release Guide</h1>
<h2>Release day - 1 week</h2>
<p>Code freeze. Ask on the dev forum who has outstanding work and synchronize on
creating the release branch.
</p>
<h2>Release day</h2>
<ol>
<li>Create the release branch: <code>svn -m "creating release branch for 5.0.alpha3" copy https://svn.activiti.org/repo/activiti/trunk https://svn.activiti.org/repo/activiti/tags/activiti-5.0.alpha3</code> </li>
<li>Update the version in the release branch: <code>s/5.0.alpha3-SNAPSHOT/5.0.alpha3/g</code> </li>
<li>Verification: Run the test suite: <code>mvn -Pcheck clean install</code> in the code base root</li>
<li>Verification: Run the demo setup: <code>ant test.demo.setup</code> in directory <code>qa</code> </li>
<li>Build the distribution: <code>ant clean distro</code> in directory <code>distro</code> </li>
<li>Upload the distribution: TODO</li>
<li>Publish the docs: <code>ant publish.docs</code> in directory <code>distro</code></li>
<li>Add the new release to the downloads page in the website</li>
<li>Commit the docs and download page updates to the website</li>
<li>Upload the maven artifacts to the repository (see dev guide)</li>
<li>Blog and tweet about it</li>
</ol>
</body>
</html>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="false" context="gettercomment_context" deleted="false" description="Comment for getter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name="gettercomment"/><template autoinsert="false" context="settercomment_context" deleted="false" description="Comment for setter method" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.settercomment" name="settercomment"/><template autoinsert="false" context="constructorcomment_context" deleted="false" description="Comment for created constructors" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name="constructorcomment"/><template autoinsert="false" context="filecomment_context" deleted="false" description="Comment for created Java files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.filecomment" name="filecomment">/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
</template><template autoinsert="false" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.typecomment" name="typecomment">/**
* @author ${user}
*/</template><template autoinsert="false" context="fieldcomment_context" deleted="false" description="Comment for fields" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name="fieldcomment"/><template autoinsert="false" context="methodcomment_context" deleted="false" description="Comment for non-overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name="methodcomment"/><template autoinsert="false" context="overridecomment_context" deleted="false" description="Comment for overriding methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name="overridecomment"/><template autoinsert="false" context="delegatecomment_context" deleted="false" description="Comment for delegate methods" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name="delegatecomment"/><template autoinsert="true" context="newtype_context" deleted="false" description="Newly created files" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.newtype" name="newtype">${filecomment}
${package_declaration}
${typecomment}
${type_declaration}</template><template autoinsert="true" context="classbody_context" deleted="false" description="Code in new class type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.classbody" name="classbody">
</template><template autoinsert="true" context="interfacebody_context" deleted="false" description="Code in new interface type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name="interfacebody">
</template><template autoinsert="true" context="enumbody_context" deleted="false" description="Code in new enum type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.enumbody" name="enumbody">
</template><template autoinsert="true" context="annotationbody_context" deleted="false" description="Code in new annotation type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name="annotationbody">
</template><template autoinsert="false" context="catchblock_context" deleted="false" description="Code in new catch blocks" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.catchblock" name="catchblock">${exception_var}.printStackTrace();</template><template autoinsert="false" context="methodbody_context" deleted="false" description="Code in created method stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.methodbody" name="methodbody">${body_statement}</template><template autoinsert="false" context="constructorbody_context" deleted="false" description="Code in created constructor stubs" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name="constructorbody">${body_statement}</template><template autoinsert="true" context="getterbody_context" deleted="false" description="Code in created getters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.getterbody" name="getterbody">return ${field};</template><template autoinsert="true" context="setterbody_context" deleted="false" description="Code in created setters" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.setterbody" name="setterbody">${field} = ${param};</template><template autoinsert="false" context="gettercomment_context" deleted="false" description="Comment for getter function" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name="gettercomment"/><template autoinsert="false" context="settercomment_context" deleted="false" description="Comment for setter function" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name="settercomment"/><template autoinsert="false" context="constructorcomment_context" deleted="false" description="Comment for created constructors" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name="constructorcomment"/><template autoinsert="false" context="filecomment_context" deleted="false" description="Comment for created JavaScript files" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name="filecomment"/><template autoinsert="false" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name="typecomment"/><template autoinsert="false" context="fieldcomment_context" deleted="false" description="Comment for vars" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name="fieldcomment"/><template autoinsert="false" context="methodcomment_context" deleted="false" description="Comment for non-overriding function" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name="methodcomment"/><template autoinsert="false" context="overridecomment_context" deleted="false" description="Comment for overriding functions" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name="overridecomment"/><template autoinsert="false" context="delegatecomment_context" deleted="false" description="Comment for delegate functions" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name="delegatecomment"/><template autoinsert="true" context="newtype_context" deleted="false" description="Newly created files" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name="newtype">${filecomment}
${package_declaration}
${typecomment}
${type_declaration}</template><template autoinsert="true" context="classbody_context" deleted="false" description="Code in new class type bodies" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name="classbody">
</template><template autoinsert="false" context="catchblock_context" deleted="false" description="Code in new catch blocks" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name="catchblock">${exception_var}.printStackTrace();</template><template autoinsert="false" context="methodbody_context" deleted="false" description="Code in created function stubs" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name="methodbody">${body_statement}</template><template autoinsert="false" context="constructorbody_context" deleted="false" description="Code in created constructor stubs" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name="constructorbody">${body_statement}</template><template autoinsert="true" context="getterbody_context" deleted="false" description="Code in created getters" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name="getterbody">return ${field};</template><template autoinsert="true" context="setterbody_context" deleted="false" description="Code in created setters" enabled="true" id="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name="setterbody">${field} = ${param};</template></templates>
\ No newline at end of file
此差异已折叠。
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="java" deleted="false" description="activiti logger" enabled="true" name="log">private static Logger log = Logger.getLogger(${enclosing_type}.class.getName());</template></templates>
\ No newline at end of file
<?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.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>activiti-engine-examples</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<name>Activiti - Engine - Examples</name>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine-examples</artifactId>
<parent>
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.0.alpha3-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
<id>database</id>
<activation>
<property>
<name>database</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>database-test-create-schema</id>
<phase>process-test-classes</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="CREATING SCHEMA AND UPDATING PROPERTIES ${database} #{database} @{database} " />
<ant antfile="${basedir}/../../qa/db/build.xml" target="create.db.schema" inheritall="false">
<property name="test_classpath" refid="maven.test.classpath"/>
<property name="database" value="${database}"/>
</ant>
<!-- TODO overwrite the target/classes/activiti.properties -->
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.examples.bpmn.event.timer;
import java.util.Date;
import org.activiti.ProcessInstance;
import org.activiti.Task;
import org.activiti.impl.time.Clock;
import org.activiti.test.ActivitiTestCase;
/**
* @author Joram Barrez
*/
public class BoundaryTimerEventTest extends ActivitiTestCase {
public void testInterruptingTimerDuration() {
// Start process instance
deployProcessForThisTestMethod();
ProcessInstance pi = processService.startProcessInstanceByKey("interruptingBoundaryTimer");
// There should be one task, with a timer : first line support
Task task = taskService.createTaskQuery().processInstance(pi.getId()).singleResult();
assertEquals("First line support", task.getName());
// Set clock to the future such that the timer can fire
Clock.setCurrentTime(new Date(System.currentTimeMillis() + (5 * 60 * 60 * 1000)));
waitForJobExecutorToProcessAllJobs(10000L, 250);
// The timer has fired, and the second task (secondlinesupport) now exists
task = taskService.createTaskQuery().processInstance(pi.getId()).singleResult();
assertEquals("Second line support", task.getName());
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.examples.bpmn.gateway;
import java.util.HashMap;
import java.util.Map;
import org.activiti.ActivitiException;
import org.activiti.ProcessInstance;
import org.activiti.Task;
import org.activiti.test.ActivitiTestCase;
/**
* Example of using the exclusive gateway.
*
* @author Joram Barrez
*/
public class ExclusiveGatewayTest extends ActivitiTestCase {
/**
* The test process has an XOR gateway where, the 'input' variable
* is used to select one of the outgoing sequence flow.
* Every one of those sequence flow goes to another task,
* allowing us to test the decision very easily.
*/
public void testDecisionFunctionality() {
deployProcessForThisTestMethod();
Map<String, Object> variables = new HashMap<String, Object>();
// Test with input == 1
variables.put("input", 1);
ProcessInstance pi = processService.startProcessInstanceByKey("exclusiveGateway", variables);
Task task = taskService.createTaskQuery()
.processInstance(pi.getId())
.singleResult();
assertEquals("Send e-mail for more information", task.getName());
// Test with input == 2
variables.put("input", 2);
pi = processService.startProcessInstanceByKey("exclusiveGateway", variables);
task = taskService.createTaskQuery()
.processInstance(pi.getId())
.singleResult();
assertEquals("Check account balance", task.getName());
// Test with input == 3
variables.put("input", 3);
pi = processService.startProcessInstanceByKey("exclusiveGateway", variables);
task = taskService.createTaskQuery()
.processInstance(pi.getId())
.singleResult();
assertEquals("Call customer", task.getName());
// Test with input == 4
variables.put("input", 4);
try {
processService.startProcessInstanceByKey("exclusiveGateway", variables);
fail();
} catch (ActivitiException e) {
// Exception is expected since no outgoing sequence flow matches
}
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.examples.bpmn.scripttask;
import org.activiti.ProcessInstance;
import org.activiti.test.ActivitiTestCase;
import org.activiti.util.CollectionUtil;
/**
* @author Joram Barrez
*/
public class ScriptTaskTest extends ActivitiTestCase {
public void testScriptExecution() {
deployProcessForThisTestMethod();
int[] inputArray = new int[] {1, 2, 3, 4, 5};
ProcessInstance pi = processService.startProcessInstanceByKey("scriptExecution",
CollectionUtil.singletonMap("inputArray", inputArray));
Integer result = (Integer) processService.getVariable(pi.getId(), "sum");
assertEquals(15, result.intValue());
}
public void testSetVariableThroughExecutionInScript() {
deployProcessForThisTestMethod();
ProcessInstance pi = processService.startProcessInstanceByKey("setScriptVariableThroughExecution");
// Since 'def' is used, the 'scriptVar' will be script local
// and not automatically stored as a process variable.
assertNull(processService.getVariable(pi.getId(), "scriptVar"));
assertEquals("test123", processService.getVariable(pi.getId(), "myVar"));
}
}
package org.activiti.examples.bpmn.usertask;
import java.util.Collections;
import java.util.List;
import org.activiti.Deployment;
import org.activiti.ProcessInstance;
import org.activiti.Task;
import org.activiti.test.ActivitiTestCase;
public class FinancialReportProcessTest extends ActivitiTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
identityService.saveUser(identityService.newUser("fozzie"));
identityService.saveUser(identityService.newUser("kermit"));
identityService.saveGroup(identityService.newGroup("accountancy"));
identityService.saveGroup(identityService.newGroup("management"));
identityService.createMembership("fozzie", "accountancy");
identityService.createMembership("kermit", "management");
}
@Override
protected void tearDown() throws Exception {
identityService.deleteUser("fozzie");
identityService.deleteUser("kermit");
identityService.deleteGroup("accountancy");
identityService.deleteGroup("management");
super.tearDown();
}
public void testProcess() {
Deployment deployment = processService.newDeployment()
.addClasspathResource("org/activiti/examples/bpmn/usertask/FinancialReportProcess.bpmn20.xml")
.deploy();
registerDeployment(deployment.getId());
ProcessInstance processInstance = processService.startProcessInstanceByKey("financialReport");
List<Task> tasks = taskService.findUnassignedTasks("fozzie");
assertEquals(1, tasks.size());
Task task = tasks.get(0);
assertEquals("Write monthly financial report", task.getName());
taskService.claim(task.getId(), "fozzie");
tasks = taskService.findAssignedTasks("fozzie");
assertEquals(1, tasks.size());
taskService.complete(task.getId());
tasks = taskService.findUnassignedTasks("fozzie");
assertEquals(0, tasks.size());
tasks = taskService.findUnassignedTasks("kermit");
assertEquals(1, tasks.size());
assertEquals("Verify monthly financial report", tasks.get(0).getName());
taskService.complete(tasks.get(0).getId());
assertProcessInstanceEnded(processInstance.getId());
deleteDeploymentsCascade(Collections.singletonList(deployment.getId()));
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.examples.bpmn.usertask.taskassignee;
import java.util.List;
import org.activiti.ProcessInstance;
import org.activiti.Task;
import org.activiti.test.ActivitiTestCase;
/**
* Simple process test to validate the current implementation protoype.
*
* @author Joram Barrez
*/
public class TaskAssigneeTest extends ActivitiTestCase {
public void testTaskAssignee() {
// Deploy test process
deployProcessForThisTestMethod();
// Start process instance
ProcessInstance processInstance = processService.startProcessInstanceByKey("taskAssigneeProcess");
// Get task list
List<Task> tasks = taskService.findAssignedTasks("kermit");
assertEquals(1, tasks.size());
Task myTask = tasks.get(0);
assertEquals("Schedule meeting", myTask.getName());
assertEquals("Schedule an engineering meeting for next week with the new hire.", myTask.getDescription());
// Complete task. Process is now finished
taskService.complete(myTask.getId());
// assert if the process instance completed
assertProcessInstanceEnded(processInstance.getId());
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.examples.bpmn.usertask.taskcandidate;
import java.util.List;
import org.activiti.ProcessInstance;
import org.activiti.Task;
import org.activiti.identity.Group;
import org.activiti.identity.User;
import org.activiti.test.ActivitiTestCase;
/**
* @author Joram Barrez
*/
public class TaskCandidateTest extends ActivitiTestCase {
private static final String KERMIT = "kermit";
private static final String GONZO = "gonzo";
@Override
protected void setUp() throws Exception {
super.setUp();
Group accountants = identityService.newGroup("accountancy");
identityService.saveGroup(accountants);
Group managers = identityService.newGroup("management");
identityService.saveGroup(managers);
Group sales = identityService.newGroup("sales");
identityService.saveGroup(sales);
User kermit = identityService.newUser(KERMIT);
identityService.saveUser(kermit);
identityService.createMembership(KERMIT, "accountancy");
User gonzo = identityService.newUser(GONZO);
identityService.saveUser(gonzo);
identityService.createMembership(GONZO, "management");
identityService.createMembership(GONZO, "accountancy");
identityService.createMembership(GONZO, "sales");
}
@Override
protected void tearDown() throws Exception {
identityService.deleteUser(KERMIT);
identityService.deleteUser(GONZO);
identityService.deleteGroup("sales");
identityService.deleteGroup("accountancy");
identityService.deleteGroup("management");
super.tearDown();
}
public void testSingleCandidateGroup() {
// Deploy and start process
deployProcessForThisTestMethod();
ProcessInstance processInstance = processService.startProcessInstanceByKey("singleCandidateGroup");
// Task should not yet be assigned to kermit
List<Task> tasks = taskService.findAssignedTasks(KERMIT);
assertTrue(tasks.isEmpty());
// The task should be visible in the candidate task list
tasks = taskService.findUnassignedTasks(KERMIT);
assertEquals(1, tasks.size());
Task task = tasks.get(0);
assertEquals("Pay out expenses", task.getName());
// Claim the task
taskService.claim(task.getId(), KERMIT);
// The task must now be gone from the candidate task list
tasks = taskService.findUnassignedTasks(KERMIT);
assertTrue(tasks.isEmpty());
// The task will be visible on the personal task list
tasks = taskService.findAssignedTasks(KERMIT);
assertEquals(1, tasks.size());
assertEquals("Pay out expenses", task.getName());
// Completing the task ends the process
taskService.complete(task.getId());
assertProcessInstanceEnded(processInstance.getId());
}
public void testMultipleCandidateGroups() {
// Deploy and start process
deployProcessForThisTestMethod();
ProcessInstance processInstance = processService.startProcessInstanceByKey("multipleCandidatesGroup");
// Task should not yet be assigned to anyone
List<Task> tasks = taskService.findAssignedTasks(KERMIT);
assertTrue(tasks.isEmpty());
tasks = taskService.findAssignedTasks(GONZO);
assertTrue(tasks.isEmpty());
// The task should be visible in the candidate task list of Gonzo and Kermit
// and anyone in the management/accountancy group
assertEquals(1, taskService.findUnassignedTasks(KERMIT).size());
assertEquals(1, taskService.findUnassignedTasks(GONZO).size());
assertEquals(1, taskService.createTaskQuery().candidateGroup("management").count());
assertEquals(1, taskService.createTaskQuery().candidateGroup("accountancy").count());
assertEquals(0, taskService.createTaskQuery().candidateGroup("sales").count());
// Gonzo claims the task
tasks = taskService.findUnassignedTasks(GONZO);
Task task = tasks.get(0);
assertEquals("Approve expenses", task.getName());
taskService.claim(task.getId(), GONZO);
// The task must now be gone from the candidate task lists
assertTrue(taskService.findUnassignedTasks(KERMIT).isEmpty());
assertTrue(taskService.findUnassignedTasks(GONZO).isEmpty());
assertEquals(0, taskService.createTaskQuery().candidateGroup("management").count());
// The task will be visible on the personal task list of Gonzo
assertEquals(1, taskService.findAssignedTasks(GONZO).size());
// But not on the personal task list of (for example) Kermit
assertTrue(taskService.findAssignedTasks(KERMIT).isEmpty());
// Completing the task ends the process
taskService.complete(task.getId());
assertProcessInstanceEnded(processInstance.getId());
}
public void testMultipleCandidateUsers() {
deployProcessForThisTestMethod();
processService.startProcessInstanceByKey("multipleCandidateUsers");
assertEquals(1, taskService.findUnassignedTasks(GONZO).size());
assertEquals(1, taskService.findUnassignedTasks(KERMIT).size());
}
public void testMixedCandidateUserAndGroup() {
deployProcessForThisTestMethod();
processService.startProcessInstanceByKey("mixedCandidateUserAndGroup");
assertEquals(1, taskService.findUnassignedTasks(GONZO).size());
assertEquals(1, taskService.findUnassignedTasks(KERMIT).size());
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.examples.identity;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.activiti.IdentityService;
import org.activiti.identity.Group;
import org.activiti.identity.User;
import org.activiti.test.ActivitiTestCase;
/**
* @author Tom Baeyens
*/
public class IdentityTest extends ActivitiTestCase {
public void testAuthentication() {
IdentityService identityService = processEngine.getIdentityService();
User user = identityService.newUser("johndoe");
user.setPassword("xxx");
identityService.saveUser(user);
assertTrue(identityService.checkPassword("johndoe", "xxx"));
assertFalse(identityService.checkPassword("johndoe", "invalid pwd"));
identityService.deleteUser("johndoe");
}
public void testFindGroupsByUserAndType() {
IdentityService identityService = processEngine.getIdentityService();
Group sales = identityService.newGroup("sales");
sales.setType("hierarchy");
identityService.saveGroup(sales);
Group development = identityService.newGroup("development");
development.setType("hierarchy");
identityService.saveGroup(development);
Group admin = identityService.newGroup("admin");
admin.setType("security-role");
identityService.saveGroup(admin);
Group user = identityService.newGroup("user");
user.setType("security-role");
identityService.saveGroup(user);
User johndoe = identityService.newUser("johndoe");
identityService.saveUser(johndoe);
User joesmoe = identityService.newUser("joesmoe");
identityService.saveUser(joesmoe);
User jackblack = identityService.newUser("jackblack");
identityService.saveUser(jackblack);
identityService.createMembership("johndoe", "sales");
identityService.createMembership("johndoe", "user");
identityService.createMembership("johndoe", "admin");
identityService.createMembership("joesmoe", "user");
List<Group> groups = identityService.findGroupsByUserAndType("johndoe", "security-role");
Set<String> groupIds = getGroupIds(groups);
Set<String> expectedGroupIds = new HashSet<String>();
expectedGroupIds.add("user");
expectedGroupIds.add("admin");
assertEquals(expectedGroupIds, groupIds);
groups = identityService.findGroupsByUserAndType("joesmoe", "security-role");
groupIds = getGroupIds(groups);
expectedGroupIds = new HashSet<String>();
expectedGroupIds.add("user");
assertEquals(expectedGroupIds, groupIds);
groups = identityService.findGroupsByUserAndType("jackblack", "security-role");
assertTrue(groups.isEmpty());
identityService.deleteGroup("sales");
identityService.deleteGroup("development");
identityService.deleteGroup("admin");
identityService.deleteGroup("user");
identityService.deleteUser("johndoe");
identityService.deleteUser("joesmoe");
identityService.deleteUser("jackblack");
}
public void testUser() {
IdentityService identityService = processEngine.getIdentityService();
User user = identityService.newUser("johndoe");
user.setFirstName("John");
user.setLastName("Doe");
user.setEmail("johndoe@alfresco.com");
identityService.saveUser(user);
user = identityService.findUser("johndoe");
assertEquals("johndoe", user.getId());
assertEquals("John", user.getFirstName());
assertEquals("Doe", user.getLastName());
assertEquals("johndoe@alfresco.com", user.getEmail());
identityService.deleteUser("johndoe");
}
public void testGroup() {
IdentityService identityService = processEngine.getIdentityService();
Group group = identityService.newGroup("sales");
group.setName("Sales division");
identityService.saveGroup(group);
group = identityService.findGroup("sales");
assertEquals("sales", group.getId());
assertEquals("Sales division", group.getName());
identityService.deleteGroup("sales");
}
public void testMembership() {
IdentityService identityService = processEngine.getIdentityService();
Group sales = identityService.newGroup("sales");
identityService.saveGroup(sales);
Group development = identityService.newGroup("development");
identityService.saveGroup(development);
User johndoe = identityService.newUser("johndoe");
identityService.saveUser(johndoe);
User joesmoe = identityService.newUser("joesmoe");
identityService.saveUser(joesmoe);
User jackblack = identityService.newUser("jackblack");
identityService.saveUser(jackblack);
identityService.createMembership("johndoe", "sales");
identityService.createMembership("joesmoe", "sales");
identityService.createMembership("joesmoe", "development");
identityService.createMembership("jackblack", "development");
List<Group> groups = identityService.findGroupsByUser("johndoe");
assertEquals(createStringSet("sales"), getGroupIds(groups));
groups = identityService.findGroupsByUser("joesmoe");
assertEquals(createStringSet("sales", "development"), getGroupIds(groups));
groups = identityService.findGroupsByUser("jackblack");
assertEquals(createStringSet("development"), getGroupIds(groups));
List<User> users = identityService.findUsersByGroup("sales");
assertEquals(createStringSet("johndoe", "joesmoe"), getUserIds(users));
users = identityService.findUsersByGroup("development");
assertEquals(createStringSet("joesmoe", "jackblack"), getUserIds(users));
identityService.deleteGroup("sales");
identityService.deleteGroup("development");
identityService.deleteUser("jackblack");
identityService.deleteUser("joesmoe");
identityService.deleteUser("johndoe");
}
private Object createStringSet(String... strings) {
Set<String> stringSet = new HashSet<String>();
for (String string: strings) {
stringSet.add(string);
}
return stringSet;
}
public Set<String> getGroupIds(List<Group> groups) {
Set<String> groupIds = new HashSet<String>();
for (Group group: groups) {
groupIds.add(group.getId());
}
return groupIds;
}
public Set<String> getUserIds(List<User> users) {
Set<String> userIds = new HashSet<String>();
for (User user: users) {
userIds.add(user.getId());
}
return userIds;
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.examples.mgmt;
import java.util.Map;
import org.activiti.ManagementService;
import org.activiti.TableMetaData;
import org.activiti.test.ActivitiTestCase;
/**
* Test case for the various operations of the {@link ManagementService}
*
* @author Tom Baeyens
* @author Joram Barrez
*/
public class ManagementServiceTest extends ActivitiTestCase {
public void testTableCount() {
Map<String, Long> tableCount = managementService.getTableCount();
assertEquals(new Long(2), tableCount.get("ACT_PROPERTY"));
assertEquals(new Long(0), tableCount.get("ACT_BYTEARRAY"));
assertEquals(new Long(0), tableCount.get("ACT_DEPLOYMENT"));
assertEquals(new Long(0), tableCount.get("ACT_EXECUTION"));
assertEquals(new Long(0), tableCount.get("ACT_ID_GROUP"));
assertEquals(new Long(0), tableCount.get("ACT_ID_MEMBERSHIP"));
assertEquals(new Long(0), tableCount.get("ACT_ID_USER"));
assertEquals(new Long(0), tableCount.get("ACT_PROCESSDEFINITION"));
assertEquals(new Long(0), tableCount.get("ACT_TASK"));
assertEquals(new Long(0), tableCount.get("ACT_TASKINVOLVEMENT"));;
}
public void testGetTableMetaData() {
TableMetaData tableMetaData = managementService.getTableMetaData("ACT_TASK");
assertEquals(tableMetaData.getColumnNames().size(), tableMetaData.getColumnTypes().size());
assertEquals(13, tableMetaData.getColumnNames().size());
int assigneeIndex = tableMetaData.getColumnNames().indexOf("ASSIGNEE_");
int createTimeIndex = tableMetaData.getColumnNames().indexOf("CREATE_TIME_");
assertTrue(assigneeIndex >= 0);
assertTrue(createTimeIndex >= 0);
assertEquals("VARCHAR", tableMetaData.getColumnTypes().get(assigneeIndex));
assertEquals("TIMESTAMP", tableMetaData.getColumnTypes().get(createTimeIndex));
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.examples.mgmt;
import java.util.List;
import junit.framework.TestCase;
import org.activiti.ProcessEngine;
import org.activiti.ProcessEngineInfo;
import org.activiti.ProcessEngines;
import org.activiti.test.ProcessEngineTestCase;
/**
* @author Tom Baeyens
*/
public class ProcessEnginesTest extends TestCase {
protected void setUp() throws Exception {
// in case previous ProcessEngineTestCase s (or ActivitiTestCase s)
// already have inialized and cached a process engine, it needs to
// be closed first.
ProcessEngineTestCase.closeProcessEngine();
}
public void testProcessEngineInfo() {
ProcessEngines.init();
List<ProcessEngineInfo> processEngineInfos = ProcessEngines.getProcessEngineInfos();
assertEquals(1, processEngineInfos.size());
ProcessEngineInfo processEngineInfo = processEngineInfos.get(0);
assertNull(processEngineInfo.getException());
assertNotNull(processEngineInfo.getName());
assertNotNull(processEngineInfo.getResourceUrl());
ProcessEngine processEngine = ProcessEngines.getProcessEngine(ProcessEngines.NAME_DEFAULT);
assertNotNull(processEngine);
ProcessEngines.destroy();
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.examples.mgmt;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.activiti.TablePage;
import org.activiti.Task;
import org.activiti.test.ActivitiTestCase;
/**
* @author Joram Barrez
*/
public class TablePageQueryTest extends ActivitiTestCase {
public void testGetTablePage() {
List<String> taskIds = generateDummyTasks(20);
TablePage tablePage = managementService.createTablePageQuery()
.tableName("ACT_TASK")
.start(0)
.size(5)
.singleResult();
assertEquals(0, tablePage.getStart());
assertEquals(5, tablePage.getSize());
assertEquals(5, tablePage.getRows().size());
assertEquals(20, tablePage.getTotal());
tablePage = managementService.createTablePageQuery()
.tableName("ACT_TASK")
.start(14)
.size(10)
.singleResult();
assertEquals(14, tablePage.getStart());
assertEquals(6, tablePage.getSize());
assertEquals(6, tablePage.getRows().size());
assertEquals(20, tablePage.getTotal());
deleteTasks(taskIds);
}
public void testGetSortedTablePage() {
List<String> taskIds = generateDummyTasks(15);
// Without a sort
TablePage tablePage = managementService.createTablePageQuery()
.tableName("ACT_TASK")
.start(1)
.size(7)
.singleResult();
String[] expectedTaskNames = new String[] {"1", "2", "3", "4", "5", "6", "7"};
verifyTaskNames(expectedTaskNames, tablePage.getRows());
// With an ascending sort
tablePage = managementService.createTablePageQuery()
.tableName("ACT_TASK")
.start(1)
.size(7)
.orderAsc("NAME_")
.singleResult();
expectedTaskNames = new String[] {"1", "10", "11", "12", "13", "14", "2"} ;
verifyTaskNames(expectedTaskNames, tablePage.getRows());
// With a descending sort
tablePage = managementService.createTablePageQuery()
.tableName("ACT_TASK")
.start(6)
.size(8)
.orderDesc("NAME_")
.singleResult();
expectedTaskNames = new String[] {"3", "2", "14", "13", "12", "11", "10", "1"} ;
verifyTaskNames(expectedTaskNames, tablePage.getRows());
deleteTasks(taskIds);
}
private void verifyTaskNames(String[] expectedTaskNames, List<Map<String, Object>> rowData) {
assertEquals(expectedTaskNames.length, rowData.size());
for (int i=0; i < expectedTaskNames.length; i++) {
assertEquals(expectedTaskNames[i], rowData.get(i).get("NAME_"));
}
}
private List<String> generateDummyTasks(int nrOfTasks) {
ArrayList<String> taskIds = new ArrayList<String>();
for (int i = 0; i < nrOfTasks; i++) {
Task task = taskService.newTask();
task.setName(String.valueOf(i));
taskService.saveTask(task);
taskIds.add(task.getId());
}
return taskIds;
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.examples.pojo;
import org.activiti.pvm.ActivityBehavior;
import org.activiti.pvm.ActivityExecution;
import org.activiti.pvm.Transition;
/**
* @author Tom Baeyens
*/
public class Automatic implements ActivityBehavior {
public void execute(ActivityExecution execution) throws Exception {
Transition defaultOutgoingTransition = execution.getDefaultOutgoingTransition();
execution.take(defaultOutgoingTransition);
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.examples.pojo;
import java.util.List;
import org.activiti.ActivitiException;
import org.activiti.pvm.ActivityBehavior;
import org.activiti.pvm.ActivityExecution;
import org.activiti.pvm.Condition;
import org.activiti.pvm.Transition;
/**
* @author Tom Baeyens
*/
public class Decision implements ActivityBehavior {
public void execute(ActivityExecution execution) throws Exception {
Transition transition = findOutgoingTransition(execution);
execution.take(transition);
}
private Transition findOutgoingTransition(ActivityExecution execution) {
List<Transition> outgoingTransitions = execution.getOutgoingTransitions();
for (Transition transition: outgoingTransitions) {
Condition condition = transition.getCondition();
if ( (condition==null)
|| (condition.evaluate(execution))
) {
return transition;
}
}
throw new ActivitiException("no transition for which the condition resolved to true: "+outgoingTransitions);
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.examples.pojo;
import junit.framework.TestCase;
import org.activiti.impl.scripting.ExpressionCondition;
import org.activiti.pvm.ObjectProcessDefinition;
import org.activiti.pvm.ObjectProcessInstance;
import org.activiti.pvm.ProcessDefinitionBuilder;
/**
* @author Tom Baeyens
*/
public class PojoTest extends TestCase {
public void testPojoWaitState() {
ObjectProcessDefinition processDefinition = ProcessDefinitionBuilder
.createProcessDefinition()
.createActivity("a")
.initial()
.behavior(new WaitState())
.transition("b")
.endActivity()
.createActivity("b")
.behavior(new WaitState())
.transition("c")
.endActivity()
.createActivity("c")
.behavior(new WaitState())
.endActivity()
.endProcessDefinition();
ObjectProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
assertTrue(processInstance.isActive("a"));
processInstance.event(null);
assertTrue(processInstance.isActive("b"));
processInstance.event(null);
assertTrue(processInstance.isActive("c"));
}
public void testPojoAutomatic() {
ObjectProcessDefinition processDefinition = ProcessDefinitionBuilder
.createProcessDefinition()
.createActivity("a")
.initial()
.behavior(new Automatic())
.transition("b")
.endActivity()
.createActivity("b")
.behavior(new Automatic())
.transition("c")
.endActivity()
.createActivity("c")
.behavior(new WaitState())
.endActivity()
.endProcessDefinition();
ObjectProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
assertTrue(processInstance.isActive("c"));
}
public void testDecision() {
ObjectProcessDefinition processDefinition = ProcessDefinitionBuilder
.createProcessDefinition()
.createActivity("start")
.initial()
.behavior(new Automatic())
.transition("checkCredit")
.endActivity()
.createActivity("checkCredit")
.behavior(new Decision())
.transition("takeToGolf", new ExpressionCondition("${creditRating=='Aaa-'}"))
.transition("askDaughterOut", new ExpressionCondition("${creditRating=='AAA+'}"))
.transition("ignore")
.endActivity()
.createActivity("takeToGolf")
.behavior(new WaitState())
.endActivity()
.createActivity("askDaughterOut")
.behavior(new WaitState())
.endActivity()
.createActivity("ignore")
.behavior(new WaitState())
.endActivity()
.endProcessDefinition();
ObjectProcessInstance processInstance = processDefinition.createProcessInstance()
.variable("creditRating", "Aaa-")
.start();
assertTrue(processInstance.isActive("takeToGolf"));
processInstance = processDefinition.createProcessInstance()
.variable("creditRating", "AAA+")
.start();
assertTrue(processInstance.isActive("askDaughterOut"));
processInstance = processDefinition.createProcessInstance()
.variable("creditRating", "bb-")
.start();
assertTrue(processInstance.isActive("ignore"));
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.examples.pojo;
import org.activiti.pvm.ActivityExecution;
import org.activiti.pvm.EventActivityBehavior;
/**
* @author Tom Baeyens
*/
public class WaitState implements EventActivityBehavior {
public void execute(ActivityExecution execution) {
// By default, the execution will not propagate.
// So if no method like take(Transition) is called on execution
// then the activity will behave as a wait state. The execution is currently
// pointing to the activity. The original call to execution.start()
// or execution.event() will return. Then the execution object will
// remain pointing to the current activity until execution.event(Object) is called.
// That method will delegate to the method below.
}
public void event(ActivityExecution execution, Object event) {
execution.take((String)event);
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.examples.processdefinitions;
import java.util.List;
import org.activiti.ProcessDefinition;
import org.activiti.test.ActivitiTestCase;
/**
* @author Tom Baeyens
*/
public class ProcessDefinitionsTest extends ActivitiTestCase {
private static final String NAMESPACE = "xmlns='http://www.omg.org/spec/BPMN/20100524/MODEL'";
private static final String TARGET_NAMESPACE = "targetNamespace='http://activiti.org/BPMN20'";
public void testGetProcessDefinitions() {
deployProcessString(
"<definitions " + NAMESPACE + " " + TARGET_NAMESPACE + ">" +
" <process id='IDR' name='Insurance Damage Report' />" +
"</definitions>"
);
deployProcessString(
"<definitions " + NAMESPACE + " " + TARGET_NAMESPACE + ">" +
" <process id='IDR' name='Insurance Damage Report' />" +
"</definitions>"
);
deployProcessString(
"<definitions " + NAMESPACE + " " + TARGET_NAMESPACE + ">" +
" <process id='IDR' name='Insurance Damage Report' />" +
"</definitions>"
);
deployProcessString(
"<definitions " + NAMESPACE + " " + TARGET_NAMESPACE + ">" +
" <process id='EN' name='Expense Note' />" +
"</definitions>"
);
deployProcessString(
"<definitions " + NAMESPACE + " " + TARGET_NAMESPACE + ">" +
" <process id='EN' name='Expense Note' />" +
"</definitions>"
);
List<ProcessDefinition> processDefinitions = processService.findProcessDefinitions();
assertNotNull(processDefinitions);
ProcessDefinition processDefinition = processDefinitions.get(0);
assertEquals("EN", processDefinition.getKey());
assertEquals("Expense Note", processDefinition.getName());
assertEquals("EN:2", processDefinition.getId());
assertEquals(2, processDefinition.getVersion());
processDefinition = processDefinitions.get(1);
assertEquals("EN", processDefinition.getKey());
assertEquals("Expense Note", processDefinition.getName());
assertEquals("EN:1", processDefinition.getId());
assertEquals(1, processDefinition.getVersion());
processDefinition = processDefinitions.get(2);
assertEquals("IDR", processDefinition.getKey());
assertEquals("Insurance Damage Report", processDefinition.getName());
assertEquals("IDR:3", processDefinition.getId());
assertEquals(3, processDefinition.getVersion());
processDefinition = processDefinitions.get(3);
assertEquals("IDR", processDefinition.getKey());
assertEquals("Insurance Damage Report", processDefinition.getName());
assertEquals("IDR:2", processDefinition.getId());
assertEquals(2, processDefinition.getVersion());
processDefinition = processDefinitions.get(4);
assertEquals("IDR", processDefinition.getKey());
assertEquals("Insurance Damage Report", processDefinition.getName());
assertEquals("IDR:1", processDefinition.getId());
assertEquals(1, processDefinition.getVersion());
assertEquals(5, processDefinitions.size());
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.examples.task;
import java.util.List;
import org.activiti.Task;
import org.activiti.test.ActivitiTestCase;
/**
* @author Joram Barrez
*/
public class StandaloneTaskTest extends ActivitiTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
identityService.saveUser(identityService.newUser("kermit"));
identityService.saveUser(identityService.newUser("gonzo"));
}
@Override
protected void tearDown() throws Exception {
identityService.deleteUser("kermit");
identityService.deleteUser("gonzo");
super.tearDown();
}
public void testCreateToComplete() {
// Create and save task
Task task = taskService.newTask();
task.setName("testTask");
taskService.saveTask(task);
String taskId = task.getId();
// Add user as candidate user
taskService.addCandidateUser(taskId, "kermit");
taskService.addCandidateUser(taskId, "gonzo");
// Retrieve task list for jbarrez
List<Task> tasks = taskService.findUnassignedTasks("kermit");
assertEquals(1, tasks.size());
assertEquals("testTask", tasks.get(0).getName());
// Retrieve task list for tbaeyens
tasks = taskService.findUnassignedTasks("gonzo");
assertEquals(1, tasks.size());
assertEquals("testTask", tasks.get(0).getName());
// Claim task
taskService.claim(taskId, "kermit");
// Tasks shouldn't appear in the candidate tasklists anymore
assertTrue(taskService.findUnassignedTasks("kermit").isEmpty());
assertTrue(taskService.findUnassignedTasks("gonzo").isEmpty());
// Complete task
taskService.complete(taskId);
// Task should be removed from runtime data
// TODO: check for historic data when implemented!
assertNull(taskService.findTask(taskId));
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.examples.taskforms;
import java.util.HashMap;
import java.util.Map;
import org.activiti.Deployment;
import org.activiti.Task;
import org.activiti.test.ActivitiTestCase;
/**
* @author Tom Baeyens
* @author Joram Barrez
*/
public class TaskFormsTest extends ActivitiTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
identityService.saveUser(identityService.newUser("fozzie"));
identityService.saveGroup(identityService.newGroup("management"));
identityService.createMembership("fozzie", "management");
}
@Override
protected void tearDown() throws Exception {
identityService.deleteGroup("management");
identityService.deleteUser("fozzie");
super.tearDown();
}
private void deployVacationRequestProcess() {
Deployment deployment = processService.newDeployment()
.addClasspathResource("org/activiti/examples/taskforms/VacationRequest.bpmn20.xml")
.addClasspathResource("org/activiti/examples/taskforms/approve.form")
.addClasspathResource("org/activiti/examples/taskforms/request.form")
.addClasspathResource("org/activiti/examples/taskforms/adjustRequest.form")
.deploy();
registerDeployment(deployment.getId());
}
public void testTaskFormsWithVacationRequestProcess() {
deployVacationRequestProcess();
// Get start form
Object startForm = processService.getStartFormByKey("vacationRequest");
assertNotNull(startForm);
// Define variables that would be filled in through the form
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("employeeName", "kermit");
parameters.put("numberOfDays", "4");
parameters.put("vacationMotivation", "I'm tired");
processService.startProcessInstanceByKey("vacationRequest", parameters);
// Management should now have a task assigned to them
Task task = taskService.createTaskQuery().candidateGroup("management").singleResult();
assertEquals("Vacation request by kermit", task.getDescription());
Object taskForm = taskService.getTaskForm(task.getId());
assertNotNull(taskForm);
}
public void testTaskFormUnavailable() {
deployProcessForThisTestMethod();
assertNull(processService.getStartFormByKey("noStartOrTaskForm"));
processService.startProcessInstanceByKey("noStartOrTaskForm");
Task task = taskService.createTaskQuery().singleResult();
assertNull(taskService.getTaskForm(task.getId()));
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.examples.variables;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.activiti.ProcessInstance;
import org.activiti.test.ActivitiTestCase;
/**
* @author Tom Baeyens
*/
public class VariablesTest extends ActivitiTestCase {
public void testBasicVariableOperations() {
deployProcessForThisTestMethod();
Date now = new Date();
List<String> serializable = new ArrayList<String>();
serializable.add("one");
serializable.add("two");
serializable.add("three");
byte[] bytes = "somebytes".getBytes();
// Start process instance
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("cost center", 928374L);
variables.put("customer", "coca-cola");
variables.put("message", "<xml />");
variables.put("start date", now);
variables.put("nihil", null);
variables.put("numbers", serializable);
variables.put("manybits", bytes);
ProcessInstance processInstance = processService.startProcessInstanceByKey("taskAssigneeProcess", variables);
variables = processService.getVariables(processInstance.getId());
assertEquals(928374L, variables.get("cost center"));
assertEquals("coca-cola", variables.get("customer"));
assertEquals("<xml />", variables.get("message"));
assertEquals(now, variables.get("start date"));
assertEquals(null, variables.get("nihil"));
assertEquals(serializable, variables.get("numbers"));
assertTrue(Arrays.equals(bytes, (byte[]) variables.get("manybits")));
assertEquals(7, variables.size());
processService.setVariable(processInstance.getId(), "cost center", null);
processService.setVariable(processInstance.getId(), "customer", null);
processService.setVariable(processInstance.getId(), "message", null);
processService.setVariable(processInstance.getId(), "start date", null);
processService.setVariable(processInstance.getId(), "nihil", null);
processService.setVariable(processInstance.getId(), "numbers", null);
processService.setVariable(processInstance.getId(), "manybits", null);
variables = processService.getVariables(processInstance.getId());
assertEquals(null, variables.get("cost center"));
assertEquals(null, variables.get("customer"));
assertEquals(null, variables.get("message"));
assertEquals(null, variables.get("start date"));
assertEquals(null, variables.get("nihil"));
assertEquals(null, variables.get("numbers"));
assertEquals(null, variables.get("manybits"));
assertEquals(7, variables.size());
processService.setVariable(processInstance.getId(), "new var", "hi");
processService.setVariable(processInstance.getId(), "cost center", 9987L);
processService.setVariable(processInstance.getId(), "customer", "colgate");
processService.setVariable(processInstance.getId(), "message", "{json}");
processService.setVariable(processInstance.getId(), "start date", now);
processService.setVariable(processInstance.getId(), "numbers", serializable);
processService.setVariable(processInstance.getId(), "manybits", bytes);
variables = processService.getVariables(processInstance.getId());
assertEquals("hi", variables.get("new var"));
assertEquals(9987L, variables.get("cost center"));
assertEquals("colgate", variables.get("customer"));
assertEquals("{json}", variables.get("message"));
assertEquals(now, variables.get("start date"));
assertEquals(null, variables.get("nihil"));
assertEquals(serializable, variables.get("numbers"));
assertTrue(Arrays.equals(bytes, (byte[]) variables.get("manybits")));
assertEquals(8, variables.size());
}
}
database=h2
jdbc.driver=org.h2.Driver
jdbc.url=jdbc:h2:mem:activiti
jdbc.username=sa
jdbc.password=
db.schema.strategy=create-drop
job.executor.auto.activate=off
handlers = java.util.logging.ConsoleHandler
.level = FINE
java.util.logging.ConsoleHandler.level=FINEST
java.util.logging.ConsoleHandler.formatter=org.activiti.impl.util.LogUtil$LogFormatter
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti="http://activiti.org/bpmn-extensions" typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/bpmn2.0">
<process id="interruptingBoundaryTimer">
<startEvent id="theStart" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="firstLineSupport" />
<userTask id="firstLineSupport" name="First line support" />
<sequenceFlow id="flow2" sourceRef="firstLineSupport" targetRef="normalEnd" />
<endEvent id="normalEnd" />
<boundaryEvent id="escalationTimer" cancelActivity="true" attachedToRef="firstLineSupport">
<timerEventDefinition>
<timeDuration>PT4H</timeDuration>
</timerEventDefinition>
</boundaryEvent>
<sequenceFlow id="flow3" sourceRef="escalationTimer" targetRef="secondLineSupport" />
<userTask id="secondLineSupport" name="Second line support" />
<sequenceFlow id="flow4" sourceRef="secondLineSupport" targetRef="escalatedEnd" />
<endEvent id="escalatedEnd" />
</process>
</definitions>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="propertyTest"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti="http://activiti.org/bpmn-extensions"
typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://www.activiti.org/bpmn2.0">
<process id="exclusiveGateway">
<startEvent id="theStart" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="exclusiveGw" />
<exclusiveGateway id="exclusiveGw" name="Exclusive Gateway" />
<sequenceFlow id="flow2" sourceRef="exclusiveGw" targetRef="theTask1">
<conditionExpression xsi:type="tFormalExpression">${input == 1}</conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow3" sourceRef="exclusiveGw" targetRef="theTask2">
<conditionExpression xsi:type="tFormalExpression">${input == 2}</conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow4" sourceRef="exclusiveGw" targetRef="theTask3">
<conditionExpression xsi:type="tFormalExpression">${input == 3}</conditionExpression>
</sequenceFlow>
<userTask id="theTask1" name="Send e-mail for more information" />
<sequenceFlow id="flow5" sourceRef="theTask1" targetRef="theEnd" />
<userTask id="theTask2" name="Check account balance" />
<sequenceFlow id="flow6" sourceRef="theTask2" targetRef="theEnd" />
<userTask id="theTask3" name="Call customer" />
<sequenceFlow id="flow7" sourceRef="theTask3" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
</definitions>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti="http://activiti.org/bpmn-extensions"
typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://www.activiti.org/bpmn2.0">
<process id="scriptExecution">
<startEvent id="theStart" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="theScriptTask" />
<scriptTask id="theScriptTask" name="Execute script" scriptFormat="groovy">
<script>
sum = 0
for ( i in inputArray ) {
sum += i
}
</script>
</scriptTask>
<sequenceFlow id="flow2" sourceRef="theScriptTask" targetRef="theTask" />
<userTask id="theTask" name="my task" />
<sequenceFlow id="flow3" sourceRef="theTask" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
</definitions>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti="http://activiti.org/bpmn-extensions"
typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://www.activiti.org/bpmn2.0">
<process id="setScriptVariableThroughExecution">
<startEvent id="theStart" />
<sequenceFlow id="flow1" sourceRef="theStart" targetRef="theScriptTask" />
<scriptTask id="theScriptTask" name="Execute script" scriptFormat="groovy">
<script>
// Using def in Groovy makes the variable script-local
// It will not be stored autmatically (which is the case when not using def)
def scriptVar = "test123"
execution.setVariable("myVar", scriptVar)
</script>
</scriptTask>
<sequenceFlow id="flow2" sourceRef="theScriptTask" targetRef="theTask" />
<userTask id="theTask" name="my task" />
<sequenceFlow id="flow3" sourceRef="theTask" targetRef="theEnd" />
<endEvent id="theEnd" />
</process>
</definitions>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<definitions id="definitions"
typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://activiti.org/bpmn20"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">
<process id="financialReport" name="Monthly financial report">
<startEvent id="theStart" />
<sequenceFlow id='flow1' sourceRef='theStart' targetRef='writeReportTask' />
<userTask id="writeReportTask" name="Write monthly financial report" >
<documentation>
Write monthly financial report for publication to shareholders.
</documentation>
<potentialOwner>
<resourceAssignmentExpression>
<formalExpression>accountancy</formalExpression>
</resourceAssignmentExpression>
</potentialOwner>
</userTask>
<sequenceFlow id='flow2' sourceRef='writeReportTask' targetRef='verifyReportTask' />
<userTask id="verifyReportTask" name="Verify monthly financial report" >
<documentation>
Verify monthly financial report composed by the accountancy departement.
This financial report is going to be sent to all the company shareholders.
</documentation>
<potentialOwner>
<resourceAssignmentExpression>
<formalExpression>management</formalExpression>
</resourceAssignmentExpression>
</potentialOwner>
</userTask>
<sequenceFlow id='flow3' sourceRef='verifyReportTask' targetRef='theEnd' />
<endEvent id="theEnd" />
</process>
</definitions>
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="taskAssigneeExample"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://www.activiti.org/bpmn2.0">
<process id='taskAssigneeProcess' name="Task Assignee example">
<startEvent id='theStart' />
<sequenceFlow id='flow1' sourceRef='theStart' targetRef='theTask' />
<userTask id='theTask' name='Schedule meeting' >
<documentation>
Schedule an engineering meeting for next week with the new hire.
</documentation>
<humanPerformer>
<resourceAssignmentExpression>
<formalExpression>kermit</formalExpression>
</resourceAssignmentExpression>
</humanPerformer>
</userTask>
<sequenceFlow id='flow2' sourceRef='theTask' targetRef='theEnd' />
<endEvent id='theEnd' />
</process>
</definitions>
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="taskAssigneeExample"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 BPMN20.xsd"
typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://www.activiti.org/bpmn2.0">
<process id='mixedCandidateUserAndGroup' name="Mixed candidate user and group example">
<startEvent id='theStart' />
<sequenceFlow id='flow1' sourceRef='theStart' targetRef='theTask' />
<userTask id='theTask' name='Write financial report' >
<documentation>
Write the bi-monthly financial report for the shareholders newsletter.
</documentation>
<potentialOwner>
<resourceAssignmentExpression>
<formalExpression>user(kermit), group(sales)</formalExpression>
</resourceAssignmentExpression>
</potentialOwner>
</userTask>
<sequenceFlow id='flow2' sourceRef='theTask' targetRef='theEnd' />
<endEvent id='theEnd' />
</process>
</definitions>
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="taskAssigneeExample"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://www.activiti.org/bpmn2.0">
<process id='multipleCandidatesGroup' name="Multiple candidate groups example">
<startEvent id='theStart' />
<sequenceFlow id='flow1' sourceRef='theStart' targetRef='theTask' />
<userTask id='theTask' name='Approve expenses' >
<documentation>
Judge expenses of employees before end of fiscal quarter.
</documentation>
<potentialOwner>
<resourceAssignmentExpression>
<formalExpression>group(accountancy), group(management)</formalExpression>
</resourceAssignmentExpression>
</potentialOwner>
</userTask>
<sequenceFlow id='flow2' sourceRef='theTask' targetRef='theEnd' />
<endEvent id='theEnd' />
</process>
</definitions>
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="taskAssigneeExample"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://www.activiti.org/bpmn2.0">
<process id='multipleCandidateUsers' name="Multiple candidate users example">
<startEvent id='theStart' />
<sequenceFlow id='flow1' sourceRef='theStart' targetRef='theTask' />
<userTask id='theTask' name='Book flight' >
<documentation>
Book flight Brussels-Rome for Activiti BPM conference.
</documentation>
<potentialOwner>
<resourceAssignmentExpression>
<formalExpression>user(gonzo), user(kermit)</formalExpression>
</resourceAssignmentExpression>
</potentialOwner>
</userTask>
<sequenceFlow id='flow2' sourceRef='theTask' targetRef='theEnd' />
<endEvent id='theEnd' />
</process>
</definitions>
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="taskAssigneeExample"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://www.activiti.org/bpmn2.0">
<process id='singleCandidateGroup' name="Single candidate group example">
<startEvent id='theStart' />
<sequenceFlow id='flow1' sourceRef='theStart' targetRef='theTask' />
<userTask id='theTask' name='Pay out expenses' >
<documentation>
Transfer money for approved expenses to employee.
</documentation>
<potentialOwner>
<resourceAssignmentExpression>
<formalExpression>accountancy</formalExpression>
</resourceAssignmentExpression>
</potentialOwner>
</userTask>
<sequenceFlow id='flow2' sourceRef='theTask' targetRef='theEnd' />
<endEvent id='theEnd' />
</process>
</definitions>
<?xml version="1.0" encoding="UTF-8" ?>
<definitions id="definitions"
typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://activiti.org/bpmn20"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti="http://activiti.org/bpmn-extensions">
<process id="noStartOrTaskForm">
<startEvent id="request" />
<sequenceFlow id="flow1" sourceRef="request" targetRef="approve" />
<userTask id="approve" />
<sequenceFlow id='flow2' sourceRef='approve' targetRef='end' />
<endEvent id="end" />
</process>
</definitions>
<?xml version="1.0" encoding="UTF-8" ?>
<definitions id="definitions"
typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://activiti.org/bpmn20"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti="http://activiti.org/bpmn-extensions">
<process id="vacationRequest" name="Vacation request">
<startEvent id="request" activiti:form="org/activiti/examples/taskforms/request.form" />
<sequenceFlow id="flow1" sourceRef="request" targetRef="handleRequest" />
<userTask id="handleRequest" name="Handle vacation request"
activiti:form="org/activiti/examples/taskforms/approve.form" >
<documentation>
Vacation request by ${employeeName}
</documentation>
<potentialOwner>
<resourceAssignmentExpression>
<formalExpression>management</formalExpression>
</resourceAssignmentExpression>
</potentialOwner>
</userTask>
<sequenceFlow id='flow2' sourceRef='handleRequest' targetRef='requestApprovedDecision' />
<exclusiveGateway id="requestApprovedDecision" name="Request approved?" />
<sequenceFlow id='flow3' sourceRef="requestApprovedDecision" targetRef="sendApprovalMail">
<conditionExpression xsi:type="tFormalExpression">${vacationApproved}</conditionExpression>
</sequenceFlow>
<task id="sendApprovalMail" name="Send confirmation e-mail" />
<sequenceFlow id='flow4' sourceRef="sendApprovalMail" targetRef="theEnd1" />
<endEvent id="theEnd1" />
<sequenceFlow id='flow5' sourceRef="requestApprovedDecision" targetRef="adjustVacationRequestTask">
<conditionExpression xsi:type="tFormalExpression">${!vacationApproved}</conditionExpression>
</sequenceFlow>
<userTask id="adjustVacationRequestTask" name="Adjust vacation request"
activiti:form="org/activiti/examples/taskforms/adjustRequest.form">
<documentation>
Your manager has not approved your vacation request.
</documentation>
<humanPerformer>
<resourceAssignmentExpression>
<formalExpression>${employeeName}</formalExpression>
</resourceAssignmentExpression>
</humanPerformer>
</userTask>
<sequenceFlow id='flow6' sourceRef="adjustVacationRequestTask" targetRef="resendRequestDecision" />
<exclusiveGateway id="resendRequestDecision" name="Resend request?" />
<sequenceFlow id='flow7' sourceRef="resendRequestDecision" targetRef="handleRequest">
<conditionExpression xsi:type="tFormalExpression">${resendRequest}</conditionExpression>
</sequenceFlow>
<sequenceFlow id='flow8' sourceRef="resendRequestDecision" targetRef="theEnd2">
<conditionExpression xsi:type="tFormalExpression">${!resendRequest}</conditionExpression>
</sequenceFlow>
<endEvent id="theEnd2" />
</process>
</definitions>
<h1>Adjust vacation Request</h1>
<p>
Your manager has disapproved your vacation request for ${numberOfDays} days. <br/>
Reason: ${managerMotivation}
</p>
<p>
<table>
<tr>
<td>
<label>
Number of days:<br/>
<input type="text" name="numberOfDays" value="${numberOfDays}" />
<input type="hidden" name="numberOfDays_type" value="Integer" />
</label>
</td>
</tr>
<tr>
<td>
<label>
<input type="checkbox" name="vacationPay"/> Vacation pay requested
<input type="hidden" name="vacationPay_boolean" value="${vacationPay}"/>
</label>
</td>
</tr>
<tr>
<td>
<label>
Motivation:<br/>
<textarea name="vacationMotivation" value=""></textarea>
</label>
</td>
</tr>
<tr>
<td>
Resend vacation request to manager?<br/>
<input type="radio" name="resendRequest" value="true" checked>Yes<br/>
<input type="radio" name="resendRequest" value="false">No
<input type="hidden" name="resendRequest_type" value="Boolean"/>
</td>
<tr>
</table>
</p>
<h1>Vacation Approval</h1>
<p>
${employeeName} would like to take ${numberOfDays} day(s) of vacation.
</p>
<p>
Motivation: ${vacationMotivation}
</p>
<p>
Do you approve this?
<select name="vacationApproved">
<option value="true">Yes</option>
<option value="false">No</option>
</select>
<input type="hidden" name="vacationApproved_type" value="Boolean" />
</p>
<p>
<label>
Motivation:<br/>
<textarea name="managerMotivation" value=""></textarea>
</label>
</p>
\ No newline at end of file
<h1>Vacation Request</h1>
<table>
<tr>
<td>
<label>
Employee Name:<br/>
<input type="text" name="employeeName" value="" />
<input type="hidden" name="employeeName_required" value="true" />
</label><br/>
</td>
</tr>
<tr>
<td>
<label>
Number of days:<br/>
<input type="text" name="numberOfDays" value="1" />
<input type="hidden" name="numberOfDays_type" value="Integer" />
</label>
</td>
</tr>
<tr>
<td>
<label>
<input type="checkbox" name="vacationPay"/> Vacation pay requested
<input type="hidden" name="vacationPay_boolean" value="true"/>
</label>
</td>
</tr>
<tr>
<td>
<label>
Motivation:<br/>
<textarea name="vacationMotivation" value=""></textarea>
</label>
</td>
</tr>
</table>
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="taskAssigneeExample"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://www.activiti.org/bpmn2.0">
<process id='taskAssigneeProcess' name="Task Assignee example">
<startEvent id='theStart' />
<sequenceFlow id='flow1' sourceRef='theStart' targetRef='theTask' />
<userTask id='theTask' name='Schedule meeting' >
<documentation>
Schedule an engineering meeting for next week with the new hire.
</documentation>
<humanPerformer>
<resourceAssignmentExpression>
<formalExpression>kermit</formalExpression>
</resourceAssignmentExpression>
</humanPerformer>
</userTask>
<sequenceFlow id='flow2' sourceRef='theTask' targetRef='theEnd' />
<endEvent id='theEnd' />
</process>
</definitions>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>activiti-engine-init</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<name>Activiti - Engine - Init</name>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine-init</artifactId>
<packaging>war</packaging>
<parent>
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.0.alpha3-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.impl.servlet;
import java.io.IOException;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.activiti.ProcessEngine;
import org.activiti.ProcessEngines;
/**
* @author Tom Baeyens
*/
public class ProcessEnginesServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
public void init() throws ServletException {
ProcessEngines.init();
}
@Override
public void destroy() {
ProcessEngines.destroy();
}
// the next is commented as that should become part of the probe app
//
// @Override
// protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// response.setContentType("text/html");
// ServletOutputStream out = response.getOutputStream();
// out.println("<html>");
// out.println("<body>");
// out.println("<h1>Activiti Version</h1>");
// out.println("<p>"+ProcessEngine.VERSION+"</p>");
// out.println("<h1>Process Engines</h1>");
// Map<String, ProcessEngine> processEngines = ProcessEngines.getProcessEngines();
// if (processEngines.isEmpty()) {
// out.println("<p>No successful initialized process engine available</p>");
// } else {
// for (String processEngineName : processEngines.keySet()) {
// out.println("<p>");
// out.println(processEngineName == null ? "The default process engine" : processEngineName);
// out.println("</p>");
// }
// }
// out.println("<h1>Initialization errors</h1>");
// Map<String, String> errors = ProcessEngines.getErrors();
// if (errors.isEmpty()) {
// out.println("<p>All configured process engines are successfully initialized</p>");
// } else {
// for(String resourceUrl : errors.keySet()) {
// out.println("<b>"+resourceUrl+"</b>");
// out.println("<pre>"+errors.get(resourceUrl)+"</pre>");
// }
// }
// out.println("</body>");
// out.println("</html>");
// out.flush();
// }
}
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
handlers = org.apache.juli.FileHandler
.level = FINEST
org.apache.juli.FileHandler.level = FINEST
org.apache.juli.FileHandler.directory = ${catalina.base}/logs
org.apache.juli.FileHandler.prefix = activiti.
org.apache.juli.FileHandler.formatter=org.activiti.impl.util.LogUtil$LogFormatter
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Activiti Engine Initializer</display-name>
<servlet>
<servlet-name>ProcessEnginesServlet</servlet-name>
<servlet-class>org.activiti.impl.servlet.ProcessEnginesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ProcessEnginesServlet</servlet-name>
<url-pattern>/processengines</url-pattern>
</servlet-mapping>
</web-app>
<html>
<body>
<h2>Activiti Engine Initializer</h2>
<p>Initializes the Activiti runtime and its engines</p>
</body>
</html>
<?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.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>activiti-engine-test-api</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<name>Activiti - Engine - Test - API</name>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine-test-api</artifactId>
<parent>
<groupId>org.activiti</groupId>
<artifactId>activiti-root</artifactId>
<relativePath>../..</relativePath>
<version>5.0.alpha3-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<excludes>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.test.bpmn;
import org.activiti.ProcessInstance;
import org.activiti.test.ActivitiTestCase;
/**
* @author Joram Barrez
*/
public class StartToEndTest extends ActivitiTestCase {
public void testStartToEnd() {
deployProcessForThisTestMethod();
ProcessInstance processInstance = processService.startProcessInstanceByKey("startToEnd");
assertProcessInstanceEnded(processInstance.getId());
assertTrue(processInstance.isEnded());
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.test.bpmn.event.timer;
import java.util.Date;
import java.util.List;
import org.activiti.Job;
import org.activiti.JobQuery;
import org.activiti.ProcessInstance;
import org.activiti.Task;
import org.activiti.impl.time.Clock;
import org.activiti.test.ActivitiTestCase;
/**
* @author jbarrez
*/
public class BoundaryTimerEventTest extends ActivitiTestCase {
/*
* Test for when multiple boundary timer events are defined on the same user task
*
* Configuration:
* - timer 1 -> 2 hours -> secondTask
* - timer 2 -> 1 hour -> thirdTask
* - timer 3 -> 3 hours -> fourthTask
*/
public void testMultipleTimersOnUserTask() {
deployProcessForThisTestMethod();
// Set the clock to time '0'
Clock.setCurrentTime(new Date(0L));
// After process start, there should be 3 timers created
ProcessInstance pi = processService.startProcessInstanceByKey("multipleTimersOnUserTask");
JobQuery jobQuery = managementService.createJobQuery().processInstanceId(pi.getId());
List<Job> jobs = jobQuery.list();
assertEquals(3, jobs.size());
// After setting the clock to time '1 hour and 5 seconds', the second timer should fire
Clock.setCurrentTime(new Date( (60 * 60 * 1000) + 5000));
waitForJobExecutorToProcessAllJobs(5000L, 25L);
assertEquals(0L, jobQuery.count());
// which means that the third task is reached
Task task = taskService.createTaskQuery().singleResult();
assertEquals("Third Task", task.getName());
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.test.bpmn.gateway;
import org.activiti.ActivitiException;
import org.activiti.ProcessInstance;
import org.activiti.test.ActivitiTestCase;
import org.activiti.util.CollectionUtil;
/**
* @author Joram Barrez
*/
public class ExclusiveGatewayTest extends ActivitiTestCase {
public void testDivergingExclusiveGateway() {
deployProcessForThisTestMethod();
for (int i =1 ; i<=3; i++) {
ProcessInstance pi = processService.startProcessInstanceByKey("exclusiveGwDiverging", CollectionUtil.singletonMap("input", i));
assertEquals("Task " + i, taskService.createTaskQuery().singleResult().getName());
processService.deleteProcessInstance(pi.getId());
}
}
public void testMergingExclusiveGateway() {
deployProcessForThisTestMethod();
processService.startProcessInstanceByKey("exclusiveGwMerging");
assertEquals(3, taskService.createTaskQuery().count());
}
// If there are multiple outgoing seqFlow with valid conditions, the first defined one should be chosen.
public void testMultipleValidConditions() {
deployProcessForThisTestMethod();
processService.startProcessInstanceByKey("exclusiveGwMultipleValidConditions", CollectionUtil.singletonMap("input", 5));
assertEquals("Task 2", taskService.createTaskQuery().singleResult().getName());
}
public void testNoSequenceFlowSelected() {
deployProcessForThisTestMethod();
try {
processService.startProcessInstanceByKey("exclusiveGwNoSeqFlowSelected", CollectionUtil.singletonMap("input", 4));
fail();
} catch (ActivitiException e) {
assertTextPresent("No outgoing sequence flow of the exclusive gateway " +
"'exclusiveGw' could be selected for continuing the process", e.getMessage());
}
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.test.bpmn.parse;
import org.activiti.ActivitiException;
import org.activiti.test.ActivitiTestCase;
/**
* Test case for verifying if the parser throws validation exceptions
* when a process definition is given that is not conform the BPMN 2.0 schemas.
*
* @author Joram Barrez
*/
public class InvalidProcessTest extends ActivitiTestCase {
public void testInvalidProcessDefinition() {
try {
deployProcessForThisTestMethod();
} catch (ActivitiException e) {
assertTextPresent("Attribute 'invalidAttribute' is not allowed to appear in element 'process'",
e.getMessage());
}
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.test.bpmn.property;
import java.io.Serializable;
/**
* Test object used in various unit test.
*
* @author Joram Barrez
*/
public class Order implements Serializable {
private static final long serialVersionUID = 1L;
private String address;
public Order() {
}
public Order(String address) {
this.address = address;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
\ No newline at end of file
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.test.bpmn.property;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.activiti.Execution;
import org.activiti.ProcessInstance;
import org.activiti.test.ActivitiTestCase;
/**
* @author Joram Barrez
*/
public class PropertyTest extends ActivitiTestCase {
public void testUserTaskSrcProperty() {
deployProcessForThisTestMethod();
// Start the process -> waits in usertask
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("inputVar", "test");
ProcessInstance pi = processService.startProcessInstanceByKey("testUserTaskSrcProperty", vars);
// 1 task should be active, and since the task is scoped 1 child execution should exist
assertNotNull(taskService.createTaskQuery().singleResult());
List<Execution> childExecutions = processService.findChildExecutions(pi.getId());
assertEquals(1, childExecutions.size());
// The scope at the task should be able to see the 'myVar' variable,
// but the process instance shouldn't be able to see it
Execution childExecution = childExecutions.get(0);
assertEquals("test", processService.getVariable(childExecution.getId(), "myVar"));
assertNull(processService.getVariable(pi.getId(), "myVar"));
// The variable 'inputVar' should be visible for both
assertEquals("test", processService.getVariable(childExecution.getId(), "inputVar"));
assertEquals("test", processService.getVariable(pi.getId(), "inputVar"));
// Change the value of variable 'myVar' on the task scope
processService.setVariable(childExecution.getId(), "myVar", "new_value");
assertEquals("new_value", processService.getVariable(childExecution.getId(), "myVar"));
assertEquals("test", processService.getVariable(childExecution.getId(), "inputVar"));
assertNull(processService.getVariable(pi.getId(), "myVar"));
// When the task completes, the variable 'myVar' is destroyed
taskService.complete(taskService.createTaskQuery().singleResult().getId());
for (Execution execution : processService.findChildExecutions(pi.getId())) {
assertNull(processService.getVariable(execution.getId(), "myVar"));
}
}
public void testUserTaskSrcExprProperty() {
deployProcessForThisTestMethod();
// Start the process -> waits in usertask
final String address = "TestStreet 123 90210 Beverly-Hills";
Order order = new Order(address);
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("order", order);
ProcessInstance pi = processService.startProcessInstanceByKey("testUserTaskSrcExprProperty", vars);
// The execution at the task should be able to see the 'orderAddress' variable,
// but the process instance shouldn't be able to see it
List<Execution> childExecutions = processService.findChildExecutions(pi.getId());
String childExecutionId = childExecutions.get(0).getId();
assertEquals(address, processService.getVariable(childExecutionId, "orderAddress"));
assertNull(processService.getVariable(pi.getId(), "orderAddress"));
// Completing the task removes the 'orderAddress' variable
taskService.complete(taskService.createTaskQuery().singleResult().getId());
assertNull(processService.getVariable(pi.getId(), "orderAddress"));
assertNotNull(processService.getVariable(pi.getId(), "order"));
}
public void testUserTaskDstProperty() {
deployProcessForThisTestMethod();
ProcessInstance pi = processService.startProcessInstanceByKey("testUserTaskDstProperty");
List<Execution> childExecutions = processService.findChildExecutions(pi.getId());
String childExecutionId = childExecutions.get(0).getId();
// The execution at the task should be able to see the 'taskVar' variable,
Map<String, Object> vars = processService.getVariables(childExecutionId);
assertEquals(1, vars.size());
assertTrue(vars.containsKey("taskVar"));
// but the process instance shouldn't be able to see it
assertTrue(processService.getVariables(pi.getId()).isEmpty());
// Setting the 'taskVar' value and completing the task should push the value into 'processVar'
processService.setVariable(childExecutionId, "taskVar", "myValue");
taskService.complete(taskService.createTaskQuery().singleResult().getId());
vars = processService.getVariables(pi.getId());
assertEquals(1, vars.size());
assertTrue(vars.containsKey("processVar"));
}
public void NOTYETIMPLEMENTEDtestUserTaskDstExprProperty() {
deployProcessForThisTestMethod();
Order order = new Order();
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("order", order);
ProcessInstance pi = processService.startProcessInstanceByKey("testUserTaskDstExprProperty", vars);
List<Execution> childExecutions = processService.findChildExecutions(pi.getId());
String childExecutionId = childExecutions.get(0).getId();
// The execution at the task should be able to see the 'orderAddress' variable,
vars = processService.getVariables(childExecutionId);
assertEquals(1, vars.size());
assertTrue(vars.containsKey("orderAddress"));
// but the process instance shouldn't be able to see it
vars = processService.getVariables(pi.getId());
assertEquals(1, vars.size());
assertTrue(vars.containsKey("order"));
// Setting the 'orderAddress' value and completing the task should push the value into order object
processService.setVariable(childExecutionId, "orderAddress", "testAddress");
taskService.complete(taskService.createTaskQuery().singleResult().getId());
assertEquals(1, processService.getVariables(pi.getId()).size());
Order orderAfterComplete = (Order) processService.getVariable(pi.getId(), "order");
assertEquals("testAddress", orderAfterComplete.getAddress());
}
public void testUserTaskLinkProperty() {
deployProcessForThisTestMethod();
// Start the process -> waits in usertask
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("inputVar", "test");
ProcessInstance pi = processService.startProcessInstanceByKey("testUserTaskLinkProperty", vars);
// Variable 'taskVar' should only be visible for the task scoped execution
Execution childExecution = processService.findChildExecutions(pi.getId()).get(0);
assertEquals("test", processService.getVariable(childExecution.getId(), "taskVar"));
assertEquals("test", processService.getVariable(childExecution.getId(), "inputVar"));
// Change the value of variable 'taskVar' on the task scope
String taskScopedExecutionId = childExecution.getId();
processService.setVariable(taskScopedExecutionId, "taskVar", "new_value");
assertEquals("new_value", processService.getVariable(taskScopedExecutionId, "taskVar"));
assertEquals("test", processService.getVariable(taskScopedExecutionId, "inputVar"));
assertNull(processService.getVariable(pi.getId(), "taskVar"));
// Completing the task copies the value of 'taskVar' into 'inputVar'
taskService.complete(taskService.createTaskQuery().singleResult().getId());
assertTrue(processService.findChildExecutions(pi.getId()).isEmpty()); // second task is not scoped
assertNull(processService.findExecutionById(taskScopedExecutionId));
assertNull(processService.getVariable(pi.getId(), "taskVar"));
assertEquals("new_value", processService.getVariable(pi.getId(), "inputVar"));
}
// public void testUserTaskLinkExprProperty() {
// deployProcessForThisTestMethod();
//
// // Start the process -> waits in usertask
// Map<String, Object> address = new HashMap<String, Object>();
// address.put("Street", "Broadway");
// address.put("City", "New York");
//
// Map<String, Object> variables = new HashMap<String, Object>();
// variables.put("address", address);
// ProcessInstance pi = processService.startProcessInstanceByKey("testUserTaskLinkExprProperty", variables);
//
// // Variable 'taskVar' should only be visible for the task scoped execution
// Execution childExecution = processService.findChildExecutions(pi.getId()).get(0);
// assertEquals("test", processService.getVariable(childExecution.getId(), "taskVar"));
// assertEquals("test", processService.getVariable(childExecution.getId(), "inputVar"));
//
// // Change the value of variable 'taskVar' on the task scope
// String taskScopedExecutionId = childExecution.getId();
// processService.setVariable(taskScopedExecutionId, "taskVar", "new_value");
// assertEquals("new_value", processService.getVariable(taskScopedExecutionId, "taskVar"));
// assertEquals("test", processService.getVariable(taskScopedExecutionId, "inputVar"));
// assertNull(processService.getVariable(pi.getId(), "taskVar"));
//
// // Completing the task copies the value of 'taskVar' into 'inputVar'
// taskService.complete(taskService.createTaskQuery().singleResult().getId());
// assertTrue(processService.findChildExecutions(pi.getId()).isEmpty()); // second task is not scoped
// assertNull(processService.findExecutionById(taskScopedExecutionId));
// assertNull(processService.getVariable(pi.getId(), "taskVar"));
// assertEquals("new_value", processService.getVariable(pi.getId(), "inputVar"));
// }
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.test.bpmn.servicetask;
/**
* @author Joram Barrez
*/
public class Counter {
public static int COUNTER = 0;
public void increment() {
COUNTER++;
}
public void decrement() {
COUNTER--;
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.test.bpmn.servicetask;
import org.activiti.test.ActivitiTestCase;
/**
* @author Joram Barrez
*/
public class JavaServiceTaskTest extends ActivitiTestCase {
public void testJavaServiceNoParamsOrResult() {
deployProcessForThisTestMethod();
processService.startProcessInstanceByKey("javaServiceNoParamsOrResult");
assertEquals(1, Counter.COUNTER);
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.test.bpmn.usertask;
import java.util.List;
import org.activiti.ActivitiException;
import org.activiti.Task;
import org.activiti.TaskQuery;
import org.activiti.test.ActivitiTestCase;
/**
* Testcase for the non-spec extensions to the task candidate use case.
*
* @author Joram Barrez
*/
public class TaskAssignmentExtensionsTest extends ActivitiTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
identityService.saveUser(identityService.newUser("kermit"));
identityService.saveUser(identityService.newUser("gonzo"));
identityService.saveUser(identityService.newUser("fozzie"));
identityService.saveGroup(identityService.newGroup("management"));
identityService.saveGroup(identityService.newGroup("accountancy"));
identityService.createMembership("kermit", "management");
identityService.createMembership("kermit", "accountancy");
identityService.createMembership("fozzie", "management");
}
@Override
protected void tearDown() throws Exception {
identityService.deleteGroup("accountancy");
identityService.deleteGroup("management");
identityService.deleteUser("fozzie");
identityService.deleteUser("gonzo");
identityService.deleteUser("kermit");
super.tearDown();
}
public void testAssigneeExtension() {
deployProcessForThisTestMethod();
processService.startProcessInstanceByKey("assigneeExtension");
List<Task> tasks = taskService.findAssignedTasks("kermit");
assertEquals(1, tasks.size());
assertEquals("my task", tasks.get(0).getName());
}
public void testDuplicateAssigneeDeclaration() {
try {
deployProcessForThisTestMethod();
fail("Duplicate assignee declaration should throw an exception");
} catch (ActivitiException e) {
assertTextPresent("duplicate assignee declaration", e.getMessage());
}
}
public void testCandidateUsersExtension() {
deployProcessForThisTestMethod();
processService.startProcessInstanceByKey("candidateUsersExtension");
List<Task> tasks = taskService.findUnassignedTasks("kermit");
assertEquals(1, tasks.size());
tasks = taskService.findUnassignedTasks("gonzo");
assertEquals(1, tasks.size());
}
public void testCandidateGroupsExtension() {
deployProcessForThisTestMethod();
processService.startProcessInstanceByKey("candidateGroupsExtension");
// Bugfix check: potentially the query could return 2 tasks since
// kermit is a member of the two candidate groups
List<Task> tasks = taskService.findUnassignedTasks("kermit");
assertEquals(1, tasks.size());
assertEquals("make profit", tasks.get(0).getName());
tasks = taskService.findUnassignedTasks("fozzie");
assertEquals(1, tasks.size());
assertEquals("make profit", tasks.get(0).getName());
// Test the task query find-by-candidate-group operation
TaskQuery query = taskService.createTaskQuery();
assertEquals(1, query.candidateGroup("management").count());
assertEquals(1, query.candidateGroup("accountancy").count());
}
// Test where the candidate user extension is used together
// with the spec way of defining candidate users
public void testMixedCandidateUserDefinition() {
deployProcessForThisTestMethod();
processService.startProcessInstanceByKey("mixedCandidateUser");
List<Task> tasks = taskService.findUnassignedTasks("kermit");
assertEquals(1, tasks.size());
tasks = taskService.findUnassignedTasks("fozzie");
assertEquals(1, tasks.size());
tasks = taskService.findUnassignedTasks("gonzo");
assertEquals(1, tasks.size());
tasks = taskService.findUnassignedTasks("mispiggy");
assertEquals(0, tasks.size());
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.test.db;
import org.activiti.ActivitiException;
import org.activiti.Deployment;
import org.activiti.test.ActivitiTestCase;
/**
* @author Joram Barrez
*/
public class DbNotCleanTest extends ActivitiTestCase {
public void testDbNotCleanAfterTest() {
Deployment deployment =
processEngine.getProcessService()
.newDeployment()
.addString("test.bpmn20.xml", "<definitions xmlns='http://www.omg.org/spec/BPMN/20100524/MODEL' " +
"targetNamespace='http://www.activiti.org/bpmn2.0' />")
.deploy();
assertNotNull(deployment);
// Manually call the check on db cleaning check
try {
checkDbIsClean();
fail("Exception expected");
} catch (ActivitiException e) {
assertExceptionMessage("Database not clean", e);
}
// Registering the deployment will clean it up in the 'real' tearDown
registerDeployment(deployment.getId());
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.test.deploy;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import org.activiti.Deployment;
import org.activiti.impl.util.IoUtil;
import org.activiti.test.ActivitiTestCase;
/**
* @author Tom Baeyens
* @author Joram Barrez
*/
public class DeploymentTest extends ActivitiTestCase {
private static final String TO_REPLACE = "to_replace";
private static final String MINIMAL_PROC_DEF =
"<definitions xmlns='http://www.omg.org/spec/BPMN/20100524/MODEL' " +
" targetNamespace='http://www.activiti.org/bpmn2.0' >" +
" <process id='" + TO_REPLACE + "' />" +
"</definitions>";
public void testSimpleString() {
deployProcessString("<definitions xmlns='http://www.omg.org/spec/BPMN/20100524/MODEL' " +
"targetNamespace='http://www.activiti.org/bpmn2.0' />");
}
public void testMultipleStringResources() throws Exception {
List<String> deploymentIds = deployTestProcesses();
List<Deployment> deployments = processService.findDeployments();
assertEquals(3, deployments.size());
// Results should be ordered by deployment time
assertEquals("idrDeployment", deployments.get(0).getName());
assertEquals("expenseDeployment", deployments.get(1).getName());
assertEquals("hiringDeployment", deployments.get(2).getName());
// Resources should be ordered by name
String deploymentId = deploymentIds.get(0);
List<String> resources = processService.findDeploymentResources(deploymentId);
assertEquals(2, resources.size());
assertEquals("idr_process01.bpmn20.xml", resources.get(0));
assertEquals("idr_process02.bpmn20.xml", resources.get(1));
// Validate the content of the deployment resources
InputStream resourceIs = processService.getDeploymentResourceContent(deploymentId, resources.get(0));
assertEquals(MINIMAL_PROC_DEF.replace(TO_REPLACE, "IDR1"),
new String(IoUtil.readInputStream(resourceIs, null)));
resourceIs.close();
resourceIs = processService.getDeploymentResourceContent(deploymentId, resources.get(1));
assertEquals(MINIMAL_PROC_DEF.replace(TO_REPLACE, "IDR2"),
new String(IoUtil.readInputStream(resourceIs, null)));
resourceIs.close();
// Clean up
deleteDeploymentsCascade(deploymentIds);
}
/*
* Deploys two test processes:
* - one deployment called 'idrDeployment' with two bpmn processes
* - one deployment called 'expenseDeployment' with one bpmn process
* - one deployment called 'hiringDeployment' with three bpmn processes
*
* The list that is returned contains the ids of the deployments,
* in the order as defined above.
*/
private List<String> deployTestProcesses() {
final String idrDeploymentName = "idrDeployment";
final String expenseDeploymentName = "expenseDeployment";
final String hiringDeploymentName = "hiringDeployment";
Deployment deployment1 =
processService.newDeployment()
.name(idrDeploymentName)
.addString("idr_process01.bpmn20.xml", MINIMAL_PROC_DEF.replace(TO_REPLACE, "IDR1"))
.addString("idr_process02.bpmn20.xml", MINIMAL_PROC_DEF.replace(TO_REPLACE, "IDR2"))
.deploy();
Deployment deployment2 =
processService.newDeployment()
.name(expenseDeploymentName)
.addString("expense_proc.bpmn20.xml", MINIMAL_PROC_DEF.replace(TO_REPLACE, "EXP"))
.deploy();
Deployment deployment3 =
processService.newDeployment()
.name(hiringDeploymentName)
.addString("hiring_process.bpmn20.xml", MINIMAL_PROC_DEF.replace(TO_REPLACE, "HIR"))
.addString("hiring_remote_employee.bpmn20.xml", MINIMAL_PROC_DEF.replace(TO_REPLACE, "HIR_REM"))
.addString("hiring_process_sales.bpmn20.xml", MINIMAL_PROC_DEF.replace(TO_REPLACE, "HIR_SAL"))
.deploy();
assertEquals(idrDeploymentName, deployment1.getName());
assertEquals(expenseDeploymentName, deployment2.getName());
return Arrays.asList(deployment1.getId(), deployment2.getId(), deployment3.getId());
}
}
/**
*
*/
package org.activiti.test.jobexecutor;
import org.activiti.impl.ProcessEngineImpl;
import org.activiti.impl.cmd.DeleteJobsCmd;
import org.activiti.impl.interceptor.Command;
import org.activiti.impl.interceptor.CommandContext;
import org.activiti.impl.interceptor.CommandExecutor;
import org.activiti.impl.job.MessageImpl;
import org.activiti.test.ActivitiTestCase;
/**
* @author tombaeyens
*
*/
public class JobExecutorCmdExceptionTest extends ActivitiTestCase {
protected TweetExceptionHandler tweetExceptionHandler = new TweetExceptionHandler();
protected void setUp() throws Exception {
super.setUp();
ProcessEngineImpl processEngineImpl = (ProcessEngineImpl)processEngine;
processEngineImpl
.getProcessEngineConfiguration()
.getJobCommands()
.addJobHandler(tweetExceptionHandler);
}
protected void tearDown() throws Exception {
ProcessEngineImpl processEngineImpl = (ProcessEngineImpl)processEngine;
processEngineImpl
.getProcessEngineConfiguration()
.getJobCommands()
.removeJobHandler(tweetExceptionHandler);
super.tearDown();
}
public void testJobCommandsWith2Exceptions() {
ProcessEngineImpl processEngineImpl = (ProcessEngineImpl)processEngine;
CommandExecutor commandExecutor = processEngineImpl.getProcessEngineConfiguration().getCommandExecutor();
commandExecutor.execute(new Command<String>() {
public String execute(CommandContext commandContext) {
MessageImpl message = createTweetExceptionMessage();
commandContext.getMessageSession().send(message);
return message.getId();
}
});
waitForJobExecutorToProcessAllJobs(8000, 250);
}
public void testJobCommandsWith3Exceptions() {
tweetExceptionHandler.setExceptionsRemaining(3);
ProcessEngineImpl processEngineImpl = (ProcessEngineImpl)processEngine;
CommandExecutor commandExecutor = processEngineImpl.getProcessEngineConfiguration().getCommandExecutor();
String jobId = commandExecutor.execute(new Command<String>() {
public String execute(CommandContext commandContext) {
MessageImpl message = createTweetExceptionMessage();
commandContext.getMessageSession().send(message);
return message.getId();
}
});
waitForJobExecutorToProcessAllJobs(8000, 250);
// TODO check if there is a failed job in the DLQ
commandExecutor.execute(new DeleteJobsCmd(jobId));
}
protected MessageImpl createTweetExceptionMessage() {
MessageImpl message = new MessageImpl();
message.setJobHandlerType("tweet-exception");
return message;
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti.test.jobexecutor;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.activiti.impl.ProcessEngineImpl;
import org.activiti.impl.interceptor.Command;
import org.activiti.impl.interceptor.CommandContext;
import org.activiti.impl.interceptor.CommandExecutor;
import org.activiti.impl.job.MessageImpl;
import org.activiti.impl.job.TimerImpl;
import org.activiti.impl.jobexecutor.AcquireJobsCmd;
import org.activiti.impl.jobexecutor.AcquiredJobs;
import org.activiti.impl.jobexecutor.ExecuteJobsCmd;
import org.activiti.impl.time.Clock;
/**
* @author Tom Baeyens
*/
public class JobExecutorCmdHappyTest extends JobExecutorTestCase {
public void testJobCommandsWithMessage() {
ProcessEngineImpl processEngineImpl = (ProcessEngineImpl)processEngine;
CommandExecutor commandExecutor = processEngineImpl.getProcessEngineConfiguration().getCommandExecutor();
String jobId = commandExecutor.execute(new Command<String>() {
public String execute(CommandContext commandContext) {
MessageImpl message = createTweetMessage("i'm coding a test");
commandContext.getMessageSession().send(message);
return message.getId();
}
});
AcquiredJobs acquiredJobs = commandExecutor.execute(new AcquireJobsCmd());
List<List<String>> jobIdsList = acquiredJobs.getJobIdsList();
assertEquals(1, jobIdsList.size());
List<String> jobIds = jobIdsList.get(0);
List<String> expectedJobIds = new ArrayList<String>();
expectedJobIds.add(jobId);
assertEquals(expectedJobIds, new ArrayList<String>(jobIds));
assertEquals(0, tweetHandler.getMessages().size());
commandExecutor.execute(new ExecuteJobsCmd(jobId));
assertEquals("i'm coding a test", tweetHandler.getMessages().get(0));
assertEquals(1, tweetHandler.getMessages().size());
}
static final long SOME_TIME = 928374923546L;
static final long SECOND = 1000;
public void testJobCommandsWithTimer() {
// clock gets automatically reset in LogTestCase.runTest
Clock.setCurrentTime(new Date(SOME_TIME));
ProcessEngineImpl processEngineImpl = (ProcessEngineImpl)processEngine;
CommandExecutor commandExecutor = processEngineImpl.getProcessEngineConfiguration().getCommandExecutor();
String jobId = commandExecutor.execute(new Command<String>() {
public String execute(CommandContext commandContext) {
TimerImpl timer = createTweetTimer("i'm coding a test", new Date(SOME_TIME + (10*SECOND)));
commandContext.getTimerSession().schedule(timer);
return timer.getId();
}
});
AcquiredJobs acquiredJobs = commandExecutor.execute(new AcquireJobsCmd());
List<List<String>> jobIdsList = acquiredJobs.getJobIdsList();
assertEquals(0, jobIdsList.size());
List<String> expectedJobIds = new ArrayList<String>();
Clock.setCurrentTime(new Date(SOME_TIME + (20*SECOND)));
acquiredJobs = commandExecutor.execute(new AcquireJobsCmd());
jobIdsList = acquiredJobs.getJobIdsList();
assertEquals(1, jobIdsList.size());
List<String> jobIds = jobIdsList.get(0);
expectedJobIds.add(jobId);
assertEquals(expectedJobIds, new ArrayList<String>(jobIds));
assertEquals(0, tweetHandler.getMessages().size());
commandExecutor.execute(new ExecuteJobsCmd(jobId));
assertEquals("i'm coding a test", tweetHandler.getMessages().get(0));
assertEquals(1, tweetHandler.getMessages().size());
}
}
database=h2
jdbc.driver=org.h2.Driver
jdbc.url=jdbc:h2:mem:activiti
jdbc.username=sa
jdbc.password=
db.schema.strategy=create-drop
job.executor.auto.activate=off
handlers = java.util.logging.ConsoleHandler
.level = FINE
java.util.logging.ConsoleHandler.level=FINEST
java.util.logging.ConsoleHandler.formatter=org.activiti.impl.util.LogUtil$LogFormatter
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schema.omg.org/spec/BPMN/2.0 BPMN20.xsd"
typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://www.activiti.org/bpmn2.0">
<process id='startToEnd'>
<startEvent id='theStart' />
<sequenceFlow id='flow1' sourceRef='theStart' targetRef='theEnd' />
<endEvent id='theEnd' />
</process>
</definitions>
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册