Automated decision service deployment sample details

You use the command line or Rule Designer to run this sample.

Running this sample

To run this sample from Rule Designer:

  1. In the Rule Explorer view, right-click application and select Run As/Run configurations.
  2. Expand Eclipse Application, select DirectoryDeployment and click Run.
  3. Check the output in the Console view. It might take a while for the console to update.
    ...
    [INFO] RuleApp file written to: workspace]/miniloan-automation/output/DirectoryDeployment.jar
    [INFO] RuleApp build finished with no errors.
    [INFO] Deploying the RuleApp to SampleDirectory ([workspace]/application/result).
    [INFO] RuleApp Deployment
    [INFO] The RuleApp was successfully deployed to SampleDirectory ([workspace]/application/result).
    ...
  4. Press F5 to refresh and expand application/result in the Rule Explorer view. You see the DirectoryDeployment directory. It contains the full RuleApp.
  5. To deploy again to both the directory and the execution server, redo steps 1 and 2, selecting the ServerDeployment configuration.

    The output in the console view contains more lines about the deployment on the server. It might take a while for the console to update.

    ...
    [INFO] Generating the RuleApp.       
    [INFO] RuleApp Build Status
    [INFO] RuleApp file written to:<workspace>\miniloan-automation\output\DirectoryDeployment.jar       
    [INFO] Deploying the RuleApp to Sample (http://localhost:9090/res)
    [INFO] RuleApp Deployment
    [INFO] The RuleApp was successfully deployed to Sample (http://localhost:9090/res)       
    ...
    [INFO] Saving workspace.
  6. In the samples server view, click Rule Execution Server console.
  7. Enter resAdmin as the user name and password. In the Explorer tab, navigate to the RuleApps. You can see that the ServerDeployment RuleApp is deployed.
Run the sample from an Ant target
  1. Open a command window and navigate to the sample directory <InstallDir>/studio/samples/brmanagement/buildautomationtool/application.
  2. Run the following command in this directory: <InstallDir>/shared/tools/ant/bin/ant cleanup. This command removes the previously deployed artifacts.
  3. Run the following command to deploy the RuleApp to the application/result directory: <InstallDir>/shared/tools/ant/bin/ant directoryDeploy.
  4. Run the following command to deploy the RuleApp to the Sample Execution server: <InstallDir>/shared/tools/ant/bin/ant serverDeploy.
  5. Check the results in the Rule Execution Server console.

To clean the artifacts that were created, use the cleanup Ant target by running the following command in this <sample>/application directory: <InstallDir>/shared/tools/ant/bin/ant cleanup.

How this sample works

This sample uses the deployment configurations that are defined in the miniloan-automation decision service. In Rule Designer, expand miniloan-automation/deployment. You can see two deployment configurations: DirectoryDeployment and ServerDeployment. Both configurations use the MiniloanServiceOperation. The ServerDeployment configuration has one target server, named SampleServer. The DirectoryDeployment configuration has one target server, named SampleDirectory. The properties of this server are defined in the application/directory-list.xml file. You must import this file to get the sample server properties.

Two run configurations are defined: DirectoryDeploment and ServerDeployment. Right-click miniloan-automation in Rule Designer and choose Run configurations to open them in Rule Designer. On the Main page, you see that they run the application com.ibm.rules.studio.decisionservice.headless and on Arguments page, you see the program arguments.

Table 1.
Argument Description
importPath The projects to load.
serverFile The path to the server list file.
<projectname>?<deploymentConfiguration The configuration to be built and deployed.

The Ant script that is used in the command line is in application/build.xml. It defines the following target: application.

Table 2. Contents of build.xml
Target/Macro definition Description
init Initializes the properties that are used by the Ant script.
headless.application Defines a macro to easily run the Eclipse application.
serverDeploy Calls the macro to deploy the RuleApp to the output directory and Rule Execution Server.
directoryDeploy Calls the macro to deploy the RuleApp to the output directory.
cleanup Removes the output directory and cleans up the deployed RuleApp from the sample Rule Execution Server.