Skip to content

Commit 6a12501

Browse files
committed
Add tag xAzureSQLDB
1 parent c830543 commit 6a12501

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

src/test/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionTest.java

+16
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package com.microsoft.sqlserver.jdbc;
66

77
import static org.junit.jupiter.api.Assertions.assertEquals;
8+
import static org.junit.jupiter.api.Assertions.assertNotNull;
89
import static org.junit.jupiter.api.Assertions.assertThrows;
910
import static org.junit.jupiter.api.Assertions.assertTrue;
1011
import static org.junit.jupiter.api.Assertions.fail;
@@ -1370,4 +1371,19 @@ public void testGetSqlFedAuthTokenFailureNagativeWaiting() throws SQLException {
13701371
}
13711372
}
13721373

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+
13731389
}

src/test/java/com/microsoft/sqlserver/jdbc/fedauth/FedauthTest.java

-13
Original file line numberDiff line numberDiff line change
@@ -505,19 +505,6 @@ public void testAccessTokenCache() {
505505

506506
}
507507

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-
521508
private static void validateException(String url, String resourceKey) {
522509
try (Connection conn = DriverManager.getConnection(url)) {
523510
fail(TestResource.getResource("R_expectedFailPassed"));

0 commit comments

Comments
 (0)