Search in sources :

Example 76 with BasicDataSource

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

the class JobEventRdbConfigurationTest method assertCreateJobEventListenerSuccess.

@Test
public void assertCreateJobEventListenerSuccess() 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(new JobEventRdbConfiguration(dataSource).createJobEventListener(), instanceOf(JobEventRdbListener.class));
}
Also used : BasicDataSource(org.apache.commons.dbcp.BasicDataSource) Test(org.junit.Test)

Example 77 with BasicDataSource

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

the class JobEventRdbSearchTest method setUpClass.

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

Example 78 with BasicDataSource

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

the class StatisticRdbRepositoryTest method setup.

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

Example 79 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)

Example 80 with BasicDataSource

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

the class AbstractSoftTransactionIntegrationTest method createDataSource.

private DataSource createDataSource(final String dataSourceName) {
    BasicDataSource result = new BasicDataSource();
    result.setDriverClassName(org.h2.Driver.class.getName());
    result.setUrl("jdbc:h2:mem:" + dataSourceName);
    result.setUsername("sa");
    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