Path: blob/master/test/jdk/tools/jpackage/linux/PackageDepsTest.java
41152 views
/*1* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223import jdk.jpackage.test.TKit;24import jdk.jpackage.test.PackageTest;25import jdk.jpackage.test.PackageType;26import jdk.jpackage.test.LinuxHelper;27import jdk.jpackage.test.Annotations.Test;282930/**31* Test --linux-package-deps parameter. Output of the test should be32* apackagedepstestprereq_1.0-1_amd64.deb and packagedepstest_1.0-1_amd64.deb or33* apackagedepstestprereq-1.0-1.amd64.rpm and packagedepstest-1.0-1.amd64.rpm34* package bundles. The output packages should provide the same functionality as35* the default package.36*37* deb: Value of Depends property of packagedepstest package should contain38* apackagedepstestprereq word.39*40* rpm: Value of Requires property of packagedepstest package should contain41* apackagedepstestprereq word.42*/434445/*46* @test47* @summary jpackage with --linux-package-deps48* @library ../helpers49* @key jpackagePlatformPackage50* @build jdk.jpackage.test.*51* @requires (os.family == "linux")52* @modules jdk.jpackage/jdk.jpackage.internal53* @compile PackageDepsTest.java54* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main55* --jpt-run=PackageDepsTest56*/57public class PackageDepsTest {5859@Test60public static void test() {61final String PREREQ_PACKAGE_NAME = "apackagedepstestprereq";6263PackageTest test1 = new PackageTest()64.forTypes(PackageType.LINUX)65.configureHelloApp()66.addInitializer(cmd -> {67cmd.setArgumentValue("--name", PREREQ_PACKAGE_NAME);68});6970PackageTest test2 = new PackageTest()71.forTypes(PackageType.LINUX)72.configureHelloApp()73.addInitializer(cmd -> {74cmd.addArguments("--linux-package-deps", PREREQ_PACKAGE_NAME);75})76.forTypes(PackageType.LINUX)77.addBundleVerifier(cmd -> {78TKit.assertTrue(79LinuxHelper.getPrerequisitePackages(cmd).contains(80PREREQ_PACKAGE_NAME), String.format(81"Check package depends on [%s] package",82PREREQ_PACKAGE_NAME));83});8485new PackageTest.Group(test1, test2).run();86}87}888990