Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-jf committed Feb 15, 2024
1 parent 327d802 commit e4a9160
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1710,6 +1710,7 @@ public void testNoPatternSearchAllowedForPrimaryAndForeignKeys() throws SQLExcep

String database = connection.getCatalog();
String schema = connection.getSchema();
String schemaPattern = schema.substring(0,1).concat("%");
final String table1 = "T1";
final String table2 = "T2";

Expand All @@ -1731,7 +1732,7 @@ public void testNoPatternSearchAllowedForPrimaryAndForeignKeys() throws SQLExcep
assertEquals(1, getSizeOfResultSet(dbmd.getPrimaryKeys(database, schema, table1)));

// Should return an empty result if we try a pattern match on the schema
assertEquals(0, getSizeOfResultSet(dbmd.getPrimaryKeys(database, "TEST%", table1)));
assertEquals(0, getSizeOfResultSet(dbmd.getPrimaryKeys(database, schemaPattern, table1)));

// Should return an empty result if we try a pattern match on the table name
assertEquals(0, getSizeOfResultSet(dbmd.getPrimaryKeys(database, null, "T%")));
Expand All @@ -1740,7 +1741,7 @@ public void testNoPatternSearchAllowedForPrimaryAndForeignKeys() throws SQLExcep
assertEquals(1, getSizeOfResultSet(dbmd.getImportedKeys(database, schema, table2)));

// Should return an empty result if we try a pattern match on the schema
assertEquals(0, getSizeOfResultSet(dbmd.getImportedKeys(database, "TEST%", table2)));
assertEquals(0, getSizeOfResultSet(dbmd.getImportedKeys(database, schemaPattern, table2)));

// Should return an empty result if we try a pattern match on the table name
assertEquals(0, getSizeOfResultSet(dbmd.getImportedKeys(database, null, "T%")));
Expand All @@ -1749,7 +1750,7 @@ public void testNoPatternSearchAllowedForPrimaryAndForeignKeys() throws SQLExcep
assertEquals(1, getSizeOfResultSet(dbmd.getExportedKeys(database, schema, table1)));

// Should return an empty result if we try a pattern match on the schema
assertEquals(0, getSizeOfResultSet(dbmd.getExportedKeys(database, "TEST%", table1)));
assertEquals(0, getSizeOfResultSet(dbmd.getExportedKeys(database, schemaPattern, table1)));

// Should return an empty result if we try a pattern match on the table name
assertEquals(0, getSizeOfResultSet(dbmd.getExportedKeys(database, null, "T%")));
Expand All @@ -1764,11 +1765,11 @@ public void testNoPatternSearchAllowedForPrimaryAndForeignKeys() throws SQLExcep
assertEquals(
0,
getSizeOfResultSet(
dbmd.getCrossReference(database, "TEST%", table1, database, schema, table2)));
dbmd.getCrossReference(database, schemaPattern, table1, database, schema, table2)));
assertEquals(
0,
getSizeOfResultSet(
dbmd.getCrossReference(database, schema, table1, database, "TEST%", table2)));
dbmd.getCrossReference(database, schema, table1, database, schemaPattern, table2)));
assertEquals(
0,
getSizeOfResultSet(dbmd.getCrossReference(database, null, "T%", database, schema, table2)));
Expand All @@ -1792,6 +1793,7 @@ public void testPatternSearchAllowedForPrimaryAndForeignKeys() throws SQLExcepti

String database = connection.getCatalog();
String schema = connection.getSchema();
String schemaPattern = schema.substring(0,1).concat("%");
final String table1 = "T1";
final String table2 = "T2";

Expand All @@ -1813,7 +1815,7 @@ public void testPatternSearchAllowedForPrimaryAndForeignKeys() throws SQLExcepti
assertEquals(1, getSizeOfResultSet(dbmd.getPrimaryKeys(database, schema, table1)));

// Should return a result if we try a pattern match on the schema
assertEquals(1, getSizeOfResultSet(dbmd.getPrimaryKeys(database, "TEST%", table1)));
assertEquals(1, getSizeOfResultSet(dbmd.getPrimaryKeys(database, schemaPattern, table1)));

// Should return a result if we try a pattern match on the table name
assertEquals(2, getSizeOfResultSet(dbmd.getPrimaryKeys(database, null, "T%")));
Expand All @@ -1822,7 +1824,7 @@ public void testPatternSearchAllowedForPrimaryAndForeignKeys() throws SQLExcepti
assertEquals(1, getSizeOfResultSet(dbmd.getImportedKeys(database, schema, table2)));

// Should return a result if we try a pattern match on the schema
assertEquals(1, getSizeOfResultSet(dbmd.getImportedKeys(database, "TEST%", table2)));
assertEquals(1, getSizeOfResultSet(dbmd.getImportedKeys(database, schemaPattern, table2)));

// Should return a result if we try a pattern match on the table name
assertEquals(1, getSizeOfResultSet(dbmd.getImportedKeys(database, null, "T%")));
Expand All @@ -1831,7 +1833,7 @@ public void testPatternSearchAllowedForPrimaryAndForeignKeys() throws SQLExcepti
assertEquals(1, getSizeOfResultSet(dbmd.getExportedKeys(database, schema, table1)));

// Should return a result if we try a pattern match on the schema
assertEquals(1, getSizeOfResultSet(dbmd.getExportedKeys(database, "TEST%", table1)));
assertEquals(1, getSizeOfResultSet(dbmd.getExportedKeys(database, schemaPattern, table1)));

// Should return a result if we try a pattern match on the table name
assertEquals(1, getSizeOfResultSet(dbmd.getExportedKeys(database, null, "T%")));
Expand All @@ -1846,11 +1848,11 @@ public void testPatternSearchAllowedForPrimaryAndForeignKeys() throws SQLExcepti
assertEquals(
1,
getSizeOfResultSet(
dbmd.getCrossReference(database, "TEST%", table1, database, schema, table2)));
dbmd.getCrossReference(database, schemaPattern, table1, database, schema, table2)));
assertEquals(
1,
getSizeOfResultSet(
dbmd.getCrossReference(database, schema, table1, database, "TEST%", table2)));
dbmd.getCrossReference(database, schema, table1, database, schemaPattern, table2)));
assertEquals(
1,
getSizeOfResultSet(dbmd.getCrossReference(database, null, "T%", database, schema, table2)));
Expand Down

0 comments on commit e4a9160

Please sign in to comment.