Author: jpeterka
Date: 2010-12-21 04:06:23 -0500 (Tue, 21 Dec 2010)
New Revision: 27625
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java
Log:
Added methods for db dialect and drivername resolution for bot tests
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java 2010-12-21
09:03:39 UTC (rev 27624)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/DatabaseHelper.java 2010-12-21
09:06:23 UTC (rev 27625)
@@ -291,6 +291,59 @@
}
/**
+ * Resolves db type for eclipse usage in SQL editor
+ *
+ * @param type
+ * @return
+ */
+ public static String getDialect(DBType type) {
+ // TODO verify values
+ String ret = "";
+ switch (type) {
+ case hsqldb18:
+ ret = "HSQL";
+ break;
+ case db2_97:
+ ret = "DB2 UDB_V9.1";
+ break;
+ case mssql2005:
+ ret = "SQL Server_2005";
+ break;
+ case mssql2008:
+ ret = "SQL Server_2008";
+ break;
+ case mysql50:
+ ret = "MySQL_5.0";
+ break;
+ case mysql51:
+ ret = "MySQL 5";
+ break;
+ case oracle10g:
+ ret = "Oracle_10";
+ break;
+ case oracle11gR1: // Intentionally empty
+ case oracle11gR1RAC: // Intentionally empty
+ case oracle11gR2: // Intentionally empty
+ case oracle11gR2RAC:
+ ret = "Oracle_11";
+ break;
+ case postgresql82: // Intentionally empty
+ case postgresql83: // Intentionally empty
+ case postgresql84:
+ ret = "PostgreSQL";
+ break;
+ case sybase15:
+ ret = "Sybase_ASE_15.x";
+ break;
+ default:
+ fail("Unknown db type");
+ break;
+ }
+ return ret;
+ }
+
+
+ /**
* Run HSQLDB database in server mode
* @param file
* @param dbname
@@ -375,4 +428,50 @@
if (outChannel != null) outChannel.close();
log.info("Driver hsqldb.jar copied");
}
+
+ public static String getDriverClass(DBType type) {
+ // TODO verify values
+ String ret = "";
+ switch (type) {
+ case hsqldb18:
+ ret = "org.hsqldb.jdbcDriver";
+ break;
+ case db2_97:
+ ret = "DB2 UDB_V9.1";
+ break;
+ case mssql2005:
+ ret = "SQL Server_2005";
+ break;
+ case mssql2008:
+ ret = "SQL Server_2008";
+ break;
+ case mysql50:
+ ret = "com.mysql.jdbc.Driver";
+ break;
+ case mysql51:
+ ret = "com.mysql.jdbc.Driver";
+ break;
+ case oracle10g:
+ ret = "Oracle_10";
+ break;
+ case oracle11gR1: // Intentionally empty
+ case oracle11gR1RAC: // Intentionally empty
+ case oracle11gR2: // Intentionally empty
+ case oracle11gR2RAC:
+ ret = "Oracle_11";
+ break;
+ case postgresql82: // Intentionally empty
+ case postgresql83: // Intentionally empty
+ case postgresql84:
+ ret = "org.postgresql.Driver";
+ break;
+ case sybase15:
+ ret = "Sybase_ASE_15.x";
+ break;
+ default:
+ fail("Unknown db type");
+ break;
+ }
+ return ret;
+ }
}