This is an automated email from the ASF dual-hosted git repository. ffang pushed a commit to branch camel-3.4.x in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.4.x by this push: new d6c41fb0 [CAMEL-15403]camel-xmlsecurity - Some unit tests fails with Oracle JDK8 261 d6c41fb0 is described below commit d6c41fb008d2ea644dfe3cf008bd4512985eaa0c Author: Freeman Fang <freeman.f...@gmail.com> AuthorDate: Wed Aug 12 13:57:18 2020 -0400 [CAMEL-15403]camel-xmlsecurity - Some unit tests fails with Oracle JDK8 261 (cherry picked from commit 960da7044e2fdbc35d509e936e64c9e42b78c5c0) --- .../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 7f66ca1..1492188 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 @@ -53,7 +53,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\"?>" @@ -290,4 +291,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 9e8f71e..919af9f 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 c8189f7..fafa143 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 b1896dc..da7bd83 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 @@ -81,7 +81,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 b4949ca..3d1031d 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 @@ -113,7 +113,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\"?>"