File tree Expand file tree Collapse file tree 3 files changed +25
-1
lines changed
src/test/java/com/microsoft/sqlserver Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ public class FedauthCommon extends AbstractTest {
145145 static final String ERR_MSG_REQUEST_THROTTLED = "Request was throttled" ;
146146 static final String ERR_FAILED_FEDAUTH = TestResource .getResource ("R_failedFedauth" );
147147
148- enum SqlAuthentication {
148+ public enum SqlAuthentication {
149149 NotSpecified ,
150150 SqlPassword ,
151151 ActiveDirectoryPassword ,
Original file line number Diff line number Diff line change @@ -491,6 +491,20 @@ public void testUnprocessedResponseCountSuccessfulIdleConnectionRecovery() throw
491491 }
492492 }
493493
494+ @ Test
495+ public void testAccessTokenInReconnect () throws SQLException {
496+ // Should use adIntegratedConnectionStr
497+ try (Connection c = DriverManager .getConnection (adIntegratedConnectionStr );
498+ Statement s = c .createStatement ()) {
499+ s .executeQuery ("SELECT 1" );
500+ ResiliencyUtils .killConnection (c , adIntegratedConnectionStr , 0 );
501+ s .executeQuery ("SELECT 1" );
502+ } catch (SQLException e ) {
503+ fail (TestResource .getResource ("R_expectedFailPassed" ));
504+ }
505+ }
506+
507+
494508 private void basicReconnect (String connectionString ) throws SQLException {
495509 // Ensure reconnects can happen multiple times over the same connection and subsequent connections
496510 for (int i1 = 0 ; i1 < 2 ; i1 ++) {
Original file line number Diff line number Diff line change 5050import com .microsoft .sqlserver .jdbc .SQLServerXADataSource ;
5151import com .microsoft .sqlserver .jdbc .TestResource ;
5252import com .microsoft .sqlserver .jdbc .TestUtils ;
53+ import com .microsoft .sqlserver .jdbc .fedauth .FedauthCommon .SqlAuthentication ;
5354
5455
5556/**
@@ -118,6 +119,10 @@ public abstract class AbstractTest {
118119 protected static String connectionString = null ;
119120 protected static String connectionStringNTLM ;
120121 protected static String connectionStringKerberos ;
122+
123+ protected static String azureServer = null ;
124+ protected static String azureDatabase = null ;
125+ protected static String adIntegratedConnectionStr ;
121126
122127 protected static ConfidentialClientApplication fedauthClientApp = null ;
123128
@@ -184,6 +189,11 @@ public static void setup() throws Exception {
184189 connectionString = TestUtils .addOrOverrideProperty (connectionString , "trustServerCertificate" ,
185190 trustServerCertificate );
186191
192+ azureServer = getConfiguredProperty ("azureServer" );
193+ azureDatabase = getConfiguredProperty ("azureDatabase" );
194+ adIntegratedConnectionStr = "jdbc:sqlserver://" + azureServer + ";database=" + azureDatabase
195+ + ";Authentication=" + SqlAuthentication .ActiveDirectoryIntegrated .toString ();
196+
187197 javaKeyPath = TestUtils .getCurrentClassPath () + Constants .JKS_NAME ;
188198
189199 keyIDs = getConfiguredProperty ("keyID" , "" ).split (Constants .SEMI_COLON );
You can’t perform that action at this time.
0 commit comments