< prev index next >

test/jdk/java/nio/file/spi/SetDefaultProvider.java

Print this page
rev 51638 : [mq]: 8210112


   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 /**
  25  * @test
  26  * @modules jdk.jartool
  27  * @library /lib/testlibrary
  28  * @build SetDefaultProvider TestProvider m/* jdk.testlibrary.ProcessTools
  29  * @run testng/othervm SetDefaultProvider
  30  * @summary Runs tests with -Djava.nio.file.spi.DefaultFileSystemProvider set on
  31  *          the command line to override the default file system provider
  32  */
  33 
  34 import java.io.File;
  35 import java.io.IOException;
  36 import java.nio.file.Files;
  37 import java.nio.file.Path;
  38 import java.nio.file.Paths;
  39 import java.util.spi.ToolProvider;
  40 
  41 import jdk.testlibrary.ProcessTools;
  42 
  43 import org.testng.annotations.BeforeTest;
  44 import org.testng.annotations.Test;
  45 import static org.testng.Assert.*;
  46 
  47 @Test
  48 public class SetDefaultProvider {
  49 
  50     private static String SET_DEFAULT_FSP =
  51         "-Djava.nio.file.spi.DefaultFileSystemProvider=TestProvider";
  52 
  53     private static final ToolProvider JAR_TOOL = ToolProvider.findFirst("jar")
  54         .orElseThrow(() ->
  55             new RuntimeException("jar tool not found")
  56         );
  57 
  58     private static Path createTempDirectory(String prefix) throws IOException {
  59         Path testDir = Paths.get(System.getProperty("test.dir", "."));
  60         return Files.createTempDirectory(testDir, prefix);
  61     }




   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 /**
  25  * @test
  26  * @modules jdk.jartool
  27  * @library /test/lib
  28  * @build SetDefaultProvider TestProvider m/* jdk.test.lib.process.ProcessTools
  29  * @run testng/othervm SetDefaultProvider
  30  * @summary Runs tests with -Djava.nio.file.spi.DefaultFileSystemProvider set on
  31  *          the command line to override the default file system provider
  32  */
  33 
  34 import java.io.File;
  35 import java.io.IOException;
  36 import java.nio.file.Files;
  37 import java.nio.file.Path;
  38 import java.nio.file.Paths;
  39 import java.util.spi.ToolProvider;
  40 
  41 import jdk.test.lib.process.ProcessTools;
  42 
  43 import org.testng.annotations.BeforeTest;
  44 import org.testng.annotations.Test;
  45 import static org.testng.Assert.*;
  46 
  47 @Test
  48 public class SetDefaultProvider {
  49 
  50     private static String SET_DEFAULT_FSP =
  51         "-Djava.nio.file.spi.DefaultFileSystemProvider=TestProvider";
  52 
  53     private static final ToolProvider JAR_TOOL = ToolProvider.findFirst("jar")
  54         .orElseThrow(() ->
  55             new RuntimeException("jar tool not found")
  56         );
  57 
  58     private static Path createTempDirectory(String prefix) throws IOException {
  59         Path testDir = Paths.get(System.getProperty("test.dir", "."));
  60         return Files.createTempDirectory(testDir, prefix);
  61     }


< prev index next >