db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r359149 - in /db/ddlutils/trunk/src/test/org/apache/ddlutils/io: RoundtripTestBase.java TestDerbyConstraints.java TestDerbyDatatypes.java TestRoundtripDerby.java
Date Tue, 27 Dec 2005 00:35:12 GMT
Author: tomdz
Date: Mon Dec 26 16:35:05 2005
New Revision: 359149

URL: http://svn.apache.org/viewcvs?rev=359149&view=rev
Log:
Added initial constraints tests

Added:
    db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDerbyConstraints.java
    db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDerbyDatatypes.java
      - copied, changed from r359072, db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestRoundtripDerby.java
Removed:
    db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestRoundtripDerby.java
Modified:
    db/ddlutils/trunk/src/test/org/apache/ddlutils/io/RoundtripTestBase.java

Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/io/RoundtripTestBase.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/io/RoundtripTestBase.java?rev=359149&r1=359148&r2=359149&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/io/RoundtripTestBase.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/io/RoundtripTestBase.java Mon Dec 26 16:35:05
2005
@@ -428,6 +428,96 @@
         "  </table>\n"+
         "</database>";
 
+    /** Test model with a nullable column. */
+    protected static final String TEST_NULL_MODEL = 
+        "<?xml version='1.0' encoding='ISO-8859-1'?>\n"+
+        "<database name='roundtriptest'>\n"+
+        "  <table name='ROUNDTRIP'>\n"+
+        "    <column name='PK' type='INTEGER' primaryKey='true' required='true'/>\n"+
+        "    <column name='VALUE' type='INTEGER' required='false'/>\n"+
+        "  </table>\n"+
+        "</database>";
+    /** Test model with a not-nullable column. */
+    protected static final String TEST_NOT_NULL_MODEL = 
+        "<?xml version='1.0' encoding='ISO-8859-1'?>\n"+
+        "<database name='roundtriptest'>\n"+
+        "  <table name='ROUNDTRIP'>\n"+
+        "    <column name='PK' type='INTEGER' primaryKey='true' required='true'/>\n"+
+        "    <column name='VALUE' type='VARCHAR' required='true'/>\n"+
+        "  </table>\n"+
+        "</database>";
+    /** Test model with a auto-increment INTEGER column. */
+    protected static final String TEST_AUTO_INCREMENT_INTEGER_MODEL = 
+        "<?xml version='1.0' encoding='ISO-8859-1'?>\n"+
+        "<database name='roundtriptest'>\n"+
+        "  <table name='ROUNDTRIP'>\n"+
+        "    <column name='PK' type='INTEGER' primaryKey='true' required='true'/>\n"+
+        "    <column name='VALUE' type='INTEGER' required='true' autoIncrement='true'/>\n"+
+        "  </table>\n"+
+        "</database>";
+    /** Test model with a auto-increment DOUBLE column. */
+    protected static final String TEST_AUTO_INCREMENT_DOUBLE_MODEL = 
+        "<?xml version='1.0' encoding='ISO-8859-1'?>\n"+
+        "<database name='roundtriptest'>\n"+
+        "  <table name='ROUNDTRIP'>\n"+
+        "    <column name='PK' type='INTEGER' primaryKey='true' required='true'/>\n"+
+        "    <column name='VALUE' type='DOUBLE' required='true' autoIncrement='true'/>\n"+
+        "  </table>\n"+
+        "</database>";
+    /** Test model with a auto-increment primary key column. */
+    protected static final String TEST_PRIMARY_KEY_AUTO_INCREMENT_MODEL = 
+        "<?xml version='1.0' encoding='ISO-8859-1'?>\n"+
+        "<database name='roundtriptest'>\n"+
+        "  <table name='ROUNDTRIP'>\n"+
+        "    <column name='PK' type='INTEGER' primaryKey='true' required='true' autoIncrement='true'/>\n"+
+        "  </table>\n"+
+        "</database>";
+    /** Test model with a simple index. */
+    protected static final String TEST_INDEX_MODEL = 
+        "<?xml version='1.0' encoding='ISO-8859-1'?>\n"+
+        "<database name='roundtriptest'>\n"+
+        "  <table name='ROUNDTRIP'>\n"+
+        "    <column name='PK' type='INTEGER' primaryKey='true' required='true'/>\n"+
+        "    <column name='VALUE' type='DOUBLE'/>\n"+
+        "    <index name='TEST_INDEX'>\n"+
+        "      <index-column name='VALUE'/>\n"+
+        "    </index>\n"+
+        "  </table>\n"+
+        "</database>";
+    /** Test model with an unique index with two columns. */
+    protected static final String TEST_UNIQUE_INDEX_MODEL = 
+        "<?xml version='1.0' encoding='ISO-8859-1'?>\n"+
+        "<database name='roundtriptest'>\n"+
+        "  <table name='ROUNDTRIP'>\n"+
+        "    <column name='PK' type='INTEGER' primaryKey='true' required='true'/>\n"+
+        "    <column name='VALUE1' type='DOUBLE'/>\n"+
+        "    <column name='VALUE2' type='VARCHAR'/>\n"+
+        "    <unique name='TEST_INDEX'>\n"+
+        "      <unique-column name='VALUE2'/>\n"+
+        "      <unique-column name='VALUE1'/>\n"+
+        "    </unique>\n"+
+        "  </table>\n"+
+        "</database>";
+    /** Test model with an index with two columns, one of which a pk field. */
+    protected static final String TEST_PRIMARY_KEY_INDEX_MODEL = 
+        "<?xml version='1.0' encoding='ISO-8859-1'?>\n"+
+        "<database name='roundtriptest'>\n"+
+        "  <table name='ROUNDTRIP'>\n"+
+        "    <column name='PK_1' type='INTEGER' primaryKey='true' required='true'/>\n"+
+        "    <column name='PK_2' type='VARCHAR' primaryKey='true' required='true'/>\n"+
+        "    <column name='VALUE' type='DOUBLE'/>\n"+
+        "    <index name='TEST_INDEX'>\n"+
+        "      <index-column name='VALUE'/>\n"+
+        "      <index-column name='PK_1'/>\n"+
+        "    </index>\n"+
+        "  </table>\n"+
+        "</database>";
+
+
+    // TODO: special columns (java_object, array, distinct, ...)
+
+    // fks (incl. multiple columns, circular references)
+
     /**
      * Inserts a row into the designated table.
      * 
@@ -574,29 +664,34 @@
         assertEquals(expected, value);
     }
 
-    protected void assertEquals(Database expected, Database actual)
+    protected void assertEquals(Database expected, Database actual) throws RuntimeException
     {
-        StringWriter writer = new StringWriter();
-        DatabaseIO   dbIo   = new DatabaseIO();
+        try
+        {
+            assertEquals((Object)expected, (Object)actual);
+        }
+        catch (Throwable ex)
+        {
+            StringWriter writer = new StringWriter();
+            DatabaseIO   dbIo   = new DatabaseIO();
 
-        dbIo.write(expected, writer);
+            dbIo.write(expected, writer);
 
-        String expectedXml = writer.toString();
-        
-        writer = new StringWriter();
-        dbIo.write(actual, writer);
+            System.err.println("Expected model:\n"+writer.toString());
+            
+            writer = new StringWriter();
+            dbIo.write(actual, writer);
 
-        String actualXml = writer.toString();
+            System.err.println("Actual model:\n"+writer.toString());
 
-        assertEquals((Object)expected, (Object)actual);
+            if (ex instanceof Error)
+            {
+                throw (Error)ex;
+            }
+            else
+            {
+                throw new RuntimeException(ex);
+            }
+        }
     }
-
-    // special columns (java_object, array, distinct, ...)
-
-    // auto-increment
-    // default values
-    // null/not null
-    // pk (incl. pk with auto-increment)
-    // index/unique (incl. for pks)
-    // fks (incl. multiple columns, circular references)
 }

Added: db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDerbyConstraints.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDerbyConstraints.java?rev=359149&view=auto
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDerbyConstraints.java (added)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDerbyConstraints.java Mon Dec 26
16:35:05 2005
@@ -0,0 +1,107 @@
+package org.apache.ddlutils.io;
+
+
+/**
+ * Performs the roundtrip constraint tests against a derby database.
+ * 
+ * @author Thomas Dudziak
+ * @version $Revision: 289996 $
+ */
+public class TestDerbyConstraints extends RoundtripTestBase
+{
+    /**
+     * {@inheritDoc}
+     */
+    protected boolean hasPkUniqueIndices()
+    {
+        return true;
+    }
+
+    /**
+     * Tests a nullable column. 
+     */
+    public void testNullableColumn()
+    {
+        createDatabase(TEST_NULL_MODEL);
+
+        assertEquals(getAdjustedModel(),
+                     getPlatform().readModelFromDatabase("roundtriptest"));
+    }
+
+    /**
+     * Tests a not-nullable column. 
+     */
+    public void testNotNullableColumn()
+    {
+        createDatabase(TEST_NOT_NULL_MODEL);
+
+        assertEquals(getAdjustedModel(),
+                     getPlatform().readModelFromDatabase("roundtriptest"));
+    }
+
+    /**
+     * Tests an auto-increment INTEGER column. 
+     */
+    public void testAutoIncrementIntegerColumn()
+    {
+        createDatabase(TEST_AUTO_INCREMENT_INTEGER_MODEL);
+
+        assertEquals(getAdjustedModel(),
+                     getPlatform().readModelFromDatabase("roundtriptest"));
+    }
+
+    /**
+     * Tests an auto-increment DOUBLE column. 
+     */
+    public void testAutoIncrementDoubleColumn()
+    {
+        createDatabase(TEST_AUTO_INCREMENT_DOUBLE_MODEL);
+
+        assertEquals(getAdjustedModel(),
+                     getPlatform().readModelFromDatabase("roundtriptest"));
+    }
+
+    /**
+     * Tests an auto-increment primary key column. 
+     */
+    public void testPrimaryKeyAutoIncrementColumn()
+    {
+        createDatabase(TEST_PRIMARY_KEY_AUTO_INCREMENT_MODEL);
+
+        assertEquals(getAdjustedModel(),
+                     getPlatform().readModelFromDatabase("roundtriptest"));
+    }
+
+    /**
+     * Tests a simple index. 
+     */
+    public void testIndex()
+    {
+        createDatabase(TEST_INDEX_MODEL);
+
+        assertEquals(getAdjustedModel(),
+                     getPlatform().readModelFromDatabase("roundtriptest"));
+    }
+
+    /**
+     * Tests an unique index for two columns. 
+     */
+    public void testUniqueIndex()
+    {
+        createDatabase(TEST_UNIQUE_INDEX_MODEL);
+
+        assertEquals(getAdjustedModel(),
+                     getPlatform().readModelFromDatabase("roundtriptest"));
+    }
+
+    /**
+     * Tests an index for two columns, one of which a pk column. 
+     */
+    public void testPrimaryKeyIndex()
+    {
+        createDatabase(TEST_PRIMARY_KEY_INDEX_MODEL);
+
+        assertEquals(getAdjustedModel(),
+                     getPlatform().readModelFromDatabase("roundtriptest"));
+    }
+}

