Test Project 2 Details
This second of the two test projects included with the JFileChecker installation is for fixed width files with the following column structure:
Other information to note about this test project is that
- Comment (text field, no constraints)
- First Name (text field between 2 and 20 charactes containing only letters and spaces)
- Last Name (text field between 2 and 21 charactes containing only letters and spaces)
- Birthday (date field accepting dates in yyyyMMdd format)
- Weight (non-negative integer numeric field)
- Gender (text field accepting only the case-sensitive values "M" and "F")
This is an example of a data file that may be checked for this test project.
- There is an unique constraint on the first name and last name fields
- Data files are expected to contain three header rows.
To set up this test project, the following files located in the installation's sql subfolder can be run in this order:
- If running Unix/Linux, edit and run test_2_unix_check_project.sql, if running windows, edit and run test_2_windows_check_project.sql.
These files are used to add data to the check_project table for test project #2 and contain defaults for data, log, and
file paths that may need to change (so edit the last three lines of the file before running it). The escape character
is also different. I've noticed that under Windows/Access, backslashes will get loaded from the query directly into the
database "as is" while under Linux/MySQL the backslashes need to be escaped with a second backslash. Please adjust the
backslashes in this query appropriately.
- run test_2_check_field_1.sql - adds data for handling the first field (Comment)
- run test_2_check_field_2.sql - adds data for handling the second field (First Name)
- run test_2_check_field_3.sql - adds data for handling the third field (Last Name)
- run test_2_check_field_4.sql - adds data for handling the fourth field (Birthday)
- run test_2_check_field_5.sql - adds data for handling the fifth field (Weight)
- run test_2_check_field_6.sql - adds data for handling the sixth field (Gender)
- run test_2_field_dt_format.sql - adds a date format for Birthday
- run test_2_project_constraint.sql - defines the unique constraint (Name)
- run test_2_field_constraint_1.sql - adds First Name to the unique constraint
- run test_2_field_constraint_2.sql - adds Last Name to the unique constraint
Test data for this project is located in the installation's testdata subfolder in a file named "test_2_data_file.dat".
This data file (or any other for this test project) should be copied to the data directory defined by the project's
data_path directory (given in the check_project table, defined in item 1 above). Similarly, be sure the data, log, and
result directories for this project (per the check_project table) exist and can have data written to them before running
JFileChecker. If all is set up and run properly, the result file generated by running JFileChecker against the test
project 2 data file should look like