Skip to content

Commit

Permalink
Merge pull request #687 from NASA-PDS/issue_684
Browse files Browse the repository at this point in the history
Bug fix for checking delimited tables that define an object_length
  • Loading branch information
jordanpadams committed Aug 23, 2023
2 parents 4996f2a + d7bc323 commit ec0283d
Show file tree
Hide file tree
Showing 4 changed files with 400 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/test/resources/features/validate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Scenario Outline: Execute validate command for tests below.
Examples:
| testName | testDir | messageCount | messageText | problemEnum | resourceDir | reportDir | commandArgs | refOutputValue |

# Validate#684
|"NASA-PDS/validate#684 Success without filesize" | "github684" | 0 | "0 errors expected" | "totalErrors" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github684_1.json -s json --skip-context-validation -t {resourceDir}/github684/example_params_noFileSize.xml" | "report_github684_1.json" |
|"NASA-PDS/validate#684 Success with filesize" | "github684" | 0 | "0 errors expected" | "totalErrors" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github684_2.json -s json --skip-context-validation -t {resourceDir}/github684/example_params_wFileSize.xml" | "report_github684_2.json" |

# Validate#683
|"NASA-PDS/validate#683 Success warn out of order offsets" | "github614" | 1 | "1 warnings expected" | "DATA_OBJECTS_OUT_OF_ORDER" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github683.json -s json -t {resourceDir}/github614/ss__0505_0711794861_465rmo__0261222srlc10000w0__cgnj02.xml" | "report_github683.json" |