Copied: db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDerbyDatatypes.java (from r359072,
db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestRoundtripDerby.java)
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDerbyDatatypes.java?p2=db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDerbyDatatypes.java&p1=db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestRoundtripDerby.java&r1=359072&r2=359149&rev=359149&view=diff
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestRoundtripDerby.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestDerbyDatatypes.java Mon Dec 26 16:35:05
2005
@@ -10,12 +10,12 @@
 import java.util.TreeSet;
 
 /**
- * Performs the roundtrip test against a derby database.
+ * Performs the roundtrip datatype tests against a derby database.
  * 
  * @author Thomas Dudziak
  * @version $Revision: 289996 $
  */
-public class TestRoundtripDerby extends RoundtripTestBase
+public class TestDerbyDatatypes extends RoundtripTestBase
 {
     /**
      * {@inheritDoc}
@@ -26,39 +26,74 @@
     }
 
     /**
-     * Tests a simple BIT column.
+     * Performs a data type test.
+     * 
+     * @param modelXml The model as XML
+     * @param value1   The non-pk value for the first row 
+     * @param value2   The non-pk value for the second row 
      */
-    public void testBit()
+    protected void performDataTypeTest(String modelXml, Object value1, Object value2)
+    {
+        performDataTypeTest(modelXml, value1, value2, value1, value2);
+    }
+
+    /**
+     * Performs a data type test for a model with a default value.
+     * 
+     * @param modelXml     The model as XML
+     * @param value1       The non-pk value for the first row; use <code>null</code>
for
+     *                     the default value
+     * @param value2       The non-pk value for the second row; use <code>null</code>
for
+     *                     the default value 
+     * @param defaultValue The default value 
+     */
+    protected void performDataTypeTest(String modelXml, Object value1, Object value2, Object
defaultValue)
+    {
+        performDataTypeTest(modelXml,
+                            value1,
+                            value2,
+                            value1 == null ? defaultValue : value1,
+                            value2 == null ? defaultValue : value2);
+    }
+
+    /**
+     * Performs a data type test.
+     * 
+     * @param modelXml  The model as XML
+     * @param inserted1 The non-pk value to insert for the first row 
+     * @param inserted2 The non-pk value to insert for the second row 
+     * @param expected1 The expected non-pk value for the first row 
+     * @param expected2 The expected non-pk value for the second row 
+     */
+    protected void performDataTypeTest(String modelXml, Object inserted1, Object inserted2,
Object expected1, Object expected2)
     {
-        createDatabase(TEST_BIT_MODEL);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), Boolean.TRUE });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), Boolean.FALSE });
+        createDatabase(modelXml);
+        insertRow("ROUNDTRIP", new Object[] { new Integer(1), inserted1 });
+        insertRow("ROUNDTRIP", new Object[] { new Integer(2), inserted2 });
 
         List beans = getRows("ROUNDTRIP");
 
