Search in sources :

Example 1 with TemplateParser

use of org.apache.camel.component.sql.stored.template.TemplateParser 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)

Example 2 with TemplateParser

use of org.apache.camel.component.sql.stored.template.TemplateParser in project camel by apache.

the class CallableStatementWrapperTest method setUp.

@Before
public void setUp() throws Exception {
    db = new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.DERBY).addScript("sql/storedProcedureTest.sql").build();
    jdbcTemplate = new JdbcTemplate(db);
    templateParser = new TemplateParser();
    this.factory = new CallableStatementWrapperFactory(jdbcTemplate, templateParser);
    super.setUp();
}
Also used : EmbeddedDatabaseBuilder(org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder) TemplateParser(org.apache.camel.component.sql.stored.template.TemplateParser) JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate) Before(org.junit.Before)

Aggregations

TemplateParser (org.apache.camel.component.sql.stored.template.TemplateParser)2 JdbcTemplate (org.springframework.jdbc.core.JdbcTemplate)2 Before (org.junit.Before)1 Test (org.junit.Test)1 EmbeddedDatabaseBuilder (org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder)1