TR1394-fixed test cases
This commit is contained in:
parent
6bd932fd9a
commit
524c1a32f9
@ -76,7 +76,9 @@ public class DBQueryResultImportReader implements TableDataReader {
|
|||||||
this.dbColumns = columns;
|
this.dbColumns = columns;
|
||||||
this.databaseService = databaseService;
|
this.databaseService = databaseService;
|
||||||
this.dbQueryInfo = dbQueryInfo;
|
this.dbQueryInfo = dbQueryInfo;
|
||||||
logger.info("batchSize:" + batchSize);
|
if(logger.isDebugEnabled()) {
|
||||||
|
logger.debug("batchSize:" + batchSize);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,7 +465,9 @@ public class DatabaseImportController implements ImportingController {
|
|||||||
jdbcConfig.setDatabaseSchema(request.getParameter("initialSchema"));
|
jdbcConfig.setDatabaseSchema(request.getParameter("initialSchema"));
|
||||||
|
|
||||||
String query = request.getParameter("query");
|
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
|
if (jdbcConfig.getDatabaseHost() == null || jdbcConfig.getDatabaseName() == null
|
||||||
|| jdbcConfig.getDatabasePassword() == null || jdbcConfig.getDatabaseType() == null
|
|| jdbcConfig.getDatabasePassword() == null || jdbcConfig.getDatabaseType() == null
|
||||||
|| jdbcConfig.getDatabaseUser() == null || query == null) {
|
|| jdbcConfig.getDatabaseUser() == null || query == null) {
|
||||||
|
@ -182,7 +182,9 @@ public class DatabaseUtils {
|
|||||||
|
|
||||||
|
|
||||||
public static void deleteAllSavedConnections() {
|
public static void deleteAllSavedConnections() {
|
||||||
logger.info("delete All Saved Connections called...");
|
if(logger.isDebugEnabled()) {
|
||||||
|
logger.debug("delete All Saved Connections called...");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@ -221,8 +223,9 @@ public class DatabaseUtils {
|
|||||||
* @param connectionName
|
* @param connectionName
|
||||||
*/
|
*/
|
||||||
public static void deleteSavedConnections(String connectionName) {
|
public static void deleteSavedConnections(String connectionName) {
|
||||||
|
if(logger.isDebugEnabled()) {
|
||||||
logger.info("deleteSavedConnections called with: {}", connectionName);
|
logger.debug("deleteSavedConnections called with: {}", connectionName);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ public class SavedConnectionCommand extends DatabaseCommand {
|
|||||||
|
|
||||||
DatabaseConfiguration savedConn = DatabaseUtils.getSavedConnection(connectionName);
|
DatabaseConfiguration savedConn = DatabaseUtils.getSavedConnection(connectionName);
|
||||||
if(savedConn == null) {
|
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.sendError(HttpStatus.SC_BAD_REQUEST, "Connection with name " + connectionName + " does not exists!");
|
||||||
response.flushBuffer();
|
response.flushBuffer();
|
||||||
return;
|
return;
|
||||||
@ -246,7 +246,7 @@ public class SavedConnectionCommand extends DatabaseCommand {
|
|||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
|
|
||||||
if(logger.isDebugEnabled()) {
|
if(logger.isDebugEnabled()) {
|
||||||
logger.info("doPost Connection: {}", request.getParameter("connectionName"));
|
logger.debug("doPost Connection: {}", request.getParameter("connectionName"));
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseConfiguration jdbcConfig = getJdbcConfiguration(request);
|
DatabaseConfiguration jdbcConfig = getJdbcConfiguration(request);
|
||||||
@ -297,7 +297,7 @@ public class SavedConnectionCommand extends DatabaseCommand {
|
|||||||
if(logger.isDebugEnabled()) {
|
if(logger.isDebugEnabled()) {
|
||||||
logger.debug("databaseType::{} " , request.getParameter("databaseHost"));
|
logger.debug("databaseType::{} " , request.getParameter("databaseHost"));
|
||||||
}
|
}
|
||||||
logger.info("databaseHost::{} " , request.getParameter("databaseServer"));
|
// logger.info("databaseHost::{} " , request.getParameter("databaseServer"));
|
||||||
|
|
||||||
DatabaseConfiguration jdbcConfig = getJdbcConfiguration(request);
|
DatabaseConfiguration jdbcConfig = getJdbcConfiguration(request);
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
@ -51,17 +51,12 @@ public class DatabaseServiceTest extends DBExtensionTests{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @AfterSuite
|
|
||||||
// public void afterSuite() {
|
|
||||||
// DBExtensionTestUtils.cleanUpTestData(testDbConfig);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetDatabaseUrl() {
|
public void testGetDatabaseUrl() {
|
||||||
DatabaseService dbService = DatabaseService.get(testDbConfig.getDatabaseType());
|
DatabaseService dbService = DatabaseService.get(testDbConfig.getDatabaseType());
|
||||||
String dbUrl = dbService.getDatabaseUrl(testDbConfig);
|
String dbUrl = dbService.getDatabaseUrl(testDbConfig);
|
||||||
// System.out.println("dbUrl:" + dbUrl);
|
|
||||||
Assert.assertNotNull(dbUrl);
|
Assert.assertNotNull(dbUrl);
|
||||||
Assert.assertEquals(dbUrl, DBExtensionTestUtils.getJDBCUrl(testDbConfig));
|
Assert.assertEquals(dbUrl, DBExtensionTestUtils.getJDBCUrl(testDbConfig));
|
||||||
}
|
}
|
||||||
@ -99,7 +94,6 @@ public class DatabaseServiceTest extends DBExtensionTests{
|
|||||||
|
|
||||||
DatabaseService dbService = DatabaseService.get(testDbConfig.getDatabaseType());
|
DatabaseService dbService = DatabaseService.get(testDbConfig.getDatabaseType());
|
||||||
Connection conn = dbService.getConnection(testDbConfig);
|
Connection conn = dbService.getConnection(testDbConfig);
|
||||||
//System.out.println("conn:" + conn);
|
|
||||||
Assert.assertNotNull(conn);
|
Assert.assertNotNull(conn);
|
||||||
|
|
||||||
} catch (DatabaseServiceException e) {
|
} catch (DatabaseServiceException e) {
|
||||||
@ -173,7 +167,7 @@ public class DatabaseServiceTest extends DBExtensionTests{
|
|||||||
Assert.assertNotNull(dbColumns);
|
Assert.assertNotNull(dbColumns);
|
||||||
|
|
||||||
int cols = dbColumns.size();
|
int cols = dbColumns.size();
|
||||||
Assert.assertEquals(cols, 3);
|
Assert.assertEquals(cols, 10);
|
||||||
|
|
||||||
|
|
||||||
} catch (DatabaseServiceException e) {
|
} catch (DatabaseServiceException e) {
|
||||||
|
@ -44,7 +44,7 @@ public class ConnectCommandTest extends DBExtensionTests {
|
|||||||
@Optional(DEFAULT_MYSQL_PASSWORD) String mySqlDbPassword, @Optional(DEFAULT_TEST_TABLE) String mySqlTestTable) {
|
@Optional(DEFAULT_MYSQL_PASSWORD) String mySqlDbPassword, @Optional(DEFAULT_TEST_TABLE) String mySqlTestTable) {
|
||||||
|
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
// System.out.println("beforeTest " + pgSqlDbName);
|
|
||||||
testDbConfig = new DatabaseConfiguration();
|
testDbConfig = new DatabaseConfiguration();
|
||||||
testDbConfig.setDatabaseHost(mySqlDbHost);
|
testDbConfig.setDatabaseHost(mySqlDbHost);
|
||||||
testDbConfig.setDatabaseName(mySqlDbName);
|
testDbConfig.setDatabaseName(mySqlDbName);
|
||||||
@ -61,12 +61,6 @@ public class ConnectCommandTest extends DBExtensionTests {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @AfterSuite
|
|
||||||
// public void afterSuite() {
|
|
||||||
// DBExtensionTestUtils.cleanUpTestData(testDbConfig);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDoPost() {
|
public void testDoPost() {
|
||||||
|
@ -58,13 +58,6 @@ public class ExecuteQueryCommandTest extends DBExtensionTests {
|
|||||||
DatabaseService.DBType.registerDatabase(MySQLDatabaseService.DB_NAME, MySQLDatabaseService.getInstance());
|
DatabaseService.DBType.registerDatabase(MySQLDatabaseService.DB_NAME, MySQLDatabaseService.getInstance());
|
||||||
|
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// @AfterSuite
|
|
||||||
// public void afterSuite() {
|
|
||||||
// DBExtensionTestUtils.cleanUpTestData(testDbConfig);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDoPost() {
|
public void testDoPost() {
|
||||||
|
@ -60,11 +60,7 @@ public class TestConnectCommandTest extends DBExtensionTests{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @AfterSuite
|
|
||||||
// public void afterSuite() {
|
|
||||||
// DBExtensionTestUtils.cleanUpTestData(testDbConfig);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDoPost() {
|
public void testDoPost() {
|
||||||
|
@ -59,12 +59,6 @@ public class TestQueryCommandTest extends DBExtensionTests {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @AfterSuite
|
|
||||||
// public void afterSuite() {
|
|
||||||
// DBExtensionTestUtils.cleanUpTestData(testDbConfig);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDoPost() {
|
public void testDoPost() {
|
||||||
|
@ -46,11 +46,6 @@ public class MariaDBConnectionManagerTest extends DBExtensionTests {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @AfterSuite
|
|
||||||
// public void afterSuite() {
|
|
||||||
// DBExtensionTestUtils.cleanUpTestData(testDbConfig);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTestConnection() {
|
public void testTestConnection() {
|
||||||
|
@ -169,9 +169,4 @@ public class MariaDBDatabaseServiceTest extends DBExtensionTests{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @AfterSuite
|
|
||||||
// public void afterSuite() {
|
|
||||||
// DBExtensionTestUtils.cleanUpTestData(testDbConfig);
|
|
||||||
// logger.info("<<After Suite Cleanup>>");
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@ -43,11 +43,7 @@ public class MySQLConnectionManagerTest extends DBExtensionTests {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @AfterSuite
|
|
||||||
// public void afterSuite() {
|
|
||||||
// DBExtensionTestUtils.cleanUpTestData(testDbConfig);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
@Test
|
@Test
|
||||||
public void testTestConnection() {
|
public void testTestConnection() {
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public class PgSQLConnectionManagerTest extends DBExtensionTests {
|
|||||||
@Optional(DEFAULT_PGSQL_PASSWORD) String pgSqlDbPassword, @Optional(DEFAULT_TEST_TABLE) String pgSqlTestTable) {
|
@Optional(DEFAULT_PGSQL_PASSWORD) String pgSqlDbPassword, @Optional(DEFAULT_TEST_TABLE) String pgSqlTestTable) {
|
||||||
|
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
// System.out.println("beforeTest " + pgSqlDbName);
|
|
||||||
testDbConfig = new DatabaseConfiguration();
|
testDbConfig = new DatabaseConfiguration();
|
||||||
testDbConfig.setDatabaseHost(pgSqlDbHost);
|
testDbConfig.setDatabaseHost(pgSqlDbHost);
|
||||||
testDbConfig.setDatabaseName(pgSqlDbName);
|
testDbConfig.setDatabaseName(pgSqlDbName);
|
||||||
|
@ -33,7 +33,6 @@ public class PgSQLDatabaseServiceTest extends DBExtensionTests{
|
|||||||
@Optional(DEFAULT_PGSQL_PASSWORD) String pgSqlDbPassword, @Optional(DEFAULT_TEST_TABLE) String pgSqlTestTable) {
|
@Optional(DEFAULT_PGSQL_PASSWORD) String pgSqlDbPassword, @Optional(DEFAULT_TEST_TABLE) String pgSqlTestTable) {
|
||||||
|
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
// System.out.println("beforeTest " + pgSqlDbName);
|
|
||||||
testDbConfig = new DatabaseConfiguration();
|
testDbConfig = new DatabaseConfiguration();
|
||||||
testDbConfig.setDatabaseHost(pgSqlDbHost);
|
testDbConfig.setDatabaseHost(pgSqlDbHost);
|
||||||
testDbConfig.setDatabaseName(pgSqlDbName);
|
testDbConfig.setDatabaseName(pgSqlDbName);
|
||||||
@ -55,7 +54,7 @@ public class PgSQLDatabaseServiceTest extends DBExtensionTests{
|
|||||||
public void testGetDatabaseUrl() {
|
public void testGetDatabaseUrl() {
|
||||||
PgSQLDatabaseService pgSqlService = (PgSQLDatabaseService)DatabaseService.get(PgSQLDatabaseService.DB_NAME);
|
PgSQLDatabaseService pgSqlService = (PgSQLDatabaseService)DatabaseService.get(PgSQLDatabaseService.DB_NAME);
|
||||||
String dbUrl = pgSqlService.getDatabaseUrl(testDbConfig);
|
String dbUrl = pgSqlService.getDatabaseUrl(testDbConfig);
|
||||||
System.out.println("dbUrl:" + dbUrl);
|
|
||||||
Assert.assertNotNull(dbUrl);
|
Assert.assertNotNull(dbUrl);
|
||||||
Assert.assertEquals(dbUrl, DBExtensionTestUtils.getJDBCUrl(testDbConfig));
|
Assert.assertEquals(dbUrl, DBExtensionTestUtils.getJDBCUrl(testDbConfig));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user