diff --git a/.travis.yml b/.travis.yml
index 4d90af025..b0184efcf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -20,6 +20,7 @@ before_install:
- mysql -u root test_db < extensions/database/test/conf/travis-mysql.sql
- psql -c 'CREATE DATABASE test_db;' -U postgres
- psql -U postgres test_db < extensions/database/test/conf/travis-pgsql.sql
+ - cp extensions/database/test/conf/travis_tests.xml extensions/database/test/conf/tests.xml
script:
- ./refine server_test
diff --git a/appveyor.yml b/appveyor.yml
index fb77ba7d2..dfdb09941 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,10 +1,15 @@
version: 1.0.{build}
+services:
+- mysql
+- postgresql96
+
init:
- cmd: java -version 2>&1 | find "version"
-clone_script:
-- cmd: git clone --recursive https://github.com/OpenRefine/OpenRefine
+clone_depth: 5
+skip_branch_with_pr: true
+
environment:
ANT_HOME: C:\apache-ant-1.10.1
JAVA_HOME: C:\Program Files (x86)\Java\jdk1.8.0
@@ -20,17 +25,24 @@ cache:
- apache-ant-1.10.1-bin.zip
build: off
-# scripts to run before build
-before_build:
+# scripts to run before test
+before_test:
- cmd: echo Running scripts before build...
+- cmd: |-
+ PATH=C:\Program Files\PostgreSQL\9.6\bin\;C:\Program Files\MySQL\MySQL Server 5.7\bin\;%PATH%
+ SET MYSQL_PWD=Password12!
+ mysql -u root --password=Password12! -e "create database test_db;"
+ mysql -u root test_db --password=Password12! < extensions\database\test\conf\travis-mysql.sql
+ echo "localhost:*:test_db:postgres:Password12!" > C:\Program Files\PostgreSQL\9.6\pgpass.conf
+ echo "localhost:*:test_db:postgres:Password12!" > pgpass.conf
+ echo "localhost:*:test_db:postgres:Password12!" > %userprofile%\pgpass.conf
+ SET PGPASSFILE=C:\Program Files\PostgreSQL\9.6\pgpass.conf
+ SET PGPASSWORD=Password12!
+ SET PGUSER=postgres
+ createdb test_db
+ psql -U postgres test_db < extensions\database\test\conf\travis-pgsql.sql
-build_script:
-# - cmd: >-
-# echo Running refine build...
-#
-# cd OpenRefine
-#
-# refine build
+ copy extensions\database\test\conf\appveyor_tests.xml extensions\database\test\conf\tests.xml
test_script:
- cmd: echo Running test_script...
@@ -39,8 +51,6 @@ test_script:
path
- cd OpenRefine
-
refine server_test
-
+
refine extensions_test
diff --git a/extensions/database/build-test.xml b/extensions/database/build-test.xml
deleted file mode 100644
index 7dd804202..000000000
--- a/extensions/database/build-test.xml
+++ /dev/null
@@ -1,194 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/extensions/database/build.xml b/extensions/database/build.xml
index c2c8f6c89..b6ee98f30 100644
--- a/extensions/database/build.xml
+++ b/extensions/database/build.xml
@@ -104,9 +104,9 @@
-
+
@@ -126,34 +126,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/extensions/database/test/com/google/refine/extension/database/DBExtensionTestUtils.java b/extensions/database/test/com/google/refine/extension/database/DBExtensionTestUtils.java
index bc06afed6..c8df3d8b3 100644
--- a/extensions/database/test/com/google/refine/extension/database/DBExtensionTestUtils.java
+++ b/extensions/database/test/com/google/refine/extension/database/DBExtensionTestUtils.java
@@ -50,8 +50,11 @@ public class DBExtensionTestUtils {
* Create Test Table with one row of Data
* @param dbConfig DatabaseConfiguration to test
* @param tableName
+ * @throws DatabaseServiceException
+ * @throws SQLException
*/
- public static void initTestData(DatabaseConfiguration dbConfig, String tableName) {
+ public static void initTestData(DatabaseConfiguration dbConfig, String tableName)
+ throws DatabaseServiceException, SQLException {
Statement stmt = null;
Connection conn = null;
@@ -87,16 +90,11 @@ public class DBExtensionTestUtils {
logger.info("Database Test Init Data Created!!!");
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
-
} finally {
if(stmt != null) {
try {
stmt.close();
} catch (SQLException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
@@ -104,7 +102,6 @@ public class DBExtensionTestUtils {
try {
conn.close();
} catch (SQLException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
@@ -113,7 +110,8 @@ public class DBExtensionTestUtils {
}
- public static void initTestData(DatabaseConfiguration dbConfig) {
+ public static void initTestData(DatabaseConfiguration dbConfig)
+ throws DatabaseServiceException, SQLException {
Statement stmt = null;
Connection conn = null;
@@ -148,11 +146,7 @@ public class DBExtensionTestUtils {
// System.out.println("Insert Data Result::" + insertResult);
logger.info("Database Test Init Data Created!!!");
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
-
+
} finally {
if(stmt != null) {
try {
@@ -179,8 +173,11 @@ public class DBExtensionTestUtils {
* Table name: test_data
* @param sampleSize
* @param batchSize
+ * @throws DatabaseServiceException
+ * @throws SQLException
*/
- public void generateMySQLTestData(int sampleSize, int batchSize) {
+ public void generateMySQLTestData(int sampleSize, int batchSize)
+ throws DatabaseServiceException, SQLException {
mncMap = new HashMap();
mccMap = new HashMap();
mccMap.put(0, 302);
@@ -208,65 +205,56 @@ public class DBExtensionTestUtils {
+ "id, ue_id, start_time, end_date, bytes_upload, bytes_download, cell_id, mcc, mnc, lac, imei)"
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
- Connection conn;
- try {
- conn = DatabaseService.get(MYSQL_DB_NAME).getConnection(dc);
+ Connection conn = DatabaseService.get(MYSQL_DB_NAME).getConnection(dc);
- Statement truncateStmt = conn.createStatement();
- int result = truncateStmt.executeUpdate(truncateTableSQL);
- System.out.println("Truncate Table Result::" + result);
- truncateStmt.close();
-
-
- conn.setAutoCommit(false);
-
- PreparedStatement stmt = conn.prepareStatement(insertTableSQL);
-
- int counter=1;
- for (int i = 0; i < sampleSize; i++) {
- stmt.setLong(1, i);
- stmt.setString(2, getNextUeId());
- stmt.setDate(3, getNextStartDate());
- stmt.setDate(4, getNextEndDate());
- stmt.setInt(5, rand.nextInt());
- stmt.setInt(6, rand.nextInt());
- stmt.setInt(7, rand.nextInt(10));
- stmt.setInt(8, getMCC());
- stmt.setInt(9, getMNC());
- stmt.setInt(10, rand.nextInt(100));
- stmt.setString(11, getNextIMEI());
-
- stmt.addBatch();
-
- //Execute batch of 1000 records
- if(i%batchSize==0){
- stmt.executeBatch();
- conn.commit();
- System.out.println("Batch "+(counter++)+" executed successfully");
- }
- }
- //execute final batch
- stmt.executeBatch();
- System.out.println("Final Batch Executed "+(counter++)+" executed successfully");
- conn.commit();
- conn.close();
+ Statement truncateStmt = conn.createStatement();
+ int result = truncateStmt.executeUpdate(truncateTableSQL);
+ System.out.println("Truncate Table Result::" + result);
+ truncateStmt.close();
+
+
+ conn.setAutoCommit(false);
+
+ PreparedStatement stmt = conn.prepareStatement(insertTableSQL);
+
+ int counter=1;
+ for (int i = 0; i < sampleSize; i++) {
+ stmt.setLong(1, i);
+ stmt.setString(2, getNextUeId());
+ stmt.setDate(3, getNextStartDate());
+ stmt.setDate(4, getNextEndDate());
+ stmt.setInt(5, rand.nextInt());
+ stmt.setInt(6, rand.nextInt());
+ stmt.setInt(7, rand.nextInt(10));
+ stmt.setInt(8, getMCC());
+ stmt.setInt(9, getMNC());
+ stmt.setInt(10, rand.nextInt(100));
+ stmt.setString(11, getNextIMEI());
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ stmt.addBatch();
+
+ //Execute batch of 1000 records
+ if(i%batchSize==0){
+ stmt.executeBatch();
+ conn.commit();
+ System.out.println("Batch "+(counter++)+" executed successfully");
+ }
}
-
+ //execute final batch
+ stmt.executeBatch();
+ System.out.println("Final Batch Executed "+(counter++)+" executed successfully");
+ conn.commit();
+ conn.close();
}
/**
*
* @param sampleSize
* @param batchSize
+ * @throws DatabaseServiceException
+ * @throws SQLException
*/
- public void generatePgSQLTestData(int sampleSize, int batchSize) {
+ public void generatePgSQLTestData(int sampleSize, int batchSize) throws DatabaseServiceException, SQLException {
mncMap = new HashMap();
mccMap = new HashMap();
mccMap.put(0, 302);
@@ -294,56 +282,46 @@ public class DBExtensionTestUtils {
+ "id, ue_id, start_time, end_date, bytes_upload, bytes_download, cell_id, mcc, mnc, lac, imei)"
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
- Connection conn;
- try {
- conn = DatabaseService.get(PGSQL_DB_NAME).getConnection(dc);
+ Connection conn = DatabaseService.get(PGSQL_DB_NAME).getConnection(dc);
- Statement truncateStmt = conn.createStatement();
- int result = truncateStmt.executeUpdate(truncateTableSQL);
- System.out.println("Truncate Table Result::" + result);
- truncateStmt.close();
-
-
- conn.setAutoCommit(false);
-
- PreparedStatement stmt = conn.prepareStatement(insertTableSQL);
-
- int counter=1;
- for (int i = 0; i < sampleSize; i++) {
- stmt.setLong(1, i);
- stmt.setString(2, getNextUeId());
- stmt.setDate(3, getNextStartDate());
- stmt.setDate(4, getNextEndDate());
- stmt.setInt(5, rand.nextInt());
- stmt.setInt(6, rand.nextInt());
- stmt.setInt(7, rand.nextInt(10));
- stmt.setInt(8, getMCC());
- stmt.setInt(9, getMNC());
- stmt.setInt(10, rand.nextInt(100));
- stmt.setString(11, getNextIMEI());
-
- stmt.addBatch();
-
- //Execute batch of 1000 records
- if(i%batchSize==0){
- stmt.executeBatch();
- conn.commit();
- System.out.println("Batch "+(counter++)+" executed successfully");
- }
- }
- //execute final batch
- stmt.executeBatch();
- System.out.println("Final Batch Executed "+(counter++)+" executed successfully");
- conn.commit();
- conn.close();
+ Statement truncateStmt = conn.createStatement();
+ int result = truncateStmt.executeUpdate(truncateTableSQL);
+ System.out.println("Truncate Table Result::" + result);
+ truncateStmt.close();
+
+
+ conn.setAutoCommit(false);
+
+ PreparedStatement stmt = conn.prepareStatement(insertTableSQL);
+
+ int counter=1;
+ for (int i = 0; i < sampleSize; i++) {
+ stmt.setLong(1, i);
+ stmt.setString(2, getNextUeId());
+ stmt.setDate(3, getNextStartDate());
+ stmt.setDate(4, getNextEndDate());
+ stmt.setInt(5, rand.nextInt());
+ stmt.setInt(6, rand.nextInt());
+ stmt.setInt(7, rand.nextInt(10));
+ stmt.setInt(8, getMCC());
+ stmt.setInt(9, getMNC());
+ stmt.setInt(10, rand.nextInt(100));
+ stmt.setString(11, getNextIMEI());
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ stmt.addBatch();
+
+ //Execute batch of 1000 records
+ if(i%batchSize==0){
+ stmt.executeBatch();
+ conn.commit();
+ System.out.println("Batch "+(counter++)+" executed successfully");
+ }
}
+ //execute final batch
+ stmt.executeBatch();
+ System.out.println("Final Batch Executed "+(counter++)+" executed successfully");
+ conn.commit();
+ conn.close();
}
@@ -381,7 +359,7 @@ public class DBExtensionTestUtils {
return "" + n;
}
- public static void main(String[] args) {
+ public static void main(String[] args) throws DatabaseServiceException, SQLException {
DBExtensionTestUtils testUtil = new DBExtensionTestUtils();
testUtil.generatePgSQLTestData(SAMPLE_SIZE, BATCH_SIZE);
// testUtil.generateMySQLTestData();
@@ -404,7 +382,7 @@ public class DBExtensionTestUtils {
//System.out.println("Drop Table Result::" + dropResult);
}
- logger.info("Database Test Cleanup Done!!!");
+ logger.info("Database Test Cleanup Done");
} catch (DatabaseServiceException e) {
// TODO Auto-generated catch block
diff --git a/extensions/database/test/com/google/refine/extension/database/DBExtensionTests.java b/extensions/database/test/com/google/refine/extension/database/DBExtensionTests.java
index 12cc01930..7d31085ef 100644
--- a/extensions/database/test/com/google/refine/extension/database/DBExtensionTests.java
+++ b/extensions/database/test/com/google/refine/extension/database/DBExtensionTests.java
@@ -33,6 +33,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.google.refine.extension.database;
+import java.util.Properties;
+
import org.slf4j.Logger;
public class DBExtensionTests {
@@ -60,14 +62,9 @@ public class DBExtensionTests {
protected final String DEFAULT_MARIADB_NAME = "testdb";
protected final String DEFAULT_TEST_TABLE = "test_data";
+
+ protected Properties properties;
- protected Logger logger;
-
-// @BeforeSuite
-// public void init() {
-// System.out.println("Log4j init...");
-// System.setProperty("log4j.configuration", "log4j-test.properties");
-// }
-
+ protected Logger logger;
}
diff --git a/extensions/database/test/com/google/refine/extension/database/DatabaseImportControllerTest.java b/extensions/database/test/com/google/refine/extension/database/DatabaseImportControllerTest.java
index 1157a71cf..b1ee56bfa 100644
--- a/extensions/database/test/com/google/refine/extension/database/DatabaseImportControllerTest.java
+++ b/extensions/database/test/com/google/refine/extension/database/DatabaseImportControllerTest.java
@@ -8,6 +8,7 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
+import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -35,7 +36,7 @@ import com.google.refine.model.Project;
-
+@Test(groups = { "requiresMySQL" })
public class DatabaseImportControllerTest extends DBExtensionTests{
@Mock
@@ -118,141 +119,114 @@ public class DatabaseImportControllerTest extends DBExtensionTests{
}
@Test
- public void testDoPostInvalidSubCommand() {
+ public void testDoPostInvalidSubCommand() throws IOException, ServletException, JSONException {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
- try {
- when(request.getQueryString()).thenReturn(
- "http://127.0.0.1:3333/command/core/importing-controller?controller=database/database-import-controller&subCommand=invalid-sub-command");
-
- when(response.getWriter()).thenReturn(pw);
- //test
- SUT.doPost(request, response);
-
- String result = sw.getBuffer().toString().trim();
- JSONObject json = new JSONObject(result);
-
- String code = json.getString("status");
- String message = json.getString("message");
- Assert.assertNotNull(code);
- Assert.assertNotNull(message);
- Assert.assertEquals(code, "error");
- Assert.assertEquals(message, "No such sub command");
-
+ when(request.getQueryString()).thenReturn(
+ "http://127.0.0.1:3333/command/core/importing-controller?controller=database/database-import-controller&subCommand=invalid-sub-command");
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ when(response.getWriter()).thenReturn(pw);
+ //test
+ SUT.doPost(request, response);
+
+ String result = sw.getBuffer().toString().trim();
+ JSONObject json = new JSONObject(result);
+
+ String code = json.getString("status");
+ String message = json.getString("message");
+ Assert.assertNotNull(code);
+ Assert.assertNotNull(message);
+ Assert.assertEquals(code, "error");
+ Assert.assertEquals(message, "No such sub command");
}
@Test
- public void testDoPostInitializeParser() {
+ public void testDoPostInitializeParser() throws ServletException, IOException, JSONException {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
- try {
- when(request.getQueryString()).thenReturn(
- "http://127.0.0.1:3333/command/core/importing-controller?controller=database/database-import-controller&subCommand=initialize-parser-ui");
- when(response.getWriter()).thenReturn(pw);
-
- SUT.doPost(request, response);
-
- String result = sw.getBuffer().toString().trim();
- JSONObject json = new JSONObject(result);
+ when(request.getQueryString()).thenReturn(
+ "http://127.0.0.1:3333/command/core/importing-controller?controller=database/database-import-controller&subCommand=initialize-parser-ui");
+ when(response.getWriter()).thenReturn(pw);
+
+ SUT.doPost(request, response);
- String status = json.getString("status");
- //System.out.println("json::" + json);
- Assert.assertEquals(status, "ok");
+ String result = sw.getBuffer().toString().trim();
+ JSONObject json = new JSONObject(result);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ String status = json.getString("status");
+ //System.out.println("json::" + json);
+ Assert.assertEquals(status, "ok");
}
@Test
- public void testDoPostParsePreview() {
+ public void testDoPostParsePreview() throws IOException, ServletException, JSONException {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
-
- try {
- long jobId = job.id;
-
- when(request.getQueryString()).thenReturn(
- "http://127.0.0.1:3333/command/core/importing-controller?controller=database%2Fdatabase-import-controller&jobID="
- + jobId + "&subCommand=parse-preview");
- when(response.getWriter()).thenReturn(pw);
-
-
- when(request.getParameter("databaseType")).thenReturn(testDbConfig.getDatabaseType());
- when(request.getParameter("databaseServer")).thenReturn(testDbConfig.getDatabaseHost());
- when(request.getParameter("databasePort")).thenReturn("" + testDbConfig.getDatabasePort());
- when(request.getParameter("databaseUser")).thenReturn(testDbConfig.getDatabaseUser());
- when(request.getParameter("databasePassword")).thenReturn(testDbConfig.getDatabasePassword());
- when(request.getParameter("initialDatabase")).thenReturn(testDbConfig.getDatabaseName());
- when(request.getParameter("query")).thenReturn(query);
- when(request.getParameter("options")).thenReturn(JSON_OPTION);
-
- SUT.doPost(request, response);
-
- String result = sw.getBuffer().toString().trim();
- JSONObject json = new JSONObject(result);
-
- String status = json.getString("status");
- //System.out.println("json::" + json);
- Assert.assertEquals(status, "ok");
+ long jobId = job.id;
+
+ when(request.getQueryString()).thenReturn(
+ "http://127.0.0.1:3333/command/core/importing-controller?controller=database%2Fdatabase-import-controller&jobID="
+ + jobId + "&subCommand=parse-preview");
+ when(response.getWriter()).thenReturn(pw);
+
+
+ when(request.getParameter("databaseType")).thenReturn(testDbConfig.getDatabaseType());
+ when(request.getParameter("databaseServer")).thenReturn(testDbConfig.getDatabaseHost());
+ when(request.getParameter("databasePort")).thenReturn("" + testDbConfig.getDatabasePort());
+ when(request.getParameter("databaseUser")).thenReturn(testDbConfig.getDatabaseUser());
+ when(request.getParameter("databasePassword")).thenReturn(testDbConfig.getDatabasePassword());
+ when(request.getParameter("initialDatabase")).thenReturn(testDbConfig.getDatabaseName());
+ when(request.getParameter("query")).thenReturn(query);
+ when(request.getParameter("options")).thenReturn(JSON_OPTION);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ SUT.doPost(request, response);
+
+ String result = sw.getBuffer().toString().trim();
+ JSONObject json = new JSONObject(result);
+
+ String status = json.getString("status");
+ //System.out.println("json::" + json);
+ Assert.assertEquals(status, "ok");
}
@Test
- public void testDoPostCreateProject() {
+ public void testDoPostCreateProject() throws IOException, ServletException, JSONException {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
-
- try {
- long jobId = job.id;
-
- when(request.getQueryString()).thenReturn(
- "http://127.0.0.1:3333/command/core/importing-controller?controller=database%2Fdatabase-import-controller&jobID="
- + jobId + "&subCommand=create-project");
- when(response.getWriter()).thenReturn(pw);
-
-
- when(request.getParameter("databaseType")).thenReturn(testDbConfig.getDatabaseType());
- when(request.getParameter("databaseServer")).thenReturn(testDbConfig.getDatabaseHost());
- when(request.getParameter("databasePort")).thenReturn("" + testDbConfig.getDatabasePort());
- when(request.getParameter("databaseUser")).thenReturn(testDbConfig.getDatabaseUser());
- when(request.getParameter("databasePassword")).thenReturn(testDbConfig.getDatabasePassword());
- when(request.getParameter("initialDatabase")).thenReturn(testDbConfig.getDatabaseName());
- when(request.getParameter("query")).thenReturn(query);
- when(request.getParameter("options")).thenReturn(JSON_OPTION);
-
-
- SUT.doPost(request, response);
-
- String result = sw.getBuffer().toString().trim();
- JSONObject json = new JSONObject(result);
+ long jobId = job.id;
+
+ when(request.getQueryString()).thenReturn(
+ "http://127.0.0.1:3333/command/core/importing-controller?controller=database%2Fdatabase-import-controller&jobID="
+ + jobId + "&subCommand=create-project");
+ when(response.getWriter()).thenReturn(pw);
+
+
+ when(request.getParameter("databaseType")).thenReturn(testDbConfig.getDatabaseType());
+ when(request.getParameter("databaseServer")).thenReturn(testDbConfig.getDatabaseHost());
+ when(request.getParameter("databasePort")).thenReturn("" + testDbConfig.getDatabasePort());
+ when(request.getParameter("databaseUser")).thenReturn(testDbConfig.getDatabaseUser());
+ when(request.getParameter("databasePassword")).thenReturn(testDbConfig.getDatabasePassword());
+ when(request.getParameter("initialDatabase")).thenReturn(testDbConfig.getDatabaseName());
+ when(request.getParameter("query")).thenReturn(query);
+ when(request.getParameter("options")).thenReturn(JSON_OPTION);
+
- String status = json.getString("status");
- //System.out.println("json::" + json);
- Assert.assertEquals(status, "ok");
+ SUT.doPost(request, response);
+
+ String result = sw.getBuffer().toString().trim();
+ JSONObject json = new JSONObject(result);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ String status = json.getString("status");
+ //System.out.println("json::" + json);
+ Assert.assertEquals(status, "ok");
}
@BeforeTest
diff --git a/extensions/database/test/com/google/refine/extension/database/DatabaseServiceTest.java b/extensions/database/test/com/google/refine/extension/database/DatabaseServiceTest.java
index ddd0eda7e..2999d36c5 100644
--- a/extensions/database/test/com/google/refine/extension/database/DatabaseServiceTest.java
+++ b/extensions/database/test/com/google/refine/extension/database/DatabaseServiceTest.java
@@ -62,16 +62,14 @@ public class DatabaseServiceTest extends DBExtensionTests{
}
-
- @Test
+ @Test(groups = {"requiresPgSQL"})
public void testGetPgSQLDBService() {
-
DatabaseService dbService = DatabaseService.get(PgSQLDatabaseService.DB_NAME);
Assert.assertNotNull(dbService);
Assert.assertEquals(dbService.getClass(), PgSQLDatabaseService.class);
}
- @Test
+ @Test(groups = {"requiresMySQL"})
public void testGetMySQLDBService() {
DatabaseService dbService = DatabaseService.get(MySQLDatabaseService.DB_NAME);
@@ -79,7 +77,7 @@ public class DatabaseServiceTest extends DBExtensionTests{
Assert.assertEquals(dbService.getClass(), MySQLDatabaseService.class);
}
- @Test
+ @Test(groups = {"requiresMariaDB"})
public void testGetMariaDBSQLDBService() {
DatabaseService dbService = DatabaseService.get(MariaDBDatabaseService.DB_NAME);
@@ -87,64 +85,34 @@ public class DatabaseServiceTest extends DBExtensionTests{
Assert.assertEquals(dbService.getClass(), MariaDBDatabaseService.class);
}
- @Test
- public void testGetConnection() {
-
- try {
-
- DatabaseService dbService = DatabaseService.get(testDbConfig.getDatabaseType());
- Connection conn = dbService.getConnection(testDbConfig);
- Assert.assertNotNull(conn);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ @Test(groups = {"requiresMySQL"})
+ public void testGetConnection() throws DatabaseServiceException {
+ DatabaseService dbService = DatabaseService.get(testDbConfig.getDatabaseType());
+ Connection conn = dbService.getConnection(testDbConfig);
+ Assert.assertNotNull(conn);
}
- @Test
- public void testTestConnection() {
-
- try {
- DatabaseService dbService = DatabaseService.get(testDbConfig.getDatabaseType());
- boolean result = dbService.testConnection(testDbConfig);
- Assert.assertEquals(result, true);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
+ @Test(groups = {"requiresMySQL"})
+ public void testTestConnection() throws DatabaseServiceException {
+ DatabaseService dbService = DatabaseService.get(testDbConfig.getDatabaseType());
+ boolean result = dbService.testConnection(testDbConfig);
+ Assert.assertEquals(result, true);
}
- @Test
- public void testConnect() {
-
- try {
- DatabaseService dbService = DatabaseService.get(testDbConfig.getDatabaseType());
- DatabaseInfo databaseInfo = dbService.connect(testDbConfig);
- Assert.assertNotNull(databaseInfo);
-
- } catch (DatabaseServiceException e) {
- e.printStackTrace();
- }
-
+ @Test(groups = {"requiresMySQL"})
+ public void testConnect() throws DatabaseServiceException {
+ DatabaseService dbService = DatabaseService.get(testDbConfig.getDatabaseType());
+ DatabaseInfo databaseInfo = dbService.connect(testDbConfig);
+ Assert.assertNotNull(databaseInfo);
}
- @Test
- public void testExecuteQuery() {
+ @Test(groups = {"requiresMySQL"})
+ public void testExecuteQuery() throws DatabaseServiceException {
+ DatabaseService dbService = DatabaseService.get(testDbConfig.getDatabaseType());
+ DatabaseInfo databaseInfo = dbService.testQuery(testDbConfig,
+ "SELECT * FROM " + testTable);
- try {
- DatabaseService dbService = DatabaseService.get(testDbConfig.getDatabaseType());
- DatabaseInfo databaseInfo = dbService.testQuery(testDbConfig,
- "SELECT * FROM " + testTable);
-
- Assert.assertNotNull(databaseInfo);
-
- } catch (DatabaseServiceException e) {
- e.printStackTrace();
- }
-
+ Assert.assertNotNull(databaseInfo);
}
@Test
@@ -157,44 +125,26 @@ public class DatabaseServiceTest extends DBExtensionTests{
Assert.assertEquals(limitQuery, "SELECT * FROM " + testTable + " LIMIT " + 100 + " OFFSET " + 0 + ";");
}
- @Test
- public void testGetColumns() {
+ @Test(groups = {"requiresMySQL"})
+ public void testGetColumns() throws DatabaseServiceException {
List dbColumns;
- try {
- DatabaseService dbService = DatabaseService.get(testDbConfig.getDatabaseType());
- dbColumns = dbService.getColumns(testDbConfig,"SELECT * FROM " + testTable);
- Assert.assertNotNull(dbColumns);
-
- int cols = dbColumns.size();
- Assert.assertEquals(cols, 10);
-
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ DatabaseService dbService = DatabaseService.get(testDbConfig.getDatabaseType());
+ dbColumns = dbService.getColumns(testDbConfig,"SELECT * FROM " + testTable);
+ Assert.assertNotNull(dbColumns);
-
+ int cols = dbColumns.size();
+ Assert.assertEquals(cols, 10);
}
- @Test
- public void testGetRows() {
+ @Test(groups = {"requiresMySQL"})
+ public void testGetRows() throws DatabaseServiceException {
+ DatabaseService dbService = DatabaseService.get(testDbConfig.getDatabaseType());
+ List dbRows = dbService.getRows(testDbConfig,
+ "SELECT * FROM " + testTable);
- try {
-
- DatabaseService dbService = DatabaseService.get(testDbConfig.getDatabaseType());
- List dbRows = dbService.getRows(testDbConfig,
- "SELECT * FROM " + testTable);
-
- Assert.assertNotNull(dbRows);
- Assert.assertEquals(dbRows.size(), 1);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
+ Assert.assertNotNull(dbRows);
+ Assert.assertEquals(dbRows.size(), 1);
}
}
diff --git a/extensions/database/test/com/google/refine/extension/database/DatabaseTestConfig.java b/extensions/database/test/com/google/refine/extension/database/DatabaseTestConfig.java
index 531e8c400..ffebbe8e6 100644
--- a/extensions/database/test/com/google/refine/extension/database/DatabaseTestConfig.java
+++ b/extensions/database/test/com/google/refine/extension/database/DatabaseTestConfig.java
@@ -1,5 +1,7 @@
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;
@@ -30,7 +32,8 @@ public class DatabaseTestConfig extends DBExtensionTests {
@Optional(DEFAULT_MARIADB_NAME) String mariadbDbName, @Optional(DEFAULT_MARIADB_HOST) String mariadbDbHost,
@Optional(DEFAULT_MARIADB_PORT) String mariadbDbPort, @Optional(DEFAULT_MARIADB_USER) String mariadbyDbUser,
- @Optional(DEFAULT_MARIADB_PASSWORD) String mariadbDbPassword, @Optional(DEFAULT_TEST_TABLE) String mariadbTestTable) {
+ @Optional(DEFAULT_MARIADB_PASSWORD) String mariadbDbPassword, @Optional(DEFAULT_TEST_TABLE) String mariadbTestTable)
+ throws DatabaseServiceException, SQLException {
//System.out.println("@BeforeSuite\n");
mysqlDbConfig = new DatabaseConfiguration();
diff --git a/extensions/database/test/com/google/refine/extension/database/cmd/ConnectCommandTest.java b/extensions/database/test/com/google/refine/extension/database/cmd/ConnectCommandTest.java
index a94f43cab..13463a1bd 100644
--- a/extensions/database/test/com/google/refine/extension/database/cmd/ConnectCommandTest.java
+++ b/extensions/database/test/com/google/refine/extension/database/cmd/ConnectCommandTest.java
@@ -3,12 +3,15 @@ package com.google.refine.extension.database.cmd;
import static org.mockito.Mockito.when;
+import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
+import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.json.JSONException;
import org.json.JSONObject;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -24,6 +27,7 @@ import com.google.refine.extension.database.DatabaseService;
import com.google.refine.extension.database.mysql.MySQLDatabaseService;
+@Test(groups = { "requiresMySQL" })
public class ConnectCommandTest extends DBExtensionTests {
@@ -63,7 +67,7 @@ public class ConnectCommandTest extends DBExtensionTests {
@Test
- public void testDoPost() {
+ public void testDoPost() throws IOException, ServletException, JSONException {
when(request.getParameter("databaseType")).thenReturn(MySQLDatabaseService.DB_NAME);
when(request.getParameter("databaseServer")).thenReturn(testDbConfig.getDatabaseHost());
@@ -75,26 +79,19 @@ public class ConnectCommandTest extends DBExtensionTests {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
- try {
- when(response.getWriter()).thenReturn(pw);
- ConnectCommand connectCommand = new ConnectCommand();
-
- connectCommand.doPost(request, response);
-
- String result = sw.getBuffer().toString().trim();
- JSONObject json = new JSONObject(result);
+ when(response.getWriter()).thenReturn(pw);
+ ConnectCommand connectCommand = new ConnectCommand();
- String code = json.getString("code");
- Assert.assertEquals(code, "ok");
-
- String databaseInfo = json.getString("databaseInfo");
- Assert.assertNotNull(databaseInfo);
+ connectCommand.doPost(request, response);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
+ String result = sw.getBuffer().toString().trim();
+ JSONObject json = new JSONObject(result);
+
+ String code = json.getString("code");
+ Assert.assertEquals(code, "ok");
+
+ String databaseInfo = json.getString("databaseInfo");
+ Assert.assertNotNull(databaseInfo);
}
diff --git a/extensions/database/test/com/google/refine/extension/database/cmd/ExecuteQueryCommandTest.java b/extensions/database/test/com/google/refine/extension/database/cmd/ExecuteQueryCommandTest.java
index 30bcd544f..935c9e04f 100644
--- a/extensions/database/test/com/google/refine/extension/database/cmd/ExecuteQueryCommandTest.java
+++ b/extensions/database/test/com/google/refine/extension/database/cmd/ExecuteQueryCommandTest.java
@@ -2,12 +2,15 @@ package com.google.refine.extension.database.cmd;
import static org.mockito.Mockito.when;
+import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
+import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.json.JSONException;
import org.json.JSONObject;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -22,7 +25,7 @@ import com.google.refine.extension.database.DatabaseConfiguration;
import com.google.refine.extension.database.DatabaseService;
import com.google.refine.extension.database.mysql.MySQLDatabaseService;
-
+@Test(groups = { "requiresMySQL" })
public class ExecuteQueryCommandTest extends DBExtensionTests {
@Mock
@@ -60,7 +63,7 @@ public class ExecuteQueryCommandTest extends DBExtensionTests {
}
@Test
- public void testDoPost() {
+ public void testDoPost() throws IOException, ServletException, JSONException {
when(request.getParameter("databaseType")).thenReturn(testDbConfig.getDatabaseType());
when(request.getParameter("databaseServer")).thenReturn(testDbConfig.getDatabaseHost());
@@ -74,27 +77,20 @@ public class ExecuteQueryCommandTest extends DBExtensionTests {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
-
- try {
- when(response.getWriter()).thenReturn(pw);
- ExecuteQueryCommand executeQueryCommand = new ExecuteQueryCommand();
-
- executeQueryCommand.doPost(request, response);
-
- String result = sw.getBuffer().toString().trim();
- JSONObject json = new JSONObject(result);
-
- String code = json.getString("code");
- Assert.assertEquals(code, "ok");
-
- String queryResult = json.getString("QueryResult");
- Assert.assertNotNull(queryResult);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ when(response.getWriter()).thenReturn(pw);
+ ExecuteQueryCommand executeQueryCommand = new ExecuteQueryCommand();
+
+ executeQueryCommand.doPost(request, response);
+
+ String result = sw.getBuffer().toString().trim();
+ JSONObject json = new JSONObject(result);
+
+ String code = json.getString("code");
+ Assert.assertEquals(code, "ok");
+ String queryResult = json.getString("QueryResult");
+ Assert.assertNotNull(queryResult);
}
}
diff --git a/extensions/database/test/com/google/refine/extension/database/cmd/SavedConnectionCommandTest.java b/extensions/database/test/com/google/refine/extension/database/cmd/SavedConnectionCommandTest.java
index f5f19335f..12ee019f3 100644
--- a/extensions/database/test/com/google/refine/extension/database/cmd/SavedConnectionCommandTest.java
+++ b/extensions/database/test/com/google/refine/extension/database/cmd/SavedConnectionCommandTest.java
@@ -7,6 +7,7 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
+import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -135,7 +136,7 @@ public class SavedConnectionCommandTest extends DBExtensionTests{
}
@Test
- public void testDoPost() {
+ public void testDoPost() throws IOException, ServletException, JSONException {
when(request.getParameter("connectionName")).thenReturn("test-db-name");
when(request.getParameter("databaseType")).thenReturn(MySQLDatabaseService.DB_NAME);
@@ -148,33 +149,24 @@ public class SavedConnectionCommandTest extends DBExtensionTests{
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
- try {
- when(response.getWriter()).thenReturn(pw);
-
- SUT.doPost(request, response);
-
- String result = sw.getBuffer().toString().trim();
-
- JSONObject json = new JSONObject(result);
-
- JSONArray savedConnections = json.getJSONArray("savedConnections");
- Assert.assertNotNull(savedConnections);
-
- int len = savedConnections.length();
-
- Assert.assertEquals(len, 1);
-
-
+ when(response.getWriter()).thenReturn(pw);
+
+ SUT.doPost(request, response);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
+ String result = sw.getBuffer().toString().trim();
+
+ JSONObject json = new JSONObject(result);
+
+ JSONArray savedConnections = json.getJSONArray("savedConnections");
+ Assert.assertNotNull(savedConnections);
+
+ int len = savedConnections.length();
+
+ Assert.assertEquals(len, 1);
}
@Test
- public void testDoGet() {
+ public void testDoGet() throws IOException, ServletException, JSONException {
String testDbName = "testLocalDb";
//add saved connection
saveDatabaseConfiguration(testDbName);
@@ -191,32 +183,25 @@ public class SavedConnectionCommandTest extends DBExtensionTests{
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
- try {
- when(response.getWriter()).thenReturn(pw);
-
- SUT.doGet(request, response);
-
- JSONObject json = new JSONObject(sw.getBuffer().toString().trim());
-
- JSONArray savedConnections = json.getJSONArray("savedConnections");
- Assert.assertNotNull(savedConnections);
-
- Assert.assertEquals(savedConnections.length(), 1);
-
- JSONObject sc = (JSONObject)savedConnections.get(0);
- // System.out.println("sc" + sc);
- String connName = sc.getString("connectionName");
- Assert.assertEquals(connName, testDbName);
-
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ when(response.getWriter()).thenReturn(pw);
+
+ SUT.doGet(request, response);
+
+ JSONObject json = new JSONObject(sw.getBuffer().toString().trim());
+
+ JSONArray savedConnections = json.getJSONArray("savedConnections");
+ Assert.assertNotNull(savedConnections);
+
+ Assert.assertEquals(savedConnections.length(), 1);
+
+ JSONObject sc = (JSONObject)savedConnections.get(0);
+ // System.out.println("sc" + sc);
+ String connName = sc.getString("connectionName");
+ Assert.assertEquals(connName, testDbName);
}
@Test
- public void testDoPut() {
+ public void testDoPut() throws IOException, ServletException, JSONException {
String testDbName = "testLocalDb";
saveDatabaseConfiguration(testDbName);
@@ -224,37 +209,30 @@ public class SavedConnectionCommandTest extends DBExtensionTests{
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
- try {
- when(response.getWriter()).thenReturn(pw);
-
- //modify database config
- String newHost = "localhost";
- when(request.getParameter("connectionName")).thenReturn(testDbName);
- when(request.getParameter("databaseType")).thenReturn(MySQLDatabaseService.DB_NAME);
- when(request.getParameter("databaseServer")).thenReturn(newHost);
- when(request.getParameter("databasePort")).thenReturn("" + testDbConfig.getDatabasePort());
- when(request.getParameter("databaseUser")).thenReturn(testDbConfig.getDatabaseUser());
- when(request.getParameter("databasePassword")).thenReturn(testDbConfig.getDatabasePassword());
- when(request.getParameter("initialDatabase")).thenReturn(testDbConfig.getDatabaseName());
-
- SUT.doPut(request, response);
-
- JSONObject json = new JSONObject(sw.getBuffer().toString().trim());
- JSONArray savedConnections = json.getJSONArray("savedConnections");
- Assert.assertNotNull(savedConnections);
-
- Assert.assertEquals(savedConnections.length(), 1);
-
- JSONObject sc = (JSONObject)savedConnections.get(0);
- System.out.println("sc" + sc);
- String newDbHost = sc.getString("databaseHost");
- Assert.assertEquals(newDbHost, newHost);
-
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ when(response.getWriter()).thenReturn(pw);
+
+ //modify database config
+ String newHost = "localhost";
+ when(request.getParameter("connectionName")).thenReturn(testDbName);
+ when(request.getParameter("databaseType")).thenReturn(MySQLDatabaseService.DB_NAME);
+ when(request.getParameter("databaseServer")).thenReturn(newHost);
+ when(request.getParameter("databasePort")).thenReturn("" + testDbConfig.getDatabasePort());
+ when(request.getParameter("databaseUser")).thenReturn(testDbConfig.getDatabaseUser());
+ when(request.getParameter("databasePassword")).thenReturn(testDbConfig.getDatabasePassword());
+ when(request.getParameter("initialDatabase")).thenReturn(testDbConfig.getDatabaseName());
+
+ SUT.doPut(request, response);
+
+ JSONObject json = new JSONObject(sw.getBuffer().toString().trim());
+ JSONArray savedConnections = json.getJSONArray("savedConnections");
+ Assert.assertNotNull(savedConnections);
+
+ Assert.assertEquals(savedConnections.length(), 1);
+
+ JSONObject sc = (JSONObject)savedConnections.get(0);
+ System.out.println("sc" + sc);
+ String newDbHost = sc.getString("databaseHost");
+ Assert.assertEquals(newDbHost, newHost);
}
@Test
diff --git a/extensions/database/test/com/google/refine/extension/database/cmd/TestConnectCommandTest.java b/extensions/database/test/com/google/refine/extension/database/cmd/TestConnectCommandTest.java
index f59db52b9..178344ada 100644
--- a/extensions/database/test/com/google/refine/extension/database/cmd/TestConnectCommandTest.java
+++ b/extensions/database/test/com/google/refine/extension/database/cmd/TestConnectCommandTest.java
@@ -2,12 +2,15 @@ package com.google.refine.extension.database.cmd;
import static org.mockito.Mockito.when;
+import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
+import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.json.JSONException;
import org.json.JSONObject;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -23,7 +26,7 @@ import com.google.refine.extension.database.DatabaseService;
import com.google.refine.extension.database.mysql.MySQLDatabaseService;
-
+@Test(groups = { "requiresMySQL" })
public class TestConnectCommandTest extends DBExtensionTests{
@Mock
@@ -63,7 +66,7 @@ public class TestConnectCommandTest extends DBExtensionTests{
@Test
- public void testDoPost() {
+ public void testDoPost() throws IOException, ServletException, JSONException {
when(request.getParameter("databaseType")).thenReturn(MySQLDatabaseService.DB_NAME);
when(request.getParameter("databaseServer")).thenReturn(testDbConfig.getDatabaseHost());
@@ -77,23 +80,16 @@ public class TestConnectCommandTest extends DBExtensionTests{
PrintWriter pw = new PrintWriter(sw);
- try {
- when(response.getWriter()).thenReturn(pw);
- TestConnectCommand connectCommand = new TestConnectCommand();
-
- connectCommand.doPost(request, response);
-
- String result = sw.getBuffer().toString().trim();
- JSONObject json = new JSONObject(result);
+ when(response.getWriter()).thenReturn(pw);
+ TestConnectCommand connectCommand = new TestConnectCommand();
- String code = json.getString("code");
- Assert.assertEquals(code, "ok");
-
+ connectCommand.doPost(request, response);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ String result = sw.getBuffer().toString().trim();
+ JSONObject json = new JSONObject(result);
+
+ String code = json.getString("code");
+ Assert.assertEquals(code, "ok");
}
diff --git a/extensions/database/test/com/google/refine/extension/database/cmd/TestQueryCommandTest.java b/extensions/database/test/com/google/refine/extension/database/cmd/TestQueryCommandTest.java
index cd3100af7..8ef3047e6 100644
--- a/extensions/database/test/com/google/refine/extension/database/cmd/TestQueryCommandTest.java
+++ b/extensions/database/test/com/google/refine/extension/database/cmd/TestQueryCommandTest.java
@@ -2,12 +2,15 @@ package com.google.refine.extension.database.cmd;
import static org.mockito.Mockito.when;
+import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
+import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.json.JSONException;
import org.json.JSONObject;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -22,7 +25,7 @@ import com.google.refine.extension.database.DatabaseConfiguration;
import com.google.refine.extension.database.DatabaseService;
import com.google.refine.extension.database.mysql.MySQLDatabaseService;
-
+@Test(groups = { "requiresMySQL" })
public class TestQueryCommandTest extends DBExtensionTests {
@Mock
@@ -61,7 +64,7 @@ public class TestQueryCommandTest extends DBExtensionTests {
@Test
- public void testDoPost() {
+ public void testDoPost() throws IOException, ServletException, JSONException {
when(request.getParameter("databaseType")).thenReturn(testDbConfig.getDatabaseType());
when(request.getParameter("databaseServer")).thenReturn(testDbConfig.getDatabaseHost());
@@ -76,25 +79,19 @@ public class TestQueryCommandTest extends DBExtensionTests {
PrintWriter pw = new PrintWriter(sw);
- try {
- when(response.getWriter()).thenReturn(pw);
- TestQueryCommand executeQueryCommand = new TestQueryCommand();
-
- executeQueryCommand.doPost(request, response);
-
- String result = sw.getBuffer().toString().trim();
- JSONObject json = new JSONObject(result);
+ when(response.getWriter()).thenReturn(pw);
+ TestQueryCommand executeQueryCommand = new TestQueryCommand();
- String code = json.getString("code");
- Assert.assertEquals(code, "ok");
-
- String queryResult = json.getString("QueryResult");
- Assert.assertNotNull(queryResult);
+ executeQueryCommand.doPost(request, response);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ String result = sw.getBuffer().toString().trim();
+ JSONObject json = new JSONObject(result);
+
+ String code = json.getString("code");
+ Assert.assertEquals(code, "ok");
+
+ String queryResult = json.getString("QueryResult");
+ Assert.assertNotNull(queryResult);
}
diff --git a/extensions/database/test/com/google/refine/extension/database/mariadb/MariaDBConnectionManagerTest.java b/extensions/database/test/com/google/refine/extension/database/mariadb/MariaDBConnectionManagerTest.java
index a02d44a4f..ba1aeb849 100644
--- a/extensions/database/test/com/google/refine/extension/database/mariadb/MariaDBConnectionManagerTest.java
+++ b/extensions/database/test/com/google/refine/extension/database/mariadb/MariaDBConnectionManagerTest.java
@@ -1,6 +1,7 @@
package com.google.refine.extension.database.mariadb;
import java.sql.Connection;
+import java.sql.SQLException;
import org.mockito.MockitoAnnotations;
import org.testng.Assert;
@@ -14,7 +15,7 @@ import com.google.refine.extension.database.DatabaseConfiguration;
import com.google.refine.extension.database.DatabaseService;
import com.google.refine.extension.database.DatabaseServiceException;
-
+@Test(groups = { "requiresMariaDB" })
public class MariaDBConnectionManagerTest extends DBExtensionTests {
@@ -48,48 +49,27 @@ public class MariaDBConnectionManagerTest extends DBExtensionTests {
@Test
- public void testTestConnection() {
-
- try {
- boolean conn = MariaDBConnectionManager.getInstance().testConnection(testDbConfig);
- Assert.assertEquals(conn, true);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ public void testTestConnection() throws DatabaseServiceException {
+ boolean conn = MariaDBConnectionManager.getInstance().testConnection(testDbConfig);
+ Assert.assertEquals(conn, true);
}
@Test
- public void testGetConnection() {
-
- try {
- Connection conn = MariaDBConnectionManager.getInstance().getConnection(testDbConfig, true);
- Assert.assertNotNull(conn);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ public void testGetConnection() throws DatabaseServiceException {
+ Connection conn = MariaDBConnectionManager.getInstance().getConnection(testDbConfig, true);
+ Assert.assertNotNull(conn);
}
@Test
- public void testShutdown() {
-
- try {
- Connection conn = MariaDBConnectionManager.getInstance().getConnection(testDbConfig, true);
- Assert.assertNotNull(conn);
-
- MariaDBConnectionManager.getInstance().shutdown();
-
- if(conn != null) {
- Assert.assertEquals(conn.isClosed(), true);
- }
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ public void testShutdown() throws DatabaseServiceException, SQLException {
+ Connection conn = MariaDBConnectionManager.getInstance().getConnection(testDbConfig, true);
+ Assert.assertNotNull(conn);
+
+ MariaDBConnectionManager.getInstance().shutdown();
+
+ if(conn != null) {
+ Assert.assertEquals(conn.isClosed(), true);
+ }
}
diff --git a/extensions/database/test/com/google/refine/extension/database/mariadb/MariaDBDatabaseServiceTest.java b/extensions/database/test/com/google/refine/extension/database/mariadb/MariaDBDatabaseServiceTest.java
index 3456954e2..927eb05d8 100644
--- a/extensions/database/test/com/google/refine/extension/database/mariadb/MariaDBDatabaseServiceTest.java
+++ b/extensions/database/test/com/google/refine/extension/database/mariadb/MariaDBDatabaseServiceTest.java
@@ -19,7 +19,7 @@ import com.google.refine.extension.database.model.DatabaseColumn;
import com.google.refine.extension.database.model.DatabaseInfo;
import com.google.refine.extension.database.model.DatabaseRow;
-
+@Test(groups = { "requiresMariaDB" })
public class MariaDBDatabaseServiceTest extends DBExtensionTests{
@@ -63,60 +63,35 @@ public class MariaDBDatabaseServiceTest extends DBExtensionTests{
}
@Test
- public void testGetConnection() {
- try {
-
- MariaDBDatabaseService pgSqlService = (MariaDBDatabaseService)DatabaseService.get(MariaDBDatabaseService.DB_NAME);
- Connection conn = pgSqlService.getConnection(testDbConfig);
-
- Assert.assertNotNull(conn);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ public void testGetConnection() throws DatabaseServiceException {
+ MariaDBDatabaseService pgSqlService = (MariaDBDatabaseService)DatabaseService.get(MariaDBDatabaseService.DB_NAME);
+ Connection conn = pgSqlService.getConnection(testDbConfig);
+
+ Assert.assertNotNull(conn);
}
@Test
- public void testTestConnection() {
- try {
- MariaDBDatabaseService pgSqlService = (MariaDBDatabaseService)DatabaseService.get(MariaDBDatabaseService.DB_NAME);
-
- boolean result = pgSqlService.testConnection(testDbConfig);
- Assert.assertEquals(result, true);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ public void testTestConnection() throws DatabaseServiceException {
+ MariaDBDatabaseService pgSqlService = (MariaDBDatabaseService)DatabaseService.get(MariaDBDatabaseService.DB_NAME);
+
+ boolean result = pgSqlService.testConnection(testDbConfig);
+ Assert.assertEquals(result, true);
}
@Test
- public void testConnect() {
- try {
- MariaDBDatabaseService pgSqlService = (MariaDBDatabaseService)DatabaseService.get(MariaDBDatabaseService.DB_NAME);
- DatabaseInfo databaseInfo = pgSqlService.connect(testDbConfig);
- Assert.assertNotNull(databaseInfo);
-
- } catch (DatabaseServiceException e) {
- e.printStackTrace();
- }
+ public void testConnect() throws DatabaseServiceException {
+ MariaDBDatabaseService pgSqlService = (MariaDBDatabaseService)DatabaseService.get(MariaDBDatabaseService.DB_NAME);
+ DatabaseInfo databaseInfo = pgSqlService.connect(testDbConfig);
+ Assert.assertNotNull(databaseInfo);
}
@Test
- public void testExecuteQuery() {
+ public void testExecuteQuery() throws DatabaseServiceException {
+ MariaDBDatabaseService pgSqlService = (MariaDBDatabaseService) DatabaseService
+ .get(MariaDBDatabaseService.DB_NAME);
+ DatabaseInfo databaseInfo = pgSqlService.testQuery(testDbConfig, "SELECT * FROM " + testTable);
- try {
-
- MariaDBDatabaseService pgSqlService = (MariaDBDatabaseService) DatabaseService
- .get(MariaDBDatabaseService.DB_NAME);
- DatabaseInfo databaseInfo = pgSqlService.testQuery(testDbConfig, "SELECT * FROM " + testTable);
-
- Assert.assertNotNull(databaseInfo);
-
- } catch (DatabaseServiceException e) {
- e.printStackTrace();
- }
+ Assert.assertNotNull(databaseInfo);
}
@Test
@@ -130,18 +105,12 @@ public class MariaDBDatabaseServiceTest extends DBExtensionTests{
}
@Test
- public void testGetRows() {
- try {
- MariaDBDatabaseService pgSqlService = (MariaDBDatabaseService) DatabaseService
+ public void testGetRows() throws DatabaseServiceException {
+ MariaDBDatabaseService pgSqlService = (MariaDBDatabaseService) DatabaseService
.get(MariaDBDatabaseService.DB_NAME);
List dbRows = pgSqlService.getRows(testDbConfig, "SELECT * FROM " + testTable);
Assert.assertNotNull(dbRows);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
}
@Test
@@ -151,21 +120,15 @@ public class MariaDBDatabaseServiceTest extends DBExtensionTests{
}
@Test
- public void testGetColumns() {
+ public void testGetColumns() throws DatabaseServiceException {
List dbColumns;
- try {
- MariaDBDatabaseService pgSqlService = (MariaDBDatabaseService) DatabaseService
- .get(MariaDBDatabaseService.DB_NAME);
+ MariaDBDatabaseService pgSqlService = (MariaDBDatabaseService) DatabaseService
+ .get(MariaDBDatabaseService.DB_NAME);
- dbColumns = pgSqlService.getColumns(testDbConfig, "SELECT * FROM " + testTable);
+ dbColumns = pgSqlService.getColumns(testDbConfig, "SELECT * FROM " + testTable);
- Assert.assertNotNull(dbColumns);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ Assert.assertNotNull(dbColumns);
}
diff --git a/extensions/database/test/com/google/refine/extension/database/mysql/MySQLConnectionManagerTest.java b/extensions/database/test/com/google/refine/extension/database/mysql/MySQLConnectionManagerTest.java
index 70b560e7d..bd01aba75 100644
--- a/extensions/database/test/com/google/refine/extension/database/mysql/MySQLConnectionManagerTest.java
+++ b/extensions/database/test/com/google/refine/extension/database/mysql/MySQLConnectionManagerTest.java
@@ -1,6 +1,7 @@
package com.google.refine.extension.database.mysql;
import java.sql.Connection;
+import java.sql.SQLException;
import org.mockito.MockitoAnnotations;
import org.testng.Assert;
@@ -14,6 +15,7 @@ import com.google.refine.extension.database.DatabaseConfiguration;
import com.google.refine.extension.database.DatabaseService;
import com.google.refine.extension.database.DatabaseServiceException;
+@Test(groups = { "requiresMySQL" })
public class MySQLConnectionManagerTest extends DBExtensionTests {
private DatabaseConfiguration testDbConfig;
@@ -45,49 +47,30 @@ public class MySQLConnectionManagerTest extends DBExtensionTests {
@Test
- public void testTestConnection() {
+ public void testTestConnection() throws DatabaseServiceException {
- try {
- boolean conn = MySQLConnectionManager.getInstance().testConnection(testDbConfig);
- Assert.assertEquals(conn, true);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ boolean conn = MySQLConnectionManager.getInstance().testConnection(testDbConfig);
+ Assert.assertEquals(conn, true);
}
@Test
- public void testGetConnection() {
+ public void testGetConnection() throws DatabaseServiceException {
- try {
- Connection conn = MySQLConnectionManager.getInstance().getConnection(testDbConfig, true);
- Assert.assertNotNull(conn);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ Connection conn = MySQLConnectionManager.getInstance().getConnection(testDbConfig, true);
+ Assert.assertNotNull(conn);
}
@Test
- public void testShutdown() {
+ public void testShutdown() throws DatabaseServiceException, SQLException {
- try {
- Connection conn = MySQLConnectionManager.getInstance().getConnection(testDbConfig, true);
- Assert.assertNotNull(conn);
-
- MySQLConnectionManager.getInstance().shutdown();
-
- if(conn != null) {
- Assert.assertEquals(conn.isClosed(), true);
- }
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
+ Connection conn = MySQLConnectionManager.getInstance().getConnection(testDbConfig, true);
+ Assert.assertNotNull(conn);
+
+ MySQLConnectionManager.getInstance().shutdown();
+
+ if(conn != null) {
+ Assert.assertEquals(conn.isClosed(), true);
+ }
}
}
diff --git a/extensions/database/test/com/google/refine/extension/database/mysql/MySQLDatabaseServiceTest.java b/extensions/database/test/com/google/refine/extension/database/mysql/MySQLDatabaseServiceTest.java
index ba51f3676..653d468df 100644
--- a/extensions/database/test/com/google/refine/extension/database/mysql/MySQLDatabaseServiceTest.java
+++ b/extensions/database/test/com/google/refine/extension/database/mysql/MySQLDatabaseServiceTest.java
@@ -20,7 +20,7 @@ import com.google.refine.extension.database.model.DatabaseInfo;
import com.google.refine.extension.database.model.DatabaseRow;
-
+@Test(groups = { "requiresMySQL" })
public class MySQLDatabaseServiceTest extends DBExtensionTests{
private DatabaseConfiguration testDbConfig;
@@ -62,60 +62,36 @@ public class MySQLDatabaseServiceTest extends DBExtensionTests{
@Test
- public void testGetConnection() {
- try {
-
- MySQLDatabaseService pgSqlService = (MySQLDatabaseService)DatabaseService.get(MySQLDatabaseService.DB_NAME);
- Connection conn = pgSqlService.getConnection(testDbConfig);
-
- Assert.assertNotNull(conn);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ public void testGetConnection() throws DatabaseServiceException {
+ MySQLDatabaseService pgSqlService = (MySQLDatabaseService)DatabaseService.get(MySQLDatabaseService.DB_NAME);
+ Connection conn = pgSqlService.getConnection(testDbConfig);
+
+ Assert.assertNotNull(conn);
}
@Test
- public void testTestConnection() {
- try {
- MySQLDatabaseService pgSqlService = (MySQLDatabaseService)DatabaseService.get(MySQLDatabaseService.DB_NAME);
-
- boolean result = pgSqlService.testConnection(testDbConfig);
- Assert.assertEquals(result, true);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ public void testTestConnection() throws DatabaseServiceException {
+ MySQLDatabaseService pgSqlService = (MySQLDatabaseService)DatabaseService.get(MySQLDatabaseService.DB_NAME);
+
+ boolean result = pgSqlService.testConnection(testDbConfig);
+ Assert.assertEquals(result, true);
}
@Test
- public void testConnect() {
- try {
- MySQLDatabaseService pgSqlService = (MySQLDatabaseService)DatabaseService.get(MySQLDatabaseService.DB_NAME);
- DatabaseInfo databaseInfo = pgSqlService.connect(testDbConfig);
- Assert.assertNotNull(databaseInfo);
-
- } catch (DatabaseServiceException e) {
- e.printStackTrace();
- }
+ public void testConnect() throws DatabaseServiceException {
+ MySQLDatabaseService pgSqlService = (MySQLDatabaseService)DatabaseService.get(MySQLDatabaseService.DB_NAME);
+ DatabaseInfo databaseInfo = pgSqlService.connect(testDbConfig);
+ Assert.assertNotNull(databaseInfo);
}
@Test
- public void testExecuteQuery() {
+ public void testExecuteQuery() throws DatabaseServiceException {
- try {
+ MySQLDatabaseService pgSqlService = (MySQLDatabaseService) DatabaseService
+ .get(MySQLDatabaseService.DB_NAME);
+ DatabaseInfo databaseInfo = pgSqlService.testQuery(testDbConfig, "SELECT * FROM " + testTable);
- MySQLDatabaseService pgSqlService = (MySQLDatabaseService) DatabaseService
- .get(MySQLDatabaseService.DB_NAME);
- DatabaseInfo databaseInfo = pgSqlService.testQuery(testDbConfig, "SELECT * FROM " + testTable);
-
- Assert.assertNotNull(databaseInfo);
-
- } catch (DatabaseServiceException e) {
- e.printStackTrace();
- }
+ Assert.assertNotNull(databaseInfo);
}
@Test
@@ -129,18 +105,12 @@ public class MySQLDatabaseServiceTest extends DBExtensionTests{
}
@Test
- public void testGetRows() {
- try {
- MySQLDatabaseService pgSqlService = (MySQLDatabaseService) DatabaseService
- .get(MySQLDatabaseService.DB_NAME);
- List dbRows = pgSqlService.getRows(testDbConfig, "SELECT * FROM " + testTable);
+ public void testGetRows() throws DatabaseServiceException {
+ MySQLDatabaseService pgSqlService = (MySQLDatabaseService) DatabaseService
+ .get(MySQLDatabaseService.DB_NAME);
+ List dbRows = pgSqlService.getRows(testDbConfig, "SELECT * FROM " + testTable);
- Assert.assertNotNull(dbRows);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ Assert.assertNotNull(dbRows);
}
@Test
@@ -150,21 +120,14 @@ public class MySQLDatabaseServiceTest extends DBExtensionTests{
}
@Test
- public void testGetColumns() {
+ public void testGetColumns() throws DatabaseServiceException {
List dbColumns;
+ MySQLDatabaseService pgSqlService = (MySQLDatabaseService) DatabaseService
+ .get(MySQLDatabaseService.DB_NAME);
- try {
- MySQLDatabaseService pgSqlService = (MySQLDatabaseService) DatabaseService
- .get(MySQLDatabaseService.DB_NAME);
+ dbColumns = pgSqlService.getColumns(testDbConfig, "SELECT * FROM " + testTable);
- dbColumns = pgSqlService.getColumns(testDbConfig, "SELECT * FROM " + testTable);
-
- Assert.assertNotNull(dbColumns);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ Assert.assertNotNull(dbColumns);
}
diff --git a/extensions/database/test/com/google/refine/extension/database/pgsql/PgSQLConnectionManagerTest.java b/extensions/database/test/com/google/refine/extension/database/pgsql/PgSQLConnectionManagerTest.java
index 09b18bd11..4c4d744d8 100644
--- a/extensions/database/test/com/google/refine/extension/database/pgsql/PgSQLConnectionManagerTest.java
+++ b/extensions/database/test/com/google/refine/extension/database/pgsql/PgSQLConnectionManagerTest.java
@@ -1,6 +1,7 @@
package com.google.refine.extension.database.pgsql;
import java.sql.Connection;
+import java.sql.SQLException;
import org.mockito.MockitoAnnotations;
import org.testng.Assert;
@@ -15,7 +16,7 @@ import com.google.refine.extension.database.DatabaseService;
import com.google.refine.extension.database.DatabaseServiceException;
-
+@Test(groups = { "requiresPgSQL" })
public class PgSQLConnectionManagerTest extends DBExtensionTests {
private DatabaseConfiguration testDbConfig;
@@ -48,48 +49,30 @@ public class PgSQLConnectionManagerTest extends DBExtensionTests {
@Test
- public void testTestConnection() {
+ public void testTestConnection() throws DatabaseServiceException {
- try {
- boolean isConnected = PgSQLConnectionManager.getInstance().testConnection(testDbConfig);
- Assert.assertEquals(isConnected, true);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ boolean isConnected = PgSQLConnectionManager.getInstance().testConnection(testDbConfig);
+ Assert.assertEquals(isConnected, true);
}
@Test
- public void testGetConnection() {
+ public void testGetConnection() throws DatabaseServiceException {
- try {
- Connection conn = PgSQLConnectionManager.getInstance().getConnection(testDbConfig, true);
- Assert.assertNotNull(conn);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ Connection conn = PgSQLConnectionManager.getInstance().getConnection(testDbConfig, true);
+ Assert.assertNotNull(conn);
}
@Test
- public void testShutdown() {
+ public void testShutdown() throws DatabaseServiceException, SQLException {
- try {
- Connection conn = PgSQLConnectionManager.getInstance().getConnection(testDbConfig, true);
- Assert.assertNotNull(conn);
-
- PgSQLConnectionManager.getInstance().shutdown();
-
- if(conn != null) {
- Assert.assertEquals(conn.isClosed(), true);
- }
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ Connection conn = PgSQLConnectionManager.getInstance().getConnection(testDbConfig, true);
+ Assert.assertNotNull(conn);
+
+ PgSQLConnectionManager.getInstance().shutdown();
+
+ if(conn != null) {
+ Assert.assertEquals(conn.isClosed(), true);
+ }
}
diff --git a/extensions/database/test/com/google/refine/extension/database/pgsql/PgSQLDatabaseServiceTest.java b/extensions/database/test/com/google/refine/extension/database/pgsql/PgSQLDatabaseServiceTest.java
index 78b1ca8d2..161d669b7 100644
--- a/extensions/database/test/com/google/refine/extension/database/pgsql/PgSQLDatabaseServiceTest.java
+++ b/extensions/database/test/com/google/refine/extension/database/pgsql/PgSQLDatabaseServiceTest.java
@@ -19,7 +19,7 @@ import com.google.refine.extension.database.model.DatabaseColumn;
import com.google.refine.extension.database.model.DatabaseInfo;
import com.google.refine.extension.database.model.DatabaseRow;
-
+@Test(groups = { "requiresPgSQL" })
public class PgSQLDatabaseServiceTest extends DBExtensionTests{
private DatabaseConfiguration testDbConfig;
@@ -61,60 +61,38 @@ public class PgSQLDatabaseServiceTest extends DBExtensionTests{
@Test
- public void testGetConnection() {
- try {
-
- PgSQLDatabaseService pgSqlService = (PgSQLDatabaseService)DatabaseService.get(PgSQLDatabaseService.DB_NAME);
- Connection conn = pgSqlService.getConnection(testDbConfig);
-
- Assert.assertNotNull(conn);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ public void testGetConnection() throws DatabaseServiceException {
+
+ PgSQLDatabaseService pgSqlService = (PgSQLDatabaseService)DatabaseService.get(PgSQLDatabaseService.DB_NAME);
+ Connection conn = pgSqlService.getConnection(testDbConfig);
+
+ Assert.assertNotNull(conn);
}
@Test
- public void testTestConnection() {
- try {
- PgSQLDatabaseService pgSqlService = (PgSQLDatabaseService)DatabaseService.get(PgSQLDatabaseService.DB_NAME);
-
- boolean result = pgSqlService.testConnection(testDbConfig);
- Assert.assertEquals(result, true);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ public void testTestConnection() throws DatabaseServiceException {
+ PgSQLDatabaseService pgSqlService = (PgSQLDatabaseService)DatabaseService.get(PgSQLDatabaseService.DB_NAME);
+
+ boolean result = pgSqlService.testConnection(testDbConfig);
+ Assert.assertEquals(result, true);
}
@Test
- public void testConnect() {
- try {
- PgSQLDatabaseService pgSqlService = (PgSQLDatabaseService)DatabaseService.get(PgSQLDatabaseService.DB_NAME);
- DatabaseInfo databaseInfo = pgSqlService.connect(testDbConfig);
- Assert.assertNotNull(databaseInfo);
-
- } catch (DatabaseServiceException e) {
- e.printStackTrace();
- }
+ public void testConnect() throws DatabaseServiceException {
+
+ PgSQLDatabaseService pgSqlService = (PgSQLDatabaseService)DatabaseService.get(PgSQLDatabaseService.DB_NAME);
+ DatabaseInfo databaseInfo = pgSqlService.connect(testDbConfig);
+ Assert.assertNotNull(databaseInfo);
}
@Test
- public void testExecuteQuery() {
+ public void testExecuteQuery() throws DatabaseServiceException {
- try {
+ PgSQLDatabaseService pgSqlService = (PgSQLDatabaseService) DatabaseService
+ .get(PgSQLDatabaseService.DB_NAME);
+ DatabaseInfo databaseInfo = pgSqlService.testQuery(testDbConfig, "SELECT * FROM " + testTable);
- PgSQLDatabaseService pgSqlService = (PgSQLDatabaseService) DatabaseService
- .get(PgSQLDatabaseService.DB_NAME);
- DatabaseInfo databaseInfo = pgSqlService.testQuery(testDbConfig, "SELECT * FROM " + testTable);
-
- Assert.assertNotNull(databaseInfo);
-
- } catch (DatabaseServiceException e) {
- e.printStackTrace();
- }
+ Assert.assertNotNull(databaseInfo);
}
@Test
@@ -128,18 +106,12 @@ public class PgSQLDatabaseServiceTest extends DBExtensionTests{
}
@Test
- public void testGetRows() {
- try {
- PgSQLDatabaseService pgSqlService = (PgSQLDatabaseService) DatabaseService
- .get(PgSQLDatabaseService.DB_NAME);
- List dbRows = pgSqlService.getRows(testDbConfig, "SELECT * FROM " + testTable);
+ public void testGetRows() throws DatabaseServiceException {
+ PgSQLDatabaseService pgSqlService = (PgSQLDatabaseService) DatabaseService
+ .get(PgSQLDatabaseService.DB_NAME);
+ List dbRows = pgSqlService.getRows(testDbConfig, "SELECT * FROM " + testTable);
- Assert.assertNotNull(dbRows);
-
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ Assert.assertNotNull(dbRows);
}
@Test
@@ -149,21 +121,16 @@ public class PgSQLDatabaseServiceTest extends DBExtensionTests{
}
@Test
- public void testGetColumns() {
+ public void testGetColumns() throws DatabaseServiceException {
List dbColumns;
- try {
- PgSQLDatabaseService pgSqlService = (PgSQLDatabaseService) DatabaseService
- .get(PgSQLDatabaseService.DB_NAME);
+ PgSQLDatabaseService pgSqlService = (PgSQLDatabaseService) DatabaseService
+ .get(PgSQLDatabaseService.DB_NAME);
- dbColumns = pgSqlService.getColumns(testDbConfig, "SELECT * FROM " + testTable);
+ dbColumns = pgSqlService.getColumns(testDbConfig, "SELECT * FROM " + testTable);
- Assert.assertNotNull(dbColumns);
+ Assert.assertNotNull(dbColumns);
- } catch (DatabaseServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
}
diff --git a/extensions/database/test/conf/appveyor_tests.xml b/extensions/database/test/conf/appveyor_tests.xml
new file mode 100644
index 000000000..1d906be12
--- /dev/null
+++ b/extensions/database/test/conf/appveyor_tests.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/extensions/database/test/conf/tests.xml b/extensions/database/test/conf/tests.xml
new file mode 100644
index 000000000..f14cc34ad
--- /dev/null
+++ b/extensions/database/test/conf/tests.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/extensions/database/test/conf/int_tests.xml b/extensions/database/test/conf/travis_tests.xml
similarity index 100%
rename from extensions/database/test/conf/int_tests.xml
rename to extensions/database/test/conf/travis_tests.xml
diff --git a/extensions/database/test/conf/unit_tests.xml b/extensions/database/test/conf/unit_tests.xml
deleted file mode 100644
index 795fa3a03..000000000
--- a/extensions/database/test/conf/unit_tests.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file