]> jaekl.net Git - cfb.git/commitdiff
Add some unit testing of the CfbSchema.
authorChris Jaekl <cejaekl@yahoo.com>
Sat, 3 Oct 2015 07:56:54 +0000 (16:56 +0900)
committerChris Jaekl <cejaekl@yahoo.com>
Sat, 3 Oct 2015 07:56:54 +0000 (16:56 +0900)
16 files changed:
prod/net/jaekl/cfb/CFB.java
prod/net/jaekl/cfb/analyze/MessageMap.java
prod/net/jaekl/cfb/db/CfbSchema.java
prod/net/jaekl/cfb/db/Column.java
prod/net/jaekl/cfb/db/Row.java
prod/net/jaekl/cfb/db/driver/PostgresqlDriver.java
prod/net/jaekl/cfb/store/DbStore.java
prod/net/jaekl/cfb/xml/LocalVariable.java
test/net/jaekl/cfb/db/CfbSchemaTest.java [new file with mode: 0644]
test/net/jaekl/cfb/db/ResultSetMock.java [new file with mode: 0644]
test/net/jaekl/cfb/db/SequenceMock.java [new file with mode: 0644]
test/net/jaekl/cfb/db/TableMock.java [new file with mode: 0644]
test/net/jaekl/cfb/db/driver/ConnectionMock.java [new file with mode: 0644]
test/net/jaekl/cfb/db/driver/DatabaseMetaDataMock.java [new file with mode: 0644]
test/net/jaekl/cfb/db/driver/DbDriverMock.java [new file with mode: 0644]
test/net/jaekl/cfb/xml/MessagesXmlData.java [new file with mode: 0644]

index a830b12c07aa8905b1463673e088ba6fc2abb94e..81c30ea7a39ac86aaa9ee90838775953ecc74189 100644 (file)
@@ -200,6 +200,11 @@ public class CFB {
                String cannotConnectFormat = trans(CfbBundle.CANNOT_CONNECT);
                String cannotConnect = MessageFormat.format(cannotConnectFormat, m_host, ""+m_port, m_dbName, m_user);
                exc.printStackTrace(pw);
+               SQLException next = exc.getNextException();
+               while (null != next) {
+                       next.printStackTrace(pw);
+                       next = next.getNextException();
+               }
                pw.println(cannotConnect);
        }
        
index b0f0b67fac525ce3e3343c1eb993f381f33ca3a0..ae389ad845496a9fd79c9623bc34e1777d6cf4f7 100644 (file)
@@ -116,7 +116,7 @@ public class MessageMap {
        }
        
        // Parse the FindBugs messages.xml file
