db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r503174 - /db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAlteration.java
Date Sat, 03 Feb 2007 05:36:15 GMT
Author: tomdz
Date: Fri Feb  2 21:36:11 2007
New Revision: 503174

URL: http://svn.apache.org/viewvc?view=rev&rev=503174
Log:
Added test for DDLUTILS-153

Modified:
    db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAlteration.java

Modified: db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAlteration.java
URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAlteration.java?view=diff&rev=503174&r1=503173&r2=503174
==============================================================================
--- db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAlteration.java (original)
+++ db/ddlutils/trunk/src/test/org/apache/ddlutils/io/TestAlteration.java Fri Feb  2 21:36:11
2007
@@ -182,6 +182,50 @@
     }
 
     /**
+     * Tests the alteration of the datatypes of a column that is indexed.
+     */
+    public void testChangeIndexColumnDatatype()
+    {
+        final String model1Xml = 
+            "<?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='avalue' type='NUMERIC' size='8' required='false'/>\n"+
+            "    <index name='avalue_index'>\n"+
+            "      <index-column name='avalue'/>\n"+
+            "    </index>\n"+
+            "  </table>\n"+
+            "</database>";
+        final String model2Xml = 
+            "<?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='avalue' type='INTEGER' required='false'/>\n"+
+            "    <index name='avalue_index'>\n"+
+            "      <index-column name='avalue'/>\n"+
+            "    </index>\n"+
+            "  </table>\n"+
+            "</database>";
+
+        createDatabase(model1Xml);
+
+        insertRow("roundtrip", new Object[] { new Integer(1), new Integer(1) });
+        insertRow("roundtrip", new Object[] { new Integer(2), new Integer(10) });
+
+        alterDatabase(model2Xml);
+
+        assertEquals(getAdjustedModel(),
+                     readModelFromDatabase("roundtriptest"));
+
+        List beans = getRows("roundtrip");
+
+        assertEquals(new Integer(1), beans.get(0), "avalue");
+        assertEquals(new Integer(10), beans.get(1), "avalue");
+    }
+
+    /**
      * Tests the alteration of a column size.
      */
     public void testChangeSize()



Mime
View raw message