harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r557126 - in /harmony/enhanced/classlib/branches/java6/modules/sql/src: main/java/java/sql/ main/java/javax/sql/rowset/serial/ test/java/org/apache/harmony/sql/tests/javax/sql/rowset/ test/java/org/apache/harmony/sql/tests/javax/sql/rowset/...
Date Wed, 18 Jul 2007 03:00:50 GMT
Author: pyang
Date: Tue Jul 17 20:00:48 2007
New Revision: 557126

URL: http://svn.apache.org/viewvc?view=rev&rev=557126
Log:
Implement Java 6 new API for SQLInput and SQLOutput

Added:
    harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockNClob.java
  (with props)
    harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockRowId.java
  (with props)
    harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockSQLXML.java
  (with props)
Modified:
    harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLInput.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLOutput.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SQLInputImpl.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SQLOutputImpl.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialClob.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialStruct.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SQLInputImplTest.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SQLOutputImplTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLInput.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLInput.java?view=diff&rev=557126&r1=557125&r2=557126
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLInput.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLInput.java
Tue Jul 17 20:00:48 2007
@@ -277,4 +277,17 @@
      *             if there is a database error
      */
     public URL readURL() throws SQLException;
+
+    /**
+     * TODO Javadoc
+     * 
+     * @return
+     */
+    public NClob readNClob() throws SQLException;
+
+    public String readNString() throws SQLException;
+
+    public SQLXML readSQLXML() throws SQLException;
+
+    public RowId readRowId() throws SQLException;
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLOutput.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLOutput.java?view=diff&rev=557126&r1=557125&r2=557126
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLOutput.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLOutput.java
Tue Jul 17 20:00:48 2007
@@ -277,4 +277,17 @@
      *             if a database error occurs
      */
     public void writeURL(URL theURL) throws SQLException;
+
+    /**
+     * TODO Javadoc
+     * 
+     * @return
+     */
+    public void writeNString(String x) throws SQLException;
+
+    public void writeNClob(NClob x) throws SQLException;
+
+    public void writeRowId(RowId x) throws SQLException;
+
+    public void writeSQLXML(SQLXML x) throws SQLException;
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SQLInputImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SQLInputImpl.java?view=diff&rev=557126&r1=557125&r2=557126
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SQLInputImpl.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SQLInputImpl.java
Tue Jul 17 20:00:48 2007
@@ -25,16 +25,18 @@
 import java.sql.Blob;
 import java.sql.Clob;
 import java.sql.Date;
+import java.sql.NClob;
 import java.sql.Ref;
+import java.sql.RowId;
 import java.sql.SQLData;
 import java.sql.SQLException;
 import java.sql.SQLInput;
+import java.sql.SQLXML;
 import java.sql.Struct;
 import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.Map;
 
