Skip to content

Commit

Permalink
Fix Oracle tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sualeh committed Oct 16, 2024
1 parent 9e9bc9d commit bb1a3e7
Show file tree
Hide file tree
Showing 31 changed files with 120 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@
@ResolveTestContext
public class WithoutPluginDB2Test extends BaseAdditionalDatabaseTest {

private final DockerImageName imageName =
DockerImageName.parse("icr.io/db2_community/db2");
private final DockerImageName imageName = DockerImageName.parse("icr.io/db2_community/db2");

@Container
private final JdbcDatabaseContainer<?> dbContainer =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

import java.util.Arrays;
import java.util.function.Predicate;

import schemacrawler.inclusionrule.InclusionRule;
import schemacrawler.inclusionrule.ListExclusionRule;
import schemacrawler.inclusionrule.RegularExpressionExclusionRule;
Expand Down Expand Up @@ -100,7 +99,8 @@ public final class OracleSchemaExclusionRule implements InclusionRule {
"XDB",
"XS$NULL"))
.and(new RegularExpressionExclusionRule("APEX_[0-9]{6}"))
.and(new RegularExpressionExclusionRule("FLOWS_[0-9]{5,6}"));
.and(new RegularExpressionExclusionRule("FLOWS_[0-9]{5,6}"))
.and(new RegularExpressionExclusionRule("OPS\\$ORACLE"));

