test/jdk/tools/jpackage/share/AppImagePackageTest.java
author herrick
Wed, 23 Oct 2019 10:10:34 -0400
branchJDK-8200758-branch
changeset 58761 88e2753a2334
parent 58464 d82489644b15
child 58993 b5e1baa9d2c3
permissions -rw-r--r--
8231972: Build a stable list of jpackager tests for SQE Submitted-by: asemenyuk Reviewed-by: aherrick, almatvee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
58301
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
     1
/*
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
     2
 * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
     4
 *
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
     7
 * published by the Free Software Foundation.
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
     8
 *
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    13
 * accompanied this code).
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    14
 *
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    18
 *
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    21
 * questions.
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    22
 */
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    23
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    24
import java.nio.file.Path;
58416
f09bf58c1f17 8231605: Improve test helpers
herrick
parents: 58415
diff changeset
    25
import jdk.jpackage.test.TKit;
58301
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    26
import jdk.jpackage.test.PackageTest;
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    27
import jdk.jpackage.test.PackageType;
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    28
import jdk.jpackage.test.JPackageCommand;
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    29
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    30
/**
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    31
 * Test --app-image parameter. The output installer should provide the same
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    32
 * functionality as the default installer (see description of the default
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    33
 * installer in SimplePackageTest.java)
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    34
 */
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    35
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    36
/*
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    37
 * @test
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    38
 * @summary jpackage with --app-image
58761
88e2753a2334 8231972: Build a stable list of jpackager tests for SQE
herrick
parents: 58464
diff changeset
    39
 * @key jpackagePlatformPackage
58301
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    40
 * @library ../helpers
58761
88e2753a2334 8231972: Build a stable list of jpackager tests for SQE
herrick
parents: 58464
diff changeset
    41
 * @requires (jpackage.test.SQETest == null)
58416
f09bf58c1f17 8231605: Improve test helpers
herrick
parents: 58415
diff changeset
    42
 * @build jdk.jpackage.test.*
58301
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    43
 * @modules jdk.jpackage/jdk.jpackage.internal
58464
d82489644b15 8215895: Verify and create tests for Mac installer specific signing options
herrick
parents: 58416
diff changeset
    44
 * @run main/othervm/timeout=540 -Xmx512m AppImagePackageTest
58301
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    45
 */
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    46
public class AppImagePackageTest {
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    47
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    48
    public static void main(String[] args) {
58416
f09bf58c1f17 8231605: Improve test helpers
herrick
parents: 58415
diff changeset
    49
        TKit.run(args, () -> {
58301
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    50
            Path appimageOutput = Path.of("appimage");
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    51
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    52
            JPackageCommand appImageCmd = JPackageCommand.helloAppImage()
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    53
                    .setArgumentValue("--dest", appimageOutput)
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    54
                    .addArguments("--package-type", "app-image");
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    55
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    56
            PackageTest packageTest = new PackageTest();
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    57
            if (packageTest.getAction() == PackageTest.Action.CREATE) {
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    58
                appImageCmd.execute();
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    59
            }
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    60
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    61
            packageTest.addInitializer(cmd -> {
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    62
                Path appimageInput = appimageOutput.resolve(appImageCmd.name());
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    63
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    64
                if (PackageType.MAC.contains(cmd.packageType())) {
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    65
                    // Why so complicated on macOS?
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    66
                    appimageInput = Path.of(appimageInput.toString() + ".app");
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    67
                }
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    68
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    69
                cmd.addArguments("--app-image", appimageInput);
58416
f09bf58c1f17 8231605: Improve test helpers
herrick
parents: 58415
diff changeset
    70
                cmd.removeArgumentWithValue("--input");
58301
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    71
            }).addBundleDesktopIntegrationVerifier(false).run();
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    72
        });
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    73
    }
e0efb29609bd 8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
diff changeset
    74
}