mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Matthew Swift
20.46.2013 409dccd8ab1c190568228262d1ff0f4ac18fb9d8
Unit test for OPENDJ-1121: Closing a connection after closing the connectionfactory causes NPE
1 files modified
16 ■■■■■ changed files
opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ConnectionFactoryTestCase.java 16 ●●●●● patch | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/test/java/org/forgerock/opendj/ldap/ConnectionFactoryTestCase.java
@@ -28,6 +28,7 @@
package org.forgerock.opendj.ldap;
import static org.fest.assertions.Assertions.assertThat;
import static org.forgerock.opendj.ldap.Connections.newFixedConnectionPool;
import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
import static org.forgerock.opendj.ldap.TestCaseUtils.findFreeSocketAddress;
import static org.forgerock.opendj.ldap.TestCaseUtils.getServerSocketAddress;
@@ -650,6 +651,21 @@
        }
    }
    @Test(description = "Test for OPENDJ-1121", enabled = false)
    public void testFactoryCloseBeforeConnectionClose() throws Exception {
        final ConnectionFactory factory =
                newFixedConnectionPool(new LDAPConnectionFactory(getServerSocketAddress()), 2);
        Connection conn = null;
        try {
            conn = factory.getConnection();
            factory.close();
        } finally {
            if (conn != null) {
                conn.close();
            }
        }
    }
    private void waitForCondition(Callable<Boolean> condition) throws Exception {
        long timeout = System.currentTimeMillis() + TEST_TIMEOUT_MS;
        while (!condition.call()) {