See: Description
| Interface | Description |
|---|---|
| IlrExcel2003InlinedTypeManager |
Manages inlined types.
|
| IlrExcel2003ScenarioSuiteReader |
Reads Excel 2003 scenario files.
|
| IlrExcel2003ScenarioSuiteWorkbook |
Encapsulates an Excel 2003 workbook that defines an scenario suite.
|
| IlrExcel2003ScenarioSuiteWriter |
Writes data to an Excel 2003 scenario file.
|
| Class | Description |
|---|---|
| IlrExcel2003ScenarioSuiteReaderFactory |
Factory class used to create instances of
IlrExcel2003ScenarioSuiteReader. |
| IlrExcel2003ScenarioSuiteWorkbookFactory |
Factory class uses to create instances of
IlrExcel2003ScenarioSuiteWorkbook. |
| IlrExcel2003ScenarioSuiteWriterFactory |
Factory class used to create instances of
IlrExcel2003ScenarioSuiteWriter. |
| Enum | Description |
|---|---|
| IlrExcel2003CellType |
Type of an Excel 2003 cell.
|
| IlrExcel2003ScenarioSuiteWriterFactory.ModelType |
Represents the type of model used to populate the Excel 2003 scenario file.
|
| IlrWhitespaceCellTextMode |
| Exception | Description |
|---|---|
| IlrExcel2003ScenarioSuiteDataException |
Represents the exception
thrown when invalid data is found in Excel 2003 scenario files.
|
| IlrExcel2003ScenarioSuiteIOException |
Represents the exception thrown when IO errors occur with Excel 2003 scenario files.
|
Provides the classes and interfaces to use for reading and writing to Excel 2003 scenario files.
A scenario represents the values of the input parameters of a ruleset, that is, the input data to ruleset execution, plus any expectations on the execution results that you wish to test.
In the API, a scenario suite represents a list of such scenarios. If you are using the proposed Excel 2003 format to store your scenarios, your scenario suite becomes an Excel 2003 scenario file, where each scenario is identified with a unique ID. Scenario files contain a Scenarios worksheet for the values of the input data. If you are testing the results of the execution, the Excel 2003 scenario file also contains one or both of the following worksheets:
If you are using a custom scenario provider such as a database, the notion of scenario file is no longer pertinent.
There are two approaches to reading data from an Excel 2003 scenario file:
The reader approach uses IlrExcel2003ScenarioSuiteReaderFactory to handle basic file management, and IlrExcel2003ScenarioSuiteReader to read and interpret the data, as follows:
The following code example shows how to implement the reader approach:
// Create an input stream on the scenario file
InputStream scenarioSuite = new FileInputStream("my-scenario.xls");
// Load the ruleset archive
InputStream rulesetArchiveInputStream = new FileInputStream("my-ruleset.jar");
IlrRulesetArchive rulesetArchive = IlrRulesetArchive.extractArchive(new IlrJarArchiveLoader(new JarInputStream(rulesetArchiveInputStream)));
// Get an instance of the reader factory
IlrExcel2003ScenarioSuiteReaderFactory factory = IlrExcel2003ScenarioSuiteReaderFactory.getInstance();
// Create a new reader
IlrExcel2003ScenarioSuiteReader reader = factory.getNewReader(scenarioSuite, rulesetArchive);
// Use the reader
reader.getScenarioCount();
...
// Close the reader
reader.close();
To write data to an Excel scenario file using the API, you need:
Population of the scenario file is performed by an IlrExcel2003ScenarioSuiteWriter, which is created from an IlrExcel2003ScenarioSuiteWriterFactory to handle basic file management.
The following code example shows how to write to an Excel scenario file:
// Create an input stream on the scenario file
InputStream scenarioSuite = new FileInputStream("my-scenario.xls");
// Load the ruleset archive
InputStream rulesetArchiveInputStream = new FileInputStream("my-ruleset.jar");
IlrRulesetArchive rulesetArchive = IlrRulesetArchive.extractArchive(new IlrJarArchiveLoader(new JarInputStream(rulesetArchiveInputStream)));
// Get an instance of the writer factory
IlrExcel2003ScenarioSuiteWriterFactory factory = IlrExcel2003ScenarioSuiteWriterFactory.getInstance();
// Create a new writer with mapping properties that explains how to interpret the BOM
Properties mappingProperties = new Properties();
mappingProperties.put("converter_my.Class", "my.Class");
IlrExcel2003ScenarioSuiteWriter writer = factory.getNewWriter(scenarioSuite, rulesetArchive, IlrExcel2003ScenarioSuiteWriterFactory.ModelType.XOM, mappingProperties);
// Use the writer
...
© Copyright IBM Corp. 1987, 2017