db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1029420 - /db/torque/village/trunk/src/test/com/workingdogs/village/TestMySQL.java
Date Sun, 31 Oct 2010 17:08:34 GMT
Author: tv
Date: Sun Oct 31 17:08:34 2010
New Revision: 1029420

URL: http://svn.apache.org/viewvc?rev=1029420&view=rev
Log:
Added a second table and a test to check schema population based on DB-metadata

Modified:
    db/torque/village/trunk/src/test/com/workingdogs/village/TestMySQL.java

Modified: db/torque/village/trunk/src/test/com/workingdogs/village/TestMySQL.java
URL: http://svn.apache.org/viewvc/db/torque/village/trunk/src/test/com/workingdogs/village/TestMySQL.java?rev=1029420&r1=1029419&r2=1029420&view=diff
==============================================================================
--- db/torque/village/trunk/src/test/com/workingdogs/village/TestMySQL.java (original)
+++ db/torque/village/trunk/src/test/com/workingdogs/village/TestMySQL.java Sun Oct 31 17:08:34
2010
@@ -75,6 +75,36 @@ import junit.framework.TestCase;
  *  w TEXT null,
  *  x MEDIUMTEXT null
  *  );
+ *  
+ *  (for schema checks)
+ *  CREATE TABLE test1
+ *  (
+ *  aa TINYINT null,
+ *  bb SMALLINT null,
+ *  cc MEDIUMINT null,
+ *  dd INT null,
+ *  ee INTEGER null,
+ *  ff BIGINT null,
+ *  gg REAL null,
+ *  hh DOUBLE null,
+ *  ii FLOAT null,
+ *  jj DECIMAL(8,1) null,
+ *  kk NUMERIC(8,1) null,
+ *  ll CHAR(255) null,
+ *  mm VARCHAR(255) null,
+ *  nn DATE null,
+ *  oo TIME null,
+ *  pp TIMESTAMP null,
+ *  qq DATETIME null,
+ *  rr TINYBLOB null,
+ *  ss BLOB null,
+ *  tt MEDIUMBLOB null,
+ *  uu LONGBLOB null,
+ *  vv TINYTEXT null,
+ *  ww TEXT null,
+ *  xx MEDIUMTEXT null,
+ *  yy MEDIUMTEXT null
+ *  );
  *  </pre>
  * </p>
  *
@@ -561,6 +591,27 @@ public class TestMySQL extends TestCase
             assertEquals(schema.getTableName(), "test");
         }
     }
+
+    /**
+     * Test schema population out of database metadata
+     *
+     * @throws DataSetException 
+     * @throws SQLException 
+     */
+    public void testSchemaPopulation()
+            throws SQLException, DataSetException
+    {
+        Schema.initSchemas(conn);
+        Schema test = new Schema().schema(conn, "test");
+        assertEquals("test", test.tableName());
+        assertEquals(24, test.numberOfColumns());
+        assertEquals("a", test.column(1).name());
+        
+        Schema test1 = new Schema().schema(conn, "test1");
+        assertEquals("test1", test1.tableName());
+        assertEquals(25, test1.numberOfColumns());
+        assertEquals("aa", test1.column(1).name());
+    }
     
     /**
      * Get a connection. 



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message