You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ff...@apache.org on 2020/08/12 17:58:11 UTC

[camel] branch master updated: [CAMEL-15403]camel-xmlsecurity - Some unit tests fails with Oracle JDK8 261

This is an automated email from the ASF dual-hosted git repository.

ffang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 960da70  [CAMEL-15403]camel-xmlsecurity - Some unit tests fails with Oracle JDK8 261
     new 310bf7c  Merge branch 'master' of github.com:apache/camel
960da70 is described below

commit 960da7044e2fdbc35d509e936e64c9e42b78c5c0
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Wed Aug 12 13:57:18 2020 -0400

    [CAMEL-15403]camel-xmlsecurity - Some unit tests fails with Oracle JDK8 261
---
 .../org/apache/camel/test/junit5/TestSupport.java     | 19 +++++++++++++++++++
 .../component/xmlsecurity/ECDSASignatureTest.java     |  5 +++--
 .../component/xmlsecurity/SignatureAlgorithmTest.java |  3 ++-
 .../xmlsecurity/SignatureDigestMethodTest.java        |  2 +-
 .../xmlsecurity/XAdESSignaturePropertiesTest.java     |  3 ++-
 .../camel/component/xmlsecurity/XmlSignatureTest.java |  3 ++-
 6 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/components/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/TestSupport.java b/components/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/TestSupport.java
index 04b39b5..8a52781 100644
--- a/components/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/TestSupport.java
+++ b/components/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/TestSupport.java
@@ -507,6 +507,25 @@ public final class TestSupport {
     }
 
     /**
+     * Tells whether the current Java version is 1.8 and build_no 261 and later.
+     *
+     * @return <tt>true</tt> if its Java 1.8.0_261 and later, <tt>false</tt> if its not (for
+     *         example Java 1.8.0_251)
+     */
+    public static boolean isJava18_261_later() {
+        boolean ret = false;
+        String version = System.getProperty("java.version");
+        try {
+            ret = version != null && version.startsWith("1.8.0_")
+                && Integer.parseInt(version.substring(6)) >= 261;
+        } catch (NumberFormatException ex) {
+            ret = false;
+        }
+        return ret;
+    }
+
+
+    /**
      * Tells whether the current Java version is 1.9.
      *
      * @return <tt>true</tt> if its Java 1.9, <tt>false</tt> if its not (for
diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/ECDSASignatureTest.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/ECDSASignatureTest.java
index b973d0a..15922f4 100644
--- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/ECDSASignatureTest.java
+++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/ECDSASignatureTest.java
@@ -58,7 +58,8 @@ public class ECDSASignatureTest extends CamelTestSupport {
     
     static {
         boolean includeNewLine = true;
-        if (TestSupport.getJavaMajorVersion() >= 9) {
+        if (TestSupport.getJavaMajorVersion() >= 9
+            || TestSupport.isJava18_261_later()) {
             includeNewLine = false;
         }
         payload = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
@@ -295,4 +296,4 @@ public class ECDSASignatureTest extends CamelTestSupport {
         return SameDocumentUriDereferencer.getInstance();
     }
 
-}
\ No newline at end of file
+}
diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SignatureAlgorithmTest.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SignatureAlgorithmTest.java
index 59851e5..b1e580d 100644
--- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SignatureAlgorithmTest.java
+++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SignatureAlgorithmTest.java
@@ -89,7 +89,8 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
     
     static {
         boolean includeNewLine = true;
-        if (TestSupport.getJavaMajorVersion() >= 9) {
+        if (TestSupport.getJavaMajorVersion() >= 9
+            || TestSupport.isJava18_261_later()) {
             includeNewLine = false;
         }
         payload = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SignatureDigestMethodTest.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SignatureDigestMethodTest.java
index 504ee26..a778381 100644
--- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SignatureDigestMethodTest.java
+++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SignatureDigestMethodTest.java
@@ -87,7 +87,7 @@ public class SignatureDigestMethodTest extends CamelTestSupport {
     
     static {
         boolean includeNewLine = true;
-        if (TestSupport.getJavaMajorVersion() >= 9) {
+        if (TestSupport.getJavaMajorVersion() >= 9 || TestSupport.isJava18_261_later()) {
             includeNewLine = false;
         }
         payload = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java
index afa985f..b964ec5 100644
--- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java
+++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java
@@ -86,7 +86,8 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport {
     
     static {
         boolean includeNewLine = true;
-        if (TestSupport.getJavaMajorVersion() >= 9) {
+        if (TestSupport.getJavaMajorVersion() >= 9
+            || TestSupport.isJava18_261_later()) {
             includeNewLine = false;
         }
         payload = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XmlSignatureTest.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XmlSignatureTest.java
index c018394..50f6182 100644
--- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XmlSignatureTest.java
+++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XmlSignatureTest.java
@@ -119,7 +119,8 @@ public class XmlSignatureTest extends CamelTestSupport {
     private KeyPair keyPair;
     
     static {
-        if (TestSupport.getJavaMajorVersion() >= 9) {
+        if (TestSupport.getJavaMajorVersion() >= 9
+            || TestSupport.isJava18_261_later()) {
             includeNewLine = false;
         }
         payload = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"