-       void parse(InputSource xml) throws FileNotFoundException, IOException, SAXException 
+       public void parse(InputSource xml) throws FileNotFoundException, IOException, SAXException 
        {
                m_msgColl = new MessageCollection();
                
index 9a6cc3b78417168b3e68aa7509a71eb4a773c8ea..230133b1a8326f6f9c65b67420a8536bba907cfb 100644 (file)
@@ -50,7 +50,7 @@ public class CfbSchema extends Schema {
        
        private static final Column[] BUGS_COLS       = { BUGID, TYPE };
        private static final Column[] CATEGORIES_COLS = { CATEGORYID, CATEGORY };
-       private static final Column[] FOUND_COLS      = { FOUNDID, BUGID, CATEGORYID, FIRSTLOCID, SECONDLOCID, THIRDLOCID, VARID_FK };
+       private static final Column[] FOUND_COLS      = { FOUNDID, RUNID, BUGID, CATEGORYID, FIRSTLOCID, SECONDLOCID, THIRDLOCID, VARID_FK };
        private static final Column[] LOCATIONS_COLS  = { LOCID, CLASSNAME, METHODNAME, METHODROLE, STARTLINE, ENDLINE };
        private static final Column[] RUNS_COLS       = { RUNID, VERSION, STARTTIME, ENDTIME };
        private static final Column[] VARIABLES_COLS  = { VARID_PK, NAME, VARROLE };
@@ -62,7 +62,7 @@ public class CfbSchema extends Schema {
        public static final Table RUNS       = new Table("RUNS",       RUNS_COLS);
        public static final Table VARIABLES  = new Table("VARIABLES",  VARIABLES_COLS);
        
-       private static final Sequence[] SEQUENCES = {
+       static final Sequence[] SEQUENCES = {
                                        BUG_SEQ,
                                        CATEGORY_SEQ,
                                        FOUND_SEQ,
@@ -71,7 +71,7 @@ public class CfbSchema extends Schema {
                                        VARIABLE_SEQ
                                };
        
-       private static final Table[] TABLES = { 
+       static final Table[] TABLES = { 
                                        BUGS,
                                        CATEGORIES,
                                        FOUND,
index db748b2a0afd083c32d083d1d01a7116153ce518..8fc723ded7b00521bbb8fd103aa9c054437e961e 100644 (file)
@@ -1,5 +1,7 @@
 package net.jaekl.cfb.db;
 
+import net.jaekl.cfb.util.Util;
+
 // Copyright (C) 2015 Christian Jaekl
 
 public class Column {
@@ -45,4 +47,40 @@ public class Column {
                
                return new Column(name, type, width.intValue(), canBeNull);
        }
+       
+       @Override 
+       public boolean equals(Object obj) 
+       {
+               if (null == obj) {
+                       return false;
+               }
+               if (! (obj instanceof Column)) {
+                       return false;
+               }
+               Column other = (Column)obj;
+
+               if (! Util.objsAreEqual(this.getName(), other.getName())) {
+                       return false;
+               }
+               if (! Util.objsAreEqual(this.getType(), other.getType())) {
+                       return false;
+               }
+               if (this.getWidth() != other.getWidth()) {
+                       return false;
+               }
+               if (! Util.objsAreEqual(this.getNull(), other.getNull())) {
+                       return false;
+               }
+               
+               return true;
+       }
+       
+       @Override
+       public int hashCode() {
+               int code = Util.objHashCode(getName())
+                                ^ Util.objHashCode(getType())
+                                ^ getWidth()
+                                ^ Util.objHashCode(getNull());
+               return code;
+       }
 }
index f25b0ae0bd93432e4b2378248794ad2545ca5939..fa3de9948ebb721a18da45230caaadd0131fc02b 100644 (file)
@@ -12,6 +12,7 @@ public class Row {
        }
        
        public int getNumColumns() { return m_columns.length; }
+       public Column getColumn(int idx) { return m_columns[idx]; }
        
        public String getString(int index) throws TypeMismatchException {
                checkType(index, Column.Type.VARCHAR);
index 8e19fc49aca4f63ef76336e2fa0309a13d18c228..fbb328503add803379a1cab500a959bdefc0c9f0 100644 (file)
@@ -8,6 +8,7 @@ import java.sql.SQLException;
 import java.util.Properties;
 
 import net.jaekl.cfb.db.Sequence;
+import net.jaekl.cfb.db.Column.Type;
 
 public class PostgresqlDriver extends DbDriver {
 
@@ -34,4 +35,16 @@ public class PostgresqlDriver extends DbDriver {
        {
                return " SELECT NEXTVAL('" + seq.getName() + "') ";
        }
-}
+       
+       @Override
+       protected String typeName(Type type) {
+               // Special case:  TIMESTAMPTZ stored as INTEGER (milliseconds since the epoch)
+               // Reading a TIMESTAMPTZ back from the DB, and converting it to a java.util.Date,
+               // is fraught with peril.  The best way around this is to store the dates in 
+               // milliseconds-since-the-epoch (01.01.1970 00:00:00.000 UTC).
+               if (Type.TIMESTAMPTZ.equals(type)) {
+                       return "BIGINT";
+               }
+               
+               return type.toString();
+       }}
index 37a389801ca5ced85bf4246de05a012ae68e4a2a..fed1f9d9f8b7ab7f8f4700791a8b7b223e09c83e 100644 (file)
@@ -318,7 +318,7 @@ public class DbStore {
                return prior;
        }
        
-       BugCollection getBugCollection(Long priorId) throws SQLException, TypeMismatchException 
+       BugCollection getBugCollection(Long runId) throws SQLException, TypeMismatchException 
        {
                throw new UnsupportedOperationException("Not yet implemented");
        }
index 277bf2dba69bb82d15ce67fc526fa5676afbc83d..42c282acf7bdd33893f83a176d79494c719ffbd1 100644 (file)
@@ -78,6 +78,6 @@ public class LocalVariable extends ParseResult {
        @Override
        public int hashCode()
        {
-               return ( (1 + Util.objHashCode(m_name)) * (1 + Util.objHashCode(m_role)) );
+               return ( (Util.objHashCode(m_name)) ^ (Util.objHashCode(m_role)) );
        }
 }
diff --git a/test/net/jaekl/cfb/db/CfbSchemaTest.java b/test/net/jaekl/cfb/db/CfbSchemaTest.java
new file mode 100644 (file)
index 0000000..9d32151
--- /dev/null
@@ -0,0 +1,53 @@
+package net.jaekl.cfb.db;
+
+import static org.junit.Assert.*;
+
+import java.io.ByteArrayInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.List;
+
+import net.jaekl.cfb.analyze.MessageMap;
+import net.jaekl.cfb.db.driver.ConnectionMock;
+import net.jaekl.cfb.db.driver.DbDriverMock;
+import net.jaekl.cfb.xml.MessagesXmlData;
+
+import org.junit.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class CfbSchemaTest {
+       @Test
+       public void testEnsureDbInitialized() throws SQLException, FileNotFoundException, IOException, SAXException {
+               ConnectionMock con;
+               DbDriverMock dbDriver;
+               CfbSchema schema;
+               con = new ConnectionMock();
+               dbDriver = new DbDriverMock();
+               schema = new CfbSchema(dbDriver);
+               
+               MessageMap msgMap = new MessageMap();
+               msgMap.parse(new InputSource(new ByteArrayInputStream(MessagesXmlData.XML.getBytes("UTF-8"))));
+               
+               schema.setMessageMap(msgMap);
+               schema.ensureDbInitialized(con);
+               
+               for (Table table : CfbSchema.TABLES) {
+                       assertTablePresent(con, dbDriver, table);
+               }
+       }
+       
+       private void assertTablePresent(ConnectionMock con, DbDriverMock dbDriver, Table table)
+               throws SQLException
+       {
+               Column[] columns = new Column[table.getNumColumns()];
+               Table[] tables = new Table[] { table };
+               
+               for (int i = 0; i < table.getNumColumns(); ++i) {
+                       columns[i] = table.getColumn(i);
+               }
+               List<Row> result = dbDriver.select(con, columns, tables, null);
+               assertNotNull(result);
+       }
+}
diff --git a/test/net/jaekl/cfb/db/ResultSetMock.java b/test/net/jaekl/cfb/db/ResultSetMock.java
new file mode 100644 (file)
index 0000000..4592272
--- /dev/null
@@ -0,0 +1,1208 @@
+package net.jaekl.cfb.db;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.NClob;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.RowId;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Statement;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.Map;
+
+public class ResultSetMock implements ResultSet {
+
+       @Override
+       public boolean isWrapperFor(Class<?> iface) throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public <T> T unwrap(Class<T> iface) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public boolean absolute(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public void afterLast() throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void beforeFirst() throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void cancelRowUpdates() throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void clearWarnings() throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void close() throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void deleteRow() throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public int findColumn(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public boolean first() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public Array getArray(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Array getArray(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public InputStream getAsciiStream(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public InputStream getAsciiStream(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public BigDecimal getBigDecimal(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public BigDecimal getBigDecimal(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public BigDecimal getBigDecimal(int arg0, int arg1) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public BigDecimal getBigDecimal(String arg0, int arg1) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public InputStream getBinaryStream(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public InputStream getBinaryStream(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Blob getBlob(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Blob getBlob(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public boolean getBoolean(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean getBoolean(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public byte getByte(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public byte getByte(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public byte[] getBytes(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public byte[] getBytes(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Reader getCharacterStream(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Reader getCharacterStream(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Clob getClob(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Clob getClob(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public int getConcurrency() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public String getCursorName() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Date getDate(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Date getDate(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Date getDate(int arg0, Calendar arg1) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Date getDate(String arg0, Calendar arg1) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public double getDouble(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public double getDouble(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getFetchDirection() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getFetchSize() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public float getFloat(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public float getFloat(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getHoldability() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getInt(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getInt(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public long getLong(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public long getLong(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public ResultSetMetaData getMetaData() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Reader getNCharacterStream(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Reader getNCharacterStream(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public NClob getNClob(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public NClob getNClob(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getNString(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getNString(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Object getObject(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Object getObject(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Object getObject(int arg0, Map<String, Class<?>> arg1)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Object getObject(String arg0, Map<String, Class<?>> arg1)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public <T> T getObject(int arg0, Class<T> arg1) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public <T> T getObject(String arg0, Class<T> arg1) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Ref getRef(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Ref getRef(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public int getRow() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public RowId getRowId(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public RowId getRowId(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public SQLXML getSQLXML(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public SQLXML getSQLXML(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public short getShort(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public short getShort(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public Statement getStatement() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getString(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getString(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Time getTime(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Time getTime(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Time getTime(int arg0, Calendar arg1) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Time getTime(String arg0, Calendar arg1) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Timestamp getTimestamp(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Timestamp getTimestamp(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Timestamp getTimestamp(int arg0, Calendar arg1) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Timestamp getTimestamp(String arg0, Calendar arg1)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public int getType() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public URL getURL(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public URL getURL(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public InputStream getUnicodeStream(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public InputStream getUnicodeStream(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public SQLWarning getWarnings() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public void insertRow() throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public boolean isAfterLast() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean isBeforeFirst() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean isClosed() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean isFirst() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean isLast() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean last() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public void moveToCurrentRow() throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void moveToInsertRow() throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public boolean next() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean previous() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public void refreshRow() throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public boolean relative(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean rowDeleted() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean rowInserted() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean rowUpdated() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public void setFetchDirection(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void setFetchSize(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateArray(int arg0, Array arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateArray(String arg0, Array arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateAsciiStream(int arg0, InputStream arg1)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateAsciiStream(String arg0, InputStream arg1)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateAsciiStream(int arg0, InputStream arg1, int arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateAsciiStream(String arg0, InputStream arg1, int arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateAsciiStream(int arg0, InputStream arg1, long arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateAsciiStream(String arg0, InputStream arg1, long arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateBigDecimal(int arg0, BigDecimal arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateBigDecimal(String arg0, BigDecimal arg1)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateBinaryStream(int arg0, InputStream arg1)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateBinaryStream(String arg0, InputStream arg1)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateBinaryStream(int arg0, InputStream arg1, int arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateBinaryStream(String arg0, InputStream arg1, int arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateBinaryStream(int arg0, InputStream arg1, long arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateBinaryStream(String arg0, InputStream arg1, long arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateBlob(int arg0, Blob arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateBlob(String arg0, Blob arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateBlob(int arg0, InputStream arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateBlob(String arg0, InputStream arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateBlob(int arg0, InputStream arg1, long arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateBlob(String arg0, InputStream arg1, long arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateBoolean(int arg0, boolean arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateBoolean(String arg0, boolean arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateByte(int arg0, byte arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateByte(String arg0, byte arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateBytes(int arg0, byte[] arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateBytes(String arg0, byte[] arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateCharacterStream(int arg0, Reader arg1)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateCharacterStream(String arg0, Reader arg1)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateCharacterStream(int arg0, Reader arg1, int arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateCharacterStream(String arg0, Reader arg1, int arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateCharacterStream(int arg0, Reader arg1, long arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateCharacterStream(String arg0, Reader arg1, long arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateClob(int arg0, Clob arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateClob(String arg0, Clob arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateClob(int arg0, Reader arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateClob(String arg0, Reader arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateClob(int arg0, Reader arg1, long arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateClob(String arg0, Reader arg1, long arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateDate(int arg0, Date arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateDate(String arg0, Date arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateDouble(int arg0, double arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateDouble(String arg0, double arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateFloat(int arg0, float arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateFloat(String arg0, float arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateInt(int arg0, int arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateInt(String arg0, int arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateLong(int arg0, long arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateLong(String arg0, long arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateNCharacterStream(int arg0, Reader arg1)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateNCharacterStream(String arg0, Reader arg1)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateNCharacterStream(int arg0, Reader arg1, long arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateNCharacterStream(String arg0, Reader arg1, long arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateNClob(int arg0, NClob arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateNClob(String arg0, NClob arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateNClob(int arg0, Reader arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateNClob(String arg0, Reader arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateNClob(int arg0, Reader arg1, long arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateNClob(String arg0, Reader arg1, long arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateNString(int arg0, String arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateNString(String arg0, String arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateNull(int arg0) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateNull(String arg0) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateObject(int arg0, Object arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateObject(String arg0, Object arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateObject(int arg0, Object arg1, int arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateObject(String arg0, Object arg1, int arg2)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateRef(int arg0, Ref arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateRef(String arg0, Ref arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateRow() throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateRowId(int arg0, RowId arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateRowId(String arg0, RowId arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateSQLXML(int arg0, SQLXML arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateSQLXML(String arg0, SQLXML arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateShort(int arg0, short arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateShort(String arg0, short arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateString(int arg0, String arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateString(String arg0, String arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateTime(int arg0, Time arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateTime(String arg0, Time arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateTimestamp(int arg0, Timestamp arg1) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void updateTimestamp(String arg0, Timestamp arg1)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public boolean wasNull() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+}
diff --git a/test/net/jaekl/cfb/db/SequenceMock.java b/test/net/jaekl/cfb/db/SequenceMock.java
new file mode 100644 (file)
index 0000000..c2208b2
--- /dev/null
@@ -0,0 +1,20 @@
+package net.jaekl.cfb.db;
+
+public class SequenceMock extends Sequence {
+
+       long m_val;
+       
+       public SequenceMock(String name) {
+               super(name);
+               m_val = 0;
+       }
+       
+       public SequenceMock(Sequence seq) {
+               this(seq.getName());
+       }
+
+       public long mock_nextVal() {
+               m_val += 1;
+               return m_val;
+       }
+}
diff --git a/test/net/jaekl/cfb/db/TableMock.java b/test/net/jaekl/cfb/db/TableMock.java
new file mode 100644 (file)
index 0000000..1c91115
--- /dev/null
@@ -0,0 +1,42 @@
+package net.jaekl.cfb.db;
+
+import java.util.ArrayList;
+
+import static org.junit.Assert.*;
+
+public class TableMock extends Table {
+
+       private ArrayList<Row> m_rows;
+       
+       public TableMock(String name, Column[] columns) {
+               super(name, columns);
+               m_rows = new ArrayList<Row>();
+       }
+       
+       public TableMock(Table table) {
+               this(table.m_name, table.m_columns.toArray(new Column[table.m_columns.size()]));
+       }
+       
+       protected ArrayList<Row> mock_getRows() { return m_rows; }
+
+       public boolean mock_hasColumn(Column expectedCol) {
+               for (Column col : m_columns) {
+                       if (col.equals(expectedCol)) {
+                               return true;
+                       }
+               }
+               return false;
+       }
+       
+       public Column[] mock_getColumns() { 
+               return m_columns.toArray(new Column[m_columns.size()]);
+       }
+       
+       public void mock_insert(Row row) {
+               assertEquals(getNumColumns(), row.getNumColumns());
+               for (int i = 0; i < getNumColumns(); ++i) {
+                       assertEquals(getColumn(i).getType(), row.getColumn(i).getType());
+               }
+               m_rows.add(row);
+       }
+}
diff --git a/test/net/jaekl/cfb/db/driver/ConnectionMock.java b/test/net/jaekl/cfb/db/driver/ConnectionMock.java
new file mode 100644 (file)
index 0000000..b25a3fc
--- /dev/null
@@ -0,0 +1,365 @@
+package net.jaekl.cfb.db.driver;
+
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.CallableStatement;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.NClob;
+import java.sql.PreparedStatement;
+import java.sql.SQLClientInfoException;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Savepoint;
+import java.sql.Statement;
+import java.sql.Struct;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.Executor;
+
+public class ConnectionMock implements Connection {
+
+       @Override
+       public boolean isWrapperFor(Class<?> arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public <T> T unwrap(Class<T> arg0) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public void abort(Executor executor) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void clearWarnings() throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void close() throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void commit() throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public Array createArrayOf(String typeName, Object[] elements)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Blob createBlob() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Clob createClob() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public NClob createNClob() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public SQLXML createSQLXML() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Statement createStatement() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Statement createStatement(int resultSetType, int resultSetConcurrency)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Statement createStatement(int resultSetType,
+                       int resultSetConcurrency, int resultSetHoldability)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Struct createStruct(String typeName, Object[] attributes)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public boolean getAutoCommit() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public String getCatalog() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Properties getClientInfo() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getClientInfo(String name) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public int getHoldability() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public DatabaseMetaData getMetaData() throws SQLException {
+               DatabaseMetaData result = new DatabaseMetaDataMock();
+               return result;
+       }
+
+       @Override
+       public int getNetworkTimeout() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public String getSchema() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public int getTransactionIsolation() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public Map<String, Class<?>> getTypeMap() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public SQLWarning getWarnings() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public boolean isClosed() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean isReadOnly() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean isValid(int timeout) throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public String nativeSQL(String sql) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public CallableStatement prepareCall(String sql) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public CallableStatement prepareCall(String sql, int resultSetType,
+                       int resultSetConcurrency) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public CallableStatement prepareCall(String sql, int resultSetType,
+                       int resultSetConcurrency, int resultSetHoldability)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public PreparedStatement prepareStatement(String sql) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public PreparedStatement prepareStatement(String sql, String[] columnNames)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public PreparedStatement prepareStatement(String sql, int resultSetType,
+                       int resultSetConcurrency) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public PreparedStatement prepareStatement(String sql, int resultSetType,
+                       int resultSetConcurrency, int resultSetHoldability)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public void releaseSavepoint(Savepoint savepoint) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void rollback() throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void rollback(Savepoint savepoint) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void setAutoCommit(boolean autoCommit) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void setCatalog(String catalog) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void setClientInfo(Properties properties)
+                       throws SQLClientInfoException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void setClientInfo(String name, String value)
+                       throws SQLClientInfoException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void setHoldability(int holdability) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void setNetworkTimeout(Executor executor, int milliseconds)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void setReadOnly(boolean readOnly) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public Savepoint setSavepoint() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Savepoint setSavepoint(String name) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public void setSchema(String schema) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void setTransactionIsolation(int level) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+       @Override
+       public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
+               // TODO Auto-generated method stub
+
+       }
+
+}
diff --git a/test/net/jaekl/cfb/db/driver/DatabaseMetaDataMock.java b/test/net/jaekl/cfb/db/driver/DatabaseMetaDataMock.java
new file mode 100644 (file)
index 0000000..265fc1a
--- /dev/null
@@ -0,0 +1,1103 @@
+package net.jaekl.cfb.db.driver;
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.RowIdLifetime;
+import java.sql.SQLException;
+
+import net.jaekl.cfb.db.ResultSetMock;
+
+public class DatabaseMetaDataMock implements DatabaseMetaData {
+
+       @Override
+       public boolean isWrapperFor(Class<?> iface) throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public <T> T unwrap(Class<T> iface) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public boolean allProceduresAreCallable() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean allTablesAreSelectable() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean deletesAreDetected(int type) throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean generatedKeyAlwaysReturned() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public ResultSet getAttributes(String catalog, String schemaPattern,
+                       String typeNamePattern, String attributeNamePattern)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getBestRowIdentifier(String catalog, String schema,
+                       String table, int scope, boolean nullable) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getCatalogSeparator() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getCatalogTerm() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getCatalogs() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getClientInfoProperties() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getColumnPrivileges(String catalog, String schema,
+                       String table, String columnNamePattern) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getColumns(String catalog, String schemaPattern,
+                       String tableNamePattern, String columnNamePattern)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public Connection getConnection() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getCrossReference(String parentCatalog,
+                       String parentSchema, String parentTable, String foreignCatalog,
+                       String foreignSchema, String foreignTable) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public int getDatabaseMajorVersion() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getDatabaseMinorVersion() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public String getDatabaseProductName() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getDatabaseProductVersion() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public int getDefaultTransactionIsolation() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getDriverMajorVersion() {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getDriverMinorVersion() {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public String getDriverName() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getDriverVersion() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getExportedKeys(String catalog, String schema, String table)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getExtraNameCharacters() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getFunctionColumns(String catalog, String schemaPattern,
+                       String functionNamePattern, String columnNamePattern)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getFunctions(String catalog, String schemaPattern,
+                       String functionNamePattern) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getIdentifierQuoteString() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getImportedKeys(String catalog, String schema, String table)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getIndexInfo(String catalog, String schema, String table,
+                       boolean unique, boolean approximate) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public int getJDBCMajorVersion() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getJDBCMinorVersion() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxBinaryLiteralLength() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxCatalogNameLength() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxCharLiteralLength() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxColumnNameLength() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxColumnsInGroupBy() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxColumnsInIndex() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxColumnsInOrderBy() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxColumnsInSelect() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxColumnsInTable() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxConnections() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxCursorNameLength() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxIndexLength() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxProcedureNameLength() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxRowSize() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxSchemaNameLength() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxStatementLength() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxStatements() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxTableNameLength() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxTablesInSelect() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public int getMaxUserNameLength() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public String getNumericFunctions() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getPrimaryKeys(String catalog, String schema, String table)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getProcedureColumns(String catalog, String schemaPattern,
+                       String procedureNamePattern, String columnNamePattern)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getProcedureTerm() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getProcedures(String catalog, String schemaPattern,
+                       String procedureNamePattern) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getPseudoColumns(String catalog, String schemaPattern,
+                       String tableNamePattern, String columnNamePattern)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public int getResultSetHoldability() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public RowIdLifetime getRowIdLifetime() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getSQLKeywords() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public int getSQLStateType() throws SQLException {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+       @Override
+       public String getSchemaTerm() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getSchemas() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getSchemas(String catalog, String schemaPattern)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getSearchStringEscape() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getStringFunctions() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getSuperTables(String catalog, String schemaPattern,
+                       String tableNamePattern) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getSuperTypes(String catalog, String schemaPattern,
+                       String typeNamePattern) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getSystemFunctions() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getTablePrivileges(String catalog, String schemaPattern,
+                       String tableNamePattern) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getTableTypes() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) 
+               throws SQLException 
+       {
+               ResultSetMock result = new ResultSetMock();
+               return result;
+       }
+
+       @Override
+       public String getTimeDateFunctions() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getTypeInfo() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getUDTs(String catalog, String schemaPattern,
+                       String typeNamePattern, int[] types) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getURL() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getUserName() throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public ResultSet getVersionColumns(String catalog, String schema,
+                       String table) throws SQLException {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public boolean insertsAreDetected(int type) throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean isCatalogAtStart() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean isReadOnly() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean locatorsUpdateCopy() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean nullPlusNonNullIsNull() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean nullsAreSortedAtEnd() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean nullsAreSortedAtStart() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean nullsAreSortedHigh() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean nullsAreSortedLow() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean othersDeletesAreVisible(int type) throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean othersInsertsAreVisible(int type) throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean othersUpdatesAreVisible(int type) throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean ownDeletesAreVisible(int type) throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean ownInsertsAreVisible(int type) throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean ownUpdatesAreVisible(int type) throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean storesLowerCaseIdentifiers() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean storesMixedCaseIdentifiers() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean storesUpperCaseIdentifiers() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsANSI92EntryLevelSQL() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsANSI92FullSQL() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsANSI92IntermediateSQL() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsAlterTableWithAddColumn() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsAlterTableWithDropColumn() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsBatchUpdates() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsCatalogsInDataManipulation() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsCatalogsInProcedureCalls() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsCatalogsInTableDefinitions() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsColumnAliasing() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsConvert() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsConvert(int fromType, int toType)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsCoreSQLGrammar() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsCorrelatedSubqueries() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsDataDefinitionAndDataManipulationTransactions()
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsDataManipulationTransactionsOnly()
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsDifferentTableCorrelationNames() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsExpressionsInOrderBy() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsExtendedSQLGrammar() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsFullOuterJoins() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsGetGeneratedKeys() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsGroupBy() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsGroupByBeyondSelect() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsGroupByUnrelated() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsIntegrityEnhancementFacility() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsLikeEscapeClause() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsLimitedOuterJoins() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsMinimumSQLGrammar() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsMixedCaseIdentifiers() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsMultipleOpenResults() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsMultipleResultSets() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsMultipleTransactions() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsNamedParameters() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsNonNullableColumns() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsOrderByUnrelated() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsOuterJoins() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsPositionedDelete() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsPositionedUpdate() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsResultSetConcurrency(int type, int concurrency)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsResultSetHoldability(int holdability)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsResultSetType(int type) throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsSavepoints() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsSchemasInDataManipulation() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsSchemasInIndexDefinitions() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsSchemasInProcedureCalls() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsSchemasInTableDefinitions() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsSelectForUpdate() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsStatementPooling() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsStoredProcedures() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsSubqueriesInComparisons() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsSubqueriesInExists() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsSubqueriesInIns() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsSubqueriesInQuantifieds() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsTableCorrelationNames() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsTransactionIsolationLevel(int level)
+                       throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsTransactions() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsUnion() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean supportsUnionAll() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean updatesAreDetected(int type) throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean usesLocalFilePerTable() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public boolean usesLocalFiles() throws SQLException {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+}
diff --git a/test/net/jaekl/cfb/db/driver/DbDriverMock.java b/test/net/jaekl/cfb/db/driver/DbDriverMock.java
new file mode 100644 (file)
index 0000000..833df82
--- /dev/null
@@ -0,0 +1,151 @@
+package net.jaekl.cfb.db.driver;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import net.jaekl.cfb.db.Column;
+import net.jaekl.cfb.db.Condition;
+import net.jaekl.cfb.db.Row;
+import net.jaekl.cfb.db.Sequence;
+import net.jaekl.cfb.db.SequenceMock;
+import net.jaekl.cfb.db.Sort;
+import net.jaekl.cfb.db.Table;
+import net.jaekl.cfb.db.TableMock;
+
+public class DbDriverMock extends DbDriver {
+
+       private HashMap<String, TableMock> m_tables;
+       private HashMap<String, SequenceMock> m_sequences;
+       
+       public DbDriverMock() {
+               super();
+               m_tables = new HashMap<String, TableMock>();
+               m_sequences = new HashMap<String, SequenceMock>();
+       }
+
+       @Override
+       public void load() throws ClassNotFoundException {
+               // no-op
+       }
+
+       @Override
+       public Connection connect(String host, int port, String dbName, String user, String pass) 
+               throws SQLException 
+       {
+               return null;
+       }
+       
+       @Override
+       public boolean createTable(Connection con, Table table) throws SQLException
+       {
+               assertNotNull(con);
+               assertNotNull(table);
+               assertFalse(m_tables.containsKey(table.getName()));
+               
+               TableMock tm = new TableMock(table);
+               m_tables.put(table.getName(), tm);
+               return true;
+       }
+       
+       @Override
+       public void dropTable(Connection con, Table table) throws SQLException 
+       {
+               assertNotNull(con);
+               assertNotNull(table);
+               assertTrue(table instanceof TableMock);
+               
+               if (m_tables.containsKey(table.getName())) {
+                       m_tables.remove(table.getName());
+               }
+               else {
+                       throw new SQLException("Table " + table.getName() + " does not exist.");
+               }
+       }
+       
+       @Override
+       public boolean createSequence(Connection con, Sequence seq) throws SQLException 
+       {
+               assertNotNull(con);
+               assertNotNull(seq);
+               assertFalse(m_sequences.containsKey(seq.getName()));
+               
+               SequenceMock sm = (seq instanceof SequenceMock) ? (SequenceMock)seq : new SequenceMock(seq);
+               
+               m_sequences.put(seq.getName(), sm);
+               return true;
+       }
+       
+       public void dropSequence(Connection con, Sequence seq) throws SQLException
+       {
+               assertNotNull(con);
+               assertNotNull(seq);
+               assertTrue(seq instanceof SequenceMock);
+
+               if (m_sequences.containsKey(seq.getName())) {
+                       m_sequences.remove(seq.getName());
+               }
+               else {
+                       throw new SQLException("Sequence " + seq.getName() + " does not exist.");
+               }
+       }
+       
+       public List<Row> select(Connection con, Column[] columns, Table[] tables, Condition[] conditions, Sort[] sorts, int limit)
+               throws SQLException
+       {
+               assertNotNull(con);
+               assertNotNull(columns);
+               assertNotNull(tables);
+               
+               // TODO:  produce sensible output
+               return new ArrayList<Row>();
+       }
+       
+       // Returns the number of rows inserted
+       @Override
+       public int insert(Connection con, Table table, Object[][] values) throws SQLException 
+       {
+               assertNotNull(con);
+               assertNotNull(table);
+               assertNotNull(values);
+               
+               TableMock tm = m_tables.get(table.getName());
+               if (null == tm) {
+                       throw new SQLException("Table " + table.getName() + " does not exist.");
+               }
+               Column[] columns = tm.mock_getColumns();
+
+               for (Object[] rowVals : values) {
+                       assertNotNull(rowVals);
+                       assertEquals(table.getNumColumns(), rowVals.length);
+                       
+                       tm.mock_insert(new Row(columns, rowVals));
+               }
+               
+               return values.length;
+       }
+
+
+       public long nextVal(Connection con, Sequence seq) throws SQLException
+       {
+               assertNotNull(con);
+               assertNotNull(seq);
+               
+               SequenceMock sm = m_sequences.get(seq.getName());
+               return sm.mock_nextVal();
+       }
+       
+       
+       @Override
+       protected String nextValSql(Sequence seq) 
+       {
+               return "";
+       }
+}
diff --git a/test/net/jaekl/cfb/xml/MessagesXmlData.java b/test/net/jaekl/cfb/xml/MessagesXmlData.java
new file mode 100644 (file)
index 0000000..5b81dca
--- /dev/null
@@ -0,0 +1,227 @@
+package net.jaekl.cfb.xml;
+
+public class MessagesXmlData {
+       public static final String XML = 
+                 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+               + "<MessageCollection xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+               + "xsi:noNamespaceSchemaLocation=\"messagecollection.xsd\">\n"
+               + "<BugCategory category=\"CORRECTNESS\">\n"
+               + "    <Description>Correctness</Description>\n"
+               + "    <Abbreviation>C</Abbreviation>\n"
+               + "    <Details>Probable bug - an apparent coding mistake\n"
+               + "           resulting in code that was probably not what the\n"
+               + "           developer intended. We strive for a low false positive rate.</Details>\n"
+               + "  </BugCategory>\n"
+               + "  <BugCategory category=\"NOISE\">\n"
+               + "                 <Description>Bogus random noise</Description>\n"
+               + "                 <Abbreviation>N</Abbreviation>\n"
+               + "                 <Details>Bogus random noise: intended to be useful\n"
+               + "                 as a control in data mining experiments, not in finding actual bugs in software\n"
+               + "                         </Details>\n"
+               + "               </BugCategory>\n"
+               + "               <BugCategory category=\"SECURITY\">\n"
+               + "                 <Description>Security</Description>\n"
+               + "                 <Abbreviation>S</Abbreviation>\n"
+               + "                 <Details>A use of untrusted input in a way that could create a remotely exploitable security vulnerability.\n"
+               + "                 </Details>\n"
+               + "               </BugCategory>\n"
+               + "               <BugCategory category=\"BAD_PRACTICE\">\n"
+               + "                 <Description>Bad practice</Description>\n"
+               + "                 <Abbreviation>B</Abbreviation>\n"
+               + "                 <Details>Violations of recommended and essential\n"
+               + "                         coding practice. Examples include hash code and equals\n"
+               + "                         problems, cloneable idiom, dropped exceptions,\n"
+               + "                         Serializable problems, and misuse of finalize.\n"
+               + "                         We strive to make this analysis accurate,\n"
+               + "                         although some groups may\n"
+               + "                         not care about some of the bad practices.</Details>\n"
+               + "               </BugCategory>\n"
+               + "               <BugCategory category=\"STYLE\">\n"
+               + "                 <Description>Dodgy code</Description>\n"
+               + "                 <Abbreviation>D</Abbreviation>\n"
+               + "                 <Details>code that is confusing, anomalous, or\n"
+               + "                         written in a way that leads itself to errors.\n"
+               + "                         Examples include dead local stores, switch fall through,\n"
+               + "                         unconfirmed casts, and redundant null check of value\n"
+               + "                         known to be null.\n"
+               + "                         More false positives accepted.\n"
+               + "                         In previous versions of FindBugs, this category was known as Style.\n"
+               + "             </Details>\n"
+               + "               </BugCategory>\n"
+               + "               <BugCategory category=\"PERFORMANCE\">\n"
+               + "                 <Description>Performance</Description>\n"
+               + "                 <Abbreviation>P</Abbreviation>\n"
+               + "                 <Details>code that is not necessarily incorrect but may be inefficient</Details>\n"
+               + "               </BugCategory>\n"
+               + "               <BugCategory category=\"MALICIOUS_CODE\">\n"
+               + "                 <Description>Malicious code vulnerability</Description>\n"
+               + "                 <Abbreviation>V</Abbreviation>\n"
+               + "                 <Details>code that is vulnerable to attacks from untrusted code</Details>\n"
+               + "               </BugCategory>\n"
+               + "               <BugCategory category=\"MT_CORRECTNESS\">\n"
+               + "                 <Description>Multithreaded correctness</Description>\n"
+               + "                 <Abbreviation>M</Abbreviation>\n"
+               + "                 <Details>code flaws having to do with threads, locks, and volatiles</Details>\n"
+               + "               </BugCategory>\n"
+               + "               <BugCategory category=\"I18N\">\n"
+               + "                 <Description>Internationalization</Description>\n"
+               + "                 <Abbreviation>I</Abbreviation>\n"
+               + "                 <Details>code flaws having to do with internationalization and locale</Details>\n"
+               + "                 <!-- DM_CONVERT_CASE is the only core bug pattern in this category -->\n"
+               + "               </BugCategory>\n"
+               + "               <BugCategory category=\"EXPERIMENTAL\">\n"
+               + "                 <Description>Experimental</Description>\n"
+               + "                 <Abbreviation>X</Abbreviation>\n"
+               + "                 <Details>Experimental and not fully vetted bug patterns</Details>\n"
+               + "                 <!-- DM_CONVERT_CASE is the only core bug pattern in this category -->\n"
+               + "               </BugCategory>\n"
+               + "               <!--\n"
+               + "               **********************************************************************\n"
+               + "               BugPatterns\n"
+               + "               **********************************************************************\n"
+               + "                -->\n"
+               + "               <BugPattern type=\"CNT_ROUGH_CONSTANT_VALUE\">\n"
+               + "                 <ShortDescription>Rough value of known constant found</ShortDescription>\n"
+               + "                 <LongDescription>Rough value of {3} found: {2}</LongDescription>\n"
+               + "                 <Details>\n"
+               + "                   <![CDATA[\n"
+               + "                 <p>It's recommended to use the predefined library constant for code clarity and better precision.</p>\n"
+               + "             ]]>\n"
+               + "                 </Details>\n"
+               + "               </BugPattern>\n"
+               + "               <BugPattern type=\"SKIPPED_CLASS_TOO_BIG\">\n"
+               + "                 <ShortDescription>Class too big for analysis</ShortDescription>\n"
+               + "                 <LongDescription>{0} is too big for analysis</LongDescription>\n"
+               + "                 <Details>\n"
+               + "                   <![CDATA[\n"
+               + "                 <p>This class is bigger than can be effectively handled, and was not fully analyzed for errors.\n"
+               + "             </p>\n"
+               + "\n"
+               + "             ]]>\n"
+               + "                 </Details>\n"
+               + "               </BugPattern>\n"
+               + "               <BugPattern type=\"NOISE_NULL_DEREFERENCE\">\n"
+               + "                 <ShortDescription>Bogus warning about a null pointer dereference</ShortDescription>\n"
+               + "                 <LongDescription>Bogus warning about a null pointer dereference in {1}</LongDescription>\n"
+               + "                 <Details>\n"
+               + "                   <![CDATA[\n"
+               + "                 <p>Bogus warning.</p>\n"
+               + "             ]]>\n"
+               + "                 </Details>\n"
+               + "               </BugPattern>\n"
+               + "               <BugPattern type=\"NOISE_METHOD_CALL\">\n"
+               + "                 <ShortDescription>Bogus warning about a method call</ShortDescription>\n"
+               + "                 <LongDescription>Bogus warning about a method call {2} in {1}</LongDescription>\n"
+               + "                 <Details>\n"
+               + "                   <![CDATA[\n"
+               + "                 <p>Bogus warning.</p>\n"
+               + "             ]]>\n"
+               + "                 </Details>\n"
+               + "               </BugPattern>\n"
+               + "               <BugPattern type=\"NOISE_FIELD_REFERENCE\">\n"
+               + "                 <ShortDescription>Bogus warning about a field reference</ShortDescription>\n"
+               + "                 <LongDescription>Bogus warning about a reference to {2} in {1}</LongDescription>\n"
+               + "                 <Details>\n"
+               + "                   <![CDATA[\n"
+               + "                 <p>Bogus warning.</p>\n"
+               + "             ]]>\n"
+               + "                 </Details>\n"
+               + "               </BugPattern>\n"
+               + "               <BugPattern type=\"NOISE_OPERATION\">\n"
+               + "                 <ShortDescription>Bogus warning about an operation</ShortDescription>\n"
+               + "                 <LongDescription>Bogus warning about an operation {1}</LongDescription>\n"
+               + "                 <Details>\n"
+               + "                   <![CDATA[\n"
+               + "                 <p>Bogus warning.</p>\n"
+               + "             ]]>\n"
+               + "                 </Details>\n"
+               + "               </BugPattern>\n"
+               + "                 <BugPattern type=\"DMI_BIGDECIMAL_CONSTRUCTED_FROM_DOUBLE\">\n"
+               + "                     <ShortDescription>BigDecimal constructed from double that isn't represented precisely</ShortDescription>\n"
+               + "                     <LongDescription>BigDecimal constructed from {4} in {1}</LongDescription>\n"
+               + "                     <Details>\n"
+               + "                   <![CDATA[\n"
+               + "                 <p>\n"
+               + "             This code creates a BigDecimal from a double value that doesn't translate well to a\n"
+               + "             decimal number.\n"
+               + "             For example, one might assume that writing new BigDecimal(0.1) in Java creates a BigDecimal which is exactly equal to 0.1 (an unscaled value of 1, with a scale of 1), but it is actually equal to 0.1000000000000000055511151231257827021181583404541015625.\n"
+               + "             You probably want to use the BigDecimal.valueOf(double d) method, which uses the String representation\n"
+               + "             of the double to create the BigDecimal (e.g., BigDecimal.valueOf(0.1) gives 0.1).\n"
+               + "             </p>\n"
+               + "\n"
+               + "             ]]>\n"
+               + "                 </Details>\n"
+               + "                 </BugPattern>\n"
+               + "\n"
+               + "                 <BugPattern type=\"DMI_DOH\">\n"
+               + "                     <ShortDescription>D'oh! A nonsensical method invocation</ShortDescription>\n"
+               + "                     <LongDescription>D'oh! A nonsensical invocation of {2.nameAndSignature} in {1}</LongDescription>\n"
+               + "                     <Details>\n"
+               + "                   <![CDATA[\n"
+               + "                 <p>\n"
+               + "             This partical method invocation doesn't make sense, for reasons that should be apparent from inspection.\n"
+               + "             </p>\n"
+               + "\n"
+               + "             ]]>\n"
+               + "                 </Details>\n"
+               + "                 </BugPattern>\n"
+               + "\n"
+               + "               <BugPattern type=\"DMI_VACUOUS_CALL_TO_EASYMOCK_METHOD\">"
+               + "                 <ShortDescription>Useless/vacuous call to EasyMock method</ShortDescription>"
+               + "                 <LongDescription>Useless/vacuous call to {2} in {1}</LongDescription>"
+               + "                 <Details>"
+               + "                   <![CDATA["
+               + "                 <p>This call doesn't pass any objects to the EasyMock method, so the call doesn't do anything."
+               + "             </p>"
+               + ""
+               + "             ]]>"
+               + "                 </Details>"
+               + "               </BugPattern>"
+               + "               <BugPattern type=\"DMI_SCHEDULED_THREAD_POOL_EXECUTOR_WITH_ZERO_CORE_THREADS\">"
+               + "                 <ShortDescription>Creation of ScheduledThreadPoolExecutor with zero core threads</ShortDescription>"
+               + "                 <LongDescription>Creation of ScheduledThreadPoolExecutor with zero core threads in {1}</LongDescription>"
+               + "                 <Details>"
+               + "                   <![CDATA["
+               + "                 <p>(<a href=\"http://java.sun.com/javase/6/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html#ScheduledThreadPoolExecutor(int)\">Javadoc</a>)"
+               + "             A ScheduledThreadPoolExecutor with zero core threads will never execute anything; changes to the max pool size are ignored."
+               + "             </p>"
+               + ""
+               + "             ]]>"
+               + "                 </Details>"
+               + "               </BugPattern>"
+               + "               <BugPattern type=\"DMI_FUTILE_ATTEMPT_TO_CHANGE_MAXPOOL_SIZE_OF_SCHEDULED_THREAD_POOL_EXECUTOR\">"
+               + "                 <ShortDescription>Futile attempt to change max pool size of ScheduledThreadPoolExecutor</ShortDescription>"
+               + "                 <LongDescription>Futile attempt to change max pool size of ScheduledThreadPoolExecutor in {1}</LongDescription>"
+               + "                 <Details>"
+               + "                   <![CDATA["
+               + "                 <p>(<a href=\"http://java.sun.com/javase/6/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html\">Javadoc</a>)"
+               + "             While ScheduledThreadPoolExecutor inherits from ThreadPoolExecutor, a few of the inherited tuning methods are not useful for it. In particular, because it acts as a fixed-sized pool using corePoolSize threads and an unbounded queue, adjustments to maximumPoolSize have no useful effect."
+               + "                 </p>"
+               + ""
+               + "             ]]>"
+               + "                 </Details>"
+               + "               </BugPattern>"
+               + "               <BugPattern type=\"DMI_UNSUPPORTED_METHOD\">"
+               + "                 <ShortDescription>Call to unsupported method</ShortDescription>"
+               + "                 <LongDescription>Call to unsupported method {2} in {1}</LongDescription>"
+               + "                 <Details>"
+               + "                   <![CDATA["
+               + "                 <p>All targets of this method invocation throw an UnsupportedOperationException."
+               + "             </p>"
+               + ""
+               + "             ]]>"
+               + "                 </Details>"
+               + "               </BugPattern>"
+               + "               <BugPattern type=\"DMI_EMPTY_DB_PASSWORD\">"
+               + "                 <ShortDescription>Empty database password</ShortDescription>"
+               + "                 <LongDescription>Empty database password in {1}</LongDescription>"
+               + "                 <Details>"
+               + "                   <![CDATA["
+               + "                 <p>This code creates a database connect using a blank or empty password. This indicates that the database is not protected by a password."
+               + "             </p>"
+               + ""
+               + "             ]]>"
+               + "                 </Details>"
+               + "               </BugPattern>"
+               + "</MessageCollection>";
+}