2727public class ClientTests extends BaseIntegrationTest {
2828 private static final Logger LOGGER = LoggerFactory .getLogger (ClientTests .class );
2929
30- @ Test (dataProvider = "clientProvider " )
30+ @ Test (groups = { "integration" }, dataProvider = "secureClientProvider " )
3131 public void testAddSecureEndpoint (Client client ) {
3232 if (isCloud ()) {
3333 return ; // will fail in other tests
@@ -52,31 +52,35 @@ public void testAddSecureEndpoint(Client client) {
5252 }
5353 }
5454
55- @ DataProvider ( name = "clientProvider" )
56- private static Client [] secureClientProvider () throws Exception {
55+ @ DataProvider
56+ public static Object [] [] secureClientProvider () throws Exception {
5757 ClickHouseNode node = ClickHouseServerForTest .getClickHouseNode (ClickHouseProtocol .HTTP ,
5858 true , ClickHouseNode .builder ()
5959 .addOption (ClickHouseClientOption .SSL_MODE .getKey (), "none" )
6060 .addOption (ClickHouseClientOption .SSL .getKey (), "true" ).build ());
61- return new Client []{
62- new Client .Builder ()
63- .addEndpoint ("https://" + node .getHost () + ":" + node .getPort ())
64- .setUsername ("default" )
65- .setPassword ("" )
66- .setRootCertificate ("containers/clickhouse-server/certs/localhost.crt" )
67- .build (),
68- new Client .Builder ()
69- .addEndpoint (Protocol .HTTP , node .getHost (), node .getPort (), true )
70- .setUsername ("default" )
71- .setPassword ("" )
72- .setRootCertificate ("containers/clickhouse-server/certs/localhost.crt" )
73- .setClientKey ("user.key" )
74- .setClientCertificate ("user.crt" )
75- .build ()
61+ return new Client [][]{
62+ {
63+ new Client .Builder ()
64+ .addEndpoint ("https://" + node .getHost () + ":" + node .getPort ())
65+ .setUsername ("default" )
66+ .setPassword ("" )
67+ .setRootCertificate ("containers/clickhouse-server/certs/localhost.crt" )
68+ .build ()
69+ },
70+ {
71+ new Client .Builder ()
72+ .addEndpoint (Protocol .HTTP , node .getHost (), node .getPort (), true )
73+ .setUsername ("default" )
74+ .setPassword ("" )
75+ .setRootCertificate ("containers/clickhouse-server/certs/localhost.crt" )
76+ .setClientKey ("user.key" )
77+ .setClientCertificate ("user.crt" )
78+ .build ()
79+ }
7680 };
7781 }
7882
79- @ Test
83+ @ Test ( groups = { "integration" })
8084 public void testRawSettings () {
8185 Client client = newClient ()
8286 .setOption ("custom_setting_1" , "value_1" )
@@ -102,33 +106,39 @@ public void testRawSettings() {
102106 }
103107 }
104108
105- @ Test
109+ @ Test ( groups = { "integration" })
106110 public void testPing () {
107111 try (Client client = newClient ().build ()) {
108112 Assert .assertTrue (client .ping ());
109113 }
110114 }
111115
112- @ Test
116+ @ Test ( groups = { "integration" })
113117 public void testPingUnpooled () {
114118 try (Client client = newClient ().enableConnectionPool (false ).build ()) {
115119 Assert .assertTrue (client .ping ());
116120 }
117121 }
118122
119- @ Test
123+ @ Test ( groups = { "integration" })
120124 public void testPingFailure () {
121125 try (Client client = new Client .Builder ()
122126 .addEndpoint ("http://localhost:12345" )
123127 .setUsername ("default" )
124128 .setPassword ("" )
125- .useNewImplementation (System .getProperty ("client.tests.useNewImplementation" , "false" ).equals ("true" ))
126129 .build ()) {
127130 Assert .assertFalse (client .ping (TimeUnit .SECONDS .toMillis (20 )));
128131 }
129132 }
130133
131- @ Test
134+ @ Test (groups = {"integration" })
135+ public void testPingAsync () {
136+ try (Client client = newClient ().useAsyncRequests (true ).build ()) {
137+ Assert .assertTrue (client .ping ());
138+ }
139+ }
140+
141+ @ Test (groups = {"integration" })
132142 public void testSetOptions () {
133143 Map <String , String > options = new HashMap <>();
134144 String productName = "my product_name (version 1.0)" ;
@@ -140,7 +150,7 @@ public void testSetOptions() {
140150 }
141151 }
142152
143- @ Test
153+ @ Test ( groups = { "integration" })
144154 public void testProvidedExecutor () throws Exception {
145155
146156 ExecutorService executorService = Executors .newSingleThreadExecutor ();
@@ -159,19 +169,19 @@ public void testProvidedExecutor() throws Exception {
159169 Assert .assertFalse (flag .get ());
160170 }
161171
162- @ Test
172+ @ Test ( groups = { "integration" })
163173 public void testLoadingServerContext () throws Exception {
164174 long start = System .nanoTime ();
165175 try (Client client = newClient ().build ()) {
166176 long initTime = (System .nanoTime () - start ) / 1_000_000 ;
167177 Assert .assertTrue (initTime < 100 );
168- Assert .assertNull (client .getServerVersion ());
178+ Assert .assertEquals (client .getServerVersion (), "unknown" );
169179 client .loadServerInfo ();
170180 Assert .assertNotNull (client .getServerVersion ());
171181 }
172182 }
173183
174- @ Test
184+ @ Test ( groups = { "integration" })
175185 public void testDisableNative () {
176186 try (Client client = newClient ().disableNativeCompression (true ).build ()) {
177187 Assert .assertTrue (client .toString ().indexOf ("JavaUnsafe" ) != -1 );
@@ -185,7 +195,6 @@ protected Client.Builder newClient() {
185195 .addEndpoint (Protocol .HTTP , node .getHost (), node .getPort (), isSecure )
186196 .setUsername ("default" )
187197 .setPassword (ClickHouseServerForTest .getPassword ())
188- .setDefaultDatabase (ClickHouseServerForTest .getDatabase ())
189- .useNewImplementation (System .getProperty ("client.tests.useNewImplementation" , "true" ).equals ("true" ));
198+ .setDefaultDatabase (ClickHouseServerForTest .getDatabase ());
190199 }
191200}
0 commit comments