changeset 59206:55e9cb6b23ec

8236518: There is no Native Packages WinUpgradeUUIDTest-2.0.exe after creating Native packages on win Reviewed-by: asemenyuk, almatvee
author herrick
date Thu, 07 May 2020 10:54:18 -0400
parents dea6a63e9ab0
children 4856a7a80c71
files test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java test/jdk/tools/jpackage/windows/WinUpgradeUUIDTest.java
diffstat 3 files changed, 18 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java	Thu May 07 17:47:11 2020 +0200
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java	Thu May 07 10:54:18 2020 -0400
@@ -603,7 +603,7 @@
 
         if (isImagePackageType()) {
             TKit.deleteDirectoryContentsRecursive(outputDir());
-        } else if (ThrowingSupplier.toSupplier(() -> Files.deleteIfExists(
+        } else if (ThrowingSupplier.toSupplier(() -> TKit.deleteIfExists(
                 outputBundle())).get()) {
             TKit.trace(
                     String.format("Deleted [%s] file before running jpackage",
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java	Thu May 07 17:47:11 2020 +0200
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java	Thu May 07 10:54:18 2020 -0400
@@ -399,6 +399,15 @@
         private boolean contentsOnly;
     }
 
+    public static boolean deleteIfExists(Path path) throws IOException {
+        if (isWindows()) {
+            if (path.toFile().exists()) {
+                Files.setAttribute(path, "dos:readonly", false);
+            }
+        }
+        return Files.deleteIfExists(path);
+    }
+
     /**
      * Deletes contents of the given directory recursively. Shortcut for
      * <code>deleteDirectoryContentsRecursive(path, null)</code>
--- a/test/jdk/tools/jpackage/windows/WinUpgradeUUIDTest.java	Thu May 07 17:47:11 2020 +0200
+++ b/test/jdk/tools/jpackage/windows/WinUpgradeUUIDTest.java	Thu May 07 10:54:18 2020 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@
  * @requires (jpackage.test.SQETest == null)
  * @build jdk.jpackage.test.*
  * @requires (os.family == "windows")
- * @modules jdk.jpackage/jdk.jpackage.internal
+ * @modules jdk.incubator.jpackage/jdk.incubator.jpackage.internal
  * @compile WinUpgradeUUIDTest.java
  * @run main/othervm/timeout=540 -Xmx512m jdk.jpackage.test.Main
  *  --jpt-run=WinUpgradeUUIDTest
@@ -79,10 +79,6 @@
             final UUID upgradeCode = UUID.fromString(
                     "F0B18E75-52AD-41A2-BC86-6BE4FCD50BEB");
             return new PackageTest()
-                .forTypes(PackageType.WINDOWS)
-                .configureHelloApp()
-                .addInitializer(cmd -> cmd.addArguments("--win-upgrade-uuid",
-                        upgradeCode.toString()))
                 .forTypes(PackageType.WIN_MSI)
                 .addBundlePropertyVerifier("UpgradeCode", value -> {
                     if (value.startsWith("{")) {
@@ -92,7 +88,12 @@
                         value = value.substring(0, value.length() - 1);
                     }
                     return UUID.fromString(value).equals(upgradeCode);
-                }, "is a match with");
+                }, "is a match with")
+                .forTypes(PackageType.WINDOWS)
+                .configureHelloApp()
+                .addInitializer(cmd -> cmd.addArguments("--win-upgrade-uuid",
+                        upgradeCode.toString())) ;
+
         };
 
         // Replace real uninstall command for the first package with nop action.