From: Jeff M. <cus...@us...> - 2002-06-25 10:14:53
|
Update of /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql In directory usw-pr-cvs1:/tmp/cvs-serv5636/src/jdk/common/com/mockobjects/sql Modified Files: MockConnection.java MockStatement.java Log Message: Replaced UnsupportedOperationExceptions with calls to notImplemented Changes setupResultSet to be addResult set to support multiple result sets Index: MockConnection.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/MockConnection.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MockConnection.java 19 Jun 2002 15:26:25 -0000 1.2 +++ MockConnection.java 25 Jun 2002 10:14:51 -0000 1.3 @@ -55,6 +55,7 @@ } public void clearWarnings() throws SQLException { + notImplemented(); } public void setupCloseException(SQLException aCloseException) { @@ -82,32 +83,39 @@ int resultSetType, int resultSetConcurrency) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public boolean getAutoCommit() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return false; } public String getCatalog() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public DatabaseMetaData getMetaData() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public int getTransactionIsolation() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return 0; } public Map getTypeMap() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public SQLWarning getWarnings() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public void setupIsClosedException(SQLException aIsClosedException) { @@ -126,16 +134,19 @@ } public boolean isReadOnly() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return false; } public String nativeSQL(String sql) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public CallableStatement prepareCall(String sql) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public CallableStatement prepareCall( @@ -143,7 +154,8 @@ int resultSetType, int resultSetConcurrency) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public PreparedStatement prepareStatement(String sql) throws SQLException { @@ -157,7 +169,8 @@ int resultSetType, int resultSetConcurrency) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public void rollback() throws SQLException { @@ -173,20 +186,20 @@ } public void setCatalog(String catalog) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public void setReadOnly(boolean readOnly) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public void setTransactionIsolation(int level) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public void setTypeMap(Map map) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } private void throwStatementExceptionIfAny() throws SQLException { Index: MockStatement.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/MockStatement.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MockStatement.java 13 Apr 2002 15:08:23 -0000 1.1 +++ MockStatement.java 25 Jun 2002 10:14:51 -0000 1.2 @@ -8,15 +8,11 @@ protected ExpectationCounter myCloseCalls = new ExpectationCounter("MockStatement.closeCalls"); protected ExpectationCounter myExecuteCalls = new ExpectationCounter("MockStatement.executeCalls"); protected ExpectationValue myQueryString = new ExpectationValue("MockStatement.queryString"); - protected MockResultSet myResultSet; + protected ReturnObjectList myResultSets = new ReturnObjectList("result set"); private int myUpdateCount = 0; private SQLException myExecuteException = null; - public MockStatement() { - super(); - } - public void setExpectedExecuteCalls(int callCount) { myExecuteCalls.setExpected(callCount); } @@ -29,8 +25,8 @@ myCloseCalls.setExpected(callCount); } - public void setupResultSet(MockResultSet aResultSet) { - myResultSet = aResultSet; + public void addResultSet(MockResultSet aResultSet) { + myResultSets.addObjectToReturn(aResultSet); } public void setupThrowExceptionOnExecute(SQLException exception) { @@ -53,13 +49,14 @@ } public boolean execute(String sql) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return true; } public ResultSet executeQuery(String sql) throws SQLException { myQueryString.setActual(sql); innerExecute(); - return myResultSet; + return (ResultSet)myResultSets.nextReturnObject(); } public int executeUpdate(String sql) throws SQLException { @@ -69,51 +66,56 @@ } public int getMaxFieldSize() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return 0; } public void setMaxFieldSize(int max) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public int getMaxRows() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return 0; } public void setMaxRows(int max) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public void setEscapeProcessing(boolean enable) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public int getQueryTimeout() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return 0; } public void setQueryTimeout(int seconds) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public void cancel() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public SQLWarning getWarnings() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public void clearWarnings() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public void setCursorName(String name) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public ResultSet getResultSet() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public int getUpdateCount() throws SQLException { @@ -121,47 +123,54 @@ } public boolean getMoreResults() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return false; } public void setFetchDirection(int direction) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public int getFetchDirection() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return 0; } public void setFetchSize(int rows) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public int getFetchSize() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return 0; } public int getResultSetConcurrency() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return 0; } public int getResultSetType() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return 0; } public void addBatch(String sql) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public void clearBatch() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public int[] executeBatch() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public Connection getConnection() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } } |