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 * @bug 8168423
27 * @summary Different types of ClassLoader running with(out) SecurityManager and
28 * (in)valid security policy file.
29 * @library /lib/testlibrary
30 * @modules java.base/jdk.internal.module
31 * @build JarUtils
32 * @build TestClassLoader TestClient
33 * @run main ClassLoaderTest -noPolicy
34 * @run main ClassLoaderTest -validPolicy
35 * @run main ClassLoaderTest -invalidPolicy
36 * @run main ClassLoaderTest -noPolicy -customSCL
37 * @run main ClassLoaderTest -validPolicy -customSCL
38 * @run main ClassLoaderTest -invalidPolicy -customSCL
39 */
40 import java.io.File;
41 import java.io.OutputStream;
42 import java.nio.file.Files;
43 import java.nio.file.Path;
44 import java.nio.file.Paths;
45 import java.nio.file.StandardCopyOption;
46 import java.util.stream.Stream;
47 import java.lang.module.ModuleDescriptor;
48 import java.util.Collections;
49 import java.util.LinkedList;
50 import java.util.List;
51 import jdk.internal.module.ModuleInfoWriter;
52 import jdk.testlibrary.ProcessTools;
53
54 public class ClassLoaderTest {
55
56 private static final String SRC = System.getProperty("test.src");
57 private static final Path TEST_CLASSES =
58 Paths.get(System.getProperty("test.classes"));
59 private static final Path ARTIFACT_DIR = Paths.get("jars");
60 private static final Path VALID_POLICY = Paths.get(SRC, "valid.policy");
61 private static final Path INVALID_POLICY
62 = Paths.get(SRC, "malformed.policy");
63 /*
64 * Here is the naming convention followed for each jar.
65 * cl.jar - Regular custom class loader jar.
66 * mcl.jar - Modular custom class loader jar.
67 * c.jar - Regular client jar.
68 * mc.jar - Modular client jar.
69 * amc.jar - Modular client referring automated custom class loader jar.
70 */
71 private static final Path CL_JAR = ARTIFACT_DIR.resolve("cl.jar");
72 private static final Path MCL_JAR = ARTIFACT_DIR.resolve("mcl.jar");
|
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 * @bug 8168423
27 * @summary Different types of ClassLoader running with(out) SecurityManager and
28 * (in)valid security policy file.
29 * @library /lib/testlibrary
30 * @library /test/lib
31 * @modules java.base/jdk.internal.module
32 * @build JarUtils
33 * @build TestClassLoader TestClient
34 * @run main ClassLoaderTest -noPolicy
35 * @run main ClassLoaderTest -validPolicy
36 * @run main ClassLoaderTest -invalidPolicy
37 * @run main ClassLoaderTest -noPolicy -customSCL
38 * @run main ClassLoaderTest -validPolicy -customSCL
39 * @run main ClassLoaderTest -invalidPolicy -customSCL
40 */
41 import java.io.File;
42 import java.io.OutputStream;
43 import java.nio.file.Files;
44 import java.nio.file.Path;
45 import java.nio.file.Paths;
46 import java.nio.file.StandardCopyOption;
47 import java.util.stream.Stream;
48 import java.lang.module.ModuleDescriptor;
49 import java.util.Collections;
50 import java.util.LinkedList;
51 import java.util.List;
52 import jdk.internal.module.ModuleInfoWriter;
53 import jdk.test.lib.process.ProcessTools;
54
55 public class ClassLoaderTest {
56
57 private static final String SRC = System.getProperty("test.src");
58 private static final Path TEST_CLASSES =
59 Paths.get(System.getProperty("test.classes"));
60 private static final Path ARTIFACT_DIR = Paths.get("jars");
61 private static final Path VALID_POLICY = Paths.get(SRC, "valid.policy");
62 private static final Path INVALID_POLICY
63 = Paths.get(SRC, "malformed.policy");
64 /*
65 * Here is the naming convention followed for each jar.
66 * cl.jar - Regular custom class loader jar.
67 * mcl.jar - Modular custom class loader jar.
68 * c.jar - Regular client jar.
69 * mc.jar - Modular client jar.
70 * amc.jar - Modular client referring automated custom class loader jar.
71 */
72 private static final Path CL_JAR = ARTIFACT_DIR.resolve("cl.jar");
73 private static final Path MCL_JAR = ARTIFACT_DIR.resolve("mcl.jar");
|