### Question:
DataSourceManagementBootstrap { @PostConstruct public void init() { initializeConfigParams(); initializeDefChangeHandler(); driverInitializer.initializeDefaultDrivers(); scheduler.schedule(getInitializeDeploymentsTask(), deploymentsInitializationDelay, TimeUnit.MILLISECONDS); } DataSourceManagementBootstrap(); @Inject  DataSourceManagementBootstrap(DataSourceRuntimeManager dataSourceRuntimeManager,
                                         DataSourceDefDeployer dataSourceDefDeployer,
                                         DriverDefDeployer driverDefDeployer,
                                         DefaultDriverInitializer driverInitializer,
                                         DefResourceChangeObserver defResourceChangeObserver,
                                         BeanManager beanManager); @PostConstruct void init(); @PreDestroy void destroy(); static final String DEPLOYMENTS_INITIALIZATION_RETRIES; static final String DEPLOYMENTS_INITIALIZATION_DELAY; static final String DEF_CHANGE_HANDLER_BEAN; }### Answer:
@Test public void testInitializeDefaultDrivers() { dataSourceManagementBootstrap.init(); verify(driverInitializer, times(1)).initializeDefaultDrivers(); }
@Test public void testInitializeDeploymentsOKWithNoRetries() throws Exception { prepareExecutor(); dataSourceManagementBootstrap.init(); verify(scheduler, times(1)).schedule(any(Runnable.class), eq(DELAY), eq(TimeUnit.MILLISECONDS)); verify(dataSourceRuntimeManager, times(1)).hasStarted(); verify(driverDefDeployer, times(1)).deployGlobalDefs(); verify(dataSourceDefDeployer, times(1)).deployGlobalDefs(); verify(scheduler, times(1)).shutdown(); }
@Test public void testInitializeDeploymentsOKWithRetries() throws Exception { prepareExecutor(); dataSourceRuntimeMangerHasStartedFailures = 4; dataSourceManagementBootstrap.init(); verify(scheduler, times(1 + (int) dataSourceRuntimeMangerHasStartedFailures)) .schedule(any(Runnable.class), eq(DELAY), eq(TimeUnit.MILLISECONDS)); verify(dataSourceRuntimeManager, times(1 + (int) dataSourceRuntimeMangerHasStartedFailures)).hasStarted(); verify(driverDefDeployer, times(1)).deployGlobalDefs(); verify(dataSourceDefDeployer, times(1)).deployGlobalDefs(); verify(scheduler, times(1)).shutdown(); }
@Test public void testInitializeDeploymentsExceededTheRetries() throws Exception { prepareExecutor(); dataSourceRuntimeMangerHasStartedFailures = RETRIES; dataSourceManagementBootstrap.init(); verify(scheduler, times((int) RETRIES)) .schedule(any(Runnable.class), eq(DELAY), eq(TimeUnit.MILLISECONDS)); verify(dataSourceRuntimeManager, times((int) RETRIES)).hasStarted(); verify(driverDefDeployer, never()).deployGlobalDefs(); verify(dataSourceDefDeployer, never()).deployGlobalDefs(); verify(scheduler, times(1)).shutdown(); }