Fix database extension test suite when run without SQL servers
This commit is contained in:
parent
34ed142bb2
commit
0dc2414fd0
@ -42,7 +42,6 @@
|
|||||||
<exclude name="requiresMySQL"/>
|
<exclude name="requiresMySQL"/>
|
||||||
<exclude name="requiresPgSQL"/>
|
<exclude name="requiresPgSQL"/>
|
||||||
<exclude name="requiresMariaDB" />
|
<exclude name="requiresMariaDB" />
|
||||||
<exclude name="requiresSQLite" />
|
|
||||||
</run>
|
</run>
|
||||||
</groups>
|
</groups>
|
||||||
<packages>
|
<packages>
|
||||||
|
@ -1,90 +0,0 @@
|
|||||||
package com.google.refine.extension.database;
|
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
import org.testng.annotations.AfterSuite;
|
|
||||||
import org.testng.annotations.BeforeSuite;
|
|
||||||
import org.testng.annotations.Optional;
|
|
||||||
import org.testng.annotations.Parameters;
|
|
||||||
|
|
||||||
import com.google.refine.extension.database.mariadb.MariaDBDatabaseService;
|
|
||||||
import com.google.refine.extension.database.mysql.MySQLDatabaseService;
|
|
||||||
import com.google.refine.extension.database.pgsql.PgSQLDatabaseService;
|
|
||||||
|
|
||||||
public class DatabaseTestConfig extends DBExtensionTests {
|
|
||||||
|
|
||||||
private DatabaseConfiguration mysqlDbConfig;
|
|
||||||
private DatabaseConfiguration pgsqlDbConfig;
|
|
||||||
private DatabaseConfiguration mariadbDbConfig;
|
|
||||||
private DatabaseConfiguration sqliteDbConfig;
|
|
||||||
|
|
||||||
@BeforeSuite
|
|
||||||
@Parameters({ "mySqlDbName", "mySqlDbHost", "mySqlDbPort", "mySqlDbUser", "mySqlDbPassword", "mySqlTestTable",
|
|
||||||
"pgSqlDbName", "pgSqlDbHost", "pgSqlDbPort", "pgSqlDbUser", "pgSqlDbPassword", "pgSqlTestTable",
|
|
||||||
"mariadbDbName", "mariadbDbHost", "mariadbDbPort", "mariadbDbUser", "mariadbDbPassword", "mariadbTestTable",
|
|
||||||
"sqliteDbName", "sqliteTestTable"})
|
|
||||||
public void beforeSuite(
|
|
||||||
@Optional(DEFAULT_MYSQL_DB_NAME) String mySqlDbName, @Optional(DEFAULT_MYSQL_HOST) String mySqlDbHost,
|
|
||||||
@Optional(DEFAULT_MYSQL_PORT) String mySqlDbPort, @Optional(DEFAULT_MYSQL_USER) String mySqlDbUser,
|
|
||||||
@Optional(DEFAULT_MYSQL_PASSWORD) String mySqlDbPassword, @Optional(DEFAULT_TEST_TABLE) String mySqlTestTable,
|
|
||||||
|
|
||||||
@Optional(DEFAULT_PGSQL_DB_NAME) String pgSqlDbName, @Optional(DEFAULT_PGSQL_HOST) String pgSqlDbHost,
|
|
||||||
@Optional(DEFAULT_PGSQL_PORT) String pgSqlDbPort, @Optional(DEFAULT_PGSQL_USER) String pgSqlDbUser,
|
|
||||||
@Optional(DEFAULT_PGSQL_PASSWORD) String pgSqlDbPassword, @Optional(DEFAULT_TEST_TABLE) String pgSqlTestTable,
|
|
||||||
|
|
||||||
@Optional(DEFAULT_MARIADB_NAME) String mariadbDbName, @Optional(DEFAULT_MARIADB_HOST) String mariadbDbHost,
|
|
||||||
@Optional(DEFAULT_MARIADB_PORT) String mariadbDbPort, @Optional(DEFAULT_MARIADB_USER) String mariadbDbUser,
|
|
||||||
@Optional(DEFAULT_MARIADB_PASSWORD) String mariadbDbPassword, @Optional(DEFAULT_TEST_TABLE) String mariadbTestTable,
|
|
||||||
|
|
||||||
@Optional(DEFAULT_SQLITE_DB_NAME) String sqliteDbName, @Optional(DEFAULT_TEST_TABLE) String sqliteTestTable)
|
|
||||||
throws DatabaseServiceException, SQLException {
|
|
||||||
|
|
||||||
//System.out.println("@BeforeSuite\n");
|
|
||||||
mysqlDbConfig = new DatabaseConfiguration();
|
|
||||||
mysqlDbConfig.setDatabaseHost(mySqlDbHost);
|
|
||||||
mysqlDbConfig.setDatabaseName(mySqlDbName);
|
|
||||||
mysqlDbConfig.setDatabasePassword(mySqlDbPassword);
|
|
||||||
mysqlDbConfig.setDatabasePort(Integer.parseInt(mySqlDbPort));
|
|
||||||
mysqlDbConfig.setDatabaseType(MySQLDatabaseService.DB_NAME);
|
|
||||||
mysqlDbConfig.setDatabaseUser(mySqlDbUser);
|
|
||||||
mysqlDbConfig.setUseSSL(false);
|
|
||||||
|
|
||||||
pgsqlDbConfig = new DatabaseConfiguration();
|
|
||||||
pgsqlDbConfig.setDatabaseHost(pgSqlDbHost);
|
|
||||||
pgsqlDbConfig.setDatabaseName(pgSqlDbName);
|
|
||||||
pgsqlDbConfig.setDatabasePassword(pgSqlDbPassword);
|
|
||||||
pgsqlDbConfig.setDatabasePort(Integer.parseInt(pgSqlDbPort));
|
|
||||||
pgsqlDbConfig.setDatabaseType(PgSQLDatabaseService.DB_NAME);
|
|
||||||
pgsqlDbConfig.setDatabaseUser(pgSqlDbUser);
|
|
||||||
pgsqlDbConfig.setUseSSL(false);
|
|
||||||
|
|
||||||
mariadbDbConfig = new DatabaseConfiguration();
|
|
||||||
mariadbDbConfig.setDatabaseHost(mariadbDbHost);
|
|
||||||
mariadbDbConfig.setDatabaseName(mariadbDbName);
|
|
||||||
mariadbDbConfig.setDatabasePassword(mariadbDbPassword);
|
|
||||||
mariadbDbConfig.setDatabasePort(Integer.parseInt(mariadbDbPort));
|
|
||||||
mariadbDbConfig.setDatabaseType(MariaDBDatabaseService.DB_NAME);
|
|
||||||
mariadbDbConfig.setDatabaseUser(mariadbDbUser);
|
|
||||||
mariadbDbConfig.setUseSSL(false);
|
|
||||||
|
|
||||||
sqliteDbConfig = new DatabaseConfiguration();
|
|
||||||
sqliteDbConfig.setDatabaseName(sqliteDbName);
|
|
||||||
|
|
||||||
DBExtensionTestUtils.initTestData(mysqlDbConfig);
|
|
||||||
DBExtensionTestUtils.initTestData(pgsqlDbConfig);
|
|
||||||
DBExtensionTestUtils.initTestData(mariadbDbConfig);
|
|
||||||
DBExtensionTestUtils.initTestData(sqliteDbConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterSuite
|
|
||||||
public void afterSuite() {
|
|
||||||
// System.out.println("@AfterSuite");
|
|
||||||
|
|
||||||
DBExtensionTestUtils.cleanUpTestData(mysqlDbConfig);
|
|
||||||
DBExtensionTestUtils.cleanUpTestData(pgsqlDbConfig);
|
|
||||||
DBExtensionTestUtils.cleanUpTestData(mariadbDbConfig);
|
|
||||||
DBExtensionTestUtils.cleanUpTestData(sqliteDbConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.google.refine.extension.database;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import org.testng.annotations.AfterSuite;
|
||||||
|
import org.testng.annotations.BeforeSuite;
|
||||||
|
import org.testng.annotations.Optional;
|
||||||
|
import org.testng.annotations.Parameters;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.refine.extension.database.mariadb.MariaDBDatabaseService;
|
||||||
|
|
||||||
|
@Test(groups = { "requiresMariaDB" })
|
||||||
|
public class InitMariaDBTestDatabase extends DBExtensionTests {
|
||||||
|
|
||||||
|
private DatabaseConfiguration mariadbDbConfig;
|
||||||
|
|
||||||
|
@BeforeSuite
|
||||||
|
@Parameters({ "mariadbDbName", "mariadbDbHost", "mariadbDbPort", "mariadbDbUser", "mariadbDbPassword", "mariadbTestTable" })
|
||||||
|
public void beforeSuite(
|
||||||
|
@Optional(DEFAULT_MARIADB_NAME) String mariadbDbName, @Optional(DEFAULT_MARIADB_HOST) String mariadbDbHost,
|
||||||
|
@Optional(DEFAULT_MARIADB_PORT) String mariadbDbPort, @Optional(DEFAULT_MARIADB_USER) String mariadbDbUser,
|
||||||
|
@Optional(DEFAULT_MARIADB_PASSWORD) String mariadbDbPassword, @Optional(DEFAULT_TEST_TABLE) String mariadbTestTable)
|
||||||
|
throws DatabaseServiceException, SQLException {
|
||||||
|
|
||||||
|
mariadbDbConfig = new DatabaseConfiguration();
|
||||||
|
mariadbDbConfig.setDatabaseHost(mariadbDbHost);
|
||||||
|
mariadbDbConfig.setDatabaseName(mariadbDbName);
|
||||||
|
mariadbDbConfig.setDatabasePassword(mariadbDbPassword);
|
||||||
|
mariadbDbConfig.setDatabasePort(Integer.parseInt(mariadbDbPort));
|
||||||
|
mariadbDbConfig.setDatabaseType(MariaDBDatabaseService.DB_NAME);
|
||||||
|
mariadbDbConfig.setDatabaseUser(mariadbDbUser);
|
||||||
|
mariadbDbConfig.setUseSSL(false);
|
||||||
|
|
||||||
|
DBExtensionTestUtils.initTestData(mariadbDbConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterSuite
|
||||||
|
public void afterSuite() {
|
||||||
|
DBExtensionTestUtils.cleanUpTestData(mariadbDbConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.google.refine.extension.database;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import org.testng.annotations.AfterSuite;
|
||||||
|
import org.testng.annotations.BeforeSuite;
|
||||||
|
import org.testng.annotations.Optional;
|
||||||
|
import org.testng.annotations.Parameters;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.refine.extension.database.mysql.MySQLDatabaseService;
|
||||||
|
|
||||||
|
@Test(groups = { "requiresMySQL" })
|
||||||
|
public class InitMySQLTestDatabase extends DBExtensionTests {
|
||||||
|
|
||||||
|
private DatabaseConfiguration mysqlDbConfig;
|
||||||
|
|
||||||
|
@BeforeSuite
|
||||||
|
@Parameters({ "mySqlDbName", "mySqlDbHost", "mySqlDbPort", "mySqlDbUser", "mySqlDbPassword", "mySqlTestTable" })
|
||||||
|
public void beforeSuite(
|
||||||
|
@Optional(DEFAULT_MYSQL_DB_NAME) String mySqlDbName, @Optional(DEFAULT_MYSQL_HOST) String mySqlDbHost,
|
||||||
|
@Optional(DEFAULT_MYSQL_PORT) String mySqlDbPort, @Optional(DEFAULT_MYSQL_USER) String mySqlDbUser,
|
||||||
|
@Optional(DEFAULT_MYSQL_PASSWORD) String mySqlDbPassword, @Optional(DEFAULT_TEST_TABLE) String mySqlTestTable)
|
||||||
|
throws DatabaseServiceException, SQLException {
|
||||||
|
|
||||||
|
//System.out.println("@BeforeSuite\n");
|
||||||
|
mysqlDbConfig = new DatabaseConfiguration();
|
||||||
|
mysqlDbConfig.setDatabaseHost(mySqlDbHost);
|
||||||
|
mysqlDbConfig.setDatabaseName(mySqlDbName);
|
||||||
|
mysqlDbConfig.setDatabasePassword(mySqlDbPassword);
|
||||||
|
mysqlDbConfig.setDatabasePort(Integer.parseInt(mySqlDbPort));
|
||||||
|
mysqlDbConfig.setDatabaseType(MySQLDatabaseService.DB_NAME);
|
||||||
|
mysqlDbConfig.setDatabaseUser(mySqlDbUser);
|
||||||
|
mysqlDbConfig.setUseSSL(false);
|
||||||
|
|
||||||
|
DBExtensionTestUtils.initTestData(mysqlDbConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterSuite
|
||||||
|
public void afterSuite() {
|
||||||
|
DBExtensionTestUtils.cleanUpTestData(mysqlDbConfig);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package com.google.refine.extension.database;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import org.testng.annotations.AfterSuite;
|
||||||
|
import org.testng.annotations.BeforeSuite;
|
||||||
|
import org.testng.annotations.Optional;
|
||||||
|
import org.testng.annotations.Parameters;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import com.google.refine.extension.database.pgsql.PgSQLDatabaseService;
|
||||||
|
|
||||||
|
@Test(groups = { "requiresPgSQL" })
|
||||||
|
public class InitPostgresTestDatabase extends DBExtensionTests {
|
||||||
|
|
||||||
|
private DatabaseConfiguration pgsqlDbConfig;
|
||||||
|
|
||||||
|
@BeforeSuite
|
||||||
|
@Parameters({ "pgSqlDbName", "pgSqlDbHost", "pgSqlDbPort", "pgSqlDbUser", "pgSqlDbPassword", "pgSqlTestTable" })
|
||||||
|
public void beforeSuite(
|
||||||
|
@Optional(DEFAULT_PGSQL_DB_NAME) String pgSqlDbName, @Optional(DEFAULT_PGSQL_HOST) String pgSqlDbHost,
|
||||||
|
@Optional(DEFAULT_PGSQL_PORT) String pgSqlDbPort, @Optional(DEFAULT_PGSQL_USER) String pgSqlDbUser,
|
||||||
|
@Optional(DEFAULT_PGSQL_PASSWORD) String pgSqlDbPassword, @Optional(DEFAULT_TEST_TABLE) String pgSqlTestTable)
|
||||||
|
throws DatabaseServiceException, SQLException {
|
||||||
|
|
||||||
|
pgsqlDbConfig = new DatabaseConfiguration();
|
||||||
|
pgsqlDbConfig.setDatabaseHost(pgSqlDbHost);
|
||||||
|
pgsqlDbConfig.setDatabaseName(pgSqlDbName);
|
||||||
|
pgsqlDbConfig.setDatabasePassword(pgSqlDbPassword);
|
||||||
|
pgsqlDbConfig.setDatabasePort(Integer.parseInt(pgSqlDbPort));
|
||||||
|
pgsqlDbConfig.setDatabaseType(PgSQLDatabaseService.DB_NAME);
|
||||||
|
pgsqlDbConfig.setDatabaseUser(pgSqlDbUser);
|
||||||
|
pgsqlDbConfig.setUseSSL(false);
|
||||||
|
|
||||||
|
DBExtensionTestUtils.initTestData(pgsqlDbConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterSuite
|
||||||
|
public void afterSuite() {
|
||||||
|
DBExtensionTestUtils.cleanUpTestData(pgsqlDbConfig);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.google.refine.extension.database;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import org.testng.annotations.AfterSuite;
|
||||||
|
import org.testng.annotations.BeforeSuite;
|
||||||
|
import org.testng.annotations.Optional;
|
||||||
|
import org.testng.annotations.Parameters;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@Test(groups = { "requiresMariaDB" })
|
||||||
|
public class InitSQLiteTestDatabase extends DBExtensionTests {
|
||||||
|
|
||||||
|
private DatabaseConfiguration sqliteDbConfig;
|
||||||
|
|
||||||
|
@BeforeSuite
|
||||||
|
@Parameters({ "sqliteDbName", "sqliteTestTable"})
|
||||||
|
public void beforeSuite(
|
||||||
|
@Optional(DEFAULT_SQLITE_DB_NAME) String sqliteDbName, @Optional(DEFAULT_TEST_TABLE) String sqliteTestTable)
|
||||||
|
throws DatabaseServiceException, SQLException {
|
||||||
|
|
||||||
|
sqliteDbConfig = new DatabaseConfiguration();
|
||||||
|
sqliteDbConfig.setDatabaseName(sqliteDbName);
|
||||||
|
|
||||||
|
DBExtensionTestUtils.initTestData(sqliteDbConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterSuite
|
||||||
|
public void afterSuite() {
|
||||||
|
DBExtensionTestUtils.cleanUpTestData(sqliteDbConfig);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user