Update of /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql
In directory sc8-pr-cvs1:/tmp/cvs-serv8469/src/jdk/common/com/mockobjects/sql
Modified Files:
CommonMockConnection.java
Log Message:
Patch from François Beausoleil to add result set type and concurrency support
Index: CommonMockConnection.java
===================================================================
RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockConnection.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CommonMockConnection.java 9 Dec 2002 18:20:14 -0000 1.6
+++ CommonMockConnection.java 21 Feb 2003 12:17:38 -0000 1.7
@@ -68,7 +68,7 @@
* Exceptions to throw can be registered for calling createStatement,
* preparedStatement, or close.
* Several less-often-used methods are not implemented.
- * If a notImplemented method is are needed for your project, please submit
+ * If a notImplemented method is needed for your project, please submit
* a patch.
* @see <a href="http://java.sun.com/j2se/1.3/docs/api/java/sql/Connection.html">javax.sql.Connection</a>
* @author
@@ -89,6 +89,9 @@
private boolean autoCommit = false;
+ private final ExpectationValue myResultSetConcurrency;
+ private final ExpectationValue myResultSetType;
+
private final ExpectationList myAutoCommit;
private final ExpectationCounter myCloseCalls;
private final ExpectationCounter myCommitCalls;
@@ -132,6 +135,8 @@
myPreparedStatements = new ReturnObjectList(name + ".PreparedStatements");
myPreparedStatementStrings = new ExpectationList(name + ".preparedStatementString");
myRollbackCalls = new ExpectationCounter(name + ".rollback");
+ myResultSetType = new ExpectationValue(name + ".resultSetType");
+ myResultSetConcurrency = new ExpectationValue(name + ".resultSetConcurrency");
}
/**
@@ -191,6 +196,31 @@
// --------------------------------------------------------------------- setup
/**
+ * Sets expectations about the possible value of the
+ * <code>resultSetConcurrency</code> parameter of
+ * {@link #createStatement(int, int) createStatement()} calls.
+ *
+ * @param resultSetConcurrency One of the constants starting with CONCUR
+ * in {@link java.sql.ResultSet}.
+ */
+ public void setExpectedResultSetConcurrency(int resultSetConcurrency) {
+ myResultSetConcurrency.setExpected(resultSetConcurrency);
+ }
+
+ /**
+ * Sets expectations about the possible value of the
+ * <code>resultSetType</code> parameter of
+ * {@link #createStatement(int, int) createStatement()} calls.
+ *
+ * @param resultSetType One of the constants starting with TYPE
+ * in {@link java.sql.ResultSet}.
+ */
+ public void setExpectedResultSetType(int resultSetType) {
+ myResultSetType.setExpected(resultSetType);
+ }
+
+
+ /**
* @deprecated
* Adds a PreparedStatement to be return by prepareStatement
* @see CommonMockConnection2
@@ -363,8 +393,13 @@
int resultSetType,
int resultSetConcurrency)
throws SQLException {
- notImplemented();
- return null;
+ myCreateStatementCalls.inc();
+ throwStatementExceptionIfAny();
+
+ myResultSetType.setActual(resultSetType);
+ myResultSetConcurrency.setActual(resultSetConcurrency);
+
+ return myStatement;
}
public boolean getAutoCommit() throws SQLException {
|