Editing Java Fragment Unit Test Run Configurations

Open a Run Configuration Dialog

The primary way to open the Run Configuration or Debug Configurations dialogs for an Java fragment unit test is:

  • In the Project Explorer view, right-click the name of the project of interest. From the context menu, select Run As>Run Configurations (or Run As>Debug Configurations)

You can also use one of the following alternative methods:

  • Select Run Configurations from the drop-down arrow next to the Run () button in the Studio toolbar (or next to the Debug () button).

  • Right-click in the EventFlow Editor canvas for your module. From the context menu, select Run As>Run Configurations.

  • In the Project Explorer, right-click the name of your application's EventFlow module. From the context menu, select Run As>Run Configurations.

Run configurations are stored as metadata in your Studio workspace. Thus, although your set of named Run Configurations is common to all your StreamBase projects, an individual Run Configuration includes the path to the individual module or project, so you cannot share Run Configurations between StreamBase or LiveView projects.

The top row of each run configuration dialog contains the Name field, common to all tabs:

Name

A configuration name is generated for you when you first run a fragment. You can change the name according to your site's standards. The name you enter is not reflected in the navigator pane on the left until you click Apply.

Create a New Run Configuration

Studio automatically creates a new Run Configuration for you the first time you run or debug a module, with the configuration taking the name of the top-level module being run. These Run Configurations are created with default settings, and you can edit or copy them to specify custom settings.

You can also create a new Run Configuration from scratch. To do this, open the Run Configurations or Debug Configurations dialog and do one of the following:

  • In the left pane, right-click EventFlow Fragment and choose New in the context menu.

  • In the left pane, select EventFlow Fragment and click the New toolbar button.

  • Select the name of an existing Run Configuration and click the Duplicate toolbar button.

Edit an Existing Run Configuration

A named Run Configuration does not exist for an EventFlow or LiveView project until you have run the fragment for that project at least once.

To edit an existing Run Configuration:

  • Open the Run Configurations or Debug Configurations dialog.

  • Select the name of the configuration to edit.

  • Make changes in the tabs of the wizard and click the Apply button before you leave each tab.

  • Click Revert to undo changes since the last saved version.

Note

The Run Configurations or Debug Configurations dialogs restart showing the last configuration you opened. This is not necessarily the configuration for the EventFlow module or LiveView project whose name was active when you invoked the Configurations dialog.

After applying your edits, you can:

  • Click Close to preserve your edits and exit the dialog.

  • In the Run Configurations dialog, click Run to run the edited Run Configuration.

  • In the Debug Configurations dialog, click Run to run and debug the edited Run Configuration.

Test Tab

The Test tab of an EventFlow Fragment Unit Test Run Configuration configures which project's tests are run in Studio.

Run a single test

Click Browse and select a project containing an EventFlow fragment unit test or test suite. Once you select a project and click OK, click Search and select the test case of interest.

Run all tests in the selected project, package or source folder

By selecting this option and clicking Search, you can run all available EventFlow unit tests for a chosen project, package, or source folder.

Node Tab

Cluster

You can change the default node name variable pattern in Studio Preferences.

The default cluster name for Studio-initiated nodes is the system login name in effect when Studio started, and is not specified in a Run Configuration. You can change the default cluster name in Studio Preferences.

Node Name

This field specifies a name for the node that Studio creates to contain this fragment. For example, you can specify here the same node name you are using in your test and deployment environment with the epadmin command.

Studio's default node name is generated from a naming pattern generated from a set of variables. Use the Node Name Variables button to select a different set of project-related variables, or use the Other Variables button to specify variables available to Studio as a whole. The naming pattern you assign must include the S(SeqNum) variable, to make sure that a sequence number is assigned to make node names unique.

Node Installation Properties

Use this control to specify one or more parameters for Studio to use when it installs a node to contain this fragment. The valid parameters are the same as can be used with the epadmin install node command; run epadmin help node at the command prompt to see the available parameters.

The feature is best used with parameters such as memorysize to specify a JVM heap size larger than the default 512 MB for certain EventFlow or LiveView fragments.

Note

Do not specify parameters that are already specified in this Run Configuration or elsewhere in Studio.

For example:

  • Do not specify the application parameter, which is already specified in the Main EventFlow Module setting described above

  • Do not use the nodename parameter to name the node, which is already accomplished above.

  • Do not use the producthome parameter to override the location of the current StreamBase installation from which Studio is running.

  • Do not use the substitutions or substitutionsfile parameters. Specify those instead on the Parameters tab for this Run Configuration.

In addition, do not use parameters that change the default adminport, adminhost, discoveryport, or discoveryhost, or this node may fail to appear in Studio's Clusters view or with the epadmin display services command.

Arguments Tab

Program Arguments

Define the arguments to be passed to the application and to the JVM (if any). Click Variables to invoke the Select Variable dialog, from which you can build a program argument setting using Java standard system property names.

VM arguments

