use of dalvik.annotation.KnownFailure in project robovm by robovm.
the class SSLEngineTest method test_unwrap_03.
/**
* javax.net.ssl.SSLEngine#unwrap(ByteBuffer src, ByteBuffer[] dsts,
* int offset, int length)
* Exception case: ReadOnlyBufferException should be thrown.
*/
@KnownFailure("Fixed on DonutBurger, Wrong Exception thrown")
public void test_unwrap_03() {
String host = "new host";
int port = 8080;
ByteBuffer bbR = ByteBuffer.allocate(100).asReadOnlyBuffer();
ByteBuffer[] bbA = { bbR, ByteBuffer.allocate(10), ByteBuffer.allocate(100) };
ByteBuffer bb = ByteBuffer.allocate(10);
SSLEngine sse = getEngine(host, port);
sse.setUseClientMode(true);
try {
sse.unwrap(bb, bbA, 0, bbA.length);
fail("ReadOnlyBufferException wasn't thrown");
} catch (ReadOnlyBufferException iobe) {
//expected
} catch (Exception e) {
fail(e + " was thrown instead of ReadOnlyBufferException");
}
}
use of dalvik.annotation.KnownFailure in project robovm by robovm.
the class SelectFunctionalityTest method test_SelectRightOuterJoin.
/**
* SelectFunctionalityTest#test_SelectRightOuterJoin(). Selects
* records from a table using right join
*
* TODO RIGHT and FULL OUTER JOINs are not supported
*/
@KnownFailure("not supported")
public void test_SelectRightOuterJoin() throws SQLException {
String sql = "SELECT distinct s.snum as ssnum, c.snum as ccnum FROM " + DatabaseCreator.CUSTOMERS_TABLE + " c right outer join " + DatabaseCreator.SALESPEOPLE_TABLE + " s on s.snum=c.snum";
ResultSet result = statement.executeQuery(sql);
HashMap<Integer, Integer> value = new HashMap<Integer, Integer>();
value.put(1001, 1001);
value.put(1002, 1002);
value.put(1003, 1003);
value.put(1004, 1004);
value.put(1007, 1007);
value.put(1013, null);
while (result.next()) {
int key = result.getInt("ssnum");
Object val = result.getObject("ccnum");
assertTrue("wrong value of ssnum field", value.containsKey(key));
assertEquals("wrong value of ccnum field", value.get(key), (Integer) val);
value.remove(key);
}
assertTrue("expected rows number doesn't equal actual rows number", value.isEmpty());
result.close();
}
use of dalvik.annotation.KnownFailure in project robovm by robovm.
the class DatabaseMetaDataNotSupportedTest method test_getIndexInfoLjava_lang_StringLjava_lang_StringLjava_lang_StringZZ.
@KnownFailure("not supported")
public void test_getIndexInfoLjava_lang_StringLjava_lang_StringLjava_lang_StringZZ() throws SQLException {
boolean unique = false;
ResultSet rs = meta.getIndexInfo(conn.getCatalog(), null, DatabaseCreator.TEST_TABLE1, unique, true);
ResultSetMetaData rsmd = rs.getMetaData();
assertTrue("Rows do not obtained", rs.next());
int col = rsmd.getColumnCount();
assertEquals("Incorrect number of columns", 13, col);
String[] columnNames = { "TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "NON_UNIQUE", "INDEX_QUALIFIER", "INDEX_NAME", "TYPE", "ORDINAL_POSITION", "COLUMN_NAME", "ASC_OR_DESC", "CARDINALITY", "PAGES", "FILTER_CONDITION" };
for (int c = 1; c <= col; ++c) {
assertEquals("Incorrect column name", columnNames[c - 1], rsmd.getColumnName(c));
}
assertEquals("Incorrect table catalog", conn.getCatalog(), rs.getString("TABLE_CAT"));
assertEquals("Incorrect table schema", null, rs.getString("TABLE_SCHEM"));
assertEquals("Incorrect table name", DatabaseCreator.TEST_TABLE1, rs.getString("TABLE_NAME"));
assertEquals("Incorrect state of uniquess", unique, rs.getBoolean("NON_UNIQUE"));
assertEquals("Incorrect index catalog", "", rs.getString("INDEX_QUALIFIER"));
assertEquals("Incorrect index name", "primary", rs.getString("INDEX_NAME").toLowerCase());
assertEquals("Incorrect index type", DatabaseMetaData.tableIndexOther, rs.getShort("TYPE"));
assertEquals("Incorrect column sequence number within index", 1, rs.getShort("ORDINAL_POSITION"));
assertEquals("Incorrect column name", "id", rs.getString("COLUMN_NAME"));
assertEquals("Incorrect column sort sequence", "a", rs.getString("ASC_OR_DESC").toLowerCase());
assertEquals("Incorrect cardinality", 1, rs.getInt("CARDINALITY"));
assertEquals("Incorrect value of pages", 0, rs.getInt("PAGES"));
assertEquals("Incorrect filter condition", null, rs.getString("FILTER_CONDITION"));
rs.close();
}
use of dalvik.annotation.KnownFailure in project robovm by robovm.
the class DatabaseMetaDataNotSupportedTest method test_getTablePrivilegesLjava_lang_StringLjava_lang_StringLjava_lang_String.
@KnownFailure("not supported. Privileges are not supported.")
public void test_getTablePrivilegesLjava_lang_StringLjava_lang_StringLjava_lang_String() throws SQLException {
// case 1. Get privileges when no privilegies exist for one table
ResultSet privileges = meta.getTablePrivileges(conn.getCatalog(), "%", DatabaseCreator.TEST_TABLE3);
assertFalse("Some privilegies exist", privileges.next());
privileges.close();
// case 2. Get privileges when no privilegies exist for all tables
privileges = meta.getTablePrivileges(null, null, null);
assertFalse("Some privilegies exist", privileges.next());
privileges.close();
// case 3. grant CREATE and SELECT privileges ang get them
HashSet<String> expectedPrivs = new HashSet<String>();
expectedPrivs.add("CREATE");
expectedPrivs.add("SELECT");
String query = "GRANT CREATE, SELECT ON " + DatabaseCreator.TEST_TABLE3 + " TO " + Support_SQL.sqlUser;
statement.execute(query);
privileges = meta.getTablePrivileges(conn.getCatalog(), null, DatabaseCreator.TEST_TABLE3);
while (privileges.next()) {
assertEquals("Wrong catalog name", Support_SQL.sqlCatalog, privileges.getString("TABLE_CAT"));
assertNull("Wrong schema", privileges.getString("TABLE_SCHEM"));
assertEquals("Wrong table name", DatabaseCreator.TEST_TABLE3, privileges.getString("TABLE_NAME"));
assertTrue("Wrong privilege " + privileges.getString("PRIVILEGE"), expectedPrivs.remove(privileges.getString("PRIVILEGE")));
assertEquals("Wrong grantor", Support_SQL.sqlLogin + "@" + Support_SQL.sqlHost, privileges.getString("GRANTOR"));
assertEquals("Wrong grantee", Support_SQL.sqlUser + "@%", privileges.getString("GRANTEE"));
assertNull("Wrong value of IS_GRANTABLE", privileges.getString("IS_GRANTABLE"));
}
privileges.close();
assertTrue("Wrong privileges were returned", expectedPrivs.isEmpty());
query = "REVOKE CREATE, SELECT ON " + DatabaseCreator.TEST_TABLE3 + " FROM " + Support_SQL.sqlUser;
statement.execute(query);
// case 4. grant all privileges ang get them
String[] privs = new String[] { "ALTER", "CREATE", "CREATE VIEW", "DELETE", "DROP", "INDEX", "INSERT", "REFERENCES", "SELECT", "SHOW VIEW", "UPDATE" };
expectedPrivs = new HashSet<String>();
for (int i = 0; i < privs.length; i++) {
expectedPrivs.add(privs[i]);
}
query = "GRANT ALL ON " + DatabaseCreator.TEST_TABLE3 + " TO " + Support_SQL.sqlUser;
statement.execute(query);
privileges = meta.getTablePrivileges(conn.getCatalog(), null, DatabaseCreator.TEST_TABLE3);
while (privileges.next()) {
assertEquals("Wrong catalog name", Support_SQL.sqlCatalog, privileges.getString("TABLE_CAT"));
assertNull("Wrong schema", privileges.getString("TABLE_SCHEM"));
assertEquals("Wrong table name", DatabaseCreator.TEST_TABLE3, privileges.getString("TABLE_NAME"));
assertTrue("Wrong privilege " + privileges.getString("PRIVILEGE"), expectedPrivs.remove(privileges.getString("PRIVILEGE")));
assertEquals("Wrong grantor", Support_SQL.sqlLogin + "@" + Support_SQL.sqlHost, privileges.getString("GRANTOR"));
assertEquals("Wrong grantee", Support_SQL.sqlUser + "@%", privileges.getString("GRANTEE"));
assertNull("Wrong value of IS_GRANTABLE", privileges.getString("IS_GRANTABLE"));
}
privileges.close();
assertTrue("Wrong privileges were returned", expectedPrivs.isEmpty());
query = "REVOKE ALL ON " + DatabaseCreator.TEST_TABLE3 + " FROM " + Support_SQL.sqlUser;
statement.execute(query);
// case 5. check no privelegies after revoke
privileges = meta.getTablePrivileges(conn.getCatalog(), "%", DatabaseCreator.TEST_TABLE3);
assertFalse("Some privilegies exist", privileges.next());
privileges.close();
privileges = meta.getTablePrivileges(null, null, null);
assertFalse("Some privilegies exist", privileges.next());
privileges.close();
}
use of dalvik.annotation.KnownFailure in project robovm by robovm.
the class DatabaseMetaDataNotSupportedTest method test_allTablesAreSelectable.
@KnownFailure("Not supported ops applied")
public void test_allTablesAreSelectable() throws SQLException {
// grant SELECT privileges
String query = "GRANT CREATE, SELECT ON " + DatabaseCreator.TEST_TABLE1 + " TO " + Support_SQL.sqlUser;
statement.execute(query);
Connection userConn = Support_SQL.getConnection(Support_SQL.sqlUrl, Support_SQL.sqlUser, Support_SQL.sqlUser);
DatabaseMetaData userMeta = userConn.getMetaData();
ResultSet userTab = userMeta.getTables(null, null, null, null);
assertTrue("Tables are not obtained", userTab.next());
assertEquals("Incorrect name of obtained table", DatabaseCreator.TEST_TABLE1.toLowerCase(), userTab.getString("TABLE_NAME").toLowerCase());
assertTrue("Not all of obtained tables are selectable", userMeta.allTablesAreSelectable());
userTab.close();
// revoke SELECT privileges
query = "REVOKE SELECT ON " + DatabaseCreator.TEST_TABLE1 + " FROM " + Support_SQL.sqlUser;
statement.execute(query);
userTab = userMeta.getTables(null, null, null, null);
assertTrue("Tables are not obtained", userTab.next());
assertEquals("Incorrect name of obtained table", DatabaseCreator.TEST_TABLE1.toLowerCase(), userTab.getString("TABLE_NAME").toLowerCase());
assertFalse("No SELECT privileges", userMeta.allTablesAreSelectable());
userTab.close();
// revoke CREATE privileges
query = "REVOKE CREATE ON " + DatabaseCreator.TEST_TABLE1 + " FROM " + Support_SQL.sqlUser;
statement.execute(query);
userConn.close();
}
Aggregations