< prev index next >
test/jdk/sun/net/www/protocol/jar/MultiReleaseJarURLConnection.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2015, 2016, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2015, 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 21,31 ****
* questions.
*/
/*
* @test
! * @bug 8132734 8144062 8159785
* @summary Test that URL connections to multi-release jars can be runtime versioned
* @library /lib/testlibrary/java/util/jar
* @modules jdk.compiler
* jdk.httpserver
* jdk.jartool
--- 21,31 ----
* questions.
*/
/*
* @test
! * @bug 8132734 8144062 8159785 8194070
* @summary Test that URL connections to multi-release jars can be runtime versioned
* @library /lib/testlibrary/java/util/jar
* @modules jdk.compiler
* jdk.httpserver
* jdk.jartool
*** 106,130 ****
Assert.assertTrue(readAndCompare(new URL(baseUrlEntry + "#fragment"), "return 8"));
// cached entities not affected
Assert.assertTrue(readAndCompare(new URL(baseUrlEntry), "return 8"));
// the following tests will not work with unversioned jars
! if (style.equals("unversioned")) return;
// direct access to versioned entry
String versUrlEntry = urlFile + "META-INF/versions/" + Runtime.version().major()
+ "/version/Version.java";
Assert.assertTrue(readAndCompare(new URL(versUrlEntry), rtreturn));
// adding any fragment does not change things
Assert.assertTrue(readAndCompare(new URL(versUrlEntry + "#runtime"), rtreturn));
Assert.assertTrue(readAndCompare(new URL(versUrlEntry + "#fragment"), rtreturn));
-
- // it really doesn't change things
- versUrlEntry = urlFile + "META-INF/versions/10/version/Version.java";
- Assert.assertTrue(readAndCompare(new URL(versUrlEntry), "return 10"));
- Assert.assertTrue(readAndCompare(new URL(versUrlEntry + "#runtime"), "return 10"));
- Assert.assertTrue(readAndCompare(new URL(versUrlEntry + "#fragment"), "return 10"));
}
@Test(dataProvider = "data")
public void testCachedJars(String style, String file) throws Exception {
String urlFile = "jar:file:" + file + "!/";
--- 106,125 ----
Assert.assertTrue(readAndCompare(new URL(baseUrlEntry + "#fragment"), "return 8"));
// cached entities not affected
Assert.assertTrue(readAndCompare(new URL(baseUrlEntry), "return 8"));
// the following tests will not work with unversioned jars
! if (style.equals("unversioned"))
! return;
// direct access to versioned entry
String versUrlEntry = urlFile + "META-INF/versions/" + Runtime.version().major()
+ "/version/Version.java";
Assert.assertTrue(readAndCompare(new URL(versUrlEntry), rtreturn));
// adding any fragment does not change things
Assert.assertTrue(readAndCompare(new URL(versUrlEntry + "#runtime"), rtreturn));
Assert.assertTrue(readAndCompare(new URL(versUrlEntry + "#fragment"), rtreturn));
}
@Test(dataProvider = "data")
public void testCachedJars(String style, String file) throws Exception {
String urlFile = "jar:file:" + file + "!/";
*** 223,233 ****
Assert.assertTrue(rep.endsWith(suffix));
}
cldr.close();
}
-
private boolean readAndCompare(URL url, String match) throws Exception {
boolean result;
// necessary to do it this way, instead of openStream(), so we can
// close underlying JarFile, otherwise windows can't delete the file
URLConnection conn = url.openConnection();
--- 218,227 ----
< prev index next >