Package org.assertj.db.type
Class AssertDbConnectionFactory
java.lang.Object
org.assertj.db.type.AssertDbConnectionFactory
Factory to create a
AssertDbConnection from different database connection input ( Jdbc URL or DataSource ).
Allow to configure behavior of connection provider like letter case or schema metadata retrieval mode.
For create with JDBC URL :
AssertDbConnection connection = AssertDbConnectionFactory.of("jdbc:h2:mem:test", "sa", "").create();
Table table = connection.table("movie").build();
For create with JDBC URL :
DataSource dataSource = ...;
AssertDbConnection connection = AssertDbConnectionFactory.of(dataSource).create();
Table table = connection.table("song").columnToCheck(new String[] { "number", "title" }).build();
- Since:
- 3.0.0
- Author:
- Julien Roy
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDataSource variant of ConnectionProviderFactorystatic classJdbc url variant of ConnectionProviderFactory -
Method Summary
Modifier and TypeMethodDescriptionInitiate factory with JDBC connection informationof(DataSource dataSource) Initiate factory with Java.sql.DataSource
-
Method Details
-
of
public static AssertDbConnectionFactory.DataSourceConnectionProviderFactory of(DataSource dataSource) Initiate factory with Java.sql.DataSource- Parameters:
dataSource- Datasource to retrieve data from database.- Returns:
- Factory of ConnectionProvider
-
of
public static AssertDbConnectionFactory.JdbcUrlConnectionProviderFactory of(String url, String user, String password) Initiate factory with JDBC connection information- Parameters:
url- JDBC url of database.user- Connection username.password- Connection password.- Returns:
- Factory of ConnectionProvider
-