openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtyle...@apache.org
Subject svn commit: r885965 - /openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java
Date Tue, 01 Dec 2009 22:06:49 GMT
Author: mtylenda
Date: Tue Dec  1 22:06:49 2009
New Revision: 885965

URL: http://svn.apache.org/viewvc?rev=885965&view=rev
Log:
Fix TestMultipleSchemaNames so that schemas are created on PostgreSQL

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java?rev=885965&r1=885964&r2=885965&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java
Tue Dec  1 22:06:49 2009
@@ -38,15 +38,13 @@
 
 public class TestMultipleSchemaNames extends SingleEMFTestCase {
 
-    static private DBDictionary dict = null;
-    
     public void setUp() {
         // Need to skip tests on MySQL, Oracle and MS SQL Server
         // See createSchemas() comment at the bottom
         setUnsupportedDatabases(
-                org.apache.openjpa.jdbc.sql.MySQLDictionary.class,
-                org.apache.openjpa.jdbc.sql.OracleDictionary.class,
-                org.apache.openjpa.jdbc.sql.SQLServerDictionary.class);
+                MySQLDictionary.class,
+                OracleDictionary.class,
+                SQLServerDictionary.class);
         if (isTestsDisabled()) {
             // getLog().trace("TestMultipleSchemaNames() - Skipping all tests - Not supported
on this DB");
             return;
@@ -419,13 +417,15 @@
      * we give up as they treat schemas in special ways.
      */
     private void createSchemas() {
+        OpenJPAEntityManagerFactorySPI tempEmf = createEMF();
+        DBDictionary dict = ((JDBCConfiguration) tempEmf.getConfiguration()).getDBDictionaryInstance();
         
         if (!(dict instanceof PostgresDictionary)) {
+            closeEMF(tempEmf);
             return;
         }
         
-        OpenJPAEntityManagerFactorySPI emf = createEMF();
-        OpenJPAEntityManagerSPI em = emf.createEntityManager();
+        OpenJPAEntityManagerSPI em = tempEmf.createEntityManager();
         String[] schemas =
             { "SCHEMA1", "SCHEMA2", "SCHEMA3", "SCHEMA3G", "SCHEMA4G" };
         for (String schema : schemas) {
@@ -438,7 +438,7 @@
                 em.getTransaction().rollback();
             }
         }
-        closeEMF(emf);
+        closeEMF(tempEmf);
     }
 
 } // end of TestMultipleSchemaNames



Mime
View raw message