TR1394-fixed test cases

This commit is contained in:
TonyO 2018-01-12 22:54:20 -06:00
parent 6bd932fd9a
commit 524c1a32f9
14 changed files with 26 additions and 63 deletions

View File

@ -76,7 +76,9 @@ public class DBQueryResultImportReader implements TableDataReader {
this.dbColumns = columns;
this.databaseService = databaseService;
this.dbQueryInfo = dbQueryInfo;
logger.info("batchSize:" + batchSize);
if(logger.isDebugEnabled()) {
logger.debug("batchSize:" + batchSize);
}
}
@ -119,7 +121,7 @@ public class DBQueryResultImportReader implements TableDataReader {
}
if(processedRows % 10000 == 0) {
if(logger.isDebugEnabled()) {
logger.debug("[[ {} rows processed... ]]",processedRows);
logger.debug("[[ {} rows processed... ]]",processedRows);
}
}
}

View File

@ -465,7 +465,9 @@ public class DatabaseImportController implements ImportingController {
jdbcConfig.setDatabaseSchema(request.getParameter("initialSchema"));
String query = request.getParameter("query");
logger.info("jdbcConfig::{}, query::{}", jdbcConfig, query);
if(logger.isDebugEnabled()) {
logger.debug("jdbcConfig::{}, query::{}", jdbcConfig, query);
}
if (jdbcConfig.getDatabaseHost() == null || jdbcConfig.getDatabaseName() == null
|| jdbcConfig.getDatabasePassword() == null || jdbcConfig.getDatabaseType() == null
|| jdbcConfig.getDatabaseUser() == null || query == null) {

View File

@ -182,7 +182,9 @@ public class DatabaseUtils {
public static void deleteAllSavedConnections() {
logger.info("delete All Saved Connections called...");
if(logger.isDebugEnabled()) {
logger.debug("delete All Saved Connections called...");
}
try {
@ -221,8 +223,9 @@ public class DatabaseUtils {
* @param connectionName
*/
public static void deleteSavedConnections(String connectionName) {
logger.info("deleteSavedConnections called with: {}", connectionName);
if(logger.isDebugEnabled()) {
logger.debug("deleteSavedConnections called with: {}", connectionName);
}
try {

View File

@ -91,7 +91,7 @@ public class SavedConnectionCommand extends DatabaseCommand {
DatabaseConfiguration savedConn = DatabaseUtils.getSavedConnection(connectionName);
if(savedConn == null) {
logger.error("Connection With name:: {} does not exist!", request.getParameter("connectionName"));
//logger.error("Connection With name:: {} does not exist!", request.getParameter("connectionName"));
response.sendError(HttpStatus.SC_BAD_REQUEST, "Connection with name " + connectionName + " does not exists!");
response.flushBuffer();
return;
@ -246,7 +246,7 @@ public class SavedConnectionCommand extends DatabaseCommand {
throws ServletException, IOException {
if(logger.isDebugEnabled()) {
logger.info("doPost Connection: {}", request.getParameter("connectionName"));
logger.debug("doPost Connection: {}", request.getParameter("connectionName"));
}
DatabaseConfiguration jdbcConfig = getJdbcConfiguration(request);
@ -297,7 +297,7 @@ public class SavedConnectionCommand extends DatabaseCommand {
if(logger.isDebugEnabled()) {
logger.debug("databaseType::{} " , request.getParameter("databaseHost"));
}
logger.info("databaseHost::{} " , request.getParameter("databaseServer"));
// logger.info("databaseHost::{} " , request.getParameter("databaseServer"));
DatabaseConfiguration jdbcConfig = getJdbcConfiguration(request);
StringBuilder sb = new StringBuilder();

View File

@ -51,17 +51,12 @@ public class DatabaseServiceTest extends DBExtensionTests{
}
// @AfterSuite
// public void afterSuite() {
// DBExtensionTestUtils.cleanUpTestData(testDbConfig);
//
// }
@Test
public void testGetDatabaseUrl() {
DatabaseService dbService = DatabaseService.get(testDbConfig.getDatabaseType());
String dbUrl = dbService.getDatabaseUrl(testDbConfig);
// System.out.println("dbUrl:" + dbUrl);
Assert.assertNotNull(dbUrl);
Assert.assertEquals(dbUrl, DBExtensionTestUtils.getJDBCUrl(testDbConfig));
}
@ -99,7 +94,6 @@ public class DatabaseServiceTest extends DBExtensionTests{
DatabaseService dbService = DatabaseService.get(testDbConfig.getDatabaseType());
Connection conn = dbService.getConnection(testDbConfig);
//System.out.println("conn:" + conn);
Assert.assertNotNull(conn);
} catch (DatabaseServiceException e) {
@ -173,7 +167,7 @@ public class DatabaseServiceTest extends DBExtensionTests{
Assert.assertNotNull(dbColumns);
int cols = dbColumns.size();
Assert.assertEquals(cols, 3);
Assert.assertEquals(cols, 10);
} catch (DatabaseServiceException e) {

View File

@ -44,7 +44,7 @@ public class ConnectCommandTest extends DBExtensionTests {
@Optional(DEFAULT_MYSQL_PASSWORD) String mySqlDbPassword, @Optional(DEFAULT_TEST_TABLE) String mySqlTestTable) {
MockitoAnnotations.initMocks(this);
// System.out.println("beforeTest " + pgSqlDbName);
testDbConfig = new DatabaseConfiguration();
testDbConfig.setDatabaseHost(mySqlDbHost);
testDbConfig.setDatabaseName(mySqlDbName);
@ -60,13 +60,7 @@ public class ConnectCommandTest extends DBExtensionTests {
DatabaseService.DBType.registerDatabase(MySQLDatabaseService.DB_NAME, MySQLDatabaseService.getInstance());
}
// @AfterSuite
// public void afterSuite() {
// DBExtensionTestUtils.cleanUpTestData(testDbConfig);
//
// }
//
@Test
public void testDoPost() {

View File

@ -58,13 +58,6 @@ public class ExecuteQueryCommandTest extends DBExtensionTests {
DatabaseService.DBType.registerDatabase(MySQLDatabaseService.DB_NAME, MySQLDatabaseService.getInstance());
}
//
// @AfterSuite
// public void afterSuite() {
// DBExtensionTestUtils.cleanUpTestData(testDbConfig);
//
// }
@Test
public void testDoPost() {

View File

@ -60,11 +60,7 @@ public class TestConnectCommandTest extends DBExtensionTests{
}
// @AfterSuite
// public void afterSuite() {
// DBExtensionTestUtils.cleanUpTestData(testDbConfig);
//
// }
@Test
public void testDoPost() {

View File

@ -59,12 +59,6 @@ public class TestQueryCommandTest extends DBExtensionTests {
}
// @AfterSuite
// public void afterSuite() {
// DBExtensionTestUtils.cleanUpTestData(testDbConfig);
//
// }
@Test
public void testDoPost() {

View File

@ -46,12 +46,7 @@ public class MariaDBConnectionManagerTest extends DBExtensionTests {
}
// @AfterSuite
// public void afterSuite() {
// DBExtensionTestUtils.cleanUpTestData(testDbConfig);
//
// }
@Test
public void testTestConnection() {

View File

@ -168,10 +168,5 @@ public class MariaDBDatabaseServiceTest extends DBExtensionTests{
}
}
// @AfterSuite
// public void afterSuite() {
// DBExtensionTestUtils.cleanUpTestData(testDbConfig);
// logger.info("<<After Suite Cleanup>>");
// }
}

View File

@ -43,11 +43,7 @@ public class MySQLConnectionManagerTest extends DBExtensionTests {
}
// @AfterSuite
// public void afterSuite() {
// DBExtensionTestUtils.cleanUpTestData(testDbConfig);
// }
//
@Test
public void testTestConnection() {

View File

@ -28,7 +28,7 @@ public class PgSQLConnectionManagerTest extends DBExtensionTests {
@Optional(DEFAULT_PGSQL_PASSWORD) String pgSqlDbPassword, @Optional(DEFAULT_TEST_TABLE) String pgSqlTestTable) {
MockitoAnnotations.initMocks(this);
// System.out.println("beforeTest " + pgSqlDbName);
testDbConfig = new DatabaseConfiguration();
testDbConfig.setDatabaseHost(pgSqlDbHost);
testDbConfig.setDatabaseName(pgSqlDbName);

View File

@ -33,7 +33,6 @@ public class PgSQLDatabaseServiceTest extends DBExtensionTests{
@Optional(DEFAULT_PGSQL_PASSWORD) String pgSqlDbPassword, @Optional(DEFAULT_TEST_TABLE) String pgSqlTestTable) {
MockitoAnnotations.initMocks(this);
// System.out.println("beforeTest " + pgSqlDbName);
testDbConfig = new DatabaseConfiguration();
testDbConfig.setDatabaseHost(pgSqlDbHost);
testDbConfig.setDatabaseName(pgSqlDbName);
@ -55,7 +54,7 @@ public class PgSQLDatabaseServiceTest extends DBExtensionTests{
public void testGetDatabaseUrl() {
PgSQLDatabaseService pgSqlService = (PgSQLDatabaseService)DatabaseService.get(PgSQLDatabaseService.DB_NAME);
String dbUrl = pgSqlService.getDatabaseUrl(testDbConfig);
System.out.println("dbUrl:" + dbUrl);
Assert.assertNotNull(dbUrl);
Assert.assertEquals(dbUrl, DBExtensionTestUtils.getJDBCUrl(testDbConfig));
}