Search in sources :

Example 1 with BasicDataSource

use of org.apache.commons.dbcp.BasicDataSource in project sharding-jdbc by dangdangdotcom.

the class AbstractSpringDBUnitTest method createDataSource.

private DataSource createDataSource(final String dataSetFile) {
    BasicDataSource result = new BasicDataSource();
    result.setDriverClassName(org.h2.Driver.class.getName());
    result.setUrl(String.format("jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL", getFileName(dataSetFile)));
    result.setUsername("sa");
    result.setPassword("");
    result.setMaxActive(100);
    return result;
}
Also used : BasicDataSource(org.apache.commons.dbcp.BasicDataSource)

Example 2 with BasicDataSource

use of org.apache.commons.dbcp.BasicDataSource in project sharding-jdbc by dangdangdotcom.

the class AbstractYamlShardingDataSourceTest method createDataSource.

protected static DataSource createDataSource(final String dsName) {
    BasicDataSource result = new BasicDataSource();
    result.setDriverClassName(org.h2.Driver.class.getName());
    result.setUrl(String.format("jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL", dsName));
    result.setUsername("sa");
    result.setPassword("");
    result.setMaxActive(100);
    return result;
}
Also used : BasicDataSource(org.apache.commons.dbcp.BasicDataSource)

Example 3 with BasicDataSource

use of org.apache.commons.dbcp.BasicDataSource in project elastic-job by dangdangdotcom.

the class JobEventRdbStorageTest method setup.

@Before
public void setup() throws SQLException {
    BasicDataSource dataSource = new BasicDataSource();
    dataSource.setDriverClassName(org.h2.Driver.class.getName());
    dataSource.setUrl("jdbc:h2:mem:job_event_storage");
    dataSource.setUsername("sa");
    dataSource.setPassword("");
    storage = new JobEventRdbStorage(dataSource);
}
Also used : BasicDataSource(org.apache.commons.dbcp.BasicDataSource) Before(org.junit.Before)

Example 4 with BasicDataSource

use of org.apache.commons.dbcp.BasicDataSource in project elastic-job by dangdangdotcom.

the class JobEventRdbListenerTest method setUp.

@Before
public void setUp() throws JobEventListenerConfigurationException, SQLException, NoSuchFieldException {
    BasicDataSource dataSource = new BasicDataSource();
    dataSource.setDriverClassName(org.h2.Driver.class.getName());
    dataSource.setUrl("jdbc:h2:mem:job_event_storage");
    dataSource.setUsername("sa");
    dataSource.setPassword("");
    JobEventRdbListener jobEventRdbListener = new JobEventRdbListener(dataSource);
    ReflectionUtils.setFieldValue(jobEventRdbListener, "repository", repository);
    when(jobEventRdbConfiguration.createJobEventListener()).thenReturn(jobEventRdbListener);
    jobEventBus = new JobEventBus(jobEventRdbConfiguration);
}
Also used : JobEventBus(com.dangdang.ddframe.job.event.JobEventBus) BasicDataSource(org.apache.commons.dbcp.BasicDataSource) Before(org.junit.Before)

Example 5 with BasicDataSource

use of org.apache.commons.dbcp.BasicDataSource in project sharding-jdbc by dangdangdotcom.

the class Main method createDataSource.

private static DataSource createDataSource(final String dataSourceName) {
    BasicDataSource result = new BasicDataSource();
    result.setDriverClassName(com.mysql.jdbc.Driver.class.getName());
    result.setUrl(String.format("jdbc:mysql://localhost:3306/%s", dataSourceName));
    result.setUsername("root");
    result.setPassword("");
    return result;
}
Also used : BasicDataSource(org.apache.commons.dbcp.BasicDataSource)

Aggregations

BasicDataSource (org.apache.commons.dbcp.BasicDataSource)141 Connection (java.sql.Connection)25 Test (org.junit.Test)13 SQLException (java.sql.SQLException)12 Properties (java.util.Properties)12 DataSource (javax.sql.DataSource)10 Platform (org.apache.ddlutils.Platform)8 Database (org.apache.ddlutils.model.Database)8 DdlGenerator (siena.jdbc.ddl.DdlGenerator)8 Statement (java.sql.Statement)7 Bean (org.springframework.context.annotation.Bean)6 ResultSet (java.sql.ResultSet)5 Before (org.junit.Before)5 JdbcPersistenceManager (siena.jdbc.JdbcPersistenceManager)5 Config (com.typesafe.config.Config)4 File (java.io.File)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 Test (org.testng.annotations.Test)3 PostgresqlPersistenceManager (siena.jdbc.PostgresqlPersistenceManager)3