Skip to content

Commit

Permalink
Corrected test for internal testing (#2473)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkyc authored Jul 8, 2024
1 parent e9b1fec commit 6b1c463
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,15 @@ public void testSqlServerBulkCopyCachingConnectionLevel() throws Exception {
stmt.execute(createSqlTable1);
stmt.execute(createSqlTable2);

Field bulkcopyMetadataCacheField = TestUtils.getJVMVersion() > 8 ?
con.getClass().getSuperclass().getDeclaredField("BULK_COPY_OPERATION_CACHE") :
con.getClass().getDeclaredField("BULK_COPY_OPERATION_CACHE");
Field bulkcopyMetadataCacheField;

if (con.getClass().getName().equals("com.microsoft.sqlserver.jdbc.SQLServerConnection43")) {
bulkcopyMetadataCacheField = con.getClass().getSuperclass()
.getDeclaredField("BULK_COPY_OPERATION_CACHE");
} else {
bulkcopyMetadataCacheField = con.getClass().getDeclaredField("BULK_COPY_OPERATION_CACHE");
}

bulkcopyMetadataCacheField.setAccessible(true);
Object bulkcopyCache = bulkcopyMetadataCacheField.get(con);

Expand Down

0 comments on commit 6b1c463

Please sign in to comment.