1
2
3
4
5
6
7
8
9
10
11 package psiprobe.beans.accessors;
12
13 import com.zaxxer.hikari.HikariDataSource;
14
15 import java.sql.SQLException;
16
17 import oracle.ucp.jdbc.PoolDataSourceImpl;
18 import oracle.ucp.jdbc.PoolXADataSourceImpl;
19
20 import org.junit.jupiter.api.Assertions;
21 import org.junit.jupiter.api.BeforeEach;
22 import org.junit.jupiter.api.Test;
23
24
25
26
27 class OracleUcpDatasourceAccessorTest {
28
29
30 OracleUcpDatasourceAccessor accessor;
31
32
33 PoolDataSourceImpl source;
34
35 PoolXADataSourceImpl xaSource;
36
37
38 HikariDataSource badSource;
39
40
41
42
43 @BeforeEach
44 void before() {
45 accessor = new OracleUcpDatasourceAccessor();
46 source = new PoolDataSourceImpl();
47 xaSource = new PoolXADataSourceImpl();
48 badSource = new HikariDataSource();
49 }
50
51
52
53
54 @Test
55 void canMapTest() {
56 Assertions.assertTrue(accessor.canMap(source));
57 }
58
59
60
61
62 @Test
63 void canMapXATest() {
64 Assertions.assertTrue(accessor.canMap(xaSource));
65 }
66
67
68
69
70 @Test
71 void cannotMapTest() {
72 Assertions.assertFalse(accessor.canMap(badSource));
73 }
74
75
76
77
78
79
80 @Test
81 void getInfoTest() throws SQLException {
82 Assertions.assertNotNull(accessor.getInfo(source));
83 }
84
85 }