Extracting Rule Sets from the Database for Testing

Once you have validated a CER rule set, you may want to write some Java code to execute and test your rules. To do this you need to publish the rule set, extract your newly-created rule set and related data from the database (using the extractdata target), generate skeleton test classes (using the creole.generate.test.classes target) and implement and run these. This section describes how to extract your rule set and associated data from the database.

Use the extractdata build target to extract the contents of a table from the database and transform it into a database independent XML file. More detail on this target is provided in the Database Synchronization section of the Curam Server Developer Guide.

  1. Open a command prompt in your Curam/EJBServer directory.
  2. Run build extractdata -Dtablename=CREOLERULESET
  3. All rule sets for the table you specified should be extracted to the folder Curam\EJBServer\build\dataextractor\blob. Records are extracted to a file based on the tablename. Find the rule set you are working with and rename it based on the rule set name. Give it an XML file extension, e.g. SampleBenefit.xml.
  4. Copy SampleBenefit.xml to the CREOLE_Rule_Sets directory of the component you are developing the rule set for. You may need to create this directory.
  5. Copy CREOLERULESET.dmx from the directory Curam\EJBServer\build\dataextractor to data\initial directory of the component you are developing the rule set for. You may need to create this directory.
  6. Edit the file CREOLERULESET.dmx located in the data\initial directory of the component and delete all the entries except the entry related to your newly created rule set SampleBenefit.xml. This entry can be found by searching for your rule set name in <value> SampleBenefit</value> tag in the CREOLERULESET.dmx file.
  7. Set the rule set definition path as./../build/svr/creole.gen/Rules/components/ your component/your rule set name.xml in the CREOLERULESET.dmx. And also empty the ruleSetVersion value as shown in the sample XML below.
    <attribute name="ruleSetDefinition">
       <value>./../build/svr/creole.gen/Rules/components/
         custom/SampleBenefit.xml
       </value>
     </attribute>
            
     <attribute name="ruleSetVersion">
       <value/>
     </attribute>
  1. Open a command prompt in your Curam/EJBServer directory.
  2. Run build extractdata -Dtablename=APPRESOURCE
  3. Copy APPRESOURCE.dmx from the directory Curam\EJBServer\build\dataextractor to data\initial directory of the component you are developing the rule set for.
  4. Edit the file APPRESOURCE.dmx located in the data\initial directory of your component and delete all the entries except the entry related to your newly created rule set SampleBenefit.xml. This entry can be found by searching for <value>RULESET- your ruleset name and version </value> in APPRESOURCE.dmx. For example, <value>RULESET-SampleBenefit1</value>
  5. Copy the resources files specified in the APPRESOURCE.dmx file, from the folder Curam\EJBServer\build\dataextractor\blob to data\initial\blob directory of your component. The names of the resources files can be found in the tag <attribute name="content"> <value>./blob/ resource file name </value></attribute> in APPRESOURCE.dmx. For example, <attribute name="content"> <value>./blob/Appresource2289</value></attribute>
  6. Set the resources path as./ your component /data/initial/blob/ resource file name in APPRESOURCE.dmx file as shown in the sample XML below.
    <attribute name="content">
      <value>./custom/data/initial/blob/Appresource2289</value>
    </attribute>
  7. Rebuild the database.