@Test public void testDoCloseConnection_NotTransactionalContext() throws NamingException { TransactionSynchronizationManager.bindResource(contextSourceMock, holder); DirContext dirContextMock2 = mock(DirContext.class); tested.doCloseConnection(dirContextMock2, contextSourceMock); verify(dirContextMock2).close(); }
void doCloseConnection(DirContext context, ContextSource contextSource) throws javax.naming.NamingException { DirContextHolder transactionContextHolder = (DirContextHolder) TransactionSynchronizationManager .getResource(contextSource); if (transactionContextHolder == null || transactionContextHolder.getCtx() != context) { log.debug("Closing context"); context.close(); } else { log.debug("Leaving transactional context open"); } }
TransactionAwareDirContextInvocationHandler implements
        InvocationHandler { void doCloseConnection(DirContext context, ContextSource contextSource) throws javax.naming.NamingException { DirContextHolder transactionContextHolder = (DirContextHolder) TransactionSynchronizationManager .getResource(contextSource); if (transactionContextHolder == null || transactionContextHolder.getCtx() != context) { log.debug("Closing context"); context.close(); } else { log.debug("Leaving transactional context open"); } } }
TransactionAwareDirContextInvocationHandler implements
        InvocationHandler { void doCloseConnection(DirContext context, ContextSource contextSource) throws javax.naming.NamingException { DirContextHolder transactionContextHolder = (DirContextHolder) TransactionSynchronizationManager .getResource(contextSource); if (transactionContextHolder == null || transactionContextHolder.getCtx() != context) { log.debug("Closing context"); context.close(); } else { log.debug("Leaving transactional context open"); } } TransactionAwareDirContextInvocationHandler(DirContext target,
            ContextSource contextSource); }
TransactionAwareDirContextInvocationHandler implements
        InvocationHandler { void doCloseConnection(DirContext context, ContextSource contextSource) throws javax.naming.NamingException { DirContextHolder transactionContextHolder = (DirContextHolder) TransactionSynchronizationManager .getResource(contextSource); if (transactionContextHolder == null || transactionContextHolder.getCtx() != context) { log.debug("Closing context"); context.close(); } else { log.debug("Leaving transactional context open"); } } TransactionAwareDirContextInvocationHandler(DirContext target,
            ContextSource contextSource); Object invoke(Object proxy, Method method, Object[] args); }
TransactionAwareDirContextInvocationHandler implements
        InvocationHandler { void doCloseConnection(DirContext context, ContextSource contextSource) throws javax.naming.NamingException { DirContextHolder transactionContextHolder = (DirContextHolder) TransactionSynchronizationManager .getResource(contextSource); if (transactionContextHolder == null || transactionContextHolder.getCtx() != context) { log.debug("Closing context"); context.close(); } else { log.debug("Leaving transactional context open"); } } TransactionAwareDirContextInvocationHandler(DirContext target,
            ContextSource contextSource); Object invoke(Object proxy, Method method, Object[] args);  }