test/jdk/tools/jpackage/windows/WinUpgradeUUIDTest.java
branchJDK-8200758-branch
changeset 58113 885b0543f6e4
child 58301 e0efb29609bd
equal deleted inserted replaced
58037:c127c766fe8e 58113:885b0543f6e4
       
     1 /*
       
     2  * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  */
       
    23 
       
    24 import jdk.jpackage.test.PackageTest;
       
    25 import jdk.jpackage.test.PackageType;
       
    26 
       
    27 /**
       
    28  * Test both --win-upgrade-uuid and --app-version parameters. Output of the test
       
    29  * should be WinUpgradeUUIDTest-1.0.exe and WinUpgradeUUIDTest-2.0.exe
       
    30  * installers. Both output installers should provide the same functionality as
       
    31  * the default installer (see description of the default installer in
       
    32  * SimplePackageTest.java) but have the same product code and different
       
    33  * versions. Running WinUpgradeUUIDTest-2.0.exe installer should automatically
       
    34  * uninstall older version of the test application previously installed with
       
    35  * WinUpgradeUUIDTest-1.0.exe installer.
       
    36  */
       
    37 
       
    38 /*
       
    39  * @test
       
    40  * @summary jpackage with --win-upgrade-uuid and --app-version
       
    41  * @library ../helpers
       
    42  * @requires (os.family == "windows")
       
    43  * @modules jdk.jpackage/jdk.jpackage.internal
       
    44  * @run main/othervm -Xmx512m WinUpgradeUUIDTest
       
    45  */
       
    46 
       
    47 public class WinUpgradeUUIDTest {
       
    48     public static void main(String[] args) {
       
    49         PackageTest test = init();
       
    50         if (test.getAction() != PackageTest.Action.VERIFY_INSTALLED) {
       
    51             test.run();
       
    52         }
       
    53 
       
    54         test = init();
       
    55         test.addInitializer(cmd -> {
       
    56             cmd.setArgumentValue("--app-version", "2.0");
       
    57             cmd.setArgumentValue("--arguments", "bar");
       
    58         });
       
    59         test.run();
       
    60     }
       
    61 
       
    62     private static PackageTest init() {
       
    63         return new PackageTest()
       
    64         .forTypes(PackageType.WINDOWS)
       
    65         .configureHelloApp()
       
    66         .addInitializer(cmd -> cmd.addArguments("--win-upgrade-uuid",
       
    67                 "F0B18E75-52AD-41A2-BC86-6BE4FCD50BEB"));
       
    68     }
       
    69 }