Skip to content

[Retire FX] Port functional test scenarios for globalization - #2924

Merged
Muskan Gupta (muskan124947) merged 4 commits into
mainfrom
users/muskgupta/globalization_FxTest
Apr 2, 2026
Merged

[Retire FX] Port functional test scenarios for globalization#2924
Muskan Gupta (muskan124947) merged 4 commits into
mainfrom
users/muskgupta/globalization_FxTest

Conversation

@muskan124947

@muskan124947 Muskan Gupta (muskan124947) commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Migrate FX Globalization Tests to JUnit 5

Migrates the legacy FX globalization test cases to JUnit 5 parameterized tests in a new globalization/ package under src/test/java/com/microsoft/sqlserver/jdbc/.

Files Added

File Description
GlobalizationTestData.java Shared constants, enums (SendMethod, ReceiveMethod, CharacterType, CharacterPosition), language samples, collations, and @MethodSource providers
GlobalizationCollationTest.java Collation round-trip, MBCS conversion, _SC collations, Turkish CP1254
GlobalizationLocaleTest.java Unicode identifiers in queries, case sensitivity, Calendar with locales, getString across JVM locales
GlobalizationUTF16Test.java UTF-16 round-trip with 15 send × 18 receive methods × 4 char types × 2 positions (pairwise coverage)

FX Test Case Mapping

FX Test Case New Test Method File
TCCollations.testSetters + testGetters testCollationSetterAndGetter GlobalizationCollationTest
TCServerCollations.test1 testServerCollationRoundTrip GlobalizationCollationTest
TCServerCollations.test2 (VSTS #234287) testTurkishCP1254Character GlobalizationCollationTest
TCCollations (extended) testCollationColumnSizes GlobalizationCollationTest
TCQueries.test1 testGlobalizedIdentifiers GlobalizationLocaleTest
TCQueries.test2 testPureUnicodeLiteral GlobalizationLocaleTest
TCCaseSensitivity.test1 testCaseSensitivity GlobalizationLocaleTest
TCCalendar.test1 testCalendarLocale GlobalizationLocaleTest
TCCalendar.test2 testCalendarOutputParams GlobalizationLocaleTest
TCLocales.test testGetStringWithLocale GlobalizationLocaleTest
TCDenaliUTF16 (VSTS #765740) testUTF16RoundTrip GlobalizationUTF16Test

Test Scenario Counts

File Test Method Scenarios Source
GlobalizationCollationTest testCollationSetterAndGetter 20 10 languages × 2 SSPAU values
testServerCollationRoundTrip ~800+ Dynamic — all _SC collations from sys.fn_helpcollations()
testTurkishCP1254Character 1 Single @Test
testCollationColumnSizes 10 10 languages × 3 sizes (loop inside)
GlobalizationLocaleTest testGlobalizedIdentifiers 9 10 languages minus Arabic (RTL)
testPureUnicodeLiteral 9 Same provider as above
testCaseSensitivity 3 English, German, Russian (×4 variations internally)
testCalendarLocale 20 10 locales × 2 SQL types (TIME, DATETIME2)
testCalendarOutputParams 20 10 locales × 2 SQL types (TIME, DATETIME2)
testGetStringWithLocale ~160+ All JVM Locale.getAvailableLocales()
GlobalizationUTF16Test testUTF16RoundTrip 30 18 pairwise + 12 extra per CharacterType
Total ~1,080+

Languages Covered (10)

English, German, Breton, Turkish, Russian, Arabic, Japanese, Chinese (China), Chinese (Taiwan), Chinese (Hong Kong)

Excluded Parameters (by design)

Excluded Reason
Bashkir, Uighur languages Extended Cyrillic/Arabic characters outside their collation's code page cause lossy ? substitution in VARCHAR — not a driver bug
DATE type in Calendar output param tests Date.valueOf() creates millis in JVM timezone; GMT Calendar reinterpretation shifts the date when JVM is not UTC — timezone-sensitive, not a driver bug
Turkish in case sensitivity tests Driver's findColumn uses Java standard case-folding which doesn't implement Turkish-I rules (known FX BUG 402731)
ASCII stream send methods (3 removed) setAsciiStream/updateAsciiStream encode as US-ASCII (7-bit) — non-ASCII characters (BMP, SURROGATE, COMBINING) are inherently lossy, not valid for UTF-16 round-trip testing

Resource Cleanup

  • Each test cleans up its own tables/procs in finally blocks
  • GlobalizationCollationTest tracks created databases in a safety-net list with @AfterAll cleanup
  • GlobalizationLocaleTest uses null-safe @AfterAll with connection.isClosed() check
  • All finally blocks include catch clauses for best-effort cleanup

@muskan124947
Muskan Gupta (muskan124947) requested review from Copilot and removed request for Copilot March 26, 2026 09:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Ports legacy FX globalization functional scenarios into the JUnit test suite to validate Unicode/UTF-16 round-trips, locale/calendar behavior, and collation handling in the JDBC driver.

Changes:

  • Added UTF-16 round-trip parameterized test coverage across multiple JDBC send/receive APIs.
  • Added locale/query/case-sensitivity/calendar globalization tests and shared test-data providers.
  • Added collation-focused tests including per-collation DB creation scenarios and server-collation discovery.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 14 comments.

File Description
src/test/java/com/microsoft/sqlserver/jdbc/globalization/GlobalizationUTF16Test.java New UTF-16 round-trip test exercising multiple setter/getter paths.
src/test/java/com/microsoft/sqlserver/jdbc/globalization/GlobalizationTestData.java New shared globalization datasets + parameter sources for the new tests.
src/test/java/com/microsoft/sqlserver/jdbc/globalization/GlobalizationLocaleTest.java New tests for Unicode identifiers, locale invariance, case sensitivity, and Calendar-based temporal access.
src/test/java/com/microsoft/sqlserver/jdbc/globalization/GlobalizationCollationTest.java New collation coverage including DB-collation creation, _SC collation discovery, and Turkish CP1254 scenario.

@codecov

codecov Bot commented Mar 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.70%. Comparing base (0bdf85b) to head (13daf39).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2924      +/-   ##
============================================
- Coverage     60.71%   60.70%   -0.02%     
+ Complexity     4953     4932      -21     
============================================
  Files           151      151              
  Lines         35022    35022              
  Branches       5856     5856              
============================================
- Hits          21265    21261       -4     
+ Misses        10953    10949       -4     
- Partials       2804     2812       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@muskan124947
Muskan Gupta (muskan124947) merged commit 02f617b into main Apr 2, 2026
18 of 19 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Closed/Merged PRs in MSSQL JDBC Apr 2, 2026
@muskan124947 Muskan Gupta (muskan124947) added this to the 13.5.1 milestone Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed/Merged PRs

Development

Successfully merging this pull request may close these issues.

4 participants