8173903: Update various tests to pass under JDK 10
authordarcy
Fri, 03 Feb 2017 12:36:42 -0800
changeset 43612 91671699935d
parent 43611 e6396b0cd092
child 43613 276f99eae616
8173903: Update various tests to pass under JDK 10 Reviewed-by: lancea, psandoz
jdk/test/java/lang/module/MultiReleaseJarTest.java
jdk/test/java/security/Provider/ProviderVersionCheck.java
jdk/test/sun/security/tools/jarsigner/multiRelease/MVJarSigningTest.java
--- a/jdk/test/java/lang/module/MultiReleaseJarTest.java	Tue Jan 31 19:26:10 2017 -0500
+++ b/jdk/test/java/lang/module/MultiReleaseJarTest.java	Fri Feb 03 12:36:42 2017 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, 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
@@ -65,7 +65,7 @@
 
     private static final String MODULE_INFO = "module-info.class";
 
-    private static final int RELEASE = Runtime.version().major();
+    private static final String RELEASE = "" + Runtime.version().major();
 
     // are multi-release JARs enabled?
     private static final boolean MULTI_RELEASE;
@@ -88,8 +88,8 @@
                 .moduleInfo("module-info.class", descriptor)
                 .resource("p/Main.class")
                 .resource("p/Helper.class")
-                .resource("META-INF/versions/9/p/Helper.class")
-                .resource("META-INF/versions/9/p/internal/Helper9.class")
+                .resource("META-INF/versions/" + RELEASE + "/p/Helper.class")
+                .resource("META-INF/versions/" + RELEASE + "/p/internal/HelperNew.class")
                 .build();
 
         // find the module
@@ -131,9 +131,9 @@
                 .moduleInfo(MODULE_INFO, descriptor1)
                 .resource("p/Main.class")
                 .resource("p/Helper.class")
-                .moduleInfo("META-INF/versions/9/" + MODULE_INFO, descriptor2)
-                .resource("META-INF/versions/9/p/Helper.class")
-                .resource("META-INF/versions/9/p/internal/Helper9.class")
+                .moduleInfo("META-INF/versions/" + RELEASE + "/" + MODULE_INFO, descriptor2)
+                .resource("META-INF/versions/" + RELEASE + "/p/Helper.class")
+                .resource("META-INF/versions/" + RELEASE + "/p/internal/HelperNew.class")
                 .build();
 
         // find the module
@@ -161,8 +161,8 @@
         Path jar = new JarBuilder(name)
                 .resource("p/Main.class")
                 .resource("p/Helper.class")
-                .resource("META-INF/versions/9/p/Helper.class")
-                .resource("META-INF/versions/9/p/internal/Helper9.class")
+                .resource("META-INF/versions/" + RELEASE + "/p/Helper.class")
+                .resource("META-INF/versions/" + RELEASE + "/p/internal/HelperNew.class")
                 .build();
 
         // find the module
@@ -200,7 +200,7 @@
 
         Path jar = new JarBuilder(name)
                 .moduleInfo(MODULE_INFO, descriptor1)
-                .moduleInfo("META-INF/versions/9/" + MODULE_INFO, descriptor2)
+                .moduleInfo("META-INF/versions/" + RELEASE + "/" + MODULE_INFO, descriptor2)
                 .build();
 
         // find the module
--- a/jdk/test/java/security/Provider/ProviderVersionCheck.java	Tue Jan 31 19:26:10 2017 -0500
+++ b/jdk/test/java/security/Provider/ProviderVersionCheck.java	Fri Feb 03 12:36:42 2017 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, 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
@@ -42,7 +42,7 @@
 
         for (Provider p: Security.getProviders()) {
             System.out.print(p.getName() + " ");
-            if (p.getVersion() != 9.0d) {
+            if (p.getVersion() != 10.0d) {
                 System.out.println("failed. " + "Version received was " +
                         p.getVersion());
                 failure = true;
--- a/jdk/test/sun/security/tools/jarsigner/multiRelease/MVJarSigningTest.java	Tue Jan 31 19:26:10 2017 -0500
+++ b/jdk/test/sun/security/tools/jarsigner/multiRelease/MVJarSigningTest.java	Fri Feb 03 12:36:42 2017 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, 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
@@ -74,7 +74,8 @@
     private static final String KEYPASS = "changeit";
     private static final String SIGNED_JAR = "Signed.jar";
     private static final String POLICY_FILE = "SignedJar.policy";
-    private static final String VERSION_MESSAGE = "I am running on version 9";
+    private static final String VERSION = "" + Runtime.version().major();
+    private static final String VERSION_MESSAGE = "I am running on version " + VERSION;
 
     public static void main(String[] args) throws Throwable {
         // compile java files in jarContent directory