Arguments that you specify here are used as command line arguments for the JVM engine that hosts the Java fragment. Click Variables to invoke the Select Variable dialog, from which you can build a VM argument setting using Java standard system property names.

In general, set StreamBase properties with a HOCON configuration file instead of the VM arguments control. Use this feature sparingly, or under the direction of TIBCO Technical Support.

Working directory

The working directory the launched process uses. To change from using the default working directory, click Other and specify the workspace or local directory to use for the working directory of the launched process.

Parameters Tab

Engine name

The next EventFlow fragment launch defined by this configuration has a default engine name generated by Studio. The Default setting is appropriate in the great majority of cases. You can see the engine name Studio chooses in the Clusters view at runtime. Select the Engine entry of a started node; the Name entry is near the top of the Properties list.

It is possible for a single node to contain more than one engine. For command-line launches, engines and engine name are specified in a HOCON configuration file of type c.t.e.dtm.c.node. Use the Specified option to direct this Studio Run Configuration to use the same engine name that will be used for command line launches. Valid characters for engine names are letters, digits, underline, hyphen, period, and dollar sign.

Deploy parameters

Set name-value pairs in the Deploy parameters field to pass command options to the deployment mechanism when running or debugging the EventFlow module. Deployment parameter options are shown in the following table.

Note

Deployment parameters are not the same as node installation parameters, which are configured on the Node tab.

Warning

Deployment parameters are an advanced feature, and incorrect settings can cause the next launch to fail.

Option Description
buildtype This option specifies the type of binaries the engine uses. The valid values are PRODUCTION or DEVELOPMENT. If not specified, the engine uses the same binary type as the node it runs in.
debug An enumeration indicating the level of diagnostic output. The valid values are:
  • enable ― a high level description of deployment activity

  • verbose ― detailed description of deployment activity

  • disable ― no diagnostic output

The default is disable.
discoverytimeout The number of seconds to wait while resolving a service name. Sub-second precision is supported, as in 1.25. The default value is 1.
displayversion A boolean flag indicating whether the product version information is to be displayed, defaulting to true. In Studio, this version information display occurs on a line beginning with status (fragment deploy): in the Console view.
exitonfailure A boolean flag that controls multi-node completion behavior. A value of true causes the deployment to return to the caller when any node returns a non-zero exit code. A value of false causes the deployment to not return until all nodes exit. The default value is false.
ignoreoptionsfile A boolean flag to suppress the default reading of the deployment options file. The default value is false. This option is only of interest for TIBCO StreamBase internal users.
keepaliveseconds The number of seconds that the node is to wait before terminating a deployed fragment when connectivity between the node and the deployment environment is lost. The default value is 10 seconds.
nodecleanup A boolean flag indicating whether the generated artifacts and state should be removed on engine exit. A value of true removes all generated artifacts and state, a value of false does not. The default value is true.
password The password to use when authenticating the StreamBase Runtime username during connections to the node. See username below.
prefix A boolean option with a value of true causes log output to be prefixed with the nodename. A value of false disables the nodename prefix. The default value is true.
reset This option with a value of true requests that all Java objects and any changed type definitions on the node be deleted before the fragment begins execution. If there is an engine already running, an error is reported and the new engine fails to start. The default value is false.
schedulerpolicy

On Linux, see the man page for sched_setscheduler (2) to understand the context of this parameter.

This parameter sets the scheduling policy and priority for the engine process. The syntax is policy: priority. The valid values for the policy are SCHED_FIFO, SCHED_RR, and SCHED_OTHER. The valid range for priority depends on the policy.

For Linux, the valid values for SCHED_FIFO and SCHED_RR are 1 to 99. If the schedulerPolicy cannot be set, the engine process is not started. In order to use real-time policies, the caller must have the appropriate permissions. On Linux, a security configuration file can be created to allow users to enable real-time policies. As an example, the following command allows the user sbuser to enable either SCHED_FIFO or SCHED_RR with a priority range from 0 to 70.

cat > /etc/security/limits.d/tibco.conf <<EOF
sbuser hard rtprio 70
sbuser soft rtprio 0
EOF
If running as root, you can set the required permission for root with the following command:
ulimit -r 99
Run this immediately before starting the node in the same shell that starts the node.
shutdowntimeoutseconds The maximum number of seconds to wait for an engine to shut down. The default value is 60 seconds.
username The user name in the StreamBase Runtime authentication realm to use when connecting to a node. Note that this is NOT the same user name as the StreamBase, LiveView, LiveView Web, or LDAP user names. The specified value must identify a principal with administrative privileges on the node. Defaults to the user.name system property, which is set as the UID of the user who executed the deploy tool client JVM.

Classpath Tab

Classpath

Use the Classpath tab to include code for a third-party library in the run of the unit test.

Source Tab

Use this tab to specify the location of JAR files or other Java resources needed by the next launch of this EventFlow fragment unit test.

Note

Use this tab only for short-term testing or debugging of your EventFlow fragment unit tests.

Best practice to use external JAR files to install the JAR in your local Maven repository, as described in Using External JAR Files.

Environment Tab

