11
11
import org .junit .jupiter .api .Test ;
12
12
13
13
@ Tag (TestTags .AUTHENTICATION )
14
- class ExternalBrowserIT {
14
+ class ExternalBrowserLatestIT {
15
15
16
16
String login = AuthConnectionParameters .SSO_USER ;
17
17
String password = AuthConnectionParameters .SSO_PASSWORD ;
18
- AuthTest authTest = new AuthTest ();
18
+ AuthTestHelper authTestHelper = new AuthTestHelper ();
19
19
20
20
@ BeforeEach
21
21
public void setUp () throws IOException {
22
- AuthTest .deleteIdToken ();
22
+ AuthTestHelper .deleteIdToken ();
23
23
}
24
24
25
25
@ AfterEach
26
26
public void tearDown () {
27
- authTest .cleanBrowserProcesses ();
28
- AuthTest .deleteIdToken ();
27
+ authTestHelper .cleanBrowserProcesses ();
28
+ AuthTestHelper .deleteIdToken ();
29
29
}
30
30
31
31
@ Test
32
32
void shouldAuthenticateUsingExternalBrowser () throws InterruptedException {
33
33
Thread provideCredentialsThread =
34
- new Thread (() -> authTest .provideCredentials ("success" , login , password ));
34
+ new Thread (() -> authTestHelper .provideCredentials ("success" , login , password ));
35
35
Thread connectThread =
36
- authTest .getConnectAndExecuteSimpleQueryThread (getExternalBrowserConnectionParameters ());
36
+ authTestHelper .getConnectAndExecuteSimpleQueryThread (
37
+ getExternalBrowserConnectionParameters ());
37
38
38
- authTest .connectAndProvideCredentials (provideCredentialsThread , connectThread );
39
- authTest .verifyExceptionIsNotThrown ();
39
+ authTestHelper .connectAndProvideCredentials (provideCredentialsThread , connectThread );
40
+ authTestHelper .verifyExceptionIsNotThrown ();
40
41
}
41
42
42
43
@ Test
43
44
void shouldThrowErrorForMismatchedUsername () throws InterruptedException {
44
45
Properties properties = getExternalBrowserConnectionParameters ();
45
46
properties .put ("user" , "differentUsername" );
46
47
Thread provideCredentialsThread =
47
- new Thread (() -> authTest .provideCredentials ("success" , login , password ));
48
- Thread connectThread = authTest .getConnectAndExecuteSimpleQueryThread (properties );
48
+ new Thread (() -> authTestHelper .provideCredentials ("success" , login , password ));
49
+ Thread connectThread = authTestHelper .getConnectAndExecuteSimpleQueryThread (properties );
49
50
50
- authTest .connectAndProvideCredentials (provideCredentialsThread , connectThread );
51
- authTest .verifyExceptionIsThrown (
51
+ authTestHelper .connectAndProvideCredentials (provideCredentialsThread , connectThread );
52
+ authTestHelper .verifyExceptionIsThrown (
52
53
"The user you were trying to authenticate as differs from the user currently logged in at the IDP." );
53
54
}
54
55
@@ -57,26 +58,26 @@ void shouldThrowErrorForWrongCredentials() throws InterruptedException {
57
58
String login = "itsnotanaccount.com" ;
58
59
String password = "fakepassword" ;
59
60
Thread provideCredentialsThread =
60
- new Thread (() -> authTest .provideCredentials ("fail" , login , password ));
61
+ new Thread (() -> authTestHelper .provideCredentials ("fail" , login , password ));
61
62
Thread connectThread =
62
- authTest .getConnectAndExecuteSimpleQueryThread (
63
+ authTestHelper .getConnectAndExecuteSimpleQueryThread (
63
64
getExternalBrowserConnectionParameters (), "BROWSER_RESPONSE_TIMEOUT=10" );
64
65
65
- authTest .connectAndProvideCredentials (provideCredentialsThread , connectThread );
66
- authTest .verifyExceptionIsThrown (
66
+ authTestHelper .connectAndProvideCredentials (provideCredentialsThread , connectThread );
67
+ authTestHelper .verifyExceptionIsThrown (
67
68
"JDBC driver encountered communication error. Message: External browser authentication failed within timeout of 10000 milliseconds." );
68
69
}
69
70
70
71
@ Test
71
72
void shouldThrowErrorForBrowserTimeout () throws InterruptedException {
72
73
Thread provideCredentialsThread =
73
- new Thread (() -> authTest .provideCredentials ("timeout" , login , password ));
74
+ new Thread (() -> authTestHelper .provideCredentials ("timeout" , login , password ));
74
75
Thread connectThread =
75
- authTest .getConnectAndExecuteSimpleQueryThread (
76
+ authTestHelper .getConnectAndExecuteSimpleQueryThread (
76
77
getExternalBrowserConnectionParameters (), "BROWSER_RESPONSE_TIMEOUT=1" );
77
78
78
- authTest .connectAndProvideCredentials (provideCredentialsThread , connectThread );
79
- authTest .verifyExceptionIsThrown (
79
+ authTestHelper .connectAndProvideCredentials (provideCredentialsThread , connectThread );
80
+ authTestHelper .verifyExceptionIsThrown (
80
81
"JDBC driver encountered communication error. Message: External browser authentication failed within timeout of 1000 milliseconds." );
81
82
}
82
83
}
0 commit comments