Creating scenario providers

You create new scenario providers in Rule Designer to use with the Scenario Service Provider (SSP). The SSP uses the provider to execute the scenarios defined in the scenario suite.

About this task

You create new scenario providers to retrieve the input data for your tests from a data source. A scenario provider is made available to business users in the Decision Center Enterprise console by referencing the DVS format.

Rule Designer generates Java™ class templates to help you:
  • Create a standard scenario provider, or a scenario provider that supports parallel execution of a simulation

  • Define how to access the scenarios at run time

  • Retrieve user input from Decision Center and initialize your scenario provider at run time

  • Create an Eclipse launch configuration to run tests in Rule Designer using the new scenario provider

After you create a scenario provider, you must make the DVS format available to business users in the Enterprise console.

Procedure

To create a scenario provider:

  1. Right-click a DVS Project and click Create a DVS artifact > Format.

    The New DVS Format wizard opens.

    Note:

    You can also click Create in the Format section of the DVS Customization.

  2. On the New Format to a Project page, select the DVS Project, and then click Next.
    1. Enter a name for the format.
    2. Define the precision level, and then click Next.

      By default, the precision is set to two digits. You can enter a different number or use all the digits for comparison.

  3. On the Scenario Provider page, choose one of the following options:
    • Select an existing provider from the menu, and click Finish to generate your new provider classes using this class.

      The Excel scenario provider class is selected by default. The message below the menu informs you whether parallel execution of a simulation is supported by the selected provider.

      Go to step 5.

    • Click Create a new Scenario Provider.

      The New DVS Scenario Provider dialog opens.

  4. In the Package Name field on the New DVS Scenario Provider page, enter a name for the package in which Rule Designer generates the scenario provider classes.
    1. In the Class Name field, enter a name for the main scenario provider class.
    2. Select the Generate a scenario provider to support parallel execution for a simulation check box if you to want to use this feature. For more information, see Parallel execution.
    3. By default, Rule Designer generates the Decision Center renderer class template, and the launch configuration plug-in project. Clear the check boxes if you do not want to generate them.
    4. Click Finish.
      • Rule Designer creates the Java class templates in the src/<PackageName> directory of the DVS Project.

      • If you used the default option, Rule Designer also creates the plug-in project for the launch configuration in your workspace.

      The custom scenario provider displays in the Scenario Provider section of the format editor.

  5. You must now implement the required code in the Java class templates.

    The DVS Project contains one of the scenario provider class templates and a renderer class template in src/<PackageName>. The provider class depends on the type of scenario provider you generated:

    Java class template Definition
    ScenarioProvider.java An implementation of IlrScenarioProvider provides access to the scenarios at run time. This type of scenario provider does not support parallel execution.
    ParallelScenarioProvider.java An implementation of IlrParallelScenarioProvider provides access to the scenarios and divides them into a set of parts at run time. This type of scenario provider supports parallel execution.
    ScenarioSuiteResourcesRenderer.java Use an implementation of IlrScenarioSuiteResourcesRenderer to customize the Decision Center GUI for the Scenarios step when creating Test Suite and Simulation artifacts.

    To implement the scenario provider classes:

    1. In the DVS Project, double-click the classes in src/<PackageName>.

      The Java class templates include TODO comments to indicate the parts to complete.

    2. Open the Tasks view to display the list of TODO tasks in the Java class template.
    3. Replace the TODO comments by the required code.
    4. Save the changes.
  6. To run a test in Rule Designer using your new scenario provider, you must build the plug-in to make the launch configuration for your custom scenario provider available in the Run Configurations or in the Debug Configurations dialogs.

    The launch configuration plug-in project contains the following class templates:

    Java class template Definition
    MyScenarioProviderLaunchConfigurationDelegate.java This class extends IlrDVSLaunchConfigurationDelegate, which accesses and verifies launch configuration attributes.
    MyScenarioProviderRunner.java This class extends IlrDVSRunner, which calls Decision Validation Services and the SSP to execute scenarios.
    MyScenarioProviderLaunchConfigurationTabGroup.java This class implements IlrDVSLaunchConfigurationTabGroup, which defines the tabs and the display order of the tabs for the DVS launch configurations.
    MyScenarioProviderTab.java This class extends IlrDVSMainTab, which defines the main tab of a DVS launch configuration and the elements to specify.
    MyScenarioProviderClasspathTab.java This class extends IlrClasspathTab, which defines the classpath used to run scenarios.
    Note:

    Check the path to make sure that you build the plug-in in the right directory.

    To implement the plug-in classes:

    1. In the plug-in project, double-click the classes in src/<PackageName>.

      The Java class templates include TODO comments to indicate the parts to complete.

    2. Open the Tasks view to display the list of TODO tasks in the Java class template.
    3. Replace the TODO comments by the required code.
    4. Save the changes.
  7. You can now test the plug-in to check that the new launch configuration displays in the Run Configurations and Debug Configurations dialogs, and contains the elements defined.

    To check the launch configuration:

    1. In the Rule Explorer, select the plug-in project.
    2. Click Run > Run.
    3. In the Run As dialog, select Eclipse Application, and click OK to launch the new Eclipse program.

      A new Eclipse application opens.

    4. Click Run > Run Configurations.

      The new launch configuration perspective displays on the side pane in the Run Configurations dialog.

      You can now deploy the launch configuration plug-in to make it available in Rule Designer (see Deploying a plug-in) and use the new scenario provider to run tests in Rule Designer (see Overview of testing in Rule Designer).

  8. After you implemented your new scenario provider in Rule Designer, you must make it available to business users in the Decision Center Enterprise console.

    To make the format available in the Enterprise console:

    1. Repackage the SSP and Decision Center archives, as described in Repackaging the SSP and Decision Center archives.
    2. Deploy the repackaged files to your application server.

Results

You must make formats that you create or modify in Rule Designer and deploy to Decision Center accessible to the business user. Click Project > Edit Project Options > Test Suite / Simulation Options in the Enterprise console, and refer to the online help for further information.