Decision Management

The ODM and DevOps Series - Post 3/4

By Guilhem Molines posted Tue December 15, 2020 03:42 AM

  

The ODM and DevOps Series

Article 3 – Building and testing ODM Decision Artifacts when they are stored in Decision Center

 

This article in the third of the ODM and DevOps series, and will discuss how to compile and test decision artifacts when the choice has been made to stored them in Decision Center.

 

Build automation

In this case, the generation of a RuleApp is performed by the compiler built into Decision Center, and you don’t need to extract out source rules from Decision Center to compile them manually.

Instead you can use the IlrDeploymentFacility java API to specify the RuleApp to generate, as shown here in the sample published here:

odm-tools-dc-ruleapp-extractor

This sample code has been written to use the deployDSRuleAppArchive API, which as the name implies, is targeting a Decision Service. However, a similar API (called deployRuleAppArchive) exists for a Classic Rule Project. Note that both of those APIs work exactly the same way whether the projects are set to use the Classic Rule Engine or the new Decision Engine.

 

Note: you can also achieve the same extraction by using a series of REST API calls instead.

GET /v1/decisionservices
gives the list of the Decision Services
GET /v1/decisionservices/{decisionServiceId}/deployments
gives the list of Deployment Configurations for one of those Decision Service
GET /v1/deployments/{deploymentId}/download
gives the RuleApp matching the selected Deployment Configuration.

 

When you extract a RuleApp as shown above, the rules are compiled with the last version of the eXecution Object Model that was published to Decision Center during the last synchronisation from Rule Designer, supposedly performed by a developer in charge of maintaining consistency. However, should you want to ensure that the XOM used is the exact version that previous steps of your compilation pipeline have generated, then you need to automate an upload of this XOM to Decision Center just prior to generation of the RuleApp. The following code sample shows a way to upload or download from/to Decision Center the XOM of a specific Decision Service:

odm-tools-dc-xom-extractor 

Note: at this moment, there’s no equivalent way to achieve the same XOM upload by combining REST APIs

Testing

If generating a RuleApp can be achieved with Decision Center only, testing of that RuleApp requires that you have also installed an instance of Rule Execution Server.

In Decision Center, make sure to create a Deployment Configuration whose target server is set to that RES instance. This allows testing from within Decision Center. Behind the scene, DC generates the RuleApp of the Decision Service, then sends it over to the RES, along with the Excel spreadsheet containing the test data as defined in a Test Suite. The RES then executes all the tests, and returns a Test Report to Decision Center.

This whole testing process can actually also be triggered by using a series of REST APIs, as follows:

 

GET /v1/decisionservices
gives the list of the Decision Services
GET /v1/decisionservices/{decisionServiceId}/testsuites
gives the list of Test Suites for one of those Decision Service
POST /v1/testsuites/{testSuiteId}/run
requests execution of the selected Test Suite
 

Those steps can thus be packaged as part of a test script, which can then be driven from a Continuous Integration build plan. Note that it requires that the build agent on which the build plan is running can access Decision Center through the network, and that a proper instance of the RES has been set up.

Continue to Article 4 - Deployment, promotion and traceability

0 comments
26 views

Permalink