/** {@inheritDoc} */
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(TABLES.OWNER, '${schema-inclusion-rule}')
AND REGEXP_LIKE(TABLES.OWNER || '.' || TABLES.TABLE_NAME, '${table-inclusion-rule}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(CONSTRAINTS.OWNER, '${schema-inclusion-rule}')
AND REGEXP_LIKE(CONSTRAINTS.OWNER || '.' || CONSTRAINTS.TABLE_NAME, '${table-inclusion-rule}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(TABLE_CONTRAINTS.OWNER, '${schema-inclusion-rule}')
AND REGEXP_LIKE(TABLE_CONTRAINTS.OWNER || '.' || TABLE_CONTRAINTS.TABLE_NAME, '${table-inclusion-rule}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(COLUMNS.OWNER, '${schema-inclusion-rule}')
AND REGEXP_LIKE(COLUMNS.OWNER || '.' || COLUMNS.TABLE_NAME, '${table-inclusion-rule}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(INDEXES.OWNER, '${schema-inclusion-rule}')
AND REGEXP_LIKE(INDEXES.OWNER || '.' || INDEXES.TABLE_NAME, '${table-inclusion-rule}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(SYNONYMS.OWNER, '${schema-inclusion-rule}')
AND SYNONYMS.TABLE_NAME NOT LIKE 'BIN$%'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ FROM
ON TABLES.OWNER = USERS.USERNAME
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(TABLES.OWNER, '${schema-inclusion-rule}')
AND REGEXP_LIKE(TABLES.OWNER || '.' || TABLES.TABLE_NAME, '${table-inclusion-rule}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(CONSTRAINTS.OWNER, '${schema-inclusion-rule}')
AND REGEXP_LIKE(CONSTRAINTS.OWNER || '.' || CONSTRAINTS.TABLE_NAME, '${table-inclusion-rule}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ WHERE
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
AND P.CONSTRAINT_TYPE IN ('P', 'U')
AND F.CONSTRAINT_TYPE = 'R'
ORDER BY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(FUNCTIONS.OWNER, '${schema-inclusion-rule}')
AND FUNCTIONS.OBJECT_TYPE = 'FUNCTION'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(COLUMNS.OWNER, '${schema-inclusion-rule}')
AND COLUMNS.OBJECT_NAME NOT LIKE 'BIN$%'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(INDEXES.OWNER, '${schema-inclusion-rule}')
AND REGEXP_LIKE(INDEXES.OWNER || '.' || INDEXES.TABLE_NAME, '${table-inclusion-rule}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(PRIMARY_KEYS.OWNER, '${schema-inclusion-rule}')
AND REGEXP_LIKE(PRIMARY_KEYS.OWNER || '.' || PRIMARY_KEYS.TABLE_NAME, '${table-inclusion-rule}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(PROCEDURES.OWNER, '${schema-inclusion-rule}')
AND PROCEDURES.OBJECT_TYPE = 'PROCEDURE'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(COLUMNS.OWNER, '${schema-inclusion-rule}')
AND COLUMNS.OBJECT_NAME NOT LIKE 'BIN$%'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(PROCEDURES.OWNER, '${schema-inclusion-rule}')
ORDER BY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(SEQUENCES.SEQUENCE_OWNER, '${schema-inclusion-rule}')
ORDER BY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(TABLES.OWNER, '${schema-inclusion-rule}')
AND REGEXP_LIKE(TABLES.OWNER || '.' || TABLES.TABLE_NAME, '${table-inclusion-rule}')
Expand All @@ -30,6 +31,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(MVIEWS.OWNER, '${schema-inclusion-rule}')
AND REGEXP_LIKE(MVIEWS.OWNER || '.' || MVIEWS.MVIEW_NAME, '${table-inclusion-rule}')
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(COLUMNS.OWNER, '${schema-inclusion-rule}')
AND REGEXP_LIKE(COLUMNS.OWNER || '.' || COLUMNS.TABLE_NAME, '${table-inclusion-rule}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(CONSTRAINTS.OWNER, '${schema-inclusion-rule}')
AND REGEXP_LIKE(CONSTRAINTS.OWNER || '.' || CONSTRAINTS.TABLE_NAME, '${table-inclusion-rule}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(TRIGGERS.OWNER, '${schema-inclusion-rule}')
AND REGEXP_LIKE(TRIGGERS.OWNER || '.' || TRIGGERS.TABLE_NAME, '${table-inclusion-rule}')
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(VIEWS.OWNER, '${schema-inclusion-rule}')
AND REGEXP_LIKE(VIEWS.OWNER || '.' || VIEWS.VIEW_NAME, '${table-inclusion-rule}')
Expand All @@ -32,6 +33,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
REGEXP_LIKE(MVIEWS.OWNER, '${schema-inclusion-rule}')
AND REGEXP_LIKE(MVIEWS.OWNER || '.' || MVIEWS.MVIEW_NAME, '${table-inclusion-rule}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ FROM
AND USERS.ORACLE_MAINTAINED = 'N'
AND NOT REGEXP_LIKE(USERS.USERNAME, '^APEX_[0-9]{6}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^FLOWS_[0-9]{5}$')
AND NOT REGEXP_LIKE(USERS.USERNAME, '^OPS\$ORACLE$')
WHERE
VIEW_TABLE_USAGE.TYPE = 'VIEW'
AND REGEXP_LIKE(VIEW_TABLE_USAGE.OWNER, '${schema-inclusion-rule}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void testOracleSelectCatalogRoleUser() throws Exception {
DatabaseConnectionSources.fromDataSource(catalogUserDataSource);
final String expectedResource =
String.format("testOracleSelectCatalogRoleUser.%s.txt", javaVersion());
testOracleWithConnection(dataSource, expectedResource, 34, true);
testOracleWithConnection(dataSource, expectedResource, 33, true);

final DatabaseAccessException sqlException =
assertThrows(
Expand Down Expand Up @@ -127,7 +127,7 @@ public void testOracleWithNoAccessUser() throws Exception {
DatabaseConnectionSources.fromDataSource(noAccessUserDataSource);
final String expectedResource =
String.format("testOracleWithNoAccessUser.%s.txt", javaVersion());
testOracleWithConnection(dataSource, expectedResource, 34, false);
testOracleWithConnection(dataSource, expectedResource, 33, false);

final DatabaseAccessException sqlException =
assertThrows(
Expand All @@ -151,7 +151,7 @@ public void testOracleWithSchemaOwnerUser() throws Exception {
DatabaseConnectionSources.fromDataSource(schemaOwnerUserDataSource);
final String expectedResource =
String.format("testOracleWithSchemaOwnerUser.%s.txt", javaVersion());
testOracleWithConnection(dataSource, expectedResource, 34, true);
testOracleWithConnection(dataSource, expectedResource, 33, true);

testSelectQuery(dataSource, "testOracleWithConnectionQuery.txt");

Expand All @@ -169,7 +169,7 @@ public void testOracleWithSelectGrantUser() throws Exception {

final String expectedResource =
String.format("testOracleWithSelectGrantUser.%s.txt", javaVersion());
testOracleWithConnection(dataSource, expectedResource, 34, true);
testOracleWithConnection(dataSource, expectedResource, 33, true);

testSelectQuery(dataSource, "testOracleWithConnectionQuery.txt");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void testOracleWithConnection() throws Exception {
final DatabaseConnectionSource dataSource = getDataSource();

final String expectedResource = String.format("testOracleWithConnection.%s.txt", javaVersion());
testOracleWithConnection(dataSource, expectedResource, 34, false);
testOracleWithConnection(dataSource, expectedResource, 33, false);

testSelectQuery(dataSource, "testOracleWithConnectionQuery.txt");
}
Expand Down
Loading

0 comments on commit bb1a3e7

Please sign in to comment.