Example #1
0
 /** Public for testing purpose. Do not use. */
 public synchronized void registerDataSource(final XaDataSource dataSource) {
   dataSources.put(dataSource.getName(), dataSource);
   branchIdMapping.put(UTF8.decode(dataSource.getBranchId()), dataSource);
   sourceIdMapping.put(dataSource.getName(), dataSource.getBranchId());
   life.add(dataSource);
   if (life.getStatus().equals(LifecycleStatus.STARTED)) {
     Listeners.notifyListeners(
         dsRegistrationListeners,
         new Listeners.Notification<DataSourceRegistrationListener>() {
           @Override
           public void notify(DataSourceRegistrationListener listener) {
             listener.registeredDataSource(dataSource);
           }
         });
   }
 }
Example #2
0
 @Test
 public void hasAllXaManagerBeans() {
   for (XaDataSource xaDataSource :
       graphDb.getXaDataSourceManager().getAllRegisteredDataSources()) {
     XaResourceInfo info = getByName(xaDataSource.getName());
     assertEquals(
         "wrong branchid for XA data source " + xaDataSource.getName(),
         XaManagerBean.toHexString(xaDataSource.getBranchId()),
         info.getBranchId());
     assertEquals(
         "wrong log version for XA data source " + xaDataSource.getName(),
         xaDataSource.getCurrentLogVersion(),
         info.getLogVersion());
     assertEquals(
         "wrong last tx ID for XA data source " + xaDataSource.getName(),
         xaDataSource.getLastCommittedTxId(),
         info.getLastTxId());
   }
 }