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.
Simulate > Decision Analysis > DMN > Open DMN Simulation > Generate Module
DMN Module: Code Generation
On the DMN Simulation window, select the DMN structure you want to generate the module from, in the data entry field of the Toolbar.
Click on the 'Generate Module' tab, and thenon the names of the DMN elements you want to generate to the server.
In the data entry field in the tab toolbar, select the language to generate in, and in the 'Module Path' field click on the icon and browse to the path location to generate the module into (note, for Java the path has to match the Package structure).
Click on the().
When the generation is complete, click on the button to open the 'Test Module' tab for the generated module.
DMN Server: Test Module
When you use the button to select the 'Test Module' tab, the 'DMN Module' field will be filled automatically with the generated DMN Server path of the module you most recently generated on the 'Generate Module' tab. If necessary, on the 'Decision' field click on the drop-down arrow and select the required Decision.
Click on the() in the Toolbar and select one or more (Ctrl+Click) BPMN2.0 DataObject(s) to add to the list in the main panel.
Now click 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:on the toolbar. In the
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 use the script to fix the issue.
Important: This 'Test Module' step is recommended before integrating DMNServer.java with the Enterprise Architect BPSim Execution Engine. See the Integrate a DMN Module Into BPSim for Simulation Help topic.
Code Generation & Connect to BPMN
- Run/Debug tests of the Java version of the DMN Server
- Connect the DMN Server to 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
- Running validation will help you locate most of the modeling issues; do 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 just 'C:' or 'C:\Program Files (x86)'