22using System . Threading ;
33using System . Threading . Tasks ;
44using Apache . Arrow . Adbc . Drivers . Databricks . Auth ;
5- using Apache . Arrow . Adbc . Tests ;
6- using Apache . Arrow . Adbc . Tests . Drivers . Apache . Spark ;
5+ using Apache . Arrow . Adbc . Tests . Drivers . Databricks ;
76using Xunit ;
87using Xunit . Abstractions ;
98
109namespace Apache . Arrow . Adbc . Tests . Drivers . Databricks . Auth
1110{
12- public class OAuthClientCredentialsServiceTests : TestBase < SparkTestConfiguration , SparkTestEnvironment > , IDisposable
11+ public class OAuthClientCredentialsServiceTests : TestBase < DatabricksTestConfiguration , DatabricksTestEnvironment > , IDisposable
1312 {
1413 private readonly OAuthClientCredentialsService _service ;
1514
1615 public OAuthClientCredentialsServiceTests ( ITestOutputHelper ? outputHelper )
17- : base ( outputHelper , new SparkTestEnvironment . Factory ( ) )
16+ : base ( outputHelper , new DatabricksTestEnvironment . Factory ( ) )
1817 {
1918 _service = new OAuthClientCredentialsService (
20- TestConfiguration . Username ,
21- TestConfiguration . Password ,
19+ TestConfiguration . OAuthClientId ,
20+ TestConfiguration . OAuthClientSecret ,
2221 new Uri ( TestConfiguration . Uri ) ,
2322 timeoutMinutes : 1 ) ;
2423 }
2524
2625 [ Fact ]
2726 public async Task GetAccessToken_WithValidCredentials_ReturnsToken ( )
2827 {
28+ Skip . IfNot ( ! string . IsNullOrEmpty ( TestConfiguration . OAuthClientId ) , "OAuth credentials not configured" ) ;
29+
2930 var token = await _service . GetAccessTokenAsync ( CancellationToken . None ) ;
3031
3132 Assert . NotNull ( token ) ;
@@ -35,16 +36,20 @@ public async Task GetAccessToken_WithValidCredentials_ReturnsToken()
3536 [ Fact ]
3637 public async Task GetAccessToken_WithCancellation_ThrowsOperationCanceledException ( )
3738 {
39+ Skip . IfNot ( ! string . IsNullOrEmpty ( TestConfiguration . OAuthClientId ) , "OAuth credentials not configured" ) ;
40+
3841 using var cts = new CancellationTokenSource ( ) ;
3942 cts . Cancel ( ) ;
4043
41- await Assert . ThrowsAsync < OperationCanceledException > ( ( ) =>
44+ await Assert . ThrowsAsync < TaskCanceledException > ( ( ) =>
4245 _service . GetAccessTokenAsync ( cts . Token ) ) ;
4346 }
4447
4548 [ Fact ]
4649 public async Task GetAccessToken_MultipleCalls_ReusesCachedToken ( )
4750 {
51+ Skip . IfNot ( ! string . IsNullOrEmpty ( TestConfiguration . OAuthClientId ) , "OAuth credentials not configured" ) ;
52+
4853 var token1 = await _service . GetAccessTokenAsync ( CancellationToken . None ) ;
4954 var token2 = await _service . GetAccessTokenAsync ( CancellationToken . None ) ;
5055
0 commit comments