author | herrick |
Tue, 24 Sep 2019 13:41:16 -0400 | |
branch | JDK-8200758-branch |
changeset 58301 | e0efb29609bd |
parent 58113 | 885b0543f6e4 |
child 58416 | f09bf58c1f17 |
permissions | -rw-r--r-- |
58113 | 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 java.nio.file.Path; |
|
25 |
import java.util.HashMap; |
|
26 |
import java.util.Map; |
|
27 |
import java.util.function.Supplier; |
|
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
28 |
import jdk.jpackage.test.Test; |
58113 | 29 |
import jdk.jpackage.test.PackageTest; |
30 |
import jdk.jpackage.test.PackageType; |
|
31 |
||
32 |
/** |
|
33 |
* Test --install-dir parameter. Output of the test should be installdirtest*.* |
|
34 |
* package bundle. The output package should provide the same functionality as |
|
35 |
* the default package but install test application in specified directory. |
|
36 |
* |
|
37 |
* Linux: |
|
38 |
* |
|
39 |
* Application should be installed in /opt/jpackage/installdirtest folder. |
|
40 |
* |
|
41 |
* Mac: |
|
42 |
* |
|
43 |
* Application should be installed in /Applications/jpackage/installdirtest.app |
|
44 |
* folder. |
|
45 |
* |
|
46 |
* Windows: |
|
47 |
* |
|
48 |
* Application should be installed in %ProgramFiles%/TestVendor/InstallDirTest1234 |
|
49 |
* folder. |
|
50 |
*/ |
|
51 |
||
52 |
/* |
|
53 |
* @test |
|
54 |
* @summary jpackage with --install-dir |
|
55 |
* @library ../helpers |
|
56 |
* @modules jdk.jpackage/jdk.jpackage.internal |
|
57 |
* @run main/othervm/timeout=360 -Xmx512m InstallDirTest |
|
58 |
*/ |
|
59 |
public class InstallDirTest { |
|
60 |
||
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
61 |
public static void main(String[] args) { |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
62 |
final Map<PackageType, Path> INSTALL_DIRS = new Supplier<Map<PackageType, Path>>() { |
58113 | 63 |
@Override |
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
64 |
public Map<PackageType, Path> get() { |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
65 |
Map<PackageType, Path> reply = new HashMap<>(); |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
66 |
reply.put(PackageType.WIN_MSI, Path.of( |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
67 |
"TestVendor\\InstallDirTest1234")); |
58113 | 68 |
reply.put(PackageType.WIN_EXE, reply.get(PackageType.WIN_MSI)); |
69 |
||
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
70 |
reply.put(PackageType.LINUX_DEB, Path.of("/opt/jpackage")); |
58113 | 71 |
reply.put(PackageType.LINUX_RPM, |
72 |
reply.get(PackageType.LINUX_DEB)); |
|
73 |
||
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
74 |
reply.put(PackageType.MAC_PKG, Path.of("/Application/jpackage")); |
58113 | 75 |
reply.put(PackageType.MAC_DMG, reply.get(PackageType.MAC_PKG)); |
76 |
||
77 |
return reply; |
|
78 |
} |
|
79 |
}.get(); |
|
80 |
||
58301
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
81 |
Test.run(args, () -> { |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
82 |
new PackageTest().configureHelloApp() |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
83 |
.addInitializer(cmd -> { |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
84 |
cmd.addArguments("--install-dir", INSTALL_DIRS.get( |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
85 |
cmd.packageType())); |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
86 |
}).run(); |
e0efb29609bd
8225249 : LinuxDebBundler and LinuxRpmBundler should share more code
herrick
parents:
58113
diff
changeset
|
87 |
}); |
58113 | 88 |
} |
89 |
} |