[java-opensaml COMMIT] in /trunk: opensaml-security-api/src/test/java/org/opensaml/security/SecurityProviderTestSuppo...

noreply at shibboleth.net noreply at shibboleth.net
Fri Oct 24 13:56:17 EDT 2014


Author: putmanb
Date: Fri Oct 24 13:56:17 2014
New Revision: 4109

URL: http://svn.shibboleth.net/view/java-opensaml?rev=4109&view=rev
Log:
Update security provider test utility class with OpenJDK detection support.
Make use of utility Java version check method where appropriate.

Modified:
    trunk/opensaml-security-api/src/test/java/org/opensaml/security/SecurityProviderTestSupport.java
    trunk/opensaml-xmlsec-api/src/test/java/org/opensaml/xmlsec/algorithm/AlgorithmRegistryTest.java
    trunk/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/impl/AlgorithmRuntimeSupportedPredicateTest.java

Modified: trunk/opensaml-security-api/src/test/java/org/opensaml/security/SecurityProviderTestSupport.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-security-api/src/test/java/org/opensaml/security/SecurityProviderTestSupport.java?rev=4109&r1=4108&r2=4109&view=diff
==============================================================================
--- trunk/opensaml-security-api/src/test/java/org/opensaml/security/SecurityProviderTestSupport.java (original)
+++ trunk/opensaml-security-api/src/test/java/org/opensaml/security/SecurityProviderTestSupport.java Fri Oct 24 13:56:17 2014
@@ -96,11 +96,20 @@
     
     /**
      * Return the current Java major version, e.g. 6, 7 or 8.
-     * @return
+     * @return the Java major version
      */
     public int getJavaVersion() {
         String versionStr = System.getProperty("java.version");
         return Integer.parseInt(versionStr.split("\\.")[1]);
     }
+    
+    /**
+     * Determine if we're running on OpenJDK.
+     * @return true or false
+     */
+    public boolean isOpenJDK() {
+        return System.getProperty("java.runtime.name", "").startsWith("OpenJDK")
+                || System.getProperty("java.vm.name", "").startsWith("OpenJDK");
+    }
 
 }

Modified: trunk/opensaml-xmlsec-api/src/test/java/org/opensaml/xmlsec/algorithm/AlgorithmRegistryTest.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-xmlsec-api/src/test/java/org/opensaml/xmlsec/algorithm/AlgorithmRegistryTest.java?rev=4109&r1=4108&r2=4109&view=diff
==============================================================================
--- trunk/opensaml-xmlsec-api/src/test/java/org/opensaml/xmlsec/algorithm/AlgorithmRegistryTest.java (original)
+++ trunk/opensaml-xmlsec-api/src/test/java/org/opensaml/xmlsec/algorithm/AlgorithmRegistryTest.java Fri Oct 24 13:56:17 2014
@@ -225,13 +225,13 @@
             
             // Conditional environment tests
             
-            if (providerSupport.haveSunEC() || providerSupport.haveBC() || providerSupport.getJavaVersion() >= 8) {
+            if (providerSupport.haveSunEC() || providerSupport.haveBC() || providerSupport.haveJavaGreaterOrEqual(8)) {
                 Assert.assertTrue(registry.isRuntimeSupported(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA1));
                 Assert.assertTrue(registry.isRuntimeSupported(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA256));
                 Assert.assertTrue(registry.isRuntimeSupported(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA384));
                 Assert.assertTrue(registry.isRuntimeSupported(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA512));
                 
-                if (providerSupport.haveBC() || providerSupport.getJavaVersion() >= 8) {
+                if (providerSupport.haveBC() || providerSupport.haveJavaGreaterOrEqual(8)) {
                     Assert.assertTrue(registry.isRuntimeSupported(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA224));
                 }
             } else {
@@ -242,7 +242,7 @@
                 Assert.assertFalse(registry.isRuntimeSupported(SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA512));
             }
             
-            if (providerSupport.haveBC() || providerSupport.getJavaVersion() >= 8) {
+            if (providerSupport.haveBC() || providerSupport.haveJavaGreaterOrEqual(8)) {
                 Assert.assertTrue(registry.isRuntimeSupported(SignatureConstants.ALGO_ID_DIGEST_SHA224));
                 Assert.assertTrue(registry.isRuntimeSupported(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA224));
                 Assert.assertTrue(registry.isRuntimeSupported(SignatureConstants.ALGO_ID_MAC_HMAC_SHA224));

Modified: trunk/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/impl/AlgorithmRuntimeSupportedPredicateTest.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/impl/AlgorithmRuntimeSupportedPredicateTest.java?rev=4109&r1=4108&r2=4109&view=diff
==============================================================================
--- trunk/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/impl/AlgorithmRuntimeSupportedPredicateTest.java (original)
+++ trunk/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/impl/AlgorithmRuntimeSupportedPredicateTest.java Fri Oct 24 13:56:17 2014
@@ -105,13 +105,13 @@
         
         try {
             

[... 22 lines stripped ...]


More information about the commits mailing list