You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2006/11/06 05:07:39 UTC

svn commit: r471629 - in /incubator/harmony/enhanced/classlib/trunk/modules/sql/src: main/java/javax/sql/rowset/ test/java/org/apache/harmony/sql/tests/javax/sql/rowset/

Author: ndbeyer
Date: Sun Nov  5 20:07:38 2006
New Revision: 471629

URL: http://svn.apache.org/viewvc?view=rev&rev=471629
Log:
Add initial BaseRowSet impl and unit test

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/rowset/BaseRowSet.java   (with props)
    incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/
    incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java   (with props)

Added: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/rowset/BaseRowSet.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/rowset/BaseRowSet.java?view=auto&rev=471629
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/rowset/BaseRowSet.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/rowset/BaseRowSet.java Sun Nov  5 20:07:38 2006
@@ -0,0 +1,718 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package javax.sql.rowset;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.Date;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Vector;
+import javax.sql.RowSet;
+import javax.sql.RowSetEvent;
+import javax.sql.RowSetListener;
+
+public abstract class BaseRowSet implements Cloneable, Serializable {
+    private static final long serialVersionUID = 4886719666485113312L ;
+    
+    public static final int UNICODE_STREAM_PARAM = 0;
+
+    public static final int BINARY_STREAM_PARAM = 1;
+
+    public static final int ASCII_STREAM_PARAM = 2;
+
+    protected InputStream binaryStream;
+
+    protected InputStream unicodeStream;
+
+    protected InputStream asciiStream;
+
+    protected Reader charStream;
+
+    private String command;
+
+    private String URL;
+
+    private String dataSource;
+
+    private int rowSetType = ResultSet.TYPE_SCROLL_INSENSITIVE;
+
+    private boolean showDeleted;
+
+    private int queryTimeout;
+
+    private int maxRows;
+
+    private int maxFieldSize;
+
+    private int concurrency = ResultSet.CONCUR_UPDATABLE;
+
+    private boolean readOnly;
+
+    private boolean escapeProcessing;
+
+    private int isolation;
+
+    private int fetchDir;
+
+    private int fetchSize;
+
+    private Map<String, Class<?>> map;
+
+    private Vector<RowSetListener> listeners;
+
+    private Hashtable<Object, Object> params;
+
+    private transient String username;
+
+    private transient String password;
+
+    public BaseRowSet() {
+        super();
+        listeners = new Vector<RowSetListener>();
+    }
+
+    protected void initParams() {
+        params = new Hashtable<Object, Object>();
+    }
+
+    public void addRowSetListener(RowSetListener listener) {
+        if (listener == null) {
+            return;
+        }
+        listeners.add(listener);
+    }
+
+    public void removeRowSetListener(RowSetListener listener) {
+        if (listener == null) {
+            return;
+        }
+        listeners.remove(listener);
+    }
+
+    protected void notifyCursorMoved() throws SQLException {
+        if (!(this instanceof RowSet)) {
+            throw new SQLException();
+        }
+        if (listeners.isEmpty()) {
+            return;
+        }
+        for (RowSetListener listener : listeners) {
+            listener.cursorMoved(new RowSetEvent((RowSet) this));
+        }
+    }
+
+    protected void notifyRowChanged() throws SQLException {
+        if (!(this instanceof RowSet)) {
+            throw new SQLException();
+        }
+        if (listeners.isEmpty()) {
+            return;
+        }
+        for (RowSetListener listener : listeners) {
+            listener.rowChanged(new RowSetEvent((RowSet) this));
+        }
+    }
+
+    protected void notifyRowSetChanged() throws SQLException {
+        if (!(this instanceof RowSet)) {
+            throw new SQLException();
+        }
+        if (listeners.isEmpty()) {
+            return;
+        }
+        for (RowSetListener listener : listeners) {
+            listener.rowSetChanged(new RowSetEvent((RowSet) this));
+        }
+    }
+
+    public String getCommand() {
+        return command;
+    }
+
+    public void setCommand(String cmd) throws SQLException {
+        // null is allowed, but empty is not
+        if (cmd != null && cmd.length() == 0) {
+            throw new SQLException();
+        }
+        this.command = cmd;
+    }
+
+    public String getUrl() throws SQLException {
+        // TODO interrogate the DataSource
+        return URL;
+    }
+
+    public void setUrl(String url) throws SQLException {
+        // null is allowed, but empty is not
+        if (url != null && url.length() == 0) {
+            throw new SQLException();
+        }
+        this.URL = url;
+        this.dataSource = null;
+    }
+
+    public String getDataSourceName() {
+        return dataSource;
+    }
+
+    public void setDataSourceName(String name) throws SQLException {
+        // null is allowed, but empty is not
+        if (name != null && name.length() == 0) {
+            throw new SQLException();
+        }
+        this.dataSource = name;
+        this.URL = null;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public void setType(int type) throws SQLException {
+        switch (type) {
+            case ResultSet.TYPE_FORWARD_ONLY:
+            case ResultSet.TYPE_SCROLL_INSENSITIVE:
+            case ResultSet.TYPE_SCROLL_SENSITIVE: {
+                this.rowSetType = type;
+                return;
+            }
+            default: {
+                throw new SQLException();
+            }
+        }
+    }
+
+    public int getType() throws SQLException {
+        return rowSetType;
+    }
+
+    public void setConcurrency(int concurrency) throws SQLException {
+        switch (concurrency) {
+            case ResultSet.CONCUR_READ_ONLY:
+            case ResultSet.CONCUR_UPDATABLE: {
+                this.concurrency = concurrency;
+                return;
+            }
+            default: {
+                throw new SQLException();
+            }
+        }
+    }
+
+    public int getConcurrency() throws SQLException {
+        return concurrency;
+    }
+
+    public boolean isReadOnly() {
+        return readOnly;
+    }
+
+    public void setReadOnly(boolean value) {
+        this.readOnly = value;
+    }
+
+    public int getTransactionIsolation() {
+        return isolation;
+    }
+
+    public void setTransactionIsolation(int level) throws SQLException {
+        switch (level) {
+            case Connection.TRANSACTION_NONE:
+            case Connection.TRANSACTION_READ_UNCOMMITTED:
+            case Connection.TRANSACTION_READ_COMMITTED:
+            case Connection.TRANSACTION_REPEATABLE_READ:
+            case Connection.TRANSACTION_SERIALIZABLE: {
+                this.isolation = level;
+                return;
+            }
+            default: {
+                throw new SQLException();
+            }
+        }
+    }
+
+    public Map<String, Class<?>> getTypeMap() {
+        //TODO determine if copy is necessary
+        return new HashMap<String, Class<?>>(map);
+    }
+
+    public void setTypeMap(Map<String, Class<?>> map) {
+        //TODO determine if copy is necessary
+        this.map = new HashMap<String, Class<?>>(map);
+    }
+
+    public int getMaxFieldSize() throws SQLException {
+        return maxFieldSize;
+    }
+
+    public void setMaxFieldSize(int max) throws SQLException {
+        // TODO test maximum based on field type
+        this.maxFieldSize = max;
+    }
+
+    public int getMaxRows() throws SQLException {
+        return maxRows;
+    }
+
+    public void setMaxRows(int max) throws SQLException {
+        this.maxRows = max;
+    }
+
+    public void setEscapeProcessing(boolean enable) throws SQLException {
+        this.escapeProcessing = enable;
+    }
+
+    public boolean getEscapeProcessing() throws SQLException {
+        return escapeProcessing;
+    }
+
+    public int getQueryTimeout() throws SQLException {
+        return queryTimeout;
+    }
+
+    public void setQueryTimeout(int seconds) throws SQLException {
+        if (seconds < 0) {
+            throw new SQLException();
+        }
+        this.queryTimeout = seconds;
+    }
+
+    public boolean getShowDeleted() throws SQLException {
+        return showDeleted;
+    }
+
+    public void setShowDeleted(boolean value) throws SQLException {
+        this.showDeleted = value;
+    }
+
+    public void setFetchDirection(int direction) throws SQLException {
+        switch (direction) {
+            case ResultSet.FETCH_REVERSE:
+            case ResultSet.FETCH_UNKNOWN: {
+                if (rowSetType == ResultSet.TYPE_FORWARD_ONLY) {
+                    throw new SQLException();
+                }
+            }
+            case ResultSet.FETCH_FORWARD: {
+                this.fetchDir = direction;
+                return;
+            }
+            default: {
+                throw new SQLException();
+            }
+        }
+    }
+
+    public int getFetchDirection() throws SQLException {
+        return fetchDir;
+    }
+
+    public void setFetchSize(int rows) throws SQLException {
+        if (rows < 0) {
+            throw new SQLException();
+        }
+        if (rows > maxRows) {
+            throw new SQLException();
+        }
+        this.fetchSize = rows;
+    }
+
+    public int getFetchSize() throws SQLException {
+        return fetchSize;
+    }
+
+    public void setNull(int parameterIndex, int sqlType) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        Object[] value = new Object[2];
+        value[1] = Integer.valueOf(sqlType);
+        params.put(Integer.valueOf(parameterIndex - 1), value);
+    }
+
+    public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        Object[] value = new Object[3];
+        value[1] = Integer.valueOf(sqlType);
+        value[2] = typeName;
+        params.put(Integer.valueOf(parameterIndex - 1), value);
+    }
+
+    public void setBoolean(int parameterIndex, boolean x) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        params.put(Integer.valueOf(parameterIndex - 1), Boolean.valueOf(x));
+    }
+
+    public void setByte(int parameterIndex, byte x) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        params.put(Integer.valueOf(parameterIndex - 1), Byte.valueOf(x));
+    }
+
+    public void setShort(int parameterIndex, short x) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        params.put(Integer.valueOf(parameterIndex - 1), Short.valueOf(x));
+    }
+
+    public void setInt(int parameterIndex, int x) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        params.put(Integer.valueOf(parameterIndex - 1), Integer.valueOf(x));
+    }
+
+    public void setLong(int parameterIndex, long x) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        params.put(Integer.valueOf(parameterIndex - 1), Long.valueOf(x));
+    }
+
+    public void setFloat(int parameterIndex, float x) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        params.put(Integer.valueOf(parameterIndex - 1), Float.valueOf(x));
+    }
+
+    public void setDouble(int parameterIndex, double x) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        params.put(Integer.valueOf(parameterIndex - 1), Double.valueOf(x));
+    }
+
+    public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        params.put(Integer.valueOf(parameterIndex - 1), x);
+    }
+
+    public void setString(int parameterIndex, String x) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        params.put(Integer.valueOf(parameterIndex - 1), x);
+    }
+
+    public void setBytes(int parameterIndex, byte[] x) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        params.put(Integer.valueOf(parameterIndex - 1), x);
+    }
+
+    public void setDate(int parameterIndex, Date x) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        params.put(Integer.valueOf(parameterIndex - 1), x);
+    }
+
+    public void setTime(int parameterIndex, Time x) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        params.put(Integer.valueOf(parameterIndex - 1), x);
+    }
+
+    public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        params.put(Integer.valueOf(parameterIndex - 1), x);
+    }
+
+    public void setAsciiStream(int parameterIndex, InputStream x, int length)
+            throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        Object[] value = new Object[3];
+        value[0] = x;
+        value[1] = Integer.valueOf(length);
+        value[2] = Integer.valueOf(ASCII_STREAM_PARAM);
+        params.put(Integer.valueOf(parameterIndex - 1), value);
+    }
+
+    public void setBinaryStream(int parameterIndex, InputStream x, int length)
+            throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        Object[] value = new Object[3];
+        value[0] = x;
+        value[1] = Integer.valueOf(length);
+        value[2] = Integer.valueOf(BINARY_STREAM_PARAM);
+        params.put(Integer.valueOf(parameterIndex - 1), value);
+    }
+
+    @Deprecated
+    public void setUnicodeStream(int parameterIndex, InputStream x, int length)
+            throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        Object[] value = new Object[3];
+        value[0] = x;
+        value[1] = Integer.valueOf(length);
+        value[2] = Integer.valueOf(UNICODE_STREAM_PARAM);
+        params.put(Integer.valueOf(parameterIndex - 1), value);
+    }
+
+    public void setCharacterStream(int parameterIndex, Reader reader, int length)
+            throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        Object[] value = new Object[2];
+        value[0] = reader;
+        value[1] = Integer.valueOf(length);
+        params.put(Integer.valueOf(parameterIndex - 1), value);
+    }
+
+    public void setObject(int parameterIndex, Object x, int targetSqlType, int scale)
+            throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        Object[] value = new Object[3];
+        value[0] = x;
+        value[1] = Integer.valueOf(targetSqlType);
+        value[2] = Integer.valueOf(scale);
+        params.put(Integer.valueOf(parameterIndex - 1), value);
+    }
+
+    public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        Object[] value = new Object[2];
+        value[0] = x;
+        value[1] = Integer.valueOf(targetSqlType);
+        params.put(Integer.valueOf(parameterIndex - 1), value);
+    }
+
+    public void setObject(int parameterIndex, Object x) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        params.put(Integer.valueOf(parameterIndex - 1), x);
+    }
+
+    public void setRef(int parameterIndex, Ref ref) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        params.put(Integer.valueOf(parameterIndex - 1), ref);
+    }
+
+    public void setBlob(int parameterIndex, Blob x) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        params.put(Integer.valueOf(parameterIndex - 1), x);
+    }
+
+    public void setClob(int parameterIndex, Clob x) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        params.put(Integer.valueOf(parameterIndex - 1), x);
+    }
+
+    public void setArray(int parameterIndex, Array array) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        params.put(Integer.valueOf(parameterIndex - 1), array);
+    }
+
+    public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        Object[] value = new Object[2];
+        value[0] = x;
+        value[1] = cal;
+        params.put(Integer.valueOf(parameterIndex - 1), value);
+    }
+
+    public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        Object[] value = new Object[2];
+        value[0] = x;
+        value[1] = cal;
+        params.put(Integer.valueOf(parameterIndex - 1), value);
+    }
+
+    public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException {
+        if (parameterIndex < 1) {
+            throw new SQLException();
+        }
+        if (params == null) {
+            throw new SQLException();
+        }
+        Object[] value = new Object[2];
+        value[0] = x;
+        value[1] = cal;
+        params.put(Integer.valueOf(parameterIndex - 1), value);
+    }
+
+    public void clearParameters() throws SQLException {
+        if (params == null) {
+            return;
+        }
+        params.clear();
+    }
+
+    public Object[] getParams() throws SQLException {
+        if (params == null) {
+            return new Object[0];
+        }
+        Object[] result = new Object[params.size()];
+        for (int i = 0; i < result.length; i++) {
+            Object param = params.get(Integer.valueOf(i));
+            if (param == null) {
+                throw new SQLException();
+            }
+            result[i] = param;
+        }
+        return result;
+    }
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/rowset/BaseRowSet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java?view=auto&rev=471629
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java Sun Nov  5 20:07:38 2006
@@ -0,0 +1,164 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.harmony.sql.tests.javax.sql.rowset;
+
+import java.sql.SQLException;
+import java.sql.Types;
+import javax.sql.rowset.BaseRowSet;
+import junit.framework.TestCase;
+
+public class BaseRowSetTest extends TestCase {
+    
+    public void testGetParams() throws Exception {
+        BaseRowSetImpl brs = new BaseRowSetImpl();
+        Object[] params = brs.getParams();
+        assertNotNull(params);
+        assertEquals(0, params.length);
+    }
+    
+    public void testSetNullintint() throws Exception {
+        BaseRowSetImpl brs = new BaseRowSetImpl();
+        try {
+            brs.setNull(1, Types.BINARY);
+            fail("sql exception expected");
+        } catch (SQLException e) {
+        }
+        
+        brs.initParams();
+        
+        try {
+            brs.setNull(0, Types.BINARY);
+            fail("sql exception expected");
+        } catch (SQLException e) {
+        }
+        
+        brs.setNull(1, Types.BINARY);
+        Object[] params = brs.getParams();
+        assertNotNull(params);
+        Object[] param = (Object[])params[0];
+        assertNotNull(param);
+        assertEquals(2, param.length);
+        assertNull(param[0]);
+        assertEquals(Integer.valueOf(Types.BINARY), param[1]);
+    }
+    
+    public void testSetNullintintString() throws Exception {
+        BaseRowSetImpl brs = new BaseRowSetImpl();
+        try {
+            brs.setNull(1, Types.BINARY, "java.lang.Boolean");
+            fail("sql exception expected");
+        } catch (SQLException e) {
+        }
+        
+        brs.initParams();
+        
+        try {
+            brs.setNull(0, Types.BINARY, "java.lang.Boolean");
+            fail("sql exception expected");
+        } catch (SQLException e) {
+        }
+        
+        brs.setNull(1, Types.BINARY, "java.lang.Boolean");
+        Object[] params = brs.getParams();
+        assertNotNull(params);
+        Object[] param = (Object[])params[0];
+        assertNotNull(param);
+        assertEquals(3, param.length);
+        assertNull(param[0]);
+        assertEquals(Integer.valueOf(Types.BINARY), param[1]);
+        assertEquals("java.lang.Boolean", param[2]);
+    }
+    
+    public void testSetBoolean() throws Exception {
+        BaseRowSetImpl brs = new BaseRowSetImpl();
+        try {
+            brs.setBoolean(1, true);
+            fail("sql exception expected");
+        } catch (SQLException e) {
+        }
+        
+        brs.initParams();
+        
+        try {
+            brs.setBoolean(0, true);
+            fail("sql exception expected");
+        } catch (SQLException e) {
+        }
+        
+        brs.setBoolean(1, true);
+        Object[] params = brs.getParams();
+        assertNotNull(params);
+        assertEquals(1, params.length);
+        assertEquals(Boolean.TRUE, params[0]);
+    }
+    
+    public void testSetByte() throws Exception {
+        BaseRowSetImpl brs = new BaseRowSetImpl();
+        try {
+            brs.setByte(1, (byte)1);
+            fail("sql exception expected");
+        } catch (SQLException e) {
+        }
+        
+        brs.initParams();
+        
+        try {
+            brs.setByte(0, (byte)1);
+            fail("sql exception expected");
+        } catch (SQLException e) {
+        }
+        
+        brs.setByte(1, (byte)1);
+        Object[] params = brs.getParams();
+        assertNotNull(params);
+        assertEquals(1, params.length);
+        assertEquals(Byte.valueOf((byte)1), params[0]);
+    }
+    
+    public void testSetShort() throws Exception {
+        BaseRowSetImpl brs = new BaseRowSetImpl();
+        try {
+            brs.setShort(1, (short)1);
+            fail("sql exception expected");
+        } catch (SQLException e) {
+        }
+        
+        brs.initParams();
+        
+        try {
+            brs.setShort(0, (short)1);
+            fail("sql exception expected");
+        } catch (SQLException e) {
+        }
+        
+        brs.setShort(1, (byte)1);
+        Object[] params = brs.getParams();
+        assertNotNull(params);
+        assertEquals(1, params.length);
+        assertEquals(Short.valueOf((short)1), params[0]);
+    }
+    
+    private static final class BaseRowSetImpl extends BaseRowSet {
+        private static final long serialVersionUID = 1L;
+
+        @Override
+        protected void initParams() {
+            super.initParams();
+        }
+    }
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java
------------------------------------------------------------------------------
    svn:eol-style = native