test/jdk/java/security/Provider/ProviderVersionCheck.java
author darcy
Tue, 30 Jan 2018 10:42:13 -0800
changeset 48685 f13f9b941bc7
parent 47216 71c04702a3d5
permissions -rw-r--r--
8196414: Update ProviderVersionCheck.java to pass on updated JDK versions Reviewed-by: mullan
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20485
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
     1
/*
48685
f13f9b941bc7 8196414: Update ProviderVersionCheck.java to pass on updated JDK versions
darcy
parents: 47216
diff changeset
     2
 * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
20485
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
     4
 *
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
     8
 *
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    13
 * accompanied this code).
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    14
 *
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    18
 *
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    21
 * questions.
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    22
 */
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    23
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    24
import java.security.Provider;
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    25
import java.security.Security;
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    26
import java.lang.Exception;
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    27
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    28
/*
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    29
 * @test
48685
f13f9b941bc7 8196414: Update ProviderVersionCheck.java to pass on updated JDK versions
darcy
parents: 47216
diff changeset
    30
 * @bug 8030823 8130696 8196414
20485
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    31
 * @run main/othervm ProviderVersionCheck
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    32
 * @summary Verify all providers in the default Providers list have the proper
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    33
 * version for the release
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    34
 * @author Anthony Scarpino
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    35
 */
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    36
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    37
public class ProviderVersionCheck {
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    38
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    39
    public static void main(String arg[]) throws Exception{
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    40
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    41
        boolean failure = false;
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    42
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    43
        for (Provider p: Security.getProviders()) {
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    44
            System.out.print(p.getName() + " ");
48685
f13f9b941bc7 8196414: Update ProviderVersionCheck.java to pass on updated JDK versions
darcy
parents: 47216
diff changeset
    45
            String specVersion = System.getProperty("java.specification.version");
f13f9b941bc7 8196414: Update ProviderVersionCheck.java to pass on updated JDK versions
darcy
parents: 47216
diff changeset
    46
            if (p.getVersion() != Double.parseDouble(specVersion)) {
20485
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    47
                System.out.println("failed. " + "Version received was " +
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    48
                        p.getVersion());
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    49
                failure = true;
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    50
            } else {
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    51
                System.out.println("passed.");
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    52
            }
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    53
        }
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    54
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    55
        if (failure) {
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    56
            throw new Exception("Provider(s) failed to have the expected " +
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    57
                    "version value.");
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    58
        }
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    59
    }
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    60
8af87f3d549c 7122707: Security Providers need to have their version numbers updated for JDK8
ascarpino
parents:
diff changeset
    61
}