-        assertEquals(Boolean.TRUE,  beans.get(0), "VALUE");
-        assertEquals(Boolean.FALSE, beans.get(1), "VALUE");
+        assertEquals(expected1, beans.get(0), "VALUE");
+        assertEquals(expected2, beans.get(1), "VALUE");
 
         assertEquals(getAdjustedModel(),
                      getPlatform().readModelFromDatabase("roundtriptest"));
     }
 
     /**
+     * Tests a simple BIT column.
+     */
+    public void testBit()
+    {
+        performDataTypeTest(TEST_BIT_MODEL, Boolean.TRUE, Boolean.FALSE);
+    }
+
+    /**
      * Tests a BIT column with a default value.
      */
     public void testBitWithDefault()
     {
-        createDatabase(TEST_BIT_MODEL_WITH_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), Boolean.TRUE });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(Boolean.FALSE, beans.get(0), "VALUE");
-        assertEquals(Boolean.TRUE,  beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_BIT_MODEL_WITH_DEFAULT, null, Boolean.TRUE, Boolean.FALSE);
     }
 
     /**
@@ -66,17 +101,7 @@
      */
     public void testBoolean()
     {
-        createDatabase(TEST_BOOLEAN_MODEL);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), Boolean.FALSE });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), Boolean.TRUE });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(Boolean.FALSE, beans.get(0), "VALUE");
-        assertEquals(Boolean.TRUE,  beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_BOOLEAN_MODEL, Boolean.FALSE, Boolean.TRUE);
     }
 
     /**
@@ -84,17 +109,7 @@
      */
     public void testBooleanWithDefault()
     {
-        createDatabase(TEST_BOOLEAN_MODEL_WITH_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), Boolean.TRUE });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(Boolean.TRUE, beans.get(0), "VALUE");
-        assertEquals(Boolean.TRUE, beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_BOOLEAN_MODEL_WITH_DEFAULT, Boolean.TRUE, null, Boolean.TRUE);
     }
 
     /**
@@ -102,20 +117,7 @@
      */
     public void testTinyInt()
     {
-        createDatabase(TEST_TINYINT_MODEL);
-
-        // Derby does not have a TINYINT type, so it gets mapped to SMALLINT
-        // and so we should use int values instead of short
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new Integer(254) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new Integer(-254) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Integer(254),  beans.get(0), "VALUE");
-        assertEquals(new Integer(-254), beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_TINYINT_MODEL, new Integer(254), new Integer(-254));
     }
 
     /**
@@ -123,17 +125,7 @@
      */
     public void testTinyIntWithDefault()
     {
-        createDatabase(TEST_TINYINT_MODEL_WITH_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new Integer(128) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Integer(128),  beans.get(0), "VALUE");
-        assertEquals(new Integer(-200), beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_TINYINT_MODEL_WITH_DEFAULT, new Integer(128), null, new
Integer(-200));
     }
 
     /**
@@ -141,18 +133,7 @@
      */
     public void testSmallInt()
     {
-        createDatabase(TEST_SMALLINT_MODEL);
-
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new Integer(-32768) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new Integer(32767) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Integer(-32768), beans.get(0), "VALUE");
-        assertEquals(new Integer(32767),  beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_SMALLINT_MODEL, new Integer(-32768), new Integer(32767));
     }
 
     /**
@@ -160,17 +141,7 @@
      */
     public void testSmallIntWithDefault()
     {
-        createDatabase(TEST_SMALLINT_MODEL_WITH_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new Integer(256) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Integer(256),    beans.get(0), "VALUE");
-        assertEquals(new Integer(-32768), beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_SMALLINT_MODEL_WITH_DEFAULT, new Integer(256), null, new
Integer(-32768));
     }
 
     /**
@@ -178,18 +149,7 @@
      */
     public void testInteger()
     {
-        createDatabase(TEST_INTEGER_MODEL);
-
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new Integer(0) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new Integer(-2147483648) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Integer(0),           beans.get(0), "VALUE");
-        assertEquals(new Integer(-2147483648), beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_INTEGER_MODEL, new Integer(0), new Integer(-2147483648));
     }
 
     /**
@@ -197,17 +157,7 @@
      */
     public void testIntegerWithDefault()
     {
-        createDatabase(TEST_INTEGER_MODEL_WITH_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new Integer(2147483646) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Integer(2147483647), beans.get(0), "VALUE");
-        assertEquals(new Integer(2147483646), beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_INTEGER_MODEL_WITH_DEFAULT, null, new Integer(2147483646),
new Integer(2147483647));
     }
 
     /**
@@ -215,18 +165,7 @@
      */
     public void testBigInt()
     {
-        createDatabase(TEST_BIGINT_MODEL);
-
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new Long(9223372036854775807l)
});
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new Long(0l) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Long(9223372036854775807l), beans.get(0), "VALUE");
-        assertEquals(new Long(0l),                   beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_BIGINT_MODEL, new Long(9223372036854775807l), new Long(0l));
     }
 
     /**
@@ -234,17 +173,7 @@
      */
     public void testBigIntWithDefault()
     {
-        createDatabase(TEST_BIGINT_MODEL_WITH_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new Long(-1l) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Long(-9223372036854775808l), beans.get(0), "VALUE");
-        assertEquals(new Long(-1l),                   beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_BIGINT_MODEL_WITH_DEFAULT, null, new Long(-1l), new Long(-9223372036854775808l));
     }
 
     /**
@@ -252,18 +181,7 @@
      */
     public void testReal()
     {
-        createDatabase(TEST_REAL_MODEL);
-
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new Float(123456789.98765f)
});
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new Float(0.0f) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Float(123456789.98765f), beans.get(0), "VALUE");
-        assertEquals(new Float(0.0f),             beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_REAL_MODEL, new Float(123456789.98765f), new Float(0.0f));
     }
 
     /**
@@ -271,17 +189,7 @@
      */
     public void testRealWithDefault()
     {
-        createDatabase(TEST_REAL_MODEL_WITH_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new Float(1e+20f) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Float(1e+20f),      beans.get(0), "VALUE");
-        assertEquals(new Float(-1.0123456f), beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_REAL_MODEL_WITH_DEFAULT, new Float(1e+20f), null, new Float(-1.0123456f));
     }
 
     /**
@@ -289,18 +197,7 @@
      */
     public void testFloat()
     {
-        createDatabase(TEST_FLOAT_MODEL);
-
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new Double(-1.0) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new Double(Float.MIN_VALUE)
});
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Double(-1.0),            beans.get(0), "VALUE");
-        assertEquals(new Double(Float.MIN_VALUE), beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_FLOAT_MODEL, new Double(-1.0), new Double(Float.MIN_VALUE));
     }
 
     /**
@@ -308,17 +205,7 @@
      */
     public void testFloatWithDefault()
     {
-        createDatabase(TEST_FLOAT_MODEL_WITH_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new Double(1e+150) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Double(1234567890.012345678901234), beans.get(0), "VALUE");
-        assertEquals(new Double(1e+150),                     beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_FLOAT_MODEL_WITH_DEFAULT, null, new Double(1e+150), new
Double(1234567890.012345678901234));
     }
 
     /**
@@ -326,18 +213,7 @@
      */
     public void testDouble()
     {
-        createDatabase(TEST_DOUBLE_MODEL);
-
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new Double(Float.MAX_VALUE)
});
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new Double(1.01) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Double(Float.MAX_VALUE), beans.get(0), "VALUE");
-        assertEquals(new Double(1.01),            beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_DOUBLE_MODEL, new Double(Float.MAX_VALUE), new Double(1.01));
     }
 
     /**
@@ -345,17 +221,7 @@
      */
     public void testDoubleWithDefault()
     {
-        createDatabase(TEST_DOUBLE_MODEL_WITH_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new Double(-1e+150) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Double(-1e+150),                     beans.get(0), "VALUE");
-        assertEquals(new Double(-9876543210.987654321098765), beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_DOUBLE_MODEL_WITH_DEFAULT, new Double(-1e+150), null, new
Double(-9876543210.987654321098765));
     }
 
     /**
@@ -363,18 +229,7 @@
      */
     public void testDecimal()
     {
-        createDatabase(TEST_DECIMAL_MODEL);
-
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new BigDecimal("0") });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new BigDecimal("-123456789012345")
});
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new BigDecimal("0"),                beans.get(0), "VALUE");
-        assertEquals(new BigDecimal("-123456789012345"), beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_DECIMAL_MODEL, new BigDecimal("0"), new BigDecimal("-123456789012345"));
     }
 
     /**
@@ -382,17 +237,7 @@
      */
     public void testDecimalWithDefault()
     {
-        createDatabase(TEST_DECIMAL_MODEL_WITH_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new BigDecimal("-1") });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new BigDecimal("123456789012345"), beans.get(0), "VALUE");
-        assertEquals(new BigDecimal("-1"),              beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_DECIMAL_MODEL_WITH_DEFAULT, null, new BigDecimal("-1"),
new BigDecimal("123456789012345"));
     }
 
     /**
@@ -400,18 +245,7 @@
      */
     public void testDecimalWithScale()
     {
-        createDatabase(TEST_DECIMAL_MODEL_WITH_SCALE);
-
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new BigDecimal("0.0100000")
});
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new BigDecimal("-87654321.1234567")
});
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new BigDecimal("0.0100000"),         beans.get(0), "VALUE");
-        assertEquals(new BigDecimal("-87654321.1234567"), beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_DECIMAL_MODEL_WITH_SCALE, new BigDecimal("0.0100000"), new
BigDecimal("-87654321.1234567"));
     }
 
     /**
@@ -419,17 +253,7 @@
      */
     public void testDecimalWithScaleAndDefault()
     {
-        createDatabase(TEST_DECIMAL_MODEL_WITH_SCALE_AND_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new BigDecimal("1.0000000")
});
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new BigDecimal("1.0000000"),        beans.get(0), "VALUE");
-        assertEquals(new BigDecimal("12345678.7654321"), beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_DECIMAL_MODEL_WITH_SCALE_AND_DEFAULT, new BigDecimal("1.0000000"),
null, new BigDecimal("12345678.7654321"));
     }
 
     /**
@@ -437,18 +261,7 @@
      */
     public void testNumeric()
     {
-        createDatabase(TEST_NUMERIC_MODEL);
-
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new BigDecimal("543210987654321")
});
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new BigDecimal("-2") });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new BigDecimal("543210987654321"), beans.get(0), "VALUE");
-        assertEquals(new BigDecimal("-2"),              beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_NUMERIC_MODEL, new BigDecimal("543210987654321"), new BigDecimal("-2"));
     }
 
     /**
@@ -456,17 +269,7 @@
      */
     public void testNumericWithDefault()
     {
-        createDatabase(TEST_NUMERIC_MODEL_WITH_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new BigDecimal("100") });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new BigDecimal("-123456789012345"), beans.get(0), "VALUE");
-        assertEquals(new BigDecimal("100"),              beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_NUMERIC_MODEL_WITH_DEFAULT, null, new BigDecimal("100"),
new BigDecimal("-123456789012345"));
     }
 
     /**
@@ -474,18 +277,7 @@
      */
     public void testNumericWithScale()
     {
-        createDatabase(TEST_NUMERIC_MODEL_WITH_SCALE);
-
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new BigDecimal("1234567.89012345")
});
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new BigDecimal("1.00000000")
});
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new BigDecimal("1234567.89012345"), beans.get(0), "VALUE");
-        assertEquals(new BigDecimal("1.00000000"),       beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_NUMERIC_MODEL_WITH_SCALE, new BigDecimal("1234567.89012345"),
new BigDecimal("1.00000000"));
     }
 
     /**
@@ -493,17 +285,7 @@
      */
     public void testNumericWithScaleAndDefault()
     {
-        createDatabase(TEST_NUMERIC_MODEL_WITH_SCALE_AND_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new BigDecimal("1e-8") });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new BigDecimal("-1234567.87654321"), beans.get(0), "VALUE");
-        assertEquals(new BigDecimal("1e-8"),              beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_NUMERIC_MODEL_WITH_SCALE_AND_DEFAULT, null, new BigDecimal("1e-8"),
new BigDecimal("-1234567.87654321"));
     }
 
     /**
@@ -511,17 +293,7 @@
      */
     public void testChar()
     {
-        createDatabase(TEST_CHAR_MODEL);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), null });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), "1234567890" });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals((Object)null,         beans.get(0), "VALUE");
-        assertEquals((Object)"1234567890", beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_CHAR_MODEL, null, "1234567890");
     }
 
     /**
@@ -529,17 +301,7 @@
      */
     public void testCharWithDefault()
     {
-        createDatabase(TEST_CHAR_MODEL_WITH_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), "12345" });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals((Object)"some value     ", beans.get(0), "VALUE");
-        assertEquals((Object)"12345          ", beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_CHAR_MODEL_WITH_DEFAULT, null, "12345", "some value    
", "12345          ");
     }
 
     /**
@@ -547,17 +309,7 @@
      */
     public void testVarChar()
     {
-        createDatabase(TEST_VARCHAR_MODEL);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), "123456789012345678" });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), null });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals((Object)"123456789012345678", beans.get(0), "VALUE");
-        assertEquals((Object)null,                 beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_VARCHAR_MODEL, "123456789012345678", null);
     }
 
     /**
@@ -565,23 +317,12 @@
      */
     public void testVarCharWithDefault()
     {
-        createDatabase(TEST_VARCHAR_MODEL_WITH_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), "1234567890123456789012345678901234567890123456789012345678901234"+
-                                                              "1234567890123456789012345678901234567890123456789012345678901234"+
-                                                              "1234567890123456789012345678901234567890123456789012345678901234"+
-                                                              "12345678901234567890123456789012345678901234567890123456789012"});
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals((Object)"some value", beans.get(0), "VALUE");
-        assertEquals((Object)("1234567890123456789012345678901234567890123456789012345678901234"+
-                              "1234567890123456789012345678901234567890123456789012345678901234"+
-                              "1234567890123456789012345678901234567890123456789012345678901234"+
-                              "12345678901234567890123456789012345678901234567890123456789012"),
beans.get(1), "VALUE");
+        String value = "1234567890123456789012345678901234567890123456789012345678901234"+
+                       "1234567890123456789012345678901234567890123456789012345678901234"+
+                       "1234567890123456789012345678901234567890123456789012345678901234"+
+                       "12345678901234567890123456789012345678901234567890123456789012";
 
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_VARCHAR_MODEL_WITH_DEFAULT, null, value, "some value");
     }
 
     /**
@@ -589,17 +330,7 @@
      */
     public void testLongVarChar()
     {
-        createDatabase(TEST_LONGVARCHAR_MODEL);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), null });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), "some not too long text" });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals((Object)null,                     beans.get(0), "VALUE");
-        assertEquals((Object)"some not too long text", beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_LONGVARCHAR_MODEL, null, "some not too long text");
     }
 
     /**
@@ -607,23 +338,12 @@
      */
     public void testLongVarCharWithDefault()
     {
-        createDatabase(TEST_LONGVARCHAR_MODEL_WITH_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), "1234567890123456789012345678901234567890123456789012345678901234"+
-                                                              "1234567890123456789012345678901234567890123456789012345678901234"+
-                                                              "1234567890123456789012345678901234567890123456789012345678901234"+
-                                                              "1234567890123456789012345678901234567890123456789012345678901234"});
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals((Object)"some value", beans.get(0), "VALUE");
-        assertEquals((Object)("1234567890123456789012345678901234567890123456789012345678901234"+
-                              "1234567890123456789012345678901234567890123456789012345678901234"+
-                              "1234567890123456789012345678901234567890123456789012345678901234"+
-                              "1234567890123456789012345678901234567890123456789012345678901234"),
beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        String value = "1234567890123456789012345678901234567890123456789012345678901234"+
+                       "1234567890123456789012345678901234567890123456789012345678901234"+
+                       "1234567890123456789012345678901234567890123456789012345678901234"+
+                       "1234567890123456789012345678901234567890123456789012345678901234";
+        
+        performDataTypeTest(TEST_LONGVARCHAR_MODEL_WITH_DEFAULT, null, value, "some value");
     }
 
     /**
@@ -632,17 +352,7 @@
     public void testDate()
     {
         // we would use Calendar but that might give Locale problems
-        createDatabase(TEST_DATE_MODEL);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), null });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new Date(103, 12, 25) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals((Object)null,          beans.get(0), "VALUE");
-        assertEquals(new Date(103, 12, 25), beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_DATE_MODEL, null, new Date(103, 12, 25));
     }
 
     /**
@@ -651,17 +361,7 @@
     public void testDateWithDefault()
     {
         // we would use Calendar but that might give Locale problems
-        createDatabase(TEST_DATE_MODEL_WITH_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new Date(105, 0, 1) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Date(105, 0, 1), beans.get(0), "VALUE");
-        assertEquals(new Date(100, 0, 1), beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_DATE_MODEL_WITH_DEFAULT, new Date(105, 0, 1), null, new
Date(100, 0, 1));
     }
 
     /**
@@ -670,17 +370,7 @@
     public void testTime()
     {
         // we would use Calendar but that might give Locale problems
-        createDatabase(TEST_TIME_MODEL);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new Time(03, 47, 15) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), null });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Time(03, 47, 15), beans.get(0), "VALUE");
-        assertEquals((Object)null,         beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_TIME_MODEL, new Time(03, 47, 15), null);
     }
 
     /**
@@ -689,17 +379,7 @@
     public void testTimeWithDefault()
     {
         // we would use Calendar but that might give Locale problems
-        createDatabase(TEST_TIME_MODEL_WITH_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new Time(23, 59, 59) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Time(23, 59, 59), beans.get(0), "VALUE");
-        assertEquals(new Time(11, 27, 03), beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_TIME_MODEL_WITH_DEFAULT, new Time(23, 59, 59), null, new
Time(11, 27, 03));
     }
 
     /**
@@ -710,17 +390,7 @@
         // we would use Calendar but that might give Locale problems
         // also we leave out the fractional part because databases differe
         // in their support here
-        createDatabase(TEST_TIMESTAMP_MODEL);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new Timestamp(70, 0, 1, 0,
0, 0, 0) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), new Timestamp(100, 10, 11,
10, 10, 10, 0)});
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Timestamp(70, 0, 1, 0, 0, 0, 0),       beans.get(0), "VALUE");
-        assertEquals(new Timestamp(100, 10, 11, 10, 10, 10, 0), beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_TIMESTAMP_MODEL, new Timestamp(70, 0, 1, 0, 0, 0, 0), new
Timestamp(100, 10, 11, 10, 10, 10, 0));
     }
 
     /**
@@ -731,17 +401,7 @@
         // we would use Calendar but that might give Locale problems
         // also we leave out the fractional part because databases differe
         // in their support here
-        createDatabase(TEST_TIMESTAMP_MODEL_WITH_DEFAULT);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), new Timestamp(90, 9, 21, 20,
25, 39, 0) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(new Timestamp(90, 9, 21, 20, 25, 39, 0), beans.get(0), "VALUE");
-        assertEquals(new Timestamp(85, 5, 17, 16, 17, 18, 0), beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_TIMESTAMP_MODEL_WITH_DEFAULT, new Timestamp(90, 9, 21, 20,
25, 39, 0), null, new Timestamp(85, 5, 17, 16, 17, 18, 0));
     }
 
     /**
@@ -757,17 +417,9 @@
 
         BinaryObjectsHelper helper = new BinaryObjectsHelper();
 
-        createDatabase(TEST_BINARY_MODEL);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), helper.serialize(value1) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), helper.serialize(value2) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(value1, beans.get(0), "VALUE");
-        assertEquals(value2, beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_BINARY_MODEL,
+                            helper.serialize(value1), helper.serialize(value2),
+                            value1, value2);
     }
 
     /**
@@ -782,17 +434,9 @@
 
         BinaryObjectsHelper helper = new BinaryObjectsHelper();
 
-        createDatabase(TEST_VARBINARY_MODEL);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), helper.serialize(value1) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), helper.serialize(value2) });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(value1,         beans.get(0), "VALUE");
-        assertEquals((Object)value2, beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_VARBINARY_MODEL,
+                            helper.serialize(value1), helper.serialize(value2),
+                            value1, value2);
     }
 
     /**
@@ -807,17 +451,9 @@
 
         BinaryObjectsHelper helper = new BinaryObjectsHelper();
 
-        createDatabase(TEST_LONGVARBINARY_MODEL);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), helper.serialize(value) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), null });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(value,        beans.get(0), "VALUE");
-        assertEquals((Object)null, beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_LONGVARBINARY_MODEL,
+                            helper.serialize(value), null,
+                            value, null);
     }
 
     /**
@@ -832,17 +468,9 @@
 
         BinaryObjectsHelper helper = new BinaryObjectsHelper();
 
-        createDatabase(TEST_BLOB_MODEL);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), helper.serialize(value) });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), null });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals(value,        beans.get(0), "VALUE");
-        assertEquals((Object)null, beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_BLOB_MODEL,
+                            helper.serialize(value), null,
+                            value, null);
     }
 
     /**
@@ -855,16 +483,6 @@
                        "1234567890123456789012345678901234567890123456789012345678901234"+
                        "1234567890123456789012345678901234567890123456789012345678901234";
 
-        createDatabase(TEST_CLOB_MODEL);
-        insertRow("ROUNDTRIP", new Object[] { new Integer(1), null });
-        insertRow("ROUNDTRIP", new Object[] { new Integer(2), value });
-
-        List beans = getRows("ROUNDTRIP");
-
-        assertEquals((Object)null,  beans.get(0), "VALUE");
-        assertEquals((Object)value, beans.get(1), "VALUE");
-
-        assertEquals(getAdjustedModel(),
-                     getPlatform().readModelFromDatabase("roundtriptest"));
+        performDataTypeTest(TEST_CLOB_MODEL, null, value);
     }
 }



Mime
View raw message