skip to main content
Corticon Studio: Rule Modeling Guide : Writing Rules to access external data : Enabling Database Access for Rules using root-level Entities : Testing the Rulesheet with Database Access disabled
 

Try Corticon Now
Testing the Rulesheet with Database Access disabled
Testing this Rulesheet without database access is a simple matter of building an Input Ruletest with all necessary data. An example of this is a Ruletest we create against the Cargo.ecore named CargoLoad.ert. Its input data is as shown:
Figure 205. Sample Input Ruletest
Looking at this Input Ruletest, we see a single FlightPlan with its collection of Cargo this collection is what we’re representing with the alias load in our Rulesheet’s Scope section. Each Cargo has a weight value entered.
The four root-level Aircraft entities are also shown. Each one has a maxCargoWeight, which will be compared to the sum of load.weight during rule execution.
Given what we know about rule scope, we can confidently predict that the test data provided in this Input Ruletest will be processed by the Rulesheet because it contains the same scope!
In the following figure, we’ve executed the Test and see that it functioned as expected. Since load.weight sums to 170000 kilograms. and the Aircraft with tailNumber N1004 can only carry 150000 kilograms, we receive a Violation message for that Aircraft and that Aircraft alone. All other Aircraft have maxCargoWeight values of 200000 kilograms or more, so they fail to fire the rule.
Figure 206. Ruletest Violation Message
So far, this behavior is exactly what we have come to expect from rules – they process data of the same scope.
Save the CargoLoad.ert Ruletest