Commit 6a12501 1 parent c830543 commit 6a12501 Copy full SHA for 6a12501
File tree 2 files changed +16
-13
lines changed
src/test/java/com/microsoft/sqlserver/jdbc
2 files changed +16
-13
lines changed Original file line number Diff line number Diff line change 5
5
package com .microsoft .sqlserver .jdbc ;
6
6
7
7
import static org .junit .jupiter .api .Assertions .assertEquals ;
8
+ import static org .junit .jupiter .api .Assertions .assertNotNull ;
8
9
import static org .junit .jupiter .api .Assertions .assertThrows ;
9
10
import static org .junit .jupiter .api .Assertions .assertTrue ;
10
11
import static org .junit .jupiter .api .Assertions .fail ;
@@ -1370,4 +1371,19 @@ public void testGetSqlFedAuthTokenFailureNagativeWaiting() throws SQLException {
1370
1371
}
1371
1372
}
1372
1373
1374
+ @ Test
1375
+ @ Tag (Constants .xAzureSQLDB )
1376
+ public void testManagedIdentityWithEncryptStrict () {
1377
+ SQLServerDataSource ds = new SQLServerDataSource ();
1378
+ ds .setURL (connectionString );
1379
+ ds .setAuthentication ("ActiveDirectoryMSI" );
1380
+ ds .setEncrypt ("strict" );
1381
+
1382
+ try (Connection con = ds .getConnection ()) {
1383
+ assertTrue (con .isValid (0 ), "Connection should be valid" );
1384
+ } catch (SQLException e ) {
1385
+ fail ("Connection failed: " + e .getMessage ());
1386
+ }
1387
+ }
1388
+
1373
1389
}
Original file line number Diff line number Diff line change @@ -505,19 +505,6 @@ public void testAccessTokenCache() {
505
505
506
506
}
507
507
508
- @ Test
509
- public void testManagedIdentityWithEncryptStrict () throws SQLException {
510
- String url = "jdbc:sqlserver://" + azureServer + ";database=" + azureDatabase + ";authentication=ActiveDirectoryMSI;encrypt=strict;" ;
511
- SQLServerDataSource ds = new SQLServerDataSource ();
512
- ds .setURL (url );
513
-
514
- try (Connection conn = ds .getConnection ()) {
515
- assertNotNull (conn );
516
- } catch (SQLException e ) {
517
- fail ("Expected connection to succeed with encrypt=strict, but it failed with error: " + e .getMessage ());
518
- }
519
- }
520
-
521
508
private static void validateException (String url , String resourceKey ) {
522
509
try (Connection conn = DriverManager .getConnection (url )) {
523
510
fail (TestResource .getResource ("R_expectedFailPassed" ));
You can’t perform that action at this time.
0 commit comments