test/jdk/tools/jpackage/share/LicenseTest.java
branchJDK-8200758-branch
changeset 58648 3bf53ffa9ae7
parent 58418 7cd20dbeee36
child 58761 88e2753a2334
--- a/test/jdk/tools/jpackage/share/LicenseTest.java	Wed Oct 16 09:57:23 2019 -0400
+++ b/test/jdk/tools/jpackage/share/LicenseTest.java	Wed Oct 16 10:32:08 2019 -0400
@@ -38,14 +38,14 @@
 import jdk.jpackage.test.TKit;
 
 /**
- * Test --license-file parameter. Output of the test should be licensetest*.*
+ * Test --license-file parameter. Output of the test should be commonlicensetest*.*
  * package bundle. The output package should provide the same functionality as
  * the default package and also incorporate license information from
  * test/jdk/tools/jpackage/resources/license.txt file from OpenJDK repo.
  *
  * deb:
  *
- * Package should install license file /usr/share/doc/licensetest/copyright
+ * Package should install license file /opt/commonlicensetest/share/doc/copyright
  * file.
  *
  * rpm:
@@ -88,20 +88,8 @@
     public static void testCommon() {
         new PackageTest().configureHelloApp()
         .addInitializer(cmd -> {
-            Path licenseCopy = TKit.workDir().resolve(LICENSE_FILE.getFileName()).toAbsolutePath().normalize();
-            Files.copy(LICENSE_FILE, licenseCopy,
-                    StandardCopyOption.REPLACE_EXISTING);
-            final Path basePath = Path.of(".").toAbsolutePath().normalize();
-            try {
-                licenseCopy = basePath.relativize(licenseCopy);
-            } catch (IllegalArgumentException ex) {
-                // May happen on Windows: java.lang.IllegalArgumentException: 'other' has different root
-                TKit.trace(String.format(
-                        "Not using relative path to license file for --license-file parameter. Failed to relativize [%s] at [%s]",
-                        licenseCopy, basePath));
-                ex.printStackTrace();
-            }
-            cmd.addArguments("--license-file", licenseCopy);
+            cmd.addArguments("--license-file", TKit.createRelativePathCopy(
+                    LICENSE_FILE));
         })
         .forTypes(PackageType.LINUX)
         .addBundleVerifier(cmd -> {