Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/test/java/com/jayant/JDBCDriverComparisonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private static Stream<Arguments> withResultSetPairs(Stream<Arguments> baseProvid
return combined.stream();
}

@ParameterizedTest
@ParameterizedTest(autoCloseArguments = false)
@MethodSource("provideSQLQueries")
@DisplayName("Compare SQL Query Results")
void compareSQLQueryResults(
Expand All @@ -197,7 +197,7 @@ void compareSQLQueryResults(
});
}

@ParameterizedTest
@ParameterizedTest(autoCloseArguments = false)
@MethodSource("provideMetadataMethods")
@DisplayName("Compare Metadata API Results")
void compareMetadataResults(
Expand Down Expand Up @@ -227,7 +227,7 @@ void compareMetadataResults(
});
}

@ParameterizedTest
@ParameterizedTest(autoCloseArguments = false)
@MethodSource("provideResultSetMethods")
@DisplayName("Compare ResultSet API Results")
void compareResultSetResults(
Expand All @@ -254,7 +254,7 @@ void compareResultSetResults(
});
}

@ParameterizedTest
@ParameterizedTest(autoCloseArguments = false)
@MethodSource("provideResultSetMetaDataMethods")
@DisplayName("Compare ResultSetMetaData API Results")
void compareResultSetMetaDataResults(
Expand Down Expand Up @@ -283,7 +283,7 @@ void compareResultSetMetaDataResults(
});
}

@ParameterizedTest
@ParameterizedTest(autoCloseArguments = false)
@MethodSource("provideConnectionMethods")
@DisplayName("Compare Connection API Results")
void compareConnectionResults(
Expand Down
12 changes: 8 additions & 4 deletions src/test/java/com/jayant/ResultSetComparator.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ public static ComparisonResult compare(
if (result1 instanceof ResultSet && result2 instanceof ResultSet) {
ResultSet rs1 = (ResultSet) result1;
ResultSet rs2 = (ResultSet) result2;
// Compare metadata
result.metadataDifferences = compareMetadata(rs1.getMetaData(), rs2.getMetaData());
try {
// Compare metadata
result.metadataDifferences = compareMetadata(rs1.getMetaData(), rs2.getMetaData());

// Compare data
result.dataDifferences = compareData(rs1, rs2);
// Compare data
result.dataDifferences = compareData(rs1, rs2);
} catch (SQLException e) {
result.dataDifferences.add("ResultSet iteration error: " + e.getMessage());
}
} else if (!(result1 instanceof ResultSet) && !(result2 instanceof ResultSet)) {
// Both are not of type ResultSet
if (result1 == null || !resultIsSame(result1, result2)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,87 @@ public Map<Map.Entry<String, Integer>, Set<Object[]>> getFunctionToArgsMap() {
Map.entry("getAttributes", 4),
new String[] {"main", "tpcds_sf100_delta", "%", "%"});

// Cross-catalog tests: null catalog (match all catalogs)
putInMapForKey(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets also add some more combinations, like tableType being TABLE, VIEW apart from null

Also, schema can be pattern, schema can be null

also, table can be null

functionToArgsMap,
Map.entry("getTables", 4),
new String[] {null, "tpcds_sf100_delta", "%", null});
putInMapForKey(
functionToArgsMap,
Map.entry("getTablePrivileges", 3),
new String[] {null, "tpcds_sf100_delta", "%"});
putInMapForKey(functionToArgsMap, Map.entry("getSchemas", 2), new String[] {null, "tpcds_%"});
putInMapForKey(
functionToArgsMap,
Map.entry("getColumns", 4),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly more combination here as well

new String[] {null, "tpcds_sf100_delta", "catalog_sales", "%"});
putInMapForKey(
functionToArgsMap,
Map.entry("getPseudoColumns", 4),
new String[] {null, "tpcds_sf100_delta", "catalog_sales", "%"});
putInMapForKey(
functionToArgsMap,
Map.entry("getColumnPrivileges", 4),
new String[] {null, "tpcds_sf100_delta", "catalog_sales", "%"});
putInMapForKey(
functionToArgsMap,
Map.entry("getVersionColumns", 3),
new String[] {null, "tpcds_sf100_delta", "catalog_sales"});
putInMapForKey(
functionToArgsMap,
Map.entry("getFunctions", 3),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here also

new String[] {null, "tpcds_sf100_delta", "aggregate"});
putInMapForKey(
functionToArgsMap,
Map.entry("getFunctionColumns", 4),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we support this?

new String[] {null, "tpcds_sf100_delta", "aggregate", "%"});
putInMapForKey(
functionToArgsMap,
Map.entry("getProcedures", 3),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here also more combination on schema being null, pattern

new String[] {null, "tpcds_sf100_delta", "%"});
putInMapForKey(
functionToArgsMap,
Map.entry("getProcedureColumns", 4),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here also

new String[] {null, "tpcds_sf100_delta", "%", "%"});
putInMapForKey(
functionToArgsMap,
Map.entry("getPrimaryKeys", 3),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we support null catalog here? Or just to compare results for null

new String[] {null, "oss_jdbc_tests", "test_result_set_types"});
putInMapForKey(
functionToArgsMap,
Map.entry("getImportedKeys", 3),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment

new String[] {null, "tpcds_sf100_delta", "catalog_sales"});
putInMapForKey(
functionToArgsMap,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is empty and null anyways is not supported, what is goal, you can add a comment on what you are testing here

Map.entry("getExportedKeys", 3),
new String[] {null, "tpcds_sf100_delta", "catalog_sales"});
putInMapForKey(
functionToArgsMap,
Map.entry("getCrossReference", 6),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

new String[] {
null, "tpcds_sf100_delta", "catalog_sales", null, "tpcds_sf100_delta", "catalog_sales"
});
putInMapForKey(
functionToArgsMap,
Map.entry("getIndexInfo", 5),
new Object[] {null, "tpcds_sf100_delta", "catalog_sales", true, false});
putInMapForKey(
functionToArgsMap,
Map.entry("getUDTs", 4),
new String[] {null, "tpcds_sf100_delta", "%", null});
putInMapForKey(
functionToArgsMap,
Map.entry("getSuperTypes", 3),
new String[] {null, "tpcds_sf100_delta", "%"});
putInMapForKey(
functionToArgsMap,
Map.entry("getSuperTables", 3),
new String[] {null, "tpcds_sf100_delta", "catalog_sales"});
putInMapForKey(
functionToArgsMap,
Map.entry("getAttributes", 4),
new String[] {null, "tpcds_sf100_delta", "%", "%"});

// Methods for ResultSet concurrency and visibility
for (Integer type : getResultSetTypes()) {
putInMapForKey(
Expand Down Expand Up @@ -129,6 +210,11 @@ public Map<Map.Entry<String, Integer>, Set<Object[]>> getFunctionToArgsMap() {
functionToArgsMap,
Map.entry("getBestRowIdentifier", 5),
new Object[] {"main", "tpcds_sf100_delta", "catalog_sales", i, true});
// Cross-catalog: null catalog
putInMapForKey(
functionToArgsMap,
Map.entry("getBestRowIdentifier", 5),
new Object[] {null, "tpcds_sf100_delta", "catalog_sales", i, true});
}
for (Integer i : getResultSetHoldability()) {
putInMapForKey(
Expand Down
Loading