< prev index next >

test/jdk/sun/net/www/protocol/jar/MultiReleaseJarURLConnection.java

Print this page




   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  * @bug 8132734 8144062 8159785 8194070
  27  * @summary Test that URL connections to multi-release jars can be runtime versioned
  28  * @library /lib/testlibrary/java/util/jar
  29  * @modules jdk.compiler
  30  *          jdk.httpserver
  31  *          jdk.jartool
  32  * @build Compiler JarBuilder CreateMultiReleaseTestJars SimpleHttpServer



  33  * @run testng MultiReleaseJarURLConnection
  34  */
  35 
  36 import java.io.IOException;
  37 import java.io.InputStream;
  38 import java.lang.invoke.MethodHandle;
  39 import java.lang.invoke.MethodHandles;
  40 import java.lang.invoke.MethodType;
  41 import java.net.JarURLConnection;
  42 import java.net.URL;
  43 import java.net.URLClassLoader;
  44 import java.net.URLConnection;
  45 import java.nio.file.Files;
  46 import java.nio.file.Paths;
  47 import java.util.Enumeration;
  48 import java.util.jar.JarFile;
  49 





  50 import org.testng.Assert;
  51 import org.testng.annotations.AfterClass;
  52 import org.testng.annotations.BeforeClass;
  53 import org.testng.annotations.DataProvider;
  54 import org.testng.annotations.Test;
  55 
  56 public class MultiReleaseJarURLConnection {
  57     String userdir = System.getProperty("user.dir",".");
  58     String unversioned = userdir + "/unversioned.jar";
  59     String unsigned = userdir + "/multi-release.jar";
  60     String signed = userdir + "/signed-multi-release.jar";
  61     SimpleHttpServer server;
  62 
  63     @BeforeClass
  64     public void initialize() throws Exception {
  65         CreateMultiReleaseTestJars creator = new CreateMultiReleaseTestJars();
  66         creator.compileEntries();
  67         creator.buildUnversionedJar();
  68         creator.buildMultiReleaseJar();
  69         creator.buildSignedMultiReleaseJar();




   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  * @bug 8132734 8144062 8159785 8194070
  27  * @summary Test that URL connections to multi-release jars can be runtime versioned
  28  * @library /lib /test/lib
  29  * @modules jdk.compiler
  30  *          jdk.httpserver
  31  *          jdk.jartool
  32  * @build jdk.test.lib.compiler.Compiler
  33  *        jdk.test.lib.util.JarBuilder
  34  *        jdk.test.lib.util.SimpleHttpServer
  35  *        mrjar.CreateMultiReleaseTestJars
  36  * @run testng MultiReleaseJarURLConnection
  37  */
  38 
  39 import java.io.IOException;
  40 import java.io.InputStream;
  41 import java.lang.invoke.MethodHandle;
  42 import java.lang.invoke.MethodHandles;
  43 import java.lang.invoke.MethodType;
  44 import java.net.JarURLConnection;
  45 import java.net.URL;
  46 import java.net.URLClassLoader;
  47 import java.net.URLConnection;
  48 import java.nio.file.Files;
  49 import java.nio.file.Paths;
  50 import java.util.Enumeration;
  51 import java.util.jar.JarFile;
  52 
  53 import jdk.test.lib.compiler.Compiler;
  54 import jdk.test.lib.util.JarBuilder;
  55 import jdk.test.lib.util.SimpleHttpServer;
  56 import mrjar.CreateMultiReleaseTestJars;
  57 
  58 import org.testng.Assert;
  59 import org.testng.annotations.AfterClass;
  60 import org.testng.annotations.BeforeClass;
  61 import org.testng.annotations.DataProvider;
  62 import org.testng.annotations.Test;
  63 
  64 public class MultiReleaseJarURLConnection {
  65     String userdir = System.getProperty("user.dir",".");
  66     String unversioned = userdir + "/unversioned.jar";
  67     String unsigned = userdir + "/multi-release.jar";
  68     String signed = userdir + "/signed-multi-release.jar";
  69     SimpleHttpServer server;
  70 
  71     @BeforeClass
  72     public void initialize() throws Exception {
  73         CreateMultiReleaseTestJars creator = new CreateMultiReleaseTestJars();
  74         creator.compileEntries();
  75         creator.buildUnversionedJar();
  76         creator.buildMultiReleaseJar();
  77         creator.buildSignedMultiReleaseJar();


< prev index next >