In this section:

Introduction

The File Event Listener monitors a specified directory on the local system. If it detects new, modified, or deleted files in that directory, it triggers a response from the associated virtual asset. This listener is commonly used in conjunction with the Data Learning tool (also available on Marketplace) so that when a new or modified traffic file is detected, any new data captured in that file is automatically added to Data Repository.

Requirements

This listener requires Virtualize 9.9.0 or later.

Installation

The listener can be installed from the UI or the command line.

UI Installation

  1. Choose Parasoft> Preferences.
  2. In the System Properties preferences page, click Add JARs
  3. Browse to fileEventListener.jar and click Add.
  4. Restart Virtualize.

Command Line Installation

Add the fileEventListener.jar file to the system.properties.classpath property in your localsettings properties file. For example:

system.properties.classpath=<path to jar>/fileEventListener.jar

Usage

Once the File Event Listener is installed, it will be available in the Transports> Custom tab of the Virtual Asset configuration panel. You can open this panel by  double-clicking a virtual asset’s Virtualize Server node.

If multiple custom listeners are available, you can select the one you want to use from the Select Implementation drop-down menu:

Configuration

The following configuration options are available.

Local Directory to Monitor

Specify the directory you want to monitor for new, updated, or deleted files. You can enter an absolute path or a path relative to the VirtualAssets project.

Poll Interval

Specify how frequently you want to check the specified directory. The default is 1000 milliseconds.

Log Level

Specify how much information you want logged to the console and the Event Monitoring view. The default is 2 (warn).

Using the File Event Listener for Data Learning

You can use the File Event Listener and Data Learning tool in concert so that any new data captured in traffic files is automatically added to a designated Data Repository.

  1. Ensure that the traffic files you want to monitor are being saved in the local directory specified in the File Event Listener's Local Directory to Monitor field. This should be the same directory used in the Data Learning tool's Source Traffic> Directory to Scan for Traffic Files field.
  2. Add a Data Learning tool as an "outgoing response" output to a responder within the .pva that's associated with the virtual asset using the File Event Listener.
  3. Configure that Data Learning tool to identify the new traffic and add the new data to the desired Data Repository. See the Data Learning Tool documentation for details.
  4. (Optional) By default, the Data Learning tool will execute any time that a file is added, modified, or deleted. If you want it to execute only in one of these cases, configure the responder's Request Body correlation accordingly. For example, the following responder is configured to respond only when the File Event Listener detects a new file in the specified directory.

    The listener can trigger three types of events: fileCreate, fileDelete, fileModify. The following example shows how these events are formatted:

    <fileeventlistenerEvents>
    <fileCreate>path_to_new_file</fileCreate>
    <fileDelete>path_to_deleted_file</fileDelete>
    ...
    </fileeventlistenerEvents>

    A Detailed Use Case on Using the File Listener along with the Data Learning Tool

    For a detailed use case of how to use the File Listener along with the Data Learning tool, see the Data Learning Tool documentation, which explains how to set up an environment that achieves the following objective: 

    If a virtual asset doesn't know how to respond to a given request, record that request (and its corresponding response from the live service) and add this data to the Data Repository. The next time the virtual asset receives that same request, the appropriate response will be returned. 

Third-party Content

This extension does not include any items that have been sourced from third parties. Additional license details are available in this plugin's licenses folder.

  • No labels