Filechecker Plugin - Macros


# LOAD_FFF {fixed_field_file_path} USING {fixed_field_file_descriptor_path} AS {fixed_field_file}

What ?

This macro will load the fixed field file descriptor and the fixed field file. It will then verify that the fixed field file is valid by using the fixed field file descriptor. Finally it will check that the fixed field file has the expected autonumbers. The macro will also convert the fixed field file into a resource of type fixed.fileld.file.

Underlying instructions :

LOAD {fixed_field_file_descriptor_path} AS __temp{%%rand1}.file
CONVERT __temp{%%rand1}.file TO fixed.field.file.descriptor(descriptor) AS __temp_{%%rand2}.fff.descriptor

LOAD {fixed_field_file_path} AS __temp{%%rand3}.file
CONVERT __temp{%%rand3}.file TO fixed.field.file(structured) USING __temp_{%%rand2}.fff.descriptor AS {fixed_field_file}

ASSERT {fixed_field_file} IS valid
ASSERT {fixed_field_file} HAS expected.autonumbers

> Input :

  • {fixed_field_file_path} : The path to the fixed field file (relative to the root of the repository).
  • {fixed_field_file_descriptor_path} : The path to the fixed field file descriptor (relative to the root of the repository).

> Output :

  • {fixed_field_file} : The name (in the context) of the fixed field file.

Example :

# LOAD_FFF repo/fff/data.txt USING repo/descriptor/my_descriptor.xml AS fixed_field_file.fff

Fixed Field File to process :

../../_images/doc-filchecker-fff-txt.png

Descriptor xml file to process (partial) :

../../_images/doc-filchecker-descriptor.png

The project’s doctree showing the resources directory (containing the fff and descriptor xml file) to process :

../../_images/doc-filchecker-project-load.png

SKF script :

../../_images/doc-filchecker-macro-load.png

Result output on success :

../../_images/doc-filchecker-load-success.png

To get a clearer view of the functionnality offered by the LOAD_FFF macro we can create a deliberate error in the fixed field file.

We add an empty line between the end of the first leaf record and the start of the second :

../../_images/doc-filchecker-load-fff-error.png

Result output on failure :

../../_images/doc-filchecker-load-fail.png


# ASSERT_FFF {fff} HAS EXPECTED CONTENT USING {fff_queries_path}

What ?

This macro allows to valid the content of a fixed field file using a fixed field file query file.

Underlying instructions :

LOAD {fff_queries_path} AS __temp{%%rand1}.file
CONVERT __temp{%%rand1}.file TO fixed.field.file.queries(query) AS __temp_{%%rand2}.fff.queries
ASSERT {fff} HAS expected.content USING __temp_{%%rand2}.fff.queries

> Input :

  • {fff} : The path to the fixed field file (relative to the root of the repository).
  • {fff_queries_path} : The path to the query file (relative to the root of the repository).

Example :

# ASSERT_FFF repo/fff/data.txt HAS EXPECTED CONTENT USING repo/queries/my_queries.xml

This example is based on the previous one. For more details, please check here.

Queries file to process :

../../_images/doc-filchecker-queries.png

The project’s doctree showing the resources directory (containing the fff, descriptor xml file and now queries file) to process :

../../_images/doc-filchecker-project-assert.png

SKF script :

../../_images/doc-filchecker-macro-assert.png

Result output on success :

../../_images/doc-filchecker-load-success.png

To get a clearer view of the functionnality offered by the ASSERT_FFF macro we can create a deliberate error in the queries file :

../../_images/doc-filchecker-assert-queries-error.png

Result output on failure :

../../_images/doc-filchecker-assert-fail.png