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 2024/05/28 12:10:53 UTC

(commons-net) branch master updated (08218d1c -> daaa5ac3)

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-net.git


    from 08218d1c Add missing tests
     new e70b7311 Deprecate org.apache.commons.net.util.TrustManagerUtils.TrustManagerUtils() for removal
     new daaa5ac3 Add 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:
 src/changes/changes.xml                            |  1 +
 .../apache/commons/net/util/TrustManagerUtils.java | 10 ++++++
 .../commons/net/util/TrustManagerUtilsTest.java    | 38 ++++++++++++++++++++++
 3 files changed, 49 insertions(+)
 create mode 100644 src/test/java/org/apache/commons/net/util/TrustManagerUtilsTest.java


(commons-net) 01/02: Deprecate org.apache.commons.net.util.TrustManagerUtils.TrustManagerUtils() for removal

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-net.git

commit e70b73117ddec1c78ca9641e0396002b17900031
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue May 28 08:06:38 2024 -0400

    Deprecate
    org.apache.commons.net.util.TrustManagerUtils.TrustManagerUtils() for
    removal
---
 src/changes/changes.xml                                |  1 +
 .../org/apache/commons/net/util/TrustManagerUtils.java | 10 ++++++++++
 .../apache/commons/net/util/TrustManagerUtilsTest.java | 18 ++++++++++++++++++
 3 files changed, 29 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 07cc58fe..01793784 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -73,6 +73,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" issue="NET-730" dev="ggregory" due-to="Johannes Thalmair, Gary Gregory">Cannot connect to FTP server with HTTP proxy.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Base 64 Encoding with URL and Filename Safe Alphabet should not chunk per RFC 4648.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate org.apache.commons.net.util.Charsets.Charsets() for removal.</action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate org.apache.commons.net.util.TrustManagerUtils.TrustManagerUtils() for removal.</action>
       <!-- ADD -->
       <action type="add" issue="NET-726" dev="ggregory" due-to="PJ Fanning, Gary Gregory">Add protected getters to FTPSClient #204.</action>
       <action type="add" dev="ggregory" due-to="Gary Gregory">Add SubnetUtils.toString().</action> 
diff --git a/src/main/java/org/apache/commons/net/util/TrustManagerUtils.java b/src/main/java/org/apache/commons/net/util/TrustManagerUtils.java
index 5ef5a827..f755d973 100644
--- a/src/main/java/org/apache/commons/net/util/TrustManagerUtils.java
+++ b/src/main/java/org/apache/commons/net/util/TrustManagerUtils.java
@@ -106,4 +106,14 @@ public final class TrustManagerUtils {
         return CHECK_SERVER_VALIDITY;
     }
 
+    /**
+     * Depreacted.
+     *
+     * @deprecated Will be removed in 2.0.
+     */
+    @Deprecated
+    public TrustManagerUtils() {
+        // empty
+    }
+
 }
diff --git a/src/test/java/org/apache/commons/net/util/TrustManagerUtilsTest.java b/src/test/java/org/apache/commons/net/util/TrustManagerUtilsTest.java
new file mode 100644
index 00000000..c0a85663
--- /dev/null
+++ b/src/test/java/org/apache/commons/net/util/TrustManagerUtilsTest.java
@@ -0,0 +1,18 @@
+package org.apache.commons.net.util;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests {@link TrustManagerUtils}.
+ */
+public class TrustManagerUtilsTest {
+
+    @SuppressWarnings("deprecation")
+    @Test
+    public void testToConstructor() {
+        assertDoesNotThrow(TrustManagerUtils::new);
+    }
+
+}


(commons-net) 02/02: Add 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-net.git

commit daaa5ac312dff42d0432372b431acf81efba5e18
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue May 28 08:10:48 2024 -0400

    Add tests
---
 .../commons/net/util/TrustManagerUtilsTest.java      | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/test/java/org/apache/commons/net/util/TrustManagerUtilsTest.java b/src/test/java/org/apache/commons/net/util/TrustManagerUtilsTest.java
index c0a85663..a2bd3007 100644
--- a/src/test/java/org/apache/commons/net/util/TrustManagerUtilsTest.java
+++ b/src/test/java/org/apache/commons/net/util/TrustManagerUtilsTest.java
@@ -1,6 +1,11 @@
 package org.apache.commons.net.util;
 
 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+import java.security.GeneralSecurityException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
 
 import org.junit.jupiter.api.Test;
 
@@ -9,6 +14,21 @@ import org.junit.jupiter.api.Test;
  */
 public class TrustManagerUtilsTest {
 
+    @Test
+    public void testGetAcceptAllTrustManager() {
+        assertNotNull(TrustManagerUtils.getAcceptAllTrustManager());
+    }
+
+    @Test
+    public void testGetDefaultTrustManager() throws KeyStoreException, GeneralSecurityException {
+        assertNotNull(TrustManagerUtils.getDefaultTrustManager(KeyStore.getInstance(KeyStore.getDefaultType())));
+    }
+
+    @Test
+    public void testGetValidateServerCertificateTrustManager() {
+        assertNotNull(TrustManagerUtils.getValidateServerCertificateTrustManager());
+    }
+
     @SuppressWarnings("deprecation")
     @Test
     public void testToConstructor() {