Filechecker Plugin - Macros¶
Contents :
# 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 :
Descriptor xml file to process (partial) :
The project’s doctree showing the resources directory (containing the fff and descriptor xml file) to process :
SKF script :
Result output on success :
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 :
Result output on failure :
# 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 :
The project’s doctree showing the resources directory (containing the fff, descriptor xml file and now queries file) to process :
SKF script :
Result output on success :
To get a clearer view of the functionnality offered by the ASSERT_FFF macro we can create a deliberate error in the queries file :
Result output on failure :