author | herrick |
Thu, 06 Jun 2019 19:31:11 -0400 | |
branch | JDK-8200758-branch |
changeset 57395 | 521c02b9eed0 |
parent 57333 | 77109ab87402 |
child 57407 | 2c14fbeff1dc |
permissions | -rw-r--r-- |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
1 |
/* |
57106
ea870b9ce89a
8216492: Update copyright of all new jpackage fils to 2019
kcr
parents:
57079
diff
changeset
|
2 |
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
4 |
* |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
8 |
* |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
13 |
* accompanied this code). |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
14 |
* |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
18 |
* |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
21 |
* questions. |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
22 |
*/ |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
23 |
|
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
24 |
import java.io.File; |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
25 |
|
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
26 |
/** |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
27 |
* Helper class which contains functions to get different system dependent paths used by tests |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
28 |
*/ |
57039 | 29 |
public class JPackagePath { |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
30 |
|
57079
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
31 |
// Path to Windows "Program Files" folder |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
32 |
// Probably better to figure this out programattically |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
33 |
private static final String WIN_PROGRAM_FILES = "C:\\Program Files"; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
34 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
35 |
// Path to Windows Start menu items |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
36 |
private static final String WIN_START_MENU = "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs"; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
37 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
38 |
// Path to Windows public desktop location |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
39 |
private static final String WIN_PUBLIC_DESKTOP = "C:\\Users\\Public\\Desktop"; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
40 |
|
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
41 |
// Return path to test src adjusted to location of caller |
57079
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
42 |
public static String getTestSrcRoot() { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
43 |
return JPackageHelper.TEST_SRC_ROOT; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
44 |
} |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
45 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
46 |
// Return path to calling test |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
47 |
public static String getTestSrc() { |
57039 | 48 |
return JPackageHelper.TEST_SRC; |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
49 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
50 |
|
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
51 |
// Returns path to generate test application |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
52 |
public static String getApp() { |
57395
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
53 |
return getApp("test"); |
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
54 |
} |
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
55 |
|
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
56 |
public static String getApp(String name) { |
57039 | 57 |
if (JPackageHelper.isWindows()) { |
57395
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
58 |
return "output" + File.separator + name |
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
59 |
+ File.separator + name + ".exe"; |
57039 | 60 |
} else if (JPackageHelper.isOSX()) { |
57395
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
61 |
return "output" + File.separator + name + ".app" |
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
62 |
+ File.separator + "Contents" |
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
63 |
+ File.separator + "MacOS" + File.separator + name; |
57039 | 64 |
} else if (JPackageHelper.isLinux()) { |
57395
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
65 |
return "output" + File.separator + name + File.separator + name; |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
66 |
} else { |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
67 |
throw new AssertionError("Cannot detect platform"); |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
68 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
69 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
70 |
|
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
71 |
// Returns path to generate test application icon |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
72 |
public static String getAppIcon() { |
57395
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
73 |
return getAppIcon("test"); |
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
74 |
} |
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
75 |
|
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
76 |
public static String getAppIcon(String name) { |
57039 | 77 |
if (JPackageHelper.isWindows()) { |
57395
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
78 |
return "output" + File.separator + name + File.separator |
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
79 |
+ name + ".ico"; |
57039 | 80 |
} else if (JPackageHelper.isOSX()) { |
57395
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
81 |
return "output" + File.separator + name + ".app" |
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
82 |
+ File.separator + "Contents" + File.separator |
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
83 |
+ "Resources" + File.separator + name + ".icns"; |
57039 | 84 |
} else if (JPackageHelper.isLinux()) { |
57395
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
85 |
return "output" + File.separator + name + File.separator |
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
86 |
+ "resources"+ File.separator + name + ".png"; |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
87 |
} else { |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
88 |
throw new AssertionError("Cannot detect platform"); |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
89 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
90 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
91 |
|
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
92 |
// Returns path to generate test application without --name argument |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
93 |
public static String getAppNoName() { |
57039 | 94 |
if (JPackageHelper.isWindows()) { |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
95 |
return "output" + File.separator + "Hello" + File.separator + "Hello.exe"; |
57039 | 96 |
} else if (JPackageHelper.isOSX()) { |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
97 |
return "output" + File.separator + "Hello.app" + File.separator + "Contents" |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
98 |
+ File.separator + "MacOS" + File.separator + "Hello"; |
57039 | 99 |
} else if (JPackageHelper.isLinux()) { |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
100 |
return "output" + File.separator + "Hello" + File.separator + "Hello"; |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
101 |
} else { |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
102 |
throw new AssertionError("Cannot detect platform"); |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
103 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
104 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
105 |
|
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
106 |
// Returns path to generate secondary launcher of test application |
57395
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
107 |
public static String getAppSL(String name) { |
57039 | 108 |
if (JPackageHelper.isWindows()) { |
57395
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
109 |
return "output" + File.separator + "test" + File.separator |
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
110 |
+ name + ".exe"; |
57039 | 111 |
} else if (JPackageHelper.isOSX()) { |
57395
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
112 |
return "output" + File.separator + "test.app" + File.separator |
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
113 |
+ "Contents" + File.separator + "MacOS" |
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
114 |
+ File.separator + name; |
57039 | 115 |
} else if (JPackageHelper.isLinux()) { |
57395
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
116 |
return "output" + File.separator + "test" + File.separator + name; |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
117 |
} else { |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
118 |
throw new AssertionError("Cannot detect platform"); |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
119 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
120 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
121 |
|
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
122 |
// Returns path to app working directory (where test application generates its output) |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
123 |
public static String getAppWorkingDir() { |
57395
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
124 |
return getAppWorkingDir("test"); |
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
125 |
} |
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
126 |
|
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
127 |
public static String getAppWorkingDir(String name) { |
57039 | 128 |
if (JPackageHelper.isWindows()) { |
57395
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
129 |
return "output" + File.separator + name + File.separator + "app"; |
57039 | 130 |
} else if (JPackageHelper.isOSX()) { |
57395
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
131 |
return "output" + File.separator + name + ".app" |
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
132 |
+ File.separator + "Contents" + File.separator + "Java"; |
57039 | 133 |
} else if (JPackageHelper.isLinux()) { |
57395
521c02b9eed0
8224130: create additional automated tests for create-app-image
herrick
parents:
57333
diff
changeset
|
134 |
return "output" + File.separator + name + File.separator + "app"; |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
135 |
} else { |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
136 |
throw new AssertionError("Cannot detect platform"); |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
137 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
138 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
139 |
|
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
140 |
// Returns path to test application cfg file |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
141 |
public static String getAppCfg() { |
57039 | 142 |
if (JPackageHelper.isWindows()) { |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
143 |
return "output" + File.separator + "test" + File.separator + "app" + File.separator |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
144 |
+ "test.cfg"; |
57039 | 145 |
} else if (JPackageHelper.isOSX()) { |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
146 |
return "output" + File.separator + "test.app" + File.separator + "Contents" |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
147 |
+ File.separator + "Java" + File.separator + "test.cfg"; |
57039 | 148 |
} else if (JPackageHelper.isLinux()) { |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
149 |
return "output" + File.separator + "test" + File.separator + "app" + File.separator |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
150 |
+ "test.cfg"; |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
151 |
} else { |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
152 |
throw new AssertionError("Cannot detect platform"); |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
153 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
154 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
155 |
|
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
156 |
// Returns path to app working directory without --name (where test application generates its output) |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
157 |
public static String getAppWorkingDirNoName() { |
57039 | 158 |
if (JPackageHelper.isWindows()) { |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
159 |
return "output" + File.separator + "Hello" + File.separator + "app"; |
57039 | 160 |
} else if (JPackageHelper.isOSX()) { |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
161 |
return "output" + File.separator + "Hello.app" + File.separator + "Contents" |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
162 |
+ File.separator + "Java"; |
57039 | 163 |
} else if (JPackageHelper.isLinux()) { |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
164 |
return "output" + File.separator + "Hello" + File.separator + "app"; |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
165 |
} else { |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
166 |
throw new AssertionError("Cannot detect platform"); |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
167 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
168 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
169 |
|
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
170 |
// Returns path including executable to java in image runtime folder |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
171 |
public static String getRuntimeJava() { |
57039 | 172 |
if (JPackageHelper.isWindows()) { |
57333 | 173 |
return "output" + File.separator + "test" |
174 |
+ File.separator + "runtime" + File.separator |
|
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
175 |
+ "bin" + File.separator + "java.exe"; |
57039 | 176 |
} else if (JPackageHelper.isOSX()) { |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
177 |
return "output" + File.separator + "test.app" + File.separator |
57333 | 178 |
+ "Contents" + File.separator |
179 |
+ "runtime" + File.separator + "Contents" + File.separator |
|
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
180 |
+ "Home" + File.separator + "bin" + File.separator + "java"; |
57039 | 181 |
} else if (JPackageHelper.isLinux()) { |
57333 | 182 |
return "output" + File.separator + "test" |
183 |
+ File.separator + "runtime" + File.separator |
|
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
184 |
+ "bin" + File.separator + "java"; |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
185 |
} else { |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
186 |
throw new AssertionError("Cannot detect platform"); |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
187 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
188 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
189 |
|
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
190 |
// Returns output file name generate by test application |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
191 |
public static String getAppOutputFile() { |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
192 |
return "appOutput.txt"; |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
193 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
194 |
|
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
195 |
// Returns path to bin folder in image runtime |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
196 |
public static String getRuntimeBin() { |
57039 | 197 |
if (JPackageHelper.isWindows()) { |
57333 | 198 |
return "output" + File.separator + "test" |
199 |
+ File.separator + "runtime" + File.separator + "bin"; |
|
57039 | 200 |
} else if (JPackageHelper.isOSX()) { |
57333 | 201 |
return "output" + File.separator + "test.app" |
202 |
+ File.separator + "Contents" |
|
203 |
+ File.separator + "runtime" |
|
204 |
+ File.separator + "Contents" |
|
205 |
+ File.separator + "Home" + File.separator + "bin"; |
|
57039 | 206 |
} else if (JPackageHelper.isLinux()) { |
57333 | 207 |
return "output" + File.separator + "test" |
208 |
+ File.separator + "runtime" + File.separator + "bin"; |
|
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
209 |
} else { |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
210 |
throw new AssertionError("Cannot detect platform"); |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
211 |
} |
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
212 |
} |
57079
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
213 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
214 |
public static String getWinProgramFiles() { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
215 |
return WIN_PROGRAM_FILES; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
216 |
} |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
217 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
218 |
public static String getWinUserLocal() { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
219 |
return System.getProperty("user.home") + File.separator + "AppData" |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
220 |
+ File.separator + "Local"; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
221 |
} |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
222 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
223 |
public static String getWinStartMenu() { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
224 |
return WIN_START_MENU; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
225 |
} |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
226 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
227 |
public static String getWinPublicDesktop() { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
228 |
return WIN_PUBLIC_DESKTOP; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
229 |
} |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
230 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
231 |
public static String getWinUserLocalStartMenu() { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
232 |
return System.getProperty("user.home") + File.separator + "AppData" |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
233 |
+ File.separator + "Roaming" + File.separator + "Microsoft" |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
234 |
+ File.separator + "Windows" + File.separator + "Start Menu" |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
235 |
+ File.separator + "Programs"; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
236 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
237 |
} |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
238 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
239 |
public static String getWinInstalledApp(String testName) { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
240 |
return getWinProgramFiles() + File.separator + testName + File.separator |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
241 |
+ testName + ".exe"; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
242 |
} |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
243 |
|
57283 | 244 |
public static String getWinInstalledApp(String installDir, String testName) { |
245 |
return getWinProgramFiles() + File.separator + installDir + File.separator |
|
246 |
+ testName + ".exe"; |
|
247 |
} |
|
248 |
||
57079
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
249 |
public static String getOSXInstalledApp(String testName) { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
250 |
return File.separator + "Applications" + File.separator + testName |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
251 |
+ ".app" + File.separator + "Contents" + File.separator |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
252 |
+ "MacOS" + File.separator + testName; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
253 |
} |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
254 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
255 |
public static String getLinuxInstalledApp(String testName) { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
256 |
return File.separator + "opt" + File.separator + testName + |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
257 |
File.separator + testName; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
258 |
} |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
259 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
260 |
public static String getOSXInstalledApp(String subDir, String testName) { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
261 |
return File.separator + "Applications" + File.separator + subDir |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
262 |
+ File.separator + testName + ".app" + File.separator |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
263 |
+ "Contents" + File.separator + "MacOS" + File.separator |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
264 |
+ testName; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
265 |
} |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
266 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
267 |
public static String getLinuxInstalledApp(String subDir, String testName) { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
268 |
return File.separator + "opt" + File.separator + subDir + File.separator |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
269 |
+ testName + File.separator + testName; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
270 |
} |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
271 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
272 |
public static String getWinInstallFolder(String testName) { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
273 |
return getWinProgramFiles() + File.separator + testName; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
274 |
} |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
275 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
276 |
public static String getLinuxInstallFolder(String testName) { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
277 |
return File.separator + "opt" + File.separator + testName; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
278 |
} |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
279 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
280 |
public static String getLinuxInstallFolder(String subDir, String testName) { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
281 |
if (testName == null) { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
282 |
return File.separator + "opt" + File.separator + subDir; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
283 |
} else { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
284 |
return File.separator + "opt" + File.separator + subDir |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
285 |
+ File.separator + testName; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
286 |
} |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
287 |
} |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
288 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
289 |
public static String getWinUserLocalInstalledApp(String testName) { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
290 |
return getWinUserLocal() + File.separator + testName + File.separator + testName + ".exe"; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
291 |
} |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
292 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
293 |
public static String getWinUserLocalInstallFolder(String testName) { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
294 |
return getWinUserLocal() + File.separator + testName; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
295 |
} |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
296 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
297 |
// Returs path to test license file |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
298 |
public static String getLicenseFilePath() { |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
299 |
String path = JPackagePath.getTestSrcRoot() + File.separator + "resources" |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
300 |
+ File.separator + "license.txt"; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
301 |
|
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
302 |
return path; |
c53a2eca0f57
8215036: Create initial set of tests for jpackage create-installer mode
herrick
parents:
57039
diff
changeset
|
303 |
} |
57181
d10b861e8d62
8214564: --win-upgrade-uuid does not work as expected
herrick
parents:
57106
diff
changeset
|
304 |
|
d10b861e8d62
8214564: --win-upgrade-uuid does not work as expected
herrick
parents:
57106
diff
changeset
|
305 |
// Returns path to app folder of installed application |
d10b861e8d62
8214564: --win-upgrade-uuid does not work as expected
herrick
parents:
57106
diff
changeset
|
306 |
public static String getWinInstalledAppFolder(String testName) { |
d10b861e8d62
8214564: --win-upgrade-uuid does not work as expected
herrick
parents:
57106
diff
changeset
|
307 |
return getWinProgramFiles() + File.separator + testName + File.separator |
d10b861e8d62
8214564: --win-upgrade-uuid does not work as expected
herrick
parents:
57106
diff
changeset
|
308 |
+ "app"; |
d10b861e8d62
8214564: --win-upgrade-uuid does not work as expected
herrick
parents:
57106
diff
changeset
|
309 |
} |
57031
ea4755429ed8
8214021: Create additional automated tests for jpackager
herrick
parents:
diff
changeset
|
310 |
} |