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 Rational® Integration Tester 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 New > Files > File from the menu.
  • Select an existing component or click the empty drawing palette, and then select Files > File 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.

Image of the configuring the physical file transport dialog box.

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 Rational® Integration Tester 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.
Length
Iterate over the contents of a file to extract multiple records.
Fixed Length Each record is the same designated size.
Token The string of characters that marks the start of each record.
Offset Each record starts after the entered number of bytes. In the example, 16 bytes of data precede the length information.
Prefix A number of bytes / characters at the start of the record that denote the length of the record.

When you use the Token, Offset, or Prefix modes, the following options control how the actual packet length is read from the stream of information.

Size The number of bytes or characters that contain the length information.
Format Indicates whether the prefix values are be treated as raw values (Bytes) or translated from their ASCII equivalent (ASCII).
Swap Bytes Indicates whether the transport swaps the order of the bytes before it treats the data as the length of the record.
Length includes prefix Indicates whether the length includes the prefix (information about the length of the message).
Propagate prefix Indicates whether the prefix portion of the message is propagated to subscribers.
Delimited
Iterate over the contents of a file to extract multiple records that are designated by start and end tokens.
Start Token A series of characters that denotes the start of a record.
End Token A series of characters that denotes the end of a record.
Token
Is similar to the Delimited option, but can be used when you need to specify more data after the end token.
Start Token A series of characters that denotes the start of a record.
End Token A series of characters that denotes the end of a record.
End Token Data Length An optional quantity of data that can be present following the end token.
Split
Packetize (split) the contents of files that are based on a user-defined delimiter.

You can select one of the existing delimiter types (New Line, Tab, Space), or select Other and enter the delimiter characters in the field provided.

When reading records, enable the Process last empty packet option if the record ends with your delimiter and you want to process one more packets as an empty string (that is, ""). Disable this option if the delimiter indicates that there are no more packets.

When you are writing to a record, by default the packetizer writes out the delimiter as the last character, so the record ends with a delimiter. For example: "…|myfieldvalue|".

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:
  • Native (uses the default option according to the platform)
  • Unix-like (line feed)
  • Windows (carriage return - line feed)
  • Mac (carriage return)
  • Binary

Compare

Use the option under the Compare tab to specify the file schema to be applied when comparing files.