e345ee opened a new pull request, #6726:
URL: https://github.com/apache/jmeter/pull/6726

   ## Description
   
   This PR fixes `CSVDataSet.getFilename()` when a test plan is loaded through 
`SaveService.loadTree()`.
   
   `CSVDataSet` keeps TestBean values in transient fields during normal 
execution, while loaded JMX values are restored into the element property map. 
Because of that, `getFilename()` could return `null` right after loading a test 
plan, even though the `filename` property was already present.
   
   The change keeps the existing runtime behavior, but makes `getFilename()` 
fall back to the stored `filename` property when the transient field has not 
been populated yet.
   
   ## Motivation and Context
   
   Fixes #6451.
   
   I ran into this while working with JMeter test plans programmatically. After 
loading a JMX file, `CSVDataSet` already has the `filename` value in its 
property map, but `getFilename()` still returns `null` until TestBean 
preparation runs.
   
   That makes it harder to inspect or validate loaded test plans, so this PR 
makes the getter return the already-loaded value in that case.
   
   ## How Has This Been Tested?
   
   Tested locally with:
   
   - `./gradlew :src:components:test --tests 
org.apache.jmeter.config.TestCVSDataSet.testFilenameGetterAfterLoadingTestPlan 
-Djava.awt.headless=true`
   - `./gradlew :src:components:test --tests 
org.apache.jmeter.config.TestCVSDataSet -Djava.awt.headless=true`
   - `./gradlew :src:components:checkstyleMain :src:components:checkstyleTest`
   - `git diff --check`
   
   The new regression test loads a minimal JMX file with 
`SaveService.loadTree()`, finds the `CSVDataSet`, and verifies that both the 
raw `filename` property and `getFilename()` return the expected value.
   
   ## Screenshots (if appropriate):
   
   Not applicable.
   
   ## Types of changes
   
   - Bug fix (non-breaking change which fixes an issue)
   
   ## Checklist:
   
   - [x] My code follows the [code style][style-guide] of this project.
   - [x] I have updated the documentation accordingly.
   
   [style-guide]: https://wiki.apache.org/jmeter/CodeStyleGuidelines


-- 
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