-import org.apache.harmony.luni.util.NotImplementedException;
 import org.apache.harmony.sql.internal.nls.Messages;
 
 /**
@@ -290,9 +292,9 @@
                     data.readSQL(input, typeName);
                     return data;
                 } catch (IllegalAccessException e) {
-                    throw new SQLException(e.getMessage());
+                    throw new SQLException(e);
                 } catch (InstantiationException e) {
-                    throw new SQLException(e.getMessage());
+                    throw new SQLException(e);
                 }
 
             }
@@ -387,6 +389,50 @@
             throw new SQLException(Messages.getString("sql.35")); //$NON-NLS-1$
         }
         return readPosition == 0 ? false : attributes[readPosition - 1] == null;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.SQLInput#readNClob()
+     * 
+     * @since 1.6
+     */
+    public NClob readNClob() throws SQLException {
+        throw new UnsupportedOperationException(Messages.getString("sql.37")); //$NON-NLS-1$
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.SQLInput#readNString()
+     * 
+     * @since 1.6
+     */
+    public String readNString() throws SQLException {
+        throw new UnsupportedOperationException(Messages.getString("sql.37")); //$NON-NLS-1$
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.SQLInput#readRowId()
+     * 
+     * @since 1.6
+     */
+    public RowId readRowId() throws SQLException {
+        throw new UnsupportedOperationException(Messages.getString("sql.37")); //$NON-NLS-1$
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.SQLInput#readSQLXML()
+     * 
+     * @since 1.6
+     */
+    public SQLXML readSQLXML() throws SQLException {
+        throw new UnsupportedOperationException(Messages.getString("sql.37")); //$NON-NLS-1$
     }
 
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SQLOutputImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SQLOutputImpl.java?view=diff&rev=557126&r1=557125&r2=557126
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SQLOutputImpl.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SQLOutputImpl.java
Tue Jul 17 20:00:48 2007
@@ -28,10 +28,13 @@
 import java.sql.Blob;
 import java.sql.Clob;
 import java.sql.Date;
+import java.sql.NClob;
 import java.sql.Ref;
+import java.sql.RowId;
 import java.sql.SQLData;
 import java.sql.SQLException;
 import java.sql.SQLOutput;
+import java.sql.SQLXML;
 import java.sql.Struct;
 import java.sql.Time;
 import java.sql.Timestamp;
@@ -39,9 +42,16 @@
 import java.util.Map;
 import java.util.Vector;
 
-import org.apache.harmony.luni.util.NotImplementedException;
 import org.apache.harmony.sql.internal.nls.Messages;
 
+/**
+ * A concrete implementation of SQLOutput. The writeXXX methods will be called
+ * by SQLData.writeSQL, which write different objects such as Array, BigDecimal
+ * to this SQLOutputImpl object.
+ * 
+ * Different JDBC drivers may have their own implementation of SQLOutput and
+ * won't use this class.
+ */
 public class SQLOutputImpl implements SQLOutput {
     private Vector attributes;
 
@@ -359,5 +369,53 @@
         } else {
             attributes.addElement(theURL);
         }
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.SQLOutput#writeNClob(NClob)
+     * 
+     * @since 1.6
+     */
+    @SuppressWarnings("unchecked")
+    public void writeNClob(NClob x) throws SQLException {
+        throw new UnsupportedOperationException(Messages.getString("sql.37")); //$NON-NLS-1$
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.SQLOutput#writeNString(String)
+     * 
+     * @since 1.6
+     */
+    @SuppressWarnings("unchecked")
+    public void writeNString(String x) throws SQLException {
+        throw new UnsupportedOperationException(Messages.getString("sql.37")); //$NON-NLS-1$
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.SQLOutput#writeRowId(RowId)
+     * 
+     * @since 1.6
+     */
+    @SuppressWarnings("unchecked")
+    public void writeRowId(RowId x) throws SQLException {
+        throw new UnsupportedOperationException(Messages.getString("sql.37")); //$NON-NLS-1$
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.SQLOutput#writeSQLXML(SQLXML)
+     * 
+     * @since 1.6
+     */
+    @SuppressWarnings("unchecked")
+    public void writeSQLXML(SQLXML x) throws SQLException {
+        throw new UnsupportedOperationException(Messages.getString("sql.37")); //$NON-NLS-1$
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialClob.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialClob.java?view=diff&rev=557126&r1=557125&r2=557126
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialClob.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialClob.java
Tue Jul 17 20:00:48 2007
@@ -55,13 +55,12 @@
 
     public SerialClob(Clob clob) throws SerialException, SQLException {
         Reader characterStream;
-        InputStream asciiStream;
 
         if (clob == null) {
             throw new SQLException(Messages.getString("sql.19"));//$NON-NLS-1$
         }
         if ((characterStream = clob.getCharacterStream()) == null
-                && (asciiStream = clob.getAsciiStream()) == null) {
+                && clob.getAsciiStream() == null) {
             throw new SQLException(Messages.getString("sql.20"));//$NON-NLS-1$
         }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialStruct.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialStruct.java?view=diff&rev=557126&r1=557125&r2=557126
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialStruct.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialStruct.java
Tue Jul 17 20:00:48 2007
@@ -57,7 +57,7 @@
         } catch (SQLException e) {
             throw new SerialException(e.getMessage());
         }
-        Vector v = new Vector();
+        Vector<Object> v = new Vector<Object>();
         try {
             SQLOutput out = new SQLOutputImpl(v, map);
             in.writeSQL(out);

Added: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockNClob.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockNClob.java?view=auto&rev=557126
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockNClob.java
(added)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockNClob.java
Tue Jul 17 20:00:48 2007
@@ -0,0 +1,71 @@
+package org.apache.harmony.sql.tests.javax.sql.rowset;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.Writer;
+import java.sql.Clob;
+import java.sql.NClob;
+import java.sql.SQLException;
+
+public class MockNClob implements NClob {
+
+    public Reader characterStreamReader = new StringReader("xys");
+
+    public InputStream asciiInputStream = new ByteArrayInputStream("hello"
+            .getBytes());
+
+    public InputStream getAsciiStream() throws SQLException {
+        return asciiInputStream;
+    }
+
+    public Reader getCharacterStream() throws SQLException {
+        return characterStreamReader;
+    }
+
+    public String getSubString(long pos, int length) throws SQLException {
+        return null;
+    }
+
+    public long length() throws SQLException {
+        return 3;
+    }
+
+    public long position(Clob searchstr, long start) throws SQLException {
+        return 0;
+    }
+
+    public long position(String searchstr, long start) throws SQLException {
+        return 0;
+    }
+
+    public OutputStream setAsciiStream(long pos) throws SQLException {
+        return null;
+    }
+
+    public Writer setCharacterStream(long pos) throws SQLException {
+        return null;
+    }
+
+    public int setString(long pos, String str) throws SQLException {
+        return 0;
+    }
+
+    public int setString(long pos, String str, int offset, int len)
+            throws SQLException {
+        return 0;
+    }
+
+    public void truncate(long len) throws SQLException {
+    }
+
+    public void free() throws SQLException {
+    }
+
+    public Reader getCharacterStream(long pos, long length) throws SQLException {
+        return null;
+    }
+
+}

Propchange: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockNClob.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockRowId.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockRowId.java?view=auto&rev=557126
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockRowId.java
(added)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockRowId.java
Tue Jul 17 20:00:48 2007
@@ -0,0 +1,10 @@
+package org.apache.harmony.sql.tests.javax.sql.rowset;
+
+import java.sql.RowId;
+
+public class MockRowId implements RowId {
+
+    public byte[] getBytes() {
+        return new byte[] { 'a', 'b' };
+    }
+}

Propchange: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockRowId.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockSQLXML.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockSQLXML.java?view=auto&rev=557126
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockSQLXML.java
(added)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockSQLXML.java
Tue Jul 17 20:00:48 2007
@@ -0,0 +1,53 @@
+package org.apache.harmony.sql.tests.javax.sql.rowset;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.sql.SQLException;
+import java.sql.SQLXML;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+
+public class MockSQLXML implements SQLXML {
+    private String str = "sqlXML";
+
+    public void free() throws SQLException {
+        str = null;
+    }
+
+    public InputStream getBinaryStream() throws SQLException {
+        return null;
+    }
+
+    public Reader getCharacterStream() throws SQLException {
+        return null;
+    }
+
+    public <T extends Source> T getSource(Class<T> sourceClass)
+            throws SQLException {
+        return null;
+    }
+
+    public String getString() throws SQLException {
+        return str;
+    }
+
+    public OutputStream setBinaryStream() throws SQLException {
+        return null;
+    }
+
+    public Writer setCharacterStream() throws SQLException {
+        return null;
+    }
+
+    public <T extends Result> T setResult(Class<T> resultClass)
+            throws SQLException {
+        return null;
+    }
+
+    public void setString(String value) throws SQLException {
+        str = value;
+    }
+}

Propchange: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockSQLXML.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SQLInputImplTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SQLInputImplTest.java?view=diff&rev=557126&r1=557125&r2=557126
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SQLInputImplTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SQLInputImplTest.java
Tue Jul 17 20:00:48 2007
@@ -28,11 +28,14 @@
 import java.sql.Blob;
 import java.sql.Clob;
 import java.sql.Date;
+import java.sql.NClob;
 import java.sql.Ref;
+import java.sql.RowId;
 import java.sql.SQLData;
 import java.sql.SQLException;
 import java.sql.SQLInput;
 import java.sql.SQLOutput;
+import java.sql.SQLXML;
 import java.sql.Struct;
 import java.sql.Time;
 import java.sql.Timestamp;
@@ -47,7 +50,10 @@
 import org.apache.harmony.sql.tests.javax.sql.rowset.MockArray;
 import org.apache.harmony.sql.tests.javax.sql.rowset.MockBlob;
 import org.apache.harmony.sql.tests.javax.sql.rowset.MockClob;
+import org.apache.harmony.sql.tests.javax.sql.rowset.MockNClob;
 import org.apache.harmony.sql.tests.javax.sql.rowset.MockRef;
+import org.apache.harmony.sql.tests.javax.sql.rowset.MockRowId;
+import org.apache.harmony.sql.tests.javax.sql.rowset.MockSQLXML;
 
 public class SQLInputImplTest extends TestCase {
 
@@ -554,6 +560,7 @@
 
     /**
      * @tests {@link javax.sql.rowset.serial.SQLInputImpl#wasNull()}
+     * 
      */
     public void testWasNull() throws SQLException {
         Object[] attributes = new Object[] { null, "hello" };
@@ -572,6 +579,133 @@
         }
         assertFalse(impl.wasNull());
         assertFalse(impl.wasNull());
+    }
+
+    /**
+     * @tests {@link javax.sql.rowset.serial.SQLInputImpl#readNClob()}
+     * 
+     * @since 1.6
+     */
+    public void testReadNClob() throws SQLException {
+        NClob nclob = new MockNClob();
+        Object[] attributes = new Object[] { null, nclob };
+        SQLInputImpl impl = new SQLInputImpl(attributes,
+                new HashMap<String, Class<?>>());
+        try {
+            impl.readNClob();
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+
+        try {
+            impl.readNClob();
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+
+        try {
+            impl.readNClob();
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+    }
+
+    /**
+     * @tests {@link javax.sql.rowset.serial.SQLInputImpl#readNString()}
+     * 
+     * @since 1.6
+     */
+    public void testReadNString() throws SQLException {
+        Object[] attributes = new Object[] { null, "hello" };
+        SQLInputImpl impl = new SQLInputImpl(attributes,
+                new HashMap<String, Class<?>>());
+        try {
+            impl.readNString();
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+
+        try {
+            impl.readNString();
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+
+        try {
+            impl.readNString();
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+    }
+
+    /**
+     * @tests {@link javax.sql.rowset.serial.SQLInputImpl#readRowId()}
+     * 
+     * @since 1.6
+     */
+    public void testReadRowId() throws SQLException {
+        RowId rowId = new MockRowId();
+        Object[] attributes = new Object[] { null, rowId };
+        SQLInputImpl impl = new SQLInputImpl(attributes,
+                new HashMap<String, Class<?>>());
+        try {
+            impl.readRowId();
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+
+        try {
+            impl.readRowId();
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+
+        try {
+            impl.readRowId();
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+    }
+
+    /**
+     * @tests {@link javax.sql.rowset.serial.SQLInputImpl#readSQLXML()}
+     * 
+     * @since 1.6
+     */
+    public void testReadSQLXML() throws SQLException {
+        SQLXML sqlXML = new MockSQLXML();
+        Object[] attributes = new Object[] { null, sqlXML };
+        SQLInputImpl impl = new SQLInputImpl(attributes,
+                new HashMap<String, Class<?>>());
+        try {
+            impl.readSQLXML();
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+
+        try {
+            impl.readSQLXML();
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+
+        try {
+            impl.readSQLXML();
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
     }
 
     /*

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SQLOutputImplTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SQLOutputImplTest.java?view=diff&rev=557126&r1=557125&r2=557126
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SQLOutputImplTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SQLOutputImplTest.java
Tue Jul 17 20:00:48 2007
@@ -45,15 +45,18 @@
 import javax.sql.rowset.serial.SerialRef;
 import javax.sql.rowset.serial.SerialStruct;
 
+import junit.framework.TestCase;
+
 import org.apache.harmony.sql.tests.javax.sql.rowset.MockArray;
 import org.apache.harmony.sql.tests.javax.sql.rowset.MockBlob;
 import org.apache.harmony.sql.tests.javax.sql.rowset.MockClob;
+import org.apache.harmony.sql.tests.javax.sql.rowset.MockNClob;
 import org.apache.harmony.sql.tests.javax.sql.rowset.MockRef;
+import org.apache.harmony.sql.tests.javax.sql.rowset.MockRowId;
+import org.apache.harmony.sql.tests.javax.sql.rowset.MockSQLXML;
 import org.apache.harmony.sql.tests.javax.sql.rowset.serial.SQLInputImplTest.MockSQLData;
 import org.apache.harmony.sql.tests.javax.sql.rowset.serial.SQLInputImplTest.MockStruct;
 
-import junit.framework.TestCase;
-
 public class SQLOutputImplTest extends TestCase {
 
     private static SQLOutputImpl impl;
@@ -259,6 +262,48 @@
     }
 
     /**
+     * @tests {@link javax.sql.rowset.serial.SQLOutputImpl#writeNClob(java.sql.NClob)}
+     * 
+     * @since 1.6
+     */
+    public void test_writeNClobLjava_sql_NClob() throws SQLException {
+        try {
+            impl.writeNClob(null);
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+
+        try {
+            impl.writeNClob(new MockNClob());
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+    }
+
+    /**
+     * @tests {@link javax.sql.rowset.serial.SQLOutputImpl#writeNString(String)}
+     * 
+     * @since 1.6
+     */
+    public void test_writeNStringLjava_sql_String() throws SQLException {
+        try {
+            impl.writeNString(null);
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+
+        try {
+            impl.writeNString("testString");
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+    }
+
+    /**
      * @tests {@link javax.sql.rowset.serial.SQLOutputImpl#writeLong(long)}
      */
     public void test_writeLongJ() throws SQLException {
@@ -298,6 +343,27 @@
     }
 
     /**
+     * @tests {@link javax.sql.rowset.serial.SQLOutputImpl#writeRowId(java.sql.RowId)}
+     * 
+     * @since 1.6
+     */
+    public void test_writeRowIdLjava_sql_RowId() throws SQLException {
+        try {
+            impl.writeRowId(null);
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+
+        try {
+            impl.writeRowId(new MockRowId());
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+    }
+
+    /**
      * @tests {@link javax.sql.rowset.serial.SQLOutputImpl#writeShort(short)}
      */
     public void test_writeShortS() throws SQLException {
@@ -305,6 +371,27 @@
         assertEquals((short) 12823, ((Short) attr.get(0)).shortValue());
         impl.writeShort((short) 32768);
         assertEquals((short) -32768, ((Short) attr.get(1)).shortValue());
+    }
+
+    /**
+     * @tests {@link javax.sql.rowset.serial.SQLOutputImpl#writeSQLXML(java.sql.SQLXML)}
+     * 
+     * @since 1.6
+     */
+    public void test_writeSQLXMLLjava_sql_SQLXML() throws SQLException {
+        try {
+            impl.writeSQLXML(null);
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+
+        try {
+            impl.writeSQLXML(new MockSQLXML());
+            fail("should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
     }
 
     /**



Mime
View raw message