Add a test to verify jpackage is using a custom MSI condition blocking package 
installation depending on the version of Windows where the package installer 
runs. Support for this MSI condition was added in 
[JDK-8150442](https://bugs.openjdk.org/browse/JDK-8150442).

The test adds an unconditionally failing OS-version MSI condition to the 
resource directory. MSI installer using this condition should always fail. The 
exit code of the failed installation would be 1603. Extended error information 
can be dug in the MSI log file. To make the test work, the following changes to 
jpackage test lib have been made:
 - Support non-0 exit code from MSI install handler. Support for non-0 exit 
codes was added to install handlers of all other types too. Added 
`PackageTest.setExpectedInstallExitCode(int)` method to configure the expected 
exit code of a package installation;
 - Support using msi log files when MSI and EXE packages get installed, 
unpacked, or uninstalled. Added `PackageTest.createMsiLog(boolean)` to enable 
or disable creation of msi log files in a PackageTest instance and 
`Optional<Path> JPackageCommand.winMsiLogFile()` to access the current log file 
from the callbacks registered with the PackageTest instance.

Added tests for PackageTest class (PackageTestTest).

Additionally, improved the code in WindowsHelper detecting paths to Start Menu, 
Desktop, and other common paths. Previously, it relied on reading these paths 
from the registry. On some machines, required registry keys are not available. 
The code now will call .NET `Environment.GetFolderPath()` function through 
powershell if a registry key is missing.

-------------

Commit messages:
 - Cleanup
 - Merge branch 'master' into decouple-os-condition
 - Merge branch 'decouple-tkit' into decouple-os-condition
 - Better log message
 - Better test description and add tests for roles with dots
 - Merge branch 'master' into decouple-tkit
 - Test if the main jar is in the app image if specified.
 - Merge branch 'decouple-executor-result' into decouple-tkit
 - Merge branch 'decouple-fix-annotations' into decouple-executor-result
 - Fix javac error
 - ... and 37 more: https://git.openjdk.org/jdk/compare/0f822681...a27cb527

Changes: https://git.openjdk.org/jdk/pull/23825/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23825&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8350013
  Stats: 1879 lines in 8 files changed: 1405 ins; 160 del; 314 mod
  Patch: https://git.openjdk.org/jdk/pull/23825.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23825/head:pull/23825

PR: https://git.openjdk.org/jdk/pull/23825

Reply via email to