File transport
You must create and configure a file transport if you want to access files as a source of publication and subscription. File transport can also be used in a stub to consume from one or more files in a directory.
Using the publish and subscribe actions in HCL OneTest™ API it is possible to create files that are used to trigger a system process and files are read for validating the expected output from a system.
File transport creation
A file transport is created when you create a file resource in the Logical View of the Architecture School.
In the Logical View, you can create a file resource in two ways:
- Right-click an existing component or on the empty drawing palette, and then select from the menu.
- Select an existing component or click the empty drawing palette, and then select from the toolbar.
Each file resource represents a unique file transport that can be selected and configured later on.
File transport configuration
The file transport provides read and write access to the contents of a file on the file system.
To configure a transport, double-click the appropriate file resource in the Logical View of the Architecture School.
Transport properties
The general properties of the transport include its name and parent.
- To change the name of the transport, enter a name in the Name field.
- To change the parent of the transport, click Parent, and then select the logical component that contains the transport.
You can test the connection properties at any time by clicking Test Transport. For example, clicking Test Transport checks if the referenced directory exists and whether the referenced directory is on a remote system and can be connected.
Settings
Use the options under the Settings tab to specify a directory of files, the file name pattern to match for a directory, and the encoding for the file.
The configuration options for the transport Settings tab are described in the following table:
Directory | The full path to a directory of files to be written (publish) or read (subscribe). Enter the path or click Browse to locate and select a directory on the local computer. Note: Wildcard characters are not supported in the directory path. |
File Name Pattern | A matching file name pattern that determines the files to be used within the directory. The pattern can contain the wildcard character * to match a series of zero or more characters. |
File Encoding | The encoding to apply when you use the file. You can select one of the preset encodings from the list, or enter the name of an encoding that is supported by Java™. |
Consuming
Use the options under the Consuming tab to configure how HCL OneTest™ API treats the contents of the file.
The configuration options for the transport Consuming tab are described in the following table:
Last Modification Delay | The elapsed time in seconds since a file was last modified before it is eligible for consumption. | ||||||||||||||||||||||||||||
Ignore last modification in subscribe | If selected, matched files in a subscribe action are consumed even if they were not modified. The file system is queried without waiting for the next scheduled poll. | ||||||||||||||||||||||||||||
Content Packetizing | Select how you want to packetize the file content. For All available
bytes and No Content (Header only) no further information is
required.
|
Producing
Use the options under the Producing tab to select the new line character.
The configuration options for the transport Producing tab are described in the following table:
New Line |
For publishing actions (writing), select the new line character to use, as follows:
|
Compare
Use the option under the Compare tab to specify the file schema to be applied when comparing files.