Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/jdk17u
Path: blob/master/test/jdk/tools/jpackage/linux/AppAboutUrlTest.java
66644 views
1
/*
2
* Copyright (c) 2021, 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.Annotations.Test;
25
import jdk.jpackage.test.Functional.ThrowingConsumer;
26
import jdk.jpackage.test.JPackageCommand;
27
import jdk.jpackage.test.PackageTest;
28
import jdk.jpackage.test.PackageType;
29
30
31
/**
32
* Test --about-url parameter in Linux installers. Output of the test should be
33
* appabouturltest_1.0-1_amd64.deb or appabouturltest-1.0-1.amd64.rpm package
34
* bundle. The output package should provide the same functionality as the
35
* default package.
36
*
37
* deb:
38
* Homepage property of the package should be set to http://foo.com value.
39
*
40
* rpm:
41
* URL property of the package should be set to http://foo.com value.
42
*/
43
44
/*
45
* @test
46
* @summary jpackage with --about-url
47
* @library ../helpers
48
* @key jpackagePlatformPackage
49
* @build jdk.jpackage.test.*
50
* @build AppAboutUrlTest
51
* @requires (os.family == "linux")
52
* @requires (jpackage.test.SQETest == null)
53
* @modules jdk.jpackage/jdk.jpackage.internal
54
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
55
* --jpt-run=AppAboutUrlTest
56
*/
57
58
/*
59
* @test
60
* @summary jpackage with --about-url
61
* @library ../helpers
62
* @key jpackagePlatformPackage
63
* @build jdk.jpackage.test.*
64
* @build AppAboutUrlTest
65
* @requires (os.family == "linux")
66
* @requires (jpackage.test.SQETest != null)
67
* @modules jdk.jpackage/jdk.jpackage.internal
68
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
69
* --jpt-run=AppAboutUrlTest.test
70
*/
71
public class AppAboutUrlTest {
72
73
@Test
74
public static void test() {
75
final String ABOUT_URL = "http://foo.com";
76
77
runTest(cmd -> {
78
cmd.addArguments("--about-url", ABOUT_URL);
79
}, ABOUT_URL, ABOUT_URL);
80
}
81
82
@Test
83
public static void testDefaults() {
84
runTest(JPackageCommand::setFakeRuntime, "", "(none)");
85
}
86
87
private static void runTest(ThrowingConsumer<JPackageCommand> initializer,
88
String expectedDebHomepage, String expectedRpmUrl) {
89
new PackageTest()
90
.forTypes(PackageType.LINUX)
91
.configureHelloApp()
92
.addInitializer(initializer)
93
.forTypes(PackageType.LINUX_DEB)
94
.addBundlePropertyVerifier("Homepage", expectedDebHomepage)
95
.forTypes(PackageType.LINUX_RPM)
96
.addBundlePropertyVerifier("URL", expectedRpmUrl)
97
.run();
98
}
99
}
100
101