BrandaoFelipe opened a new pull request, #10573:
URL: https://github.com/apache/seatunnel/pull/10573

   ### Purpose of this pull request
   
   This PR enhances the unit test coverage for SQL Server in the 
`connector-jdbc` module by introducing Testcontainers-based integration tests, 
aligning with the objectives outlined in issue #10214.
   
   **Key Improvements:**
   
   - **Containerized Testing Infrastructure**
     - Created `AbstractSqlServerContainerTest` base class that manages a SQL 
Server 2022 container lifecycle using Testcontainers
     - Tests now run against a real SQL Server instance in Docker, eliminating 
reliance on local environment setup
     - Container starts once per test suite (`@BeforeAll`/`@AfterAll`) for 
efficiency
   
   - **Comprehensive Catalog Tests (`SqlServerCatalogTest`)**
     - **Data Type Mapping**: Validates correct mapping of 25+ SQL Server data 
types to SeaTunnel types including numeric types (INT, BIGINT, DECIMAL, 
NUMERIC), string types (VARCHAR, NVARCHAR, TEXT, CHAR, NCHAR), date/time types 
(DATE, DATETIME, DATETIME2, DATETIMEOFFSET, TIME), binary types (VARBINARY, 
BINARY), and special types (UNIQUEIDENTIFIER, XML, BIT)
     - **Index and Constraint Testing**: Verifies proper detection and mapping 
of Primary Keys, regular indexes, unique indexes, and composite indexes
     - **Comment Preservation**: Tests that column comments with special 
characters are correctly preserved
     - **Save Mode Operations**: Validates CREATE, TRUNCATE, DROP operations
     - **Secondary Database Operations**: Tests database creation and deletion
     - **Data Round-trip**: Inserts and verifies data for all data types
   
   - **Comprehensive Dialect Tests (`SqlServerDialectContainerTest`)**
     - **UPSERT Statement**: Validates MERGE syntax generation
     - **CRUD Operations**: Tests INSERT, UPDATE, DELETE statement generation
     - **Row Existence**: Verifies `SELECT 1 FROM` syntax with named parameters
     - **Identifier Quoting**: Ensures proper bracket quoting `[identifier]`
     - **Table Path Parsing**: Tests parsing of different table path formats
     - **Prepared Statement Creation**: Validates fetch size configuration
     - **Column Existence Check**: Tests metadata queries
   
   - **URL Handling Enhancement**
     - Fixed `JdbcUrlUtil` to properly parse SQL Server connection URLs with 
parameters (e.g., `jdbc:sqlserver://host:port;encrypt=false`)
     - Added special handling for SQL Server URL format in `getJdbcUrlInfo()`
   
   **Test Coverage Added:**
   - 15+ new test methods covering catalog operations
   - 10+ new test methods covering dialect operations
   - Edge cases including special characters in comments
   - Complex data type scenarios
   - Index and constraint validations
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. This is a **test-only change**. It does not affect any user-facing 
functionality, APIs, or documentation.
   
   ### How was this patch tested?
   
   - **All 25+ SQL Server tests pass locally:**
     - `SqlServerCatalogTest` (15+ tests)
     - `SqlServerDialectContainerTest` (10+ tests)
   - **Java 8 compatibility** verified
   - **Spotless formatting** applied
   - **Maven build successful:**
     ```bash
     mvn clean compile test -Dtest="*SqlServer*"


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to