DMN Module Code Generation and Test Module
Enterprise Architect also provides a 'Test Module' page, which is a preprocess for integrating DMN with BPMN. The concept is to provide one or more BPMN2.0::DataObject elements, then test if a specified target decision can be evaluated correctly or not.
If any error or exception occurs, you can create an Analyzer Script to debug the code of the DMN Module and Test Client.
After this 'Test Module' process, Enterprise Architect guarantees that the BPMN2.0::DataObject elements will work well with the DMN Module.
You then configure BPSim by loading DataObjects and assigning DMN Module decisions to BPSim Properties, which will be further used as conditions on the Sequence Flows outgoing from a Gateway.
DMN Module: Code Generation
Activate the 'Generate Module' tab of the DMN Simulation window, select the DMN elements you want to generate to the server, specify the file path and language, then click on the .
(Note: For Java, the path has to match the Package structure.)
- Add the elements to the module, then click on the on the toolbar to open the 'DMN Element Selection' dialog
- Click on the decision you want to generate to the server; in this example we select the decision 'Application risk score'
Note: All the dependencies will be selected automatically.
- Generate the DMN Module; give the Java file a Package name, then click on the Generate button
Note: In this example, the Module Path ends with '\com\sparxsystems\dmn', which matches the Package 'com.sparxsystems.dmn'.
- Click on the to access the 'Test Server' page
DMN Server: Test client
If this page was activated from the 'Generate Server' page, the 'DMN Module' field will be filled automatically with the generated DMN Server's path. Otherwise, click the button to browse for a DMN Server file.
Click theto add one or more BPMN2.0 DataObject(s) to the list, choose a decision from the combo box, then click the on the toolbar.
In the System Output window, this message indicates the DMN Server and BPMN2.0 DataObject can work well with each other to evaluate the selected decision.
Running Test Client for DMN Server...
Result : 133.0
The Running completed successfully.
If there are errors, create an Analyzer script by clicking the toolbar button and fix the issue.
Important: This 'Test Module' step is recommended before integrating DMNServer.java to the Enterprise Architect BPSim Execution Engine.
Code Generation & Connect to BPMN
- Run/Debug testing of the Java version of the DMN Server
- Connect the DMN Server with the Enterprise Architect BPSim Execution Engine
Common Errors & Solutions
- Since a DMN expression allows for spaces, in order to clarify the composite Input Data there must be a space before and after the '.' in the expression; for example, 'Applicant data . Age' is valid, whereas 'Applicant data.Age' is not valid
Note that when using the Auto Completion feature this issue will not arise
- 'Run validation' will help you locate most of the modeling issues; run this before simulation and code generation
- Compiling with Java requires full read-write access to the target directory. Compilation will fail if the module path is set to 'C:' or 'C:\Progam Files (x86)'