package org.apache.harmony.sql.tests.java.sql;
import dalvik.annotation.BrokenTest;
+import dalvik.annotation.KnownFailure;
import dalvik.annotation.TestTargetClass;
import dalvik.annotation.TestTargets;
import dalvik.annotation.TestLevel;
method = "deregisterDriver",
args = {java.sql.Driver.class}
)
+ @KnownFailure("Not all Drivers are loaded in testsetup. Classloader issue in DriverManager.")
public void testDeregisterDriver() throws Exception {
// First get one of the drivers loaded by the test
Driver aDriver;
public void testGetDriver() throws SQLException {
for (String element : validURLs) {
Driver validDriver = DriverManager.getDriver(element);
- assertNotNull(validDriver);
+ assertNotNull("Driver " + element + " not loaded", validDriver);
} // end for
for (String element : invalidURLs) {
} // end while
// Check that all the drivers are in the list...
- assertEquals("testGetDrivers: Don't see all the loaded drivers - ", i,
- numberLoaded);
+ assertEquals("testGetDrivers: Don't see all the loaded drivers - ", numberLoaded,
+ i);
} // end method testGetDrivers()
static int timeout1 = 25;
)
public void testRegisterDriver() throws ClassNotFoundException,
SQLException, IllegalAccessException, InstantiationException {
- String EXTRA_DRIVER_NAME = "org.apache.harmony.sql.tests.java.sql.TestHelper_Driver3";
+ // This is DRIVER3
+ // String EXTRA_DRIVER_NAME =
+ // "org.apache.harmony.sql.tests.java.sql.TestHelper_Driver3";
try {
DriverManager.registerDriver(null);
Driver theDriver = null;
// Load another Driver that isn't in the basic set
- Class<?> driverClass = Class.forName(EXTRA_DRIVER_NAME);
+ Class<?> driverClass = Class.forName(DRIVER3);
theDriver = (Driver) driverClass.newInstance();
DriverManager.registerDriver(theDriver);
-
+
assertTrue("testRegisterDriver: driver not in loaded set",
isDriverLoaded(theDriver));
try {
Class<?> driverClass = Class.forName(element);
assertNotNull(driverClass);
- // System.out.println("Loaded driver - classloader = " +
- // driverClass.getClassLoader());
+ System.out.println("Loaded driver - classloader = " +
+ driverClass.getClassLoader());
numberLoaded++;
} catch (ClassNotFoundException e) {
System.out.println("DriverManagerTest: failed to load Driver: "
+ element);
} // end try
} // end for
- /*
- * System.out.println("DriverManagerTest: number of drivers loaded: " +
- * numberLoaded);
- */
driversLoaded = true;
return numberLoaded;
} // end method loadDrivers()
* @tests Blob#close()
*/
@TestTargetNew(
- level = TestLevel.SUFFICIENT,
+ level = TestLevel.NOT_FEASIBLE,
notes = "not clear from spec what should happen when Blob is closed.",
method = "close",
args = {}
)
- @KnownFailure("Blob does not clean up inputStream.")
+// @KnownFailure("Blob does not clean up inputStream.")
public void testClose() {
assertNotNull(testBlob);
testBlob.close();
- // inputStream eithter null or some error occurs
+ // inputStream either null or some error occurs
try {
+ // TODO This does look a bit weird. Revisit later.
assertNull(testBlob.getInputStream());
} catch (Throwable e) {
//ok
}
-
- try {
- assertNull(testBlob.getOutputStream());
- } catch (Throwable e) {
- //ok
- }
-
}
}
package tests.SQLite;
+import dalvik.annotation.AndroidOnly;
import dalvik.annotation.KnownFailure;
import dalvik.annotation.TestLevel;
import dalvik.annotation.TestTargetClass;
args = {FunctionContext.class, String[].class}
)
})
+ @AndroidOnly("Aggregation function not called")
public void testCreate_aggregate() {
TestTrace t = new TestTrace();
method = "set_result_zeroblob",
args = {int.class}
)
+ @AndroidOnly("ZeroBlob not supported")
public void testSet_result_zeroblob() throws Exception,
UnsupportedEncodingException {
Stmt st = null;
method = "getMajorVersion",
args = {}
)
- })
+ })
public void testGetMajorVersion() {
if (this.jDriver != null) {
assertTrue(jDriver.getMajorVersion() > 0);
method = "jdbcCompliant",
args = {}
)
- })
+ })
public void testJdbcCompliant() {
if (this.jDriver != null) {
assertFalse(jDriver.jdbcCompliant());
.getColumnName(c));
}
// TODO getCatalog is not supported
-// assertEquals("Incorrect primary key table catalog", conn.getCatalog(),
-// rs.getString("PKTABLE_CAT"));
+ assertEquals("Incorrect primary key table catalog", conn.getCatalog(),
+ rs.getString("PKTABLE_CAT"));
assertEquals("Incorrect primary key table schema", "", rs
.getString("PKTABLE_SCHEM"));
assertEquals("Incorrect primary key table name",
assertEquals("Incorrect primary key column name", "fkey", rs
.getString("PKCOLUMN_NAME"));
// TODO getCatalog is not supported
-// assertEquals("Incorrect foreign key table catalog", conn.getCatalog(),
-// rs.getString("FKTABLE_CAT"));
+ assertEquals("Incorrect foreign key table catalog", conn.getCatalog(),
+ rs.getString("FKTABLE_CAT"));
assertEquals("Incorrect foreign key table schema", "", rs
.getString("FKTABLE_SCHEM"));
assertEquals("Incorrect foreign key table name",
public void test_getDatabaseMajorVersion() throws SQLException {
assertTrue("Incorrdct database major version", meta
.getDatabaseMajorVersion() >= 0);
- /*
- // Exception checking
+
+ // Exception checking
conn.close();
try {
} catch (SQLException e) {
// ok
}
- */
+
}
/**
assertTrue("Incorrect database minor version", meta
.getDatabaseMinorVersion() >= 0);
- /*
// Exception checking
conn.close();
} catch (SQLException e) {
// ok
}
- */
}
/**
assertTrue("Incorrect database product name", !"".equals(meta
.getDatabaseProductName().trim()));
- /*
// Exception checking
conn.close();
} catch (SQLException e) {
// ok
}
- */
+
}
/**
public void test_getDatabaseProductVersion() throws SQLException {
assertTrue("Incorrect database product version", !"".equals(meta
.getDatabaseProductVersion().trim()));
- /*
// Exception checking
conn.close();
} catch (SQLException e) {
// ok
}
- */
}
/**
fail("Incorrect value of default transaction isolation level");
}
- /*
// Exception checking
conn.close();
} catch (SQLException e) {
// ok
}
- */
}
/**
assertTrue("Incorrect driver name", driverName.trim().startsWith(
"SQLite"));
- /*
// Exception checking
conn.close();
} catch (SQLException e) {
// ok
}
- */
}
/**
public void test_getDriverVersion() throws SQLException {
assertTrue("Incorrect driver version", !"".equals(meta
.getDriverVersion().trim()));
- /*
+
//Exception checking
conn.close();
//ok
}
- */
}
.getColumnName(c));
}
// TODO getCatalog is not supported
-// assertEquals("Incorrect primary key table catalog", conn.getCatalog(),
-// rs.getString("PKTABLE_CAT"));
+ assertEquals("Incorrect primary key table catalog", conn.getCatalog(),
+ rs.getString("PKTABLE_CAT"));
assertEquals("Incorrect primary key table schema", "", rs
.getString("PKTABLE_SCHEM"));
assertEquals("Incorrect primary key table name",
DatabaseCreator.TEST_TABLE3, rs.getString("PKTABLE_NAME"));
assertEquals("Incorrect primary key column name", "fkey", rs
.getString("PKCOLUMN_NAME"));
-// assertEquals("Incorrect foreign key table catalog", conn.getCatalog(),
-// rs.getString("FKTABLE_CAT"));
+ assertEquals("Incorrect foreign key table catalog", conn.getCatalog(),
+ rs.getString("FKTABLE_CAT"));
assertEquals("Incorrect foreign key table schema", "", rs
.getString("FKTABLE_SCHEM"));
assertEquals("Incorrect foreign key table name",
public void test_getJDBCMinorVersion() throws SQLException {
assertTrue("Incorrect JDBC minor version",
meta.getJDBCMinorVersion() >= 0);
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
+
}
/**
public void test_getJDBCMajorVersion() throws SQLException {
assertTrue("Incorrect JDBC major version",
meta.getJDBCMajorVersion() >= 0);
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
+
}
public void test_getNumericFunctions() throws SQLException {
escapedFunctions(NUMERIC_FUNCTIONS, meta.getNumericFunctions());
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
+
}
/**
*/
@TestTargetNew(
level = TestLevel.SUFFICIENT,
- notes = "Functionality test fails: keys and catalogs are not supported. SQLException checking test fails",
+ notes = "Functionality test fails: keys and catalogs are not supported.",
method = "getPrimaryKeys",
args = {java.lang.String.class, java.lang.String.class, java.lang.String.class}
)
assertEquals("Incorrect column name", columnNames[c - 1], rsmd
.getColumnName(c));
}
-// assertEquals("Incorrect table catalogue", conn.getCatalog(), rs
-// .getString("TABLE_CAT").toLowerCase());
+ assertEquals("Incorrect table catalogue", conn.getCatalog(), rs
+ .getString("TABLE_CAT").toLowerCase());
assertEquals("Incorrect table schema", "", rs
.getString("TABLE_SCHEM"));
assertEquals("Incorrect table name", DatabaseCreator.TEST_TABLE1, rs
assertEquals("Incorrect column name", "id", rs.getString("COLUMN_NAME")
.toLowerCase());
assertEquals("Incorrect sequence number", 1, rs.getShort("KEY_SEQ"));
- // assertEquals("Incorrect primary key name", "primary", rs.getString(
- // "PK_NAME").toLowerCase());
+ assertEquals("Incorrect primary key name", "primary", rs.getString(
+ "PK_NAME").toLowerCase());
rs.close();
//Exception checking
}
assertFalse("Incorrect result set holdability", meta
.supportsResultSetHoldability(hdb));
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
+
}
/**
public void test_getSQLKeywords() throws SQLException {
assertTrue("Incorrect SQL keywords", !"".equals(meta.getSQLKeywords()
.trim()));
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
+
}
/**
fail("Incorrect SQL state types");
}
- /*
- //Exception checking
+
+ //Exception checking
conn.close();
try {
} catch (SQLException e) {
//ok
}
- */
+
}
/**
}
rs.close();
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
+
}
/**
public void test_getSearchStringEscape() throws SQLException {
assertTrue("Incorrect search string escape", !"".equals(meta
.getSearchStringEscape().trim()));
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
+
}
/**
public void test_getStringFunctions() throws SQLException {
escapedFunctions(STRING_FUNCTIONS, meta.getStringFunctions());
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
+
}
public void test_getSystemFunctions() throws SQLException {
escapedFunctions(SYSTEM_FUNCTIONS, meta.getSystemFunctions());
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
+
}
}
rs.close();
- /*
+
//Exception checking
conn.close();
//ok
}
- */
}
/**
method = "getTables",
args = {java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String[].class}
)
- @KnownFailure("If no schema is associated: returns empty string or shouldn't null be returned?. Ticket 98")
+ @KnownFailure("If no schema is associated: returns empty string where actually null be returned?. Ticket 98")
public void test_getTablesLjava_lang_StringLjava_lang_StringLjava_lang_String$Ljava_lang_String()
throws SQLException {
String[] tablesName = {
assertTrue("Wrong table name", Arrays.binarySearch(tablesName, rs
.getString("TABLE_NAME")) > -1);
//No Schema associated
-// assertNull("Wrong table schema: "+rs.getString("TABLE_SCHEM"), rs.getString("TABLE_SCHEM"));
+ assertNull("Wrong table schema: "+rs.getString("TABLE_SCHEM"), rs.getString("TABLE_SCHEM"));
assertTrue("Wrong table type", Arrays.binarySearch(tablesType, rs
.getString("TABLE_TYPE")) > -1);
assertEquals("Wrong parameter REMARKS", "", rs.getString("REMARKS"));
assertTrue("No tables exist", rs.next());
assertEquals("Wrong table name", VIEW_NAME, rs.getString("TABLE_NAME"));
-// assertNull("Wrong table schema: "+rs.getString("TABLE_SCHEM"), rs.getString("TABLE_SCHEM"));
+ assertNull("Wrong table schema: "+rs.getString("TABLE_SCHEM"), rs.getString("TABLE_SCHEM"));
assertEquals("Wrong table type", "VIEW", rs.getString("TABLE_TYPE"));
assertEquals("Wrong parameter REMARKS", "", rs.getString("REMARKS"));
assertFalse("Wrong size of result set", rs.next());
while (rs.next()) {
assertTrue("Wrong table name", Arrays.binarySearch(tablesName, rs
.getString("TABLE_NAME")) > -1);
-// assertNull("Wrong table schema ", rs.getString("TABLE_SCHEM"));
+ assertNull("Wrong table schema ", rs.getString("TABLE_SCHEM"));
assertTrue("Wrong table type", Arrays.binarySearch(tablesType, rs
.getString("TABLE_TYPE")) > -1);
assertEquals("Wrong parameter REMARKS", "", rs.getString("REMARKS"));
}
rs.close();
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
+
}
/**
escapedFunctions(TIMEDATE_FUNCTIONS, meta.getTimeDateFunctions());
- /*
- //Exception checking
+
+ //Exception checking
conn.close();
try {
} catch (SQLException e) {
//ok
}
- */
}
/**
method = "getTypeInfo",
args = {}
)
+ @KnownFailure("not supported")
public void test_getTypeInfo() throws SQLException {
insertNewRecord();
.getInt("DATA_TYPE")) > -1);
}
rs.close();
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
+
}
@KnownFailure("Ticket 98")
public void test_getURL() throws SQLException {
assertEquals("Wrong url", Support_SQL.sqlUrl, meta.getURL());
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
+
}
/**
args = {}
)
@KnownFailure("Ticket 98")
- public void test_getUserName() throws SQLException {
+ public void s() throws SQLException {
assertEquals("Wrong user name", Support_SQL.sqlUser, meta.getUserName());
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
+
}
"visible row insert can be detected for TYPE_SCROLL_SENSITIVE type",
meta.insertsAreDetected(ResultSet.TYPE_SCROLL_SENSITIVE));
- /*
- //Exception checking
+
+ //Exception checking
conn.close();
try {
} catch (SQLException e) {
//ok
}
- */
+
}
/**
public void test_isReadOnly() throws SQLException {
assertFalse("database is not read-only", meta.isReadOnly());
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
}
/**
"deletes made by others are visible for TYPE_SCROLL_SENSITIVE type",
meta.othersDeletesAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
+
}
/**
"inserts made by others are visible for TYPE_SCROLL_SENSITIVE type",
meta.othersInsertsAreVisible(ResultSet.TYPE_SCROLL_SENSITIVE));
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
+
}
/**
} catch (SQLException e) {
//ok
}
- */
+
}
@TestTargetNew(
method = "supportsColumnAliasing",
args = {}
)
+ @KnownFailure("not supported. SQLException checking test fails")
public void test_supportsColumnAliasing() throws SQLException {
insertNewRecord();
rs.close();
//Exception checking
- /*
conn.close();
try {
} catch (SQLException e) {
//ok
}
- */
+
}
method = "supportsExpressionsInOrderBy",
args = {}
)
+ @KnownFailure("exception test fails")
public void test_supportsExpressionsInOrderBy() throws SQLException {
insertNewRecord();
}
//Exception checking
- /*
conn.close();
try {
} catch (SQLException e) {
//ok
}
- */
+
}
method = "supportsGroupBy",
args = {}
)
+ @KnownFailure("exception test fails")
public void test_supportsGroupBy() throws SQLException {
insertNewRecord();
}
//Exception checking
- /*
conn.close();
try {
} catch (SQLException e) {
//ok
}
- */
+
}
method = "supportsGroupByUnrelated",
args = {}
)
+ @KnownFailure("exception test fails")
public void test_supportsGroupByUnrelated() throws SQLException {
insertNewRecord();
}
//Exception checking
- /*
conn.close();
try {
} catch (SQLException e) {
//ok
}
- */
+
}
/**
statementForward.execute("create table companies(id integer not null);");
statementForward.execute("drop table companies");
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
+
}
/**
method = "supportsOrderByUnrelated",
args = {}
)
+ @KnownFailure("exception test fails")
public void test_supportsOrderByUnrelated() throws SQLException {
insertNewRecord();
}
//Exception checking
-
- /*
conn.close();
try {
} catch (SQLException e) {
//ok
}
- */
+
}
/**
method = "supportsSelectForUpdate",
args = {}
)
+ @KnownFailure("exception test fails")
public void test_supportsSelectForUpdate() throws SQLException {
insertNewRecord();
//Exception checking
- /*
conn.close();
try {
} catch (SQLException e) {
//ok
}
- */
+
}
/**
method = "supportsSubqueriesInExists",
args = {}
)
+ @KnownFailure("exception test fails")
public void test_supportsSubqueriesInExists() throws SQLException {
insertNewRecord();
}
}
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
+
}
/**
method = "supportsTableCorrelationNames",
args = {}
)
+ @KnownFailure("exception test fails")
public void test_supportsTableCorrelationNames() throws SQLException {
insertNewRecord();
}
}
- /*
+
//Exception checking
conn.close();
} catch (SQLException e) {
//ok
}
- */
+
}
/**
suite.addTest(org.apache.harmony.sql.tests.java.sql.AllTests.suite());
suite.addTest(org.apache.harmony.sql.tests.javax.sql.AllTests.suite());
suite.addTest(tests.java.sql.AllTests.suite());
- suite.addTest(tests.SQLite.AllTests.suite());
+
+ // These don't do blackbox testing *and* crash JUnit on the JDK
+ // suite.addTest(tests.SQLite.AllTests.suite());
suite.addTestSuite(tests.sql.ConnectionTest.class);
suite.addTestSuite(tests.sql.PreparedStatementTest.class);
)
@KnownFailure("not supported")
public void testCreateStatementIntIntIntNotSupported() {
- /*
Statement st = null;
try {
st = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,
}
}
}
- */
}
/**
st.execute("select * from zoo where family = 'dog'");
rs1 = st.getResultSet();
assertEquals(1, getCount(rs1));
- /*
// TODO getGeneratedKeys is not supported
rs4 = prst.getGeneratedKeys();
assertEquals(0, getCount(rs4));
rs5 = prst1.getGeneratedKeys();
assertEquals(0, getCount(rs5));
- */
} catch (SQLException e) {
fail("SQLException is thrown: " + e.getMessage());
} finally {
method = "getParameterMetaData",
args = {}
)
- @KnownFailure("not supported")
public void testGetParameterMetaData() throws SQLException {
PreparedStatement ps = null;
String query = "select * from zoo where id = ?";
method = "setInt",
args = {int.class, int.class}
)
+ @KnownFailure("exception test fails")
public void testSetInt() throws SQLException {
PreparedStatement ps = null;
method = "setLong",
args = {int.class, long.class}
)
+ @KnownFailure("exception test fails")
public void testSetLong() {
PreparedStatement ps = null;
method = "setFloat",
args = {int.class, float.class}
)
+ @KnownFailure("exception test fails")
public void testSetFloat() throws SQLException {
float value1 = 12345678.12345689f;
float value2 = -12345678.12345689f;
method = "setDouble",
args = {int.class, double.class}
)
+ @KnownFailure("exception test fails")
public void testSetDouble() throws SQLException {
PreparedStatement ps = null;
method = "setString",
args = {int.class, java.lang.String.class}
)
+ @KnownFailure("exception test fails")
public void testSetString_charField() {
PreparedStatement ps = null;
method = "setString",
args = {int.class, java.lang.String.class}
)
+ @KnownFailure("exception test fails")
public void testSetString_longTextField() {
PreparedStatement ps = null;
method = "setShort",
args = {int.class, short.class}
)
+ @KnownFailure("exception test fails")
public void testSetShort() {
PreparedStatement ps = null;
method = "setBoolean",
args = {int.class, boolean.class}
)
+ @KnownFailure("exception test fails")
public void testSetBoolean() {
PreparedStatement ps = null;
method = "setByte",
args = {int.class, byte.class}
)
+ @KnownFailure("exception test fails")
public void testSetByte() {
PreparedStatement ps = null;
method = "setObject",
args = {int.class, java.lang.Object.class}
)
+ @KnownFailure("exception test fails")
public void testSetObject_int_Object() {
PreparedStatement ps = null;
* this test doesn't pass on RI
*/
@TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "",
+ level = TestLevel.SUFFICIENT,
+ notes = "not all types supported",
method = "setObject",
args = {int.class, java.lang.Object.class, int.class}
)
+ @KnownFailure("Fails for Types.DATE")
public void testSetObject_int_Object_int() {
PreparedStatement ps = null;
method = "setObject",
args = {int.class, java.lang.Object.class, int.class, int.class}
)
+ @KnownFailure("Fails for Types.DATE")
public void testSetObject_int_Object_int_int() {
PreparedStatement ps = null;
args = {}
)
})
+ @KnownFailure("Wrong value returned for Long: java.lang.String (VARCHAR)")
public void testGetMetaData() {
/*
* List<String> types = Arrays.asList("BOOLEAN", "INT", "LONG",
if (supported[i - 1]) {
assertTrue("Wrong column name at " + i, colName
.equalsIgnoreCase(meta.getColumnName(i)));
- assertTrue("Wrong type at " + i, type.equalsIgnoreCase(meta
+ assertTrue("Wrong type at " + i+" required" +type+ " but is "+meta.getColumnTypeName(i), type.equalsIgnoreCase(meta
.getColumnTypeName(i)));
}
}
method = "getObject",
args = {int.class}
)
+ @KnownFailure("Wrong value returned for Long: java.lang.String")
public void testGetObjectInt() {
try {
method = "getObject",
args = {java.lang.String.class}
)
+ @KnownFailure("Wrong value returned for Long: java.lang.String")
public void testGetObjectString() {
ListIterator<String> colNameIt = colNames.listIterator();
try {
if (supported[i-1]) {
Object value = res.getObject(name);
assertTrue("value " + value.getClass().getName()
- + " does not correspond " + typeMap[i-1] + "at "+i, value
+ + " for "+name+" does not correspond " + typeMap[i-1] + "at "+i, value
.getClass().equals(typeMap[i-1]));
}
}
}
try {
- String name = rsmd.getColumnClassName(-1);
+ String name = rsmd.getColumnClassName(0);
assertNull(name);
} catch (SQLException e) {
fail("SQLException is thrown");
method = "getColumnLabel",
args = {int.class}
)
+ @KnownFailure("Column label has format TABLE.COLUMN expected: COLUMN")
public void testGetColumnLabel() {
String[] labels = { "id", "name", "family" };
try {
for (int i = 0; i < rsmd.getColumnCount(); i++) {
String label = rsmd.getColumnLabel(i + 1);
- assertTrue(labels[i].contains(label));
+ assertTrue("expected "+labels[i] + "got "+label,labels[i].contains(label));
}
} catch (SQLException e) {
fail("SQLException is thrown: " + e.getMessage());
}
try {
- String label = rsmd.getColumnLabel(-1);
+ String label = rsmd.getColumnLabel(0);
fail("SQLException expected");
} catch (SQLException e) {
//ok
method = "getColumnName",
args = {int.class}
)
+ @KnownFailure("Column label has format TABLE.COLUMN expected: COLUMN")
public void testGetColumnName() {
String[] labels = { "id", "name", "family" };
try {
}
try {
- String label = rsmd.getColumnName(-1);
+ String label = rsmd.getColumnName(0);
fail("SQLException is not thrown");
} catch (SQLException e) {
//ok
}
try {
- rsmd.getColumnType(-1);
+ rsmd.getColumnType(0);
fail("SQLException is not thrown");
} catch (SQLException e) {
// expected
}
try {
- rsmd.getColumnTypeName(-1);
+ rsmd.getColumnTypeName(0);
fail("SQLException is not thrown");
} catch (SQLException e) {
// expected
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
- notes = "MAX/MIN/zero parameters checking missed",
+ notes = "",
method = "getTableName",
args = {int.class}
)
+ @KnownFailure("For int = 0, exception expected")
public void testGetTableName() throws SQLException {
try {
assertEquals("zoo", rsmd.getTableName(1));
} catch (SQLException sqle) {
}
}
-
+ //Exception Text
try {
- String name = rsmd.getTableName(-1);
+ String name = rsmd.getTableName(0);
fail("SQLException Expected");
} catch (SQLException e) {
// ok
}
- try {
- String name = rsmd.getTableName(5);
- fail("SQLException Expected");
- } catch (SQLException e) {
- //ok
- }
}
/**
try {
- rsmd.getPrecision(-1);
+ rsmd.getPrecision(0);
fail("SQLException is not thrown");
} catch (SQLException e) {
// expected
assertTrue(rsmd2.getScale(2) > 0);
try {
- rsmd.getScale(-1);
+ rsmd.getScale(0);
fail("SQLException is not thrown");
} catch (SQLException e) {
// expected
try {
- rsmd.getSchemaName(-1);
+ rsmd.getSchemaName(0);
fail("SQLException is not thrown");
} catch (SQLException e) {
// expected
// Exception testing
try {
- rsmd.isAutoIncrement(-1);
+ rsmd.isAutoIncrement(0);
fail("SQLException is not thrown");
} catch (SQLException e) {
// expected
// Exception testing
try {
- rsmd.isCaseSensitive(-1);
+ rsmd.isCaseSensitive(0);
fail("SQLException is not thrown");
} catch (SQLException e) {
// expected
// Exception testing
try {
- rsmd.isCurrency(-1);
+ rsmd.isCurrency(0);
fail("SQLException is not thrown");
} catch (SQLException e) {
// expected
// Exception testing
try {
- rsmd.isDefinitelyWritable(-1);
+ rsmd.isDefinitelyWritable(0);
fail("SQLException is not thrown");
} catch (SQLException e) {
// expected
// Exception testing
try {
- rsmd.isNullable(-1);
+ rsmd.isNullable(0);
fail("SQLException is not thrown");
} catch (SQLException e) {
// expected
* @test {@link java.sql.ResultSetMetaData#isReadOnly(int column)}
*/
@TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "Tests fail: always returns false. Exceptions fail, Feature only partially implemented.",
+ level = TestLevel.NOT_FEASIBLE,
+ notes = "Cannot know from blackbox test if readonly or writable. Exceptions fail, Feature only partially implemented.",
method = "isReadOnly",
args = {int.class}
)
// Exception testing
try {
- rsmd.isReadOnly(-1);
- fail("SQLException is not thrown");
- } catch (SQLException e) {
- // expected
- }
- try {
- rsmd.isReadOnly(5);
+ rsmd.isReadOnly(0);
fail("SQLException is not thrown");
} catch (SQLException e) {
// expected
// Exception testing
try {
- rsmd.isSearchable(-1);
- fail("SQLException is not thrown");
- } catch (SQLException e) {
- // expected
- }
- try {
- rsmd.isSearchable(5);
+ rsmd.isSearchable(0);
fail("SQLException is not thrown");
} catch (SQLException e) {
// expected
// Exception testing
try {
- rsmd.isSigned(-1);
- fail("SQLException is not thrown");
- } catch (SQLException e) {
- // expected
- }
- try {
- rsmd.isSigned(5);
+ rsmd.isSigned(0);
fail("SQLException is not thrown");
} catch (SQLException e) {
// expected
* @test {@link java.sql.ResultSetMetaData#isWritable(int column)}
*/
@TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "Not supported. Tests fail: always returns false. Exceptions and tests on non numeric fields fail, failing statements commented out. Feature only partially implemented.",
+ level = TestLevel.NOT_FEASIBLE,
+ notes = "Analaguous to is Readonly. Exceptions and tests on non numeric fields fail, failing statements commented out. Feature only partially implemented.",
method = "isWritable",
args = {int.class}
)
assertTrue(rsmd.isWritable(2));
assertTrue(rsmd.isWritable(3));
} catch (SQLException e1) {
- fail("ResultSetMetaDataTest.isReadOnly" + e1.getMessage());
+ fail("ResultSetMetaDataTest.isWritable" + e1.getMessage());
e1.printStackTrace();
}
- /*
// Exception testing
try {
- rsmd.isWritable(-1);
- fail("SQLException is not thrown");
- } catch (SQLException e) {
- // expected
- }
- try {
- rsmd.isSigned(5);
+ rsmd.isWritable(0);
fail("SQLException is not thrown");
} catch (SQLException e) {
// expected
}
- */
}
// Exception testing
try {
- rsmd.getColumnDisplaySize(-1);
+ rsmd.getColumnDisplaySize(0);
fail("SQLException is not thrown");
} catch (SQLException e) {
// expected
)
@KnownFailure("not supported")
public void testPrevious2() throws SQLException {
- /*
try {
assertSame(ResultSet.TYPE_SCROLL_INSENSITIVE, scrollableTarget.getFetchDirection());
} catch (SQLException e) {
//ok
}
- */
}
/**
@KnownFailure("Scrollable resultSet. Not supported")
public void testRelativeScrollableResultSet() throws SQLException {
// scrollable resultSet
- /*
try {
int initialRow = scrollableTarget.getRow();
} catch (SQLException e) {
//ok
}
- */
}
)
@KnownFailure("not supported")
public void testUpdateObjectStringObject() {
- /*
try {
writableTarget.next();
writableTarget.updateObject("family","bird");
} catch (SQLException e) {
fail("Unexpected exception: " + e.getMessage());
}
- */
}
)
@KnownFailure("Feature not supported")
public void testUpdateStringStringString() throws Exception {
- /*
try {
writableTarget.next();
writableTarget.updateString("family","bird");
} catch (SQLException e) {
//ok
}
- */
}
/**
import java.sql.SQLInput;
-/**
- * @author andrea@google.com (Your Name Here)
- *
- */
@TestTargetClass(SQLInput.class)
public class SQLInputTest extends TestCase {
try {
st = conn.createStatement();
st.execute(queries[i], Statement.NO_GENERATED_KEYS);
- fail("Exception expected: Not supported");
- /*
+
ResultSet rs = st.getGeneratedKeys();
- fail("Revise test implemenation for feature impl. has changed");
assertFalse(rs.next());
- */
+
} catch (SQLException e) {
// ok
} finally {
import java.sql.Struct;
import java.util.Map;
-/**
- * @author andrea@google.com (Your Name Here)
- *
- */
@TestTargetClass(Struct.class)
public class StructTest extends TestCase {