From e63e24652178af1ab08ae224129d63e9c6af81e3 Mon Sep 17 00:00:00 2001 From: Sebb Date: Thu, 9 Nov 2023 23:20:57 +0000 Subject: [PATCH] Don't load JNI when testing JNA Temporary work-round for CRYPTO-175 Ideally need to change AbstractTest classes to be generic. --- .../jna/AbstractCipherJnaStreamTest.java | 22 +++++++++++++++++++ .../PositionedCryptoInputStreamJnaTest.java | 5 +++++ 2 files changed, 27 insertions(+) diff --git a/src/test/java/org/apache/commons/crypto/jna/AbstractCipherJnaStreamTest.java b/src/test/java/org/apache/commons/crypto/jna/AbstractCipherJnaStreamTest.java index 255b881b0..99e8d5fb9 100644 --- a/src/test/java/org/apache/commons/crypto/jna/AbstractCipherJnaStreamTest.java +++ b/src/test/java/org/apache/commons/crypto/jna/AbstractCipherJnaStreamTest.java @@ -82,4 +82,26 @@ public void testSkip() throws Exception { doSkipTest(CIPHER_OPENSSL_JNA, true); } + + @Override + @Test + @Timeout(value = 120000, unit = TimeUnit.MILLISECONDS) + public void testExceptions() throws Exception { + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + doExceptionTest(CIPHER_OPENSSL_JNA, baos, false); + + doExceptionTest(CIPHER_OPENSSL_JNA, baos, true); + } + + @Override + @Test + @Timeout(value = 120000, unit = TimeUnit.MILLISECONDS) + public void testFieldGetters() throws Exception { + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + doFieldGetterTest(CIPHER_OPENSSL_JNA, baos, false); + + doFieldGetterTest(CIPHER_OPENSSL_JNA, baos, true); + } + + } diff --git a/src/test/java/org/apache/commons/crypto/jna/PositionedCryptoInputStreamJnaTest.java b/src/test/java/org/apache/commons/crypto/jna/PositionedCryptoInputStreamJnaTest.java index a9dc0246e..ab47dd432 100644 --- a/src/test/java/org/apache/commons/crypto/jna/PositionedCryptoInputStreamJnaTest.java +++ b/src/test/java/org/apache/commons/crypto/jna/PositionedCryptoInputStreamJnaTest.java @@ -31,6 +31,11 @@ public void init() { assumeTrue(OpenSslJna.isEnabled()); } + @Test + @Override // Don't load JNI! + public void testJNI() throws Exception { + } + @Test public void testCipher() throws Exception { testCipher(OpenSslJnaCipher.class.getName());