From: Jeff M. <cus...@us...> - 2002-08-30 14:50:01
|
Update of /cvsroot/mockobjects/mockobjects-java/src/jdk/1.3/com/mockobjects/sql In directory usw-pr-cvs1:/tmp/cvs-serv31012/src/jdk/1.3/com/mockobjects/sql Modified Files: MockResultSetMetaData.java Log Message: Added support for column types to MockResultSetMetaData and create a common base class for both 1.3 and 1.4 jdk Index: MockResultSetMetaData.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/1.3/com/mockobjects/sql/MockResultSetMetaData.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MockResultSetMetaData.java 28 Jun 2002 17:35:39 -0000 1.1 +++ MockResultSetMetaData.java 30 Aug 2002 14:49:58 -0000 1.2 @@ -1,195 +1,19 @@ package com.mockobjects.sql; -import com.mockobjects.*; -import java.sql.*; -import java.sql.SQLException; -import java.util.Vector; - -public class MockResultSetMetaData extends MockObject -implements ResultSetMetaData { - - private ReturnObjectList myNames = new ReturnObjectList("column names"); - private int myColumnCount; - - public void setupGetColumnCount(int aColumnCount){ - myColumnCount = aColumnCount; - } - - /** - * @see ResultSetMetaData#getColumnCount() - */ - public int getColumnCount() throws SQLException { - return myColumnCount; - } - - /** - * @see ResultSetMetaData#isAutoIncrement(int) - */ - public boolean isAutoIncrement(int arg0) throws SQLException { - notImplemented(); - return false; - } - - /** - * @see ResultSetMetaData#isCaseSensitive(int) - */ - public boolean isCaseSensitive(int arg0) throws SQLException { - notImplemented(); - return false; - } - - /** - * @see ResultSetMetaData#isSearchable(int) - */ - public boolean isSearchable(int arg0) throws SQLException { - notImplemented(); - return false; - } - - /** - * @see ResultSetMetaData#isCurrency(int) - */ - public boolean isCurrency(int arg0) throws SQLException { - notImplemented(); - return false; - } - - /** - * @see ResultSetMetaData#isNullable(int) - */ - public int isNullable(int arg0) throws SQLException { - notImplemented(); - return 0; - } - - /** - * @see ResultSetMetaData#isSigned(int) - */ - public boolean isSigned(int arg0) throws SQLException { - notImplemented(); - return false; - } - - /** - * @see ResultSetMetaData#getColumnDisplaySize(int) - */ - public int getColumnDisplaySize(int arg0) throws SQLException { - notImplemented(); - return 0; - } - - /** - * @see ResultSetMetaData#getColumnLabel(int) - */ - public String getColumnLabel(int arg0) throws SQLException { - notImplemented(); - return null; - } +import com.mockobjects.ExpectationList; +import com.mockobjects.MockObject; +import com.mockobjects.ReturnObjectList; - public void setupAddColumnNames(String[] allNames) { - if (allNames != null) { - for (int i = 0; i < allNames.length; i++) { - setupAddColumnName(allNames[i]); - } - } - } - - public void setupAddColumnName(String aName){ - this.myNames.addObjectToReturn(aName); - } - - /** - * @see ResultSetMetaData#getColumnName(int) - */ - public String getColumnName(int aColumnIndex) throws SQLException { - return (String)myNames.nextReturnObject(); - } - - /** - * @see ResultSetMetaData#getSchemaName(int) - */ - public String getSchemaName(int arg0) throws SQLException { - notImplemented(); - return null; - } - - /** - * @see ResultSetMetaData#getPrecision(int) - */ - public int getPrecision(int arg0) throws SQLException { - notImplemented(); - return 0; - } - - /** - * @see ResultSetMetaData#getScale(int) - */ - public int getScale(int arg0) throws SQLException { - notImplemented(); - return 0; - } - - /** - * @see ResultSetMetaData#getTableName(int) - */ - public String getTableName(int arg0) throws SQLException { - notImplemented(); - return null; - } - - /** - * @see ResultSetMetaData#getCatalogName(int) - */ - public String getCatalogName(int arg0) throws SQLException { - notImplemented(); - return null; - } - - /** - * @see ResultSetMetaData#getColumnType(int) - */ - public int getColumnType(int arg0) throws SQLException { - notImplemented(); - return 0; - } - - /** - * @see ResultSetMetaData#getColumnTypeName(int) - */ - public String getColumnTypeName(int arg0) throws SQLException { - notImplemented(); - return null; - } - - /** - * @see ResultSetMetaData#isReadOnly(int) - */ - public boolean isReadOnly(int arg0) throws SQLException { - notImplemented(); - return false; - } - - /** - * @see ResultSetMetaData#isWritable(int) - */ - public boolean isWritable(int arg0) throws SQLException { - notImplemented(); - return false; - } - - /** - * @see ResultSetMetaData#isDefinitelyWritable(int) - */ - public boolean isDefinitelyWritable(int arg0) throws SQLException { - notImplemented(); - return false; - } +import java.sql.ResultSetMetaData; +import java.sql.SQLException; - /** - * @see ResultSetMetaData#getColumnClassName(int) - */ - public String getColumnClassName(int arg0) throws SQLException { - notImplemented(); - return null; - } +/** + * Minimal implementation of ResultSetMetaData for testing. + * Supports column count, column names, and column sql types. + * @see <a href="http://java.sun.com/j2se/1.3/docs/api/java/sql/ResultSetMetaData.html">javax.sql.ResultSetMetaData</a>. + * @author Jeff Martin + * @author Ted Husted + * @version $Revision$ + */ +public class MockResultSetMetaData extends CommonMockResultSetMetaData { } |