@Test void doGetTransaction() { String id = "unique_id"; when(idGenerator.generateId()).thenReturn(id); Object trans = molgenisTransactionManager.doGetTransaction(); assertNotNull(trans); assertTrue(trans instanceof MolgenisTransaction); MolgenisTransaction molgenisTransaction = (MolgenisTransaction) trans; assertEquals(id, molgenisTransaction.getId()); }
@Override protected Object doGetTransaction() { Object dataSourceTransactionManager = super.doGetTransaction(); String id; if (TransactionSynchronizationManager.hasResource( TransactionConstants.TRANSACTION_ID_RESOURCE_NAME)) { id = (String) TransactionSynchronizationManager.getResource( TransactionConstants.TRANSACTION_ID_RESOURCE_NAME); } else { id = idGenerator.generateId().toLowerCase(); } return new MolgenisTransaction(id, dataSourceTransactionManager); }
PostgreSqlTransactionManager extends DataSourceTransactionManager implements TransactionManager { @Override protected Object doGetTransaction() { Object dataSourceTransactionManager = super.doGetTransaction(); String id; if (TransactionSynchronizationManager.hasResource( TransactionConstants.TRANSACTION_ID_RESOURCE_NAME)) { id = (String) TransactionSynchronizationManager.getResource( TransactionConstants.TRANSACTION_ID_RESOURCE_NAME); } else { id = idGenerator.generateId().toLowerCase(); } return new MolgenisTransaction(id, dataSourceTransactionManager); } }
PostgreSqlTransactionManager extends DataSourceTransactionManager implements TransactionManager { @Override protected Object doGetTransaction() { Object dataSourceTransactionManager = super.doGetTransaction(); String id; if (TransactionSynchronizationManager.hasResource( TransactionConstants.TRANSACTION_ID_RESOURCE_NAME)) { id = (String) TransactionSynchronizationManager.getResource( TransactionConstants.TRANSACTION_ID_RESOURCE_NAME); } else { id = idGenerator.generateId().toLowerCase(); } return new MolgenisTransaction(id, dataSourceTransactionManager); } PostgreSqlTransactionManager(
      IdGenerator idGenerator,
      DataSource dataSource,
      TransactionExceptionTranslatorRegistry transactionExceptionTranslatorRegistry); }
PostgreSqlTransactionManager extends DataSourceTransactionManager implements TransactionManager { @Override protected Object doGetTransaction() { Object dataSourceTransactionManager = super.doGetTransaction(); String id; if (TransactionSynchronizationManager.hasResource( TransactionConstants.TRANSACTION_ID_RESOURCE_NAME)) { id = (String) TransactionSynchronizationManager.getResource( TransactionConstants.TRANSACTION_ID_RESOURCE_NAME); } else { id = idGenerator.generateId().toLowerCase(); } return new MolgenisTransaction(id, dataSourceTransactionManager); } PostgreSqlTransactionManager(
      IdGenerator idGenerator,
      DataSource dataSource,
      TransactionExceptionTranslatorRegistry transactionExceptionTranslatorRegistry); @Override synchronized void addTransactionListener(TransactionListener transactionListener); }
PostgreSqlTransactionManager extends DataSourceTransactionManager implements TransactionManager { @Override protected Object doGetTransaction() { Object dataSourceTransactionManager = super.doGetTransaction(); String id; if (TransactionSynchronizationManager.hasResource( TransactionConstants.TRANSACTION_ID_RESOURCE_NAME)) { id = (String) TransactionSynchronizationManager.getResource( TransactionConstants.TRANSACTION_ID_RESOURCE_NAME); } else { id = idGenerator.generateId().toLowerCase(); } return new MolgenisTransaction(id, dataSourceTransactionManager); } PostgreSqlTransactionManager(
      IdGenerator idGenerator,
      DataSource dataSource,
      TransactionExceptionTranslatorRegistry transactionExceptionTranslatorRegistry); @Override synchronized void addTransactionListener(TransactionListener transactionListener);  }