Search in sources :

Example 1 with JdbcMetadataStore

use of org.springframework.integration.jdbc.metadata.JdbcMetadataStore in project spring-integration by spring-projects.

the class PersistentAcceptOnceFileListFilterExternalStoreTests method testFileSystemWithJdbcMetadataStore.

@Test
public void testFileSystemWithJdbcMetadataStore() throws Exception {
    EmbeddedDatabase dataSource = new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).addScript("classpath:/org/springframework/integration/jdbc/schema-drop-h2.sql").addScript("classpath:/org/springframework/integration/jdbc/schema-h2.sql").build();
    JdbcMetadataStore metadataStore = new JdbcMetadataStore(dataSource);
    metadataStore.afterPropertiesSet();
    try {
        testFileSystem(metadataStore);
        List<Map<String, Object>> metaData = new JdbcTemplate(dataSource).queryForList("SELECT * FROM INT_METADATA_STORE");
        assertEquals(1, metaData.size());
        assertEquals("43", metaData.get(0).get("METADATA_VALUE"));
    } finally {
        dataSource.shutdown();
    }
}
Also used : EmbeddedDatabaseBuilder(org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder) JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate) EmbeddedDatabase(org.springframework.jdbc.datasource.embedded.EmbeddedDatabase) JdbcMetadataStore(org.springframework.integration.jdbc.metadata.JdbcMetadataStore) Map(java.util.Map) Test(org.junit.Test)

Aggregations

Map (java.util.Map)1 Test (org.junit.Test)1 JdbcMetadataStore (org.springframework.integration.jdbc.metadata.JdbcMetadataStore)1 JdbcTemplate (org.springframework.jdbc.core.JdbcTemplate)1 EmbeddedDatabase (org.springframework.jdbc.datasource.embedded.EmbeddedDatabase)1 EmbeddedDatabaseBuilder (org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder)1