updated getLog() methods and switched testcase to use setUnsupportedDatabases()

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@813519 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Donald Woods 2009-09-10 17:16:31 +00:00
parent 8e96965225
commit 0d3179cef9
2 changed files with 19 additions and 18 deletions

View File

@ -43,24 +43,12 @@ public class TestMultipleSchemaNames extends SingleEMFTestCase {
public void setUp() {
// Need to skip tests on MySQL, Oracle and MS SQL Server
// See createSchemas() comment at the bottom
if (dict == null) {
OpenJPAEntityManagerFactorySPI emf = createEMF();
OpenJPAEntityManagerSPI em = emf.createEntityManager();
JDBCConfiguration conf = (JDBCConfiguration) em.getConfiguration();
dict = conf.getDBDictionaryInstance();
if ((dict instanceof MySQLDictionary) ||
(dict instanceof OracleDictionary) ||
(dict instanceof SQLServerDictionary)) {
setTestsDisabled(true);
// do some logging
emf.getConfiguration().getLog("Tests").trace(
"TestMultipleSchemaNames() - Skipping all tests - Not supported on this DB");
}
closeEMF(emf);
}
setUnsupportedDatabases(
org.apache.openjpa.jdbc.sql.MySQLDictionary.class,
org.apache.openjpa.jdbc.sql.OracleDictionary.class,
org.apache.openjpa.jdbc.sql.SQLServerDictionary.class);
if (isTestsDisabled()) {
getLog().trace("TestMultipleSchemaNames() - Skipping all tests - Not supported on this DB");
return;
}

View File

@ -206,6 +206,19 @@ public abstract class SingleEMFTestCase
}
protected Log getLog() {
return emf.getConfiguration().getLog("Tests");
return getLog("Tests");
}
protected Log getLog(String s) {
OpenJPAEntityManagerFactorySPI tempEMF = emf;
if (tempEMF == null) {
tempEMF = createEMF();
}
Log log = emf.getConfiguration().getLog(s);
if (emf == null) {
closeEMF(tempEMF);
}
return log;
}
}