8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package test.launchertest;
27
28 import java.util.ArrayList;
29 import junit.framework.AssertionFailedError;
30 import org.junit.Test;
31
32 import static org.junit.Assert.*;
33 import static test.launchertest.Constants.*;
34
35 /**
36 * Unit test for launching modular FX applications
37 */
38 public class ModuleLauncherTest {
39
40 private static final String modulePath2 = System.getProperty("launchertest.testapp2.module.path");
41 private static final String modulePath3 = System.getProperty("launchertest.testapp3.module.path");
42 private static final String modulePath4 = System.getProperty("launchertest.testapp4.module.path");
43 private static final String modulePath5 = System.getProperty("launchertest.testapp5.module.path");
44 private static final String modulePath6 = System.getProperty("launchertest.testapp6.module.path");
45 private static final String moduleName = "mymod";
46
47 private final int testExitCode = ERROR_NONE;
48
49 private void doTestLaunchModule(String modulePath, String testAppName) throws Exception {
50 assertNotNull(testAppName);
51 System.err.println("The following Unknown module WARNING messages are expected:");
52 String mpArg = "--module-path=" + modulePath;
53 String moduleAppName = "--module=" + moduleName + "/" + testAppName;
54 final ArrayList<String> cmd =
55 test.util.Util.createApplicationLaunchCommand(
56 moduleAppName,
57 null,
58 null,
59 new String[] { mpArg }
60 );
61
62 final ProcessBuilder builder = new ProcessBuilder(cmd);
63
64 builder.redirectError(ProcessBuilder.Redirect.INHERIT);
65 builder.redirectOutput(ProcessBuilder.Redirect.INHERIT);
66 Process process = builder.start();
67 int retVal = process.waitFor();
68 switch (retVal) {
69 case 0:// SUCCESS
|
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package test.launchertest;
27
28 import java.io.File;
29 import java.util.ArrayList;
30 import junit.framework.AssertionFailedError;
31 import org.junit.Test;
32
33 import static org.junit.Assert.*;
34 import static test.launchertest.Constants.*;
35
36 /**
37 * Unit test for launching modular FX applications
38 */
39 public class ModuleLauncherTest {
40
41 private static final String modulePath2 = System.getProperty("launchertest.testapp2.module.path");
42 private static final String modulePath3 = System.getProperty("launchertest.testapp3.module.path");
43 private static final String modulePath4 = System.getProperty("launchertest.testapp4.module.path");
44 private static final String modulePath5 = System.getProperty("launchertest.testapp5.module.path");
45 private static final String modulePath6 = System.getProperty("launchertest.testapp6.module.path");
46 private static final String moduleName = "mymod";
47
48 private final int testExitCode = ERROR_NONE;
49
50 private void doTestLaunchModule(String appModulePath, String testAppName) throws Exception {
51 final String javafxModulePath = System.getProperty("worker.module.path");
52 String modulePath;
53 if (javafxModulePath != null) {
54 modulePath = javafxModulePath + File.pathSeparator + appModulePath;
55 } else {
56 modulePath = appModulePath;
57 }
58 assertNotNull(testAppName);
59 System.err.println("The following Unknown module WARNING messages are expected:");
60 String mpArg = "--module-path=" + modulePath;
61 String moduleAppName = "--module=" + moduleName + "/" + testAppName;
62 final ArrayList<String> cmd =
63 test.util.Util.createApplicationLaunchCommand(
64 moduleAppName,
65 null,
66 null,
67 new String[] { mpArg }
68 );
69
70 final ProcessBuilder builder = new ProcessBuilder(cmd);
71
72 builder.redirectError(ProcessBuilder.Redirect.INHERIT);
73 builder.redirectOutput(ProcessBuilder.Redirect.INHERIT);
74 Process process = builder.start();
75 int retVal = process.waitFor();
76 switch (retVal) {
77 case 0:// SUCCESS
|