99import java .sql .Statement ;
1010import java .util .Properties ;
1111
12- import static org .assertj .core .api .Assertions .assertThatThrownBy ;
13-
1412@ Test (timeOut = 10000 )
1513public class TestDatabendDriverUri {
1614 private static DatabendDriverUri createDriverUri (String url )
@@ -21,12 +19,15 @@ private static DatabendDriverUri createDriverUri(String url)
2119 }
2220
2321 private static void assertInvalid (String url , String prefix ) {
24- assertThatThrownBy (() -> createDriverUri (url ))
25- .isInstanceOf (SQLException .class )
26- .hasMessageStartingWith (prefix );
22+ SQLException exception = Assert .expectThrows (SQLException .class , () -> createDriverUri (url ));
23+ String msg = exception .getMessage ();
24+ Assert .assertTrue (
25+ msg .startsWith (prefix ),
26+ "error message not start with " + prefix + ":" + msg
27+ );
2728 }
2829
29- @ Test (groups = {"unit " })
30+ @ Test (groups = {"UNIT " })
3031 public void testInvalidUri () {
3132 // missing jdbc: prefix
3233 assertInvalid ("test" , "Invalid JDBC URL: test" );
@@ -38,15 +39,15 @@ public void testInvalidUri() {
3839
3940 }
4041
41- @ Test (groups = {"unit " })
42+ @ Test (groups = {"UNIT " })
4243 public void testBasic () throws SQLException {
4344 DatabendDriverUri uri = DatabendDriverUri .create ("jdbc:databend://http://localhost" , null );
4445 Assert .assertEquals (uri .getUri ().getScheme (), "http" );
4546 Assert .assertEquals (uri .getUri ().getHost (), "localhost" );
4647 Assert .assertEquals (uri .getUri ().getPort (), 8000 );
4748 }
4849
49- @ Test (groups = {"unit " })
50+ @ Test (groups = {"UNIT " })
5051 public void testMultiHost () throws SQLException {
5152 DatabendDriverUri uri = DatabendDriverUri .create ("jdbc:databend://localhost,localhost:9991,localhost:31919/d2?ssl=true" , null );
5253 Assert .assertEquals (uri .getNodes ().getUris ().size (), 3 );
@@ -61,7 +62,7 @@ public void testMultiHost() throws SQLException {
6162 Assert .assertEquals (uri .getNodes ().getUris ().get (2 ).getPort (), 31919 );
6263 }
6364
64- @ Test (groups = {"unit " })
65+ @ Test (groups = {"UNIT " })
6566 public void testSameHost () throws SQLException {
6667 DatabendDriverUri uri = DatabendDriverUri .create ("jdbc:databend://u1:p1@localhost,localhost:9991,localhost/d2?ssl=false" , null );
6768 System .out .println (uri .getNodes ().toString ());
@@ -77,7 +78,7 @@ public void testSameHost() throws SQLException {
7778 Assert .assertEquals (uri .getNodes ().getUris ().get (1 ).getPort (), 9991 );
7879 }
7980
80- @ Test (groups = {"unit " })
81+ @ Test (groups = {"UNIT " })
8182 public void testDefaultSSL () throws SQLException {
8283 DatabendDriverUri uri = DatabendDriverUri .create ("jdbc:databend://localhost" , null );
8384
@@ -86,7 +87,7 @@ public void testDefaultSSL() throws SQLException {
8687 Assert .assertEquals (uri .getUri ().getPort (), 8000 );
8788 }
8889
89- @ Test (groups = {"unit " })
90+ @ Test (groups = {"UNIT " })
9091 public void testSSLSetFalse () throws SQLException {
9192 DatabendDriverUri uri = DatabendDriverUri .create ("jdbc:databend://localhost?SSL=false" , null );
9293
@@ -95,7 +96,7 @@ public void testSSLSetFalse() throws SQLException {
9596 Assert .assertEquals (uri .getUri ().getPort (), 8000 );
9697 }
9798
98- @ Test (groups = {"unit " })
99+ @ Test (groups = {"UNIT " })
99100 public void testSSLSetTrue () throws SQLException {
100101 DatabendDriverUri uri = DatabendDriverUri .create ("jdbc:databend://localhost?ssl=true" , null );
101102
@@ -104,7 +105,7 @@ public void testSSLSetTrue() throws SQLException {
104105 Assert .assertEquals (uri .getUri ().getPort (), 443 );
105106 }
106107
107- @ Test (groups = {"unit " })
108+ @ Test (groups = {"UNIT " })
108109 public void testSSLCustomPort () throws SQLException {
109110 DatabendDriverUri uri = DatabendDriverUri .create ("jdbc:databend://localhost:33101" , null );
110111
@@ -113,7 +114,7 @@ public void testSSLCustomPort() throws SQLException {
113114 Assert .assertEquals (uri .getUri ().getPort (), 33101 );
114115 }
115116
116- @ Test (groups = {"unit " })
117+ @ Test (groups = {"UNIT " })
117118 public void testSSLCustomPort2 () throws SQLException {
118119 DatabendDriverUri uri = DatabendDriverUri .create ("jdbc:databend://http://localhost:33101" , null );
119120
@@ -123,7 +124,7 @@ public void testSSLCustomPort2() throws SQLException {
123124
124125 }
125126
126- @ Test (groups = {"unit " })
127+ @ Test (groups = {"UNIT " })
127128 public void testUser () throws SQLException {
128129 DatabendDriverUri uri = DatabendDriverUri .create ("jdbc:databend://u1@localhost:33101?password=p1" , null );
129130
@@ -132,7 +133,7 @@ public void testUser() throws SQLException {
132133 Assert .assertEquals (uri .getDatabase (), "default" );
133134 }
134135
135- @ Test (groups = {"unit " })
136+ @ Test (groups = {"UNIT " })
136137 public void testUserDatabase () throws SQLException {
137138 DatabendDriverUri uri = DatabendDriverUri .create ("jdbc:databend://u1@localhost:33101/db1?password=p1" , null );
138139
@@ -141,7 +142,7 @@ public void testUserDatabase() throws SQLException {
141142 Assert .assertEquals (uri .getDatabase (), "db1" );
142143 }
143144
144- @ Test (groups = {"unit " })
145+ @ Test (groups = {"UNIT " })
145146 public void testUserDatabasePath () throws SQLException {
146147 DatabendDriverUri uri = DatabendDriverUri .create ("jdbc:databend://u1@localhost:33101/db1?password=p1&database=db2" , null );
147148
@@ -150,7 +151,7 @@ public void testUserDatabasePath() throws SQLException {
150151 Assert .assertEquals (uri .getDatabase (), "db2" );
151152 }
152153
153- @ Test (groups = {"unit " })
154+ @ Test (groups = {"UNIT " })
154155 public void testUserDatabaseProp () throws SQLException {
155156 Properties props = new Properties ();
156157 props .setProperty ("database" , "db3" );
@@ -178,7 +179,7 @@ public void testUserDatabaseProp() throws SQLException {
178179 Assert .assertEquals ("enable" , uri .getSslmode ().toString ());
179180 }
180181
181- @ Test (groups = {"unit " })
182+ @ Test (groups = {"UNIT " })
182183 public void testUserDatabasePropFull () throws SQLException {
183184 Properties props = new Properties ();
184185 props .setProperty ("database" , "db3" );
@@ -202,7 +203,7 @@ public void testUserDatabasePropFull() throws SQLException {
202203 Assert .assertEquals ("" , uri .binaryFormat ().toString ());
203204 }
204205
205- @ Test (groups = {"unit " })
206+ @ Test (groups = {"UNIT " })
206207 public void testFull () throws SQLException {
207208 Properties props = new Properties ();
208209 props .setProperty ("database" , "db3" );
@@ -235,7 +236,7 @@ public void testFull() throws SQLException {
235236 Assert .assertEquals (false , uri .getStrNullAsNull ());
236237 }
237238
238- @ Test
239+ @ Test ( groups = "IT" )
239240 public void TestSetSchema () throws SQLException {
240241 DatabendConnection connection = (DatabendConnection ) Utils .createConnection ();
241242 try {
@@ -249,7 +250,7 @@ public void TestSetSchema() throws SQLException {
249250 connection .createStatement ().execute ("insert into test2 values (1)" );
250251 }
251252
252- @ Test
253+ @ Test ( groups = "IT" )
253254 public void TestSetSessionSettings () throws SQLException {
254255 Properties props = new Properties ();
255256 // set session settings
0 commit comments