mattcasters opened a new pull request, #7369: URL: https://github.com/apache/hop/pull/7369
# Pull Request: Auto-create root folders for file-based execution info locations (Hop-7341) ## Description This pull request addresses issue [#7341](https://github.com/apache/hop/issues/7341) where file-based execution information locations (`FileExecutionInfoLocation` and `CachingFileExecutionInfoLocation`) failed with an error if their configured destination/root folder did not exist. We have added a new checkbox property `Create folder?` (`createParentFolder`) to both plugins: - Positioned below the root folder (order `015`). - Defaults to `true` in constructors for new metadata elements. - Implemented folder checks and creation inside the `initialize()` method of both classes using `HopVfs`. --- ## Detailed Changes ### Core Code Changes 1. **`CachingFileExecutionInfoLocation.java`**: - Added the `createParentFolder` property with `@GuiWidgetElement` and `@HopMetadataProperty`. - Set the property to `true` by default in the constructor. - Updated the `initialize()` method to create the resolved `actualRootFolder` if `createParentFolder` is enabled. 2. **`FileExecutionInfoLocation.java`**: - Added the `createParentFolder` property with `@GuiWidgetElement` and `@HopMetadataProperty`. - Set the property to `true` by default in constructors. - Added `isCreateParentFolder()` and `setCreateParentFolder(...)` getter/setter. - Updated the `initialize()` method to create the resolved `rootFolder` if `createParentFolder` is enabled. ### Resource & Translation Bundles Added translations for the label (`Create folder?`) and tooltip (`Check this option to create the specified folder if it doesn't exist.`) in: - `engine/src/main/resources/org/apache/hop/execution/caching/messages/messages_en_US.properties` (`CachingFileExecutionInfoLocation.CreateParentFolder.Label`/`Tooltip`) - `engine/src/main/resources/org/apache/hop/execution/local/messages/messages_en_US.properties` (`LocalExecutionInfoLocation.CreateParentFolder.Label`/`Tooltip`) - `engine/src/main/resources/org/apache/hop/execution/messages/messages_en_US.properties` (`LocalExecutionInfoLocation.CreateParentFolder.Label`/`Tooltip`) ### Documentation - Updated `docs/hop-user-manual/modules/ROOT/pages/metadata-types/execution-information-location.adoc` to document the new `Create folder?` option under the `File location` and `Caching File Location` specific options. ### Tests Created two new JUnit 5 unit tests verifying that both plugins correctly create folders when `createParentFolder` is `true`, and do not create them when it is `false`: - `org.apache.hop.execution.local.FileExecutionInfoLocationTest` - `org.apache.hop.execution.caching.CachingFileExecutionInfoLocationTest` --- ## Verification - **Unit Tests**: Executed successfully (`Tests run: 4, Failures: 0, Errors: 0, Skipped: 0`). - **Style Formatting**: Cleaned and validated via `./mvnw spotless:check -pl engine`. -- 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]
