Creating file schemas

File schemas can be used to define the contents of one or more files that you intend to write to (publish) or read from (subscribe) in Test Integrations and APIs tests.

About this task

For files that are made up of a number of records, a file schema can save you from having to write to or read from a file over and over again (that is, creating a publisher or subscriber for each record in the file). The file schema lets Test Integrations and APIs iterate over the entire file, reading the wanted records according to the way the file is defined.

The file schema can be used with the File resource (created in the Logical View of Architecture School), which defines the file that contains the records to be processed. For more information about working with files in Test Integrations and APIs, refer to Testing with the File transport.

The following example illustrates how to create a file schema.

Procedure

  1. In the Schema Library view of the Architecture School perspective, click the arrow next to Add,and then click Other > File Schema.
  2. Enter a name for the schema that is based on the file type with which it is used.
  3. On the right side of the Schema Library view, the file schema definition is displayed on the Config > Layout page.
  4. Add records (that is, the schemas that are imported earlier that define the file records) to the file schema by clicking New Record.
  5. In the Schema wizard, select the wanted schema (or add one) and click Finish.
  6. Add conditions to the defining records by clicking New Condition.
    The new condition window

    Conditions are used to help Test Integrations and APIs understand the structure of the file that is being processed. If available for a condition, you can select a field within the record to use for matching the condition.

    In the example file schema that is shown, the file contains a header record, a number of group records, and a trailer (footer) record. Within each group record, one or more detail records can show.

    Record definitions can be moved and deleted by using the Remove Record, Move Up, and Move Down icons. Conditions cannot be moved, but they can be deleted by using the Remove Condition icon.

  7. In the Schema with data tab, click Browse to select the file resource (created in the Logical View) that defines the file to be processed.
  8. Select the wanted encoding type to apply from the Source Encoding list.

    A preview of the file to be processed is displayed.

    Preview of file schema
  9. On the Config > Settings page, you can specify a number for the Records to ignore at the start of file field.
    The remaining fields that are displayed depend on the value of the Type field.

    For All Available Bytes and Swift type records, no further information is required.

    For Split type records, see the following table:
    Table 1. Fields for Split type records
    Field Description
    Update outbound message with packet details below You can update outbound messages with the length of the remaining data for delimited records. To include this information in outbound messages (that is, when publishing), select the Update outbound message with packet details option.
    [Delimiters] Select one of the following delimiters:
    • New line
    • Tab
    • Space
    • Other

    If you choose Other, you must specify a delimiting character.

    Process last empty packet Valid when reading records. Select this option if the record ends with the delimiter you specified previously and you want to process one more packet as an empty string (""). Clear this option if the delimiter indicates that there are no more packets.
    For Length type records, see the following table:
    Table 2. Fields for length-delimited records
    Field Description
    Update outbound message with packet details below You can update outbound messages with the length of the remaining data for delimited records. To include this information in outbound messages (that is, when publishing), select the Update outbound message with packet details option.
    Fixed Length Select this option if the packets in the record are all the same length. Specify the number of characters in each packet.
    Token Select this option if the packets are separated by tokens. Specify one or more characters for the token.
    Offset Select this option if the packet length is determined by an offset. Specify the number of characters in the offset.
    Prefix Select this option if the length of the packets is contained in a Prefix.
    For Token, Offset, and Prefix, the following additional information is required.
    Size
    The length of the packet.
    Format
    The packet can be in ASCII or Bytes (EBCDIC) format.
    Swap Bytes
    Select this option if the transport swaps the order of the bytes before it treats the data as the length of the record.
    Length includes prefix
    Select this option if the length in the Size field includes the length of the prefix.
    Propagate prefix
    Select this option if you want to write the prefix to the outgoing message.
    For Delimited type records, see the following table:
    Table 3. Fields for Delimited type records
    Field Description
    Update outbound message with packet details below You can update outbound messages with the length of the remaining data for delimited records. To include this information in outbound messages (that is, when publishing), select the Update outbound message with packet details option.
    Start Token Specify one or more characters for the token that begins a record.
    End Token Specify one or more characters for the token that ends a record.
    For ISO 8583 type records, see the following table:
    Table 4. Fields for ISO 8583 type records
    Field Description
    Update outbound message with packet details below You can update outbound messages with the length of the remaining data for delimited records. To include this information in outbound messages (that is, when publishing), select the Update outbound message with packet details option.
    Select the ISO 8583 Schema Select a Data Format Description Language schema that you have previously uploaded to the Schema Library.
    For Token delimited records, see the following table:
    Table 5. Fields for token-delimited records
    Field Description
    Update outbound message with packet details below You can update outbound messages with the length of the remaining data for delimited records. To include this information in outbound messages (that is, when publishing), select the Update outbound message with packet details option.
    Start Token Specify one or more characters for the token that begins a record.
    End Token Specify one or more characters for the token that ends a record.
    End Token Data Length The number of characters of data that can follow the end token.
    For Dynamic type records, see the following table:
    Table 6. Fields for dynamic type records
    Field Description
    Update outbound message with packet details below You can update outbound messages with the length of the remaining data for delimited records. To include this information in outbound messages (that is, when publishing), select the Update outbound message with packet details option.
    Remove newline character from the end of each record Select a Data Format Description Language schema that you have previously uploaded to the Schema Library.