#1869: Improve windows helper to search windows registry#1876
#1869: Improve windows helper to search windows registry#1876jakozian wants to merge 13 commits into
Conversation
… entries from registry
Coverage Report for CI Build 25717685842Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage decreased (-0.09%) to 70.643%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions285 previously-covered lines in 13 files lost coverage.
Coverage Stats💛 - Coveralls |
MarvMa
left a comment
There was a problem hiding this comment.
Thats a really easy to read PR following the KISS principle, which I personally appreciate a lot 👍 I left some comments regarding minor changes. I have been more critical since that has been the desired task. But the coments are just related to minor changes in code-style regarding the coding-conventions of IDEasy.
Co-authored-by: MarvMa <marvin.meitzner@gmail.com>
…evonfw#1869-improve-windows-helper-to-search-windows-registry
| } | ||
| for (String line : out) { | ||
| line = line.trim(); | ||
| if (line.startsWith("HKEY_")) { |
There was a problem hiding this comment.
if registryBasePath was "HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall" this will never be true? So it that entry in the constant array pointless then?
Should this rather be like this:
| if (line.startsWith("HKEY_")) { | |
| if (line.startsWith(registryBasePath)) { |
There was a problem hiding this comment.
The output of reg query <path> /s looks something like this:

That means the HKCU of the path is written out in the output and in this case HK = HKEY and CU=Current User. For that reason i did not check for line.startsWith(registryBasePath).
And the goal is to find the path to the tool and every path (doesn't matter which base path, LM or CU) begins with HKEY_ so that seemed to be the right decision in my opinion.
| private static final String MOCK_APP_NAME = "TestApp"; | ||
|
|
||
| private static final String MOCK_DISPLAY_VERSION = "1.1.1"; | ||
|
|
||
| private static final String MOCK_INSTALL_LOCATION = "C:\\Program Files\\TestApp"; | ||
|
|
||
| private static final String MOCK_DISPLAY_ICON = | ||
| "C:\\Program Files\\TestApp\\testapp.exe,0"; | ||
| private static final String MOCK_UNINSTALL_STRING = | ||
| "\"C:\\Program Files\\TestApp\\uninstall.exe\""; |
There was a problem hiding this comment.
for mocking we should use a Map where mock data for tests can be registered instead of hard-coding random values.
Assuming you want to test PGAdmin now with mocked Windows on any OS then you could first register for the key pgadmin some object (Java record) containing the displayIcon, appName, and displayVersion, etc.
Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>
This PR fixes #1869
Implemented changes:
DisplayVersion,DisplayIcon,InstallLocationandUninstallStringin common registry paths for an application.Checklist for this PR
Make sure everything is checked before merging this PR. For further info please also see
our DoD.
mvn clean testlocally all tests pass and build is successful#«issue-id»: «brief summary»(e.g.#921: fixed setup.bat). If no issue ID exists, title only.In Progressand assigned to you or there is no issue (might happen for very small PRs)with
internal