1 /*
2 * Copyright (c) 2010, 2015, 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 */
30 import java.io.*;
31 import java.util.*;
32
33 public class GraphicalInstallerTest {
34 public static void main(String... args) throws Exception {
35 new GraphicalInstallerTest().run();
36 }
37
38 void run() throws Exception {
39 File testSrc = new File(System.getProperty("test.src"));
40 File classes = new File("classes");
41 classes.mkdirs();
42 List<String> opts = Arrays.asList("-d", classes.getPath());
43 int rc = compile(opts, new File(testSrc, "GraphicalInstaller.java"));
44 if (rc != 0) {
45 error("compilation failed: rc=" + rc);
46 return;
47 }
48
49 check(classes,
50 "GraphicalInstaller$1.class",
51 "GraphicalInstaller$1X$1.class",
52 "GraphicalInstaller$1X.class",
53 "GraphicalInstaller$BackgroundInstaller.class",
54 "GraphicalInstaller.class");
55
56 if (errors > 0)
57 throw new Exception(errors + " errors occurred");
58 }
59
60 /**
61 * Compile files with given options.
62 * Display any output from compiler, and return javac return code.
63 */
64 int compile(List<String> opts, File... files) {
65 List<String> args = new ArrayList<String>();
66 args.addAll(opts);
67 for (File f: files)
68 args.add(f.getPath());
69 StringWriter sw = new StringWriter();
70 PrintWriter pw = new PrintWriter(sw);
|
1 /*
2 * Copyright (c) 2010, 2018, 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 */
30 import java.io.*;
31 import java.util.*;
32
33 public class GraphicalInstallerTest {
34 public static void main(String... args) throws Exception {
35 new GraphicalInstallerTest().run();
36 }
37
38 void run() throws Exception {
39 File testSrc = new File(System.getProperty("test.src"));
40 File classes = new File("classes");
41 classes.mkdirs();
42 List<String> opts = Arrays.asList("-d", classes.getPath());
43 int rc = compile(opts, new File(testSrc, "GraphicalInstaller.java"));
44 if (rc != 0) {
45 error("compilation failed: rc=" + rc);
46 return;
47 }
48
49 check(classes,
50 "GraphicalInstaller$1X$1.class",
51 "GraphicalInstaller$1X.class",
52 "GraphicalInstaller$BackgroundInstaller.class",
53 "GraphicalInstaller.class");
54
55 if (errors > 0)
56 throw new Exception(errors + " errors occurred");
57 }
58
59 /**
60 * Compile files with given options.
61 * Display any output from compiler, and return javac return code.
62 */
63 int compile(List<String> opts, File... files) {
64 List<String> args = new ArrayList<String>();
65 args.addAll(opts);
66 for (File f: files)
67 args.add(f.getPath());
68 StringWriter sw = new StringWriter();
69 PrintWriter pw = new PrintWriter(sw);
|