1 /*
2 * Copyright (c) 2015, 2016, 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 */
28 import java.io.InputStream;
29 import java.io.InputStreamReader;
30 import java.io.SequenceInputStream;
31 import java.io.StringWriter;
32 import java.io.Writer;
33 import java.nio.file.Files;
34 import java.nio.file.Path;
35 import java.nio.file.Paths;
36 import java.util.ArrayList;
37 import java.util.Collection;
38 import java.util.Collections;
39 import java.util.List;
40 import java.util.function.Consumer;
41 import java.util.stream.Collectors;
42 import java.util.stream.Stream;
43 import javax.tools.JavaCompiler;
44 import javax.tools.JavaFileObject;
45 import javax.tools.StandardJavaFileManager;
46 import javax.tools.StandardLocation;
47 import javax.tools.ToolProvider;
48 import jdk.testlibrary.FileUtils;
49 import jdk.testlibrary.JDKToolFinder;
50 import static java.lang.String.format;
51 import static java.util.Arrays.asList;
52
53 /*
54 * @test
55 * @bug 8064924
56 * @modules jdk.compiler
57 * @summary Basic test for URLStreamHandlerProvider
58 * @library /lib/testlibrary
59 * @build jdk.testlibrary.FileUtils jdk.testlibrary.JDKToolFinder
60 * @compile Basic.java Child.java
61 * @run main Basic
62 */
63
64 public class Basic {
65
66 static final Path TEST_SRC = Paths.get(System.getProperty("test.src", "."));
67 static final Path TEST_CLASSES = Paths.get(System.getProperty("test.classes", "."));
68
69 public static void main(String[] args) throws Throwable {
70 unknownProtocol("foo", UNKNOWN);
71 unknownProtocol("bar", UNKNOWN);
72 viaProvider("baz", KNOWN);
73 viaProvider("bert", KNOWN);
74 viaProvider("ernie", UNKNOWN, "-Djava.security.manager");
75 viaProvider("curly", UNKNOWN, "-Djava.security.manager");
76 viaProvider("larry", KNOWN, "-Djava.security.manager",
77 "-Djava.security.policy=" + TEST_SRC + File.separator + "basic.policy");
78 viaProvider("moe", KNOWN, "-Djava.security.manager",
79 "-Djava.security.policy=" + TEST_SRC + File.separator + "basic.policy");
|
1 /*
2 * Copyright (c) 2015, 2017, 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 */
28 import java.io.InputStream;
29 import java.io.InputStreamReader;
30 import java.io.SequenceInputStream;
31 import java.io.StringWriter;
32 import java.io.Writer;
33 import java.nio.file.Files;
34 import java.nio.file.Path;
35 import java.nio.file.Paths;
36 import java.util.ArrayList;
37 import java.util.Collection;
38 import java.util.Collections;
39 import java.util.List;
40 import java.util.function.Consumer;
41 import java.util.stream.Collectors;
42 import java.util.stream.Stream;
43 import javax.tools.JavaCompiler;
44 import javax.tools.JavaFileObject;
45 import javax.tools.StandardJavaFileManager;
46 import javax.tools.StandardLocation;
47 import javax.tools.ToolProvider;
48 import jdk.test.lib.util.FileUtils;
49 import jdk.testlibrary.JDKToolFinder;
50 import static java.lang.String.format;
51 import static java.util.Arrays.asList;
52
53 /*
54 * @test
55 * @bug 8064924
56 * @modules jdk.compiler
57 * @summary Basic test for URLStreamHandlerProvider
58 * @library /lib/testlibrary /test/lib
59 * @build jdk.testlibrary.JDKToolFinder
60 * @compile Basic.java Child.java
61 * @run main Basic
62 */
63
64 public class Basic {
65
66 static final Path TEST_SRC = Paths.get(System.getProperty("test.src", "."));
67 static final Path TEST_CLASSES = Paths.get(System.getProperty("test.classes", "."));
68
69 public static void main(String[] args) throws Throwable {
70 unknownProtocol("foo", UNKNOWN);
71 unknownProtocol("bar", UNKNOWN);
72 viaProvider("baz", KNOWN);
73 viaProvider("bert", KNOWN);
74 viaProvider("ernie", UNKNOWN, "-Djava.security.manager");
75 viaProvider("curly", UNKNOWN, "-Djava.security.manager");
76 viaProvider("larry", KNOWN, "-Djava.security.manager",
77 "-Djava.security.policy=" + TEST_SRC + File.separator + "basic.policy");
78 viaProvider("moe", KNOWN, "-Djava.security.manager",
79 "-Djava.security.policy=" + TEST_SRC + File.separator + "basic.policy");
|