Path: blob/master/test/jdk/tools/jpackage/linux/AppAboutUrlTest.java
66644 views
/*1* Copyright (c) 2021, 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.Annotations.Test;24import jdk.jpackage.test.Functional.ThrowingConsumer;25import jdk.jpackage.test.JPackageCommand;26import jdk.jpackage.test.PackageTest;27import jdk.jpackage.test.PackageType;282930/**31* Test --about-url parameter in Linux installers. Output of the test should be32* appabouturltest_1.0-1_amd64.deb or appabouturltest-1.0-1.amd64.rpm package33* bundle. The output package should provide the same functionality as the34* default package.35*36* deb:37* Homepage property of the package should be set to http://foo.com value.38*39* rpm:40* URL property of the package should be set to http://foo.com value.41*/4243/*44* @test45* @summary jpackage with --about-url46* @library ../helpers47* @key jpackagePlatformPackage48* @build jdk.jpackage.test.*49* @build AppAboutUrlTest50* @requires (os.family == "linux")51* @requires (jpackage.test.SQETest == null)52* @modules jdk.jpackage/jdk.jpackage.internal53* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main54* --jpt-run=AppAboutUrlTest55*/5657/*58* @test59* @summary jpackage with --about-url60* @library ../helpers61* @key jpackagePlatformPackage62* @build jdk.jpackage.test.*63* @build AppAboutUrlTest64* @requires (os.family == "linux")65* @requires (jpackage.test.SQETest != null)66* @modules jdk.jpackage/jdk.jpackage.internal67* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main68* --jpt-run=AppAboutUrlTest.test69*/70public class AppAboutUrlTest {7172@Test73public static void test() {74final String ABOUT_URL = "http://foo.com";7576runTest(cmd -> {77cmd.addArguments("--about-url", ABOUT_URL);78}, ABOUT_URL, ABOUT_URL);79}8081@Test82public static void testDefaults() {83runTest(JPackageCommand::setFakeRuntime, "", "(none)");84}8586private static void runTest(ThrowingConsumer<JPackageCommand> initializer,87String expectedDebHomepage, String expectedRpmUrl) {88new PackageTest()89.forTypes(PackageType.LINUX)90.configureHelloApp()91.addInitializer(initializer)92.forTypes(PackageType.LINUX_DEB)93.addBundlePropertyVerifier("Homepage", expectedDebHomepage)94.forTypes(PackageType.LINUX_RPM)95.addBundlePropertyVerifier("URL", expectedRpmUrl)96.run();97}98}99100101