77
88import java .sql .DriverPropertyInfo ;
99import java .util .Arrays ;
10- import java .util .Collections ;
1110import java .util .Map ;
1211import java .util .Properties ;
13- import java .util .regex .Matcher ;
14- import java .util .regex .Pattern ;
1512import java .util .stream .Collectors ;
1613
1714import static org .testng .Assert .assertEquals ;
@@ -27,27 +24,31 @@ public void testConnectionUrl(String jdbcUrl, String connectionUrl, Properties p
2724
2825 @ DataProvider (name = "testConnectionUrlDataProvider" )
2926 public static Object [][] testConnectionUrlDataProvider () {
27+ Properties emptyProps = new Properties ();
3028 Properties defaultProps = new Properties ();
3129 defaultProps .setProperty (ClientConfigProperties .USER .getKey (), "default" );
3230 defaultProps .setProperty (ClientConfigProperties .PASSWORD .getKey (), "" );
3331 Properties useSSL = new Properties ();
3432 useSSL .put (JdbcConfiguration .USE_SSL_PROP , "true" );
33+ Properties bearerToken = new Properties ();
34+ bearerToken .put (ClientConfigProperties .BEARERTOKEN_AUTH .getKey (), "jwtToken" );
3535
3636 Map <String , String > defaultParams = Map .of ( "user" , "default" , "password" , "" );
3737 Map <String , String > simpleParams = Map .of ( "database" , "clickhouse" , "param1" , "value1" , "param2" , "value2" , "user" , "default" , "password" , "" );
38- Map <String , String > useSSLParams = Map .of ("ssl" , "true" );
38+ Map <String , String > useSSLParams = Map .of ("database" , "clickhouse" , "ssl" , "true" );
39+ Map <String , String > bearerTokenParams = Map .of ("database" , "clickhouse" , "bearer_token" , "jwtToken" );
3940 Map <String , String > withListParams = Map .of ("database" , "default" , "param1" , "value1" , "custom_header1" , "val1,val2,val3" , "user" , "default" , "password" , "" );
4041 Map <String , String > withListParamsQuotes = Map .of ("database" , "default" , "param1" , "value1" , "custom_header1" , "\" role 1,3,4\" ,'val2',val3" , "user" , "default" , "password" , "" );
4142
42-
4343 return new Object [][] {
4444 {"jdbc:clickhouse://localhost:8123/" , "http://localhost:8123" , defaultProps , defaultParams },
4545 {"jdbc:clickhouse://localhost:8443/clickhouse?param1=value1¶m2=value2" , "http://localhost:8443" , defaultProps , simpleParams },
4646 {"jdbc:clickhouse:https://localhost:8123/clickhouse?param1=value1¶m2=value2" , "https://localhost:8123" , defaultProps , simpleParams },
47- {"jdbc:clickhouse://localhost:8443/" , "https://localhost:8443" , useSSL , useSSLParams },
47+ {"jdbc:clickhouse://localhost:8443/clickhouse" , "https://localhost:8443" , useSSL , useSSLParams },
48+ {"jdbc:clickhouse://localhost:8443/clickhouse?ssl=true" , "https://localhost:8443" , emptyProps , useSSLParams },
49+ {"jdbc:clickhouse://localhost:8443/clickhouse" , "http://localhost:8443" , bearerToken , bearerTokenParams },
4850 {"jdbc:clickhouse://localhost:8443/default?param1=value1&custom_header1=val1,val2,val3" , "http://localhost:8443" , defaultProps , withListParams },
4951 {"jdbc:clickhouse://localhost:8443/default?custom_header1=\" role 1,3,4\" ,'val2',val3¶m1=value1" , "http://localhost:8443" , defaultProps , withListParamsQuotes },
50-
5152 };
5253 }
5354
0 commit comments