RangerPluginActivityLogger { public void commitAfterTransactionComplete(Runnable commitWork) { if (pluginActivityAuditCommitInline) { if (LOG.isDebugEnabled()) { LOG.debug("Using TransactionManager for committing work [pluginActivityAuditCommitInline:" + pluginActivityAuditCommitInline + "]"); } transactionSynchronizationAdapter.executeOnTransactionCompletion(commitWork); } else { if (LOG.isDebugEnabled()) { LOG.debug("Using separate thread for committing work [pluginActivityAuditCommitInline:" + pluginActivityAuditCommitInline + "]"); } final long delayInMillis = 1000L; transactionService.scheduleToExecuteInOwnTransaction(commitWork, delayInMillis); } }  @PostConstruct void init(); void commitAfterTransactionComplete(Runnable commitWork);  }
@Test public void test1CommitAfterTransactionComplete() { pluginActivityAuditCommitInline = false; rangerPluginActivityLogger.commitAfterTransactionComplete(commitWork); }
@Test public void test3CommitAfterTransactionComplete() { pluginActivityAuditCommitInline = true; rangerPluginActivityLogger.commitAfterTransactionComplete(commitWork); }