Class PreparedDbProvider
- java.lang.Object
-
- com.opentable.db.postgres.embedded.PreparedDbProvider
-
public class PreparedDbProvider extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPreparedDbProvider.DbInfo
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcreateDatabase()Create a new database, and return it as a JDBC connection string.DataSourcecreateDataSource()Create a new database, and return it as a DataSource.DataSourcecreateDataSourceFromConnectionInfo(ConnectionInfo connectionInfo)Create a new Datasource given DBInfo.ConnectionInfocreateNewDatabase()static PreparedDbProviderforPreparer(DatabasePreparer preparer)static PreparedDbProviderforPreparer(DatabasePreparer preparer, Iterable<Consumer<EmbeddedPostgres.Builder>> customizers)Map<String,String>getConfigurationTweak(String dbModuleName)Return configuration tweaks in a format appropriate for otj-jdbc DatabaseModule.
-
-
-
Method Detail
-
forPreparer
public static PreparedDbProvider forPreparer(DatabasePreparer preparer)
-
forPreparer
public static PreparedDbProvider forPreparer(DatabasePreparer preparer, Iterable<Consumer<EmbeddedPostgres.Builder>> customizers)
-
createDatabase
public String createDatabase() throws SQLException
Create a new database, and return it as a JDBC connection string. NB: No two invocations will return the same database.- Returns:
- JDBC connection string.
- Throws:
SQLException- SQLException if any
-
createNewDatabase
public ConnectionInfo createNewDatabase() throws SQLException
- Throws:
SQLException
-
createDataSourceFromConnectionInfo
public DataSource createDataSourceFromConnectionInfo(ConnectionInfo connectionInfo)
Create a new Datasource given DBInfo. More common usage is to call createDatasource().- Parameters:
connectionInfo- connection information- Returns:
- Datasource
-
createDataSource
public DataSource createDataSource() throws SQLException
Create a new database, and return it as a DataSource. No two invocations will return the same database.- Returns:
- Datasource the datasource
- Throws:
SQLException- SQLException if any
-
getConfigurationTweak
public Map<String,String> getConfigurationTweak(String dbModuleName) throws SQLException
Return configuration tweaks in a format appropriate for otj-jdbc DatabaseModule.- Parameters:
dbModuleName- Name of the module- Returns:
- Configuration properties
- Throws:
SQLException- SQLException if any
-
-