Caution

The settings in the Environment tab have a very different meaning for EventFlow fragment Run Configurations than for the usual Java Run Configurations provided by Eclipse. Please read this section carefully.

Environment variables to set

Remember that all EventFlow fragments are launched into StreamBase Runtime nodes, and that nodes are always part of a StreamBase Runtime cluster.

Studio enables the Append environment to operating system environment setting by default. This means the shell environment for the operating system in which Studio runs is passed to and available to fragments running in nodes. Any variables specified in this tab can supplement the system settings, or can modify or override existing system environment variables.

You can select the Use specified environment only control to restrict the launched node's environment settings to those specified in this tab.

A StreamBase Runtime node has its environment set at node installation time. This has the following consequences:

  • Settings made in this tab can only affect the next node that Studio installs and starts. Remember that Studio installs a node and reuses it for the next launch of the same fragment. So even though this tab is part of the configuration for one EventFlow module, if you add or change environment variables in this tab, for them to take effect, you must stop and remove any existing node for this fragment using toolbar buttons in the Clusters view. Then at the next launch of this configuration, Studio installs and starts a new node with the new environment settings.

  • Settings made in this Environment tab only affect nodes installed and started by Studio. These settings are not preserved in any fragment archive you create from this project. Therefore, these settings are not carried into any StreamBase Runtime archive that includes this fragment.

  • Settings made in this tab are independent of command line launches made with the epadmin command. The epadmin command appends the shell environment to the node's environment at node install time. If you have made any custom environment settings in this tab, you must repeat those settings in the shell in which you run the epadmin command, or in configuration substitution values.

The New/Edit Environment Variable dialog contains a Variables button, which is a feature inherited from Eclipse. Use this button to specify the value of an environment variable using one or more Eclipse system variables whose contents are resolved by Eclipse when this configuration is run. Use the Help button on this dialog for further information on each available variable.

The list of variables includes ${sb_home}, which is defined as the absolute file system path of the StreamBase installation directory as currently set in Studio's Preferences dialog.

See Environment Variables for a further discussion of the ways environment variables are used in StreamBase.

Reserved Environment Variables

Fragment launches in Studio cannot set customized values for the TIBCO_EP_HOME or JAVA_HOME environment variables because those have particular meaning for Studio operations. This is true even if these variables are inherited from the system environment.

Studio detects and blocks attempts to use these two variables, whether explicitly specified in this Environment tab, or inherited from the system environment. In this case, Studio displays a warning dialog like the following.

Select the Remember my decision check box to suppress this warning dialog for future fragment launches.

Common Tab

The settings in the Common tab are common to all Eclipse Run Configurations. Use Eclipse Help to learn how more about these options.

Save as

This option determines where this Run Configuration is saved. The default setting, Local file, saves configurations in the workspace metadata area. As an alternative, you can select Shared file to save this Run Configuration as a file in one of your project folders. In this case, the Run Configuration is saved as Name.launch, where Name is specified in the Name field. Specify the target project folder using the Browse button.

Display in favorites menu

The favorites menu is a list of Run Configuration names that appears in the second section of the drop-down menu of the Run and Debug buttons on the toolbar. The first section contains a changing list of recently Run Configurations. Add a configuration to the favorites section to keep it in the menu, even when other applications have replaced it in the recently run section. This option performs the same function as the Organize Favorites option in the Run and Debug drop-down menus.

Encoding

Use this section to specify a non-default character encoding for log messages sent to the Console View (and optionally to a standard output file).

Standard Input and Output

Allocate Console is selected by default. This specifies using the Console view to display logging messages written to standard output and standard error.

Input File is not supported by EventFlow fragment launches.

Output File is unselected by default. To specify that standard output and standard error of your fragment's run are written to a log file, select the Output File check box, and enter a path to a file. If the specified file does not exist, it is created for you. If both Allocate Console and Output File options are selected, log messages are written to both places.

You must designate the path to the file using Eclipse-specific syntax. Rather than typing a path, use the Workspace or File System buttons to navigate to a workspace or file system folder, and specify a file name. These buttons let Eclipse write the syntax for you. If you are familiar with the Eclipse syntax required in this field, you can use the Variables button to build up a path from components.

Append is dimmed unless the Output File option is selected. Select the Append check box to have log messages appended to the file specified in the Output File field. If unselected (the default setting), the designated file is overwritten with each run of this configuration.

Launch in background

Use this option to specify that the launching process itself runs in the background. (The StreamBase server that hosts your EventFlow fragment unit test is always run in the background.) Selecting this box returns control to Studio immediately when you launch this configuration, without displaying the usual Starting Server dialogs.

Perspective Change Preferences

By default, running or debugging a StreamBase module with a Run Configuration automatically switches StreamBase Studio to the SB Test/Debug perspective, after prompting you to confirm. You can specify on the prompt dialog to not ask again.

The option to switch perspectives is not stored in the Run Configuration itself, but is a global setting for all StreamBase fragments, specified in Studio Preference Settings.

Back to Top ^