Expand Down
6 changes: 6 additions & 0 deletions src/test/resources/github684/example_params.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0
100 100 100 100
1.0 1.0 1.0 1.0
filename1.fits
filename2.fits
195 changes: 195 additions & 0 deletions src/test/resources/github684/example_params_noFileSize.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
<?xml version='1.0' encoding='UTF-8'?>
<?xml-model href="https://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1I00.sch"
schematypens="http://purl.oclc.org/dsdl/schematron"?>
<?xml-model href="https://pds.nasa.gov/pds4/img/v1/PDS4_IMG_1I00_1860.sch"
schematypens="http://purl.oclc.org/dsdl/schematron"?>
<Product_Observational xmlns="http://pds.nasa.gov/pds4/pds/v1" xmlns:img="http://pds.nasa.gov/pds4/img/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pds.nasa.gov/pds4/pds/v1 https://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1I00.xsd http://pds.nasa.gov/pds4/img/v1 https://pds.nasa.gov/pds4/img/v1/PDS4_IMG_1I00_1860.xsd">
<Identification_Area>
<logical_identifier>urn:nasa:pds:lucy.ttcam:calibration:example_params</logical_identifier>
<version_id>1.1</version_id>
<title>TTCam Parameters</title>
<information_model_version>1.18.0.0</information_model_version>
<product_class>Product_Observational</product_class>
</Identification_Area>
<Observation_Area>
<Time_Coordinates>
<start_date_time>2023Z</start_date_time>
<stop_date_time>2023Z</stop_date_time>
</Time_Coordinates>
<Investigation_Area>
<name>Lucy</name>
<type>Mission</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:investigation:mission.lucy</lid_reference>
<reference_type>data_to_investigation</reference_type>
</Internal_Reference>
</Investigation_Area>
<Observing_System>
<Observing_System_Component>
<name>Lucy</name>
<type>Host</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:instrument_host:spacecraft.lucy</lid_reference>
<reference_type>is_instrument_host</reference_type>
</Internal_Reference>
</Observing_System_Component>
<Observing_System_Component>
<name>Terminal Tracking Cameras (TTCam)</name>
<type>Instrument</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:instrument:lucy.ttcam</lid_reference>
<reference_type>is_instrument</reference_type>
</Internal_Reference>
</Observing_System_Component>
</Observing_System>
<Target_Identification>
<name>Placeholder</name>
<type>Calibrator</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:target:calibrator.cal</lid_reference>
<reference_type>data_to_target</reference_type>
</Internal_Reference>
</Target_Identification>
<Discipline_Area/>
</Observation_Area>
<Reference_List/>
<File_Area_Observational>
<File>
<file_name>example_params.txt</file_name>
<local_identifier>data_file</local_identifier>
<creation_date_time>2023Z</creation_date_time>
<!-- <file_size unit="byte">94</file_size> -->
<md5_checksum>2f9a5e6ac515500aaac6236c0e118d3e</md5_checksum>
</File>
<Table_Delimited>
<offset unit="byte">0</offset>
<object_length unit="byte">24</object_length>
<parsing_standard_id>PDS DSV 1</parsing_standard_id>
<description>first line of parameters</description>
<records>1</records>
<record_delimiter>Line-Feed</record_delimiter>
<field_delimiter>Horizontal Tab</field_delimiter>
<Record_Delimited>
<fields>6</fields>
<groups>0</groups>
<Field_Delimited>
<name>p1</name>
<data_type>ASCII_Real</data_type>
</Field_Delimited>
<Field_Delimited>
<name>p2</name>
<data_type>ASCII_Real</data_type>
</Field_Delimited>
<Field_Delimited>
<name>p3</name>
<data_type>ASCII_Real</data_type>
</Field_Delimited>
<Field_Delimited>
<name>p4</name>
<data_type>ASCII_Real</data_type>
</Field_Delimited>
<Field_Delimited>
<name>p5</name>
<data_type>ASCII_Real</data_type>
</Field_Delimited>
<Field_Delimited>
<name>p6</name>
<data_type>ASCII_Real</data_type>
</Field_Delimited>
</Record_Delimited>
</Table_Delimited>
<Table_Delimited>
<offset unit="byte">24</offset>
<object_length unit="byte">8</object_length>
<parsing_standard_id>PDS DSV 1</parsing_standard_id>
<description>second line of parameters</description>
<records>1</records>
<record_delimiter>Line-Feed</record_delimiter>
<field_delimiter>Horizontal Tab</field_delimiter>
<Record_Delimited>
<fields>2</fields>
<groups>0</groups>
<Field_Delimited>
<name>first_param</name>
<data_type>ASCII_Real</data_type>
</Field_Delimited>
<Field_Delimited>
<name>second_param</name>
<data_type>ASCII_Real</data_type>
</Field_Delimited>
</Record_Delimited>
</Table_Delimited>
<Table_Delimited>
<offset unit="byte">32</offset>
<object_length unit="byte">16</object_length>
<parsing_standard_id>PDS DSV 1</parsing_standard_id>
<description>third line of parameters</description>
<records>1</records>
<record_delimiter>Line-Feed</record_delimiter>
<field_delimiter>Horizontal Tab</field_delimiter>
<Record_Delimited>
<fields>4</fields>
<groups>0</groups>
<Field_Delimited>
<name>value1</name>
<data_type>ASCII_NonNegative_Integer</data_type>
</Field_Delimited>
<Field_Delimited>
<name>value2</name>
<data_type>ASCII_NonNegative_Integer</data_type>
</Field_Delimited>
<Field_Delimited>
<name>value3</name>
<data_type>ASCII_NonNegative_Integer</data_type>
</Field_Delimited>
<Field_Delimited>
<name>value4</name>
<data_type>ASCII_NonNegative_Integer</data_type>
</Field_Delimited>
</Record_Delimited>
</Table_Delimited>
<Table_Delimited>
<offset unit="byte">48</offset>
<object_length unit="byte">16</object_length>
<parsing_standard_id>PDS DSV 1</parsing_standard_id>
<description>fourth line of parameters</description>
<records>1</records>
<record_delimiter>Line-Feed</record_delimiter>
<field_delimiter>Horizontal Tab</field_delimiter>
<Record_Delimited>
<fields>4</fields>
<groups>0</groups>
<Field_Delimited>
<name>coeff1</name>
<data_type>ASCII_Real</data_type>
</Field_Delimited>
<Field_Delimited>
<name>coeff2</name>
<data_type>ASCII_Real</data_type>
</Field_Delimited>
<Field_Delimited>
<name>coeff3</name>
<data_type>ASCII_Real</data_type>
</Field_Delimited>
<Field_Delimited>
<name>coeff4</name>
<data_type>ASCII_Real</data_type>
</Field_Delimited>
</Record_Delimited>
</Table_Delimited>
<Stream_Text>
<name>file name 1</name>
<offset unit="byte">64</offset>
<object_length unit="byte">15</object_length>
<parsing_standard_id>7-Bit ASCII Text</parsing_standard_id>
<record_delimiter>Line-Feed</record_delimiter>
</Stream_Text>
<Stream_Text>
<name>file name 2</name>
<offset unit="byte">79</offset>
<object_length unit="byte">15</object_length>
<parsing_standard_id>7-Bit ASCII Text</parsing_standard_id>
<record_delimiter>Line-Feed</record_delimiter>
</Stream_Text>
</File_Area_Observational>
</Product_Observational>
Loading

0 comments on commit ec0283d

Please sign in to comment.