forked from utPLSQL/utPLSQL-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConnectionConfigTest.java
More file actions
57 lines (45 loc) · 1.86 KB
/
ConnectionConfigTest.java
File metadata and controls
57 lines (45 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package org.utplsql.cli;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class ConnectionConfigTest {
@Test
void parse() {
ConnectionConfig info = new ConnectionConfig("test/pw@my.local.host/service");
assertEquals("test", info.getUser());
assertEquals("pw", info.getPassword());
assertEquals("my.local.host/service", info.getConnect());
assertFalse(info.isSysDba());
}
@Test
void parseSysDba() {
ConnectionConfig info = new ConnectionConfig("sys as sysdba/pw@my.local.host/service");
assertEquals("sys as sysdba", info.getUser());
assertEquals("pw", info.getPassword());
assertEquals("my.local.host/service", info.getConnect());
assertTrue(info.isSysDba());
}
@Test
void parseSysOper() {
ConnectionConfig info = new ConnectionConfig("myOperUser as sysoper/passw0rd@my.local.host/service");
assertEquals("myOperUser as sysoper", info.getUser());
assertEquals("passw0rd", info.getPassword());
assertEquals("my.local.host/service", info.getConnect());
assertTrue(info.isSysDba());
}
@Test
void parseSpecialCharsPW() {
ConnectionConfig info = new ConnectionConfig("test/\"p@ssw0rd=\"@my.local.host/service");
assertEquals("test", info.getUser());
assertEquals("p@ssw0rd=", info.getPassword());
assertEquals("my.local.host/service", info.getConnect());
assertFalse(info.isSysDba());
}
@Test
void parseSpecialCharsUser() {
ConnectionConfig info = new ConnectionConfig("\"User/Mine@=\"/pw@my.local.host/service");
assertEquals("User/Mine@=", info.getUser());
assertEquals("pw", info.getPassword());
assertEquals("my.local.host/service", info.getConnect());
assertFalse(info.isSysDba());
}
}