168 }
169 return cp;
170 }
171 return null;
172 }
173
174 public static ArrayList<String> createApplicationLaunchCommand(
175 String testAppName,
176 String testPldrName,
177 String testPolicy) throws IOException {
178
179 final String classpath = System.getProperty("java.class.path");
180
181 /*
182 * note: the "worker" properties are tied into build.gradle and
183 * the related GradleJUnitWorker as a workaround until the build
184 * is fully converted to a modular build
185 */
186 final Boolean isJigsaw = Boolean.getBoolean("worker.isJigsaw");
187 final String workerJavaCmd = System.getProperty("worker.java.cmd");
188 final String workerXpatchFile = System.getProperty("worker.xpatch.file");
189 final String workerPatchPolicy = System.getProperty("worker.patch.policy");
190 final String workerClassPath = System.getProperty("worker.classpath.file");
191 final Boolean workerDebug = Boolean.getBoolean("worker.debug");
192
193 final ArrayList<String> cmd = new ArrayList<>(30);
194
195 if (workerJavaCmd != null) {
196 cmd.add(workerJavaCmd);
197 } else {
198 cmd.add("java");
199 }
200
201 if (isJigsaw && workerXpatchFile != null) {
202 cmd.add("@" + workerXpatchFile);
203 } else {
204 String jfxdir = getJfxrtDir(classpath);
205 Assert.assertNotNull("failed to find jfxdir",jfxdir);
206 cmd.add("-Xbootclasspath/a:" + jfxdir + "/" + "jfxrt.jar");
207 }
208
209 // This is a "minimum" set, rather than the full @addExports
210 if (isJigsaw) {
211 cmd.add("-XaddExports:javafx.graphics/com.sun.javafx.application=ALL-UNNAMED");
212 }
213
214 if (isJigsaw && workerClassPath != null) {
215 cmd.add("@" + workerClassPath);
216 } else {
217 cmd.add("-cp");
218 cmd.add(classpath);
219 }
220
221 if (testPldrName != null) {
222 cmd.add("-Djavafx.preloader=" + testPldrName);
223 }
224
225 if (testPolicy != null) {
226
227 cmd.add("-Djava.security.manager");
228
229 try {
230 if (workerPatchPolicy != null) {
231 // with Jigsaw, we need to create a merged java.policy
232 // file that contains the permissions for the Xpatch classes
233 // as well as the permissions needed for this test
234
235 File wpp = new File(workerPatchPolicy);
236 if (!wpp.exists()) {
237 throw new RuntimeException("Missing workerPatchPolicy");
238 }
239
240 File tempFile = null;
241 if (workerDebug) {
242 tempFile = new File(workerPatchPolicy +
243 "_" + testAppName);
244 } else {
245 tempFile = File.createTempFile("java", "policy");
246 tempFile.deleteOnExit();
247 }
248
249 BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile));
250
251 BufferedReader reader1 = new BufferedReader(new FileReader(wpp));
252 URL url = new URL(testPolicy);
|
168 }
169 return cp;
170 }
171 return null;
172 }
173
174 public static ArrayList<String> createApplicationLaunchCommand(
175 String testAppName,
176 String testPldrName,
177 String testPolicy) throws IOException {
178
179 final String classpath = System.getProperty("java.class.path");
180
181 /*
182 * note: the "worker" properties are tied into build.gradle and
183 * the related GradleJUnitWorker as a workaround until the build
184 * is fully converted to a modular build
185 */
186 final Boolean isJigsaw = Boolean.getBoolean("worker.isJigsaw");
187 final String workerJavaCmd = System.getProperty("worker.java.cmd");
188 final String workerPatchModuleFile = System.getProperty("worker.patchmodule.file");
189 final String workerPatchPolicy = System.getProperty("worker.patch.policy");
190 final String workerClassPath = System.getProperty("worker.classpath.file");
191 final Boolean workerDebug = Boolean.getBoolean("worker.debug");
192
193 final ArrayList<String> cmd = new ArrayList<>(30);
194
195 if (workerJavaCmd != null) {
196 cmd.add(workerJavaCmd);
197 } else {
198 cmd.add("java");
199 }
200
201 if (isJigsaw && workerPatchModuleFile != null) {
202 cmd.add("@" + workerPatchModuleFile);
203 } else {
204 String jfxdir = getJfxrtDir(classpath);
205 Assert.assertNotNull("failed to find jfxdir",jfxdir);
206 cmd.add("-Xbootclasspath/a:" + jfxdir + "/" + "jfxrt.jar");
207 }
208
209 // This is a "minimum" set, rather than the full @addExports
210 if (isJigsaw) {
211 cmd.add("--add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED");
212 }
213
214 if (isJigsaw && workerClassPath != null) {
215 cmd.add("@" + workerClassPath);
216 } else {
217 cmd.add("-cp");
218 cmd.add(classpath);
219 }
220
221 if (testPldrName != null) {
222 cmd.add("-Djavafx.preloader=" + testPldrName);
223 }
224
225 if (testPolicy != null) {
226
227 cmd.add("-Djava.security.manager");
228
229 try {
230 if (workerPatchPolicy != null) {
231 // with Jigsaw, we need to create a merged java.policy
232 // file that contains the permissions for the patchmodule classes
233 // as well as the permissions needed for this test
234
235 File wpp = new File(workerPatchPolicy);
236 if (!wpp.exists()) {
237 throw new RuntimeException("Missing workerPatchPolicy");
238 }
239
240 File tempFile = null;
241 if (workerDebug) {
242 tempFile = new File(workerPatchPolicy +
243 "_" + testAppName);
244 } else {
245 tempFile = File.createTempFile("java", "policy");
246 tempFile.deleteOnExit();
247 }
248
249 BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile));
250
251 BufferedReader reader1 = new BufferedReader(new FileReader(wpp));
252 URL url = new URL(testPolicy);
|