< prev index next >

test/java/net/spi/URLStreamHandlerProvider/Basic.java

Print this page




   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  */
  23 
  24 import java.io.*;








  25 import java.nio.file.Files;
  26 import java.nio.file.Path;
  27 import java.nio.file.Paths;
  28 import java.util.*;
  29 import java.util.Collection;
  30 import java.util.Collections;
  31 import java.util.List;
  32 import java.util.function.Consumer;
  33 import java.util.stream.Collectors;
  34 import java.util.stream.Stream;
  35 import javax.tools.JavaCompiler;
  36 import javax.tools.JavaFileObject;
  37 import javax.tools.StandardJavaFileManager;
  38 import javax.tools.StandardLocation;
  39 import javax.tools.ToolProvider;
  40 import jdk.testlibrary.FileUtils;
  41 import jdk.testlibrary.JDKToolFinder;
  42 import static java.lang.String.format;
  43 import static java.util.Arrays.asList;
  44 
  45 /*
  46  * @test
  47  * @bug 8064924
  48  * @modules java.compiler
  49  * @summary Basic test for URLStreamHandlerProvider
  50  * @library /lib/testlibrary
  51  * @build jdk.testlibrary.FileUtils jdk.testlibrary.JDKToolFinder
  52  * @compile Basic.java Child.java
  53  * @run main Basic
  54  */
  55 
  56 public class Basic {
  57 
  58     static final Path TEST_SRC = Paths.get(System.getProperty("test.src", "."));
  59     static final Path TEST_CLASSES = Paths.get(System.getProperty("test.classes", "."));
  60 
  61     public static void main(String[] args) throws Throwable {
  62         unknownProtocol("foo", UNKNOWN);
  63         unknownProtocol("bar", UNKNOWN);
  64         viaProvider("baz", KNOWN);
  65         viaProvider("bert", KNOWN);
  66         viaProvider("ernie", UNKNOWN, "-Djava.security.manager");
  67         viaProvider("curly", UNKNOWN, "-Djava.security.manager");
  68         viaProvider("larry", KNOWN, "-Djava.security.manager",




   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  */
  23 
  24 import java.io.File;
  25 import java.io.FileWriter;
  26 import java.io.Reader;
  27 import java.io.IOException;
  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",


< prev index next >