mattcasters opened a new pull request, #7357:
URL: https://github.com/apache/hop/pull/7357

   Task: hardening the Apache Hop Testing Plugin, issue #7355 
   
   This report outlines the completed fixes and enhancements implemented in the 
Apache Hop codebase to resolve the issues described in the description above.
   ---
   
   ## 1. CSV Loader Safety (Out of Bounds Errors)
   * **Problem:** If a CSV data set file on disk changed (e.g. fewer columns) 
relative to the data set metadata or vice-versa, the CSV loader utility would 
throw `ArrayIndexOutOfBoundsException` errors.
   * **Resolution:** 
     * Updated 
[DataSetCsvUtil.java](file:///home/matt/git/mattcasters/hop/plugins/misc/testing/src/main/java/org/apache/hop/testing/DataSetCsvUtil.java):
 Added boundary checks on the index mapping arrays before invok
   ing `setRowMeta.getValueMeta(...)` and `csvRecord.get(...)`. Any missing or 
out-of-bound columns default gracefully to `null` instead of throwing 
exceptions.
     * Updated 
[DataSet.java](file:///home/matt/git/mattcasters/hop/plugins/misc/testing/src/main/java/org/apache/hop/testing/DataSet.java):
 Enhanced `getMappedDataSetFieldsRowMeta` to construct a dummy `ValueMetaStri
   ng` if a mapped field does not exist in the dataset metadata, preventing 
downstream NullPointerExceptions and metadata mismatches.
   
   ---
   
   ## 2. Open Selected Unit Test from Workflow Actions
   * **Problem:** Opening a pipeline via the *Run Unit Tests* action in a 
workflow opened the pipeline, but did not activate the specific unit test 
selected in that workflow action if multiple tests existed.
   * **Resolution:** 
     * Updated 
[RunPipelineTests.java](file:///home/matt/git/mattcasters/hop/plugins/misc/testing/src/main/java/org/apache/hop/testing/actions/runtests/RunPipelineTests.java):
 Set the chosen unit test's name in the `D
   ataSetConst.VAR_UNIT_TEST_NAME` environment variable (using reflection to 
access `HopGui` variables safely to maintain headless environment 
compatibility).
     * Updated 
[AutoOpenTestExtensionPoint.java](file:///home/matt/git/mattcasters/hop/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/AutoOpenTestExtensionPoint.java):
 Added checking for `DataSetConst.VA
   R_UNIT_TEST_NAME` during the `PipelineAfterOpen` extension point. If 
specified, the requested unit test is activated, and the variable is 
subsequently cleared.
   
   ---
   
   ## 3. Dataset Location Dialog Validation
   * **Problem:** Missing validation tools in the *Dataset Location Dialog* to 
check mapped/sort fields, file existence, and row reading.
   * **Resolution:** 
     * Updated 
[PipelineUnitTestSetLocationDialog.java](file:///home/matt/git/mattcasters/hop/ui/testing/PipelineUnitTestSetLocationDialog.java):
 Added a **Validate** button at the bottom of the dialog.
     * Implemented a `validate()` check that:
       1. Validates that a dataset and transform are selected.
       2. Validates that the dataset exists in metadata.
       3. Checks if the mapped fields exist in both the transform and the 
dataset.
       4. Checks if the sort fields exist in the dataset.
       5. Checks if the actual CSV file exists on disk.
       6. Validates if rows can be successfully read from the CSV file.
       7. Displays validation remarks using the standard Hop 
`CheckResultDialog` or a popup message box.
     * Added corresponding translations in 
[messages_en_US.properties](file:///home/matt/git/mattcasters/hop/plugins/misc/testing/src/main/resources/org/apache/hop/ui/testing/messages/messages_en_US.properties).
   
   ---
   
   ## 4. Context Menu Override on Golden Dataset Arrow Click
   * **Problem:** Right-clicking or clicking on a golden dataset arrow on the 
canvas unexpectedly popped up the general pipeline context menu along with the 
expected location dialog.
   * **Resolution:**
     * Created 
[LocationMouseUpExtensionPoint.java](file:///home/matt/git/mattcasters/hop/plugins/misc/testing/src/main/java/org/apache/hop/testing/xp/LocationMouseUpExtensionPoint.java):
 Registered to the `PipelineGr
   aphMouseUp` extension point.
     * Intercepts `MouseUp` events on the canvas: if the clicked AreaOwner 
belongs to `AREA_DRAWN_INPUT_DATA_SET`, `AREA_DRAWN_GOLDEN_DATA_SET`, or 
`AREA_DRAWN_GOLDEN_DATA_RESULT`, it sets `pipelineGraphExtension.setP
   reventingDefault(true)`, stopping the pipeline context dialog from appearing.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to