| Samples > Rule Scenario Manager Demonstration > How to Test Rules in Rule Scenario Manager using an Extended Excel Binding |
How to Test Rules in Rule Scenario Manager using an Extended Excel Binding |
PREVIOUS NEXT |
This sample shows how to test rules in Rule Scenario Manager using an extended Excel binding.
The Rule Scenario Manager archive is provided with the sample. For testing purposes, you may want to regenerate it. A macro in an Excel file is provided to do this. Macro execution must be enabled in Excel to run it.
Key features include:
To install the sample:
scenariomanager > extended-suite-excel-binding.
deploy command to deploy the updated Scenario Service Provider (SSP) and Rule Scenario Manager Console.
This sample can only be opened and run in the Samples Console.
The sample enables you to create and upload the Rule Scenario Manager archive containing a complete scenario. Once uploaded, you can run the scenario using the Rule Scenario Manager Console.
The Rule Scenario Manager archive is already created for the sample, so you do not need to create it. However, if you want to create it for testing purposes, you can do so by running the macro provided in the sample Excel file. Note that you must have Excel configured to be able to do this. If you are not able run macros, you can go straight to the upload task.
To create the Rule Scenario Manager archive:
sample.xls, change your Excel security level to medium, restart Excel and re-open the file.
NUM TASKS NOT EXECUTED: this test is set to zero. It asserts that all the tasks defined in the main ruleflow in the scenario will be executed.
INPUT PARAMETERS: this test asserts that the loan data passed as input must have an amount equal to 50000.
<InstallDir>/scenariomanager/samples/extended-suite-excel-binding/data/sample-upload.zip
sample.xls.
To upload the Rule Scenario Manager archive to the Rule Scenario Manager Console:
URL: http://localhost:8080/rsm.
To explore the newly-updated Rule Scenario Manager archive:
To run the scenario suite:
When execution is complete, the Report View is automatically displayed. You should see that the scenario suite completed successfully. Scroll down the Report View page to see the results of the execution.
This sample is located in <InstallDir>/scenariomanager/samples/extended-suite-excel-binding. It contains the following files:
ExtendedSuiteConfiguration.java - a class defining the configuration settings for the scenario suite.
ExtendedSuiteExcelBinding.java - a class responsible for reading the Excel file and building an in-memory representation of the scenario suite. It is used by the Rule Scenario Manager Console to create and persist the scenario suite. See the public method Object fromBinding() throws Exception {...}.
exception/ApplicationException.java - a common exception.
exception/DataNotFoundException.java - an exception thrown when expected data in the Excel file is not found.
util/AlreadyReadResource.java - a class implementing a resource wrapper.
util/Constants.java - set of constants used throughout this sample.
util/excel/WorkbookHelper.java - a facade class helper that reads and validates the Excel file.
util/excel/helper/ConfigurationDefinitionHelper.java - a class helper that reads the suite configuration in the Excel file.
util/excel/helper/ParameterDefinitionHelper.java - a class helper that reads the input data from the Excel file.
util/excel/helper/ScenarioDefinitionHelper.java - a class helper that reads the scenario definition properties from the Excel file.
util/excel/helper/ScenarioSuiteDefinitionHelper.java - a class helper that reads the suite definition properties from the Excel file.
util/excel/helper/TestDefinitionHelper.java - a class helper that reads the test definition properties from the Excel file.
util/excel/helper/ValidatorHelper.java - a class helper that validates the Excel file.
The Rule Scenario Manager archive is a zip file containing:
archive-descriptor.xml)
sample-upload.xls). This is a renamed version of the sample.xls file that comes with the sample.
When the Rule Scenario Manager archive is uploaded, Rule Scenario Manager needs to identify:
sample-upload.xls)
sample.ExtendedSuiteExcelBinding)
sample.Configuration)
All this information is held in the archive-descriptor.xml file, within xml tags.
The sample upload file contains all the data needed to describe the scenario suite, and the code to generate the Rule Scenario Manager archive.
The file is called when you do one of the following:
Note that you will be required to enter a password to have access to the macro code. The password is sample. You can keep this password, change it to something else or remove it - although we recommend that you protect your macros so that no-one else can modify them.
The sample-upload.xls file must include a data objects sheet for each class included in the input data definition. The format is the same as the default Rule Scenario Manager format. For more details, please refer to The Data Objects Sheet.
To rebuild the sample:
build target to compile the code and create the extension JAR file.
deploy.ruleapp target, to deploy the RuleApp.
deploy target. The deploy target:
JAR file. This JAR file contains the compiled code for the source files described in the Source Files section, above.
loanvalidation-xom.jar. When you launch the scenario, the SSP creates the java object instances from the Scenario Input Data before requiring an execution to the Rule Execution Server, so it needs them in its classpath.
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS NEXT |