use of org.apache.commons.dbcp.BasicDataSource in project OpenClinica by OpenClinica.
the class OcDbTestCase method getDataSource.
@Override
public DataSource getDataSource() {
BasicDataSource ds = new BasicDataSource();
ds.setAccessToUnderlyingConnectionAllowed(true);
ds.setDriverClassName(dbDriverClassName);
ds.setUsername(dbUserName);
ds.setPassword(dbPassword);
ds.setUrl(dbUrl);
return ds;
}
use of org.apache.commons.dbcp.BasicDataSource in project OpenClinica by OpenClinica.
the class HibernateOcDbTestCase method getDataSource.
@Override
public DataSource getDataSource() {
ds = new BasicDataSource();
ds.setAccessToUnderlyingConnectionAllowed(true);
ds.setDriverClassName(dbDriverClassName);
ds.setUsername(dbUserName);
ds.setPassword(dbPassword);
ds.setUrl(dbUrl);
return ds;
}
use of org.apache.commons.dbcp.BasicDataSource in project elastic-job by dangdangdotcom.
the class BootstrapEnvironment method getJobEventRdbConfiguration.
/**
* 获取作业数据库事件配置.
*
* @return 作业数据库事件配置
*/
public Optional<JobEventRdbConfiguration> getJobEventRdbConfiguration() {
String driver = getValue(EnvironmentArgument.EVENT_TRACE_RDB_DRIVER);
String url = getValue(EnvironmentArgument.EVENT_TRACE_RDB_URL);
String username = getValue(EnvironmentArgument.EVENT_TRACE_RDB_USERNAME);
String password = getValue(EnvironmentArgument.EVENT_TRACE_RDB_PASSWORD);
if (!Strings.isNullOrEmpty(driver) && !Strings.isNullOrEmpty(url) && !Strings.isNullOrEmpty(username)) {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(driver);
dataSource.setUrl(url);
dataSource.setUsername(username);
dataSource.setPassword(password);
return Optional.of(new JobEventRdbConfiguration(dataSource));
}
return Optional.absent();
}
use of org.apache.commons.dbcp.BasicDataSource in project elastic-job by dangdangdotcom.
the class TaskExecutor method registered.
@Override
public void registered(final ExecutorDriver executorDriver, final Protos.ExecutorInfo executorInfo, final Protos.FrameworkInfo frameworkInfo, final Protos.SlaveInfo slaveInfo) {
if (!executorInfo.getData().isEmpty()) {
Map<String, String> data = SerializationUtils.deserialize(executorInfo.getData().toByteArray());
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(data.get("event_trace_rdb_driver"));
dataSource.setUrl(data.get("event_trace_rdb_url"));
dataSource.setPassword(data.get("event_trace_rdb_password"));
dataSource.setUsername(data.get("event_trace_rdb_username"));
jobEventBus = new JobEventBus(new JobEventRdbConfiguration(dataSource));
}
}
use of org.apache.commons.dbcp.BasicDataSource in project elastic-job by dangdangdotcom.
the class JobEventRdbConfigurationTest method assertGetDataSource.
@Test
public void assertGetDataSource() throws JobEventListenerConfigurationException {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(org.h2.Driver.class.getName());
dataSource.setUrl("jdbc:h2:mem:job_event_storage");
dataSource.setUsername("sa");
dataSource.setPassword("");
assertThat((BasicDataSource) (new JobEventRdbConfiguration(dataSource).getDataSource()), is(dataSource));
}
Aggregations