You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by py...@apache.org on 2007/07/16 11:03:03 UTC
svn commit: r556562 [5/6] - in
/harmony/enhanced/classlib/trunk/modules/sql/src: main/java/java/sql/
main/java/javax/sql/ main/java/javax/sql/rowset/
main/java/javax/sql/rowset/serial/ main/java/javax/sql/rowset/spi/
main/java/javax/transaction/xa/ mai...
Modified: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TypesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TypesTest.java?view=diff&rev=556562&r1=556561&r2=556562
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TypesTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TypesTest.java Mon Jul 16 02:02:56 2007
@@ -25,77 +25,77 @@
public class TypesTest extends TestCase {
- /*
- * Public statics test
- */
- public void testPublicStatics() {
+ /*
+ * Public statics test
+ */
+ public void testPublicStatics() {
- HashMap<String, Integer> thePublicStatics = new HashMap<String, Integer>();
- thePublicStatics.put("BOOLEAN", new Integer(16));
- thePublicStatics.put("DATALINK", new Integer(70));
- thePublicStatics.put("REF", new Integer(2006));
- thePublicStatics.put("CLOB", new Integer(2005));
- thePublicStatics.put("BLOB", new Integer(2004));
- thePublicStatics.put("ARRAY", new Integer(2003));
- thePublicStatics.put("STRUCT", new Integer(2002));
- thePublicStatics.put("DISTINCT", new Integer(2001));
- thePublicStatics.put("JAVA_OBJECT", new Integer(2000));
- thePublicStatics.put("OTHER", new Integer(1111));
- thePublicStatics.put("NULL", new Integer(0));
- thePublicStatics.put("LONGVARBINARY", new Integer(-4));
- thePublicStatics.put("VARBINARY", new Integer(-3));
- thePublicStatics.put("BINARY", new Integer(-2));
- thePublicStatics.put("TIMESTAMP", new Integer(93));
- thePublicStatics.put("TIME", new Integer(92));
- thePublicStatics.put("DATE", new Integer(91));
- thePublicStatics.put("LONGVARCHAR", new Integer(-1));
- thePublicStatics.put("VARCHAR", new Integer(12));
- thePublicStatics.put("CHAR", new Integer(1));
- thePublicStatics.put("DECIMAL", new Integer(3));
- thePublicStatics.put("NUMERIC", new Integer(2));
- thePublicStatics.put("DOUBLE", new Integer(8));
- thePublicStatics.put("REAL", new Integer(7));
- thePublicStatics.put("FLOAT", new Integer(6));
- thePublicStatics.put("BIGINT", new Integer(-5));
- thePublicStatics.put("INTEGER", new Integer(4));
- thePublicStatics.put("SMALLINT", new Integer(5));
- thePublicStatics.put("TINYINT", new Integer(-6));
- thePublicStatics.put("BIT", new Integer(-7));
+ HashMap<String, Integer> thePublicStatics = new HashMap<String, Integer>();
+ thePublicStatics.put("BOOLEAN", new Integer(16));
+ thePublicStatics.put("DATALINK", new Integer(70));
+ thePublicStatics.put("REF", new Integer(2006));
+ thePublicStatics.put("CLOB", new Integer(2005));
+ thePublicStatics.put("BLOB", new Integer(2004));
+ thePublicStatics.put("ARRAY", new Integer(2003));
+ thePublicStatics.put("STRUCT", new Integer(2002));
+ thePublicStatics.put("DISTINCT", new Integer(2001));
+ thePublicStatics.put("JAVA_OBJECT", new Integer(2000));
+ thePublicStatics.put("OTHER", new Integer(1111));
+ thePublicStatics.put("NULL", new Integer(0));
+ thePublicStatics.put("LONGVARBINARY", new Integer(-4));
+ thePublicStatics.put("VARBINARY", new Integer(-3));
+ thePublicStatics.put("BINARY", new Integer(-2));
+ thePublicStatics.put("TIMESTAMP", new Integer(93));
+ thePublicStatics.put("TIME", new Integer(92));
+ thePublicStatics.put("DATE", new Integer(91));
+ thePublicStatics.put("LONGVARCHAR", new Integer(-1));
+ thePublicStatics.put("VARCHAR", new Integer(12));
+ thePublicStatics.put("CHAR", new Integer(1));
+ thePublicStatics.put("DECIMAL", new Integer(3));
+ thePublicStatics.put("NUMERIC", new Integer(2));
+ thePublicStatics.put("DOUBLE", new Integer(8));
+ thePublicStatics.put("REAL", new Integer(7));
+ thePublicStatics.put("FLOAT", new Integer(6));
+ thePublicStatics.put("BIGINT", new Integer(-5));
+ thePublicStatics.put("INTEGER", new Integer(4));
+ thePublicStatics.put("SMALLINT", new Integer(5));
+ thePublicStatics.put("TINYINT", new Integer(-6));
+ thePublicStatics.put("BIT", new Integer(-7));
- Class<?> typesClass;
- try {
- typesClass = Class.forName("java.sql.Types");
- } catch (ClassNotFoundException e) {
- fail("java.sql.Types class not found!");
- return;
- } // end try
+ Class<?> typesClass;
+ try {
+ typesClass = Class.forName("java.sql.Types");
+ } catch (ClassNotFoundException e) {
+ fail("java.sql.Types class not found!");
+ return;
+ } // end try
- Field[] theFields = typesClass.getDeclaredFields();
- int requiredModifier = Modifier.PUBLIC + Modifier.STATIC
- + Modifier.FINAL;
+ Field[] theFields = typesClass.getDeclaredFields();
+ int requiredModifier = Modifier.PUBLIC + Modifier.STATIC
+ + Modifier.FINAL;
- int countPublicStatics = 0;
- for (Field element : theFields) {
- String fieldName = element.getName();
- int theMods = element.getModifiers();
- if (Modifier.isPublic(theMods) && Modifier.isStatic(theMods)) {
- try {
- Object fieldValue = element.get(null);
- Object expectedValue = thePublicStatics.get(fieldName);
- if (expectedValue == null) {
- fail("Field " + fieldName + " missing!");
- } // end
- assertEquals("Field " + fieldName + " value mismatch: ",
- expectedValue, fieldValue);
- assertEquals("Field " + fieldName + " modifier mismatch: ",
- requiredModifier, theMods);
- countPublicStatics++;
- } catch (IllegalAccessException e) {
- fail("Illegal access to Field " + fieldName);
- } // end try
- } // end if
- } // end for
+ int countPublicStatics = 0;
+ for (Field element : theFields) {
+ String fieldName = element.getName();
+ int theMods = element.getModifiers();
+ if (Modifier.isPublic(theMods) && Modifier.isStatic(theMods)) {
+ try {
+ Object fieldValue = element.get(null);
+ Object expectedValue = thePublicStatics.get(fieldName);
+ if (expectedValue == null) {
+ fail("Field " + fieldName + " missing!");
+ } // end
+ assertEquals("Field " + fieldName + " value mismatch: ",
+ expectedValue, fieldValue);
+ assertEquals("Field " + fieldName + " modifier mismatch: ",
+ requiredModifier, theMods);
+ countPublicStatics++;
+ } catch (IllegalAccessException e) {
+ fail("Illegal access to Field " + fieldName);
+ } // end try
+ } // end if
+ } // end for
- } // end method testPublicStatics
+ } // end method testPublicStatics
} // end class TypesTest
Modified: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/ConnectionEventTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/ConnectionEventTest.java?view=diff&rev=556562&r1=556561&r2=556562
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/ConnectionEventTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/ConnectionEventTest.java Mon Jul 16 02:02:56 2007
@@ -34,31 +34,31 @@
fail("illegal argument exception expected");
} catch (IllegalArgumentException e) {
}
-
+
Impl_PooledConnection ipc = new Impl_PooledConnection();
ConnectionEvent ce = new ConnectionEvent(ipc);
assertSame(ipc, ce.getSource());
assertNull(ce.getSQLException());
}
-
+
public void testConstructorConnectionSQLException() {
try {
new ConnectionEvent(null, null);
fail("illegal argument exception expected");
} catch (IllegalArgumentException e) {
}
-
+
Impl_PooledConnection ipc = new Impl_PooledConnection();
ConnectionEvent ce = new ConnectionEvent(ipc, null);
assertSame(ipc, ce.getSource());
assertNull(ce.getSQLException());
-
+
SQLException e = new SQLException();
ce = new ConnectionEvent(ipc, e);
assertSame(ipc, ce.getSource());
assertSame(e, ce.getSQLException());
}
-
+
/**
* @tests serialization/deserialization compatibility.
*/
@@ -111,5 +111,4 @@
}
};
-}
-
+}
Modified: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_PooledConnection.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_PooledConnection.java?view=diff&rev=556562&r1=556561&r2=556562
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_PooledConnection.java (original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_PooledConnection.java Mon Jul 16 02:02:56 2007
@@ -33,6 +33,7 @@
return null;
}
- public void removeConnectionEventListener(ConnectionEventListener theListener) {
+ public void removeConnectionEventListener(
+ ConnectionEventListener theListener) {
}
}
Modified: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_RowSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_RowSet.java?view=diff&rev=556562&r1=556561&r2=556562
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_RowSet.java (original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/Impl_RowSet.java Mon Jul 16 02:02:56 2007
@@ -99,34 +99,38 @@
public void removeRowSetListener(RowSetListener theListener) {
}
- public void setArray(int parameterIndex, Array theArray) throws SQLException {
- }
-
- public void setAsciiStream(int parameterIndex, InputStream theInputStream, int length)
+ public void setArray(int parameterIndex, Array theArray)
throws SQLException {
}
- public void setBigDecimal(int parameterIndex, BigDecimal theBigDecimal) throws SQLException {
+ public void setAsciiStream(int parameterIndex, InputStream theInputStream,
+ int length) throws SQLException {
}
- public void setBinaryStream(int parameterIndex, InputStream theInputStream, int length)
+ public void setBigDecimal(int parameterIndex, BigDecimal theBigDecimal)
throws SQLException {
}
+ public void setBinaryStream(int parameterIndex, InputStream theInputStream,
+ int length) throws SQLException {
+ }
+
public void setBlob(int parameterIndex, Blob theBlob) throws SQLException {
}
- public void setBoolean(int parameterIndex, boolean theBoolean) throws SQLException {
+ public void setBoolean(int parameterIndex, boolean theBoolean)
+ throws SQLException {
}
public void setByte(int parameterIndex, byte theByte) throws SQLException {
}
- public void setBytes(int parameterIndex, byte[] theByteArray) throws SQLException {
+ public void setBytes(int parameterIndex, byte[] theByteArray)
+ throws SQLException {
}
- public void setCharacterStream(int parameterIndex, Reader theReader, int length)
- throws SQLException {
+ public void setCharacterStream(int parameterIndex, Reader theReader,
+ int length) throws SQLException {
}
public void setClob(int parameterIndex, Clob theClob) throws SQLException {
@@ -148,13 +152,15 @@
public void setDate(int parameterIndex, Date theDate) throws SQLException {
}
- public void setDouble(int parameterIndex, double theDouble) throws SQLException {
+ public void setDouble(int parameterIndex, double theDouble)
+ throws SQLException {
}
public void setEscapeProcessing(boolean enable) throws SQLException {
}
- public void setFloat(int parameterIndex, float theFloat) throws SQLException {
+ public void setFloat(int parameterIndex, float theFloat)
+ throws SQLException {
}
public void setInt(int parameterIndex, int theInteger) throws SQLException {
@@ -169,21 +175,23 @@
public void setMaxRows(int max) throws SQLException {
}
- public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException {
+ public void setNull(int parameterIndex, int sqlType, String typeName)
+ throws SQLException {
}
public void setNull(int parameterIndex, int sqlType) throws SQLException {
}
- public void setObject(int parameterIndex, Object theObject, int targetSqlType, int scale)
- throws SQLException {
+ public void setObject(int parameterIndex, Object theObject,
+ int targetSqlType, int scale) throws SQLException {
}
- public void setObject(int parameterIndex, Object theObject, int targetSqlType)
- throws SQLException {
+ public void setObject(int parameterIndex, Object theObject,
+ int targetSqlType) throws SQLException {
}
- public void setObject(int parameterIndex, Object theObject) throws SQLException {
+ public void setObject(int parameterIndex, Object theObject)
+ throws SQLException {
}
public void setPassword(String password) throws SQLException {
@@ -198,10 +206,12 @@
public void setRef(int parameterIndex, Ref theRef) throws SQLException {
}
- public void setShort(int parameterIndex, short theShort) throws SQLException {
+ public void setShort(int parameterIndex, short theShort)
+ throws SQLException {
}
- public void setString(int parameterIndex, String theString) throws SQLException {
+ public void setString(int parameterIndex, String theString)
+ throws SQLException {
}
public void setTime(int parameterIndex, Time theTime, Calendar theCalendar)
@@ -211,11 +221,12 @@
public void setTime(int parameterIndex, Time theTime) throws SQLException {
}
- public void setTimestamp(int parameterIndex, Timestamp theTimestamp, Calendar theCalendar)
- throws SQLException {
+ public void setTimestamp(int parameterIndex, Timestamp theTimestamp,
+ Calendar theCalendar) throws SQLException {
}
- public void setTimestamp(int parameterIndex, Timestamp theTimestamp) throws SQLException {
+ public void setTimestamp(int parameterIndex, Timestamp theTimestamp)
+ throws SQLException {
}
public void setTransactionIsolation(int level) throws SQLException {
@@ -224,7 +235,8 @@
public void setType(int type) throws SQLException {
}
- public void setTypeMap(Map<String, Class<?>> theTypeMap) throws SQLException {
+ public void setTypeMap(Map<String, Class<?>> theTypeMap)
+ throws SQLException {
}
public void setUrl(String theURL) throws SQLException {
@@ -279,7 +291,8 @@
return null;
}
- public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
+ public BigDecimal getBigDecimal(int columnIndex, int scale)
+ throws SQLException {
return null;
}
@@ -287,7 +300,8 @@
return null;
}
- public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException {
+ public BigDecimal getBigDecimal(String columnName, int scale)
+ throws SQLException {
return null;
}
@@ -419,7 +433,8 @@
return null;
}
- public Object getObject(int columnIndex, Map<String, Class<?>> map) throws SQLException {
+ public Object getObject(int columnIndex, Map<String, Class<?>> map)
+ throws SQLException {
return null;
}
@@ -427,7 +442,8 @@
return null;
}
- public Object getObject(String columnName, Map<String, Class<?>> map) throws SQLException {
+ public Object getObject(String columnName, Map<String, Class<?>> map)
+ throws SQLException {
return null;
}
@@ -483,7 +499,8 @@
return null;
}
- public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
+ public Timestamp getTimestamp(int columnIndex, Calendar cal)
+ throws SQLException {
return null;
}
@@ -491,7 +508,8 @@
return null;
}
- public Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException {
+ public Timestamp getTimestamp(String columnName, Calendar cal)
+ throws SQLException {
return null;
}
@@ -599,10 +617,12 @@
throws SQLException {
}
- public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
+ public void updateBigDecimal(int columnIndex, BigDecimal x)
+ throws SQLException {
}
- public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException {
+ public void updateBigDecimal(String columnName, BigDecimal x)
+ throws SQLException {
}
public void updateBinaryStream(int columnIndex, InputStream x, int length)
@@ -641,8 +661,8 @@
throws SQLException {
}
- public void updateCharacterStream(String columnName, Reader reader, int length)
- throws SQLException {
+ public void updateCharacterStream(String columnName, Reader reader,
+ int length) throws SQLException {
}
public void updateClob(int columnIndex, Clob x) throws SQLException {
@@ -687,13 +707,15 @@
public void updateNull(String columnName) throws SQLException {
}
- public void updateObject(int columnIndex, Object x, int scale) throws SQLException {
+ public void updateObject(int columnIndex, Object x, int scale)
+ throws SQLException {
}
public void updateObject(int columnIndex, Object x) throws SQLException {
}
- public void updateObject(String columnName, Object x, int scale) throws SQLException {
+ public void updateObject(String columnName, Object x, int scale)
+ throws SQLException {
}
public void updateObject(String columnName, Object x) throws SQLException {
@@ -726,10 +748,12 @@
public void updateTime(String columnName, Time x) throws SQLException {
}
- public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException {
+ public void updateTimestamp(int columnIndex, Timestamp x)
+ throws SQLException {
}
- public void updateTimestamp(String columnName, Timestamp x) throws SQLException {
+ public void updateTimestamp(String columnName, Timestamp x)
+ throws SQLException {
}
public boolean wasNull() throws SQLException {
Modified: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/RowSetEventTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/RowSetEventTest.java?view=diff&rev=556562&r1=556561&r2=556562
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/RowSetEventTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/RowSetEventTest.java Mon Jul 16 02:02:56 2007
@@ -28,7 +28,7 @@
fail("illegal argument exception expected");
} catch (IllegalArgumentException e) {
}
-
+
Impl_RowSet irs = new Impl_RowSet();
RowSetEvent rse = new RowSetEvent(irs);
assertSame(irs, rse.getSource());
Modified: 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/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java?view=diff&rev=556562&r1=556561&r2=556562
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java Mon Jul 16 02:02:56 2007
@@ -41,7 +41,7 @@
assertNotNull(params);
assertEquals(0, params.length);
}
-
+
/**
* @tests {@link javax.sql.rowset.BaseRowSet#getFetchDirection()}
*/
@@ -49,7 +49,7 @@
BaseRowSetImpl brs = new BaseRowSetImpl();
assertEquals(ResultSet.FETCH_FORWARD, brs.getFetchDirection());
}
-
+
/**
* @tests {@link javax.sql.rowset.BaseRowSet#getTypeMap()}
*/
@@ -57,7 +57,7 @@
BaseRowSetImpl brs = new BaseRowSetImpl();
assertNull(brs.getTypeMap());
}
-
+
public void testSetNullintint() throws Exception {
BaseRowSetImpl brs = new BaseRowSetImpl();
try {
@@ -65,25 +65,25 @@
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];
+ 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 {
@@ -91,26 +91,26 @@
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];
+ 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 {
@@ -118,105 +118,105 @@
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);
+ brs.setByte(1, (byte) 1);
fail("sql exception expected");
} catch (SQLException e) {
}
-
+
brs.initParams();
-
+
try {
- brs.setByte(0, (byte)1);
+ brs.setByte(0, (byte) 1);
fail("sql exception expected");
} catch (SQLException e) {
}
-
- brs.setByte(1, (byte)1);
+
+ brs.setByte(1, (byte) 1);
Object[] params = brs.getParams();
assertNotNull(params);
assertEquals(1, params.length);
- assertEquals(Byte.valueOf((byte)1), params[0]);
+ assertEquals(Byte.valueOf((byte) 1), params[0]);
}
-
+
public void testSetShort() throws Exception {
BaseRowSetImpl brs = new BaseRowSetImpl();
try {
- brs.setShort(1, (short)1);
+ brs.setShort(1, (short) 1);
fail("sql exception expected");
} catch (SQLException e) {
}
-
+
brs.initParams();
-
+
try {
- brs.setShort(0, (short)1);
+ brs.setShort(0, (short) 1);
fail("sql exception expected");
} catch (SQLException e) {
}
-
- brs.setShort(1, (byte)1);
+
+ brs.setShort(1, (byte) 1);
Object[] params = brs.getParams();
assertNotNull(params);
assertEquals(1, params.length);
- assertEquals(Short.valueOf((short)1), params[0]);
+ assertEquals(Short.valueOf((short) 1), params[0]);
}
-
+
/**
* @tests {@link javax.sql.rowset.BaseRowSet#setFetchDirection(int)}
*/
public void testSetFetchDirectionI() throws SQLException {
- BaseRowSetImpl brs = new BaseRowSetImpl();
- brs.setFetchDirection(ResultSet.FETCH_FORWARD);
- assertEquals(ResultSet.FETCH_FORWARD, brs.getFetchDirection());
-
- brs.setType(ResultSet.TYPE_SCROLL_SENSITIVE);
- brs.setFetchDirection(ResultSet.FETCH_UNKNOWN);
- assertEquals(ResultSet.FETCH_UNKNOWN, brs.getFetchDirection());
-
- brs.setType(ResultSet.TYPE_FORWARD_ONLY);
- try {
- brs.setFetchDirection(ResultSet.FETCH_REVERSE);
- fail("should throw SQLException");
- } catch (SQLException e) {
- // expected
- }
-
- try {
- brs.setFetchDirection(1100);
- fail("should throw SQLException");
- } catch (SQLException e) {
- // expected
- }
+ BaseRowSetImpl brs = new BaseRowSetImpl();
+ brs.setFetchDirection(ResultSet.FETCH_FORWARD);
+ assertEquals(ResultSet.FETCH_FORWARD, brs.getFetchDirection());
+
+ brs.setType(ResultSet.TYPE_SCROLL_SENSITIVE);
+ brs.setFetchDirection(ResultSet.FETCH_UNKNOWN);
+ assertEquals(ResultSet.FETCH_UNKNOWN, brs.getFetchDirection());
+
+ brs.setType(ResultSet.TYPE_FORWARD_ONLY);
+ try {
+ brs.setFetchDirection(ResultSet.FETCH_REVERSE);
+ fail("should throw SQLException");
+ } catch (SQLException e) {
+ // expected
+ }
+
+ try {
+ brs.setFetchDirection(1100);
+ fail("should throw SQLException");
+ } catch (SQLException e) {
+ // expected
+ }
}
-
+
/**
* @tests {@link javax.sql.rowset.BaseRowSet#setTypeMap(java.util.Map)}
*/
public void testSetTypeMap() {
- BaseRowSetImpl brs = new BaseRowSetImpl();
- brs.setTypeMap(null);
- assertNull(brs.getTypeMap());
+ BaseRowSetImpl brs = new BaseRowSetImpl();
+ brs.setTypeMap(null);
+ assertNull(brs.getTypeMap());
}
-
+
public void testSetArray() throws SQLException {
BaseRowSetImpl brs = new BaseRowSetImpl();
brs.initParams();
@@ -225,9 +225,10 @@
Object[] params = brs.getParams();
assertNotNull(params);
assertEquals(1, params.length);
- assertTrue("Should have stored a SerialArray", params[0] instanceof SerialArray);
+ assertTrue("Should have stored a SerialArray",
+ params[0] instanceof SerialArray);
}
-
+
public void testSetBlob() throws SQLException {
BaseRowSetImpl brs = new BaseRowSetImpl();
brs.initParams();
@@ -236,9 +237,10 @@
Object[] params = brs.getParams();
assertNotNull(params);
assertEquals(1, params.length);
- assertTrue("Should have stored a SerialBlob", params[0] instanceof SerialBlob);
+ assertTrue("Should have stored a SerialBlob",
+ params[0] instanceof SerialBlob);
}
-
+
public void testSetClob() throws SQLException {
BaseRowSetImpl brs = new BaseRowSetImpl();
brs.initParams();
@@ -248,9 +250,10 @@
assertNotNull(params);
assertEquals(1, params.length);
assertTrue(c != params[0]);
- assertTrue("Should have stored a SerialClob", params[0] instanceof SerialClob);
+ assertTrue("Should have stored a SerialClob",
+ params[0] instanceof SerialClob);
}
-
+
public void testSetRef() throws SQLException {
BaseRowSetImpl brs = new BaseRowSetImpl();
brs.initParams();
@@ -260,9 +263,10 @@
assertNotNull(params);
assertEquals(1, params.length);
assertTrue(r != params[0]);
- assertTrue("Should have stored a SerialRef", params[0] instanceof SerialRef);
+ assertTrue("Should have stored a SerialRef",
+ params[0] instanceof SerialRef);
}
-
+
private static final class BaseRowSetImpl extends BaseRowSet {
private static final long serialVersionUID = 1L;
Modified: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockArray.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockArray.java?view=diff&rev=556562&r1=556561&r2=556562
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockArray.java (original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockArray.java Mon Jul 16 02:02:56 2007
@@ -52,8 +52,7 @@
return null;
}
- public ResultSet getResultSet(long index, int count)
- throws SQLException {
+ public ResultSet getResultSet(long index, int count) throws SQLException {
return null;
}
Modified: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockBlob.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockBlob.java?view=diff&rev=556562&r1=556561&r2=556562
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockBlob.java (original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockBlob.java Mon Jul 16 02:02:56 2007
@@ -62,7 +62,8 @@
public void free() throws SQLException {
}
- public InputStream getBinaryStream(long pos, long length) throws SQLException {
+ public InputStream getBinaryStream(long pos, long length)
+ throws SQLException {
return null;
}
}
Modified: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockClob.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockClob.java?view=diff&rev=556562&r1=556561&r2=556562
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockClob.java (original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/MockClob.java Mon Jul 16 02:02:56 2007
@@ -28,7 +28,9 @@
public class MockClob implements Clob {
public Reader characterStreamReader = new StringReader("xys");
- public InputStream asciiInputStream = new ByteArrayInputStream("hello".getBytes());
+
+ public InputStream asciiInputStream = new ByteArrayInputStream("hello"
+ .getBytes());
public InputStream getAsciiStream() throws SQLException {
return asciiInputStream;
Modified: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/RowSetMetaDataImplTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/RowSetMetaDataImplTest.java?view=diff&rev=556562&r1=556561&r2=556562
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/RowSetMetaDataImplTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/RowSetMetaDataImplTest.java Mon Jul 16 02:02:56 2007
@@ -1,6 +1,5 @@
package org.apache.harmony.sql.tests.javax.sql.rowset;
-
import java.io.Serializable;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
@@ -14,16 +13,16 @@
import junit.framework.TestCase;
/**
- * Test class for javax.sql.rowset.RowSetMetaDataImpl
- *
+ * Test class for javax.sql.rowset.RowSetMetaDataImpl
+ *
*/
public class RowSetMetaDataImplTest extends TestCase {
-
+
private static RowSetMetaDataImpl metaDataImpl = null;
-
+
/**
- * This comparator is designed for RowSetMetaDataImpl objects whose
- * colCount has already been set. Other objects may fail when using it.
+ * This comparator is designed for RowSetMetaDataImpl objects whose colCount
+ * has already been set. Other objects may fail when using it.
*/
private final static SerializableAssert ROWSET_METADATA_COMPARATOR = new SerializableAssert() {
@@ -32,23 +31,24 @@
try {
RowSetMetaDataImpl initialImpl = (RowSetMetaDataImpl) initial;
RowSetMetaDataImpl deserializedImpl = (RowSetMetaDataImpl) deserialized;
-
- Assert.assertEquals(initialImpl.getColumnCount(), deserializedImpl.getColumnCount());
- Assert.assertEquals(initialImpl.getColumnType(1), deserializedImpl.getColumnType(1));
+
+ Assert.assertEquals(initialImpl.getColumnCount(),
+ deserializedImpl.getColumnCount());
+ Assert.assertEquals(initialImpl.getColumnType(1),
+ deserializedImpl.getColumnType(1));
} catch (SQLException e) {
fail();
}
}
};
-
+
/**
* @tests javax.sql.rowset.RowSetMetaDataImpl#RowSetMetaDataImpl()
*/
public void test_Constructor() {
- assertNotNull(metaDataImpl);
+ assertNotNull(metaDataImpl);
}
-
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#getColumnCount()}
*/
@@ -57,17 +57,17 @@
try {
metaDataImpl.isAutoIncrement(1);
fail("should throw SQLException");
- } catch (SQLException e) {
+ } catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(4);
assertEquals(4, metaDataImpl.getColumnCount());
assertFalse(metaDataImpl.isAutoIncrement(4));
-
+
metaDataImpl.setColumnCount(Integer.MAX_VALUE);
assertFalse(metaDataImpl.isAutoIncrement(4));
- //assertEquals(Integer.MAX_VALUE, metaDataImpl.getColumnCount());
+ // assertEquals(Integer.MAX_VALUE, metaDataImpl.getColumnCount());
// RI throws ArrayIndexOutOfBoundsException here, which is a RI's bug
try {
metaDataImpl.isAutoIncrement(5);
@@ -76,25 +76,25 @@
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#setColumnCount(int)}
*/
public void test_setColumnCountI() throws SQLException {
try {
metaDataImpl.setColumnCount(-1);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
-
+
try {
metaDataImpl.setColumnCount(0);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(18);
assertEquals(18, metaDataImpl.getColumnCount());
metaDataImpl.setAutoIncrement(1, true);
@@ -104,47 +104,47 @@
assertEquals(19, metaDataImpl.getColumnCount());
assertFalse(metaDataImpl.isAutoIncrement(1));
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#getCatalogName(int)}
*/
public void test_getCatalogNameI() throws SQLException {
try {
metaDataImpl.getCatalogName(1);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(2);
assertEquals("", metaDataImpl.getCatalogName(1));
metaDataImpl.setCatalogName(1, "catalog");
assertEquals("catalog", metaDataImpl.getCatalogName(1));
metaDataImpl.setCatalogName(1, null);
assertEquals("", metaDataImpl.getCatalogName(1));
-
+
try {
metaDataImpl.getCatalogName(Integer.MIN_VALUE);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#getColumnClassName(int)}
*/
public void test_getColumnClassNameI() throws SQLException {
try {
metaDataImpl.getColumnClassName(1);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(12);
assertEquals("java.lang.String", metaDataImpl.getColumnClassName(12));
-
+
metaDataImpl.setColumnTypeName(12, null);
assertEquals("java.lang.String", metaDataImpl.getColumnClassName(12));
metaDataImpl.setColumnType(12, Types.BLOB);
@@ -156,234 +156,235 @@
metaDataImpl.setColumnType(12, Types.BIT);
assertEquals("java.lang.Boolean", metaDataImpl.getColumnClassName(12));
metaDataImpl.setColumnType(12, Types.DECIMAL);
- assertEquals("java.math.BigDecimal", metaDataImpl.getColumnClassName(12));
+ assertEquals("java.math.BigDecimal", metaDataImpl
+ .getColumnClassName(12));
metaDataImpl.setColumnType(12, Types.TINYINT);
assertEquals("java.lang.Byte", metaDataImpl.getColumnClassName(12));
-
+
try {
metaDataImpl.getColumnClassName(0);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#getColumnDisplaySize(int)}
*/
public void test_getColumnDisplaySizeI() throws SQLException {
try {
metaDataImpl.getColumnDisplaySize(1);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(2);
assertEquals(0, metaDataImpl.getColumnDisplaySize(1));
metaDataImpl.setColumnDisplaySize(1, 4);
assertEquals(4, metaDataImpl.getColumnDisplaySize(1));
-
+
try {
metaDataImpl.getColumnDisplaySize(-32);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#getColumnLabel(int)}
*/
public void test_getColumnLabelI() throws SQLException {
try {
metaDataImpl.getColumnLabel(1);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(3);
assertNull(metaDataImpl.getColumnLabel(1));
metaDataImpl.setColumnLabel(1, null);
assertEquals("", metaDataImpl.getColumnLabel(1));
metaDataImpl.setColumnLabel(1, "err");
assertEquals("err", metaDataImpl.getColumnLabel(1));
-
+
try {
metaDataImpl.getColumnLabel(11);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#getColumnName(int)}
*/
public void test_getColumnNameI() throws SQLException {
try {
metaDataImpl.getColumnName(1);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(13);
assertNull(metaDataImpl.getColumnName(12));
metaDataImpl.setColumnName(12, null);
assertEquals("", metaDataImpl.getColumnName(12));
metaDataImpl.setColumnName(12, "ColumnName");
assertEquals("ColumnName", metaDataImpl.getColumnName(12));
-
+
try {
metaDataImpl.getColumnName(0);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#getColumnType(int)}
*/
public void test_getColumnTypeI() throws SQLException {
try {
metaDataImpl.getColumnType(1);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(13);
metaDataImpl.setColumnType(13, Types.ARRAY);
assertEquals(Types.ARRAY, metaDataImpl.getColumnType(13));
-
+
try {
metaDataImpl.getColumnType(14);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#getColumnTypeName(int)}
*/
public void test_getColumnTypeNameI() throws SQLException {
try {
metaDataImpl.getColumnTypeName(223);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(21);
metaDataImpl.setColumnType(14, Types.BIGINT);
metaDataImpl.setColumnTypeName(14, null);
assertEquals("", metaDataImpl.getColumnTypeName(14));
metaDataImpl.setColumnTypeName(14, "haha");
assertEquals("haha", metaDataImpl.getColumnTypeName(14));
-
+
try {
metaDataImpl.getColumnTypeName(22);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#getPrecision(int)}
*/
public void test_getPrecisionI() throws SQLException {
try {
metaDataImpl.getPrecision(2);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(1);
assertEquals(0, metaDataImpl.getPrecision(1));
metaDataImpl.setPrecision(1, Integer.MAX_VALUE);
assertEquals(Integer.MAX_VALUE, metaDataImpl.getPrecision(1));
-
+
try {
metaDataImpl.getPrecision(3);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#getSchemaName(int)}
*/
public void test_getScaleI() throws SQLException {
try {
metaDataImpl.getScale(1);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(2);
assertEquals(0, metaDataImpl.getScale(2));
metaDataImpl.setScale(2, Integer.MAX_VALUE);
assertEquals(Integer.MAX_VALUE, metaDataImpl.getScale(2));
-
+
try {
metaDataImpl.getScale(3);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#getSchemaName(int)}
*/
public void test_getSchemaNameI() throws SQLException {
try {
metaDataImpl.getSchemaName(352);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(67);
metaDataImpl.setSchemaName(67, null);
assertEquals("", metaDataImpl.getSchemaName(67));
metaDataImpl.setSchemaName(67, "a \u0053");
assertEquals("a S", metaDataImpl.getSchemaName(67));
-
+
try {
metaDataImpl.getSchemaName(Integer.MIN_VALUE);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#getTableName(int)}
*/
public void test_getTableNameI() throws SQLException {
try {
metaDataImpl.getTableName(2);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(2);
assertEquals("", metaDataImpl.getTableName(1));
assertEquals("", metaDataImpl.getTableName(2));
metaDataImpl.setTableName(1, "tableName");
assertEquals("tableName", metaDataImpl.getTableName(1));
assertEquals("", metaDataImpl.getTableName(2));
-
+
try {
metaDataImpl.getTableName(Integer.MIN_VALUE);
fail("should throw SQLException");
@@ -391,39 +392,39 @@
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#isAutoIncrement(int)}
*/
public void test_isAutoIncrementI() throws SQLException {
try {
metaDataImpl.isAutoIncrement(1);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
-
- metaDataImpl.setColumnCount(3);
+
+ metaDataImpl.setColumnCount(3);
assertFalse(metaDataImpl.isAutoIncrement(1));
assertFalse(metaDataImpl.isAutoIncrement(3));
metaDataImpl.setAutoIncrement(3, true);
assertTrue(metaDataImpl.isAutoIncrement(3));
-
+
try {
metaDataImpl.isAutoIncrement(-1);
- fail ("should throw SQLException");
- } catch (SQLException e) {
+ fail("should throw SQLException");
+ } catch (SQLException e) {
// expected
}
-
+
try {
metaDataImpl.isAutoIncrement(4);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#isCaseSensitive(int)}
*/
@@ -431,27 +432,27 @@
metaDataImpl.setColumnCount(5);
assertFalse(metaDataImpl.isCaseSensitive(2));
assertFalse(metaDataImpl.isCaseSensitive(5));
-
+
metaDataImpl.setCaseSensitive(2, true);
assertTrue(metaDataImpl.isCaseSensitive(2));
metaDataImpl.setCaseSensitive(2, false);
assertFalse(metaDataImpl.isCaseSensitive(2));
-
+
try {
metaDataImpl.isCaseSensitive(0);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
try {
metaDataImpl.isCaseSensitive(6);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#isCurrency(int)}
*/
@@ -462,25 +463,25 @@
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(5);
assertFalse(metaDataImpl.isCurrency(1));
metaDataImpl.setCurrency(1, true);
assertTrue(metaDataImpl.isCurrency(1));
metaDataImpl.setCurrency(1, true);
assertTrue(metaDataImpl.isCurrency(1));
-
+
try {
metaDataImpl.isCurrency(0);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(6);
assertFalse(metaDataImpl.isCurrency(1));
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#isNullable(int)}
*/
@@ -491,12 +492,14 @@
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(2);
- assertEquals(ResultSetMetaData.columnNoNulls, metaDataImpl.isNullable(1));
+ assertEquals(ResultSetMetaData.columnNoNulls, metaDataImpl
+ .isNullable(1));
metaDataImpl.setNullable(1, ResultSetMetaData.columnNullableUnknown);
- assertEquals(ResultSetMetaData.columnNullableUnknown, metaDataImpl.isNullable(1));
-
+ assertEquals(ResultSetMetaData.columnNullableUnknown, metaDataImpl
+ .isNullable(1));
+
try {
metaDataImpl.isNullable(3);
fail("should throw SQLException");
@@ -504,7 +507,7 @@
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#isReadOnly(int)}
*/
@@ -515,12 +518,12 @@
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(11);
assertFalse(metaDataImpl.isReadOnly(1));
assertFalse(metaDataImpl.isReadOnly(11));
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#isWritable(int)}
*/
@@ -531,13 +534,13 @@
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(3);
assertTrue(metaDataImpl.isWritable(1));
-
+
assertTrue(metaDataImpl.isWritable(3));
assertFalse(metaDataImpl.isReadOnly(3));
-
+
try {
metaDataImpl.isWritable(4);
fail("should throw SQLException");
@@ -545,7 +548,7 @@
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#isDefinitelyWritable(int)}
*/
@@ -553,7 +556,7 @@
metaDataImpl.setColumnCount(2);
assertTrue(metaDataImpl.isDefinitelyWritable(1));
assertTrue(metaDataImpl.isDefinitelyWritable(2));
-
+
// RI fails here, which does not comply to the spec
try {
metaDataImpl.isDefinitelyWritable(-1);
@@ -562,7 +565,7 @@
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#isSearchable(int)}
*/
@@ -573,22 +576,22 @@
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(1);
assertFalse(metaDataImpl.isSearchable(1));
metaDataImpl.setSearchable(1, true);
assertTrue(metaDataImpl.isSearchable(1));
metaDataImpl.setSearchable(1, false);
assertFalse(metaDataImpl.isSearchable(1));
-
+
try {
metaDataImpl.isSearchable(2);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#isSigned(int)}
*/
@@ -599,59 +602,59 @@
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(35);
assertFalse(metaDataImpl.isSigned(35));
metaDataImpl.setSigned(35, true);
assertTrue(metaDataImpl.isSigned(35));
metaDataImpl.setSigned(35, false);
assertFalse(metaDataImpl.isSigned(35));
-
+
try {
metaDataImpl.isSigned(36);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#setAutoIncrement(int, boolean)}
*/
public void test_setAutoIncrementIZ() throws SQLException {
try {
metaDataImpl.setAutoIncrement(1, true);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(2);
assertFalse(metaDataImpl.isAutoIncrement(1));
metaDataImpl.setAutoIncrement(1, false);
assertFalse(metaDataImpl.isAutoIncrement(1));
metaDataImpl.setAutoIncrement(1, true);
assertTrue(metaDataImpl.isAutoIncrement(1));
-
+
try {
metaDataImpl.setAutoIncrement(-1, false);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#setCaseSensitive(int, boolean)}
*/
public void test_setCaseSensitiveIZ() throws SQLException {
try {
metaDataImpl.setCaseSensitive(2, false);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(9);
assertFalse(metaDataImpl.isCaseSensitive(9));
metaDataImpl.setCaseSensitive(9, false);
@@ -660,165 +663,165 @@
assertTrue(metaDataImpl.isCaseSensitive(9));
metaDataImpl.setAutoIncrement(9, false);
assertTrue(metaDataImpl.isCaseSensitive(9));
-
+
try {
metaDataImpl.setCaseSensitive(10, true);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#setCatalogName(int, String)}
*/
public void test_setCatalogNameILjava_lang_String() throws SQLException {
try {
metaDataImpl.setCatalogName(1, "test");
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(1);
metaDataImpl.setCatalogName(1, "AbC");
assertEquals("AbC", metaDataImpl.getCatalogName(1));
metaDataImpl.setCatalogName(1, null);
assertEquals("", metaDataImpl.getCatalogName(1));
-
+
try {
metaDataImpl.setCatalogName(10, null);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#setColumnDisplaySize(int, int)}
*/
public void test_setColumnDisplaySizeII() throws SQLException {
try {
metaDataImpl.setColumnDisplaySize(1, 2);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(1);
assertEquals(0, metaDataImpl.getColumnDisplaySize(1));
metaDataImpl.setColumnDisplaySize(1, Integer.MAX_VALUE);
assertEquals(Integer.MAX_VALUE, metaDataImpl.getColumnDisplaySize(1));
-
+
try {
metaDataImpl.setColumnDisplaySize(2, 0);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
try {
metaDataImpl.setColumnDisplaySize(2, Integer.MIN_VALUE);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#setColumnName(int, String)}
*/
public void test_setColumnNameILjava_lang_String() throws SQLException {
try {
metaDataImpl.setColumnName(1, null);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(4);
assertNull(metaDataImpl.getColumnName(1));
metaDataImpl.setColumnName(1, "ate dsW");
assertEquals("ate dsW", metaDataImpl.getColumnName(1));
metaDataImpl.setColumnName(1, null);
assertEquals("", metaDataImpl.getColumnName(1));
-
+
try {
metaDataImpl.setColumnName(5, "exception");
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#setColumnLabel(int, String)}
*/
public void test_setColumnLabelILjava_lang_String() throws SQLException {
try {
metaDataImpl.setColumnLabel(1, null);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(3);
assertNull(metaDataImpl.getColumnLabel(3));
metaDataImpl.setColumnLabel(3, null);
assertEquals("", metaDataImpl.getColumnLabel(3));
-
+
try {
metaDataImpl.setColumnLabel(4, "exception");
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#setColumnType(int, int)}
*/
public void test_setColumnTypeII() throws SQLException {
- try {
- metaDataImpl.setColumnType(1, Types.BIGINT);
- fail ("should throw SQLException");
- } catch (SQLException e) {
- // expected
- }
-
- metaDataImpl.setColumnCount(2);
- assertEquals(0, metaDataImpl.getColumnType(1));
- metaDataImpl.setColumnType(1, Types.CLOB);
- assertEquals(Types.CLOB, metaDataImpl.getColumnType(1));
- metaDataImpl.setColumnType(1, Types.BOOLEAN);
- assertEquals(Types.BOOLEAN, metaDataImpl.getColumnType(1));
-
- try {
- metaDataImpl.setColumnType(1, 66);
- fail ("should throw SQLException");
- } catch (SQLException e) {
- // expected
- }
-
- try {
- metaDataImpl.setColumnType(3, 58);
- fail ("should throw SQLException");
- } catch (SQLException e) {
- // expected
- }
- }
-
+ try {
+ metaDataImpl.setColumnType(1, Types.BIGINT);
+ fail("should throw SQLException");
+ } catch (SQLException e) {
+ // expected
+ }
+
+ metaDataImpl.setColumnCount(2);
+ assertEquals(0, metaDataImpl.getColumnType(1));
+ metaDataImpl.setColumnType(1, Types.CLOB);
+ assertEquals(Types.CLOB, metaDataImpl.getColumnType(1));
+ metaDataImpl.setColumnType(1, Types.BOOLEAN);
+ assertEquals(Types.BOOLEAN, metaDataImpl.getColumnType(1));
+
+ try {
+ metaDataImpl.setColumnType(1, 66);
+ fail("should throw SQLException");
+ } catch (SQLException e) {
+ // expected
+ }
+
+ try {
+ metaDataImpl.setColumnType(3, 58);
+ fail("should throw SQLException");
+ } catch (SQLException e) {
+ // expected
+ }
+ }
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#setColumnTypeName(int, String)}
*/
public void test_setColumnTypeNameILjava_lang_String() throws SQLException {
try {
metaDataImpl.setColumnTypeName(1, "aa");
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(2);
assertNull(metaDataImpl.getColumnTypeName(2));
metaDataImpl.setColumnTypeName(2, null);
@@ -828,212 +831,214 @@
metaDataImpl.setColumnTypeName(2, "java.lang.String");
assertEquals(0, metaDataImpl.getColumnType(2));
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#setCurrency(int, boolean)}
*/
public void test_setCurrencyIZ() throws SQLException {
try {
metaDataImpl.setCurrency(12, false);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(7);
assertFalse(metaDataImpl.isCurrency(4));
metaDataImpl.setCurrency(4, false);
assertFalse(metaDataImpl.isCurrency(4));
metaDataImpl.setCurrency(4, true);
assertTrue(metaDataImpl.isCurrency(4));
-
+
try {
metaDataImpl.setCurrency(8, true);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#setNullable(int, int)}
*/
public void test_setNullableII() throws SQLException {
try {
metaDataImpl.setNullable(21, 1);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(1);
assertEquals(0, metaDataImpl.isNullable(1));
metaDataImpl.setNullable(1, ResultSetMetaData.columnNullable);
- assertEquals(ResultSetMetaData.columnNullable, metaDataImpl.isNullable(1));
-
+ assertEquals(ResultSetMetaData.columnNullable, metaDataImpl
+ .isNullable(1));
+
try {
- metaDataImpl.setNullable(2, ResultSetMetaData.columnNullableUnknown);
- fail ("should throw SQLException");
+ metaDataImpl
+ .setNullable(2, ResultSetMetaData.columnNullableUnknown);
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
try {
metaDataImpl.setNullable(2, 3);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#setPrecision(int, int)}
*/
public void test_setPrecisionII() throws SQLException {
try {
metaDataImpl.setPrecision(12, 1);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(1);
metaDataImpl.setPrecision(1, 0);
assertEquals(0, metaDataImpl.getPrecision(1));
-
+
try {
metaDataImpl.setPrecision(12, Integer.MIN_VALUE);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#setScale(int, int)}
*/
public void test_setScaleII() throws SQLException {
try {
metaDataImpl.setScale(34, 5);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(1);
metaDataImpl.setScale(1, 252);
assertEquals(252, metaDataImpl.getScale(1));
-
+
try {
metaDataImpl.setScale(1, -23);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
try {
metaDataImpl.setScale(2, Integer.MIN_VALUE);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#setSchemaName(int, String)}
*/
public void test_setSchemaNameILjava_lang_String() throws SQLException {
try {
metaDataImpl.setSchemaName(-12, "asw");
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(7);
assertEquals("", metaDataImpl.getSchemaName(3));
metaDataImpl.setSchemaName(3, "schema name");
assertEquals("schema name", metaDataImpl.getSchemaName(3));
metaDataImpl.setSchemaName(3, null);
assertEquals("", metaDataImpl.getSchemaName(3));
-
+
try {
metaDataImpl.setSchemaName(Integer.MIN_VALUE, null);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#setSearchable(int, boolean)}
*/
public void test_setSearchableIZ() throws SQLException {
try {
metaDataImpl.setSearchable(-22, true);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(8);
assertFalse(metaDataImpl.isSearchable(2));
metaDataImpl.setSearchable(2, true);
assertTrue(metaDataImpl.isSearchable(2));
metaDataImpl.setSearchable(2, false);
- assertFalse(metaDataImpl.isSearchable(2));
-
+ assertFalse(metaDataImpl.isSearchable(2));
+
try {
metaDataImpl.setSearchable(Integer.MIN_VALUE, true);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#setSigned(int, boolean)}
*/
public void test_setSignedIZ() throws SQLException {
try {
metaDataImpl.setSigned(34, true);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(12);
assertFalse(metaDataImpl.isSigned(12));
metaDataImpl.setSigned(12, true);
assertTrue(metaDataImpl.isSigned(12));
metaDataImpl.setSigned(12, false);
- assertFalse(metaDataImpl.isSigned(12));
-
+ assertFalse(metaDataImpl.isSigned(12));
+
try {
metaDataImpl.setSigned(0, true);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
}
-
+
/**
* @tests {@link javax.sql.rowset.RowSetMetaDataImpl#setTableName(int, String)}
*/
public void test_setTableNameILjava_lang_String() throws SQLException {
try {
metaDataImpl.setTableName(34, null);
- fail ("should throw SQLException");
+ fail("should throw SQLException");
} catch (SQLException e) {
// expected
}
-
+
metaDataImpl.setColumnCount(2);
metaDataImpl.setTableName(2, "test");
assertEquals("test", metaDataImpl.getTableName(2));
metaDataImpl.setTableName(2, null);
assertEquals("", metaDataImpl.getTableName(2));
-
+
try {
metaDataImpl.setTableName(-3, null);
fail("should throw SQLException");
@@ -1041,17 +1046,17 @@
// expected
}
}
-
+
/**
* @tests serialization/deserialization.
*/
public void test_serialization_self() throws Exception {
- RowSetMetaDataImpl impl = new RowSetMetaDataImpl();
- impl.setColumnCount(1);
- impl.setColumnType(1, Types.CHAR);
- SerializationTest.verifySelf(impl, ROWSET_METADATA_COMPARATOR);
+ RowSetMetaDataImpl impl = new RowSetMetaDataImpl();
+ impl.setColumnCount(1);
+ impl.setColumnType(1, Types.CHAR);
+ SerializationTest.verifySelf(impl, ROWSET_METADATA_COMPARATOR);
}
-
+
/**
* @tests serialization/deserialization compatibility with RI.
*/