[ldap-sdk-commits] SF.net SVN: ldap-sdk:[1585] trunk
A Java-based LDAP API
Brought to you by:
dirmgr,
kennethleo
From: <di...@us...> - 2023-01-10 23:46:04
|
Revision: 1585 http://sourceforge.net/p/ldap-sdk/code/1585 Author: dirmgr Date: 2023-01-10 23:46:02 +0000 (Tue, 10 Jan 2023) Log Message: ----------- Add getServerSet methods to connection pools Updated the LDAPConnectionPool and LDAPThreadLocalConnectionPool classes to add getServerSet methods that can be used to retrieve the server set used to establish new connections for the pool. Modified Paths: -------------- trunk/docs/release-notes.html trunk/src/com/unboundid/ldap/sdk/LDAPConnectionPool.java trunk/src/com/unboundid/ldap/sdk/LDAPThreadLocalConnectionPool.java trunk/tests/unit/src/com/unboundid/ldap/sdk/UpdateConnectionPoolBindRequestAndServerSetTestCase.java Modified: trunk/docs/release-notes.html =================================================================== --- trunk/docs/release-notes.html 2023-01-06 23:50:29 UTC (rev 1584) +++ trunk/docs/release-notes.html 2023-01-10 23:46:02 UTC (rev 1585) @@ -21,6 +21,13 @@ </li> <li> + Updated the LDAPConnectionPool and LDAPThreadLocalConnectionPool classes to add + getServerSet methods that can be used to retrieve the server set used to + establish new connections for the pool. + <br><br> + </li> + + <li> Added support for encrypted PKCS #8 private keys. Private keys can now be formatted in encrypted PEM when provided with an encryption password and a set of encryption properties, and the PKCS #8 PEM file reader can read encrypted Modified: trunk/src/com/unboundid/ldap/sdk/LDAPConnectionPool.java =================================================================== --- trunk/src/com/unboundid/ldap/sdk/LDAPConnectionPool.java 2023-01-06 23:50:29 UTC (rev 1584) +++ trunk/src/com/unboundid/ldap/sdk/LDAPConnectionPool.java 2023-01-10 23:46:02 UTC (rev 1585) @@ -2481,6 +2481,21 @@ /** + * Retrieves the server set that should be used to establish new connections + * for use in this connection pool. + * + * @return The server set that should be used to establish new connections + * for use in this connection pool. + */ + @NotNull() + public ServerSet getServerSet() + { + return serverSet; + } + + + + /** * Specifies the server set that should be used to establish new connections * for use in this connection pool. Existing connections will not be * affected. Modified: trunk/src/com/unboundid/ldap/sdk/LDAPThreadLocalConnectionPool.java =================================================================== --- trunk/src/com/unboundid/ldap/sdk/LDAPThreadLocalConnectionPool.java 2023-01-06 23:50:29 UTC (rev 1584) +++ trunk/src/com/unboundid/ldap/sdk/LDAPThreadLocalConnectionPool.java 2023-01-10 23:46:02 UTC (rev 1585) @@ -1292,6 +1292,21 @@ /** + * Retrieves the server set that should be used to establish new connections + * for use in this connection pool. + * + * @return The server set that should be used to establish new connections + * for use in this connection pool. + */ + @NotNull() + public ServerSet getServerSet() + { + return serverSet; + } + + + + /** * Specifies the server set that should be used to establish new connections * for use in this connection pool. Existing connections will not be * affected. Modified: trunk/tests/unit/src/com/unboundid/ldap/sdk/UpdateConnectionPoolBindRequestAndServerSetTestCase.java =================================================================== --- trunk/tests/unit/src/com/unboundid/ldap/sdk/UpdateConnectionPoolBindRequestAndServerSetTestCase.java 2023-01-06 23:50:29 UTC (rev 1584) +++ trunk/tests/unit/src/com/unboundid/ldap/sdk/UpdateConnectionPoolBindRequestAndServerSetTestCase.java 2023-01-10 23:46:02 UTC (rev 1585) @@ -438,9 +438,10 @@ ds3.startListening(); + final ServerSet serverSet1 = + new SingleServerSet("127.0.0.1", ds1.getListenPort()); try (LDAPConnectionPool pool = - new LDAPConnectionPool( - new SingleServerSet("127.0.0.1", ds1.getListenPort()), + new LDAPConnectionPool(serverSet1, new SimpleBindRequest("cn=Directory Manager", "password"), 1, 1)) { @@ -451,9 +452,16 @@ // Update the server so that new connections will be established to ds2. - pool.setServerSet(new SingleServerSet("127.0.0.1", ds2.getListenPort())); + assertNotNull(pool.getServerSet()); + assertSame(pool.getServerSet(), serverSet1); + final ServerSet serverSet2 = + new SingleServerSet("127.0.0.1", ds2.getListenPort()); + pool.setServerSet(serverSet2); + assertNotNull(pool.getServerSet()); + assertSame(pool.getServerSet(), serverSet2); + // Make sure that the existing connection is still connected to ds1. conn = pool.getConnection(); assertEquals(conn.getConnectedPort(), ds1.getListenPort()); @@ -475,6 +483,8 @@ catch (final LDAPSDKUsageException e) { // This was expected. + assertNotNull(pool.getServerSet()); + assertSame(pool.getServerSet(), serverSet2); } @@ -486,7 +496,11 @@ // Set the server set so that new connections will be established to ds3. - pool.setServerSet(new SingleServerSet("127.0.0.1", ds3.getListenPort())); + final ServerSet serverSet3 = + new SingleServerSet("127.0.0.1", ds3.getListenPort()); + pool.setServerSet(serverSet3); + assertNotNull(pool.getServerSet()); + assertSame(pool.getServerSet(), serverSet3); // Make sure that new connections are established to ds3. @@ -547,9 +561,15 @@ // Update the server so that new connections will be established to ds2. - pool.setServerSet(new SingleServerSet("127.0.0.1", ds2.getListenPort())); + assertNotNull(pool.getServerSet()); + final ServerSet serverSet2 = + new SingleServerSet("127.0.0.1", ds2.getListenPort()); + pool.setServerSet(serverSet2); + assertNotNull(pool.getServerSet()); + assertSame(pool.getServerSet(), serverSet2); + // Make sure that the existing connection is still connected to ds1. conn = pool.getConnection(); assertEquals(conn.getConnectedPort(), ds1.getListenPort()); @@ -571,6 +591,8 @@ catch (final LDAPSDKUsageException e) { // This was expected. + assertNotNull(pool.getServerSet()); + assertSame(pool.getServerSet(), serverSet2); } @@ -582,7 +604,11 @@ // Set the server set so that new connections will be established to ds3. - pool.setServerSet(new SingleServerSet("127.0.0.1", ds3.getListenPort())); + final ServerSet serverSet3 = + new SingleServerSet("127.0.0.1", ds3.getListenPort()); + pool.setServerSet(serverSet3); + assertNotNull(pool.getServerSet()); + assertSame(pool.getServerSet(), serverSet3); // Make sure that new connections are established to ds3. @@ -630,9 +656,10 @@ ds3.startListening(); + final ServerSet serverSet1 = + new SingleServerSet("127.0.0.1", ds1.getListenPort()); try (LDAPThreadLocalConnectionPool pool = - new LDAPThreadLocalConnectionPool( - new SingleServerSet("127.0.0.1", ds1.getListenPort()), + new LDAPThreadLocalConnectionPool(serverSet1, new SimpleBindRequest("cn=Directory Manager", "password"))) { // Make sure that the connection is initially established to ds1. @@ -642,9 +669,16 @@ // Update the server so that new connections will be established to ds2. - pool.setServerSet(new SingleServerSet("127.0.0.1", ds2.getListenPort())); + assertNotNull(pool.getServerSet()); + assertSame(pool.getServerSet(), serverSet1); + final ServerSet serverSet2 = + new SingleServerSet("127.0.0.1", ds2.getListenPort()); + pool.setServerSet(serverSet2); + assertNotNull(pool.getServerSet()); + assertSame(pool.getServerSet(), serverSet2); + // Make sure that the existing connection is still connected to ds1. conn = pool.getConnection(); assertEquals(conn.getConnectedPort(), ds1.getListenPort()); @@ -666,6 +700,8 @@ catch (final LDAPSDKUsageException e) { // This was expected. + assertNotNull(pool.getServerSet()); + assertSame(pool.getServerSet(), serverSet2); } @@ -677,7 +713,11 @@ // Set the server set so that new connections will be established to ds3. - pool.setServerSet(new SingleServerSet("127.0.0.1", ds3.getListenPort())); + final ServerSet serverSet3 = + new SingleServerSet("127.0.0.1", ds3.getListenPort()); + pool.setServerSet(serverSet3); + assertNotNull(pool.getServerSet()); + assertSame(pool.getServerSet(), serverSet3); // Make sure that new connections are established to ds3. @@ -739,9 +779,15 @@ // Update the server so that new connections will be established to ds2. - pool.setServerSet(new SingleServerSet("127.0.0.1", ds2.getListenPort())); + assertNotNull(pool.getServerSet()); + final ServerSet serverSet2 = + new SingleServerSet("127.0.0.1", ds2.getListenPort()); + pool.setServerSet(serverSet2); + assertNotNull(pool.getServerSet()); + assertSame(pool.getServerSet(), serverSet2); + // Make sure that the existing connection is still connected to ds1. conn = pool.getConnection(); assertEquals(conn.getConnectedPort(), ds1.getListenPort()); @@ -763,6 +809,8 @@ catch (final LDAPSDKUsageException e) { // This was expected. + assertNotNull(pool.getServerSet()); + assertSame(pool.getServerSet(), serverSet2); } @@ -774,7 +822,11 @@ // Set the server set so that new connections will be established to ds3. - pool.setServerSet(new SingleServerSet("127.0.0.1", ds3.getListenPort())); + final ServerSet serverSet3 = + new SingleServerSet("127.0.0.1", ds3.getListenPort()); + pool.setServerSet(serverSet3); + assertNotNull(pool.getServerSet()); + assertSame(pool.getServerSet(), serverSet3); // Make sure that new connections are established to ds3. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |