8211974: move test/jdk/lib/testlibrary/java/util/jar/*.java to top-level library or a local library

Reviewed-by: rriggs, bchristi, lancea, iignatyev
This commit is contained in:
Ivan Sipka 2020-07-08 20:35:36 +01:00 committed by Igor Ignatyev
parent e5c43ab86e
commit dda0c6cecd
12 changed files with 61 additions and 34 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,11 +29,13 @@ import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import jdk.test.lib.util.JarBuilder;
/* /*
* @test * @test
* @bug 8174151 * @bug 8174151
* @summary Test for java.protocol.handler.pkgs with jar protocol handler * @summary Test for java.protocol.handler.pkgs with jar protocol handler
* @library /lib/testlibrary/java/util/jar * @library /test/lib/
* @build jdk.test.lib.util.JarBuilder
* @compile handlers/jar/Handler.java * @compile handlers/jar/Handler.java
* @run main/othervm -Djava.protocol.handler.pkgs=handlers JarHandlerPkgPrefix * @run main/othervm -Djava.protocol.handler.pkgs=handlers JarHandlerPkgPrefix
*/ */
@ -62,4 +64,5 @@ public class JarHandlerPkgPrefix {
Files.delete(jarPath); Files.delete(jarPath);
} }
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -21,14 +21,13 @@
* questions. * questions.
*/ */
/** /*
* @test * @test
* @bug 8186334 * @bug 8186334
* @library /lib/testlibrary/java/util/jar * @summary Make sure scanning manifest doesn't throw AIOOBE on certain strings containing backticks.
* @build JarBuilder * @library /test/lib/
* @build jdk.test.lib.util.JarBuilder
* @run testng JarBacktickManifest * @run testng JarBacktickManifest
* @summary Make sure scanning manifest doesn't throw AIOOBE on certain strings
* containing backticks.
*/ */
import java.io.File; import java.io.File;
@ -41,6 +40,8 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import jdk.test.lib.util.JarBuilder;
public class JarBacktickManifest { public class JarBacktickManifest {
public static final String VERIFY_MANIFEST_JAR = "verifyManifest.jar"; public static final String VERIFY_MANIFEST_JAR = "verifyManifest.jar";

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,9 @@
* support multi-release jar files * support multi-release jar files
* @library /lib/testlibrary/java/util/jar /test/lib * @library /lib/testlibrary/java/util/jar /test/lib
* @build jdk.test.lib.RandomFactory * @build jdk.test.lib.RandomFactory
* Compiler JarBuilder CreateMultiReleaseTestJars * CreateMultiReleaseTestJars
* jdk.test.lib.compiler.Compiler
* jdk.test.lib.util.JarBuilder
* @run testng MultiReleaseJarAPI * @run testng MultiReleaseJarAPI
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,7 +29,10 @@
* @modules jdk.jartool * @modules jdk.jartool
* jdk.compiler * jdk.compiler
* jdk.httpserver * jdk.httpserver
* @build Compiler JarBuilder CreateMultiReleaseTestJars SimpleHttpServer * @build CreateMultiReleaseTestJars
* SimpleHttpServer
* jdk.test.lib.compiler.Compiler
* jdk.test.lib.util.JarBuilder
* @run testng MultiReleaseJarHttpProperties * @run testng MultiReleaseJarHttpProperties
* @run testng/othervm -Djdk.util.jar.version=0 MultiReleaseJarHttpProperties * @run testng/othervm -Djdk.util.jar.version=0 MultiReleaseJarHttpProperties
* @run testng/othervm -Djdk.util.jar.version=8 MultiReleaseJarHttpProperties * @run testng/othervm -Djdk.util.jar.version=8 MultiReleaseJarHttpProperties

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,10 @@
* @test * @test
* @bug 8132734 8144062 8194070 * @bug 8132734 8144062 8194070
* @summary Test the System properties for JarFile that support multi-release jar files * @summary Test the System properties for JarFile that support multi-release jar files
* @library /lib/testlibrary/java/util/jar * @library /lib/testlibrary/java/util/jar /test/lib/
* @build Compiler JarBuilder CreateMultiReleaseTestJars * @build CreateMultiReleaseTestJars
* jdk.test.lib.compiler.Compiler
* jdk.test.lib.util.JarBuilder
* @run testng MultiReleaseJarProperties * @run testng MultiReleaseJarProperties
* @run testng/othervm -Djdk.util.jar.version=0 MultiReleaseJarProperties * @run testng/othervm -Djdk.util.jar.version=0 MultiReleaseJarProperties
* @run testng/othervm -Djdk.util.jar.version=8 MultiReleaseJarProperties * @run testng/othervm -Djdk.util.jar.version=8 MultiReleaseJarProperties

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,10 @@
* @test * @test
* @bug 8132734 8144062 * @bug 8132734 8144062
* @summary Test potential security related issues * @summary Test potential security related issues
* @library /lib/testlibrary/java/util/jar * @library /lib/testlibrary/java/util/jar /test/lib/
* @build Compiler JarBuilder CreateMultiReleaseTestJars * @build CreateMultiReleaseTestJars
* jdk.test.lib.compiler.Compiler
* jdk.test.lib.util.JarBuilder
* @run testng MultiReleaseJarSecurity * @run testng MultiReleaseJarSecurity
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,10 +25,11 @@
* @test * @test
* @bug 8164389 8222440 * @bug 8164389 8222440
* @summary walk entries in a multi-release jar file via jdk.zipfs * @summary walk entries in a multi-release jar file via jdk.zipfs
* @library /lib/testlibrary/java/util/jar
* @modules jdk.jartool * @modules jdk.jartool
* jdk.zipfs * jdk.zipfs
* @build Compiler JarBuilder * @library /test/lib/
* @build jdk.test.lib.util.JarBuilder
* jdk.test.lib.compiler.Compiler
* @run testng JFSTester * @run testng JFSTester
*/ */
@ -49,6 +50,8 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import jdk.test.lib.util.JarBuilder;
public class JFSTester { public class JFSTester {
private URI jarURI; private URI jarURI;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,11 +25,13 @@
* @test * @test
* @bug 8144355 8144062 8176709 8194070 8193802 8231093 * @bug 8144355 8144062 8176709 8194070 8193802 8231093
* @summary Test aliasing additions to ZipFileSystem for multi-release jar files * @summary Test aliasing additions to ZipFileSystem for multi-release jar files
* @library /lib/testlibrary/java/util/jar * @library /lib/testlibrary/java/util/jar /test/lib/
* @modules jdk.compiler * @modules jdk.compiler
* jdk.jartool * jdk.jartool
* jdk.zipfs * jdk.zipfs
* @build Compiler JarBuilder CreateMultiReleaseTestJars * @build CreateMultiReleaseTestJars
* jdk.test.lib.util.JarBuilder
* jdk.test.lib.compiler.Compiler
* @run testng MultiReleaseJarTest * @run testng MultiReleaseJarTest
*/ */
@ -47,6 +49,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.*; import org.testng.annotations.*;
import jdk.test.lib.util.JarBuilder;
public class MultiReleaseJarTest { public class MultiReleaseJarTest {
final private int MAJOR_VERSION = Runtime.version().feature(); final private int MAJOR_VERSION = Runtime.version().feature();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -37,6 +37,9 @@ import java.util.Map;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
import jdk.security.jarsigner.JarSigner; import jdk.security.jarsigner.JarSigner;
import jdk.test.lib.util.JarBuilder;
import jdk.test.lib.compiler.Compiler;
public class CreateMultiReleaseTestJars { public class CreateMultiReleaseTestJars {
final private String main = final private String main =
"package version;\n\n" "package version;\n\n"

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,7 +29,10 @@
* @modules jdk.compiler * @modules jdk.compiler
* jdk.httpserver * jdk.httpserver
* jdk.jartool * jdk.jartool
* @build Compiler JarBuilder CreateMultiReleaseTestJars SimpleHttpServer * @build CreateMultiReleaseTestJars
* SimpleHttpServer
* jdk.test.lib.util.JarBuilder
* jdk.test.lib.compiler.Compiler
* @run testng MultiReleaseJarURLConnection * @run testng MultiReleaseJarURLConnection
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -20,6 +20,7 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package jdk.test.lib.compiler;
import javax.tools.*; import javax.tools.*;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -31,15 +32,15 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
class Compiler { public class Compiler {
final private Map<String,String> input; final private Map<String,String> input;
private List<String> options; private List<String> options;
Compiler(Map<String,String> input) { public Compiler(Map<String,String> input) {
this.input = input; this.input = input;
} }
Compiler setRelease(int release) { public Compiler setRelease(int release) {
// Setting the -release option does not work for some reason // Setting the -release option does not work for some reason
// so do it the old fashioned way // so do it the old fashioned way
// options = Arrays.asList("-release", String.valueOf(release)); // options = Arrays.asList("-release", String.valueOf(release));
@ -48,7 +49,7 @@ class Compiler {
return this; return this;
} }
Map<String,byte[]> compile() { public Map<String,byte[]> compile() {
List<SourceFileObject> cunits = createCompilationUnits(); List<SourceFileObject> cunits = createCompilationUnits();
Map<String,ClassFileObject> cfos = createClassFileObjects(); Map<String,ClassFileObject> cfos = createClassFileObjects();
JavaCompiler jc = ToolProvider.getSystemJavaCompiler(); JavaCompiler jc = ToolProvider.getSystemJavaCompiler();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -20,6 +20,7 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package jdk.test.lib.util;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;