Search in sources :

Example 1 with TestLDAPConnectionPoolHealthCheck

use of com.unboundid.ldap.sdk.TestLDAPConnectionPoolHealthCheck in project ldapsdk by pingidentity.

the class LDAPCommandLineToolTestCase method testGetConnectionPoolExtendedOptions.

/**
 * Provides test coverage for the method used to get a connection pool with an
 * extended set of options.
 * <BR><BR>
 * Access to an SSL-enabled Directory Server instance is required for complete
 * processing.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testGetConnectionPoolExtendedOptions() throws Exception {
    if (!isSSLEnabledDirectoryInstanceAvailable()) {
        return;
    }
    LDAPSearch ldapSearch = new LDAPSearch(null, null);
    ResultCode rc = ldapSearch.runTool("-h", getTestHost(), "-p", String.valueOf(getTestPort()), "-q", "-X", "-D", getTestBindDN(), "-w", getTestBindPassword(), "-b", "", "-s", "base", "(objectClass=*)");
    assertEquals(rc, ResultCode.SUCCESS);
    LDAPConnectionPool pool = ldapSearch.getConnectionPool(1, 5, 1, new TestPostConnectProcessor(null, null), new TestPostConnectProcessor(null, null), false, new TestLDAPConnectionPoolHealthCheck());
    assertNotNull(pool);
    assertNotNull(pool.getRootDSE());
    LDAPConnection conn = pool.getConnection();
    assertNotNull(conn);
    assertNotNull(conn.getRootDSE());
    LDAPConnection conn2 = pool.getConnection();
    assertNotNull(conn2);
    assertNotNull(conn2.getRootDSE());
    pool.releaseConnection(conn);
    pool.releaseConnection(conn2);
    pool.close();
    assertTrue(ldapSearch.anyLDAPArgumentsProvided());
}
Also used : LDAPConnectionPool(com.unboundid.ldap.sdk.LDAPConnectionPool) LDAPSearch(com.unboundid.ldap.sdk.examples.LDAPSearch) LDAPConnection(com.unboundid.ldap.sdk.LDAPConnection) ResultCode(com.unboundid.ldap.sdk.ResultCode) TestPostConnectProcessor(com.unboundid.ldap.sdk.TestPostConnectProcessor) TestLDAPConnectionPoolHealthCheck(com.unboundid.ldap.sdk.TestLDAPConnectionPoolHealthCheck) Test(org.testng.annotations.Test)

Aggregations

LDAPConnection (com.unboundid.ldap.sdk.LDAPConnection)1 LDAPConnectionPool (com.unboundid.ldap.sdk.LDAPConnectionPool)1 ResultCode (com.unboundid.ldap.sdk.ResultCode)1 TestLDAPConnectionPoolHealthCheck (com.unboundid.ldap.sdk.TestLDAPConnectionPoolHealthCheck)1 TestPostConnectProcessor (com.unboundid.ldap.sdk.TestPostConnectProcessor)1 LDAPSearch (com.unboundid.ldap.sdk.examples.LDAPSearch)1 Test (org.testng.annotations.Test)1