|
| 1 | +/* |
| 2 | + * Copyright (c) 2020, 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 | +package jdk.jpackage.tests; |
| 25 | + |
| 26 | +import jdk.jpackage.test.PackageTest; |
| 27 | +import jdk.jpackage.test.PackageType; |
| 28 | +import jdk.jpackage.test.Annotations.Test; |
| 29 | + |
| 30 | +/** |
| 31 | + * Test --vendor parameter. Output of the test should be |
| 32 | + * vendortest*.* package bundle. The output package should provide the |
| 33 | + * same functionality as the default package with the default value of vendor |
| 34 | + * property overridden. |
| 35 | + * |
| 36 | + * Linux DEB: |
| 37 | + * |
| 38 | + * Value of "Maintainer" property of .deb package should start with "Test Vendor" string. |
| 39 | + * |
| 40 | + * Linux RPM: |
| 41 | + * |
| 42 | + * Value of "Vendor" property of .rpm package should be set to "Test Vendor" string. |
| 43 | + * |
| 44 | + * Mac: |
| 45 | + * |
| 46 | + * --vendor parameter is ignored. |
| 47 | + * |
| 48 | + * Windows: |
| 49 | + * |
| 50 | + * Publisher value displayed in the Add/Remove Programs should be set |
| 51 | + * to "Test Vendor" string. |
| 52 | + */ |
| 53 | + |
| 54 | +/* |
| 55 | + * @test |
| 56 | + * @summary Test --vendor jpackage command option |
| 57 | + * @library ../../../../helpers |
| 58 | + * @key jpackagePlatformPackage |
| 59 | + * @requires (os.family == "windows") |
| 60 | + * @requires jpackage.test.SQETest != null |
| 61 | + * @build jdk.jpackage.test.* |
| 62 | + * @modules jdk.jpackage/jdk.jpackage.internal |
| 63 | + * @compile VendorTest.java |
| 64 | + * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main |
| 65 | + * --jpt-run=jdk.jpackage.tests.VendorTest |
| 66 | + */ |
| 67 | + |
| 68 | +/* |
| 69 | + * @test |
| 70 | + * @summary Test --vendor jpackage command option |
| 71 | + * @library ../../../../helpers |
| 72 | + * @key jpackagePlatformPackage |
| 73 | + * @requires (os.family != "mac") |
| 74 | + * @requires jpackage.test.SQETest == null |
| 75 | + * @build jdk.jpackage.test.* |
| 76 | + * @modules jdk.jpackage/jdk.jpackage.internal |
| 77 | + * @compile VendorTest.java |
| 78 | + * @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main |
| 79 | + * --jpt-run=jdk.jpackage.tests.VendorTest |
| 80 | + */ |
| 81 | +public class VendorTest { |
| 82 | + |
| 83 | + @Test |
| 84 | + public static void test() { |
| 85 | + final String vendorValue = "Test Vendor"; |
| 86 | + |
| 87 | + new PackageTest() |
| 88 | + .configureHelloApp() |
| 89 | + .addBundleDesktopIntegrationVerifier(false) |
| 90 | + .addInitializer(cmd -> { |
| 91 | + cmd.addArguments("--vendor", vendorValue); |
| 92 | + }) |
| 93 | + .forTypes(PackageType.LINUX_DEB) |
| 94 | + .addBundlePropertyVerifier("Maintainer", value -> { |
| 95 | + return value.startsWith(vendorValue + " "); |
| 96 | + }, "starts with") |
| 97 | + .forTypes(PackageType.LINUX_RPM) |
| 98 | + .addBundlePropertyVerifier("Vendor", value -> { |
| 99 | + return value.equals(vendorValue); |
| 100 | + }, "equals to") |
| 101 | + .forTypes(PackageType.WIN_MSI) |
| 102 | + .addBundlePropertyVerifier("Manufacturer", value -> { |
| 103 | + return value.equals(vendorValue); |
| 104 | + }, "equals to") |
| 105 | + .run(); |
| 106 | + } |
| 107 | +} |
0 commit comments