openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jrba...@apache.org
Subject svn commit: r832816 - /openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestMapCollectionToBlob.java
Date Wed, 04 Nov 2009 17:48:29 GMT
Author: jrbauer
Date: Wed Nov  4 17:48:29 2009
New Revision: 832816

URL: http://svn.apache.org/viewvc?rev=832816&view=rev
Log:
Fixed test case failure which occurs on DB platforms that use non-default max embedded LOB
size.

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestMapCollectionToBlob.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestMapCollectionToBlob.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestMapCollectionToBlob.java?rev=832816&r1=832815&r2=832816&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestMapCollectionToBlob.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestMapCollectionToBlob.java
Wed Nov  4 17:48:29 2009
@@ -20,9 +20,12 @@
 
 import java.sql.Types;
 
+import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.meta.ClassMapping;
 import org.apache.openjpa.jdbc.meta.FieldMapping;
 import org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy;
+import org.apache.openjpa.jdbc.meta.strats.MaxEmbeddedBlobFieldStrategy;
+import org.apache.openjpa.jdbc.sql.DBDictionary;
 import org.apache.openjpa.persistence.JPAFacadeHelper;
 import org.apache.openjpa.persistence.test.SingleEMTestCase;
 
@@ -37,8 +40,8 @@
     public void testHandlerToHandlerMaps() {
         ClassMapping cm = (ClassMapping) JPAFacadeHelper.getMetaData(em,
             HandlerToHandlerMapInstance.class);
-        FieldMapping fm = cm.getFieldMapping("map");        
-        assertEquals(HandlerFieldStrategy.class, fm.getStrategy().getClass());
+        FieldMapping fm = cm.getFieldMapping("map");
+        assertEquals(getBlobFieldStrategy(), fm.getStrategy().getClass());
         assertEquals("NONSTD_MAPPING_MAP", fm.getTable().getName());
         assertEquals(fm.getTable().getColumn("MAP").getType(), Types.BLOB);
 
@@ -49,4 +52,16 @@
         em.getTransaction().commit();
         em.close();
     }
+
+    /*
+     * Returns the strategy that is used for handling blob fields, based upon
+     * the configuration of the dictionary.
+     */
+    private Class<?> getBlobFieldStrategy() {
+        DBDictionary dict = ((JDBCConfiguration)(emf.getConfiguration())).getDBDictionaryInstance();
+        if (dict.maxEmbeddedBlobSize == -1) {
+            return HandlerFieldStrategy.class;
+        }
+        return MaxEmbeddedBlobFieldStrategy.class;
+    }
 }



Mime
View raw message