#392 Create integration test for MySQL

- Relocate tests to AbstractDataSourceIntegrationTest to reuse tests for SQLite and MySQL
- Add H2 driver and create test class for MySQL
This commit is contained in:
ljacqu
2016-02-22 21:52:10 +01:00
parent 44e2218ada
commit 5e16ca1490
7 changed files with 234 additions and 109 deletions
@@ -81,6 +81,19 @@ public class MySQL implements DataSource {
}
}
MySQL(NewSetting settings, HikariDataSource hikariDataSource) {
this.host = settings.getProperty(DatabaseSettings.MYSQL_HOST);
this.port = settings.getProperty(DatabaseSettings.MYSQL_PORT);
this.username = settings.getProperty(DatabaseSettings.MYSQL_USERNAME);
this.password = settings.getProperty(DatabaseSettings.MYSQL_PASSWORD);
this.database = settings.getProperty(DatabaseSettings.MYSQL_DATABASE);
this.tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE);
this.columnOthers = settings.getProperty(HooksSettings.MYSQL_OTHER_USERNAME_COLS);
this.col = new Columns(settings);
this.hashAlgorithm = settings.getProperty(SecuritySettings.PASSWORD_HASH);
ds = hikariDataSource;
}
private synchronized void setConnectionArguments() throws RuntimeException {
ds = new HikariDataSource();
ds.setPoolName("AuthMeMYSQLPool");
@@ -48,18 +48,11 @@ public class SQLite implements DataSource {
}
@VisibleForTesting
SQLite(NewSetting settings, Connection connection, boolean executeSetup) {
SQLite(NewSetting settings, Connection connection) {
this.database = settings.getProperty(DatabaseSettings.MYSQL_DATABASE);
this.tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE);
this.col = new Columns(settings);
this.con = connection;
if (executeSetup) {
try {
setup();
} catch (SQLException e) {
throw new IllegalStateException(e);
}
}
}
private synchronized void connect() throws ClassNotFoundException, SQLException {