|
|
pl:dydaktyka:dss:lab2 [2017/10/16 15:47] kkluza [Project and model development] |
pl:dydaktyka:dss:lab2 [2019/06/27 15:50] |
====== Lab 2: Basics of working with Activiti Designer ====== | |
| |
Web Activiti Modeler has several limitations. | |
Activiti Designer in Eclipse environment provides more functionalities, like in the case of additional properties of elements specification. | |
Therefore, we will open our model in Activiti Designer and prepare a jUnit test for it. | |
| |
===== m2e plugin installation ===== | |
| |
If the m2e plugin is not installed in your eclipse environment, please install it from the address: [[http://download.eclipse.org/technology/m2e/releases/Maven Integration for Eclipse]] version 1.4.1. \\ | |
If slf4j plugin is missing as well, you can install them from another repository, e.g., http://www.fuin.org/p2-repository/. \\ | |
After installation, remember to restart Eclipse. | |
| |
===== Project and model development ===== | |
| |
Create a new project in eclipse: | |
**New -> Project...**, następnie **Activiti -> Activiti Project**. | |
| |
Next, add to the project (in **src/main/resources/java**) \\ | |
an empty Activiti diagram (**New->Other..., Activiti -> Activiti Diagram**).\\ | |
Now, design some really simple process model. | |
| |
===== Testing the model ===== | |
| |
Convert the project: **Configure -> Convert to Maven Project**. | |
| |
Click the right mouse button on the project tree | |
and select: | |
**Activiti->Generate unit test**.\\ | |
In ''src/test/java/org/activiti/designer/test'', a JUnit test should be now available. | |
| |
Run the test and check if it passed or failed. | |
| |
<WRAP center round alert 60%> | |
If the test did not pass properly because e.g. not all libraries could be loaded, | |
please adjust the version of Activiti on your computer. \\ | |
To do this, we need to change the version of Actviti to 5.XX \\ (where XX is the correct version) in the 'pom.xml' file. \\ | |
You can also check the configuration file ''activiti.cfg.xml'' describing the Activiti mode. It should be in the directory: ''src/main/resources/''. | |
</WRAP> | |
| |
Using [[http://activiti.org/javadocs/org/activiti/engine/test/ActivitiRule.html|ActivitiRule]], | |
we have access to relevant services that provide interfaces for various functionalities: | |
* **[[http://www.activiti.org/javadocs/org/activiti/engine/RepositoryService.html|RepositoryService]]** -- provides functionality for deployment, query execution, or process removal, | |
* **[[http://www.activiti.org/javadocs/org/activiti/engine/RuntimeService.html|RuntimeService]]** -- provides the interface for starting and executing queries to process instances (including their variables); | |
* **[[http://www.activiti.org/javadocs/org/activiti/engine/IdentityService.html|IdentityService]]** -- provides the authentication interface. | |
* **[[http://activiti.org/javadocs/org/activiti/engine/TaskService.html|TaskService]]** -- provides the interface for managing tasks. | |
* **[[http://activiti.org/javadocs/org/activiti/engine/FormService.html|FormService]]** -- provides the interface for managing forms. | |
| |
<code java> | |
RepositoryService repositoryService = activitiRule.getRepositoryService(); | |
RuntimeService runtimeService = activitiRule.getRuntimeService(); | |
IdentityService identityService = activitiRule.getIdentityService(); | |
TaskService taskService = activitiRule.getTaskService(); | |
FormService formService = activitiRule.getFormService(); | |
</code> | |
| |
| |
| |
| |
| |
| |