1 /* 2 * Copyright (c) 2018, 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.TKit; 25 import jdk.jpackage.test.PackageTest; 26 import jdk.jpackage.test.PackageType; 27 import jdk.jpackage.test.LinuxHelper; 28 import jdk.jpackage.test.Annotations.Test; 29 30 31 /** 32 * Test --linux-package-deps parameter. Output of the test should be 33 * apackagedepstestprereq_1.0-1_amd64.deb and packagedepstest_1.0-1_amd64.deb or 34 * apackagedepstestprereq-1.0-1.amd64.rpm and packagedepstest-1.0-1.amd64.rpm 35 * package bundles. The output packages should provide the same functionality as 36 * the default package. 37 * 38 * deb: Value of Depends property of packagedepstest package should contain 39 * apackagedepstestprereq word. 40 * 41 * rpm: Value of Requires property of packagedepstest package should contain 42 * apackagedepstestprereq word. 43 */ 44 45 46 /* 47 * @test 48 * @summary jpackage with --linux-package-deps 49 * @library ../helpers 50 * @key jpackagePlatformPackage 51 * @build jdk.jpackage.test.* 52 * @requires (os.family == "linux") 53 * @modules jdk.incubator.jpackage/jdk.incubator.jpackage.internal 54 * @compile PackageDepsTest.java 55 * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main 56 * --jpt-run=PackageDepsTest 57 */ 58 public class PackageDepsTest { 59 60 @Test 61 public static void test() { 62 final String PREREQ_PACKAGE_NAME = "apackagedepstestprereq"; 63 64 PackageTest test1 = new PackageTest() 65 .forTypes(PackageType.LINUX) 66 .configureHelloApp() 67 .addInitializer(cmd -> { 68 cmd.setArgumentValue("--name", PREREQ_PACKAGE_NAME); 69 }); 70 71 PackageTest test2 = new PackageTest() 72 .forTypes(PackageType.LINUX) 73 .configureHelloApp() 74 .addInitializer(cmd -> { 75 cmd.addArguments("--linux-package-deps", PREREQ_PACKAGE_NAME); 76 }) 77 .forTypes(PackageType.LINUX) 78 .addBundleVerifier(cmd -> { 79 TKit.assertTrue( 80 LinuxHelper.getPrerequisitePackages(cmd).contains( 81 PREREQ_PACKAGE_NAME), String.format( 82 "Check package depends on [%s] package", 83 PREREQ_PACKAGE_NAME)); 84 }); 85 86 new PackageTest.Group(test1, test2).run(); 87 } 88 }