public class JdbcSink extends AbstractModuleFixture<JdbcSink> implements Disposable
jdbc
sink module. Maintains an in memory relational database and exposes a
JdbcTemplate
so that assertions can be made against it.label
Constructor and Description |
---|
JdbcSink(javax.sql.DataSource dataSource)
Initializes a JdbcSink with the
DataSource . |
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
If using a in memory database this method will shutdown the database.
|
JdbcSink |
columns(java.lang.String columns)
allows a user to set the columns (comma delimited list) that the sink will write its results to.
|
void |
dropTable(java.lang.String tableName) |
org.springframework.jdbc.core.JdbcTemplate |
getJdbcTemplate() |
JdbcSink |
initializeDB(boolean initializeDB) |
boolean |
isInitializeDB() |
boolean |
isReady()
Determines if a connection to the designated database can be made.
|
JdbcSink |
tableName(java.lang.String tableName)
Sets the table that the sink will write to.
|
protected java.lang.String |
toDSL()
Renders the DSL for this fixture.
|
label, toString
public JdbcSink(javax.sql.DataSource dataSource)
DataSource
. Using this DataSource a JDBCTemplate is created.dataSource
- public org.springframework.jdbc.core.JdbcTemplate getJdbcTemplate()
protected java.lang.String toDSL()
toDSL
in class AbstractModuleFixture<JdbcSink>
public void cleanup()
cleanup
in interface Disposable
public void dropTable(java.lang.String tableName)
public JdbcSink tableName(java.lang.String tableName)
tableName
- the name of the table.public JdbcSink columns(java.lang.String columns)
columns
- a comma delimited list of column names.public boolean isReady()
public boolean isInitializeDB()
public JdbcSink initializeDB(boolean initializeDB)