Search in sources :

Example 76 with JdbcTemplate

use of org.springframework.jdbc.core.JdbcTemplate in project camel by apache.

the class TransactionalClientWithRollbackTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    final DataSource ds = getMandatoryBean(DataSource.class, "dataSource");
    jdbc = new JdbcTemplate(ds);
}
Also used : JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate) DataSource(javax.sql.DataSource)

Example 77 with JdbcTemplate

use of org.springframework.jdbc.core.JdbcTemplate in project camel by apache.

the class MixedTransactionPropagationTest method setUp.

@Override
protected void setUp() throws Exception {
    this.disableJMX();
    super.setUp();
    final DataSource ds = getMandatoryBean(DataSource.class, "dataSource");
    jdbc = new JdbcTemplate(ds);
}
Also used : JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate) DataSource(javax.sql.DataSource)

Example 78 with JdbcTemplate

use of org.springframework.jdbc.core.JdbcTemplate in project camel by apache.

the class SpringTransactionalClientDataSourceTransactedTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    // create database and insert dummy data
    final DataSource ds = getMandatoryBean(DataSource.class, "dataSource");
    jdbc = new JdbcTemplate(ds);
}
Also used : JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate) DataSource(javax.sql.DataSource)

Example 79 with JdbcTemplate

use of org.springframework.jdbc.core.JdbcTemplate in project camel by apache.

the class TransactionalClientDataSourceMinimalConfigurationTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    // create database and insert dummy data
    final DataSource ds = getMandatoryBean(DataSource.class, "dataSource");
    jdbc = new JdbcTemplate(ds);
}
Also used : JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate) DataSource(javax.sql.DataSource)

Example 80 with JdbcTemplate

use of org.springframework.jdbc.core.JdbcTemplate in project camel by apache.

the class TemplateCacheTest method shouldCacheTemplateFunctions.

@Test
public void shouldCacheTemplateFunctions() throws InterruptedException {
    JdbcTemplate jdbcTemplate = new JdbcTemplate(db);
    CallableStatementWrapperFactory fac = new CallableStatementWrapperFactory(jdbcTemplate, new TemplateParser());
    BatchCallableStatementCreatorFactory batchFactory1 = fac.getTemplateForBatch("FOO()");
    BatchCallableStatementCreatorFactory batchFactory2 = fac.getTemplateForBatch("FOO()");
    assertSame(batchFactory1, batchFactory2);
    TemplateStoredProcedure templateStoredProcedure1 = fac.getTemplateStoredProcedure("FOO()");
    TemplateStoredProcedure templateStoredProcedure2 = fac.getTemplateStoredProcedure("FOO()");
    assertSame(templateStoredProcedure1, templateStoredProcedure2);
}
Also used : TemplateParser(org.apache.camel.component.sql.stored.template.TemplateParser) JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate) Test(org.junit.Test)

Aggregations

JdbcTemplate (org.springframework.jdbc.core.JdbcTemplate)124 Test (org.junit.Test)46 DataSource (javax.sql.DataSource)37 Before (org.junit.Before)19 SQLException (java.sql.SQLException)11 EmbeddedDatabaseBuilder (org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder)11 BaseDbTest (com.alibaba.otter.node.etl.BaseDbTest)6 DbDialect (com.alibaba.otter.node.etl.common.db.dialect.DbDialect)6 DbMediaSource (com.alibaba.otter.shared.common.model.config.data.db.DbMediaSource)6 Connection (java.sql.Connection)6 JdbcOperations (org.springframework.jdbc.core.JdbcOperations)6 TransactionStatus (org.springframework.transaction.TransactionStatus)6 Test (org.testng.annotations.Test)6 SqlTemplate (com.alibaba.otter.node.etl.common.db.dialect.SqlTemplate)5 PreparedStatement (java.sql.PreparedStatement)5 Table (org.apache.ddlutils.model.Table)5 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)5 DataAccessException (org.springframework.dao.DataAccessException)5 AbstractDriverBasedDataSource (org.springframework.jdbc.datasource.AbstractDriverBasedDataSource)5 TransactionCallback (org.springframework.transaction.support.TransactionCallback)5