Skip to content
Permalink
Browse files
8272477: Additional cleanup of test/jdk/java/nio/file/spi/SetDefaultP…
…rovider.java

Reviewed-by: bpb
  • Loading branch information
Lance Andersen committed Mar 24, 2022
1 parent a7e9883 commit 90750decb47772420eaf127b19efa9b5cdacccfe
Showing 1 changed file with 12 additions and 13 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.spi.ToolProvider;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import jdk.test.lib.process.ProcessTools;
@@ -51,7 +50,7 @@
@Test
public class SetDefaultProvider {

private static String SET_DEFAULT_FSP =
private static final String SET_DEFAULT_FSP =
"-Djava.nio.file.spi.DefaultFileSystemProvider=TestProvider";

private static final ToolProvider JAR_TOOL = ToolProvider.findFirst("jar")
@@ -73,7 +72,7 @@ public void testClassPath() throws Exception {
String testClasses = System.getProperty("test.classes");
String classpath = moduleClasses + File.pathSeparator + testClasses;
int exitValue = exec(SET_DEFAULT_FSP, "-cp", classpath, "p.Main");
assertTrue(exitValue == 0);
assertEquals(exitValue, 0);
}

/**
@@ -88,7 +87,7 @@ public void testClassPathWithFileSystemProviderJar() throws Exception {
String classpath = jar + File.pathSeparator + testClasses
+ File.separator + "modules" + File.separator + "m";
int exitValue = exec(SET_DEFAULT_FSP, "-cp", classpath, "p.Main");
assertTrue(exitValue == 0);
assertEquals(exitValue, 0);
}

/**
@@ -112,7 +111,7 @@ private void createFileSystemProviderJar(Path jar, Path dir) throws IOException
}
}
int ret = JAR_TOOL.run(System.out, System.out, args.toArray(new String[0]));
assertTrue(ret == 0);
assertEquals(ret, 0);
}

/**
@@ -128,7 +127,7 @@ public void testClassPathWithSecurityManager() throws Exception {
int exitValue = exec(SET_DEFAULT_FSP, "-cp", classpath,
"-Dtest.classes=" + testClasses, "-Djava.security.manager",
"-Djava.security.policy==" + policyFile, "p.Main");
assertTrue(exitValue == 0);
assertEquals(exitValue, 0);
}

/**
@@ -138,7 +137,7 @@ public void testClassPathWithSecurityManager() throws Exception {
public void testExplodedModule() throws Exception {
String modulePath = System.getProperty("jdk.module.path");
int exitValue = exec(SET_DEFAULT_FSP, "-p", modulePath, "-m", "m/p.Main");
assertTrue(exitValue == 0);
assertEquals(exitValue, 0);
}

/**
@@ -148,7 +147,7 @@ public void testExplodedModule() throws Exception {
public void testModularJar() throws Exception {
String jarFile = createModularJar();
int exitValue = exec(SET_DEFAULT_FSP, "-p", jarFile, "-m", "m/p.Main");
assertTrue(exitValue == 0);
assertEquals(exitValue, 0);
}

/**
@@ -162,7 +161,7 @@ public void testExplodedModuleWithExplodedPatch() throws Exception {
"--patch-module", "m=" + patchdir,
"-p", modulePath,
"-m", "m/p.Main");
assertTrue(exitValue == 0);
assertEquals(exitValue, 0);
}

/**
@@ -178,7 +177,7 @@ public void testExplodedModuleWithJarPatch() throws Exception {
"--patch-module", "m=" + patch,
"-p", modulePath,
"-m", "m/p.Main");
assertTrue(exitValue == 0);
assertEquals(exitValue, 0);
}

/**
@@ -190,7 +189,7 @@ private String moduleClasses() {
Path m = Paths.get(dir, "m");
if (Files.exists(m)) return m.toString();
}
assertFalse(true);
fail();
return null;
}

@@ -210,7 +209,7 @@ private Path createJarFile(Path dir) throws Exception {
Path jar = createTempDirectory("tmp").resolve("m.jar");
String[] args = { "--create", "--file=" + jar, "-C", dir.toString(), "." };
int ret = JAR_TOOL.run(System.out, System.out, args);
assertTrue(ret == 0);
assertEquals(ret, 0);
return jar;
}

1 comment on commit 90750de

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 90750de Mar 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.