Task 4: Fixing the problem and redeploying the ruleset

You find and fix an error, and then deploy the corrected ruleset. You verify that your application works correctly.

About this task

Step 1: Correcting the bug in the ruleset

You can change the order in which rules are run. In this step, you correct the bug in the ruleset by changing the rule order so that the rate rule is run before the repayment rule.

Procedure

  1. In Rule Designer, switch to the Rule perspective.
  2. In the Rule Explorer, expand loanvalidation-rules/rules, and open the computation package. Then, double-click the repayment rule.
  3. In the Intellirule editor, add the following lines after the last definition:
    if
       the yearly interest rate of 'the loan' is more than 0
    
  4. Click File > Save.
    Image shows the repayment business rule.

Step 2: Deploying the corrected ruleset to Rule Execution Server

After you correct the ruleset, you must deploy it to Rule Execution Server.

Procedure

  1. Open the loanvalidation_debugging deployment configuration under the loanvalidation_rules project deployment folder.
  2. On the Overview page, click Proceed to RuleApp deployment in the Deployment section.
  3. Click Next repeatedly, until you reach the summary page. Notice that the RuleSet New Version number changed from 1.0 to 1.1.
    Image shows the version number.
  4. Click Finish. The deployment report opens, and shows that the deployment was successful.

Step 3: Verifying the RuleApp update in the Rule Execution Server console

After you deploy the correct ruleset, you check the updated RuleApp in the Rule Execution Server console.

Procedure

  1. Open the Rule Execution Server console.
  2. In the Navigator panel, click RuleApps  > /loanvalidation_debugging/1.0/.

    The loanvalidation_debugging RuleApp View is displayed.

    Image shows the loanvalidation RuleApp view.

    The RuleApp now contain two versions of the ruleset:

    • 1.0: The one that you debugged.
    • 1.1: The one that you just deployed, and which contains the fix.

Step 4: Verifying the execution with the REST execution

After you deploy the correct ruleset, you check the updated RuleApp in the Rule Execution Server console.

Procedure

  1. In the RuleAPP view, click loanvalidation_rulesRuleset 1.1 to open the ruleset view.
  2. In the Ruleset View, click Retrieve HTDS Description File.
  3. Select REST in the Service protocol type field, and select the OpenAPI - JSON format.
  4. Click Test, and wait for the console to generate the default data.
  5. Replace the request contents with the following code:
    {
    "loan": {
    "numberOfMonthlyPayments": 70,
    "startDate": "2016-10-19T17:27:14.000+0000",
    "amount": 100000,
    "loanToValue": 0.7},
    "borrower": {
    "firstName": "Joe",
    "lastName": "Doe",
    "birth": "1987-09-29T01:49:45.000+0000",
    "SSN": {
    "areaNumber": "424",
    "groupCode": "56",
    "serialNumber": "7942"
    },
    "yearlyIncome": 100000,
    "zipCode": "95372",
    "creditScore": 600,
    "latestBankruptcy": {
    "date": "2014-09-18T23:18:33.000+0000",
    "chapter": 3,
    "reason": "Summer loss"
    }
    }
    }
  6. Check the results in the server response. The ruleset fixes the problem, and the loan is approved:
    ...    
    "approved": true,    
    "messages": [      
    "Low risk loan",      
    "Congratulations! Your loan has been approved"
    ],
    ...

Results

You have completed the tutorial. It showed you how to debug a ruleset on a remote server.