You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/08/23 19:06:27 UTC

[commons-crypto] branch master updated (bdded36 -> bd3e9d3)

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

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-crypto.git.


    from bdded36  - Make org.apache.commons.crypto.stream.input.Input extend Closeable. - Make org.apache.commons.crypto.stream.output.Output extend Closeable. - Add new and missing tests. - Code coverage 100% for StreamOutput. - Code coverage 100% for ChannelInput.
     new 37f7378  Don't hide useful comments.
     new bd3e9d3  Simpler property loading. More tests.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/commons/crypto/Crypto.java     |  4 +-
 .../java/org/apache/commons/crypto/CryptoTest.java | 57 ++++++++++++++++------
 2 files changed, 43 insertions(+), 18 deletions(-)


[commons-crypto] 01/02: Don't hide useful comments.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-crypto.git

commit 37f7378a6a589a444a10a6ef27265eb73105cf12
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Aug 23 14:53:05 2020 -0400

    Don't hide useful comments.
---
 .../java/org/apache/commons/crypto/CryptoTest.java | 36 ++++++++++++----------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/src/test/java/org/apache/commons/crypto/CryptoTest.java b/src/test/java/org/apache/commons/crypto/CryptoTest.java
index 54ad0b1..f693626 100644
--- a/src/test/java/org/apache/commons/crypto/CryptoTest.java
+++ b/src/test/java/org/apache/commons/crypto/CryptoTest.java
@@ -22,22 +22,26 @@ import org.junit.Test;
 
 public class CryptoTest {
 
-    @Test
-    // This test may fail unless the code was built by Maven, as
-    // it relies on the VERSION file being set up correctly
-    public void testGetComponentVersion() {
-        final String version = Crypto.getComponentVersion();
-        Assert.assertNotNull("Should not be null",version);
-        Assert.assertTrue(version,version.matches("^\\d+\\.\\d+.*"));
-    }
+	/**
+	 * This test may fail unless the code was built by Maven, as it relies on the
+	 * VERSION file being set up correctly
+	 */
+	@Test
+	public void testGetComponentName() {
+		final String version = Crypto.getComponentName();
+		Assert.assertNotNull("Should not be null", version);
+		Assert.assertTrue(version, version.matches("^Apache Commons Crypto.*"));
+	}
 
-    @Test
-    // This test may fail unless the code was built by Maven, as
-    // it relies on the VERSION file being set up correctly
-    public void testGetComponentName() {
-        final String version = Crypto.getComponentName();
-        Assert.assertNotNull("Should not be null",version);
-        Assert.assertTrue(version,version.matches("^Apache Commons Crypto.*"));
-    }
+	/**
+	 * This test may fail unless the code was built by Maven, as it relies on the
+	 * VERSION file being set up correctly.
+	 */
+	@Test
+	public void testGetComponentVersion() {
+		final String version = Crypto.getComponentVersion();
+		Assert.assertNotNull("Should not be null", version);
+		Assert.assertTrue(version, version.matches("^\\d+\\.\\d+.*"));
+	}
 
 }


[commons-crypto] 02/02: Simpler property loading. More tests.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-crypto.git

commit bd3e9d38d7e200d9d31fdddaa5d0a1f1d275044e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Aug 23 15:06:20 2020 -0400

    Simpler property loading. More tests.
---
 src/main/java/org/apache/commons/crypto/Crypto.java |  4 ++--
 .../java/org/apache/commons/crypto/CryptoTest.java  | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/crypto/Crypto.java b/src/main/java/org/apache/commons/crypto/Crypto.java
index f19ae3e..cbe49ba 100644
--- a/src/main/java/org/apache/commons/crypto/Crypto.java
+++ b/src/main/java/org/apache/commons/crypto/Crypto.java
@@ -67,15 +67,15 @@ public final class Crypto {
 		 */
 		private static Properties getComponentProperties() {
 			final URL url = Crypto.class.getResource("/org/apache/commons/crypto/component.properties");
+			final Properties versionData = new Properties();
 			if (url != null) {
-				final Properties versionData = new Properties();
 				try (InputStream inputStream = url.openStream()) {
 					versionData.load(inputStream);
 					return versionData;
 				} catch (final IOException e) { // NOPMD
 				}
 			}
-			return new Properties(); // make sure field is not null
+			return versionData;
 		}
 	}
 
diff --git a/src/test/java/org/apache/commons/crypto/CryptoTest.java b/src/test/java/org/apache/commons/crypto/CryptoTest.java
index f693626..4956c45 100644
--- a/src/test/java/org/apache/commons/crypto/CryptoTest.java
+++ b/src/test/java/org/apache/commons/crypto/CryptoTest.java
@@ -18,6 +18,7 @@
 package org.apache.commons.crypto;
 
 import org.junit.Assert;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class CryptoTest {
@@ -44,4 +45,24 @@ public class CryptoTest {
 		Assert.assertTrue(version, version.matches("^\\d+\\.\\d+.*"));
 	}
 
+	@Test
+	@Ignore("Mac64 failure with OpenSSL 1.1.1g")
+	public void testMain() throws Throwable {
+		try {
+			Crypto.main(new String[0]);
+		} catch (Throwable e) {
+			Throwable loadingError = Crypto.getLoadingError();
+			System.err.println("Special case; LoadingError = " + loadingError);
+			throw loadingError != null ? loadingError : e;
+		}
+	}
+
+	@Test
+	public void testLoadingError() throws Throwable {
+		Throwable loadingError = Crypto.getLoadingError();
+		if (loadingError != null) {
+			throw loadingError;
+		}
+	}
+
 }